*/
public static final void createClientJar(
DeploymentContext dc, File clientJar, ZipItem[] clientStubs,
String clientJarChoice) throws DeploymentException {
try {
ArchiveFactory archiveFactory = Globals.
getDefaultHabitat().getComponent(ArchiveFactory.class);
// client jar naming convension is <app-name>Client.jar
WritableArchive target = archiveFactory.createArchive(clientJar);
RootDeploymentDescriptor descriptor;
Application app = dc.getModuleMetaData(Application.class);
if (app.isVirtual()) {
descriptor = app.getStandaloneBundleDescriptor();
} else {
descriptor = app;
}
ReadableArchive source = archiveFactory.openArchive(
dc.getSourceDir());
PEDeploymentFactoryImpl pe = new PEDeploymentFactoryImpl();
Properties props = getPropertiesForClientJarMaker(
CLIENT_JAR_CHOICES.getClientJarChoice(clientJarChoice),
dc, descriptor);
ClientJarMaker jarMaker = pe.getClientJarMaker(props);
// copy xml files from generated directory archive to original
// directory archive so the created client jar contain
// processed xml files.
if (FileUtils.safeIsDirectory(dc.getScratchDir("xml"))) {
ReadableArchive source2 = archiveFactory.openArchive(
dc.getScratchDir("xml"));
jarMaker.create(descriptor, source, source2, target,
clientStubs, null);
source2.close();
} else {