public void process(String name, InputStream stream) throws ResourceProcessorException {
m_log.log(LogService.LOG_DEBUG, "processing " + name);
// initial validation
synchronized (LOCK) {
if (m_session == null) {
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Can not process resource without a Deployment Session");
}
}
MetaDataReader reader = new MetaDataReader();
MetaData data = null;
try {
data = reader.parse(stream);
}
catch (IOException e) {
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Unable to process resource.", e);
}
if (data == null) {
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Supplied configuration is not conform the metatype xml specification.");
}
// process resources
String filter = null;
Map optionalAttributes = data.getOptionalAttributes();
if (optionalAttributes != null) {
filter = (String) optionalAttributes.get(AutoConfResourceProcessor.CONFIGURATION_ADMIN_FILTER_ATTRIBUTE);
}
// add to session data
if (!m_toBeInstalled.containsKey(name)) {
m_toBeInstalled.put(name, new ArrayList());
}
Map designates = data.getDesignates();
if (designates == null) {
// if there are no designates, there's nothing to process
m_log.log(LogService.LOG_INFO, "No designates found in the resource, so there's nothing to process.");
return;
}
Map localOcds = data.getObjectClassDefinitions();
if (localOcds == null) {
localOcds = Collections.EMPTY_MAP;
}
Iterator i = designates.keySet().iterator();
while (i.hasNext()) {
Designate designate = (Designate) designates.get(i.next());
// check object
if (designate.getObject() == null) {
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Designate Object child missing or invalid");
}
// check attributes
if (designate.getObject().getAttributes() == null || designate.getObject().getAttributes().size() == 0) {
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Object Attributes child missing or invalid");
}
// check ocdRef
String ocdRef = designate.getObject().getOcdRef();
if (ocdRef == null || "".equals(ocdRef)) {
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "Object ocdRef attribute missing or invalid");
}
// determine OCD
ObjectClassDefinition ocd = null;
OCD localOcd = (OCD) localOcds.get(ocdRef);
// ask meta type service for matching OCD if no local OCD has been defined
ocd = (localOcd != null) ? new ObjectClassDefinitionImpl(localOcd) : getMetaTypeOCD(data, designate);
if (ocd == null) {
throw new ResourceProcessorException(ResourceProcessorException.CODE_OTHER_ERROR, "No Object Class Definition found with id=" + ocdRef);
}
// determine configuration data based on the values and their type definition
Dictionary dict = getProperties(designate, ocd);
if (dict == null) {
// designate does not match it's definition, but was marked optional, ignore it