KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > oc4j > ide > OC4JJ2eePlatformImpl


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.ide;
21
22 import java.io.File JavaDoc;
23 import java.util.HashSet JavaDoc;
24 import java.util.Set JavaDoc;
25 import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider;
26 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
27 import org.netbeans.modules.j2ee.deployment.plugins.api.J2eePlatformImpl;
28 import org.netbeans.modules.j2ee.oc4j.OC4JDeploymentManager;
29 import org.netbeans.modules.j2ee.oc4j.util.OC4JPluginProperties;
30 import org.netbeans.spi.project.libraries.LibraryImplementation;
31 import org.openide.util.NbBundle;
32 import org.openide.util.Utilities;
33
34 /**
35  *
36  * @author pblaha
37  */

38 public class OC4JJ2eePlatformImpl extends J2eePlatformImpl {
39     
40     private OC4JDeploymentManager dm;
41     private LibraryImplementation[] libraries;
42     private OC4JPluginProperties properties;
43     
44     public OC4JJ2eePlatformImpl(OC4JDeploymentManager dm) {
45         this.dm = dm;
46         this.properties = dm.getProperties();
47         initLibraries();
48     }
49     
50     public boolean isToolSupported(String JavaDoc toolName) {
51         if ("oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider".equals(toolName)) {
52             return true;
53         }
54         return false;
55     }
56     
57     
58     public File JavaDoc[] getToolClasspathEntries(String JavaDoc toolName) {
59         return new File JavaDoc[0];
60     }
61     
62     public Set JavaDoc getSupportedSpecVersions() {
63         Set JavaDoc <String JavaDoc> result = new HashSet JavaDoc<String JavaDoc>();
64         result.add(J2eeModule.JAVA_EE_5);
65         return result;
66     }
67     
68     public java.util.Set JavaDoc getSupportedModuleTypes() {
69         Set JavaDoc <Object JavaDoc> result = new HashSet JavaDoc<Object JavaDoc>();
70         result.add(J2eeModule.EAR);
71         result.add(J2eeModule.WAR);
72         result.add(J2eeModule.EJB);
73         return result;
74     }
75     
76     public java.io.File JavaDoc[] getPlatformRoots() {
77         return new File JavaDoc[0];
78     }
79     
80     public LibraryImplementation[] getLibraries() {
81         return libraries;
82     }
83     
84     public java.awt.Image JavaDoc getIcon() {
85         return Utilities.loadImage("org/netbeans/modules/j2ee/myserver/resources/server.gif"); // NOI18N
86

87     }
88     
89     public String JavaDoc getDisplayName() {
90         return NbBundle.getMessage(OC4JJ2eePlatformImpl.class, "MSG_OC4JServerPlatform");
91     }
92     
93     public Set JavaDoc getSupportedJavaPlatformVersions() {
94         return null;
95     }
96     
97     public org.netbeans.api.java.platform.JavaPlatform getJavaPlatform() {
98         return null;
99     }
100     
101     public void notifyLibrariesChanged() {
102         initLibraries();
103         firePropertyChange(PROP_LIBRARIES, null, libraries.clone());
104     }
105     
106     private void initLibraries() {
107         // create library
108
LibraryImplementation lib = new J2eeLibraryTypeProvider().createLibrary();
109         lib.setName(NbBundle.getMessage(OC4JJ2eePlatformImpl.class, "TITLE_OC4J_LIBRARY"));
110         lib.setContent(J2eeLibraryTypeProvider.VOLUME_TYPE_CLASSPATH, properties.getClasses());
111         libraries = new LibraryImplementation[] {lib};
112     }
113 }
Popular Tags