Source Code Cross Referenced for J2eeModule.java in  » 6.0-JDK-Core » j2eeserver » org » netbeans » modules » j2ee » deployment » devmodules » api » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » j2eeserver » org.netbeans.modules.j2ee.deployment.devmodules.api 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003         *
004         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005         *
006         * The contents of this file are subject to the terms of either the GNU
007         * General Public License Version 2 only ("GPL") or the Common
008         * Development and Distribution License("CDDL") (collectively, the
009         * "License"). You may not use this file except in compliance with the
010         * License. You can obtain a copy of the License at
011         * http://www.netbeans.org/cddl-gplv2.html
012         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013         * specific language governing permissions and limitations under the
014         * License.  When distributing the software, include this License Header
015         * Notice in each file and include the License file at
016         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017         * particular file as subject to the "Classpath" exception as provided
018         * by Sun in the GPL Version 2 section of the License file that
019         * accompanied this code. If applicable, add the following below the
020         * License Header, with the fields enclosed by brackets [] replaced by
021         * your own identifying information:
022         * "Portions Copyrighted [year] [name of copyright owner]"
023         *
024         * Contributor(s):
025         *
026         * The Original Software is NetBeans. The Initial Developer of the Original
027         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028         * Microsystems, Inc. All Rights Reserved.
029         *
030         * If you wish your version of this file to be governed by only the CDDL
031         * or only the GPL Version 2, indicate your decision by adding
032         * "[Contributor] elects to include this software in this distribution
033         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034         * single choice of license, a recipient has the option to distribute
035         * your version of this file under either the CDDL, the GPL Version 2 or
036         * to extend the choice of license to its licensees as provided above.
037         * However, if you add GPL Version 2 code and therefore, elected the GPL
038         * Version 2 license, then the option applies only if the new code is
039         * made subject to such option by the copyright holder.
040         */
041
042        package org.netbeans.modules.j2ee.deployment.devmodules.api;
043
044        import java.beans.PropertyChangeListener;
045        import java.io.File;
046        import org.netbeans.modules.j2ee.dd.api.common.RootInterface;
047        import org.netbeans.modules.j2ee.deployment.config.J2eeModuleAccessor;
048        import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleImplementation;
049        import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
050        import javax.enterprise.deploy.shared.ModuleType;
051        import org.openide.filesystems.FileObject;
052        import java.util.Iterator;
053        import org.netbeans.modules.j2ee.metadata.model.api.MetadataModel;
054        import org.openide.util.Parameters;
055
056        /** 
057         * Abstraction of J2EE module. Provides access to basic server-neutral properties 
058         * of the modules: J2EE version, module type, deployment descriptor.
059         * <p>
060         * It is not possible to instantiate this class directly. Implementators have to
061         * implement the {@link J2eeModuleImplementation} first and then use the
062         * {@link J2eeModuleFactory} to create a J2eeModule instance.
063         * 
064         * @author  Pavel Buzek
065         */
066        public class J2eeModule {
067
068            /** MIME type for ContentDescriptor of build targets that have J2eeModule in lookup.
069             * This can be used to search implementations of targets providing J2eeModule 
070             * in project's ContainersList.
071             */
072            public static final String MIME_J2EE_MODULE_TARGET = "MIME-org-nb-j2eeserver-J2eeModule-BuildTarget"; //NOI18N
073
074            /** The module is an EAR archive. */
075            public static final Object EAR = ModuleType.EAR;
076            /** The module is an Web Application archive. */
077            public static final Object WAR = ModuleType.WAR;
078            /** The module is an Enterprise Java Bean archive. */
079            public static final Object EJB = ModuleType.EJB;
080            /** The module is an Connector archive. */
081            public static final Object CONN = ModuleType.RAR;
082            /** The module is an Client Application archive. */
083            public static final Object CLIENT = ModuleType.CAR;
084
085            /** 
086             * J2EE specification version 1.3 
087             * @since 1.5
088             */
089            public static final String J2EE_13 = "1.3"; //NOI18N
090            /** 
091             * J2EE specification version 1.4 
092             * @since 1.5
093             */
094            public static final String J2EE_14 = "1.4"; //NOI18N
095            /**
096             * 
097             * JAVA EE 5 specification version
098             * 
099             * @since 1.6
100             */
101            public static final String JAVA_EE_5 = "1.5"; // NOI18N 
102
103            public static final String APP_XML = "META-INF/application.xml";
104            public static final String WEB_XML = "WEB-INF/web.xml";
105            public static final String WEBSERVICES_XML = "WEB-INF/webservices.xml";
106            public static final String EJBJAR_XML = "META-INF/ejb-jar.xml";
107            public static final String EJBSERVICES_XML = "META-INF/webservices.xml";
108            public static final String CONNECTOR_XML = "META-INF/ra.xml";
109            public static final String CLIENT_XML = "META-INF/application-client.xml";
110
111            /**
112             * Enterprise resorce directory property
113             */
114            public static final String PROP_RESOURCE_DIRECTORY = "resourceDir"; // NOI18N
115
116            /**
117             * Module version property
118             */
119            public static final String PROP_MODULE_VERSION = "moduleVersion"; // NOI18N
120
121            private J2eeModuleProvider j2eeModuleProvider;
122
123            public interface RootedEntry {
124                FileObject getFileObject();
125
126                String getRelativePath();
127            }
128
129            private final J2eeModuleImplementation impl;
130
131            J2eeModule(J2eeModuleImplementation impl) {
132                this .impl = impl;
133            }
134
135            /** 
136             * Returns a Java EE module specification version, version of a web application 
137             * for example.
138             * <p>
139             * Do not confuse with the Java EE platform specification version.
140             *
141             * @return module specification version.
142             */
143            public String getModuleVersion() {
144                return impl.getModuleVersion();
145            }
146
147            /** 
148             * Returns module type.
149             * 
150             * @return module type.
151             */
152            public Object getModuleType() {
153                return impl.getModuleType();
154            }
155
156            /** 
157             * Returns the location of the module within the application archive.
158             * 
159             * @return location of the module within the application archive.
160             */
161            public String getUrl() {
162                return impl.getUrl();
163            }
164
165            /** Returns the archive file for the module of null if the archive file 
166             * does not exist (for example, has not been compiled yet). 
167             */
168            public FileObject getArchive() throws java.io.IOException {
169                return impl.getArchive();
170            }
171
172            /** Returns the contents of the archive, in copyable form.
173             *  Used for incremental deployment.
174             *  Currently uses its own {@link RootedEntry} interface.
175             *  If the J2eeModule instance describes a
176             *  j2ee application, the result should not contain module archives.
177             *  @return Iterator through {@link RootedEntry}s
178             */
179            public Iterator getArchiveContents() throws java.io.IOException {
180                return impl.getArchiveContents();
181            }
182
183            /** This call is used in in-place deployment. 
184             *  Returns the directory staging the contents of the archive
185             *  This directory is the one from which the content entries returned
186             *  by {@link #getArchiveContents} came from.
187             *  @return FileObject for the content directory, return null if the 
188             *     module doesn't have a build directory, like an binary archive project
189             */
190            public FileObject getContentDirectory() throws java.io.IOException {
191                return impl.getContentDirectory();
192            }
193
194            /**
195             * Returns a metadata model of a deployment descriptor specified by the 
196             * <code>type</code> parameter.
197             * 
198             * <p>
199             * As an example, passing <code>org.netbeans.modules.j2ee.dd.api.web.WebAppMetadata.class</code>
200             * as a type parameter will return a metadata model of the web module deployment 
201             * descriptor - web.xml.
202             * </p>
203             * 
204             * @param type metadata model type class for which a <code>MetadataModel</code>
205             *        instance will be returned.
206             * 
207             * @return metadata model of a deployment descriptor specified by the <code>type</code>
208             *         parameter.
209             * 
210             * @throws NullPointerException if the <code>type</code> parameter is <code>null</code>.
211             */
212            public <T> MetadataModel<T> getMetadataModel(Class<T> type) {
213                Parameters.notNull("type", type); // NOI18N
214                return impl.getMetadataModel(type);
215            }
216
217            /**
218             * Returns the module resource directory or null if the module has no resource
219             * directory.
220             * 
221             * @return the module resource directory or null if the module has no resource
222             *         directory.
223             */
224            public File getResourceDirectory() {
225                return impl.getResourceDirectory();
226            }
227
228            /**
229             * Returns source deployment configuration file path for the given deployment 
230             * configuration file name.
231             *
232             * @param name file name of the deployment configuration file, WEB-INF/sun-web.xml
233             *        for example.
234             * 
235             * @return absolute path to the deployment configuration file, or null if the
236             *         specified file name is not known to this J2eeModule.
237             */
238            public File getDeploymentConfigurationFile(String name) {
239                return impl.getDeploymentConfigurationFile(name);
240            }
241
242            /**
243             * Add a PropertyChangeListener to the listener list.
244             * 
245             * @param listener PropertyChangeListener
246             */
247            public void addPropertyChangeListener(
248                    PropertyChangeListener listener) {
249                impl.addPropertyChangeListener(listener);
250            }
251
252            /**
253             * Remove a PropertyChangeListener from the listener list.
254             * 
255             * @param listener PropertyChangeListener
256             */
257            public void removePropertyChangeListener(
258                    PropertyChangeListener listener) {
259                impl.removePropertyChangeListener(listener);
260            }
261
262            synchronized J2eeModuleProvider getJ2eeModuleProvider() {
263                return j2eeModuleProvider;
264            }
265
266            synchronized void setJ2eeModuleProvider(
267                    J2eeModuleProvider j2eeModuleProvider) {
268                this .j2eeModuleProvider = j2eeModuleProvider;
269            }
270
271            static {
272                J2eeModuleAccessor.DEFAULT = new J2eeModuleAccessor() {
273                    public J2eeModule createJ2eeModule(
274                            J2eeModuleImplementation impl) {
275                        return new J2eeModule(impl);
276                    }
277
278                    public J2eeModuleProvider getJ2eeModuleProvider(
279                            J2eeModule j2eeModule) {
280                        return j2eeModule.getJ2eeModuleProvider();
281                    }
282
283                    public void setJ2eeModuleProvider(J2eeModule j2eeModule,
284                            J2eeModuleProvider j2eeModuleProvider) {
285                        j2eeModule.setJ2eeModuleProvider(j2eeModuleProvider);
286                    }
287                };
288            }
289        }
www._j___av_a___2_s___.__c__o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.