KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > deployment > plugins > api > J2eePlatformImpl


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.plugins.api;
21
22
23 import java.awt.Image JavaDoc;
24 import java.beans.PropertyChangeListener JavaDoc;
25 import java.beans.PropertyChangeSupport JavaDoc;
26 import java.io.File JavaDoc;
27 import java.util.Collections JavaDoc;
28 import java.util.Set JavaDoc;
29 import org.netbeans.api.java.platform.JavaPlatform;
30 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
31 import org.netbeans.spi.project.libraries.LibraryImplementation;
32
33 /**
34  * Base SPI interface for J2eePlatform. The J2eePlatform describes the target
35  * environment J2EE applications are build against and subsequently deployed to.
36  * Each server instance defines its own J2EE platform.
37  *
38  * @author Stepan Herold
39  * @since 1.5
40  */

41 public abstract class J2eePlatformImpl {
42     
43     /** Display name property */
44     public static final String JavaDoc PROP_DISPLAY_NAME = "displayName"; //NOI18N
45
/** Libraries property */
46     public static final String JavaDoc PROP_LIBRARIES = "libraries"; //NOI18N
47
/** Platform roots property */
48     public static final String JavaDoc PROP_PLATFORM_ROOTS = "platformRoots"; //NOI18N
49

50     private PropertyChangeSupport JavaDoc supp;
51     
52     /**
53      * Return platform's libraries.
54      *
55      * @return platform's libraries.
56      */

57     public abstract LibraryImplementation[] getLibraries();
58     
59     /**
60      * Return platform's display name.
61      *
62      * @return platform's display name.
63      */

64     public abstract String JavaDoc getDisplayName();
65     
66     /**
67      * Return an icon describing the platform. This will be mostly the icon
68      * used for server instance nodes
69      *
70      * @return an icon describing the platform
71      * @since 1.6
72      */

73     public abstract Image JavaDoc getIcon();
74     
75     /**
76      * Return platform's root directories. This will be mostly server's installation
77      * directory.
78      *
79      * @return platform's root directories.
80      */

81     public abstract File JavaDoc[] getPlatformRoots();
82     
83     /**
84      * Return classpath for the specified tool. Use the tool constants declared
85      * in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform}.
86      *
87      * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}.
88      * @return classpath for the specified tool.
89      */

90     public abstract File JavaDoc[] getToolClasspathEntries(String JavaDoc toolName);
91     
92     /**
93      * Specifies whether a tool of the given name is supported by this platform.
94      * Use the tool constants declared in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform}.
95      *
96      * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}
97      * .
98      * @return <code>true</code> if platform supports tool of the given name,
99      * <code>false</code> otherwise.
100      */

101     public abstract boolean isToolSupported(String JavaDoc toolName);
102     
103     /**
104      * Return a list of supported J2EE specification versions. Use J2EE specification
105      * versions defined in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule}
106      * class.
107      *
108      * @return list of supported J2EE specification versions.
109      */

110     public abstract Set JavaDoc/*<String>*/ getSupportedSpecVersions();
111     
112     /**
113      * Return a list of supported J2EE specification versions for
114      * a given module type.
115      *
116      * Implement this method if the server supports different versions
117      * of spec for different types of modules.
118      * If this method is not implemented by the plugin the IDE
119      * will use the non parametrized version of
120      * getSupportedSpecVersions.
121      *
122      * @param moduleType one of the constants defined in
123      * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule}
124      * @return list of supported J2EE specification versions.
125      */

126     public Set JavaDoc <String JavaDoc> getSupportedSpecVersions(Object JavaDoc moduleType) {
127         return getSupportedSpecVersions();
128     }
129     
130     /**
131      * Return a list of supported J2EE module types. Use module types defined in the
132      * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule}
133      * class.
134      *
135      * @return list of supported J2EE module types.
136      */

137     public abstract Set JavaDoc/*<Object>*/ getSupportedModuleTypes();
138     
139     /**
140      * Return a set of J2SE platform versions this J2EE platform can run with.
141      * Versions should be specified as strings i.g. ("1.3", "1.4", etc.)
142      *
143      * @since 1.9
144      */

145     public abstract Set JavaDoc/*<String>*/ getSupportedJavaPlatformVersions();
146     
147     /**
148      * Return server J2SE platform or null if the platform is unknown, not
149      * registered in the IDE.
150      *
151      * @return server J2SE platform or null if the platform is unknown, not
152      * registered in the IDE.
153      *
154      * @since 1.9
155      */

156     public abstract JavaPlatform getJavaPlatform();
157     
158     /**
159      * Register a listener which will be notified when some of the platform's properties
160      * change.
161      *
162      * @param l listener which should be added.
163      */

164     public final void addPropertyChangeListener(PropertyChangeListener JavaDoc l) {
165         synchronized (this) {
166             if (supp == null)
167                 supp = new PropertyChangeSupport JavaDoc(this);
168         }
169         supp.addPropertyChangeListener(l);
170     }
171     
172     /**
173      * Remove a listener registered previously.
174      *
175      * @param l listener which should be removed.
176      */

177     public final void removePropertyChangeListener(PropertyChangeListener JavaDoc l) {
178         if (supp != null)
179             supp.removePropertyChangeListener(l);
180     }
181     
182
183     /**
184      * Fire PropertyChange to all registered PropertyChangeListeners.
185      *
186      * @param propName property name.
187      * @param oldValue old value.
188      * @param newValue new value.
189      */

190     public final void firePropertyChange(String JavaDoc propName, Object JavaDoc oldValue, Object JavaDoc newValue) {
191         if (supp != null)
192             supp.firePropertyChange(propName, oldValue, newValue);
193     }
194
195     /**
196      * Returns the property value for the specified tool.
197      * <p>
198      * The property value uses Ant property format and therefore may contain
199      * references to another properties defined either by the client of this API
200      * or by the tool itself.
201      * <p>
202      * The properties the client may be requited to define are as follows
203      * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#CLIENT_PROP_DIST_ARCHIVE}
204      *
205      * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}.
206      * @param propertyName tool property name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_PROP_MAIN_CLASS}.
207      *
208      * @return property value or null, if the property is not defined for the
209      * specified tool.
210      *
211      * @since 1.16
212      */

213     public String JavaDoc getToolProperty(String JavaDoc toolName, String JavaDoc propertyName) {
214         return null;
215     }
216 }
217
Popular Tags