context = aConfig.getServletContext();
if (context != null)
context.log("ServiceManager: HOTHOT Loading service: "+theService);
Properties props = new Properties();
try {
props.load(context.getResourceAsStream(aServiceConfigFile));
} catch (IOException exc) {
if (context != null)
context.log("ServiceManager: File \"" + aServiceConfigFile
+ "\" cannot be found or read.");
throw new Exception("ServiceManager: File \"" + aServiceConfigFile
+ "\" cannot be found or read.");
}
int numAll = 0;
int numSuccessful = 0;
for (Iterator iter = props.names(); iter.hasNext();) {
String serviceBaseName = (String) iter.next();
if (serviceBaseName.equals(theService)) {
context.log("ServiceManager: Service "+theService+" FOUND!!");
numAll++;
// ty to get hold of the base service
Class serviceBase;
try {
serviceBase = Class.forName(serviceBaseName);
} catch (ClassNotFoundException exc) {
if (context != null)
context.log("ServiceManager: A service with name "
+ serviceBaseName + " cannot be found.");
continue;
}
String serviceImplName = props.getString(serviceBaseName);
Class serviceImpl = null;
Service service = null;
try {
serviceImpl = Class.forName(serviceImplName);
service = (Service) serviceImpl.newInstance();
Properties serviceProps = new Properties();
try {
InputStream is = null;
is = context.getResourceAsStream(aServiceConfigDir
+ StringUtils.nameOf(serviceImpl)
+ ".properties");
if (is == null)
is = context.getResourceAsStream(aServiceConfigDir
+ StringUtils.nameOf(serviceBase)
+ ".properties");
if (is != null)
serviceProps.load(is);
} catch (IOException exc) {
// ignore -- we go without properties then
}
if (context != null)
context.log(StringUtils.nameOf(serviceBase)