Methods Summary |
---|
public void | generate()
if (application == null) return;
java.util.Set ejbBundleDescriptors = application.getEjbBundleDescriptors();
// Determine if sun-ejb.xml needs to be generated
boolean generate = false;
for(Iterator it=ejbBundleDescriptors.iterator(); it.hasNext(); ) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) it.next();
com.sun.enterprise.ddgenerator.sun.EjbModule ejbModule =
new com.sun.enterprise.ddgenerator.sun.EjbModule(ejbBundleDescriptor,
applicationDirectory);
if (! ejbModule.hasSunDescriptor()) {
generate = true;
}
}
if (generate == false) return;
// Backup existing sun descriptor
for(Iterator it=ejbBundleDescriptors.iterator(); it.hasNext(); ) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) it.next();
com.sun.enterprise.ddgenerator.sun.EjbModule ejbModule =
new com.sun.enterprise.ddgenerator.sun.EjbModule(ejbBundleDescriptor,
applicationDirectory);
ejbModule.backupSunDescriptor();
}
// Generate sun descriptor
for(Iterator it=ejbBundleDescriptors.iterator(); it.hasNext(); ) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) it.next();
com.sun.enterprise.ddgenerator.sun.EjbModule ejbModule =
new com.sun.enterprise.ddgenerator.sun.EjbModule(ejbBundleDescriptor,
applicationDirectory);
ejbModule.generate();
}
// update referencing descriptors
java.util.Vector ejbRefDescriptorsV = application.getEjbReferenceDescriptors();
if (ejbRefDescriptorsV == null) {
save();
return;
}
int ejbRefDescriptorsSize = ejbRefDescriptorsV.size();
for (int i=0; i<ejbRefDescriptorsSize; i++) {
EjbReferenceDescriptor ejbRefDescriptor =
(EjbReferenceDescriptor) ejbRefDescriptorsV.get(i);
updateEjbRefDescriptorJndiName(ejbRefDescriptor, ejbBundleDescriptors);
}
// save application descriptor
save();
|
public static void | main(java.lang.String[] args)
String appDir = "/home/sreeni/TEMP/stateless-converter_1";
System.out.println("Application");
System.out.println("Press enter to continue ...");
try {
System.in.read();
} catch (java.io.IOException ioe) {
}
FileArchive in = new FileArchive();
try {
in.open(appDir);
} catch (java.io.IOException ioe) {
}
ApplicationArchivist archivist = new ApplicationArchivist();
archivist.setXMLValidation(false);
archivist.setClassLoader(null);
com.sun.enterprise.deployment.Application application = null;
try {
application = (com.sun.enterprise.deployment.Application) archivist.open(in);
} catch (java.io.IOException ioe) {
} catch (org.xml.sax.SAXParseException saxpe) {
}
com.sun.enterprise.ddgenerator.sun.Application app =
new com.sun.enterprise.ddgenerator.sun.Application(application, appDir);
app.generate();
|
private void | save()
FileArchive in = new FileArchive();
try {
in.open(applicationDirectory);
} catch (java.io.IOException ioe) {
}
DescriptorArchivist archivist = new DescriptorArchivist();
try {
archivist.write(application, in);
} catch (java.io.IOException ioe) {
}
|
public void | setApplicationDirectory(java.lang.String applicationDirectory)
this.applicationDirectory = applicationDirectory;
|
public void | setDescriptor(com.sun.enterprise.deployment.Descriptor descriptor)
this.application = (com.sun.enterprise.deployment.Application) descriptor;
|
private void | updateEjbRefDescriptorJndiName(EjbReferenceDescriptor ejbRefDescriptor, java.util.Set ejbBundleDescriptors)
for(Iterator it=ejbBundleDescriptors.iterator(); it.hasNext(); ) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) it.next();
java.util.Set ejbDescriptors = ejbBundleDescriptor.getEjbs();
for (Iterator jt = ejbDescriptors.iterator(); jt.hasNext();) {
EjbDescriptor ejbDescriptor = (EjbDescriptor) jt.next();
if ((ejbDescriptor.getHomeClassName()).equals(ejbRefDescriptor.getHomeClassName())) {
ejbRefDescriptor.setJndiName(ejbDescriptor.getJndiName());
return;
}
}
}
|