use of com.sun.enterprise.connectors.ConnectorRegistry in project Payara by payara.
the class ConnectorDeployer method unregisterBeanValidator.
private void unregisterBeanValidator(String rarName) {
ConnectorRegistry registry = ConnectorRegistry.getInstance();
registry.removeBeanValidator(rarName);
}
use of com.sun.enterprise.connectors.ConnectorRegistry in project Payara by payara.
the class ConnectorsRecoveryResourceHandler method getdbUserPasswordOfConnectorConnectionPool.
private String[] getdbUserPasswordOfConnectorConnectionPool(ConnectorConnectionPool connectorConnectionPool) {
String[] userPassword = new String[2];
userPassword[0] = null;
userPassword[1] = null;
List<Property> properties = connectorConnectionPool.getProperty();
if (properties != null) {
boolean foundUserPassword = false;
for (Property elementProperty : properties) {
String prop = elementProperty.getName().toUpperCase(locale);
if ("USERNAME".equals(prop) || "USER".equals(prop)) {
userPassword[0] = elementProperty.getValue();
foundUserPassword = true;
} else if ("PASSWORD".equals(prop)) {
userPassword[1] = elementProperty.getValue();
foundUserPassword = true;
}
}
if (foundUserPassword == true) {
return userPassword;
}
}
PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(connectorConnectionPool);
String rarName = connectorConnectionPool.getResourceAdapterName();
String connectionDefName = connectorConnectionPool.getConnectionDefinitionName();
ConnectorRegistry connectorRegistry = ConnectorRegistry.getInstance();
ConnectorDescriptor connectorDescriptor = connectorRegistry.getDescriptor(rarName);
ConnectionDefDescriptor cdd = connectorDescriptor.getConnectionDefinitionByCFType(connectionDefName);
Set configProps = cdd.getConfigProperties();
for (Iterator iter = configProps.iterator(); iter.hasNext(); ) {
ConnectorConfigProperty envProp = (ConnectorConfigProperty) iter.next();
String prop = envProp.getName().toUpperCase(locale);
if ("USER".equals(prop) || "USERNAME".equals(prop)) {
userPassword[0] = envProp.getValue();
} else if ("PASSWORD".equals(prop)) {
userPassword[1] = envProp.getValue();
}
}
if (userPassword[0] != null && !"".equals(userPassword[0].trim())) {
return userPassword;
}
// else read the default username and password from the ra.xml
ManagedConnectionFactory mcf = connectorRegistry.getManagedConnectionFactory(poolInfo);
userPassword[0] = ConnectionPoolObjectsUtils.getValueFromMCF("UserName", poolInfo, mcf);
userPassword[1] = ConnectionPoolObjectsUtils.getValueFromMCF("Password", poolInfo, mcf);
return userPassword;
}
use of com.sun.enterprise.connectors.ConnectorRegistry in project Payara by payara.
the class ConnectorsRecoveryResourceHandler method createActiveResourceAdapter.
private void createActiveResourceAdapter(String rarModuleName) throws ConnectorRuntimeException {
ConnectorRuntime cr = ConnectorRuntime.getRuntime();
ConnectorRegistry creg = ConnectorRegistry.getInstance();
if (creg.isRegistered(rarModuleName))
return;
if (ConnectorAdminServiceUtils.isEmbeddedConnectorModule(rarModuleName)) {
cr.createActiveResourceAdapterForEmbeddedRar(rarModuleName);
} else {
String moduleDir;
if (ConnectorsUtil.belongsToSystemRA(rarModuleName)) {
moduleDir = ConnectorsUtil.getSystemModuleLocation(rarModuleName);
} else {
moduleDir = configBeansUtilities.getLocation(rarModuleName);
}
ClassLoader loader = cr.createConnectorClassLoader(moduleDir, null, rarModuleName);
cr.createActiveResourceAdapter(moduleDir, rarModuleName, loader);
}
}
Aggregations