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

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
 * Microsystems, Inc. All Rights Reserved.
 */


package org.netbeans.modules.j2ee.deployment.config;

import javax.enterprise.deploy.model.*;
import javax.enterprise.deploy.shared.*;

import java.util.*;

public class ApplImpl extends DeployableObjectImpl implements J2eeApplicationObject {
    
    final Map map;
    
    /** Creates new ApplImpl */
    ApplImpl(ModuleDeploymentSupport support, Map moduleMap) {
        super(support);
        this.map = moduleMap;
    }
    
    public DeployableObject getDeployableObject(String uri) {
        ModuleDeploymentSupport mds = (ModuleDeploymentSupport) map.get(uri);
        if(mds == null) return null;
        return mds.obj;
    }
    
    public DeployableObject[] getDeployableObjects(ModuleType type){ 
        Iterator i = map.values().iterator();
        Vector v = new Vector();
        while(i.hasNext()) {
            ModuleDeploymentSupport mds =  (ModuleDeploymentSupport)i.next();
            if(mds.obj.getType().equals(type)) v.add(mds.obj);
        }
        DeployableObject[] ret = new DeployableObject[v.size()];
        v.copyInto(ret);
        return ret; 
    }
    
    public DeployableObject[] getDeployableObjects() {
        Object[] supports = map.values().toArray();
        DeployableObject[] ret = new DeployableObject[supports.length];
        for(int i = 0; i < ret.length; i++) {
            ret[i] = ((ModuleDeploymentSupport)supports[i]).obj;
        }
        return ret;
    }
        
    public String[] getModuleUris(ModuleType type){  
        Iterator i = map.keySet().iterator();
        Vector v = new Vector();
        while(i.hasNext()) {
            String url = (String)i.next();
            ModuleDeploymentSupport mds =  (ModuleDeploymentSupport)map.get(url);
            if(mds.obj.getType().equals(type)) v.add(url);
        }
        String[] ret = new String[v.size()];
        v.copyInto(ret);
        return ret; 
 }
    
    public String[] getModuleUris() {
        Collection uris = map.keySet();
        String[] ret = new String[uris.size()];
        uris.toArray(ret);
        return ret;
    }
    
    //PENDING
   public DDBean[] getChildBean(ModuleType type, String xpath){ return null; }
   
    //PENDING
   public String[] getText(ModuleType type, String xpath){ return null; }
   
    //PENDING
   public void addXpathListener(ModuleType type, String xpath, XpathListener xpl){ return ; }
   
    //PENDING
   public void removeXpathListener(ModuleType type, String xpath, XpathListener xpl){ return ; }
   
}
... 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.