AbstractArchive archive;
if (appClientFile.isDirectory()) {
archive = new FileArchive();
((FileArchive) archive).open(appClientFile.getAbsolutePath());
} else {
archive = new InputJarArchive();
((InputJarArchive) archive).open(appClientFile.getAbsolutePath());
}
if (appDesc.getMainClassName()==null || appDesc.getMainClassName().length()==0) {
appDesc.setMainClassName(className);
arch.processAnnotations(appDesc, archive);
// let's remove our appArgs first element since it was the app client class name
//...but only if this is not a Java Web Start launch.
if (mainClass==null && ! isJWS) {
appArgs.removeElementAt(0);
}
}
}
} catch (Throwable t) {
_logger.log(Level.WARNING,
"main.appclient_descriptors_failed", (displayName == null) ? mainClass : displayName);
throw t;
}
container = new AppContainer(appDesc, guiAuth);
}
if(container == null) {
_logger.log(Level.WARNING, "acc.no_client_desc",
(displayName == null) ? mainClass : displayName);
System.exit(1);
}
// Set the authenticator which is called back when a
// protected web resource is requested and authentication data is
// needed.
Authenticator.setDefault(new HttpAuthenticator(container));
// log a machine name, port number per Jagadesh's request
_logger.log(Level.INFO, "acc.orb_host_name", host);
_logger.log(Level.INFO, "acc.orb_port_number", port);
Properties props = new Properties();
props.put("org.omg.CORBA.ORBInitialHost", host);
props.put("org.omg.CORBA.ORBInitialPort", port);
String appMainClass = container.preInvoke(props);
cleanup.setAppContainer(container);
// load and invoke the real main of the application.
Class cl = null;
try {
cl = jcl.loadClass(appMainClass);
} catch (java.lang.ClassNotFoundException cnf) {
String errorMessage = localStrings.getString
("appclient.mainclass.not.found", appMainClass);
_logger.log(Level.WARNING, errorMessage);
throw cnf;
}
_logger.log(Level.INFO, "acc.load_app_class", appMainClass);
String[] applicationArgs = new String[appArgs.size()];
for(int sz = 0; sz < applicationArgs.length; sz++) {
applicationArgs[sz] = (String) appArgs.elementAt(sz);
}
// check if we are dealing with an application client containing
// service references... if this is the case, I need to explode
// the appclient jar file to be able to access its wsdl files
// with a URL (so that imports can work)
if (appDesc.hasWebServiceClients()) {
File moduleFile;
if (appDesc.getApplication()==null
|| appDesc.getApplication().isVirtual()) {
// this is a standalone module, I can do Wsdl file
// resolution directly on it.
moduleFile = appClientFile;
} else {
InputJarArchive earFile = new InputJarArchive();
earFile.open(appClientFile.getAbsolutePath());
String moduleName = appDesc.getModuleDescriptor().getArchiveUri();
InputStream is = earFile.getEntry(moduleName);
moduleFile = File.createTempFile("appclient", ".jar");
moduleFile.deleteOnExit();
OutputStream os = new FileOutputStream(moduleFile);
ArchivistUtils.copy(new BufferedInputStream(is), new BufferedOutputStream(os));
earFile.close();
}
// now perform wsdl file resolution
for (Iterator itr = appDesc.getServiceReferenceDescriptors().iterator();
itr.hasNext();) {