Methods Summary |
---|
public void | addNotificationListener(NotificationListener nl)
standaloneListeners.addElement(nl);
this.notify(LISTENER_ADDED, null, null);
|
public void | addStandAlone(Descriptor desc)
String oldName = desc.getName();
String newName = this.getUniqueStandAloneName(oldName);
if (!oldName.equals(newName)) {
desc.setName(newName);
}
this.standalones.addElement(desc);
desc.addNotificationListener(this);
this.notify(STANDALONE_ADDED, STANDALONE_PROPERTY, desc);
this.setActiveStandAlone(desc);
|
public void | closeStandAlone(Descriptor desc)Close the given stand-alone object
this.standalones.removeElement(desc);
// UIProject.removeProject(desc);
// ProjectImpl proj = (ProjectImpl)Project.getProject(desc);
// if (proj != null) {
// proj.remove();
// Project.removeProject(desc);
// }
this.setActiveStandAlone(null);
this.notify(STANDALONE_REMOVED, STANDALONE_PROPERTY, desc);
|
public Descriptor | getActiveStandAlone()Return the active stand-alone object
return this.activeStandAlone;
|
protected java.lang.String | getConfigFileName()
return this.configFileName;
|
public java.util.Vector | getStandAloneNames()
Vector names = new Vector();
Enumeration e = this.standalones.elements();
for (;e.hasMoreElements();) {
names.addElement(((Descriptor)e.nextElement()).getName());
}
return names;
|
public Descriptor | getStandAloneWithJar(java.io.File jarFilename)
String absPath = jarFilename.getAbsolutePath();
Enumeration e = this.standalones.elements();
for (;e.hasMoreElements();) {
Descriptor d = (Descriptor)e.nextElement();
if (d instanceof ConnectorDescriptor) {
String uri = ((ConnectorDescriptor)d).getArchivist().
getArchiveUri();
if ((new File(uri)).getAbsolutePath().equals(absPath)) {
return d;
}
} else
if (d instanceof Application) {
if (((Application)d).getApplicationArchivist().
getApplicationFile().getAbsolutePath().equals(absPath)) {
return d;
}
} else {
// XXX - unknown descriptor
}
}
return null;
|
public java.util.Vector | getStandAlones()
return (Vector)this.standalones.clone();
|
public java.io.File | getTemp()Gets the temporary directory.
return temp;
|
protected java.lang.String | getUniqueStandAloneName(java.lang.String trialName)
return Descriptor.createUniqueNameAmongst(trialName,
this.getStandAloneNames());
|
public boolean | isDirty(Descriptor desc)
if (desc instanceof ConnectorDescriptor) {
return ((ConnectorDescriptor)desc).isDirty();
} else
if (desc instanceof Application) {
return ((Application)desc).isDirty();
}
return false;
|
public boolean | isStandAloneDescriptor(Descriptor desc)
Enumeration e = this.standalones.elements();
for (;e.hasMoreElements();) {
if (desc == e.nextElement()) {
return true;
}
}
return false;
|
public void | notification(NotificationEvent ne)
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 = (name == null)?
new NotificationEvent(this, type) :
new NotificationEvent(this, type, name, value);
/* make a copy of the listener list */
Vector listenersClone = null;
synchronized (standaloneListeners) {
listenersClone = (Vector)standaloneListeners.clone();
}
/* notify listeners */
for (Enumeration e = listenersClone.elements(); e.hasMoreElements();) {
NotificationListener nl = (NotificationListener)e.nextElement();
nl.notification(ne);
}
|
public Descriptor | openStandAlone(java.io.File name)
/* ConnectorDescriptor */
if (ConnectorArchivist.isConnector(name)) {
//IASRI 4691307 Anissa
//Open the rar file with ValidateXML set to false, and include S1AS descriptor.
ConnectorDescriptor d = ConnectorArchivist.open(name, false, true);
// IASRI 4691307 end.
this.addStandAlone(d);
// ProjectImpl newProj = new ProjectImpl(d);
// newProj.load();
// Project.addProject(d, newProj);
return d;
}
/* Application */
if (ApplicationArchivist.isApplication(name)) {
Application d = ApplicationArchivist.openAT(name); //bug# 4774785; 4691307
this.addStandAlone(d);
// ProjectImpl newProj = new ProjectImpl(d);
// newProj.load();
// Project.addProject(d, newProj);
d.doneOpening();
return d;
}
/* not found */
return null;
|
public void | removeNotificationListener(NotificationListener nl)
standaloneListeners.removeElement(nl);
|
public java.util.Hashtable | restoreFromUserHome()
Hashtable badFiles = new Hashtable();
File propsFile = new File(preferencesDirectory, getConfigFileName());
if (propsFile.exists()) {
FileInputStream fis = new FileInputStream(propsFile);
Properties props = new Properties();
props.load(fis);
for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
String name = (String)e.nextElement();
String jarFilename = (String)props.getProperty(name);
try {
this.openStandAlone(new File(jarFilename));
} catch (Throwable t) {
badFiles.put(jarFilename, t);
}
}
fis.close();
}
return badFiles;
|
public void | saveStandAlone(Descriptor desc)
if (desc instanceof ConnectorDescriptor) {
ConnectorDescriptor cd = (ConnectorDescriptor)desc;
ConnectorArchivist ca = (ConnectorArchivist)cd.getArchivist();
ca.save(new File(ca.getArchiveUri()), true);
}
|
public void | saveStandAloneAs(Descriptor desc, java.io.File newFile)
if (desc instanceof ConnectorDescriptor) {
ConnectorDescriptor cd = (ConnectorDescriptor)desc;
ConnectorArchivist ca = (ConnectorArchivist)cd.getArchivist();
ca.save(newFile, true);
}
|
public void | saveToUserHome()Saves the list of open stand-alone objects to the working dir
File propsFile = new File(preferencesDirectory, getConfigFileName());
FileOutputStream fos = new FileOutputStream(propsFile);
Properties props = new Properties();
Enumeration e = this.standalones.elements();
for (;e.hasMoreElements();) {
Descriptor next = (Descriptor)e.nextElement();
String loc = null;
if (next instanceof ConnectorDescriptor) {
loc = ((ConnectorDescriptor)next).getArchivist().
getArchiveUri();
} else
if (next instanceof Application) {
loc = ((Application)next).getApplicationArchivist().
getApplicationFile().toString();
}
if (loc != null) {
props.put(next.getName(), loc);
} else {
System.err.println("Unsupported Stand-Alone descriptor type:");
System.err.println(" " + next.getClass().getName());
}
}
props.store(fos, "J2EE Stand-Alone Descriptors"); // NOI18N
fos.close();
|
public void | setActiveStandAlone(Descriptor desc)
if (desc != this.activeStandAlone) {
this.activeStandAlone = desc;
if (desc != null) {
this.notify(ACTIVE_CHANGED, STANDALONE_PROPERTY, desc);
} else {
this.notify(ACTIVE_CHANGED, null, null);
}
}
|
public java.lang.String | toString()Formatted String.
return "Stand-Alone Manager"; // NOI18N
|