public static ConnectorResourceConfig createInstance( final DomainConfig domainConfig, final String name, final String poolName, final Map<String, String> optional) { return domainConfig.createConnectorResourceConfig(name, poolName, optional); }
/** list all application refs that are present in the provided list of targets */ public TargetModuleID[] listAppRefs(String[] targets) throws IOException { if (!isConnected()) { throw new IllegalStateException( localStrings.getString("enterprise.deployment.client.disconnected_state")); } Vector tmpVector = new Vector(); DomainConfig domainCfg = ProxyFactory.getInstance(dasConnection).getDomainRoot().getDomainConfig(); Map serverProxies = domainCfg.getStandaloneServerConfigMap(); Map clusterProxies = domainCfg.getClusterConfigMap(); Map clusteredServerProxies = domainCfg.getClusteredServerConfigMap(); for (int i = 0; i < targets.length; i++) { Set proxySet = null; if (serverProxies.get(targets[i]) != null) { StandaloneServerConfig tgtProxy = (StandaloneServerConfig) domainCfg.getContainee(XTypes.STANDALONE_SERVER_CONFIG, targets[i]); proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG); } else if (clusterProxies.get(targets[i]) != null) { ClusterConfig tgtProxy = (ClusterConfig) domainCfg.getContainee(XTypes.CLUSTER_CONFIG, targets[i]); proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG); } else if (clusteredServerProxies.get(targets[i]) != null) { ClusteredServerConfig tgtProxy = (ClusteredServerConfig) domainCfg.getContainee(XTypes.CLUSTERED_SERVER_CONFIG, targets[i]); proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG); } else if (TargetType.DOMAIN.equals(targets[i])) { StandaloneServerConfig tgtProxy = (StandaloneServerConfig) domainCfg.getContainee(XTypes.STANDALONE_SERVER_CONFIG, DAS); proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG); } else { return null; } Object[] appRefs = proxySet.toArray(); for (int k = 0; k < appRefs.length; k++) { SunTarget aTarget = new SunTarget(serverId); aTarget.setAppServerInstance(targets[i]); aTarget.setConnectionSource(dasConnection); DeployedItemRefConfig item = (DeployedItemRefConfig) appRefs[k]; SunTargetModuleID tgtId = new SunTargetModuleID(item.getRef(), aTarget); tmpVector.add(tgtId); } } SunTargetModuleID[] result = new SunTargetModuleID[tmpVector.size()]; return (TargetModuleID[]) tmpVector.toArray(result); }
public static ConnectorResourceConfig ensureDefaultInstance(final DomainConfig domainConfig) { ConnectorResourceConfig result = domainConfig.getConnectorResourceConfigMap().get(getDefaultInstanceName()); final ConnectorConnectionPoolConfig connectorConnectionPool = ConnectorConnectionPoolConfigTest.ensureDefaultInstance(domainConfig); if (result == null) { result = createInstance( domainConfig, getDefaultInstanceName(), connectorConnectionPool.getName(), null); } return result; }
public Target[] createTargets(String[] targets) { if (!isConnected()) { throw new IllegalStateException( localStrings.getString("enterprise.deployment.client.disconnected_state")); } Target[] targetsArray = new Target[targets.length]; Map serverProxies = null; Map clusterProxies = null; try { // parse through given targets for (int i = 0; i < targets.length; i++) { // if this is "domain" add a domain target if (TargetType.DOMAIN.equals(targets[i])) { // Add a domain target SunTarget dom = new SunTarget(serverId); dom.setAppServerInstance(TargetType.DOMAIN); dom.setConnectionSource(dasConnection); dom.setTargetType(TargetType.DOMAIN); targetsArray[i] = dom; continue; } // if this is "server" add a server target if (DAS.equals(targets[i])) { // Add a target for default server SunTarget serv = new SunTarget(serverId); serv.setAppServerInstance(DAS); serv.setConnectionSource(dasConnection); serv.setTargetType(TargetType.STAND_ALONE_SERVER); targetsArray[i] = serv; continue; } // for PE, it will not come here at all; go ahead and get proxies and server/cluster keysets // from the proxies if (serverProxies == null || clusterProxies == null) { DomainConfig domainCfg = ProxyFactory.getInstance(dasConnection).getDomainRoot().getDomainConfig(); serverProxies = domainCfg.getStandaloneServerConfigMap(); clusterProxies = domainCfg.getClusterConfigMap(); } // check if ctarget is a stand alone server if (serverProxies.get(targets[i]) != null) { SunTarget aTarget = new SunTarget(serverId); aTarget.setAppServerInstance(targets[i]); aTarget.setConnectionSource(dasConnection); aTarget.setTargetType(TargetType.STAND_ALONE_SERVER); targetsArray[i] = aTarget; continue; } // check if ctarget is a cluster if (clusterProxies.get(targets[i]) != null) { SunTarget aTarget = new SunTarget(serverId); aTarget.setAppServerInstance(targets[i]); aTarget.setConnectionSource(dasConnection); aTarget.setTargetType(TargetType.CLUSTER); targetsArray[i] = aTarget; continue; } // if we are here, it means given target does not exist at all - return null return null; } } catch (Throwable ex) { // it's too late to change the DeploymentFacility.createTargets // interface to throw approriate exceptions as this point, // but let's at least re-throw the RuntimeException so // connection failure (for example, due to wrong user/password) // could be reported back to user. if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } return null; } return targetsArray; }