alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * EarConfigBean.java
 *
 * Created on February 28, 2002, 3:27 PM
 */

package org.netbeans.tests.j2eeserver.plugin.jsr88;

import javax.enterprise.deploy.spi.exceptions.*;
import javax.enterprise.deploy.spi.*;
import java.beans.*;
import javax.enterprise.deploy.model.*;

import java.util.*;

/**
 *
 * @author  gfink
 */
public class WebModuleConfigBean implements DConfigBeanRoot {
    
    DDBean bean;
    DepConfig config;
    Collection children = new HashSet();
    String WEBAPP = "/";
    String EJBREF = "web-app/ejb-ref";
    String RESOURCEREF = "web-app/resource-ref/res-ref-name";
    
    public WebModuleConfigBean(DDBean bean, DepConfig config) {
        this.bean = bean; this.config = config;
    }
      
    public DConfigBean getDConfigBean(DDBean dDBean) throws ConfigurationException {
        DConfigBean ret = null;
        if(dDBean.getXpath().endsWith(EJBREF))
            ret = new EjbRefConfigBean(dDBean, config);
        else if(dDBean.getXpath().endsWith(RESOURCEREF))
            ret = new ResourceRefConfigBean(dDBean, config);
        else if (dDBean.getXpath().endsWith(WEBAPP))
            ret = this;
        if(ret != null) children.add(ret);
        return ret;
    }
    
    public DDBean getDDBean() {
        return bean;
    }
    
    public String[] getXpaths() {
        //return new String[] { WEBAPP, RESOURCEREF, EJBREF };
        return new String[] { RESOURCEREF, EJBREF };
    }
    
    public void notifyDDChange(XpathEvent xpathEvent) {
    }
    
    public void removeDConfigBean(DConfigBean dConfigBean) throws BeanNotFoundException {
        children.remove(dConfigBean);
        propertyChangeSupport.firePropertyChange(dConfigBean.getClass().toString(),dConfigBean,null);
    }
    
      /** Utility field used by bound properties. */
      private PropertyChangeSupport propertyChangeSupport =  new PropertyChangeSupport(this);
      
      /** Holds value of property securityDomain. */
      private String securityDomain;
      
      /** Holds value of property contextRoot. */
      private String contextRoot;
      
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }
    
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }   
    
    /** Getter for property securityDomain.
     * @return Value of property securityDomain.
     */
    public String getSecurityDomain() {
        return this.securityDomain;
    }
    
    /** Setter for property securityDomain.
     * @param securityDomain New value of property securityDomain.
     */
    public void setSecurityDomain(String securityDomain) {
        String oldSecurityDomain = this.securityDomain;
        this.securityDomain = securityDomain;
        propertyChangeSupport.firePropertyChange("securityDomain", oldSecurityDomain, securityDomain);
    }
    
    /** Getter for property contextRoot.
     * @return Value of property contextRoot.
     *
     */
    public String getContextRoot() {
        return this.contextRoot;
    }
    
    /** Setter for property contextRoot.
     * @param contextRoot New value of property contextRoot.
     *
     */
    public void setContextRoot(String contextRoot) {
        this.contextRoot = contextRoot;
    }
    
    public DConfigBean getDConfigBean(DDBeanRoot dDBeanRoot) {
        return null;
    }
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.