Methods Summary |
---|
void | addEjbModule(java.lang.String name)Adds an ejb module to the cache.
_ejbModules.put(name, name);
|
void | addJ2eeApplication(java.lang.String name, java.util.List ejbBundles, java.util.List webBundles)Adds an application to the cache.
J2eeApplication app = new J2eeApplication(name, ejbBundles, webBundles);
_j2eeApplications.put(name, app);
|
void | addWebModule(java.lang.String name)Adds a web module to the cache.
_webModules.put(name, name);
|
public java.util.Map | getEjbModules()Returns all stand alone ejb modules with web services.
return _ejbModules;
|
public static synchronized com.sun.enterprise.admin.wsmgmt.repository.impl.cache.CacheMgr | getInstance()Returns the singleton instance of this class.
if (_mgr == null) {
_mgr = new CacheMgr();
}
return _mgr;
|
public java.util.Map | getJ2eeApplications()Returns all j2ee applications with web services.
return _j2eeApplications;
|
private java.lang.String | getPropertyFile()Returns the persistent cache index location.
String iRoot =
System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY);
String file = iRoot + File.separator + PEFileLayout.GENERATED_DIR
+ File.separator + CACHE_FILE;
return file;
|
public java.util.Map | getWebModules()Returns all stand alone web apps with web services.
return _webModules;
|
private void | load()Reads from the persistent cache index property file.
FileInputStream fis = null;
try {
File file = new File(getPropertyFile());
// abort if file does not exist
if (!file.exists()) {
return;
}
fis = new FileInputStream(file);
Properties pro = new Properties();
pro.load(fis);
for (Enumeration e = pro.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
String val = pro.getProperty(key);
if (EJB.equals(val)) {
_ejbModules.put(key, key);
} else if (WEB.equals(val)) {
_webModules.put(key, key);
} else {
J2eeApplication app = new J2eeApplication(key, val);
_j2eeApplications.put(key, app);
}
}
} catch (Exception e) {
_logger.log(Level.FINE,
"Error while loading ws-mgmt cache file", e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (Exception e) { }
}
}
|
java.lang.String | removeEjbModule(java.lang.String name)Removes an ejb module from cache.
return (String) _ejbModules.remove(name);
|
J2eeApplication | removeJ2eeApplication(java.lang.String name)Removes an application from the cache.
return (J2eeApplication) _j2eeApplications.remove(name);
|
java.lang.String | removeWebModule(java.lang.String name)Removes a web module from cache.
return (String) _webModules.remove(name);
|
void | save()Saves the current in memory cache indexes to a property file.
FileOutputStream fos = null;
try {
Properties pro = new Properties();
Collection eValues = _ejbModules.values();
for (Iterator iter=eValues.iterator(); iter.hasNext();) {
String ejbMod = (String) iter.next();
pro.put(ejbMod, EJB);
}
Collection wValues = _webModules.values();
for (Iterator iter=wValues.iterator(); iter.hasNext();) {
String webMod = (String) iter.next();
pro.put(webMod, WEB);
}
Collection aValues = _j2eeApplications.values();
for (Iterator iter=aValues.iterator(); iter.hasNext();) {
J2eeApplication app = (J2eeApplication) iter.next();
pro.put(app.getName(), app.getPersistentValue());
}
File file = new File(getPropertyFile());
fos = new FileOutputStream(file);
pro.store(fos, "");
} catch (Exception e) {
_logger.log(Level.FINE, "Error while saving ws-mgmt cache file", e);
} finally {
if (fos != null) {
try {
fos.close();
} catch (Exception e) { }
}
}
|