private void assertInDeploymentSession(String msg) throws ResourceProcessorException { synchronized (m_lock) { DeploymentSession current = m_sessionRef.get(); if (current == null) { throw new ResourceProcessorException(CODE_OTHER_ERROR, msg); } } }
private void checkMethodFailure(int code, String methodName) throws ResourceProcessorException { if (shouldFail(methodName)) { throw new ResourceProcessorException(code, methodName + " fails forcedly!"); } }
private MetaData parseAutoConfResource(InputStream stream) throws ResourceProcessorException { MetaDataReader reader = new MetaDataReader(); MetaData data = null; try { data = reader.parse(stream); } catch (IOException e) { throw new ResourceProcessorException(CODE_OTHER_ERROR, "Unable to process resource.", e); } if (data == null) { throw new ResourceProcessorException(CODE_OTHER_ERROR, "Supplied configuration is not conform the metatype xml specification."); } return data; } }
public void process(String name, InputStream stream) throws ResourceProcessorException { ensureSession(); String originalDeploymentPackage = m_resourceStore.getDeploymentPackage(name); if ((originalDeploymentPackage != null) && !m_deploymentPackageName.equals(originalDeploymentPackage)) { throw new ResourceProcessorException(ResourceProcessorException.CODE_RESOURCE_SHARING_VIOLATION, "Resource " + name + " does not belong to deployment package " + m_deploymentPackageName + ", but to " + originalDeploymentPackage); } try { m_resourceStore.addResource(m_deploymentPackageName, name, stream); } catch (IOException e) { throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Error storing resource.", e); } m_toInstall.add(name); }
public void dropped(String name) throws ResourceProcessorException { m_log.log(LogService.LOG_DEBUG, "dropped " + name); assertInDeploymentSession("Can not drop resource without a Deployment Session"); Map<String, List<AutoConfResource>> toBeDeleted; synchronized (m_lock) { toBeDeleted = new HashMap<String, List<AutoConfResource>>(m_toBeDeleted); } try { List<AutoConfResource> resources = m_persistencyManager.load(name); if (!toBeDeleted.containsKey(name)) { toBeDeleted.put(name, new ArrayList()); } toBeDeleted.get(name).addAll(resources); } catch (IOException ioe) { throw new ResourceProcessorException(CODE_OTHER_ERROR, "Unable to drop resource: " + name, ioe); } synchronized (m_lock) { m_toBeDeleted.putAll(toBeDeleted); } m_log.log(LogService.LOG_DEBUG, "dropped " + name + " done"); }
private Filter getFilter(MetaData data) throws ResourceProcessorException { Map optionalAttributes = data.getOptionalAttributes(); if (optionalAttributes != null) { try { return FrameworkUtil.createFilter((String) optionalAttributes.get(AutoConfResourceProcessor.CONFIGURATION_ADMIN_FILTER_ATTRIBUTE)); } catch (InvalidSyntaxException e) { throw new ResourceProcessorException(CODE_OTHER_ERROR, "Unable to create filter!", e); } } return null; }
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Error validating resource.", e);
throw new ResourceProcessorException(ResourceProcessorException.CODE_PREPARE, "Unable to read existing resources for resource " + name, ioe);
throw new ResourceProcessorException(CODE_OTHER_ERROR, "Unable to parse value for definition: adref=" + ad.getID()); default: throw new ResourceProcessorException(CODE_OTHER_ERROR, "Unsupported value-type for definition: adref=" + ad.getID()); throw new ResourceProcessorException(CODE_OTHER_ERROR, "Unable to parse value for definition: adref=" + ad.getID());
if (objectDef == null) throw new ResourceProcessorException(CODE_OTHER_ERROR, "Designate Object child missing or invalid"); throw new ResourceProcessorException(CODE_OTHER_ERROR, "Object Attributes child missing or invalid"); if (ocdRef == null || "".equals(ocdRef)) throw new ResourceProcessorException(CODE_OTHER_ERROR, "Object ocdRef attribute missing or invalid"); if (ocd == null) throw new ResourceProcessorException(CODE_OTHER_ERROR, "No Object Class Definition found with id=" + ocdRef);
throw new ResourceProcessorException(CODE_OTHER_ERROR, "Could not match attribute to it's definition: adref=" + adRef); throw new ResourceProcessorException(CODE_OTHER_ERROR, "Could not find attribute definition: adref=" + adRef);
throw new ResourceProcessorException(ResourceProcessorException.CODE_PREPARE, "Unable to read existing resources for resource " + name, ioe); throw new ResourceProcessorException(ResourceProcessorException.CODE_PREPARE, "Existing configuration was bound to " + configuration.getBundleLocation() + " instead of " + bundleLocation);