Methods Summary |
---|
public void | addApplication(Application application)Adds an application to the manager.
String newName = this.getUniqueApplicationName(application.getName());
application.setName(newName);
applications.addElement(application);
application.addNotificationListener(this);
this.notify(APPLICATION_ADDED, APPLICATION_PROPERTY, application);
this.setActiveApplication(application);
|
public void | addNotificationListener(com.sun.enterprise.util.NotificationListener nl)Register for state changes.
applicationListeners.addElement(nl);
this.notify(LISTENER_ADDED, null, null);
|
public void | closeApplication(Application application)Close the given application.
applications.removeElement(application);
// UIProject.removeProject(application);
// ProjectImpl proj = (ProjectImpl)Project.getProject(application);
// if ( proj != null ) {
// proj.remove();
// Project.removeProject(application);
// }
this.setActiveApplication(null);
this.notify(APPLICATION_REMOVED, APPLICATION_PROPERTY, application);
|
public Application | getActiveApplication()Return the active application.
return activeApplication;
|
public java.util.Vector | getApplicationNames()
Vector names = new Vector();
for (Enumeration e = applications.elements();e.hasMoreElements();) {
names.addElement(((Application) e.nextElement()).getName());
}
return names;
|
public Application | getApplicationWithJar(java.io.File jarFilename)
for (Enumeration e = this.getApplications().elements();
e.hasMoreElements();) {
Application application = (Application) e.nextElement();
if (application.getApplicationArchivist().
getApplicationFile().getAbsolutePath().equals(
jarFilename.getAbsolutePath())) {
return application;
}
}
return null;
|
public java.util.Vector | getApplications()The Vector open application objects.
Vector clone = (Vector) applications.clone();
return clone;
|
protected java.lang.String | getConfigAppFileName()
return this.configFileName;
|
public java.io.File | getTemp()Gets the temporary directory.
return temp;
|
protected java.lang.String | getUniqueApplicationName(java.lang.String trialName)
return Application.createUniqueNameAmongst(trialName,
this.getApplicationNames());
|
public Application | newApplication(java.lang.String name, java.lang.String jarFile)Create a new application with the given name and jar file and
makes it the active one..
Application newApplication = new Application(
this.getUniqueApplicationName(name), new File(jarFile));
// Project newProj = new ProjectImpl(newApplication);
// Project.addProject(newApplication, newProj);
try {
this.saveApplication(newApplication);
} catch (IOException ioe) {
Log.print(this, ioe);
}
this.addApplication(newApplication);
return newApplication;
|
public void | notification(com.sun.enterprise.util.NotificationEvent ne)I am recieving a notification event.
this.notify(ne.getType(), NotificationEvent.OBJECT_THAT_CHANGED,
ne.getObjectThatChanged());
|
public void | notify(java.lang.String type, java.lang.String name, java.lang.Object value)Convenience method for notifying listeners.
NotificationEvent ne = null;
if (name == null) {
ne = new NotificationEvent(this, type);
} else {
ne = new NotificationEvent(this, type, name, value);
}
Vector listenersClone = null;
synchronized (applicationListeners) {
listenersClone = (Vector) applicationListeners.clone();
}
for (Enumeration e = listenersClone.elements(); e.hasMoreElements();) {
NotificationListener nl = (NotificationListener) e.nextElement();
//System.out.println("notifying " + nl);
nl.notification(ne);
//System.out.println("Done");
}
//System.out.println("Notify: " + (System.currentTimeMillis() - time));
|
public Application | openApplication(java.io.File name)Open the JAR file application.
Application openedApplication = ApplicationArchivist.openAT(name); //4691307; 4774785
// fix bug# 4766725
for (java.util.Iterator itr = openedApplication.getWebBundleDescriptors().iterator(); itr.hasNext();) {
WebBundleDescriptor webBundleDescriptor = (WebBundleDescriptor) itr.next();
for(Enumeration e = webBundleDescriptor.getWebComponentDescriptors(); e.hasMoreElements();){
WebComponentDescriptorImpl comp = (WebComponentDescriptorImpl) e.nextElement();
if (comp.getName().equals(""))
comp.setName(comp.getCanonicalName());
}
}
// start IASRI4691307
// Initialize Sun Specific Descriptors HERE
//
com.sun.enterprise.tools.deployment.ui.sunone.SunOneUtils.createSunOneXml(openedApplication);
com.sun.enterprise.tools.deployment.Util.addMappingsSkeleton(openedApplication);
// end IASRI4691307
this.addApplication(openedApplication);
// ProjectImpl newProj = new ProjectImpl(openedApplication);
// newProj.load();
// Project.addProject(openedApplication, newProj);
openedApplication.doneOpening();
return openedApplication;
|
public void | removeNotificationListener(com.sun.enterprise.util.NotificationListener nl)Deregister for state changes.
applicationListeners.removeElement(nl);
|
public java.util.Hashtable | restoreFromUserHome()retore state from the last session, returning a Hashtable of
filenames to exceptions for each application that could
not be reopened.
Hashtable badApplicationJarFilenamesToExceptions = new Hashtable();
File appsFile = new File(preferencesDirectory, getConfigAppFileName());
if (appsFile.exists()) {
FileInputStream fis = new FileInputStream(appsFile);
Properties applications = new Properties();
applications.load(fis);
for (Enumeration e = applications.propertyNames();
e.hasMoreElements();) {
String appName = (String) e.nextElement();
String appJarFilename = (String)
applications.getProperty(appName);
Application openedApp=null;
try {
this.openApplication(new File(appJarFilename));
} catch (Throwable t) {
badApplicationJarFilenamesToExceptions.put(
appJarFilename, t);
}
}
if (fis != null) {
fis.close();
}
}
return badApplicationJarFilenamesToExceptions;
|
public void | saveApplication(Application application)Save the given applicastion to its JAR file.
ApplicationArchivist archivist = application.getApplicationArchivist();
archivist.save(archivist.getApplicationFile(), true);
// ProjectImpl proj = (ProjectImpl)Project.getProject(application);
// if (proj != null) {
// proj.save();
// }
|
public void | saveAsApplication(Application application, java.io.File newJar)Save the given application to the supllied file.
ApplicationArchivist archivist = application.getApplicationArchivist();
archivist.save(newJar, true);
// ProjectImpl proj = (ProjectImpl)Project.getProject(application);
// if (proj != null) {
// proj.save();
// }
|
public void | saveToUserHome()Saves the list of open applications to the working dir under
'.jpedeploytool/.'
File appsFile = new File(preferencesDirectory, getConfigAppFileName());
FileOutputStream fos = new FileOutputStream(appsFile);
Properties applications = new Properties();
for (Enumeration e = this.getApplications().elements();
e.hasMoreElements();) {
Application nextApplication = (Application) e.nextElement();
applications.put(nextApplication.getName(),
nextApplication.getApplicationArchivist().
getApplicationFile().toString());
}
applications.store(fos, "J2EE Applications"); // NOI18N
if (fos != null) {
fos.close();
}
|
public void | setActiveApplication(Application application)Sets the active application.
if (application != activeApplication) {
this.activeApplication = application;
if (application != null) {
this.notify(ACTIVE_CHANGED, APPLICATION_PROPERTY, application);
} else {
this.notify(ACTIVE_CHANGED, null, null);
}
}
|
public void | setConfigAppFileName(java.lang.String cfgAppFile)
this.configFileName = (cfgAppFile != null)? cfgAppFile : CFG_APP_FILE;
|
public java.lang.String | toString()Formatted String.
return "Application Manager"; // NOI18N
|