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: /*
043: * EjbContainerVendor.java
044: */
045:
046: package org.netbeans.modules.visualweb.ejb.datamodel;
047:
048: import org.openide.util.NbBundle;
049:
050: /**
051: * This class lists all the EJB container vendors Rave can support
052: *
053: * @author cao
054: */
055: public class EjbContainerVendor {
056: // Supported application servers
057: public static final String SUN_APP_SERVER_9_1 = NbBundle
058: .getMessage(EjbContainerVendor.class, "SUN_APP_SERVER_9_1");
059:
060: public static final String SUN_APP_SERVER_9 = NbBundle.getMessage(
061: EjbContainerVendor.class, "SUN_APP_SERVER_9");
062: public static final String SUN_APP_SERVER_8_1 = NbBundle
063: .getMessage(EjbContainerVendor.class, "SUN_APP_SERVER_8_1");
064: public static final String SUN_APP_SERVER_8 = NbBundle.getMessage(
065: EjbContainerVendor.class, "SUN_APP_SERVER_8");
066: public static final String SUN_APP_SERVER_7 = NbBundle.getMessage(
067: EjbContainerVendor.class, "SUN_APP_SERVER_7");
068: public static final String WEBLOGIC_8_1 = NbBundle.getMessage(
069: EjbContainerVendor.class, "BEA_WEBLOGIC_8_1");
070: public static final String WEBSPHERE_5_1 = NbBundle.getMessage(
071: EjbContainerVendor.class, "IBM_WEBSPHERE_5_1");
072:
073: // Default IIOP Port for different application servers
074: public static final int SUN_APP_SERVER_PORT = 3700;
075: public static final int WEBLOGIC_PORT = 7001;
076: public static final int WEBSPHERE_PORT = 2809;
077: public static final int UNKNOWN_PORT = 0;
078:
079: // EJB deployment descriptors
080: public static final String STANDARD_DEPLOYMENT_DESCRIPTOR = "ejb-jar.xml";
081: public static final String SUN_DEPLOYMENT_DESCRIPTOR = "sun-ejb-jar.xml";
082: public static final String WEBLOGIC_DEPLOYMENT_DESCRIPTOR = "weblogic-ejb-jar.xml";
083: public static final String WEBSPHERE_DEPLOYMENT_DESCRIPTOR = "ibm-ejb-jar-bnd.xmi";
084:
085: public static String[] getContainerTypeNames() {
086: String[] containerTypes = { SUN_APP_SERVER_9_1,
087: SUN_APP_SERVER_9, SUN_APP_SERVER_8_1, SUN_APP_SERVER_8,
088: SUN_APP_SERVER_7, WEBLOGIC_8_1, WEBSPHERE_5_1 };
089: return containerTypes;
090: }
091:
092: public static int getDefaultPort(String server) {
093: if (isSunAppServer(server))
094: return SUN_APP_SERVER_PORT;
095: else if (server.equals(WEBLOGIC_8_1))
096: return WEBLOGIC_PORT;
097: else if (server.equals(WEBSPHERE_5_1))
098: return WEBSPHERE_PORT;
099: else
100: return UNKNOWN_PORT;
101: }
102:
103: public static String getVendorDDFileName(String server) {
104: if (isSunAppServer(server))
105: return SUN_DEPLOYMENT_DESCRIPTOR;
106: else if (server.equals(WEBLOGIC_8_1))
107: return WEBLOGIC_DEPLOYMENT_DESCRIPTOR;
108: else if (server.equals(WEBSPHERE_5_1))
109: return WEBSPHERE_DEPLOYMENT_DESCRIPTOR;
110: else
111: throw new java.lang.IllegalArgumentException(server);
112: }
113:
114: static boolean isSunAppServer(String server) {
115: return server.equals(SUN_APP_SERVER_9_1)
116: || server.equals(SUN_APP_SERVER_9)
117: || server.equals(SUN_APP_SERVER_8_1)
118: || server.equals(SUN_APP_SERVER_8)
119: || server.equals(SUN_APP_SERVER_7);
120: }
121: }
|