KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > deployment > devmodules > api > J2eeModule


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.deployment.devmodules.api;
21
22 import org.netbeans.modules.schema2beans.BaseBean;
23 import javax.enterprise.deploy.shared.ModuleType JavaDoc;
24 import org.openide.filesystems.FileObject;
25 import java.util.Iterator JavaDoc;
26
27 /** Abstraction of J2EE module. Provides access to basic properties
28  * of the modules: J2EE version, module type, deployment descriptor.
29  *
30  * @author Pavel Buzek
31  */

32 public interface J2eeModule {
33
34     /** MIME type for ContentDescriptor of build targets that have J2eeModule in lookup.
35      * This can be used to search implementations of targets providing J2eeModule
36      * in project's ContainersList.
37      */

38     public static final String JavaDoc MIME_J2EE_MODULE_TARGET = "MIME-org-nb-j2eeserver-J2eeModule-BuildTarget"; //NOI18N
39

40     /** The module is an EAR archive. */
41     public static final Object JavaDoc EAR = ModuleType.EAR;
42     /** The module is an Web Application archive. */
43     public static final Object JavaDoc WAR = ModuleType.WAR;
44     /** The module is an Enterprise Java Bean archive. */
45     public static final Object JavaDoc EJB = ModuleType.EJB;
46     /** The module is an Connector archive. */
47     public static final Object JavaDoc CONN = ModuleType.RAR;
48     /** The module is an Client Application archive. */
49     public static final Object JavaDoc CLIENT = ModuleType.CAR;
50     
51     /**
52      * J2EE specification version 1.3
53      * @since 1.5
54      */

55     public static final String JavaDoc J2EE_13 = "1.3"; //NOI18N
56
/**
57      * J2EE specification version 1.4
58      * @since 1.5
59      */

60     public static final String JavaDoc J2EE_14 = "1.4"; //NOI18N
61
/**
62      *
63      * JAVA EE 5 specification version
64      *
65      * @since 1.6
66      */

67     public static final String JavaDoc JAVA_EE_5 = "1.5"; // NOI18N
68

69     public static final String JavaDoc APP_XML = "META-INF/application.xml";
70     public static final String JavaDoc WEB_XML = "WEB-INF/web.xml";
71     public static final String JavaDoc WEBSERVICES_XML = "WEB-INF/webservices.xml";
72     public static final String JavaDoc EJBJAR_XML = "META-INF/ejb-jar.xml";
73     public static final String JavaDoc EJBSERVICES_XML = "META-INF/webservices.xml";
74     public static final String JavaDoc CONNECTOR_XML = "META-INF/ra.xml";
75     public static final String JavaDoc CLIENT_XML = "META-INF/application-client.xml";
76     
77     /** Returns module specification version */
78     public String JavaDoc getModuleVersion();
79     
80     /** Returns module type */
81     public Object JavaDoc getModuleType();
82     
83     /** Returns the location of the module within the application archive. */
84     public abstract String JavaDoc getUrl ();
85     
86     /** Sets the location of the modules within the application archive.
87      * For example, a web module could be at "/wbmodule1.war" within the ear
88      * file. For standalone module the URL cannot be set to a different value
89      * then "/"
90      */

91     public void setUrl (String JavaDoc url);
92     
93     /** Returns the archive file for the module of null if the archive file
94      * does not exist (for example, has not been compiled yet).
95      */

96     public FileObject getArchive () throws java.io.IOException JavaDoc;
97     
98     /** Returns the contents of the archive, in copyable form.
99      * Used for incremental deployment.
100      * Currently uses its own {@link RootedEntry} interface.
101      * If the J2eeModule instance describes a
102      * j2ee application, the result should not contain module archives.
103      * @return Iterator through {@link RootedEntry}s
104      */

105     public Iterator JavaDoc getArchiveContents() throws java.io.IOException JavaDoc;
106
107     /** This call is used in in-place deployment.
108      * Returns the directory staging the contents of the archive
109      * This directory is the one from which the content entries returned
110      * by {@link #getArchiveContents} came from.
111      * @return FileObject for the content directory, return null if the
112      * module doesn't have a build directory, like an binary archive project
113      */

114     public FileObject getContentDirectory() throws java.io.IOException JavaDoc;
115     
116     /** Returns a live bean representing the final deployment descriptor
117      * that will be used for deploment of the module. This can be
118      * taken from sources, constructed on fly or a combination of these
119      * but it needs to be available even if the module has not been built yet.
120      *
121      * @param location Parameterized by location because of possibility of multiple
122      * deployment descriptors for a single module (jsp.xml, webservices.xml, etc).
123      * Location must be prefixed by /META-INF or /WEB-INF as appropriate.
124      * @return a live bean representing the final DD
125      */

126     public BaseBean getDeploymentDescriptor(String JavaDoc location);
127
128     public interface RootedEntry {
129         FileObject getFileObject ();
130         String JavaDoc getRelativePath ();
131     }
132     
133     /** Add module change listener.
134      * @param listener on version change
135      */

136     public void addVersionListener(VersionListener listener);
137     
138     /** Remove module version change listener.
139      * @param listener on version change
140      */

141     public void removeVersionListener(VersionListener listener);
142     
143     public interface VersionListener {
144         void versionChanged(String JavaDoc oldVersion, String JavaDoc newVersion);
145     }
146 }
147
Popular Tags