FileDocCategorySizeDatePackage
J2eeApplication.javaAPI DocGlassfish v2 API6220Fri May 04 22:24:44 BST 2007com.sun.enterprise.admin.wsmgmt.repository.impl.cache

J2eeApplication

public class J2eeApplication extends Object
Represents a J2EE Application with ejb and web modules that have web services.
author
Nazrul Islam
since
J2SE 5.0

Fields Summary
String
_name
List
_ejbBundles
List
_webBundles
static final String
DELIM
static final String
EJB_KEY
static final String
WEB_KEY
Constructors Summary
J2eeApplication(String name, List ejb, List web)
Constructor.

param
name name of the application
param
ejb name of ejb bundles with web services
param
web name of web bundles with web services

        _name        = name;
        _ejbBundles  = ejb;
        _webBundles  = web;
    
J2eeApplication(String key, String val)
Constructor.

param
key name of the application
param
val string representation of the ejb and web bundles

        _name = key;
        _ejbBundles = new ArrayList();
        _webBundles = new ArrayList();

        StringTokenizer st = new StringTokenizer(val, DELIM);
        while (st.hasMoreTokens()) {
            String m = st.nextToken();
            if (m.startsWith(EJB_KEY)) {
                int ejbKeyLength = EJB_KEY.length();
                String ejbModule = m.substring(ejbKeyLength);   
                addEjbBundle(ejbModule);

            } else if (m.startsWith(WEB_KEY)) {
                int webKeyLength = WEB_KEY.length();
                String webModule = m.substring(webKeyLength);   
                addWebBundle(webModule);
            }
        }
    
Methods Summary
voidaddEjbBundle(java.lang.String name)
Adds an ejb bundle to the list.

param
name name of the ejb bundle

        _ejbBundles.add(name);
    
voidaddWebBundle(java.lang.String name)
Adds a web bundle to the list.

param
name name of the web bundle

        _webBundles.add(name);
    
public java.util.ListgetEjbBundles()
Returns the name of the ejb bundles that have web services.

return
list of ejb bundles with web services

        return _ejbBundles;
    
public java.lang.StringgetName()
Returns the name of the application.

return
name of the application

        return _name;
    
java.lang.StringgetPersistentValue()
Returns a string representation of the ejb and web bundles.

return
a string representation of the ejb and web bundles

        StringBuffer sb = new StringBuffer();

        for (Iterator iter=_ejbBundles.iterator(); iter.hasNext();) {
            String ejb = (String) iter.next();
            sb.append(EJB_KEY);
            sb.append(ejb);
            sb.append(DELIM);
        }

        for (Iterator iter=_webBundles.iterator(); iter.hasNext();) {
            String web = (String) iter.next();
            sb.append(WEB_KEY);
            sb.append(web);
            sb.append(DELIM);
        }

        String persistentValue = null;
        int length = sb.length();
        if (length > 0) {
            String val = sb.toString();
            persistentValue = val.substring(0, length-1);
        }
        return persistentValue;
    
public java.util.ListgetWebBundles()
Returns the name of the web bundles that have web services.

return
list of web bundles with web services

        return _webBundles;
    
booleanremoveEjbBundle(java.lang.String name)
Removes an ejb bundle from the list.

param
name name of the ejb bundle
return
true if the bundle was removed

        return _ejbBundles.remove(name);
    
booleanremoveWebBundle(java.lang.String name)
Removes a web bundle from the list.

param
name name of the web bundle
return
true if bundle was removed

        return _webBundles.remove(name);