protected void parse(DeploymentUnit unit, Object dataObj) throws Exception {
Map<String, Map<String, Object>> results = (Map<String, Map<String, Object>>) dataObj;
if (results != null) {
for (String service : results.keySet()) {
Map<String, Object> params = results.get( service );
ServiceMetaData serviceMetaData = new ServiceMetaData();
boolean requiresSingleton = requiresSingleton( params );
serviceMetaData.setRequiresSingleton( requiresSingleton );
String className = service;
Map<String, Object> config = null;
if (params != null) {
if (params.containsKey( "service" )) {
className = (String)params.remove( "service" );
}
if (params.containsKey( "config" )) {
config = (Map<String, Object>)params.remove( "config" );
} else {
if (!params.isEmpty()) {
logDeprecation( unit, "Use the config: key to pass configuration to a service - the method you are using has been deprecated (service: " + service + ")" );
}
config = params;
}
}
serviceMetaData.setClassName( className );
serviceMetaData.setName( service );
serviceMetaData.setParameters( config );
serviceMetaData.setRubyRequirePath( StringUtils.underscore( className.trim() ) );
unit.addToAttachmentList( ServiceMetaData.ATTACHMENTS_KEY, serviceMetaData );
}
}
}