KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > core > dev > wizard > ProjectInfo


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.websvc.core.dev.wizard;
21
22 import java.util.Map JavaDoc;
23 import org.netbeans.api.project.Project;
24 import org.netbeans.modules.j2ee.api.ejbjar.EjbJar;
25 import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
26 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
27 import org.netbeans.modules.web.api.webmodule.WebModule;
28 import org.netbeans.modules.websvc.jaxws.api.JAXWSSupport;
29 import org.openide.WizardDescriptor;
30
31 /**
32  *
33  * @author radko
34  */

35 public class ProjectInfo {
36     
37     private Project project;
38     private int projectType;
39     
40     public static final int JSE_PROJECT_TYPE = 0;
41     public static final int WEB_PROJECT_TYPE = 1;
42     public static final int EJB_PROJECT_TYPE = 2;
43     
44     private boolean jwsdpSupported = false;
45     private boolean jsr109Supported = false;
46     private boolean jsr109oldSupported = false;
47     
48     /** Creates a new instance of ProjectInfo */
49     
50     public ProjectInfo(Project project) {
51         this.project=project;
52         JAXWSSupport wss = JAXWSSupport.getJAXWSSupport(project.getProjectDirectory());
53         if (wss != null) {
54             Map JavaDoc properties = wss.getAntProjectHelper().getStandardPropertyEvaluator().getProperties();
55             String JavaDoc serverInstance = (String JavaDoc)properties.get("j2ee.server.instance"); //NOI18N
56
if (serverInstance != null) {
57                 J2eePlatform j2eePlatform = Deployment.getDefault().getJ2eePlatform(serverInstance);
58                 if (j2eePlatform != null) {
59                     jwsdpSupported = j2eePlatform.isToolSupported(J2eePlatform.TOOL_JWSDP);
60                     jsr109Supported = j2eePlatform.isToolSupported(J2eePlatform.TOOL_JSR109);
61                     jsr109oldSupported = j2eePlatform.isToolSupported(J2eePlatform.TOOL_WSCOMPILE);
62                 }
63             }
64         }
65         
66         WebModule wm = WebModule.getWebModule(project.getProjectDirectory());
67         EjbJar em = EjbJar.getEjbJar(project.getProjectDirectory());
68         if (em != null)
69             projectType = EJB_PROJECT_TYPE;
70         else if (wm != null)
71             projectType = WEB_PROJECT_TYPE;
72         else
73             projectType = JSE_PROJECT_TYPE;
74     }
75     
76     public int getProjectType() {
77         return projectType;
78     }
79     
80     public Project getProject() {
81         return project;
82     }
83     
84     public boolean isJwsdpSupported() {
85         return jwsdpSupported;
86     }
87     public boolean isJsr109Supported() {
88         return jsr109Supported;
89     }
90     public boolean isJsr109oldSupported() {
91         return jsr109oldSupported;
92     }
93 }
94
95
Popular Tags