* {@link com.sun.appserv.management.WebServiceMgr#PASSWORD_KEY}
*/
public void addRegistryConnectionResources(String jndiName,
String description, String type, Map<String, String> properties){
final DomainConfig dc = getDomainConfig();
String registryType = null;
if (type == WebServiceMgr.UDDI_KEY) {
registryType = this.UDDI_PROPERTY;
} else if (type == WebServiceMgr.EBXML_KEY ){
registryType = this.EBXML_PROPERTY;
}
if (registryType == null) {
Object[] params = {UDDI_PROPERTY, EBXML_PROPERTY};
_logger.log(Level.WARNING, "registry.specify_registry_type", params);
throw new RuntimeException("Registry Type has to be "+
UDDI_PROPERTY + " or "+ EBXML_PROPERTY);
}
// 1. get resource adapter config
Map <String, ResourceAdapterConfig> raConfMap = dc.getResourceAdapterConfigMap();
// 2. get the resourceAdapterName
String resourceAdapterName = null;
for (String ra : raConfMap.keySet()){
ResourceAdapterConfig rac = raConfMap.get(ra);
if (rac.existsProperty(registryType)){
resourceAdapterName = rac.getResourceAdapterName();
break;
}
}
if (resourceAdapterName == null){
// Now look in the system resource adapter.
resourceAdapterName = getSystemConnectorResources(registryType);
if (resourceAdapterName == null){
// could not find any resource adapter that is a jaxr resource adapter type
// log it
String msg =
"Cannot locate JAXR Resource Adapter to add Connection pool" +
" and Connector Resource. Please add connector resource " +
"of type " + registryType;
_logger.log(Level.SEVERE,
"registry.deploy_registry_connector_resource", registryType);
throw new RuntimeException(msg);
}
}
// 3. generate a unique pool name
String poolName = FileUtils.makeFriendlyFileName(jndiName) + POOL_SUFFIX;
// 4. connectorDefinitionName
String connectorDefinitionName = JAXR_REGISTRY_TYPE;
if (registryType.equals(UDDI_PROPERTY)){
// jaxr-ri works only with a "/" appended to the URL
Properties props = new Properties();
for (String property : properties.keySet()){
String propValue = (String)properties.get(property);
if (LifeCycleManagerURL.equals(property) ||
QueryManagerURL.equals(property)){
//jaxr-ri needs a backslash at the end of the URL
if (!propValue.endsWith("/")) {
propValue = propValue + "/";
}
props.put(property, propValue);
} else if (property.equalsIgnoreCase("username")){
props.put("UserName", propValue);
} else if (property.equalsIgnoreCase("password")){
props.put("UserPassword", propValue);
} else
props.put(property, propValue);
}
connectorDefinitionName = UDDI_JAXR_REGISTRY_TYPE;
createConnectorConnectionPoolMBean(resourceAdapterName,
connectorDefinitionName, poolName, props);
} else {
Map<String, String> optional = new HashMap <String, String> ();
for (String property : properties.keySet()){
optional.put(PropertiesAccess.PROPERTY_PREFIX + property,
properties.get(property));
}
dc.createConnectorConnectionPoolConfig( poolName,
resourceAdapterName, connectorDefinitionName, optional );
}
dc.createConnectorResourceConfig(jndiName, poolName, null);
}