KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > oc4j > OC4JTargetModuleID


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.oc4j;
21
22 import java.util.Vector JavaDoc;
23 import javax.enterprise.deploy.spi.Target JavaDoc;
24 import javax.enterprise.deploy.spi.TargetModuleID JavaDoc;
25
26 /**
27  *
28  * @author pblaha
29  */

30 class OC4JTargetModuleID implements TargetModuleID JavaDoc {
31     private Target JavaDoc target;
32     private String JavaDoc jar_name;
33     private String JavaDoc context_url;
34     private Vector JavaDoc childs = new Vector JavaDoc();
35     private TargetModuleID JavaDoc parent = null;
36     
37     OC4JTargetModuleID(Target JavaDoc target) {
38         this( target, "");
39     }
40     
41     OC4JTargetModuleID(Target JavaDoc target, String JavaDoc jar_name) {
42         this.target = target;
43         this.setJARName(jar_name);
44     }
45     
46     public void setContextURL( String JavaDoc context_url) {
47         this.context_url = context_url;
48     }
49     
50     public void setJARName( String JavaDoc jar_name) {
51         this.jar_name = jar_name;
52     }
53     
54     public void setParent( OC4JTargetModuleID parent) {
55         this.parent = parent;
56         
57     }
58     
59     public void addChild( OC4JTargetModuleID child) {
60         childs.add( child );
61         child.setParent( this );
62     }
63     
64     public TargetModuleID JavaDoc[] getChildTargetModuleID() {
65         return (TargetModuleID JavaDoc[])childs.toArray(new TargetModuleID JavaDoc[childs.size()]);
66     }
67     
68     //Retrieve a list of identifiers of the children of this deployed module.
69
public String JavaDoc getModuleID(){
70         return jar_name;
71     }
72     
73     // Retrieve the id assigned to represent the deployed module.
74
public TargetModuleID JavaDoc getParentTargetModuleID() {
75         return parent;
76     }
77     
78     //Retrieve the identifier of the parent object of this deployed module.
79
public Target JavaDoc getTarget(){
80         return target;
81     }
82     //Retrieve the name of the target server.
83
public java.lang.String JavaDoc getWebURL() {
84         return context_url;//"http://" + module_id; //NOI18N
85
}
86     
87     //If this TargetModulID represents a web module retrieve the URL for it.
88
public java.lang.String JavaDoc toString() {
89         return getModuleID() + hashCode();
90     }
91 }
Popular Tags