Environment clientEnvironment = EnvironmentBuilder.buildEnvironment(clientEnvironmentType, defaultClientEnvironment);
if (standAlone) {
String name = new File(moduleFile.getName()).getName();
idBuilder.resolve(clientEnvironment, name + "_" + name, "jar");
} else {
Artifact earConfigId = earEnvironment.getConfigId();
idBuilder.resolve(clientEnvironment, earConfigId.getArtifactId() + "_" + targetPath, "jar");
}
EnvironmentType serverEnvironmentType = gerAppClient.getServerEnvironment();
Environment serverEnvironment = EnvironmentBuilder.buildEnvironment(serverEnvironmentType, defaultServerEnvironment);
if (!standAlone) {
EnvironmentBuilder.mergeEnvironments(earEnvironment, serverEnvironment);
serverEnvironment = earEnvironment;
if (!serverEnvironment.getConfigId().isResolved()) {
throw new IllegalStateException("Server environment module ID should be fully resolved (not " + serverEnvironment.getConfigId() + ")");
}
} else {
idBuilder.resolve(serverEnvironment, new File(moduleFile.getName()).getName(), "jar");
}
namingBuilders.buildEnvironment(appClient, gerAppClient, clientEnvironment);
if (earName == null) {
earName = naming.createRootName(serverEnvironment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
}
//always use the artifactId of the app client as the name component of the module name (on the server).
AbstractName moduleName = naming.createChildName(earName, clientEnvironment.getConfigId().toString(), NameFactory.APP_CLIENT_MODULE);
AbstractName clientBaseName = naming.createRootName(clientEnvironment.getConfigId(), clientEnvironment.getConfigId().toString(), NameFactory.J2EE_APPLICATION);
//start installing the resource adapters in the client.
Collection resourceModules = new ArrayList();
GerResourceType[] resources = gerAppClient.getResourceArray();
for (int i = 0; i < resources.length; i++) {
GerResourceType resource = resources[i];
String path;
JarFile connectorFile;
if (resource.isSetExternalRar()) {
path = resource.getExternalRar().trim();
Artifact artifact = Artifact.create(path);
File file = null;
for (Iterator iterator = repositories.iterator(); iterator.hasNext();) {
Repository repository = (Repository) iterator.next();
if (repository.contains(artifact)) {
file = repository.getLocation(artifact);