if (!entry.hasPropertyWithName(JposEntry.SERVICE_CLASS_PROP_NAME)) {
throw new JposException(JposConst.JPOS_E_NOSERVICE, "serviceClass property not found!");
}
String className = (String) entry.getPropertyValue(JposEntry.SERVICE_CLASS_PROP_NAME);
BaseService service = (BaseService) serviceMap.get(className);
if (service != null) {
service.setEntry(entry);
} else {
try {
Object obj = ObjectType.getInstance(className);
if (obj == null) {
throw new JposException(JposConst.JPOS_E_NOEXIST, "unable to locate serviceClass");
}
if (!(obj instanceof JposServiceInstance)) {
throw new JposException(JposConst.JPOS_E_NOSERVICE, "serviceClass is not an instance of JposServiceInstance");
} else if (!(obj instanceof BaseService)) {
throw new JposException(JposConst.JPOS_E_NOSERVICE, "serviceClass is not an instance of BaseKybService");
} else {
service = (BaseService) obj;
service.setEntry(entry);
serviceMap.put(className, service);
}
} catch (Exception e) {
throw new JposException(JposConst.JPOS_E_NOSERVICE, "Error creating the service instance [" + className + "]", e);
}