// Get service name
String serviceName = self.getName();
// see if we have a ResourceService_impl registered for that name
ResourceService_impl serviceImpl = (ResourceService_impl) mResourceServiceImplMap
.get(serviceName);
if (serviceImpl != null) {
return serviceImpl;
}
// No service impl registered for this service name, attempt to
// create a new one
// Get the Resource Specifier Path
String resourceSpecifierPath = (String) self.getOption(PARAM_RESOURCE_SPECIFIER_PATH);
if (resourceSpecifierPath == null || resourceSpecifierPath.trim().length() == 0) {
throw new Exception("Invalid Configuration - " + PARAM_RESOURCE_SPECIFIER_PATH
+ " not Defined. Check your deployment descriptor file (WSDD)");
}
// parse ResourceSpecifier
ResourceSpecifier resourceSpecifier = UIMAFramework.getXMLParser().parseResourceSpecifier(
new XMLInputSource(resourceSpecifierPath));
// Get the number of instances to create
String numInstancesStr = (String) self.getOption(PARAM_NUM_INSTANCES);
int numInstances;
try {
numInstances = Integer.parseInt(numInstancesStr);
} catch (NumberFormatException e) {
throw new Exception("Invalid Configuration - " + PARAM_NUM_INSTANCES
+ " not valid. Check your deployment descriptor file (WSDD)");
}
// Get whether to enable logging
String enableLogStr = (String) self.getOption(PARAM_ENABLE_LOGGING);
boolean enableLog = "true".equalsIgnoreCase(enableLogStr);
// create and initialize the service implementation
serviceImpl = (ResourceService_impl) aServiceImplClass.newInstance();
HashMap initParams = new HashMap();
initParams.put(AnalysisEngine.PARAM_NUM_SIMULTANEOUS_REQUESTS, new Integer(numInstances));
serviceImpl.initialize(resourceSpecifier, initParams);
// disable logging for Analysis Engines if deployer so indicated
if (!enableLog && serviceImpl instanceof AnalysisEngineService_impl) {
Logger nullLogger = UIMAFramework.newLogger();
nullLogger.setOutputStream(null);