try {
earContext.addIncludeAsPackedJar(URI.create(module.getTargetPath()), moduleFile);
} catch (IOException e) {
throw new DeploymentException("Unable to copy app client module jar into configuration: " + moduleFile.getName());
}
AppClientModule appClientModule = (AppClientModule) module;
appClientModule.setEarFile(earFile);
//create the ear context for the app client.
Environment clientEnvironment = appClientModule.getClientEnvironment();
// if (!appClientModule.isStandAlone() || clientEnvironment.getConfigId() == null) {
// Artifact earConfigId = earContext.getConfigID();
// Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
// clientEnvironment.setConfigId(configId);
// }
File appClientDir;
try {
appClientDir = targetConfigurationStore.createNewConfigurationDir(clientEnvironment.getConfigId());
} catch (ConfigurationAlreadyExistsException e) {
throw new DeploymentException(e);
}
// construct the app client deployment context... this is the same class used by the ear context
EARContext appClientDeploymentContext;
try {
appClientDeploymentContext = new EARContext(appClientDir,
null,
clientEnvironment,
ConfigurationModuleType.CAR,
earContext.getNaming(),
earContext.getConfigurationManager(),
null, //no server name needed on client
appClientModule.getAppClientName(),
transactionManagerObjectName,
connectionTrackerObjectName,
null,
null,
corbaGBeanObjectName
);
appClientModule.setEarContext(appClientDeploymentContext);
appClientModule.setRootEarContext(earContext);
} catch (DeploymentException e) {
cleanupAppClientDir(appClientDir);
throw e;
}
for (Iterator resources = appClientModule.getResourceModules().iterator(); resources.hasNext();) {
ConnectorModule connectorModule = (ConnectorModule) resources.next();
getConnectorModuleBuilder().installModule(connectorModule.getModuleFile(), appClientDeploymentContext, connectorModule, configurationStores, targetConfigurationStore, repositories);
}
}