/* Comment copied from interface. */
public ResourceManagementService newResourceManagementService ()
throws FactoryConfigurationError {
if (getResourceAssignmentContext() == null) {
throw new FactoryConfigurationError
("Resource assignment context not configured.");
}
// make fallbacks
Properties fallbacks = new Properties ();
// try to get properties from file
Properties baseProps = new Properties(fallbacks);
try {
InputStream is = DatabaseRmsFactory.class.getResourceAsStream
("/de.danet.an.workflow.rmsimpls.dbrms-factory.properties");
if (is != null) {
baseProps.load (is);
}
} catch (IOException ex) {
}
// Overrides from JNDI
Properties props = new Properties (baseProps);
String[] knownProps = {
"dataSource",
"allUsersQuery",
"allRolesQuery",
"allGroupsQuery",
"userNameQuery",
"roleNameQuery",
"groupNameQuery",
"userLookupQuery",
"roleLookupQuery",
"groupLookupQuery",
"rolesQuery",
"groupsQuery"
};
for (int i = 0; i < knownProps.length; i++) {
try {
String entry = (String)EJBUtil.lookupJNDIEntry
("java:comp/env/de.danet.an.workflow.rmsimpls.dbrms."
+ knownProps[i]);
props.setProperty (knownProps[i], entry);
} catch (NamingException ne) {
// Name not defined
}
}
for (int i = 0; i < knownProps.length; i++) {
if (props.getProperty(knownProps[i]) == null) {
throw new FactoryConfigurationError
("Missing property: " + knownProps[i]);
}
}
return new DatabaseRmsService (props, getResourceAssignmentContext());