Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal')
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPlugin.properties31
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPluginMessages.java48
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/NullStatusMonitor.java61
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusMonitor.java37
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusRenderer.java32
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/AnyFilter.java82
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/Filter.java86
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/IProjectToStringTransformer.java28
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEActionAdapterFactory.java122
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java1407
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java248
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ResourceUtils.java1890
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/SelectionToResource.java69
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java788
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StatusObjectHandler.java140
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java32
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java95
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TestFacilityListTransformer.java40
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TypeRuntimeServerModifier.java93
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringToIProjectTransformer.java41
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringUtils.java288
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/UniversalPathTransformer.java137
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaBeanProperty.java96
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRule.java129
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRuleEngine.java56
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceAnalyzer.java214
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceRuleEngine.java278
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JDTResolver.java877
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaBeanProperty.java147
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRule.java143
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRuleSet.java285
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0001.java68
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0002.java82
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0003.java151
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0005.java121
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0006.java164
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRuleSetFactory.java44
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentScenarioContext.java367
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentUDDIPreferenceContext.java49
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioContext.java104
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java117
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/TransientScenarioContext.java293
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceContext.java31
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceDefaults.java24
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/LabelsAndIds.java48
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/TypeRuntimeServer.java114
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/dialog/IStatusDialogConstants.java40
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExecutable.java31
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtension.java46
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionImpl.java100
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistry.java42
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java118
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/JavaProxyTestCommand.java39
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WSDLTestFinishCommand.java19
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java178
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestFinishCommand.java39
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java144
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/plugin/WebServicePlugin.java97
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaClientInfo.java48
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaInfo.java48
60 files changed, 0 insertions, 10786 deletions
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPlugin.properties b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPlugin.properties
deleted file mode 100644
index 0ffee3f21..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPlugin.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-###############################################################################
-# Copyright (c) 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-MSG_ERROR_SERVER=IWAB0213E Error in starting server.
-
-ANY_FILTER_NAME=All files
-ANY_FILTER_DESC=This is a kind of Filter that accepts all objects.
-
-ERROR_SELECTION_TRANSFORM=Specified selection does not match a resource.
-
-MSG_JAXRPC11_NOT_COMPLIANT=The service class "{0}" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.
-MSG_JAXRPC11_UNRESOLVED_CLASS=The class "{0}" cannot be loaded via project "{1}". Check that the project contains the class, or that the class is loadable according to the Java Build Path of the project.
-MSG_JAXRPC11_UNRESOLVED_TYPE=A data type, "{0}", could not be resolved while analyzing the service class. Check your project classpath.
-MSG_JAXRPC11_RULE_0001=The service class "{0}" does not have a public default constructor. Chapter 10.1 of the JAX-RPC 1.1 specification requires a service class to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the service class to handle an incoming request message.
-MSG_JAXRPC11_RULE_0002=The value type "{0}" used via the service class "{1}" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization.
-MSG_JAXRPC11_RULE_0003=The method "{0}" on the service class "{1}" is overloaded. Overloaded methods are allowed by chapter 5.5.5 of the JAX-RPC 1.1 specification, however, some JAX-RPC 1.1 compliant tools may not allow overloaded methods or may generate WSDL with overloaded operations as contrary to rule R2304 of the WS-I Basic Profile.
-MSG_JAXRPC11_RULE_0004=The service specific exception class "{0}" does not have a public constructor with parameters corresponding in number and type to the getter methods on the class. Chapter 5.5.5 of the JAX-RPC 1.1 specification requires a service specific exception to have a public constructor with the same number of parameters as there are getter methods, and of matching data types, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the exception during deserialization of a fault message.
-MSG_JAXRPC11_RULE_0005=The method "{0}" on the service class "{1}" uses a data type, "{2}", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
-MSG_JAXRPC11_RULE_0006=The field or property "{0}" on the value type "{1}" used via the service class "{2}" has a data type, "{3}", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
-MSG_JAXRPC11_RULE_0007=The primitive type "{0}" is not supported by the JAX-RPC 1.1 specification. As stated in chapter 5.1.1 of the specification, the supported primitive types are "boolean", "byte", "short", "int", "long", "float" and "double".
-MSG_JAXRPC11_RULE_0008=The wrapper type "{0}" is not supported by the JAX-RPC 1.1 specification. As stated in chapter 5.1.1 of the specification, the supported wrapper types are those corresponding to "boolean", "byte", "short", "int", "long", "float" and "double".
-MSG_JAXRPC11_RULE_0009=The Java type "{0}" is not supported by the JAX-RPC 1.1 specification. As stated in chapter 5.1.3 of the specification, the supported standard types are "java.lang.String", "java.util.Date", "java.util.Calendar", "java.math.BigInteger", "java.math.BigDecimal", "javax.xml.namespace.QName" and "java.net.URI".
-MSG_JAXRPC11_RULE_0010=Support for collection and map classes such as "{0}" is not required by JAX-RPC 1.1. Due to their non-type safe nature, a JAX-RPC 1.1 compliant Web service engine may not handle collections, or may represent them in WSDL documents and SOAP messages in a manner that impairs interoperability. The use of arrays instead of collections is strongly recommended. \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPluginMessages.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPluginMessages.java
deleted file mode 100644
index 58874f2ae..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/WSPluginMessages.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060420 132905 cbrealey@ca.ibm.com - Chris Brealey
- * 20060607 145604 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class WSPluginMessages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.jst.ws.internal.WSPlugin";//$NON-NLS-1$
-
- private WSPluginMessages() {
- // Do not instantiate
- }
-
- public static String MSG_ERROR_SERVER;
- public static String ANY_FILTER_NAME;
- public static String ANY_FILTER_DESC;
- public static String ERROR_SELECTION_TRANSFORM;
- public static String MSG_JAXRPC11_NOT_COMPLIANT;
- public static String MSG_JAXRPC11_UNRESOLVED_CLASS;
- public static String MSG_JAXRPC11_UNRESOLVED_TYPE;
- public static String MSG_JAXRPC11_RULE_0001;
- public static String MSG_JAXRPC11_RULE_0002;
- public static String MSG_JAXRPC11_RULE_0003;
- public static String MSG_JAXRPC11_RULE_0004;
- public static String MSG_JAXRPC11_RULE_0005;
- public static String MSG_JAXRPC11_RULE_0006;
- public static String MSG_JAXRPC11_RULE_0007;
- public static String MSG_JAXRPC11_RULE_0008;
- public static String MSG_JAXRPC11_RULE_0009;
- public static String MSG_JAXRPC11_RULE_0010;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, WSPluginMessages.class);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/NullStatusMonitor.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/NullStatusMonitor.java
deleted file mode 100644
index c0454d107..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/NullStatusMonitor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.command;
-
-import java.util.Vector;
-import org.eclipse.core.runtime.IStatus;
-
-/**
-* A NullStatusRenderer throws away IStatus information.
-*/
-public class NullStatusMonitor implements StatusMonitor
-{
-
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- protected boolean result;
-
- /**
- * Default constructor.
- */
- public NullStatusMonitor () {}
- /**
- * Does nothing.
- */
- public int reportStatus(IStatus status, Vector options) { return 0; }
- public boolean reportStatus(IStatus status)
- {
- switch (status.getSeverity())
- {
- case IStatus.ERROR:
- case IStatus.WARNING:
- result = false;
- break;
- case IStatus.INFO:
- default: //IStatus.OK
- result = true;
- break;
- }
- return result;
- }
- public void dumpSavedStatus() { }
- public boolean canContinue()
- {
- return result;
- }
-
- public void reset () {
- result = true;
- }
-}
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusMonitor.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusMonitor.java
deleted file mode 100644
index de0758f77..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusMonitor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.command;
-
-import java.util.Vector;
-import org.eclipse.core.runtime.IStatus;
-
-/**
-* A StatusMonitor reports IStatus information to a display system.
-*/
-public interface StatusMonitor
-{
-
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- /**
- * reports the contents of the given status object.
- * Subclasses must implement this method to report
- * IStatus information to a given display system,
- * such as SWT, the command line, or a trace file.
- */
- public int reportStatus(IStatus status, Vector options);
- public boolean reportStatus(IStatus status);
- public void dumpSavedStatus();
- public boolean canContinue();
- public void reset();
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusRenderer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusRenderer.java
deleted file mode 100644
index 0cff3a6b8..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/command/StatusRenderer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.command;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
-* A StatusRenderer renders IStatus information to a display system.
-*/
-public interface StatusRenderer
-{
-
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- /**
- * Renders the contents of the given status object.
- * Subclasses must implement this method to render
- * IStatus information to a given display system,
- * such as SWT, the command line, or a trace file.
- */
- public void render ( IStatus status );
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/AnyFilter.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/AnyFilter.java
deleted file mode 100644
index c88ba88cd..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/AnyFilter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-
-/**
-* This is a kind of {@link Filter} that accepts all objects,
-* and is a suitable base class for new <code>Filters</code>.
-*/
-public class AnyFilter implements Filter
-{
-
- /**
- * Constructs a new <code>AnyFilter</code>.
- */
- public AnyFilter ()
- {
- }
-
- /**
- * Returns the locale-specific name of this filter.
- * @return The locale-specific name of this filter.
- */
- public String getName ()
- {
- return WSPluginMessages.ANY_FILTER_NAME;
- }
-
- /**
- * Returns the locale-specific description of this filter.
- * @return The locale-specific description of this filter.
- */
- public String getDescription ()
- {
- return WSPluginMessages.ANY_FILTER_DESC;
- }
-
- /**
- * Returns an {@link org.eclipse.core.runtime.IStatus}
- * describing the <code>Filter</code>'s assessment of
- * the given <code>object</code>.
- * See {@link Filter#statusOf} for general comments.
- * The default implementation of <code>AnyFilter</code>
- * returns a status with severity <code>IStatus.OK</code>.
- * Subclasses may override.
- * @param object The object to filter.
- * @return An {@link org.eclipse.core.runtime.IStatus}.
- */
- public IStatus statusOf ( Object object )
- {
- return new Status(IStatus.OK,WebServicePlugin.ID,0,"",null);
- }
-
- /**
- * Returns true if and only if {@link #statusOf} returns
- * an {@link org.eclipse.core.runtime.IStatus} with a
- * severity of less than <code>IStatus.ERROR</code>.
- * Subclasses may override to provide a higher-performance
- * implementation.
- * @param object The object to filter.
- * @return True if and only if {@link #statusOf} returns
- * an {@link org.eclipse.core.runtime.IStatus} with a
- * severity of less than <code>IStatus.ERROR</code>.
- */
- public boolean accepts ( Object object )
- {
- return !statusOf(object).matches(IStatus.ERROR);
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/Filter.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/Filter.java
deleted file mode 100644
index 7749cad43..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/Filter.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
-* This is the interface for a class of objects that filter
-* other objects for inclusion or exclusion by some consumer.
-*/
-public interface Filter
-{
-
- /**
- * Returns the locale-specific name of this filter.
- * @return The locale-specific name of this filter.
- */
- public String getName ();
-
- /**
- * Returns the locale-specific description of this filter.
- * @return The locale-specific description of this filter.
- */
- public String getDescription ();
-
- /**
- * Returns an {@link org.eclipse.core.runtime.IStatus}
- * describing the <code>Filter</code>'s assessment of
- * the given <code>object</code>.
- * The severity of the
- * returned <code>IStatus</code> is as follows:
- * <ul>
- * <li>
- * {@link org.eclipse.core.runtime.IStatus#OK}
- * if the <code>Filter</code> accepts the <code>object</code>
- * with no further information for the caller (meaning the
- * {@link org.eclipse.core.runtime.IStatus#getMessage} and
- * {@link org.eclipse.core.runtime.IStatus#getException} methods
- * are ignored).
- * <li>
- * {@link org.eclipse.core.runtime.IStatus#INFO}
- * if the <code>Filter</code> accepts the <code>object</code>
- * Additional information may be available from the
- * {@link org.eclipse.core.runtime.IStatus#getMessage} and
- * {@link org.eclipse.core.runtime.IStatus#getException} methods.
- * <li>
- * {@link org.eclipse.core.runtime.IStatus#WARNING}
- * if the <code>Filter</code> accepts the <code>object</code>.
- * Additional information may be available from the
- * {@link org.eclipse.core.runtime.IStatus#getMessage} and
- * {@link org.eclipse.core.runtime.IStatus#getException} methods.
- * <li>
- * {@link org.eclipse.core.runtime.IStatus#ERROR}
- * if the <code>Filter</code> does not accept the <code>object</code>.
- * Additional information may be available from the
- * {@link org.eclipse.core.runtime.IStatus#getMessage} and
- * {@link org.eclipse.core.runtime.IStatus#getException} methods.
- * </ul>
- * @param object The object to filter.
- * @return An {@link org.eclipse.core.runtime.IStatus}
- * describing the <code>Filter</code>'s assessment of
- * the given <code>object</code>.
- */
- public IStatus statusOf ( Object object );
-
- /**
- * Returns true if and only if this <code>Filter</code>
- * accepts the given <code>object</code>. This method
- * must return true if and only if {@link #statusOf}
- * returns an <code>IStatus</code> with a severity of
- * less than <code>IStatus.ERROR</code>.
- * @param object The object to filter.
- * @return True if and only if this <code>Filter</code>
- * accepts the given <code>object</code>.
- */
- public boolean accepts ( Object object );
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/IProjectToStringTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/IProjectToStringTransformer.java
deleted file mode 100644
index 5bec5527e..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/IProjectToStringTransformer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-
-
-
-/**
- * Transfroms a org.eclipse.core.runtime.IProject to java.lang.String
- */
-public class IProjectToStringTransformer implements Transformer {
-
- public Object transform(Object value)
- {
- IProject project = (IProject)value;
- return project.getName();
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEActionAdapterFactory.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEActionAdapterFactory.java
deleted file mode 100644
index 2bf7bf063..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEActionAdapterFactory.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060222 125574 zina@ca.ibm.com - Zina Mostafia
- * 20060222 225574 gilberta@ca.ibm.com - Gilbert Andrews
- *******************************************************************************/
-/*
- * Created on May 8, 2004
- */
-package org.eclipse.jst.ws.internal.common;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
-import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
-
-
-/**
- * @author gilberta
- */
-public class J2EEActionAdapterFactory {
-
-
- public static String getWSDLURI(ServiceImpl serviceImpl)
- {
- Definition definition = serviceImpl.getEnclosingDefinition();
- String location = definition.getLocation();
-
- return location;
- }
-
- //has to be under the webcontent
- public static final String EJB_MODULE = "ejbModule";
- public static final String APPCLIENT_MODULE = "appClientModule";
- public static final String WEB_MODULE = "WebContent";
-
- public static String getWSDLURI(ServiceRef serviceImpl)
- {
- String moduleRoot = null;
- IProject project = ProjectUtilities.getProject(serviceImpl);
- if(J2EEUtils.isWebComponent(project))
- {
- moduleRoot = WEB_MODULE;
- }
- else if (J2EEUtils.isEJBComponent(project))
- {
- moduleRoot = EJB_MODULE;
- }
- else if (J2EEUtils.isAppClientComponent(project))
- {
- moduleRoot = APPCLIENT_MODULE;
- }
- IPath path = project.getLocation().addTrailingSeparator();
- path = path.append(moduleRoot).addTrailingSeparator();
- path = path.append(serviceImpl.getWsdlFile());
- File file = new File(path.toString());
- try{
- URL url = file.toURL();
- return url.toString();
- }catch(MalformedURLException e){return null;}
-
-
-
-
- }
-
- public static String getWSDLURI(WSDLResourceImpl wsdlRI)
- {
- Definition definition = wsdlRI.getDefinition();
- String location = definition.getLocation();
-
- return location;
- }
-
- public static String getWSILPath(WSDLResourceImpl wsdlRI)
- {
- return convertToRelative(getWSDLURI(wsdlRI));
- }
-
- public static String getWSILPath(ServiceRef serviceImpl)
- {
- return convertToRelative(getWSDLURI(serviceImpl));
- }
-
- public static String getWSILPath(ServiceImpl serviceImpl)
- {
- return convertToRelative(getWSDLURI(serviceImpl));
- }
-
- public static String FILE="file:/";
- public static String FILEL="file:";
- public static String convertToRelative(String uri)
- {
- //remove file:
- String root = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
- root = FILE + root;
- String rootL = FILEL + root;
- if(uri.startsWith(root) || uri.startsWith(rootL)){
- return uri.substring(root.length());
- }
- return uri;
- }
-
-
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java
deleted file mode 100644
index e513d734e..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java
+++ /dev/null
@@ -1,1407 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner
- * 20060329 128069 rsinha@ca.ibm.com - Rupam Kuehner
- * 20060503 126819 rsinha@ca.ibm.com - Rupam Kuehner
- * 20060524 131132 mahutch@ca.ibm.com - Mark Hutchinson
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.common;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.ejb.EJBResource;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.ejb.Session;
-import org.eclipse.jst.j2ee.ejb.SessionType;
-import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.environment.EnvironmentService;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-/**
- * This class contains some useful J2EE utilities for Web services internal use.
- */
-public final class J2EEUtils {
-
- public final static int WEB = 1;
- public final static int EJB = 2;
- public final static int APPCLIENT = 4;
- public final static int EAR = 8;
-
- /**
- * Returns an IVirtualComponent
- * @param project
- * @return
- */
- public static IVirtualComponent getVirtualComponent(IProject project){
- return ComponentCore.createComponent(project);
- }
-
- /**
- *
- * @param projectName
- * @return
- */
- public static IVirtualComponent getVirtualComponent(String projectName){
- IProject project = null;
- if (projectName!=null && projectName.length() > 0 )
- project = ProjectUtilities.getProject(projectName);
-
- return ComponentCore.createComponent(project);
- }
-
-
- /**
- * Returns the J2EE version
- * @param p project
- * @return int
- */
- public static int getJ2EEVersion(IProject p){
-
- String ver = J2EEProjectUtilities.getJ2EEProjectVersion(p);
- return J2EEVersionUtil.convertVersionStringToInt(ver);
-
- /*
- int j2eeVer = -1;
- try {
- IVirtualComponent vc = ComponentCore.createComponent(p);
- if (vc!=null){
- j2eeVer = getJ2EEVersion(vc);
- }
- }
- catch (Exception e){
- //handle exception
- }
- return j2eeVer;
- */
- }
-
- public static int getJ2EEVersion(IVirtualComponent ch){
- int j2eeVer = -1;
- //check type
- if (ch!=null){
- IProject project = ch.getProject();
- j2eeVer = getJ2EEVersion(project);
- }
-
- /* Use new API provided by J2EE
- if (ch!=null) {
- if (isWebComponent(ch))
- j2eeVer = getWebComponentJ2EEVersion(ch);
- else if (isAppClientComponent(ch))
- j2eeVer = getAppClientComponentJ2EEVersion(ch);
- else if (isEJBComponent(ch))
- j2eeVer = getEJBComponentJ2EEVersion(ch);
- else if (isEARComponent(ch))
- j2eeVer = getEARComponentJ2EEVersion(ch);
- }
- */
-
- return j2eeVer;
- }
-
-
- /**
- * Returns the J2EEVersion
- * @param p IProject
- * @return String
- */
- public static String getJ2EEVersionAsString(IProject p){
-
- String ver = J2EEProjectUtilities.getJ2EEProjectVersion(p);
- return ver != null ? ver : null;
-
- /*
- int j2eeVer = getJ2EEVersion(p);
- if (j2eeVer!=-1){
- return J2EEVersionUtil.getJ2EETextVersion(j2eeVer);
- }
- else
- return null;
-
- */
- }
-
- public static IVirtualComponent[] getAllComponents(){
- List v = new ArrayList();
- IProject[] projects = ResourceUtils.getWorkspaceRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- IVirtualComponent vc = ComponentCore.createComponent(projects[i]);
- if(vc != null)
- v.add(vc);
- }
-
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- /**
- * Returns all the EAR components in the workspace
- * @return IVirtualComponent[]; empty if none
- */
- public static IVirtualComponent[] getAllEARComponents() {
- List v = new ArrayList();
- IProject[] projects = ResourceUtils.getWorkspaceRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- try {
- IVirtualComponent[] components = getEARComponentsFromProject(projects[i]);
- for (int j=0; j<components.length; j++) {
- if (components[j]!=null)
- v.add(components[j]);
- }
- } catch (Exception e) {
- e.printStackTrace();
- //handle exception
- }
-
- }
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- public static IVirtualComponent[] getAllWebComponents(){
- List v = new ArrayList();
- IProject[] projects = ResourceUtils.getWorkspaceRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- try {
- IVirtualComponent[] components = getWebComponents(projects[i]);
- for (int j=0; j<components.length; j++) {
- if (components[j]!=null)
- v.add(components[j]);
- }
- } catch (Exception e) {
- e.printStackTrace();
- //handle exception
- }
-
- }
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- public static IVirtualComponent[] getAllEJBComponents(){
- List v = new ArrayList();
- IProject[] projects = ResourceUtils.getWorkspaceRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- try {
- IVirtualComponent[] components = getEJBComponents(projects[i]);
- for (int j=0; j<components.length; j++) {
- if (components[j]!=null)
- v.add(components[j]);
- }
- } catch (Exception e) {
- e.printStackTrace();
- //handle exception
- }
-
- }
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- /**
- * Returns the EAR components in a given IProject
- * @param project
- * @return empty if no EAR components; must not return null
- */
- public static IVirtualComponent[] getEARComponentsFromProject(IProject project){
- //get all components in the project
- List v = new ArrayList();
- try {
- IVirtualComponent component = ComponentCore.createComponent(project);
- if (component != null && isEARComponent(component)){
- v.add(component);
- }
- }
- catch (Exception e){
- //handle exception
- }
-
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- /**
- * Returns Web components in a project
- * @param project
- * @return empty array if no web components; must not return null
- */
- public static IVirtualComponent[] getWebComponents(IProject project){
-
- //get all components in the project
- List v = new ArrayList();
- try {
- IVirtualComponent component = ComponentCore.createComponent(project);
-
- if (component != null && isWebComponent(component)){
- v.add(component);
- }
-
- }
- catch (Exception e){
- //handle exception
- }
-
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- public static String[] getWebComponentNames(IProject project){
- IVirtualComponent[] vcs = getWebComponents(project);
- return toComponentNamesArray(vcs);
- }
-
- public static String[] getEARComponentNames(IProject project){
- IVirtualComponent[] vcs = getEARComponentsFromProject(project);
- return toComponentNamesArray(vcs);
- }
-
- /**
- * Returns all components of type, componentType in the project.
- * @param project
- * @param componentType i.e. J2EEUtils.WEB
- * @return
- */
- public static IVirtualComponent[] getComponentsByType(IProject project, int componentType){
-
- List v = new ArrayList();
- if ( (WEB & componentType)==WEB ){
- IVirtualComponent[] webVC = getWebComponents(project);
- addToArrayListHelper(webVC, v);
- }
- if ( (EJB & componentType)==EJB ){
- IVirtualComponent[] ejbVC = getEJBComponents(project);
- addToArrayListHelper(ejbVC, v);
- }
- if ( (APPCLIENT & componentType)==APPCLIENT ) {
- IVirtualComponent[] appClientVC = getAppClientComponents(project);
- addToArrayListHelper(appClientVC, v);
- }
- if ( (EAR & componentType)==EAR ) {
- IVirtualComponent[] earVC = getEARComponentsFromProject(project);
- addToArrayListHelper(earVC, v);
- }
-
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- /**
- * Returns all components of type, componentType in the project.
- * @param project
- * @param componentTypeId as defined in IModuleConstants.
- * @return
- */
- public static IVirtualComponent[] getComponentsByType(IProject project, String componentTypeId){
-
- //get all components in the project of type componentTypeId
- List v = new ArrayList();
- try {
-
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if ( vc != null && J2EEProjectUtilities.isProjectOfType(project,componentTypeId))
- {
- v.add(vc);
- }
- //if (isWebComponent(project, components[i].getName())){
- //v.add(components[i]);
- //}
-
- }
- catch (Exception e){
- //handle exception
- }
-
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- public static String[] getProjectsContainingComponentOfType(String componentTypeId)
- {
- Vector v = new Vector();
- IVirtualComponent[] comps = getAllComponents();
- for (int i = 0; i < comps.length; i++) {
- if (J2EEProjectUtilities.isProjectOfType(comps[i].getProject(),componentTypeId))
- {
- //Add the project name to the vector if it has not been added already
- String name = comps[i].getProject().getName();
- if (!v.contains(name))
- {
- v.add(name);
- }
- }
-
- }
-
- return (String[])v.toArray(new String[0]);
- }
-
- /**
- * Helper method for getComponentsByType
- * @param vcs
- * @param vect
- */
- private static void addToArrayListHelper(IVirtualComponent[] vcs, List al){
- for (int i=0;i<vcs.length;i++){
- al.add(vcs[i]);
- }
- }
-
-
- /**
- * Essentially, returns all projects in the workspace
- * @return
- */
- public static IProject[] getAllFlexibleProjects(){
-
- List v = new ArrayList();
- try {
- IProject[] projects = ProjectUtilities.getAllProjects();
- for(int i=0; i<projects.length;i++) {
- if (ModuleCoreNature.getModuleCoreNature(projects[i])!=null){
- v.add(projects[i]);
- }
- }
- }
- catch(Exception e){
- }
-
- return (IProject[])v.toArray(new IProject[0]);
- }
-
-
- /**
- * True if there exists a underlying resource backing up the component and project
- * @param projectName
- * @param componentName
- * @return
- */
- public static boolean exists(String projectName, String componentName){
- IProject project = null;
- if (projectName!=null && projectName.length() > 0 ) {
- project = ProjectUtilities.getProject(projectName);
- }
- else
- return false;
-
- return exists(project);
- }
-
- /**
- * True if there exists a underlying resource backing up the component and project
- * @param project
- * @return
- */
- public static boolean exists(IProject project){
- if (project!=null) {
- if (!project.exists())
- return false;
-
- IVirtualComponent vc = ComponentCore.createComponent(project);
- return vc.exists();
- }
- else
- return false;
-
- }
-
- /**
- * Returns an array of EAR components which are referenced by the component
- * @param project
- * @return
- */
- public static IVirtualComponent[] getReferencingEARComponents(IProject project){
- List ears = new ArrayList();
- try{
- IVirtualComponent targetVC = ComponentCore.createComponent(project);
-
- IVirtualComponent[] earVC = getAllEARComponents();
- for (int i=0; i<earVC.length;i++) {
- IVirtualReference[] refs = earVC[i].getReferences();
- for (int k=0;k<refs.length;k++) {
- if (targetVC.equals(refs[k].getReferencedComponent())){
- ears.add(refs[k].getEnclosingComponent());
- }
- }
- }
-
- }
- catch (Exception e){
- }
-
- return (IVirtualComponent[])ears.toArray(new IVirtualComponent[0]);
- }
-
-
- /**
- * Returns the EJB Components referenced by the ear
- * @param project
- * @return
- */
- public static IVirtualComponent[] getReferencingEJBComponentsFromEAR(IProject project){
-
- List ejbComps = new ArrayList();
- try{
- IVirtualComponent vc = ComponentCore.createComponent(project);
- IVirtualReference[] refs = vc.getReferences();
- for (int i=0;i<refs.length;i++){
- if (isEJBComponent(refs[i].getReferencedComponent())){
- ejbComps.add(refs[i].getReferencedComponent());
- }
- }
- }
- catch(Exception e){
- }
-
- return (IVirtualComponent[])ejbComps.toArray(new IVirtualComponent[0]);
- }
-
-
- /**
- *
- * @param jar
- * @return Vector of bean String names.
- */
- public static Vector getBeanNames(EJBJar jar) {
- // We currently only support Stateless session beans.
- // List cmpBeans = jar.getBeanManagedBeans();
- // List bmpBeans = jar.getContainerManagedBeans();
- List sessionBeans = jar.getSessionBeans();
-
- Vector names = new Vector();
-
- // getBeanNames( names, cmpBeans );
- // getBeanNames( names, bmpBeans );
- getBeanNames(names, sessionBeans);
-
- return names;
- }
-
- /**
- * @param names
- * specifies that vector of strings that will be used to add bean
- * names to.
- * @param beans
- * specifies a list of beans.
- */
- private static void getBeanNames(Vector names, List beans) {
- Iterator iterator = beans.iterator();
-
- while (iterator.hasNext()) {
- EnterpriseBean bean = (EnterpriseBean) (iterator.next());
-
- if (bean.isSession()) {
- Session sessionBean = (Session) bean;
-
- if (sessionBean.getSessionType().getValue() == SessionType.STATELESS) {
- names.add(bean.getName());
- }
- }
- }
- }
-
- /**
- * Uses jem ProjectUtilities to get the project
- * @param ejb eObject
- * @return IProject
- */
- public static IProject getProjectFromEJB(EnterpriseBean ejb) {
- return ProjectUtilities.getProject(ejb);
- }
-
- /**
- * Returns a default J2EE 1.3 EAR component in the workspace
- * @return EAR component name
- */
- public static IVirtualComponent getDefault13EARComponent(){
- IVirtualComponent[] allEARComponents = getAllEARComponents();
- for (int j=0;j<allEARComponents.length;j++){
- int j2eeVersion = getJ2EEVersion(allEARComponents[j]);
- if (j2eeVersion == J2EEVersionConstants.J2EE_1_3_ID)
- return allEARComponents[j];
- }
- return null;
- }
-
- /**
- * Returns a default J2EE 1.4 EAR component in the workspace
- * @return EAR component name
- */
- public static IVirtualComponent getDefault14EARComponent(){
- IVirtualComponent[] allEARComponents = getAllEARComponents();
- for (int j=0;j<allEARComponents.length;j++){
- int j2eeVersion = getJ2EEVersion(allEARComponents[j]);
- if (j2eeVersion == J2EEVersionConstants.J2EE_1_4_ID)
- return allEARComponents[j];
- }
- return null;
- }
-
- /**
- * Returns the first EAR component of the J2EE version
- * @param versionId
- * @return
- */
- public static IVirtualComponent getEARComponentofJ2EEVersion(int versionId){
- IVirtualComponent[] components = getAllEARComponents();
- for (int i=0; i<components.length; i++){
- if (getJ2EEVersion(components[i]) == versionId)
- return components[i];
- }
- return null;
- }
-
-
- /**
- *
- * @param j2eeVersionInt
- * @return
- */
- public static String getLabelFromJ2EEVersion(String j2eeVersionInt) {
- if (j2eeVersionInt == null || j2eeVersionInt.length() == 0)
- return "";
-
- int j2eeVersion = Integer.parseInt(j2eeVersionInt);
- switch (j2eeVersion) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return J2EEVersionConstants.VERSION_1_2_TEXT;
- case J2EEVersionConstants.J2EE_1_3_ID :
- return J2EEVersionConstants.VERSION_1_3_TEXT;
- case J2EEVersionConstants.J2EE_1_4_ID :
- return J2EEVersionConstants.VERSION_1_4_TEXT;
- default :
- return "";
- }
- }
-
- public static String getJ2EEVersionFromLabel(String j2eeLabel) {
- String j2ee12String = String.valueOf(J2EEVersionConstants.J2EE_1_2_ID);
- String j2ee13String = String.valueOf(J2EEVersionConstants.J2EE_1_3_ID);
- String j2ee14String = String.valueOf(J2EEVersionConstants.J2EE_1_4_ID);
- if (j2eeLabel.equals(J2EEVersionConstants.VERSION_1_2_TEXT))
- return j2ee12String;
-
- if (j2eeLabel.equals(J2EEVersionConstants.VERSION_1_3_TEXT))
- return j2ee13String;
-
- if (j2eeLabel.equals(J2EEVersionConstants.VERSION_1_4_TEXT))
- return j2ee14String;
-
- return "";
-
- }
-
- /**
- * Returns String representations of J2EE versions
- * @param aVersion
- * @return
- */
- public static String getJ2EEIntVersionAsString(String aVersion) {
- if (aVersion.equals(J2EEVersionConstants.VERSION_1_4_TEXT))
- return new Integer(J2EEVersionConstants.J2EE_1_4_ID).toString();
- if (aVersion.equals(J2EEVersionConstants.VERSION_1_3_TEXT))
- return new Integer(J2EEVersionConstants.J2EE_1_3_ID).toString();
- if (aVersion.equals(J2EEVersionConstants.VERSION_1_2_TEXT))
- return new Integer(J2EEVersionConstants.J2EE_1_2_ID).toString();
- // default
- return new Integer(J2EEVersionConstants.J2EE_1_4_ID).toString();
- }
-
- // ----------------------------------------------------------------------
-
-
-
- /**
- *
- * @return
- *
- * @deprecated // use getALLEARComponents
- */
- public static IProject[] getEARProjects() {
- Vector v = new Vector();
- IProject[] projects = ResourceUtils.getWorkspaceRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- try {
-// if (projects[i].hasNature(IEARNatureConstants.NATURE_ID)) {
- if (ResourceUtils.isEARProject(projects[i])) {
- v.add(projects[i]);
- }
- } catch (Exception e) {
- e.printStackTrace();
- //handle exception
- }
-
- }
-
- return (IProject[])v.toArray(new IProject[0]);
- }
-
-
- /**
- * Returns the first EAR project associated with the project and server
- * @param serviceProject
- * @param server
- * @return
- *
- * @deprecated // to be simplified
- */
- public static IProject getDefaultEARProject(IProject serviceProject, IServer server) {
-
- IProject[] earProjects = null;
- IProject ear = null;
-
- if (serviceProject != null && serviceProject.exists()) {
- try {
-
- boolean isWebEJBOrAppClient = ResourceUtils.isWebProject(serviceProject) //serviceProject.hasNature(IWebNatureConstants.J2EE_NATURE_ID)
- || ResourceUtils.isEJBProject(serviceProject) //serviceProject.hasNature(IEJBNatureConstants.NATURE_ID)
- || ResourceUtils.isAppClientProject(serviceProject);//serviceProject.hasNature(IApplicationClientNatureConstants.NATURE_ID);
- if (!isWebEJBOrAppClient) {
- return null;
- }
-
- IProject[] ears = getEARProjects();
-
- // separate EARs which are already deployed to the existing
- // server
- if (ears != null && ears.length >= 1) {
- ArrayList preferredEARList = new ArrayList();
- ArrayList secondaryEARList = new ArrayList();
- for (int i = 0; i < ears.length; i++) {
- ear = ears[i];
- IModule module = ResourceUtils.getModule(ear);
- if (module != null) {
- if (server != null
- || ServerUtil.containsModule(server,
- module, new NullProgressMonitor())) {
- preferredEARList.add(ear);
- } else {
- secondaryEARList.add(ear);
- }
- }
- }
- // add secondaryEARList items to end of primary list
- for (int j = 0; j < secondaryEARList.size(); j++) {
- preferredEARList.add(secondaryEARList.get(j));
- }
- // toArray
- if (preferredEARList != null) {
- earProjects = (IProject[]) preferredEARList.toArray(new IProject[0]);
- }
- }
- } catch (Exception ce) {
- ILog log = EnvironmentService.getEclipseLog();
- log.log(ILog.ERROR, 5039, J2EEUtils.class, "getEARProjects", ce);
-
- }
- }
- return earProjects[0];
- }
-
- /**
- * Gets the EJB Components in the project
- * @param project
- * @return
- */
- public static IVirtualComponent[] getEJBComponents(IProject project){
-
- //get all components in the project
- List v = new ArrayList();
- IVirtualComponent component = ComponentCore.createComponent(project);
- try {
- if (component != null && isEJBComponent(component)){
- v.add(component);
- }
- }
- catch (Exception e){
- //handle exception
- }
-
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- /**
- * Gets the Application Client components in a project.
- * @param project
- * @return
- */
- public static IVirtualComponent[] getAppClientComponents(IProject project){
-
- //get all components in the project
- List v = new ArrayList();
- try {
- IVirtualComponent component = ComponentCore.createComponent(project);
-
- if (component != null && isAppClientComponent(component)){
- v.add(component);
- }
- }
- catch (Exception e){
- //handle exception
- }
-
- return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
- }
-
- /**
- *
- * @param project
- * @return
- */
- public static IVirtualComponent[] getReferencingEJB20ComponentsFromEAR(IProject project){
-
- List ejbComps = new ArrayList();
- try{
- IVirtualComponent vc = ComponentCore.createComponent(project);
- IVirtualReference[] refs = vc.getReferences();
- for (int i=0; i<refs.length;i++) {
- if (isEJB20Component(refs[i].getReferencedComponent()))
- ejbComps.add(refs[i].getReferencedComponent());
- }
- }
- catch (Exception e){
- }
-
- return (IVirtualComponent[])ejbComps.toArray(new IVirtualComponent[0]);
- }
-
-
- /**
- * Utility method to combine two IProject[]
- * @param projectArray1
- * @param projectArray2
- * @return
- */
- public static IProject[] combineProjectArrays(IProject[] projectArray1,
- IProject[] projectArray2) {
-
- // check if either or both arrays are null.
- if (projectArray1 == null && projectArray2 == null)
- return null;
- else if (projectArray1 != null && projectArray2 == null)
- return projectArray1;
- else if (projectArray1 == null && projectArray2 != null)
- return projectArray2;
-
- IProject[] combinedProjects = new IProject[projectArray1.length
- + projectArray2.length];
-
- System.arraycopy(projectArray1, 0, combinedProjects, 0,
- projectArray1.length);
- if (projectArray2.length > 0) {
- System.arraycopy(projectArray2, 0, combinedProjects,
- projectArray1.length, projectArray2.length);
- }
-
- return combinedProjects;
- }
-
- /**
- *
- * @param project
- * @return
- */
- public static IVirtualComponent[] getReferencingWebComponentsFromEAR(IProject project){
- List webComps = new ArrayList();
- try{
- IVirtualComponent vc = ComponentCore.createComponent(project);
- IVirtualReference[] refs = vc.getReferences();
- for (int i=0; i<refs.length;i++) {
- if (isWebComponent(refs[i].getReferencedComponent()))
- webComps.add(refs[i].getReferencedComponent());
- }
- }
- catch(Exception e){
- }
-
- return (IVirtualComponent[])webComps.toArray(new IVirtualComponent[0]);
- }
-
-
-
- /**
- *
- * @param ejbComponent
- * @return
- */
- public static boolean isEJB20Component(IVirtualComponent ejbComponent){
- return isEJB20Component(ejbComponent.getProject());
- }
-
- /**
- *
- * @param project
- * @return
- */
- public static boolean isEJB20Component(IProject project){
- boolean isEJB = false;
- try {
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (EJBArtifactEdit.isValidEJBModule(vc)) {
- EJBArtifactEdit ejbEdit = null;
- try {
- ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(vc);
- EJBResource ejbRes = ejbEdit.getEJBJarXmiResource();
- if (ejbRes.getModuleVersionID()== J2EEVersionConstants.EJB_2_0_ID) {
- return true;
- }
- }
- finally {
- if (ejbEdit!=null)
- ejbEdit.dispose();
- }
- }
- }
- catch(Exception ex){}
-
- return isEJB;
- }
-
-
- /**
- * Checks if the component at compName is referenced by the ear at earCompName
- * @param earProject
- * @param project
- * @return
- */
- public static boolean isComponentAssociated(IProject earProject, IProject project) {
- IVirtualComponent vc1 = ComponentCore.createComponent(earProject);
- IVirtualComponent vc2 = ComponentCore.createComponent(project);
- return isComponentAssociated(vc1, vc2);
- }
-
- /**
- * Checks if the component is referenced by the ear
- * @param ear
- * @param component
- * @return
- */
- private static boolean isComponentAssociated(IVirtualComponent ear, IVirtualComponent component){
- boolean isAssociated = false;
-
- // Note: not implemented by J2EE yet.. to be used later.
- IVirtualReference[] compRefs = ear.getReferences();
- if (compRefs!= null) {
- for (int i=0;i<compRefs.length;i++){
- IVirtualReference vref = compRefs[i];
- if (component.equals(vref.getReferencedComponent()))
- isAssociated = true;
- }
- }
- return isAssociated;
- }
-
- /**
- *
- * @param project
- * @param earProject
- */
- public static void associateComponentToEAR(IProject project, IProject earProject) {
-
- IDataModel addComponentToEARDataModel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider());
- IVirtualComponent earComp = ComponentCore.createComponent(earProject);
- addComponentToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComp);
- List modList = (List) addComponentToEARDataModel.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- IVirtualComponent targetComp = ComponentCore.createComponent(project);
- modList.add(targetComp);
- addComponentToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList);
-
- try {
- addComponentToEARDataModel.getDefaultOperation().execute(null, null);
- } catch (ExecutionException e) {
- Logger.getLogger().log(e);
- }
-
- }
-
- /*
- * Determines whether project can be associated with earProject.
- * @returns IStatus of OK if the project is a Web project, EJB project, or AppClient
- * project that can be associated with the EAR project.
- * Returns IStatus with an ERROR severity if the project is a Web project,
- * EJB project, or AppClient project that cannot be associated with the EAR project.
- * When an IStatus of severity ERROR is returned, the IStatus' message will contain the
- * lowest J2EE level that this project requires on an EAR.
- * Returns an IStatus with severity OK if project is not recognized as a Web, EJB, or
- * AppClient project or if earProject is not recognized as an EAR project.
- */
- public static IStatus canAssociateProjectToEAR(IProject project, IProject earProject)
- {
- //If project contains the web, ejb, or appclient facet, and earProject contains the
- //ear facet, return whether or not the facet versions are such that the project
- //can be added to the ear.
-
- IStatus status = Status.OK_STATUS;
- boolean isWeb = isWebComponent(project);
- boolean isEJB = isEJBComponent(project);
- boolean isAppClient = isAppClientComponent(project);
- boolean isEAR = isEARComponent(earProject);
- if ((isWeb || isEJB || isAppClient) && isEAR)
- {
- try
- {
- IFacetedProject fProject = ProjectFacetsManager.create(project);
- IFacetedProject fEarProject = ProjectFacetsManager.create(earProject);
-
- IProjectFacet earPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_EAR_MODULE);
- IProjectFacetVersion earPfv = fEarProject.getInstalledVersion(earPf);
- String earVersion = earPfv.getVersionString();
-
- String webVersion = null;
- String ejbVersion = null;
- String acVersion = null;
-
- if (isWeb)
- {
- IProjectFacet webPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_WEB_MODULE);
- IProjectFacetVersion webPfv = fProject.getInstalledVersion(webPf);
- webVersion = webPfv.getVersionString();
- }
- else if (isEJB)
- {
- IProjectFacet ejbPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_EJB_MODULE);
- IProjectFacetVersion ejbPfv = fProject.getInstalledVersion(ejbPf);
- ejbVersion = ejbPfv.getVersionString();
- }
- else if (isAppClient)
- {
- IProjectFacet acPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_APPCLIENT_MODULE);
- IProjectFacetVersion acPfv = fProject.getInstalledVersion(acPf);
- acVersion = acPfv.getVersionString();
- }
-
- if ((isWeb && webVersion.equals(J2EEVersionConstants.VERSION_2_2_TEXT)) ||
- (isEJB && ejbVersion.equals(J2EEVersionConstants.VERSION_1_1_TEXT)) ||
- (isAppClient && acVersion.equals(J2EEVersionConstants.VERSION_1_2_TEXT))
- )
- {
- if (!greaterThanOrEqualTo(earVersion, J2EEVersionConstants.VERSION_1_2_TEXT))
- {
- status = StatusUtils.errorStatus(J2EEVersionConstants.VERSION_1_2_TEXT);
- }
- }
- else if ((isWeb && webVersion.equals(J2EEVersionConstants.VERSION_2_3_TEXT)) ||
- (isEJB && ejbVersion.equals(J2EEVersionConstants.VERSION_2_0_TEXT)) ||
- (isAppClient && acVersion.equals(J2EEVersionConstants.VERSION_1_3_TEXT))
- )
- {
- if (!greaterThanOrEqualTo(earVersion, J2EEVersionConstants.VERSION_1_3_TEXT))
- {
- status = StatusUtils.errorStatus(J2EEVersionConstants.VERSION_1_3_TEXT);
- }
- }
- else if ((isWeb && webVersion.equals(J2EEVersionConstants.VERSION_2_4_TEXT)) ||
- (isEJB && ejbVersion.equals(J2EEVersionConstants.VERSION_2_1_TEXT)) ||
- (isAppClient && acVersion.equals(J2EEVersionConstants.VERSION_1_4_TEXT))
- )
- {
- if (!greaterThanOrEqualTo(earVersion, J2EEVersionConstants.VERSION_1_4_TEXT))
- {
- status = StatusUtils.errorStatus(J2EEVersionConstants.VERSION_1_4_TEXT);
- }
- }
- } catch (CoreException ce)
- {
- //If facet API throws a CoreException when trying to create an IFacetedProject from
- //an IProject, an OK Status will be returned and clients of this utility method
- //won't raise a validation error.
- }
- }
-
- return status;
- }
-
-
- /*
- * @param versionA version number of the form 1.2.3
- * @param versionA version number of the form 1.2.3
- * @return boolean returns whether versionA is greater than or equal to versionB
- */
- private static boolean greaterThanOrEqualTo(String versionA, String versionB)
- {
- if (versionA.equals(versionB))
- {
- return true;
- }
- else
- {
- StringTokenizer stA = new StringTokenizer(versionA, ".");
- StringTokenizer stB = new StringTokenizer(versionB, ".");
-
- int sizeA = stA.countTokens();
- int sizeB = stB.countTokens();
-
- int size;
- if (sizeA < sizeB)
- {
- size = sizeA;
- }
- else
- size = sizeB;
-
- for (int i = 0; i < size; i++)
- {
- int a = Integer.parseInt(stA.nextToken());
- int b = Integer.parseInt(stB.nextToken());
- if (a != b)
- {
- return a > b;
- }
- }
-
- return sizeA > sizeB;
- }
- }
-
- /**
- * @param project
- * @return
- */
- public static IPath getWebInfPath(IProject project){
-
- IVirtualComponent component = ComponentCore.createComponent(project);
-
- //should WEB-INF location be pulled in from the .component file rather than hardcoded here?
- IVirtualFolder webInfDir = component.getRootFolder().getFolder(new Path("/WEB-INF"));
- IPath modulePath = webInfDir.getWorkspaceRelativePath();
-
- if (!webInfDir.exists())
- {
- try
- {
- webInfDir.create(0,null);
- }
- catch (CoreException e)
- {}
- }
- return modulePath;
- }
-
-
- /**
- *
- * @param project
- * @return
- *
- */
- public static IPath getFirstWebContentPath(IProject project){
-
- IPath modulePath = null;
- try {
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (ModuleCoreNature.isFlexibleProject(project)) {
- modulePath = vc.getRootFolder().getWorkspaceRelativePath();
- }
- }
- catch(Exception ex){}
-
- return modulePath;
- }
-
- /**
- * @param project
- * @return
- */
- public static IPath getWebContentPath(IProject project){
- IVirtualComponent component = ComponentCore.createComponent(project);
- IPath modulePath = component.getRootFolder().getWorkspaceRelativePath();
- return modulePath;
- }
-
- /**
- *
- * @param project
- * @return
- *
- */
- public static IContainer getFirstWebContentContainer(IProject project){
- IContainer container = null;
- IPath modulePath = getFirstWebContentPath(project);
- IResource res = ResourceUtils.findResource(modulePath);
- if (res!=null){
- container = res.getParent();
- }
-
- return container;
- }
-
- /**
- * @param project
- * @return
- */
- public static IContainer getWebContentContainer(IProject project){
- IContainer container = null;
- IPath modulePath = getWebContentPath(project);
- IResource res = ResourceUtils.findResource(modulePath);
- if (res instanceof IContainer){
- container = (IContainer)res;
- }
- return container;
- }
-
-
- /**
- * Returns the first Module name
- * @param project
- * @return
- *
- */
- public static String getFirstWebModuleName(IProject project){
- String moduleName = null;
- try {
- IVirtualComponent vc = ComponentCore.createComponent(project);
- moduleName = vc.getName();
- }
- catch(Exception ex){}
-
- return moduleName;
- }
-
-
- public static boolean isWebComponent(IVirtualComponent comp){
- return J2EEProjectUtilities.isDynamicWebProject(comp.getProject());
- }
-
- public static boolean isEARComponent(IVirtualComponent comp){
- return J2EEProjectUtilities.isEARProject(comp.getProject());
- }
-
- /**
- * True if the component is a valid EJB component
- * @param project
- * @return
- */
- public static boolean isEJBComponent(IProject project) {
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (vc != null)
- {
- return isEJBComponent(vc);
- }
- else
- {
- return false;
- }
- }
-
- public static boolean isEJBComponent(IVirtualComponent comp){
- return J2EEProjectUtilities.isEJBProject(comp.getProject());
- }
-
- public static boolean isAppClientComponent(IVirtualComponent comp){
- return J2EEProjectUtilities.isApplicationClientProject(comp.getProject());
- }
-
- public static boolean isJavaComponent(IVirtualComponent comp){
- return J2EEProjectUtilities.isUtilityProject(comp.getProject());
- }
-
- public static String getComponentTypeId(IProject project) {
- return J2EEProjectUtilities.getJ2EEProjectType(project);
- }
-
- public static String[] toComponentNamesArray(IVirtualComponent[] components){
- String[] ecNames = new String[components.length];
- for(int i=0; i<components.length; i++){
- ecNames[i] = components[i].getName();
- }
- return ecNames;
- }
-
- public static IProject[] toProjectArray(IVirtualComponent[] components){
- IProject[] projects = new IProject[components.length];
- for (int i=0; i<components.length; i++){
- projects[i] = components[i].getProject();
- }
- return projects;
- }
-
- /**
- * Given a J2EE level, this method returns the highest supported servlet level
- * @param j2eeLevel
- * @return web app version
- */
- public static Integer getServletVersionForJ2EEVersion(String j2eeLevel){
- int aVersion = Integer.valueOf(j2eeLevel).intValue();
- switch (aVersion) {
- case J2EEVersionConstants.J2EE_1_2_ID:
- return new Integer(J2EEVersionConstants.WEB_2_2_ID);
-
- case J2EEVersionConstants.J2EE_1_3_ID:
- return new Integer(J2EEVersionConstants.WEB_2_3_ID);
-
- case J2EEVersionConstants.J2EE_1_4_ID:
- return new Integer(J2EEVersionConstants.WEB_2_4_ID);
-
- default:
- return new Integer(J2EEVersionConstants.WEB_2_3_ID);
- }
- }
-
- /**
- * Given a J2EE level, this method returns the highest supported EJB version
- * @param j2eeLevel
- * @return ejb spec version
- */
- public static Integer getEJBVersionForJ2EEVersion(String j2eeLevel){
- int aVersion = Integer.valueOf(j2eeLevel).intValue();
- switch (aVersion) {
- case J2EEVersionConstants.J2EE_1_2_ID:
- return new Integer(J2EEVersionConstants.EJB_1_1_ID);
-
- case J2EEVersionConstants.J2EE_1_3_ID:
- return new Integer(J2EEVersionConstants.EJB_2_0_ID);
-
- case J2EEVersionConstants.J2EE_1_4_ID:
- return new Integer(J2EEVersionConstants.EJB_2_1_ID);
-
- default:
- return new Integer(J2EEVersionConstants.EJB_2_0_ID);
- }
- }
-
- /**
- * True if the component is a valid Java component
- * @param project
- * @return
- */
- public static boolean isJavaComponent(IProject project) {
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (vc != null)
- {
- return isJavaComponent(vc);
- }
- else
- {
- //check if it's a faceted project with only the Java facet.
- try
- {
- if (project.exists())
- {
- IFacetedProject fProject = ProjectFacetsManager.create(project);
- if (fProject != null)
- {
- Set facets = fProject.getProjectFacets();
- if (facets.size()==1)
- {
- IProjectFacetVersion pfv = (IProjectFacetVersion)facets.iterator().next();
- if (pfv.getProjectFacet().getId().equals(IModuleConstants.JST_JAVA))
- {
- return true;
- }
- }
- }
- else
- {
- //This is not a faceted project. Check if this is a simple Java project.
- if (ResourceUtils.isJavaProject(project))
- {
- return true;
- }
- }
- }
- } catch (CoreException ce)
- {
-
- }
- }
-
- return false;
- }
-
- /**
- * True if the component is a valid Web component
- * @param project
- * @return
- */
- public static boolean isWebComponent(IProject project) {
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (vc != null)
- {
- return isWebComponent(vc);
- }
- else
- {
- return false;
- }
- }
-
- /**
- * True if the component is a true Application client component
- * @param project
- * @return
- */
- public static boolean isAppClientComponent(IProject project) {
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (vc != null)
- {
- return isAppClientComponent(vc);
- }
- else
- {
- return false;
- }
- }
-
- /**
- * True is the component is a valid EAR component
- * @param project
- * @return
- */
- public static boolean isEARComponent(IProject project){
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (vc != null)
- {
- return isEARComponent(vc);
- }
- else
- {
- return false;
- }
- }
-
- public static IFolder getOutputContainerRoot (IVirtualComponent component) {
- return (IFolder)J2EEProjectUtilities.getOutputContainers(component.getProject())[0];
- }
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java
deleted file mode 100644
index f883dd34c..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.common;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.emf.workbench.nature.EMFNature;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.java.JavaRefFactory;
-import org.eclipse.jem.java.JavaVisibilityKind;
-import org.eclipse.jem.java.Method;
-
-/**
-* This class contains some useful utilities for dealing with the JavaMOF
-*/
-
-public final class JavaMOFUtils
-{
- /**
- * Determine whether this class of the given name is loadable in the given
- * project.
- * @param className The fully qualified name of the class
- * @param project The project
- * @return True if the class is loadable and no exceptions are thrown.
- */
- public static boolean isClassLoadable(String className, IProject project) throws CoreException
- {
- return isClassLoadable(getJavaClass(className,project));
- }
-
- public static boolean isClassLoadable(JavaClass javaClass)
- {
- return javaClass.isExistingType();
- }
-
- /**
- * Determine whether the specified class has a public constructor
- * with an empty parameter list.
- * @param className The fully qualified name of the class
- * @param project The project
- * @return True if the class is loadable from the project and the
- * class has a public constructor with an empty parameter list
- */
- public static boolean hasPublicDefaultCtor(String className, IProject project) throws CoreException
- {
- return hasPublicDefaultCtor(getJavaClass(className, project));
- }
-
-
- public static boolean hasPublicDefaultCtor(JavaClass javaClass)
- {
-
- List methodList = javaClass.getMethods();
- if (methodList==null)
- return true;
-
- Iterator iMethods = methodList.iterator();
- boolean userDefinedCtor = false;
- while (iMethods.hasNext())
- {
- Method thisMethod = (Method)iMethods.next();
-
- if (thisMethod.isConstructor())
- {
- userDefinedCtor = true;
-
- //Since the user has defined a ctor, the default ctor is no longer available.
- //We must ensure that the user has provided a public ctor with no parameters.
-
- //check if public
- if (thisMethod.getJavaVisibility().getValue() == JavaVisibilityKind.PUBLIC)
- {
- //see if parameter list is empty
- List paramList = thisMethod.getParameters();
- if (paramList.isEmpty() )
- {
- return true;
- }
- }
- }
-
- }
-
- if (userDefinedCtor)
- {
- return false; //if the user defined a ctor and we still haven't
- //returned true, none of them were public with no parameters.
- }
- else
- {
- return true;
- }
-
- }
- /**
- * Determine whether the specified class implements the specified interface.
- * @param className The fully qualified name of the class
- * @param interfaceName The fully qualified name of the interface
- * @param project The project
- * @return True if the class and interface are loadable from the project and
- * the class implements the interface.
- */
- public static boolean implementsInterface(String className, String interfaceName, IProject project)
- throws CoreException
- {
- return implementsInterface(getJavaClass(className, project), getJavaClass(interfaceName, project));
- }
-
-public static boolean implementsInterface(JavaClass javaClass, JavaClass interfaceClass)
- {
-
- if (!javaClass.isExistingType()) return false;
-
- if (!interfaceClass.isExistingType()) return false;
-
- return javaClass.implementsInterface(interfaceClass);
- }
-
- /**
- * Determine whether the specified class extends the specified superclass
- * @param className The fully qualified name of the class
- * @param superClassName The fully qualified name of the superclass
- * @param project The project
- * @return True if the class and superClass are loadable from the project and
- * the class extends the superClass
- */
- public static boolean extendsClass(String className, String superClassName, IProject project)
- throws CoreException
- {
- return extendsClass(getJavaClass(className,project), getJavaClass(superClassName, project));
- }
-
- public static boolean extendsClass(JavaClass javaClass, JavaClass superClass)
- {
- return superClass.isAssignableFrom(javaClass);
- }
-
- /**
- * Determine whether the specified class is actually an interface
- * @param className The fully qualified name of the class
- * @param project The project
- * @return True if the class is loadable from the project and is
- * actually an interface
- */
- public static boolean isInterface(String className, IProject project) throws CoreException
- {
- return isInterface(getJavaClass(className, project));
- }
-
- public static boolean isInterface(JavaClass javaClass)
- {
- return javaClass.isInterface();
- }
- public static boolean hasAbstractMethods (String className, IProject project) throws CoreException
- {
- return hasAbstractMethods(getJavaClass(className, project));
- }
-
- public static boolean hasAbstractMethods (JavaClass javaClass)
- {
- List methodList = javaClass.getMethods();
- if (methodList==null)
- return false;
-
- Iterator iMethods = methodList.iterator();
- while (iMethods.hasNext())
- {
- Method thisMethod = (Method)iMethods.next();
- if ( thisMethod.isAbstract()) return true;
- }
- return false;
- }
-
- /*
- *
- */
- /**
- * @param classQName Fully qualified classname (packageName + typeName)
- * @param project
- * @return
- * @throws CoreException
- */
-public static JavaClass getJavaClass(String classQName , IProject project) throws CoreException
- {
- EMFNature jMOF = JemProjectUtilities.getJEM_EMF_Nature(project, true);
- return (JavaClass)JavaRefFactory.eINSTANCE.reflectType(classQName,jMOF.getResourceSet());
- }
-
- /**
- * @param packageName
- * @param typeName
- * @param project
- * @return
- * @throws CoreException
- */
-public static JavaClass getJavaClass(String packageName, String typeName , IProject project) throws CoreException
- {
- EMFNature jMOF = JemProjectUtilities.getJEM_EMF_Nature(project, true);
- return (JavaClass)JavaRefFactory.eINSTANCE.reflectType(packageName, typeName, jMOF.getResourceSet());
- }
-
- public static boolean isValidSEIFile(JavaClass beanClass, JavaClass seiClass)
- {
- if (!seiClass.isInterface())
- return false;
-
- Vector beanMethodsList = new Vector();
- List beanMethods = beanClass.getMethods();
- Iterator beanMethodsIterator = beanMethods.iterator();
- while (beanMethodsIterator.hasNext())
- {
- Method thisMethod = (Method)beanMethodsIterator.next();
- beanMethodsList.add(thisMethod.getMethodElementSignature());
- }
-
- List seiMethods = seiClass.getMethods();
- if (beanMethods == null ) {
- if ( seiMethods == null) return true;
- else return false;
- }
- if (seiMethods == null) return false;
-
- Iterator seiMethodsIterator = seiMethods.iterator();
- while (seiMethodsIterator.hasNext())
- {
- Method thisMethod = (Method)seiMethodsIterator.next();
- if ( !beanMethodsList.contains(thisMethod.getMethodElementSignature())) {
- return false;
- }
- }
- return true;
-
- }
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ResourceUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ResourceUtils.java
deleted file mode 100644
index 650af5aa6..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ResourceUtils.java
+++ /dev/null
@@ -1,1890 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060330 124667 kathy@ca.ibm.com - Kathy Chan
- * 20060421 136761 rsinha@ca.ibm.com - Rupam Kuehner
- * 20060424 115690 sengpl@ca.ibm.com - Seng Phung-Lu
- * 20060503 126819 rsinha@ca.ibm.com - Rupam Kuehner
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaConventions;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.applicationclient.componentcore.util.AppClientArtifactEdit;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-import org.eclipse.wst.common.environment.EnvironmentService;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.model.IURLProvider;
-
-/**
- * This class contains useful methods for working with Eclipse resources.
- */
-public final class ResourceUtils {
-
- // Keeps the IWorkspaceRoot hanging around. See getWorkspaceRoot().
- private static IWorkspaceRoot root_ = null;
-
- // Keeps the IWorkspace hanging around. See getWorkspace().
-
- private static IWorkspace workspace_ = null;
-
- /**
- * As returned by {@link #getProjectType getProjectType()}, indicates that
- * the given project has no Java or Web nature.
- */
- public static byte PROJECT_TYPE_NONE = 0;
-
- /**
- * As returned by {@link #getProjectType getProjectType()}, indicates that
- * the given project has a Java project nature.
- */
- public static byte PROJECT_TYPE_JAVA = 1;
-
- /**
- * As returned by {@link #getProjectType getProjectType()}, indicates that
- * the given project has a Web project nature.
- */
- public static byte PROJECT_TYPE_WEB = 2;
-
- /**
- * As returned by {@link #getProjectType getProjectType()}, indicates that
- * the given project has an EJB project nature.
- */
- public static byte PROJECT_TYPE_EJB = 4;
-
- /**
- * As returned by {@link #getProjectType getProjectType()}, indicates that
- * the given project has an Application client project nature.
- */
- public static byte PROJECT_TYPE_APPCLIENT = 8;
-
- /**
- * The SOAP rpcrouter servlet extension to be added to web project URL
- */
- public static String SERVLET_EXT = "/servlet/rpcrouter";
-
- private static final String DEFAULT_CLIENT_WEB_PROJECT_EXT = "Client";
- private static final String DEFAULT_CLIENT_EJB_PROJECT_EXT = "EJBClient";
- private static final String DEFAULT_EJB_PROJECT_NAME = "WebServiceEJBProject";
- private static final String DEFAULT_EJB_COMPONENT_NAME = "WebServiceEJB";
- private static final String DEFAULT_WEB_PROJECT_NAME = "WebServiceProject";
- private static final String DEFAULT_WEB_COMPONENT_NAME = "WebServiceProject";
- private static final String DEFAULT_ROUTER_PROJECT_EXT = "Router";
-
- private static final String DEFAULT_SERVICE_EAR_PROJECT_NAME = "WebServiceProjectEAR";
- private static final String DEFAULT_SERVICE_EAR_COMPONENT_NAME = "WebServiceProjectEAR";
- private static final String DEFAULT_CLIENT_EAR_PROJECT_NAME = "WebServiceProjectClientEAR";
- private static final String DEFAULT_CLIENT_EAR_COMPONENT_NAME = "WebServiceProjectClientEAR";
-
- private static final String DEFAULT_EAR_EXT = "EAR";
-
- /**
- * Returns the IWorkspaceRoot object.
- * @return The IWorkspaceRoot object.
- */
- public static IWorkspaceRoot getWorkspaceRoot() {
- if (root_ == null) {
- root_ = ResourcesPlugin.getWorkspace().getRoot();
- }
- return root_;
- }
-
- /**
- * Returns the IWorkspace object.
- * @return The IWorkspace object.
- */
- public static IWorkspace getWorkspace() {
- if (workspace_ == null) {
- if (root_ == null) {
- root_ = ResourcesPlugin.getWorkspace().getRoot();
- }
- workspace_ = root_.getWorkspace();
- }
- return workspace_;
- }
-
- /**
- * Returns an {@link org.eclipse.core.resources.IResource IResource}of the
- * given absolute pathname or null if no such resource exists.
- *
- * @param absolutePathname
- * The absolute path of the resource.
- * @return The <code>IResource</code>.
- */
- public static IResource findResource(String absolutePathname) {
- if (absolutePathname == null) {
- return null;
- }
- return findResource(new Path(absolutePathname));
- }
-
- /**
- * Returns an {@link org.eclipse.core.resources.IResource IResource}of the
- * given absolute path or null if no such resource exists.
- *
- * @param absolutePath
- * The absolute <code>IPath</code> of the resource.
- * @return The <code>IResource</code>.
- */
- public static IResource findResource(IPath absolutePath) {
- if (absolutePath == null) {
- return null;
- }
- return ResourceUtils.getWorkspaceRoot().findMember(absolutePath);
- }
-
- /**
- * Returns an {@link org.eclipse.core.resources.IResource IResource}of the
- * given file system relative pathname and project or null if no such resource exists.
- *
- * @param filePath File system relative pathname
- * @param project Project
- * @return The <code>IResource</code>.
- */
- public static IResource findResourceAtLocation(String filePath, IProject project) {
-
- return findResource(findPathAtLocation( new Path(filePath), project));
- }
-
- /**
- * This method attempts to convert a path that is relative to a file system
- * to a path that is relative to the workspace. Instead of comparing the
- * filePath with the install location of the workspace (i.e.
- * Platform.getLocation()), the filePath is compared with the location of the project
- * since the project could be in a location other than the the default location relative to the
- * workspace.
- *
- * @param filePath File path relative to a file system
- * @param project The project the file is in
- * @return Path relative to the workspace
- */
- public static IPath findPathAtLocation(IPath filePath, IProject project) {
- IPath result = null;
-
- IPath projectLocation = project.getLocation();
-
- if (projectLocation.matchingFirstSegments(filePath) == projectLocation
- .segmentCount()) {
- filePath = filePath.removeFirstSegments(projectLocation
- .segmentCount() - 1);
- result = filePath.setDevice(null);
- }
-
- return result;
- }
- /**
- * Validates the given string as a name for a resource of the given type(s).
- * This method obeys the contract of
- * {@link org.eclipse.core.resources.IWorkspace#validateName IWorkspace.validateName()}.
- *
- * @param segment
- * The path to validate.
- * @param typeMask
- * The <code>IResource</code> type or types.
- * @return The status with a value if <code>IStatus.OK</code> if the path
- * is valid, or with appropriate severity and message information if
- * the path is not valid.
- *
- * @deprecated not used
- */
- public static IStatus validateName(String segment, int typeMask) {
- return getWorkspace().validateName(segment, typeMask);
- }
-
- /**
- * Validates the given string as the path of a resource of the given
- * type(s). This method obeys the contract of
- * {@link org.eclipse.core.resources.IWorkspace#validatePath IWorkspace.validatePath()}.
- *
- * @param path
- * The path to validate.
- * @param typeMask
- * The <code>IResource</code> type or types.
- * @return The status with a value if <code>IStatus.OK</code> if the path
- * is valid, or with appropriate severity and message information if
- * the path is not valid.
- * @deprecated not used
- */
- public static IStatus validatePath(String path, int typeMask) {
- return getWorkspace().validatePath(path, typeMask);
- }
-
- /**
- * Validates the given Java type name.
- *
- * @param typeName
- * The Java type name.
- * @return The status with a value of <code>IStatus.OK</code> if the name
- * is valid, or with appropriate severity and message information if
- * name is not valid. The primitive types (boolean, char, byte,
- * short, int, long, float, double) are valid. Arrays of valid types
- * are themselves valid.
- * @deprecated use JavaConventions in the jdt core
- */
- public static IStatus validateJavaTypeName(String typeName) {
- //
- // Strip off the trailing array bits, if any.
- //
- int a = typeName.indexOf('[');
- if (a > 0) {
- typeName = typeName.substring(0, a);
- }
- //
- // Allow primitives.
- //
- if (isPrimitiveJavaType(typeName)) {
- return new Status(IStatus.OK, WebServicePlugin.ID, 0, "", null);
- }
- //
- // Defer to JavaConventions.
- //
- return JavaConventions.validateJavaTypeName(typeName);
- }
-
- /**
- * Returns true if the given <code>typeName</code> is a Java primitive
- * (boolean, char, byte, short, int, long, float, double).
- *
- * @return True if the type name is a Java primitive.
- *
- * @deprecated
- */
- public static boolean isPrimitiveJavaType(String typeName) {
- return (typeName.equals("boolean") || typeName.equals("char")
- || typeName.equals("byte") || typeName.equals("short")
- || typeName.equals("int") || typeName.equals("long")
- || typeName.equals("float") || typeName.equals("double"));
- }
-
- /**
- * Returns the handle of the IProject at the beginning of the given
- * <code>absolutePath</code>. Neither the given path nor the project need
- * exist in the workspace. The path must be absolute, and must consist of at
- * least one segment.
- *
- * @return An IProject handle for the project at the beginning of the given
- * <code>absolutePath</code>, or null if the path does not
- * specify a project.
- */
- public static IProject getProjectOf(IPath absolutePath) {
- if (absolutePath.isAbsolute()) {
- String projectName = absolutePath.segment(0);
- if (projectName != null) {
- return getWorkspaceRoot().getProject(projectName);
- }
- }
- return null;
- }
-
- /**
- *
- * @param absolutePath
- * @return
- */
- public static IVirtualComponent getComponentOf(IPath absolutePath){
- if (absolutePath.isAbsolute()) {
- String projectName = absolutePath.segment(0);
- IProject project = getWorkspaceRoot().getProject(projectName);
- if (projectName != null) {
- return ComponentCore.createComponent(project);
- }
- }
- return null;
- }
-
- public static IVirtualComponent getComponentOf(IResource res)
- {
- IVirtualResource[] vresources = ComponentCore.createResources(res);
- IVirtualComponent vcomp = null;
- if (vresources != null && vresources.length>0)
- {
- IVirtualResource vres = vresources[0];
- vcomp = vres.getComponent();
- }
- return vcomp;
- }
-
-
- /**
- * Returns true if the given <code>project</code> is a Java Project.
- *
- * @param project
- * The project.
- * @return True if the project is a Java Project.
- */
- public static boolean isJavaProject(IProject project) {
- try
- {
- return project.hasNature(JavaCore.NATURE_ID);
- }
- catch (CoreException ce)
- {
- //Return false if CoreException occurs while checking nature.
- return false;
- }
- }
-
- /**
- * Returns true if the given <code>project</code> is a Java Project.
- *
- * @param project
- * The project.
- * @return True if the project is a Java Project.
- */
- public static boolean isTrueJavaProject(IProject project) {
- return (!isWebProject(project) && !isAppClientProject(project) && !isEARProject(project)
- && !isEJBProject(project) && isJavaProject(project));
- /*
- * try { String[] natures = project.getDescription().getNatureIds();
- * return (natures.length == 1 &&
- * natures[0].equals(JavaCore.NATURE_ID)); } catch (CoreException e) { }
- * return false;
- */
- }
-
- /**
- * Returns true if the given <code>project</code> is a Web Project.
- * Note: For components; use J2EEUtils.isWebComponent()
- * @param project
- * The project.
- * @return True if the project is a Web Project.
- *
- * @deprecated
- */
- public static boolean isWebProject(IProject project) {
- boolean isWeb = false;
- StructureEdit mc = null;
- try {
- mc = StructureEdit.getStructureEditForRead(project);
- WorkbenchComponent[] wbcs = mc.getWorkbenchModules();
- if (wbcs.length!=0) {
- //isWeb = WebArtifactEdit.isValidWebModule(wbcs[0]);
- }
- }
- catch(Exception ex){
- // handle exception
- }
- finally{
- if (mc!=null)
- mc.dispose();
- }
-
- return isWeb;
- }
-
- /**
- * Note: for components; use J2EEUtils.isEARComponent()
- * @param project
- * @return
- *
- * @deprecated
- */
- public static boolean isEARProject(IProject project){
- boolean isEAR = false;
- StructureEdit mc = null;
- try {
- mc = StructureEdit.getStructureEditForRead(project);
- WorkbenchComponent[] wbcs = mc.getWorkbenchModules();
- if (wbcs.length!=0) {
- EARArtifactEdit earEdit = null;
- try {
- //earEdit = EARArtifactEdit.getEARArtifactEditForRead(wbcs[0]);
- if (earEdit!=null){
- isEAR = true;
- }
- }
- finally{
- if (earEdit!=null)
- earEdit.dispose();
- }
- }
- }
- catch(Exception ex){}
- finally{
- if (mc!=null)
- mc.dispose();
- }
-
- return isEAR;
- }
- /**
- * Returns true if the given <code>project</code> is an EJB 1.1 or EJB 2.0
- * Project.
- * Note: for components, use J2EEUtils.isEJBComponent
- * @param project
- * The project.
- * @return True if the project is an EJB 1.1 or an EJB 2.0 Project.
- *
- * @deprecated
- *
- */
- public static boolean isEJBProject(IProject project) {
- boolean isEJB = false;
- StructureEdit mc = null;
- try {
- mc = StructureEdit.getStructureEditForRead(project);
- WorkbenchComponent[] wbcs = mc.getWorkbenchModules();
- if (wbcs.length!=0) {
- EJBArtifactEdit ejbEdit = null;
- try {
- //ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(wbcs[0]);
- if (ejbEdit!=null){
- isEJB = true;
- }
- }
- finally{
- if (ejbEdit!=null)
- ejbEdit.dispose();
- }
- }
- }
- catch(Exception ex){}
- finally{
- if (mc!=null)
- mc.dispose();
- }
-
- return isEJB;
- }
-
- /**
- * Returns true if the given <code>project</code> is an Application Client
- * Project.
- * Note: for components, use J2EEUtils.isAppClientComponent()
- * @param project
- * The project.
- * @return True if the project is an Application Client Project
- *
- * @deprecated
- */
- public static boolean isAppClientProject(IProject project) {
- boolean isAppClient = false;
- StructureEdit mc = null;
- try {
- mc = StructureEdit.getStructureEditForRead(project);
- WorkbenchComponent[] wbcs = mc.getWorkbenchModules();
- if (wbcs.length!=0) {
- AppClientArtifactEdit appClientEdit = null;
- try {
- //appClientEdit = AppClientArtifactEdit.getAppClientArtifactEditForRead(wbcs[0]);
- if (appClientEdit!=null){
- isAppClient = true;
- }
- }
- finally{
- if (appClientEdit!=null)
- appClientEdit.dispose();
- }
- }
- }
- catch(Exception ex){}
- finally{
- if (mc!=null)
- mc.dispose();
- }
-
- return isAppClient;
- }
-
- /**
- * Returns the type of the given <code>project</code> as a bitmask.
- * Relevant bitmask values are:
- * <ol>
- * <li>{@link #PROJECT_TYPE_JAVA PROJECT_TYPE_JAVA}
- * <li>{@link #PROJECT_TYPE_WEB PROJECT_TYPE_WEB}
- * <li>{@link #PROJECT_TYPE_EJB PROJECT_TYPE_EJB}
- * <li>{@link #PROJECT_TYPE_NONE PROJECT_TYPE_NONE}
- * </ol>
- *
- * @param project
- * The project.
- * @return The type bitmask of the project.
- *
- * @deprecated use getComponentType
- */
- public static byte getProjectType(IProject project) {
- byte projectType = PROJECT_TYPE_NONE;
- if (ResourceUtils.isJavaProject(project)) {
- projectType |= PROJECT_TYPE_JAVA;
- }
- if (ResourceUtils.isWebProject(project)) {
- projectType |= PROJECT_TYPE_WEB;
- }
- if (ResourceUtils.isEJBProject(project)) {
- projectType |= PROJECT_TYPE_EJB;
- }
- return projectType;
- }
-
- /**
- * Returns the component type id as defined in IModuleConstants
- * i.e. IModuleConstants.JST_WEB_MODULE = "jst.web"
- * @param project
- * @return
- */
- public static String getComponentType(IProject project){
- return J2EEProjectUtilities.getJ2EEProjectType(project);
- }
-
- /**
- * Returns the component type
- * @param component
- * @return
- */
- public static String getComponentType(IVirtualComponent component){
- return getComponentType(component.getProject());
- }
-
- /**
- * Returns WebModule Deployable of the <code>project</code> as an
- * <code>IDeployable</code>, or null if the project has no Web nature.
- *
- * @param project
- * The project.
- * @return WebModule Deployable of the <code>project</code> or null if the
- * project has no Web nature.
- */
- public static IModule getModule(IProject project) {
- return ServerUtil.getModule(project);
-}
-
-// Workaround for 113621
-//public static IModule getModule(IProject project) {
-// IModule[] modules = ServerUtil.getModules(project);
-// if (modules!=null && modules.length!=0) {
-// return modules[0];
-// }
-// return null;
-//}
-
- /**
- * Returns the build output location of the <code>project</code> as an
- * <code>IPath</code>, or null if the project has no Java nature.
- * i.e. WP\.deployables\webModule\WEB-INF\classes
- * @param project
- * The project.
- * @return The build output location of the <code>project</code> or null
- * if the project has no Java nature.
- * @deprecated not used
- */
- public static IPath getJavaOutputLocation(IProject project) {
- IPath outputLocation = null;
- try {
- IJavaProject javaProject = JavaCore.create(project);
- if (javaProject != null) {
- outputLocation = javaProject.getOutputLocation();
- }
- } catch (JavaModelException e) {
- }
- ILog log = EnvironmentService.getEclipseLog();
- log.log(ILog.INFO, 5032, ResourceUtils.class, "getJavaOutputLocation",
- "project=" + project + ",outputLocation=" + outputLocation);
-
- return outputLocation;
- }
-
- /**
- * Returns a build source location of the <code>project</code> as an
- * <code>IPath</code>, or null if the project either has no Java nature
- * or if the project's build classpath contains no folders local to the
- * project. If the project has more than one of its own folders on the build
- * classpath, then one of them is chosen arbitrarily as the build source
- * location. To work with all entries on the build classpath, use
- * {@link #getJavaPackageFragmentRoots getJavaPackageFragmentRoots()}or
- * {@link #getJavaClasspath getJavaClasspath()}.
- *
- * @param project
- * The project.
- * @return A build source location of the <code>project</code> or null if
- * the project has no Java nature or if the project's build
- * classpath contains no folders local to the project.
- */
-
- public static IPath getJavaSourceLocation(IProject project) {
- IPath sourceLocation = null;
- IPackageFragmentRoot[] fragmentRoots = getJavaPackageFragmentRoots(project);
- for (int i = 0; i < fragmentRoots.length && sourceLocation == null; i++) {
- try {
- IResource fragmentRoot = fragmentRoots[i]
- .getCorrespondingResource();
- if (fragmentRoot != null
- && (fragmentRoot.getProject().equals(project))
- && (fragmentRoot.getType() != IResource.FILE)) {
- sourceLocation = fragmentRoot.getFullPath();
- }
- } catch (JavaModelException e) {
- }
- }
-
- ILog log = EnvironmentService.getEclipseLog();
- log.log(ILog.INFO, 5030, ResourceUtils.class, "getJavaSourceLocation",
- "project=" + project + ",sourceLocation=" + sourceLocation);
-
- return sourceLocation;
- }
-
-
- /**
- * Returns the "JavaSource" folder
- * @param project
- * @return
- */
- /*
- public static IPath getJavaSourceLocation(IProject project){
- IVirtualComponent component = ComponentCore.createComponent(project);
- return getJavaSourceLocation(component);
- }
- */
- /**
- * Returns the JavaSource location folder
- * @param comp
- * @return
- */
- public static IPath getJavaSourceLocation(IVirtualComponent comp){
- if (comp!=null){
- IVirtualFolder folder = comp.getRootFolder().getFolder(new Path("/WEB-INF/classes"));
- return folder.getWorkspaceRelativePath();
- }
- return null;
- }
-
- /**
- * Returns the JavaSource locations in each project
- * @param project
- * @return
- */
- public static IPath[] getAllJavaSourceLocations(IProject project) {
- Vector pathVector = new Vector();
- IPackageFragmentRoot[] fragmentRoots = getJavaPackageFragmentRoots(project);
-
- for (int i = 0; i < fragmentRoots.length; i++) {
- try {
- IResource fragmentRoot = fragmentRoots[i].getCorrespondingResource();
- if (fragmentRoot != null && (fragmentRoot.getProject().equals(project))
- && (fragmentRoot.getType() != IResource.FILE)) {
- pathVector.add(fragmentRoot.getFullPath());
- }
- } catch (JavaModelException e) {
- }
- }
- return (IPath[]) pathVector.toArray(new Path[pathVector.size()]);
- }
-
- public static IPath[] getAllJavaSourceLocations(IVirtualComponent[] components) {
-
- if (components!=null){
- List javaSourcePaths = new ArrayList();
- for (int i=0;i<components.length;i++){
- IPath path = getJavaSourceLocation(components[i]);
- javaSourcePaths.add(path);
- }
- return (IPath[])javaSourcePaths.toArray(new IPath[0]);
- }
- return null;
- }
-
- /**
- * Returns a build source package fragment root of the <code>project</code>
- * as an <code>IPackageFragmentRoot</code>, or null if the project either
- * has no Java nature or if the project's build classpath contains no
- * folders local to the project. If the project has more than one of its own
- * folders on the build classpath, then one of them is chosen arbitrarily as
- * the build source location.
- *
- * @param project
- * The project.
- * @return A build source package fragment root of the <code>project</code>
- * or null if the project has no Java nature or if the project's
- * build classpath contains no folders local to the project.
- *
- * @deprecated not used
- */
- public static IPackageFragmentRoot getJavaSourcePackageFragmentRoot(IProject project) {
- IPackageFragmentRoot packageFragmentRoot = null;
- IPath javaSourceLocation = getJavaSourceLocation(project);
- try {
- IJavaProject javaProject = JavaCore.create(project);
- if (javaProject != null) {
- packageFragmentRoot = javaProject.findPackageFragmentRoot(javaSourceLocation);
- }
- } catch (JavaModelException e) {
- }
- return packageFragmentRoot;
- }
-
- /**
- * Returns the package fragment roots of the <code>project</code> as an
- * array of <code>IPackageFragmentRoot</code> objects. If the project has
- * no Java nature then the returned array will be of length zero.
- *
- * @param project
- * The project.
- * @return The package fragment roots of the <code>project</code>.
- */
- public static IPackageFragmentRoot[] getJavaPackageFragmentRoots(IProject project) {
- try {
- IJavaProject javaProject = JavaCore.create(project);
- if (javaProject != null) {
- IPackageFragmentRoot[] packageFragmentRoots = javaProject
- .getPackageFragmentRoots();
- return packageFragmentRoots;
- }
- } catch (JavaModelException e) {
- }
- return new IPackageFragmentRoot[0];
- }
-
- /**
- * Returns the build classpath entries of the <code>project</code> as an
- * array of <code>IClasspathEntry</code> objects. If the project has no
- * Java nature then the returned array will be of length zero.
- *
- * @param project
- * The project.
- * @return The classpath entries of the <code>project</code>.
- *
- * @deprecated not used
- */
- public static IClasspathEntry[] getJavaClasspath(IProject project) {
- try {
- IJavaProject javaProject = JavaCore.create(project);
- if (javaProject != null) {
- IClasspathEntry[] classpathEntries = javaProject.getRawClasspath();
- return classpathEntries;
- }
- } catch (JavaModelException e) {
- }
- return new IClasspathEntry[0];
- }
-
- /**
- *
- * @param project
- * @return
- */
- public static IFolder getWebComponentServerRoot(IProject project){
-
- IFolder webModuleServerRoot = null;
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (vc.exists())
- webModuleServerRoot = J2EEUtils.getOutputContainerRoot(vc);
-
- return webModuleServerRoot;
- }
-
- /**
- * Returns the URL string corresponding to the web server module root of the
- * project in a server instance or null if the project has no Web nature or
- * has no association to a server instance.
- *
- * @param project
- * The project.
- * @return The web server module root URL or null if the project has no Web
- * nature or has no association to a server instance.
- * @deprecated use getWebComponentURL(..) which belongs in ServerUtils
- */
- public static String getWebProjectURL(IProject project,
- String serverFactoryId, IServer server) {
-
- String webProjectURL = null;
- IModule module = getModule(project);
- if (module != null) {
- IServer serverInstance = ServerUtils.getServerForModule(module,
- serverFactoryId, server, true, new NullProgressMonitor());
- if (serverInstance != null) {
-// URL url = ((IURLProvider) serverInstance.getDelegate()).getModuleRootURL(module);
- URL url = ((IURLProvider)serverInstance.getAdapter(IURLProvider.class)).getModuleRootURL(module);
- if (url != null) {
- String s = url.toString();
- webProjectURL = (s.endsWith("/") ? s.substring(0, s
- .length() - 1) : s);
- }
- }
- }
-
- ILog log = EnvironmentService.getEclipseLog();
- log.log(ILog.INFO, 5036, ResourceUtils.class, "getWebProjectURL",
- "project=" + project + ",webProjectURL=" + webProjectURL);
-
- return webProjectURL;
- }
-
- /**
- * Returns the forged URL string corresponding to the web server module root
- * of the project in a server instance or null if the project has no Web
- * nature or has no association to a server instance.
- *
- * @param project
- * @return The web server module root URL or null if the project has no Web
- * nature or has no association to a server instance.
- * @deprecated not used
- */
-// public static String getForgedWebProjectURL(IProject project, String serverFactoryId, IServer server){
-//
-// String webProjectURL = null;
-// IModule module = getModule(project);
-// if (module != null)
-// {
-// //IServer serverInstance = ServerUtils.getServerForModule(module,
-// // serverFactoryId, server, true, new NullProgressMonitor());
-// if (server != null)
-// {
-// String hostname = server.getHost();
-//
-// // get ServerPort
-// int portNumber = 0;
-//
-// ServerPort[] ports = server.getServerPorts(null);
-// ServerPort port = null;
-// for (int it = 0; it<ports.length; it++)
-// {
-// ServerPort p = ports[it];
-// String protocol = p.getProtocol();
-// if (protocol != null && protocol.trim().toLowerCase().equals("http"))
-// {
-// port = p;
-// portNumber = p.getPort();
-// break;
-// }
-// }
-//
-//
-//
-// URL url = null;
-// try {
-// url = new URL("http", hostname, portNumber, "");
-// }
-// catch(Exception e){
-// e.printStackTrace();
-// }
-//
-//
-// //URL url = ((IURLProvider) serverInstance.getDelegate()).getModuleRootURL(module);
-//
-// if (url != null)
-// {
-// String s = url.toString();
-// webProjectURL = s + "/"+project.getName();
-// //webProjectURL = (s.endsWith("/") ? s.substring(0,s.length()-1) : s);
-// }
-// }
-// }
-// ILog log = new EclipseLog();
-// log.log(ILog.INFO, 5036, ResourceUtils.class, "getWebProjectURL", "project="+project+",webProjectURL="+webProjectURL);
-// return webProjectURL;
-// }
- /**
- * Returns the URL string corresponding to the web server module root of the
- * project in a server instance or null if the project has no Web nature or
- * has no association to a server instance.
- *
- * @param project
- * The project.
- * @return The web server module root URL or null if the project has no Web
- * nature or has no association to a server instance.
- * @deprecated belongs in ServerUtils
- *
- */
- public static String getWebProjectURL(IProject project) {
- String webProjectURL = null;
- IModule module = getModule(project);
- if (module != null) {
- IServer serverInstance = ServerUtils.getServerForModule(module);
- if (serverInstance != null) {
- URL url = ((IURLProvider)serverInstance.getAdapter(IURLProvider.class)).getModuleRootURL(module);
- if (url != null) {
- String s = url.toString();
- webProjectURL = (s.endsWith("/") ? s.substring(0, s
- .length() - 1) : s);
- }
- }
- }
- ILog log = EnvironmentService.getEclipseLog();
- log.log(ILog.INFO, 5037, ResourceUtils.class, "getWebProjectURL",
- "project=" + project + ",webProjectURL=" + webProjectURL);
-
- return webProjectURL;
- }
-
- /**
- *
- * @param project
- * @return
- *
- * @deprecated should be in ServerUtils
- */
- public static String getEncodedWebProjectURL(IProject project) {
- String url = getWebProjectURL(project);
- if (url != null) {
- int index = url.lastIndexOf('/');
- if (index != -1) {
- StringBuffer encodedURL = new StringBuffer();
- encodedURL.append(url.substring(0, index + 1));
- try {
- String ctxtRoot = URLEncoder.encode(url.substring(index + 1, url.length()), "UTF-8");
- int plusIndex = ctxtRoot.indexOf('+');
- while (plusIndex != -1) {
- StringBuffer sb = new StringBuffer();
- sb.append(ctxtRoot.substring(0, plusIndex));
- sb.append("%20");
- sb.append(ctxtRoot.substring(plusIndex + 1, ctxtRoot
- .length()));
- ctxtRoot = sb.toString();
- plusIndex = ctxtRoot.indexOf('+');
- }
- encodedURL.append(ctxtRoot);
- }catch (IOException io){
- //handler exception
- }
- url = encodedURL.toString();
- }
- }
- return url;
- }
-
- /**
- * Given the <code>absolutePath</code> of a Java resource, returns the
- * package name of the resource or null if the resource is not properly
- * located in a project or folder on the build classpath or that is the
- * build output path.
- *
- * @param absolutePath
- * The absolute path of the Java resource.
- * @return the package name of the Java resource.
- */
- public static String getJavaResourcePackageName(IPath absolutePath) {
- try {
- IPath javaFolderPath = absolutePath.removeLastSegments(1);
- IProject project = getProjectOf(absolutePath);
- IJavaProject javaProject = JavaCore.create(project);
- if (javaProject != null) {
- IPackageFragment fragment = javaProject
- .findPackageFragment(javaFolderPath);
- if (fragment != null) {
- return fragment.getElementName();
- }
- IPath outputPath = getJavaOutputLocation(project);
- if (outputPath.isPrefixOf(javaFolderPath)) {
- IPath javaPackagePath = javaFolderPath
- .removeFirstSegments(outputPath.segmentCount());
- return javaPackagePath.isEmpty() ? null : javaPackagePath
- .toString().replace(IPath.SEPARATOR, '.');
- }
- }
- } catch (JavaModelException e) {
- }
- return null;
- }
-
- /**
- * Given the <code>absolutePath</code> of a Java resource, returns the
- * package name of the resource as a relative pathname or null if the
- * resource is not properly located in a project or folder on the build
- * classpath.
- *
- * @param absolutePath
- * The absolute path of the Java resource.
- * @return the package name of the Java resource as a relative path.
- */
- public static IPath getJavaResourcePackagePath(IPath absolutePath) {
- String packageName = ResourceUtils
- .getJavaResourcePackageName(absolutePath);
- return (packageName == null ? null : new Path(packageName.replace('.',
- IPath.SEPARATOR)));
- }
-
- /**
- * Given the <code>absolutePath</code> of a Java resource, returns the
- * absolute path of the project or folder that is on the build classpath or
- * is the build output path and that contains the fully qualified Java
- * resource, or null if no such project or folder exists.
- *
- * @param absolutePath
- * The absolute path of the Java resource.
- * @return The absolute path of the project or folder containing the fully
- * qualified Java resource.
- * @deprecated not used
- */
- public static IPath getJavaResourceRootPath(IPath absolutePath) {
- try {
- IProject project = getProjectOf(absolutePath);
- IJavaProject javaProject = JavaCore.create(project);
- if (javaProject != null) {
- IPackageFragmentRoot[] pfrs = javaProject
- .getPackageFragmentRoots();
- for (int i = 0; i < pfrs.length; i++) {
- IResource fragmentRoot = pfrs[i].getCorrespondingResource();
- if (fragmentRoot != null) {
- IPath fragmentPath = fragmentRoot.getFullPath();
- if (fragmentPath.isPrefixOf(absolutePath)) {
- return fragmentPath;
- }
- }
- }
- IPath outputPath = getJavaOutputLocation(project);
- if (outputPath.isPrefixOf(absolutePath)) {
- return outputPath;
- }
- }
- } catch (JavaModelException e) {
- }
- return null;
- }
-
- /**
- * Determines an URL (HTTP or FILE) to an Eclipse resource, returning the
- * URL string if successful and false otherwise. A value of null will
- * definitely be returned if any of the following conditions are not met:
- * <ol>
- * <li>The absolute path begins with a Web Project.
- * <li>The leading portion of the absolute path matches the path of the
- * container returned by {#link #getWebModuleServerRoot
- * getWebModuleServerRoot} for the project.
- * <li>The path does not lead to the WEB-INF folder or any descendent
- * thereof.
- * <li>The Web Project is associated with an explicit or default server
- * instance.
- * </ol>
- *
- * @param absolutePath
- * The absolute path of the resource.
- * @return The URL of the file, or null if no URL can be determined.
- * @deprecated not used
- */
-// public static String getURLFromPath(IPath absolutePath,
-// String serverFactoryId, IServer server) {
-// return getURLFromPath(absolutePath, getWebProjectURL(
-// getProjectOf(absolutePath), serverFactoryId, server));
-// }
-
- /**
- *
- * @param absolutePath
- * @param webProjectURL
- * @return
- * @deprecated not used
- */
-// public static String getURLFromPath(IPath absolutePath, String webProjectURL) {
-// StringBuffer url = new StringBuffer();
-// IProject project = getProjectOf(absolutePath);
-// IContainer webModuleServerRoot = getWebModuleServerRoot(project);
-// if (webModuleServerRoot != null) {
-// IPath webModuleServerRootPath = webModuleServerRoot.getFullPath();
-// if (webModuleServerRootPath.isPrefixOf(absolutePath)) {
-// int numSegment = webModuleServerRootPath.segmentCount();
-// int numSegmentFromPath = absolutePath.segmentCount();
-// if (numSegmentFromPath > numSegment) {
-// String nextSegment = absolutePath.segment(numSegment);
-// // check if the segment after the WebModuleServerRoot is
-// // WEB-INF (ignoring case)
-// if (nextSegment != null && !nextSegment.equalsIgnoreCase("WEB-INF")) {
-// IPath relativePath = absolutePath.removeFirstSegments(numSegment);
-// if (webProjectURL != null)
-// url.append(webProjectURL).append(IPath.SEPARATOR).append(relativePath.toString());
-// }
-// } else if (numSegmentFromPath == numSegment)
-// url.append(webProjectURL);
-// }
-// }
-// if (url.length() < 1) {
-// IWorkspaceRoot workspace = getWorkspaceRoot();
-// url.append(getResourceURI(workspace.getFile(absolutePath)));
-// }
-// ILog log = new EclipseLog();
-// log.log(ILog.INFO, 5038, ResourceUtils.class, "getURLFromPath",
-// "absolutePath=" + absolutePath + ",url=" + url);
-//
-// return url.toString();
-// }
-
- /**
- * Copies a set of files from a plugin's installation location to a native
- * directory. The files are named in an index file located relative to the
- * plugin's installation location.
- *
- * @param plugin
- * The plugin containing the files to copy. Must not be null.
- * @param sourcePath
- * The path, relative to the <code>plugin</code> install
- * location, containing the files to copy. If null, then the
- * plugin install location is the source path (ie. null is
- * equivalent to ".").
- * @param indexPathname
- * A file containing a whitespace-delimitted list of pathnames of
- * the files to copy. The pathnames are relative to the
- * <code>plugin sourcePath</code>. Must not be null.
- * @param targetPath
- * The absolute path of the native directory to which the files
- * will be copied. The relative pathnames of the files named in
- * the <code>indexPathname</code> file are preserved. Must not
- * be null.
- * @param progressMonitor
- * The progress monitor for the operation, or null.
- * @throws IOException
- * An exception indicating an IO error has occured.
- */
- static public void copyIndexedFilesToOS(Plugin plugin, IPath sourcePath,
- IPath indexPathname, IPath targetPath,
- IProgressMonitor progressMonitor) throws IOException {
- InputStream input = plugin.openStream(indexPathname);
- Enumeration filenames = StringUtils.parseFilenamesFromStream(input);
- copyEnumeratedFilesToOS(plugin, sourcePath, filenames, targetPath,
- progressMonitor);
- }
-
- /**
- * Copies a set of files from a plugin's installation location to a native
- * directory. The files are named in an enumeration.
- *
- * @param plugin
- * The plugin containing the files to copy. Must not be null.
- * @param sourcePath
- * The path, relative to the <code>plugin</code> install
- * location, containing the files to copy. If null, then the
- * plugin install location is the source path (ie. null is
- * equivalent to ".").
- * @param pathnames
- * An enumeration of pathnames of the files to copy. The
- * pathnames are relative to the <code>plugin sourcePath</code>.
- * Must not be null.
- * @param targetPath
- * The absolute path of the native directory to which the files
- * will be copied. The relative pathnames of the files named in
- * the <code>pathnames</code> enumeration are preserved. Must
- * not be null.
- * @param progressMonitor
- * The progress monitor for the operation, or null.
- * @throws IOException
- * An exception indicating an IO error has occured.
- */
- static public void copyEnumeratedFilesToOS(Plugin plugin, IPath sourcePath,
- Enumeration pathnames, IPath targetPath,
- IProgressMonitor progressMonitor) throws IOException {
- while (pathnames.hasMoreElements()) {
- String filename = (String) pathnames.nextElement();
- copyFileToOS(plugin, sourcePath, new Path(filename), targetPath,
- progressMonitor);
- }
- }
-
- /**
- * Copies a file from a plugin's installation location to a native
- * directory.
- *
- * @param plugin
- * The plugin containing the files to copy. Must not be null.
- * @param sourcePath
- * The path, relative to the <code>plugin</code> install
- * location, containing the files to copy. If null, then the
- * plugin install location is the source path (ie. null is
- * equivalent to ".").
- * @param pathname
- * The pathname of the file to copy. The pathname is relative to
- * the <code>plugin sourcePath</code>. Must not be null.
- * @param targetPath
- * The absolute path of the native directory to which the file
- * will be copied. The relative pathname of the file is
- * preserved. Must not be null.
- * @param progressMonitor
- * The progress monitor for the operation, or null.
- * @throws IOException
- * An exception indicating an IO error has occured.
- */
- static public void copyFileToOS(Plugin plugin, IPath sourcePath,
- IPath pathname, IPath targetPath, IProgressMonitor progressMonitor)
- throws IOException {
- IPath target = targetPath.append(pathname);
- IPath source = sourcePath == null ? pathname : sourcePath
- .append(pathname);
- InputStream input = plugin.openStream(source);
- OutputStream output = new FileOutputStream(target.toOSString());
- copyStream(input, output);
- input.close();
- output.close();
- }
-
- /**
- * Copies data from one stream to another.
- *
- * @param input
- * The input stream.
- * @param output
- * The output stream.
- * @return The number of bytes copied.
- * @throws IOException
- * An exception if an error occurs while processing either of
- * the streams.
- */
- static public int copyStream(InputStream input, OutputStream output)
- throws IOException {
- int t = 0;
- byte[] buffer = new byte[1024];
- int n = input.read(buffer);
- while (n >= 0) {
- output.write(buffer, 0, n);
- t += n;
- n = input.read(buffer);
- }
- return t;
- }
-
- /**
- * Creates a native directory path equal to the parent portion of the given
- * <code>pathname</code>. If the directory already exists, then no action
- * is taken.
- *
- * @param pathname
- * The pathname to the file whose parent directory should be
- * created.
- * @throws IOException
- * An exception if an IO error occurs.
- */
- static public void createParentDirectoryFor(String pathname)
- throws IOException {
- File file = new File(pathname);
- File parent = file.getParentFile();
- if (parent != null) {
- parent.mkdirs();
- }
- }
-
- /**
- * Returns the IResource represented by the given selection.
- *
- * @param object
- * The selection
- * @return IResource if the selection represents an IResource. Returns null
- * otherwise.
- * @throws CoreException
- */
- static public IResource getResourceFromSelection(Object obj)
- throws CoreException {
- IResource res = null;
- if (obj != null) {
- if (obj instanceof IResource) {
- res = (IResource) obj;
- } else if (obj instanceof IJavaElement) {
- IJavaElement javaElement = (IJavaElement) obj;
- res = javaElement.getCorrespondingResource();
- } else if (obj instanceof EnterpriseBean) {
- EnterpriseBean ejbBean = (EnterpriseBean) obj;
- IProject ejbProject = ProjectUtilities.getProject(ejbBean);
- if (ejbProject != null)
- res = ejbProject;
- }
-
- }
-
- return res;
- }
-
- //----------------------------------------------------------------------
- // Naughty bits...
- //----------------------------------------------------------------------
-
- //
- // Creates a path of folders.
- // Do not call with an absolutePath of less than one segment.
- //
- // private static IContainer makeFolderPath (
- // ResourceContext resourceContext,
- // IPath absolutePath,
- // IProgressMonitor progressMonitor,
- // StatusMonitor statusMonitor
- // )
- // throws CoreException
- // {
- // if (absolutePath.segmentCount() <= 1)
- // {
- // return getWorkspaceRoot().getProject(absolutePath.segment(0));
- // }
- // else
- // {
- // IContainer parent = makeFolderPath(resourceContext,
- // absolutePath.removeLastSegments(1), progressMonitor, statusMonitor);
- // String folderName = absolutePath.lastSegment();
- // return makeFolder(resourceContext, parent,folderName, progressMonitor ,
- // statusMonitor);
- // }
- // }
- //
- // Creates a folder under a container.
- // The container must already exist.
- //
- // private static IFolder makeFolder (
- // ResourceContext resourceContext,
- // IContainer parent,
- // String folderName,
- // IProgressMonitor progressMonitor,
- // StatusMonitor statusMonitor
- // )
- // throws CoreException
- // {
- // IResource child = parent.findMember(folderName);
- // if (child == null)
- // {
- // if (!resourceContext.isCreateFoldersEnabled()) {
- // int result = statusMonitor.reportStatus(new
- // Status(IStatus.WARNING,WebServicePlugin.ID,0,
- // WebServicePlugin.getMessage("%MSG_ERROR_FOLDER_CREATION_DISABLED",
- // new Object[] {parent.getFullPath().toString(),folderName}),null),
- // getThreeStateFileOptions());
- // if (result == IStatusDialogConstants.CANCEL_ID)
- // return null;
- //
- // if ( result == IStatusDialogConstants.YES_TO_ALL_ID)
- // resourceContext.setCreateFoldersEnabled(true);
- //
- // }
- // IFolder folder = parent.getFolder(new Path(folderName));
- // folder.create(true,true,progressMonitor);
- // return folder;
- // }
- // else if (child.getType() == IResource.FOLDER)
- // {
- // return (IFolder)child;
- // }
- // else
- // {
- // throw new CoreException(new
- // Status(IStatus.ERROR,WebServicePlugin.ID,0,WebServicePlugin.getMessage("%MSG_ERROR_RESOURCE_NOT_FOLDER",new
- // Object[] {parent.getFullPath().append(folderName).toString()}),null));
- // }
- // }
-
- //
- // Creates a file under a container.
- // The container must already exist.
- //
- // private static IFile makeFile (
- // ResourceContext resourceContext,
- // IContainer parent,
- // String fileName,
- // InputStream inputStream,
- // IProgressMonitor progressMonitor,
- // StatusMonitor statusMonitor
- // )
- // throws CoreException
- // {
- // IResource child = parent.findMember(fileName);
- // if (child != null)
- // {
- // if (child.getType() == IResource.FILE)
- // {
- // if (!resourceContext.isOverwriteFilesEnabled()) {
- // int result = statusMonitor.reportStatus( new
- // Status(IStatus.WARNING,WebServicePlugin.ID,0,
- // WebServicePlugin.getMessage("%MSG_ERROR_FILE_OVERWRITE_DISABLED",
- // new Object[] {parent.getFullPath().toString(),fileName}),null),
- // getThreeStateFileOptions());
- //
- // if (result == IStatusDialogConstants.CANCEL_ID)
- // return null;
- //
- // if ( result == IStatusDialogConstants.YES_TO_ALL_ID)
- // resourceContext.setOverwriteFilesEnabled(true);
- // }
- // //We have permission to overwrite so check if file is read-only
- // if (child.isReadOnly())
- // {
- // if (!resourceContext.isCheckoutFilesEnabled()) {
- //
- // int result = statusMonitor.reportStatus( new
- // Status(IStatus.WARNING,WebServicePlugin.ID,0,
- // WebServicePlugin.getMessage("%MSG_ERROR_FILE_CHECKOUT_DISABLED",
- // new Object[] {parent.getFullPath().toString(),fileName}),null),
- // getThreeStateFileOptions());
- //
- // if (result == IStatusDialogConstants.CANCEL_ID)
- // return null;
- //
- // if ( result == IStatusDialogConstants.YES_TO_ALL_ID)
- // resourceContext.setCheckoutFilesEnabled(true);
- // }
- //
- // IFile[] files = new IFile[1];
- // files[0] = (IFile)child;
- //
- // if (
- // !statusMonitor.reportStatus(getWorkspace().validateEdit(files,null)))
- // return null;
- // }
- //
- // //Change the contents of the existing file.
- // IFile file = parent.getFile(new Path(fileName));
- // file.setContents(inputStream,true,true,progressMonitor);
- // return file;
- //
- // }
- // else
- // {
- // throw new CoreException(new
- // Status(IStatus.ERROR,WebServicePlugin.ID,0,WebServicePlugin.getMessage("%MSG_ERROR_RESOURCE_NOT_FILE",new
- // Object[] {parent.getFullPath().append(fileName)}),null));
- // }
- // }
- // else
- // {
- // //Create a new file.
- // IFile file = parent.getFile(new Path(fileName));
- // file.create(inputStream,true,progressMonitor);
- // return file;
- // }
- // }
-
- /**
- * Deletes a file under a container. The container must already exist.
- *
- * @param file -
- * the IFile to be deleted
- * @param progressMonitor
- * @param statusMonitor
- * @return True if the file does not exist or if it exists and is
- * successfully deleted. False otherwise.
- */
- // public static boolean deleteFile (
- // ResourceContext resourceContext,
- // IFile file,
- // IProgressMonitor progressMonitor,
- // StatusMonitor statusMonitor )
- // throws CoreException
- // {
- // if (file.exists())
- // {
- // if (!resourceContext.isOverwriteFilesEnabled()) {
- // int result = statusMonitor.reportStatus( new
- // Status(IStatus.WARNING,WebServicePlugin.ID,0,
- // WebServicePlugin.getMessage("%MSG_ERROR_FILE_OVERWRITE_DISABLED",
- // new Object[]
- // {file.getParent().getFullPath().toString(),file.getName()}),null),
- // getThreeStateFileOptions());
- //
- // if (result == IStatusDialogConstants.CANCEL_ID)
- // return false;
- //
- // if ( result == IStatusDialogConstants.YES_TO_ALL_ID)
- // resourceContext.setOverwriteFilesEnabled(true);
- // }
- // //We have permission to overwrite so check if file is read-only
- // if (file.isReadOnly())
- // {
- // if (!resourceContext.isCheckoutFilesEnabled()) {
- // int result = statusMonitor.reportStatus( new
- // Status(IStatus.WARNING,WebServicePlugin.ID,0,
- // WebServicePlugin.getMessage("%MSG_ERROR_FILE_CHECKOUT_DISABLED",
- // new Object[]
- // {file.getParent().getFullPath().toString(),file.getName()}),null),
- // getThreeStateFileOptions());
- // if (result == IStatusDialogConstants.CANCEL_ID)
- // return false;
- //
- // if ( result == IStatusDialogConstants.YES_TO_ALL_ID)
- // resourceContext.setCheckoutFilesEnabled(true);
- //
- // }
- // IFile[] files = new IFile[1];
- // files[0] = file;
- //
- // if (
- // !statusMonitor.reportStatus(getWorkspace().validateEdit(files,null)))
- // return false;
- // }
- // file.delete(true,progressMonitor);
- // }
- // //At this point, either the file did not exist or we successfully deleted
- // it. Return success.
- // return true;
- // }
- /**
- * Deletes a folder under a container.
- *
- * @param folder -
- * the IFolder to be deleted
- * @param progressMonitor
- * @param statusMonitor
- * @return True if the folder does not exist or if it exists and is
- * successfully deleted along with its members. False otherwise.
- */
- // public static boolean deleteFolder (
- // ResourceContext resourceContext,
- // IFolder folder,
- // IProgressMonitor progressMonitor,
- // StatusMonitor statusMonitor
- // )
- // throws CoreException
- // {
- // if (!folder.exists()) return true;
- //
- // boolean deleted = true;
- // IResource[] resources = folder.members();
- // for (int i=0; i<resources.length; i++)
- // {
- // IResource resource = resources[i];
- // if (resource instanceof IFile)
- // {
- // deleted = deleteFile(resourceContext, (IFile)resource, progressMonitor,
- // statusMonitor);
- // }
- // if (resource instanceof IFolder)
- // {
- // deleted = deleteFolder( resourceContext, (IFolder)resource,
- // progressMonitor, statusMonitor);
- // }
- //
- // if (!deleted) break;
- // }
- // if (deleted) {
- // folder.delete(true, true, progressMonitor);
- // return true;
- // }
- // else
- // return false;
- //
- // }
- /**
- * Deletes a set of files that are named in an index file located relative
- * to the plugin's installation location.
- *
- * @param plugin
- * The plugin containing the indexed file Must not be null.
- * @param sourcePath -
- * relative path of the indexed file passing a null in has the
- * same effect as passing a "." in
- * @param indexFilePath -
- * the indexed filename Must not be null
- * @param targetPath -
- * path containing the files named in the indexed file Must not
- * be null, this path must end with a trailing separator
- * @param progressMonitor
- */
- // public static void deleteIndexFilesFromOS (
- // Plugin plugin,
- // IPath indexFilePath,
- // IPath targetPath
- // )
- // throws IOException {
- // InputStream input = plugin.openStream(indexFilePath);
- // Enumeration filenames = StringUtils.parseFilenamesFromStream(input);
- // while (filenames.hasMoreElements()) {
- // File targetFile =
- // targetPath.append((String)filenames.nextElement()).toFile();
- // if (targetFile.exists())
- // targetFile.delete();
- // }
- // }
- /**
- * Returns a URI reference to the given Eclipse resource, or null if no such
- * reference can be determined (for example, if the resource does not exist
- * in the underlying filesystem).
- *
- * @param resource
- * The resource.
- * @return The URI as a string, or null if there is no URI to the resource.
- */
- public static String getResourceURI(IResource resource) {
- String uri = null;
- IPath location = resource.getLocation();
- if (location != null) {
- uri = "file:" + location.toString();
- }
- return uri;
- }
-
- /**
- * Returns a URI reference to the given Eclipse resource using the
- * "platform:" protocol, or null if no such reference can be determined (for
- * example, if the resource does not exist in the underlying filesystem).
- *
- * @param resource
- * The resource.
- * @return The URI as a string, or null if there is no URI to the resource.
- */
- public static String getPlatformResourceURI(IResource resource) {
- String uri = null;
- IPath location = resource.getFullPath();
- if (location != null) {
- uri = "platform:/resource" + location.toString();
- }
- return uri;
- }
-
- /**
- * Returns the default binding namespace string given a Java bean name
- * (using the convention used by CTC in GM). e.g. Java bean MyClass result
- * in binding namespace of
- * "http://www.myclass.com/definitions/MyClassRemoteInterface"
- *
- * @param beanName
- * The java bean.
- * @return The binding namespace as a string.
- */
- public static String getBindingNamespace(String beanName) {
- return "http://www." + beanName.toLowerCase() + ".com/definitions/"
- + beanName + "RemoteInterface";
- }
-
- /**
- * Returns the default schema namespace string given a Java bean name (using
- * the convention used by CTC in GM). e.g. Java bean MyClass result in
- * schema namespace of
- * "http://www.myclass.com/schemas/MyClassRemoteInterface"
- *
- * @param beanName
- * The java bean.
- * @return The schemas namespace as a string.
- */
- public static String getSchemaNamespace(String beanName) {
- return "http://www." + beanName.toLowerCase() + ".com/schemas/"
- + beanName + "RemoteInterface";
- }
-
- // public static Vector getThreeStateFileOptions() {
- // Vector options = new Vector();
- // options.add(new
- // StatusOption(IStatusDialogConstants.YES_ID,IStatusDialogConstants.YES_LABEL,"",""));
- // options.add(new
- // StatusOption(IStatusDialogConstants.YES_TO_ALL_ID,IStatusDialogConstants.YES_TO_ALL_LABEL,"",""));
- // options.add(new
- // StatusOption(IStatusDialogConstants.CANCEL_ID,IStatusDialogConstants.CANCEL_LABEL,"",""));
- // return options;
- // }
-
- //----------------------------------------------------------------------
-
- /**
- * Gets the SOAP rpcrouter servlet URL for the service project
- *
- * @param project
- * The project.
- * @param serverFactoryId
- * The server factory id
- * @param server
- * The server
- * @return The URL, possibly null.
- */
-
- public static String getServletURL(IProject project,
- String serverFactoryId, IServer server) {
- return getServletURL(getWebProjectURL(project, serverFactoryId, server));
- }
-
- public static String getServletURL(String webProjectURL) {
- if (webProjectURL == null)
- return null;
- else
- return webProjectURL + SERVLET_EXT;
- }
-
- /**
- * Gets the client Web project name
- *
- * @param projectName
- * The project name to base on.
- * @param typeId the webservice type id.
- * @return The client Web project name.
- *
- * @deprecated
- */
- public static String getClientWebProjectName(String projectName, String typeId)
- {
- String baseClientWebProjectName = projectName + DEFAULT_CLIENT_WEB_PROJECT_EXT;
- IPath projectPath;
- IProject project;
- boolean foundWebProject = false;
- int i = 1;
-
- if( isSkeletonEJBType( typeId ) )
- {
- // For the skeleton EJB scenario we need to create a slightly different
- // base name. When the EJB project is created another project
- // is created with "Client" tacked onto the end. We will
- // add "WS" to our client so we don't collide with the other
- // client project.
- baseClientWebProjectName = projectName + "WS" + DEFAULT_CLIENT_WEB_PROJECT_EXT;
- }
-
- String clientWebProjectName = baseClientWebProjectName;
-
- while (!foundWebProject)
- {
- projectPath = new Path(clientWebProjectName).makeAbsolute();
- project = ResourceUtils.getProjectOf(projectPath);
-
- if (project.exists() && !ResourceUtils.isWebProject(project))
- {
- clientWebProjectName = baseClientWebProjectName + i;
- i++;
- }
- else
- {
- foundWebProject = true;
- }
- }
-
- return clientWebProjectName;
- }
-
- public static String[] getClientProjectComponentName(String projectName, String componentName, boolean isEJB)
- {
- String clientProjectName = null;
- String clientComponentName = null;
- if (isEJB)
- {
- clientProjectName = projectName + DEFAULT_CLIENT_EJB_PROJECT_EXT;
- clientComponentName = componentName + DEFAULT_CLIENT_EJB_PROJECT_EXT;
- }
- else
- {
- clientProjectName = projectName + DEFAULT_CLIENT_WEB_PROJECT_EXT;
-// String baseName = clientProjectName;
- clientComponentName = componentName + DEFAULT_CLIENT_WEB_PROJECT_EXT;
-// String baseCompName = clientComponentName;
- }
-
- //TODO we may want to remove this if statement once defect 103366 is resolved.
- //TODO: Defect 107997 - Revisit prject and module creation logic
-// if( !FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp() )
-// {
-// clientComponentName = clientProjectName;
-// }
-
-// boolean foundWebProject = false;
-// int i = 1;
-//
-// while (!foundWebProject)
-// {
-// IPath projectPath = new Path(clientProjectName).makeAbsolute();
-// IProject project = ResourceUtils.getProjectOf(projectPath);
-//
-// if (project.exists())
-// {
-// clientProjectName = baseName + i;
-// clientComponentName = baseCompName + i;
-// i++;
-// }
-// else
-// {
-// foundWebProject = true;
-// }
-// }
-
- return new String[]{clientProjectName, clientComponentName};
- }
-
- /**
- *
- * @param typeID
- * @return
- *
- * @deprecated
- */
- public static boolean isSkeletonEJBType( String typeID )
- {
- return typeID.equals( "org.eclipse.jst.ws.type.wsdl.ejb" );
- }
-
- public static String getDefaultEJBProjectName() {
- return DEFAULT_EJB_PROJECT_NAME;
- }
-
- public static String getDefaultEJBComponentName() {
- return DEFAULT_EJB_COMPONENT_NAME;
- }
-
- public static String getDefaultWebProjectName() {
- return DEFAULT_WEB_PROJECT_NAME;
- }
-
- public static String getDefaultWebComponentName() {
- return DEFAULT_WEB_COMPONENT_NAME;
- }
-
- public static String getDefaultClientExtension() {
- return DEFAULT_CLIENT_WEB_PROJECT_EXT;
- }
-
- /**
- *
- * @param projectName
- * @return
- *
- */
- public static String getRouterProjectName(String projectName) {
- return projectName + DEFAULT_ROUTER_PROJECT_EXT;
- }
-
- public static String getDefaultServiceEARProjectName() {
- return DEFAULT_SERVICE_EAR_PROJECT_NAME;
- }
-
- public static String getDefaultServiceEARComponentName() {
- return DEFAULT_SERVICE_EAR_COMPONENT_NAME;
- }
-
- public static String getDefaultClientEARProjectName() {
- return DEFAULT_CLIENT_EAR_PROJECT_NAME;
- }
-
- public static String getDefaultClientEARComponentName() {
- return DEFAULT_CLIENT_EAR_COMPONENT_NAME;
- }
-
- public static String getDefaultEARExtension() {
- return DEFAULT_EAR_EXT;
- }
-}
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/SelectionToResource.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/SelectionToResource.java
deleted file mode 100644
index 7c77dabbc..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/SelectionToResource.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-
-public class SelectionToResource implements Transformer
-{
- /* (non-Javadoc)
- * @see org.eclipse.wst.command.internal.env.core.data.Transformer#transform(java.lang.Object)
- */
- public Object transform(Object value)
- {
- IStructuredSelection selection = (IStructuredSelection)value;
- IResource resource = null;
-
- if( selection != null )
- {
- Object object = selection.getFirstElement();
-
- if( object != null )
- {
- if( object instanceof IResource)
- {
- resource = (IResource)object;
- }
- else if( object instanceof ICompilationUnit )
- {
- ICompilationUnit compUnit = (ICompilationUnit)object;
-
- try
- {
- resource = compUnit.getCorrespondingResource();
- }
- catch( JavaModelException exc)
- {
- }
- }
- else if( object instanceof EnterpriseBean )
- {
- EnterpriseBean ejbBean = (EnterpriseBean)object;
- IProject ejbProject = ProjectUtilities.getProject( ejbBean );
-
- if( ejbProject != null )
- {
- resource = ejbProject;
- }
- }
- }
- }
-
- return resource;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
deleted file mode 100644
index 4c1b8dc52..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
+++ /dev/null
@@ -1,788 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
- * 20060330 124667 kathy@ca.ibm.com - Kathy Chan
- * 20061004 159356 kathy@ca.ibm.com - Kathy Chan, Get correct module root URL based on server chosen
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.common;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.environment.IEnvironment;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.model.IURLProvider;
-
-/**
- * This class contains useful methods for working with Server plugin functions
- */
-public final class ServerUtils {
-
- private Hashtable serverIdToLabel_;
-
- private Hashtable serverLabelToId_;
-
- private static ServerUtils instance_;
-
- public static ServerUtils getInstance() {
- if (instance_ == null) {
- instance_ = new ServerUtils();
- }
- return instance_;
-
- }
-
- public ServerUtils() {
- }
-
- // Gets the Server labels given the server factory id
- public void getServerLabelsAndIds() {
- serverIdToLabel_ = new Hashtable();
- serverLabelToId_ = new Hashtable();
- IServerType[] serverTypes = ServerCore.getServerTypes();
- for (int idx = 0; idx < serverTypes.length; idx++) {
-
- IServerType serverType = (IServerType) serverTypes[idx];
-
- String id = serverType.getId();
- String serverLabel = serverType.getName();
- if (!(id == null) && !(serverLabel == null)) {
- serverIdToLabel_.put(id, serverLabel);
- serverLabelToId_.put(serverLabel, id);
- }
- }
- }
-
- public String getServerLabelForId(String factoryId) {
- if (serverIdToLabel_ == null)
- this.getServerLabelsAndIds();
- return (String) serverIdToLabel_.get(factoryId);
- }
-
- public String getServerIdForLabel(String factoryLabel) {
- if (serverLabelToId_ == null)
- this.getServerLabelsAndIds();
- return (String) serverLabelToId_.get(factoryLabel);
- }
-
- public IStatus modifyModules(IEnvironment env, IServer server,
- IModule module, boolean add, IProgressMonitor monitor) {
-
- IServerWorkingCopy wc = null;
- IStatus status = Status.OK_STATUS;
-
- try {
-
- if (module == null || !module.getProject().exists()) {
- return status;
- }
-
- // check if module is a true Java project
- if (module instanceof IModule) {
- IModule pm = (IModule) module;
- if (pm != null) {
- IProject project = pm.getProject();
- if (project == null
- || ResourceUtils.isTrueJavaProject(project)) {
- return status;
- }
- }
- }
-
- wc = server.createWorkingCopy();
- if (wc != null) {
-// Object x = server.getAdapter(IRunningActionServer.class);
-// if (x != null && x instanceof IRunningActionServer) {
-// int state = server.getServerState();
-// if (state == IServer.STATE_STOPPED
-// || state == IServer.STATE_UNKNOWN) {
-// String mode = ILaunchManager.RUN_MODE;
-// server.synchronousStart(mode, monitor);
-// }
-// }
-
- List list = Arrays.asList(server.getModules());
- if (add) {
- if (!list.contains(module)) {
- ServerUtil.modifyModules(wc, new IModule[] { module },
- new IModule[0], monitor);
- }
- } else { // removes module
- if (list.contains(module)) {
- ServerUtil.modifyModules(wc, new IModule[0],
- new IModule[] { module }, monitor);
- }
- }
- } else {
- // handle case of Null WC; non-issue for now
- }
- }
- catch (CoreException exc )
- {
- status = StatusUtils.errorStatus( WSPluginMessages.MSG_ERROR_SERVER, exc );
- env.getStatusHandler().reportError(status);
- return status;
- } finally {
- if (wc != null) {
- // Always saveAll and release the serverWorkingCopy
- try
- {
- wc.saveAll(true, monitor);
- }
- catch (CoreException exc )
- {
- status = StatusUtils.errorStatus( WSPluginMessages.MSG_ERROR_SERVER, exc );
- env.getStatusHandler().reportError(status);
- return status;
- }
- }
- }
- return status;
- }
-
- public static IServer getServerForModule(IModule module, String serverTypeId,
- IServer server, boolean create, IProgressMonitor monitor) {
- if (server != null)
- return server;
- else
- return getServerForModule(module, serverTypeId, create, monitor);
- }
-
- public static IServer getServerForModule(IModule module,
- String serverTypeId, boolean create, IProgressMonitor monitor) {
- try {
-
- IServer[] servers = ServerUtil.getServersByModule(module, monitor);
-
- if (servers != null && servers.length > 0) {
- if (serverTypeId == null || serverTypeId.length() == 0)
- return servers[0]; // WSAD v4 behavior
-
- for (int i = 0; i < servers.length; i++) {
- if (servers[i].getServerType().getId().equalsIgnoreCase(
- serverTypeId))
- return servers[i];
- }
- }
-
- return createServer(module, serverTypeId, monitor);
-
- } catch (Exception e) {
- return null;
- }
- }
-
- public static IServer getServerForModule(IModule module) {
- try {
- IServer[] servers = ServerUtil.getServersByModule(module, null);
- return ((servers != null && servers.length > 0) ? servers[0] : null);
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- *
- * @param env
- * @param module
- * @param serverTypeId
- * @param monitor
- * @return
- *
- * @deprecated
- */
- public IServer createServer(IEnvironment env, IModule module,
- String serverTypeId, IProgressMonitor monitor) {
- IServerWorkingCopy serverWC = null;
- IServer server = null;
- try {
- IServerType serverType = ServerCore.findServerType(serverTypeId);
- serverWC = serverType.createServer(serverTypeId, null, monitor);
- try {
- if (serverWC != null) {
- server = serverWC.saveAll(true, monitor);
- }
- } catch (CoreException ce)
- {
- IStatus status = StatusUtils.errorStatus( WSPluginMessages.MSG_ERROR_SERVER, ce);
- env.getStatusHandler().reportError(status);
- return null;
- }
-
- if (server != null) {
-
-// Object x = server.getAdapter(IRunningActionServer.class);
-// if (x != null && x instanceof IRunningActionServer) {
-// int state = server.getServerState();
-// if (state == IServer.STATE_STOPPED
-// || state == IServer.STATE_UNKNOWN) {
-// String mode = ILaunchManager.RUN_MODE;
-// server.synchronousStart(mode, monitor);
-// }
-// }
-
- if (module != null && module.getProject().exists()) {
- IModule[] parentModules = server.getRootModules(module,
- monitor);
- if (parentModules != null && parentModules.length != 0) {
- module = (IModule) parentModules[0];
- }
- serverWC.modifyModules(new IModule[] { module },
- new IModule[0], monitor);
- }
-
- }
-
- return server;
- }
- catch (Exception e)
- {
- IStatus status = StatusUtils.errorStatus( WSPluginMessages.MSG_ERROR_SERVER, e);
- env.getStatusHandler().reportError(status);
- return null;
- } finally {
- try {
- if (serverWC != null) {
- serverWC.saveAll(true, monitor);
- }
- } catch (CoreException ce) {
- IStatus status = StatusUtils.errorStatus( WSPluginMessages.MSG_ERROR_SERVER, ce);
- env.getStatusHandler().reportError(status);
- return null;
- }
- }
- }
-
- /**
- * createServer This creates a server but does not report errors. @param
- * module
- * @param serverTypeId
- * @param monitor progress monitor
- * @return IServer returns null if unsuccessful
- *
- * @deprecated
- */
- public static IServer createServer(IModule module, String serverTypeId,
- IProgressMonitor monitor) {
- IServerWorkingCopy serverWC = null;
- IServer server = null;
- try {
- IServerType serverType = ServerCore.findServerType(serverTypeId);
- serverWC = serverType.createServer(serverTypeId, null, monitor);
-
- try {
- if (serverWC != null) {
- server = serverWC.saveAll(true, monitor);
- }
- } catch (CoreException ce) {
- return null;
- }
-
- if (server != null) {
-
-// Object x = server.getAdapter(IRunningActionServer.class);
-// if (x != null && x instanceof IRunningActionServer) {
-// int state = server.getServerState();
-// if (state == IServer.STATE_STOPPED
-// || state == IServer.STATE_UNKNOWN) {
-// String mode = ILaunchManager.RUN_MODE;
-// server.synchronousStart(mode, monitor);
-// }
-// }
- if (module != null) {
- IModule[] parentModules = server.getRootModules(module,
- monitor);
- if (parentModules != null && parentModules.length != 0) {
- module = (IModule) parentModules[0];
- }
- serverWC.modifyModules(new IModule[] { module },
- new IModule[0], monitor);
- }
-
- }
-
- return server;
- } catch (Exception e) {
- return null;
- } finally {
- try {
- if (serverWC != null) {
- serverWC.saveAll(true, monitor);
- }
- } catch (CoreException ce) {
- return null;
- // handler core exception
- }
- }
- }
-
- public static String[] getServerTypeIdsByModule(IVirtualComponent component) {
- IProject project = component.getProject();
- String[] serverIds = null;
-
- if (project != null) {
- IServer[] servers = ServerUtil.getServersByModule(getModule(project), null);
- if (servers != null) {
- serverIds = new String[servers.length];
-
- for (int index = 0; index < servers.length; index++) {
- serverIds[index] = servers[index].getId();
-
- }
- }
- }
-
- if (serverIds == null) {
- serverIds = new String[0];
- }
-
- return serverIds;
- }
-
- /**
- * @param project
- * @return
- * @deprecated should be using getServerTypeIdsByModule( IVirtualComponent )
- */
- public static String[] getServerTypeIdsByModule(IProject project) {
- Vector serverIds = new Vector();
- if (project != null) {
- IServer[] servers = ServerUtil.getServersByModule(ResourceUtils
- .getModule(project), null);
- if (servers != null && servers.length > 0) {
- for (int i = 0; i < servers.length; i++) {
- serverIds.add(servers[i].getId());
- }
- }
- }
- return (String[]) serverIds.toArray(new String[serverIds.size()]);
- }
-
- public static IModule getModule(IProject project) {
- return ServerUtil.getModule(project);
-}
-
-// Workaround for 113621
-//public static IModule getModule(IProject project) {
-// IModule[] modules = ServerUtil.getModules(project);
-// if (modules!=null && modules.length!=0) {
-// return modules[0];
-// }
-// return null;
-//}
-
- /**
- * Returns the URL string corresponding to the web server module root of the
- * component based on a server factory ID or null if the project has no Web nature
- * or the module root cannot be determined (e.g. For some types of
- * servers, we would not be able to get module root URL if the server has not been started).
- * Note that we are not relying on which server the module is currently associated with to determine
- * the correct module server root because the project might be associated with a server but we need the
- * module root based on another server factory ID.
- *
- * @param project
- * The project.
- * @param serverFactoryId server factory ID
- * @return The web server module root URL or null
- */
- public static String getWebComponentURL(IProject project, String serverFactoryId) {
- String webProjectURL = null;
- IModule module = getModule(project);
- if (module != null) {
- IServerType serverType = ServerCore.findServerType(serverFactoryId);
- if (serverType!=null)
- {
- try {
- //Choose a Runtime which is not a stub
- IRuntime nonStubRuntime = null;
- IRuntime[] runtimes = ServerUtil.getRuntimes(null, null);
- String serverRuntimeTypeId = serverType.getRuntimeType().getId();
- for (int i = 0; i < runtimes.length; i++) {
- IRuntime runtime = runtimes[i];
- String thisRuntimeTypeId = runtime.getRuntimeType().getId();
- if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) {
- //Found an appropriate IRuntime that is not a stub
- nonStubRuntime = runtime;
- break;
- }
- }
-
- if (nonStubRuntime != null)
- {
- IServerWorkingCopy serverWC = serverType.createServer(null, null, nonStubRuntime, null);
- IURLProvider urlProvider = (IURLProvider) serverWC.loadAdapter(IURLProvider.class, null);
- if (urlProvider!=null) {
- URL url = urlProvider.getModuleRootURL(module);
- if (url != null) {
- String s = url.toString();
- webProjectURL = (s.endsWith("/") ? s.substring(0, s.length() - 1) : s);
- }
- }
- }
-
- } catch(CoreException ce){
- Logger.getLogger().log(ce);
- }
-
- }
- }
- return webProjectURL;
- }
-
- /**
- * Returns the URL string corresponding to the web server module root of the
- * component based on a server factory ID and server. Returns null if the project has no Web nature
- * or the module root cannot be determined (e.g. For some types of
- * servers, we would not be able to get module root URL if the server has not been started).
- * Note that we are not relying on which server the module is currently associated with to determine
- * the correct module server root because the project might be associated with a server but we need the
- * module root based on another server / server factory ID.
- *
- * @param project
- * The project.
- * @param serverFactoryId server factory ID
- * @param server Server id
- * @return The web server module root URL or null
- */
- public static String getWebComponentURL(IProject project,
- String serverFactoryId, IServer server) {
-
- String webProjectURL = null;
- IModule module = getModule(project);
- if (module != null) {
- if (server != null) {
- IURLProvider urlProvider = (IURLProvider) server.loadAdapter(IURLProvider.class, null);
- if (urlProvider!=null) {
- URL url = urlProvider.getModuleRootURL(module);
- if (url != null) {
- String s = url.toString();
- webProjectURL = (s.endsWith("/") ? s.substring(0, s.length() - 1) : s);
- }
- }
- } else {
- webProjectURL = getWebComponentURL(project, serverFactoryId);
- }
- }
- return webProjectURL;
- }
-
- public static String getEncodedWebComponentURL(IProject project, String serverFactoryId) {
- String url = getWebComponentURL(project, serverFactoryId);
- return encodeURL(url);
- }
-
- public static String getEncodedWebComponentURL(IProject project, String serverFactoryId, IServer server) {
- String url = getWebComponentURL(project, serverFactoryId, server);
- return encodeURL(url);
- }
-
- public static String encodeURL(String url) {
- if (url != null) {
- int index = url.lastIndexOf('/');
- if (index != -1) {
- StringBuffer encodedURL = new StringBuffer();
- encodedURL.append(url.substring(0, index + 1));
- try {
- String ctxtRoot = URLEncoder.encode(url.substring(index + 1, url.length()), "UTF-8");
- int plusIndex = ctxtRoot.indexOf('+');
- while (plusIndex != -1) {
- StringBuffer sb = new StringBuffer();
- sb.append(ctxtRoot.substring(0, plusIndex));
- sb.append("%20");
- sb.append(ctxtRoot.substring(plusIndex + 1, ctxtRoot
- .length()));
- ctxtRoot = sb.toString();
- plusIndex = ctxtRoot.indexOf('+');
- }
- encodedURL.append(ctxtRoot);
- }catch (IOException io){
- //handler exception
- }
- url = encodedURL.toString();
- }
- }
- return url;
- }
-
- public static IServer getDefaultExistingServer(IVirtualComponent component) {
- IProject project = component.getProject();
- IModule module = getModule(project);
- IServer preferredServer = ServerCore.getDefaultServer(module);
- if (preferredServer != null)
- return preferredServer;
-
- IServer[] configuredServers = ServerUtil.getServersByModule(module,
- null);
-
- if (configuredServers != null && configuredServers.length > 0) {
- preferredServer = configuredServers[0];
- } else {
- IServer[] nonConfiguredServers = ServerUtil
- .getAvailableServersForModule(module, false, null);
-
- if (nonConfiguredServers != null
- && nonConfiguredServers.length > 0) {
- preferredServer = nonConfiguredServers[0];
- }
- }
-
- return preferredServer;
- }
-
- /**
- * @param project
- * @return
- * @deprecated should be using getDefaultExistingServer( IVirtualComponent )
- */
- public static IServer getDefaultExistingServer(IProject project) {
-
- IModule module = ServerUtil.getModule(project);
- IServer preferredServer = null;
- preferredServer = ServerCore.getDefaultServer(module);
-
-// Workaround for 113621
-// IModule[] modules = ServerUtil.getModules(project);
-// IServer preferredServer = null;
-// if (modules.length > 0){
-// preferredServer = ServerCore.getDefaultServer(modules[0]);
-// }
-
- if (preferredServer != null)
- return preferredServer;
-
- IServer[] configuredServers = ServerUtil.getServersByModule(
- ResourceUtils.getModule(project), null);
- if (configuredServers != null && configuredServers.length > 0) {
- return configuredServers[0];
- }
-
- IServer[] nonConfiguredServers = ServerUtil
- .getAvailableServersForModule(ResourceUtils.getModule(project),
- false, null);
- if (nonConfiguredServers != null && nonConfiguredServers.length > 0) {
- return nonConfiguredServers[0];
- }
- return null;
- }
-
- /*
- * @param moduleType - ad defined in IServerTargetConstants (i.e. EAR_TYPE,
- * WEB_TYPE, etc.) @param j2eeVersion String representation of the int
- * values in J2EEVersionConstants i.e. "12" or "13" or "14" @return String
- * the id of the server target - to be used in project creation operations.
- */
- public static String getServerTargetIdFromFactoryId(String serverFactoryId,
- String moduleType, String j2eeVersion) {
- IServerType serverType = ServerCore.findServerType(serverFactoryId);
- if (serverType == null)
- return null;
-
- String serverRuntimeTypeId = serverType.getRuntimeType().getId();
-
- String stJ2EEVersion = ServerUtils.getServerTargetJ2EEVersion(j2eeVersion);
- List runtimes = Arrays.asList(ServerUtil.getRuntimes(moduleType, stJ2EEVersion));
- for (int i = 0; i < runtimes.size(); i++) {
- IRuntime runtime = (IRuntime) runtimes.get(i);
- String thisRuntimeTypeId = runtime.getRuntimeType().getId();
- if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) {
- return runtime.getId();
- }
- }
-
- return null;
- }
-
- /*
- * @param serverFactoryId the server's factory id @returns the runtime type
- * id given the server's factory id. Returns a blank String if the no
- * ServerType exists for the given factory id.
- */
- public static String getRuntimeTargetIdFromFactoryId(String serverFactoryId) {
- IServerType serverType = ServerCore.findServerType(serverFactoryId);
- if (serverType != null) {
- String serverRuntimeId = serverType.getRuntimeType().getId();
- return serverRuntimeId;
- } else
- return "";
- }
-
- public static String getFactoryIdFromRuntimeTargetId(String runtimeTargetId){
- IServerType[] serverTypes = ServerCore.getServerTypes();
- for (int i=0;i<serverTypes.length;i++) {
- IRuntimeType runtimeTyp = serverTypes[i].getRuntimeType();
- if (runtimeTyp!=null){
- if (runtimeTyp.getId().equals(runtimeTargetId))
- return serverTypes[i].getId();
- }
- }
- return "";
-
- }
-
-
- /*
- * @param serverFactoryId the server's factory id @returns the server type
- * id given the server's factory id. Returns a blank String if the no
- * ServerType exists for the given factory id.
- */
- public static String getServerTypeIdFromFactoryId(String serverFactoryId) {
- IServerType serverType = ServerCore.findServerType(serverFactoryId);
- if (serverType != null) {
- String serverTypeId = serverType.getId();
- return serverTypeId;
- } else
- return "";
- }
-
- /*
- * @param j2eeVersion String representation of the int values in
- * J2EEVersionConstants i.e. "12" or "13" or "14"
- */
- public static boolean isTargetValidForEAR(String runtimeTargetId,
- String j2eeVersion) {
- if (runtimeTargetId == null)
- return false;
-
- String earModuleType = IModuleConstants.JST_EAR_MODULE;
- String stJ2EEVersion = ServerUtils.getServerTargetJ2EEVersion(j2eeVersion);
- List runtimes = Arrays.asList(ServerUtil.getRuntimes(earModuleType, stJ2EEVersion));
- for (int i = 0; i < runtimes.size(); i++) {
- IRuntime runtime = (IRuntime) runtimes.get(i);
- String thisId = runtime.getRuntimeType().getId();
- if (thisId.equals(runtimeTargetId))
- return true;
- }
-
- return false;
- }
-
- /*
- * @param j2eeVersion String representation of the int values in
- * J2EEVersionConstants i.e. "12" or "13" or "14" @param the project type
- * from IServerTargetConstants
- */
- public static boolean isTargetValidForProjectType(String runtimeTargetId,
- String j2eeVersion, String projectType) {
- if (runtimeTargetId == null)
- return false;
-
- if (projectType == null || projectType.length() == 0)
- return false;
-
- String stJ2EEVersion = ServerUtils.getServerTargetJ2EEVersion(j2eeVersion);
- List runtimes = Arrays.asList(ServerUtil.getRuntimes(projectType, stJ2EEVersion));
- for (int i = 0; i < runtimes.size(); i++) {
- IRuntime runtime = (IRuntime) runtimes.get(i);
- String thisId = runtime.getRuntimeType().getId();
- if (thisId.equals(runtimeTargetId))
- return true;
- }
-
- return false;
- }
-
- public static String getServerTargetJ2EEVersion(String j2eeVersion) {
-
- if (j2eeVersion == null || j2eeVersion.length() == 0)
- return null;
-
- int j2eeVersionInt = Integer.parseInt(j2eeVersion);
- switch (j2eeVersionInt) {
- case (J2EEVersionConstants.J2EE_1_2_ID):
- return IServerTargetConstants.J2EE_12;
- case (J2EEVersionConstants.J2EE_1_3_ID):
- return IServerTargetConstants.J2EE_13;
- case (J2EEVersionConstants.J2EE_1_4_ID):
- return IServerTargetConstants.J2EE_14;
- default:
- return null;
- }
- }
-
- //Converts a module type from J2EEUtils to a module type like
- //the one in IServerTargetConstants.
- public static String getServerTargetModuleType(int moduleType)
- {
- switch (moduleType)
- {
- case J2EEUtils.WEB :
- return IServerTargetConstants.WEB_TYPE;
- case J2EEUtils.EJB :
- return IServerTargetConstants.EJB_TYPE;
- case J2EEUtils.APPCLIENT :
- return IServerTargetConstants.APP_CLIENT_TYPE;
- case J2EEUtils.EAR :
- return IServerTargetConstants.EAR_TYPE;
- default:
- return null;
-
- }
- }
-
- /*
- * Returns a non-stub runtime if one is available for the the given server type.
- * @param serverFactoryId - server type id
- * @returns IRuntime Returns a non-stub runtime if one is available for the the given server type.
- * Returns null otherwise.
- */
- public static IRuntime getNonStubRuntime(String serverFactoryId)
- {
- //Find a Runtime which is not a stub
- IServerType serverType = ServerCore.findServerType(serverFactoryId);
- IRuntime nonStubRuntime = null;
- if (serverType != null)
- {
- //boolean foundNonStubRuntime = false;
- IRuntime[] runtimes = ServerUtil.getRuntimes(null, null);
- String serverRuntimeTypeId = serverType.getRuntimeType().getId();
- for (int i = 0; i < runtimes.length; i++)
- {
- IRuntime runtime = runtimes[i];
- String thisRuntimeTypeId = runtime.getRuntimeType().getId();
- if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub())
- {
- // Found an appropriate IRuntime that is not a stub
- //foundNonStubRuntime = true;
- nonStubRuntime = runtime;
- break;
- }
- }
- }
-
- return nonStubRuntime;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StatusObjectHandler.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StatusObjectHandler.java
deleted file mode 100644
index 1111d76c7..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StatusObjectHandler.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.common;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
-
-
-public class StatusObjectHandler
-{
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
- private static final int MAX_DETAILS = 16;
-
- public static IStatus generateTreeStatus (IStatus status)
- {
- //
- // There could be lots of Throwables, CoreExceptions,
- // WrappedExceptions and IStatus objects beneath the
- // given status. Find them.
- //
- LinkedList statusList = new LinkedList();
- appendStatus(MAX_DETAILS, statusList, status, status.getSeverity());
- if (statusList.size() > 0)
- {
- IStatus newStatus = (IStatus)statusList.removeFirst();
- if (statusList.size() > 0)
- {
- IStatus[] secondaryStatusArray = new IStatus[statusList.size()];
- int n = 0;
- Iterator i = statusList.iterator();
- while (i.hasNext())
- {
- secondaryStatusArray[n++] = (IStatus)i.next();
- }
- newStatus = new MultiStatus(status.getPlugin(),status.getCode(),secondaryStatusArray,status.getMessage(),status.getException());
- }
- return newStatus;
- }
- else
- return null;
- }
-
- //
- // Appends zero or more IStatus objects to the list of IStatus objects
- // based upon an IStatus.
- //
- private static int appendStatus ( int max, List statusList, IStatus status, int severity )
- {
- if (max > 0 && status != null)
- {
- //
- // Append an IStatus object for the given status' message.
- //
- if (status.getMessage() != null)
- {
- max = append(statusList,max,severity,status.getPlugin(),status.getCode(),status.getMessage(),status.getException());
- }
- //
- // Append the IStatus' Throwable, if any.
- //
- max = appendThrowable(max,statusList,status.getException(),severity);
- //
- // If the IStatus is a multi status, append the children.
- //
- IStatus[] children = status.getChildren();
- for (int i=0; i<children.length && max>0; i++)
- {
- max = appendStatus(max,statusList,children[i],severity);
- }
- }
- return max;
- }
-
- //
- // Appends zero or more IStatus objects to the list of IStatus objects
- // based upon a Throwable. WrappedExceptions and CoreExceptions are
- // given special treatment.
- //
- private static int appendThrowable ( int max, List statusList, Throwable throwable, int severity )
- {
- if (max > 0 && throwable != null)
- {
- //
- // Append an IStatus object for the exception's message.
- //
- if (throwable.getLocalizedMessage() != null)
- {
- max = append(statusList,max,severity,WebServicePlugin.ID,0,throwable.getLocalizedMessage(),throwable);
- }
- //
- // If the exception is a WrappedException, append the wrapped Exception.
- //
- if (throwable instanceof WrappedException)
- {
- WrappedException wexc = (WrappedException)throwable;
- max = appendThrowable(max,statusList,wexc.exception(),severity);
- }
- //
- // If the exception is a CoreException, append the enclosed IStatus.
- //
- if (throwable instanceof CoreException)
- {
- CoreException cexc = (CoreException)throwable;
- max = appendStatus(max,statusList,cexc.getStatus(),severity);
- }
- }
- return max;
- }
-
- //
- // Creates and appends an IStatus to the list of IStatus objects.
- //
- private static int append ( List statusList, int max, int severity, String id, int code, String message, Throwable throwable )
- {
- if (max > 0)
- {
- IStatus status = new Status(severity,id,code,message,throwable);
- statusList.add(status);
- max--;
- }
- return max;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java
deleted file mode 100644
index da7e1da65..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-
-/**
- *
- * Transforms a input String to a Path
- *
- * @author joan
- *
- */
-
-public class String2PathTransformer implements Transformer {
-
- public Object transform(Object value) {
- Path path = new Path(value.toString());
- return path;
- }
-
-}
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java
deleted file mode 100644
index f2351b0f9..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060222 128094 joan@ca.ibm.com - Joan Haggarty
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.ejb.EJBResource;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.wst.command.internal.env.common.FileResourceUtils;
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-/**
- * Transforms a string value representing a workspace resource path into a StructuredSelection object
- *
- * @author joan
- *
- */
-
-public class String2SelectionTransformer implements Transformer {
-
- public Object transform(Object value) {
-
- StructuredSelection selection = null;
- IResource resource = FileResourceUtils.getWorkspaceRoot().findMember(new Path(value.toString()));
- if (resource != null)
- {
- IProject resProject = resource.getProject();
- // check if resource is part of an EJB
- if (J2EEUtils.isEJBComponent(resProject))
- {
- // if resource is part of EJB need to get the EnterpriseBean as the selection
- IVirtualComponent[] ejbComponents = J2EEUtils.getEJBComponents(resProject);
- EJBArtifactEdit ejbEdit = null;
- try{
- ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(ejbComponents[0]);
- EJBResource ejbRes = ejbEdit.getEJBJarXmiResource();
- EJBJar ejbJar = ejbRes.getEJBJar();
- IPath path = resource.getFullPath();
- String resourcePath = ResourceUtils.getJavaResourcePackageName(path);
- String javaClassName = resource.getName();
- // strip off file extension if necessary
- if (javaClassName.lastIndexOf('.')>-1)
- {
- javaClassName = javaClassName.substring(0, javaClassName.lastIndexOf('.'));
- }
- JavaClass javaClass = JavaMOFUtils.getJavaClass(resourcePath, javaClassName, resProject);
- EnterpriseBean ejb = ejbJar.getEnterpriseBeanWithReference(javaClass);
- if (ejb != null)
- {
- selection = new StructuredSelection(ejb.getName());
- }
- }
- catch (Exception exc)
- {
-
- }
- finally {
- if (ejbEdit!=null)
- ejbEdit.dispose();
- }
- }
- // if selection not already set - create it from the resource object
- if (selection == null)
- {
- selection = new StructuredSelection(resource);
- }
- }
- else
- {
- // string doesn't return resource - error condition
- throw new IllegalArgumentException(WSPluginMessages.ERROR_SELECTION_TRANSFORM);
- }
- return selection;
- }
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TestFacilityListTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TestFacilityListTransformer.java
deleted file mode 100644
index b8596054b..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TestFacilityListTransformer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-import org.eclipse.wst.command.internal.env.core.selection.SelectionList;
-
-public class String2TestFacilityListTransformer implements Transformer {
-
- public Object transform(Object value) {
- String testFacility = (String)value;
- //value represents name of a test facility
- //pick up list of test facilities
- String[] testTypes = WebServicePlugin.getInstance().getScenarioContext().getWebServiceTestTypes();
-
- int index = 0;
- //match value to name of test facility and set index accordingly
- for (int i = 0; i < testTypes.length; i++) {
- if (testTypes[i].equals(testFacility))
- {
- break;
- }
- index++;
- }
-
- SelectionList selectionList = new SelectionList(testTypes, index);
- return selectionList;
- }
-}
-
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TypeRuntimeServerModifier.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TypeRuntimeServerModifier.java
deleted file mode 100644
index 8f4fcf20c..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TypeRuntimeServerModifier.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060303 128832 joan@ca.ibm.com - Joan Haggarty
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import java.util.Map;
-
-import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
-import org.eclipse.wst.command.internal.env.core.data.BeanModifier;
-
-public class String2TypeRuntimeServerModifier implements BeanModifier {
-
- private String SERVICE_RT_ID_KEY = "Service.RuntimeId"; //$NON-NLS-N$
- private String RUNTIME_ID = "RuntimeId"; //$NON-NLS-N$
- private String SERVICE_SRV_ID_KEY = "Service.ServerId"; //$NON-NLS-N$
- private String SERVER_ID = "ServerId"; //$NON-NLS-N$
- private String TYPE_ID = "TypeId"; //$NON-NLS-N$
- private String TD_EJB = "TOP DOWN EJB"; //$NON-NLS-N$
- private String BU_EJB = "BOTTOM UP EJB"; //$NON-NLS-N$
- private String TD_EJB_TYPE_ID = "1/org.eclipse.jst.ws.wsImpl.ejb";
- private String BU_EJB_TYPE_ID = "0/org.eclipse.jst.ws.wsImpl.ejb";
- private String SERVICE_PREFIX = "Service."; //$NON-NLS-N$
- private String CLIENT_PREFIX = "Client."; //$NON-NLS-N$
-
- /**
- * Modifies the supplied TypeRuntimeServer bean with properties in holder.
- * If the bean is null, construct a new one and set its properties.
- * @param bean TypeRuntimeServer bean to be modified
- * @param holder Map containing values for TypeRuntimeServer properties
- * @return TypeRuntimeServer with properties set
- */
- public void modify(Object bean, Object holder) {
-
- TypeRuntimeServer types = null;
- if (bean == null || !(bean instanceof TypeRuntimeServer))
- {
- types = new TypeRuntimeServer();
- }
- else
- {
- types = (TypeRuntimeServer)bean;
- }
-
- if (holder instanceof Map)
- {
- Map typesMap = (Map)holder;
- String prefix = "";
-
-
- if (typesMap.containsKey(SERVICE_RT_ID_KEY)||typesMap.containsKey(SERVICE_SRV_ID_KEY))
- {
- prefix = SERVICE_PREFIX;
- }
- else
- {
- prefix = CLIENT_PREFIX;
- }
-
- String runtimeID = (String)typesMap.get(prefix+RUNTIME_ID);
- if (runtimeID != null)
- types.setRuntimeId(runtimeID);
-
- String serverID = (String)typesMap.get(prefix+SERVER_ID);
- if (serverID != null)
- types.setServerId(serverID);
-
- //check if web service type is EJB - if not, default for Java bean types
- String typeID = (String)typesMap.get(prefix+TYPE_ID);
- if (typeID != null)
- {
- if (typeID.toUpperCase().equals(TD_EJB)) //only setting typeID specifically for EJB case
- {
- types.setTypeId(TD_EJB_TYPE_ID);
- }
- else if (typeID.toUpperCase().equals(BU_EJB))
- {
- types.setTypeId(BU_EJB_TYPE_ID);
- }
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringToIProjectTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringToIProjectTransformer.java
deleted file mode 100644
index 92efc3b17..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringToIProjectTransformer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-
-
-/**
- * Transfroms a java.lang.String to an org.eclipse.core.runtime.IProject
- */
-public class StringToIProjectTransformer implements Transformer
-{
- /* (non-Javadoc)
- * @see org.eclipse.wst.command.internal.env.core.data.Transformer#transform(java.lang.Object)
- * @param Object This must be a java.lang.String
- * @return Object Returns an IProject
- */
-
- public Object transform(Object value)
- {
- String project = (String)value;
- int slashIndex = project.indexOf( '/' );
- String projectName = project;
-
- if( slashIndex != -1 )
- {
- projectName = project.substring( 0, slashIndex );
- }
-
- return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringUtils.java
deleted file mode 100644
index 0c4bd2dc9..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/StringUtils.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.common;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.Vector;
-import org.eclipse.jdt.core.JavaConventions;
-
-/**
- * This class contains some useful string utilities that are not provided by
- * either String or StringBuffer.
- *
- * @author Peter Moogk
- * @date July 13, 2000
-**/
-public final class StringUtils
-{
-
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- /**
- * The platform-specific line separator.
- */
- public static final String NEWLINE = System.getProperty("line.separator");
-
- private StringUtils(){};
-
- /**
- * This method splits a single line of text into multiple lines
- * based on a maximum line length. The method will try to fit as
- * many words as possible onto a line without exceeding the maximum
- * line length. Note: the only case where a line might exceed the
- * maximum is if a single word is longer than the maximum.
- **/
- public static String[] splitter( String text, int max_length )
- {
- Vector return_text = new Vector(20);
- String[] return_str;
- int index = 0;
-
- while( index < text.length() )
- {
- String str = text.substring( index, Math.min( max_length + index,
- text.length() ) );
- int space_index = str.lastIndexOf( " " );
-
- if( index + str.length() < text.length() &&
- text.charAt( index + str.length() - 1 ) != ' ' &&
- text.charAt( index + str.length() ) != ' ' &&
- space_index != -1 )
- {
- return_text.addElement( str.substring( 0, space_index ) );
- index += space_index + 1;
- }
- else
- {
- return_text.addElement( str.trim() );
- index += str.length();
- }
- }
-
- return_str = new String[return_text.size()];
-
- for( index = 0; index < return_text.size(); index++ )
- {
- return_str[index] = (String)(return_text.elementAt(index));
- }
-
- return return_str;
- }
-
- /**
- * This method returns a string with a repeated number of characters.
- **/
- static public String repeat( char the_char, int count )
- {
- StringBuffer buf = new StringBuffer( count );
-
- for( int index = 0; index < count; index++ )
- {
- buf.append( the_char );
- }
-
- return buf.toString();
- }
-
- /**
- * This method flattens an array of arguments to a string.
- * The method respects embedded whitespace and quotes.
- * <ul>
- * <li>Any argument with embedded whitespace will be flattened out
- * with enclosing quotes. For example, the single argument
- * <u>Hello World</u>
- * will be returned as
- * <u>"Hello World"</u>.
- * <li>Any argument with quotes will be flattened out with the
- * quotes escaped. For example, the single argument
- * <u>"Happy days"</u>
- * will be returned as
- * <u>\"Happy days\"</u>.
- * </ul>
- * @param arguments The array of strings to flatten.
- * @return the flattened string.
- */
- static public String flattenArguments ( String[] arguments )
- {
- StringBuffer buf = new StringBuffer();
-
- for (int i=0; i<arguments.length; i++)
- {
- //
- // Append a separator (except the first time).
- //
- if (i > 0) buf.append(' ');
-
- //
- // Look for whitespace.
- //
- boolean whitespace = false;
- char[] chars = arguments[i].toCharArray();
- for (int j=0; !whitespace && j<chars.length; j++)
- {
- if (Character.isWhitespace(chars[j]))
- {
- whitespace = true;
- }
- }
-
- //
- // Append the argument, quoted as necessary.
- //
- if (whitespace) buf.append('"');
- for (int j=0; j<chars.length; j++)
- {
- if (chars[j] == '"') buf.append('\\');
- buf.append(chars[j]);
- }
- if (whitespace) buf.append('"');
- }
-
- return buf.toString();
- }
-
- /**
- * This method parses whitespace-delimitted filenames from
- * the given <code>input</code> stream. <b>Limitation:</b>
- * Quoted filenames or filenames with embedded whitespace
- * are not currently supported.
- * @param input The input stream.
- * @return An enumeration of filenames from the stream.
- */
- static public Enumeration parseFilenamesFromStream ( InputStream input )
- throws IOException
- {
- Vector filenames = new Vector(64,64);
- StringBuffer buffer = null;
- byte state = STATE_WS;
- int ic = input.read();
- while (ic >= 0)
- {
- char c = (char)ic;
- switch (state)
- {
- case STATE_WS:
- if (!Character.isWhitespace(c))
- {
- buffer = new StringBuffer();
- buffer.append(c);
- state = STATE_NWS;
- }
- break;
- case STATE_NWS:
- if (!Character.isWhitespace(c))
- {
- buffer.append(c);
- }
- else
- {
- String filename = buffer.toString();
- filenames.add(filename);
- buffer = null;
- state = STATE_WS;
- }
- break;
- default:
- break;
- }
- ic = input.read();
- }
- return filenames.elements();
- }
-
- private static final byte STATE_WS = 0;
- private static final byte STATE_NWS = 1;
-
-
- /**
- * Returns true is the type passed in is a primtive java type
- * @param class name String
- * @return true is primitive type
- */
- public static boolean isPrimitiveType(String typeName)
- {
-
- if (typeName.equalsIgnoreCase("boolean") ||
- typeName.equalsIgnoreCase("byte") ||
- typeName.equalsIgnoreCase("double") ||
- typeName.equalsIgnoreCase("float") ||
- typeName.equalsIgnoreCase("int") ||
- typeName.equalsIgnoreCase("long") ||
- typeName.equalsIgnoreCase("short") ||
- typeName.equalsIgnoreCase("char"))
- return true;
- return false;
-
- }
-
- /**
- * The method replace the characters that are allowed in URIs
- * and not allowed in Java class names to an underscore ('_')
- * @param URI String
- * @return valid Java class name String
- */
- public static String URI2ClassName( String uri ) {
- String className = uri;
- for ( int i = 0; i < URI_SYMBOLS.length; i++ ) {
- className = className.replace ( URI_SYMBOLS[i], UNDERSCORE );
- }
- return className;
- }
-
- private static final char[] URI_SYMBOLS = {'-', '~', '#', '/', '.'};
- private static final char UNDERSCORE = '_';
-
-
- /**
- * This returns a valid Java identifier based on the given name.
- * (follows JAX-RPC 1.0 Public Review Draft 2 recommendations)
- */
- public static String javaIdentifierFor(String localName)
- {
- StringBuffer result = new StringBuffer();
- boolean skipped = false;
- for (int i = 0, length = localName.length(); i < length; ++i)
- {
- char character = localName.charAt(i);
- if (Character.isJavaIdentifierPart(character) && !isDelimiter(character))
- {
- if (skipped && result.length() != 0)
- {
- character = Character.toUpperCase(character);
- }
- result.append(character);
- skipped = false;
- }
- else
- {
- skipped =true;
- }
- }
-
- if (!JavaConventions.validateIdentifier(result.toString()).isOK())
- {
- result.insert(0, "_");
- }
-
- return result.toString();
- }
-
- private static boolean isDelimiter(char character)
- {
- return "\u002D\u002E\u003A\u005F\u00B7\u0387\u06DD\u06DE".indexOf(character) != -1;
- }
-
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/UniversalPathTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/UniversalPathTransformer.java
deleted file mode 100644
index a5e6c3141..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/UniversalPathTransformer.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060825 135570 makandre@ca.ibm.com - Andrew Mak, Service implementation URL not displayed properly on first page
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.common;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
-
-/**
- * <p>A utility class for transforming a path to and from the following formats:</p>
- * <ul>
- * <li>An absolute eclipse path (i.e. starts with /ProjectName/...)</li>
- * <li>An absolute filesystem URI path (i.e. file:/C:/MyWorkspace/ProjectName/...)</li>
- * <li>A platform URI path (i.e. platform:/resource/ProjectName/...)</li>
- * </ul>
- * <p>In all cases, if the transformer could not convert the path, it is returned unchanged.</p>
- */
-public class UniversalPathTransformer {
-
- /**
- * Prefix of platform URIs.
- */
- public static final String PLATFORM_PREFIX = "platform:/resource/";
-
- /**
- * Prefix of filesystem URIs.
- */
- public static final String LOCATION_PREFIX = "file:/";
-
- private static String PROTOCOL_MARKER = ":";
- private static char PATH_SEPARATOR = '/';
-
- /**
- * Determines if a URI string starts with the given prefix. This method is case-insensitive.
- *
- * @param uri The URI string to check.
- * @param prefix The prefix.
- * @return true iff prefix is a strict prefix of the URI string (i.e. prefix != uri), false
- * is returned otherwise.
- */
- private boolean isPrefix(String uri, String prefix) {
- if (prefix.length() >= uri.length())
- return false;
-
- return uri.substring(0, prefix.length()).equalsIgnoreCase(prefix);
- }
-
- /**
- * Transform the given path to an eclipse path. If the given path is a filesystem URI, it must map to
- * a real resource in the workspace.
- *
- * @param str The path to transform.
- * @return Returns an eclipse path equivalent of the given path.
- */
- public String toPath(String str) {
-
- if (str == null || str.length() == 0)
- return str;
-
- if (isPrefix(str, PLATFORM_PREFIX)) {
- str = str.substring(PLATFORM_PREFIX.length() - 1);
- }
- else if (isPrefix(str, LOCATION_PREFIX)) {
- String s = str.substring(LOCATION_PREFIX.length());
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(s));
- if (file != null)
- str = file.getFullPath().makeAbsolute().toString();
- }
-
- return str;
- }
-
- /**
- * Transform the given path to a platform URI path. If the given path is a filesystem URI, it must map to
- * a real resource in the workspace.
- *
- * @param str The path to transform.
- * @return Returns a platform URI path equivalent of the given path.
- */
- public String toPlatformPath(String str) {
-
- if (str == null || str.length() == 0)
- return str;
-
- if (isPrefix(str, LOCATION_PREFIX)) {
- String s = str.substring(LOCATION_PREFIX.length());
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(s));
- if (file != null)
- str = PLATFORM_PREFIX + file.getFullPath().makeRelative();
- }
- else if (str.indexOf(PROTOCOL_MARKER) == -1) {
- if (str.charAt(0) == PATH_SEPARATOR)
- str = PLATFORM_PREFIX + str.substring(1);
- else
- str = PLATFORM_PREFIX + str;
- }
-
- return str;
- }
-
- /**
- * Transform the given path to a filesystem URI path. The path must be a valid
- * eclipse resource.
- *
- * @param str The path to transform.
- * @return Returns a filesystem URI path equivalent of the given path.
- */
- public String toLocation(String str) {
-
- if (str == null || str.length() == 0)
- return str;
-
- String s = str;
-
- if (isPrefix(s, PLATFORM_PREFIX))
- s = toPath(s);
-
- if (s.indexOf(PROTOCOL_MARKER) == -1) {
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(s));
- if (file != null)
- str = file.getLocationURI().toString();
- }
-
- return str;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaBeanProperty.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaBeanProperty.java
deleted file mode 100644
index 9cfe27dba..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaBeanProperty.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-
-/**
- * @author cbrealey
- * This object represents a simple or indexed property
- * as defined by the Java Bean specification. Every
- * IJavaBeanProperty is characterized by four things:
- * <ol>
- * <li>The name of the property.</li>
- * <li>Whether or not the property is indexed.</li>
- * <li>The JDT IMethod of the getter, if any.</li>
- * <li>The JDT IMethod of the setter, if any.</li>
- * </ol>
- */
-public interface IJavaBeanProperty
-{
- /**
- * Returns the name of the property.
- * @return The name of the property.
- */
- public String getName ();
-
- /**
- * Returns true if and only if the property is indexed.
- * @return True if and only if the property is indexed.
- */
- public boolean isIndexed ();
-
- /**
- * Returns the JDT IMethod of the getter.
- * For indexed properties,
- * the return type of the getter will be an array.
- * For simple properties,
- * the return type of the getter will not be an array.
- * @return The JDT IMethod of the getter,
- * or null if this is a write-only property.
- */
- public IMethod getGetter ();
-
- /**
- * Returns the JDT IMethod of the indexed getter,
- * or null if this is either not an indexed property,
- * or is an indexed property but has only the array-
- * based getter.
- * @return The JDT IMethod of the indexed getter,
- * or null if this is not an indexed property or
- * if there is no indexed getter.
- */
- public IMethod getIndexedGetter ();
-
- /**
- * Returns the JDT IMethod of the setter.
- * For indexed properties,
- * the parameter type of the setter will be an array.
- * For simple properties,
- * the parameter type of the setter will not be an array.
- * @return The JDT IMethod of the setter,
- * or null if this is a read-only property.
- */
- public IMethod getSetter ();
-
- /**
- * Returns the JDT IMethod of the indexed setter,
- * or null if this is either not an indexed property,
- * or is an indexed property but has only the array-
- * based setter.
- * @return The JDT IMethod of the indexed setter,
- * or null if this is not an indexed property or
- * if there is no indexed setter.
- */
- public IMethod getIndexedSetter ();
-
- /**
- * Returns the type within which the getter and/or setter
- * of this property is declared, or null if none.
- * @return The type within which the getter and/or setter
- * of this property is declared.
- */
- public IType getDeclaringType ();
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRule.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRule.java
deleted file mode 100644
index 0912c9d05..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRule.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-
-/**
- * @author cbrealey
- * A Java Web service conformance Rule tests some collection
- * of Java resources that implement, or are meant to implement,
- * a Web service against a single, concise requirement as is
- * typically defined by a specification (eg. JAX-RPC, JSR 109)
- * or a runtime (eg. Apache Axis).
- * <p>
- * Every rule must have a namespace and a unique ID under that
- * that namespace. Every rule may have a short name and a long
- * description, both of which are recommended but optional.
- * <p>
- * Every rule follows a lifecycle of initialization, analysis
- * and completion. A Java Web service rule engine will drive
- * the <code>init()</code> method to initialize the rule, then
- * drive the various <code>visit...()</code> methods as it
- * navigates some collection of JDT resources, then drive the
- * <code>getResults()</code> method to indicate analysis is done
- * and retrieve a status object with the results of the analysis.
- */
-public interface IJavaWebServiceRule
-{
- /**
- * Returns the unique identifier of the rule
- * within the namespace to which the rule belongs.
- * @return The unique identifier of the rule.
- * Valid rule identifiers must not be negative.
- */
- public int getId ();
-
- /**
- * Returns the namespace to which this rule belongs.
- * @return The namespace to which this rule belongs.
- * Never returns null.
- */
- public String getNamespace ();
-
- /**
- * Returns the translatable short name of this rule.
- * @return The translatable short name of this rule,
- * or null if the rule has no name.
- */
- public String getName ();
-
- /**
- * Returns the translatable description of this rule.
- * @return The translatable description of this rule,
- * or null if the rule has no description.
- */
- public String getDescription ();
-
- /**
- * Called by the rule engine to give this rule a chance
- * to initialize itself prior to visiting JDT objects.
- * @param engine The engine initializing this rule.
- */
- public void init ( IJavaWebServiceRuleEngine engine );
-
- /**
- * Called by the rule engine when it decides to visit
- * a Java class (ie. primitive types are excluded).
- * @param jdtClass The class to visit.
- * @param peanutTrail The trail of objects back to the root.
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail );
-
- /**
- * Called by the rule engine when it decides to visit
- * a Java class found on the throws clause of a method.
- * @param jdtClass The exception class to visit.
- * @param peanutTrail The trail of objects back to the root.
- */
- public void visitException ( IType jdtClass, Stack peanutTrail );
-
- /**
- * Called by the rule engine when it decides to visit
- * a field belonging to a class.
- * @param jdtField The field to visit.
- * @param peanutTrail The trail of objects back to the root.
- */
- public void visitField ( IField jdtField, Stack peanutTrail );
-
- /**
- * Called by the rule engine when it decides to visit
- * a Java Bean property (ie. represented by a "get" and/or
- * "set" method) beloning to a class.
- * @param beanProperty The property to visit.
- * @param peanutTrail The trail of objects back to the root.
- */
- public void visitProperty ( IJavaBeanProperty beanProperty, Stack peanutTrail );
-
- /**
- * Called by the rule engine when it decides to visit a method.
- * @param jdtMethod The method to visit.
- * @param peanutTrail The trail of objects back to the root.
- */
- public void visitMethod ( IMethod jdtMethod, Stack peanutTrail );
-
- /**
- * Called by the rule engine after all JDT objects have
- * been visited so that the rule can return a status
- * object (usually a multi-status) with a summary of
- * any violations by JDT objects detected by this rule.
- * @return The results of the rule's analysis.
- */
- public IStatus getResults ();
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRuleEngine.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRuleEngine.java
deleted file mode 100644
index 23ef0b6ab..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/IJavaWebServiceRuleEngine.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IType;
-
-/**
- * @author cbrealey
- * This is an engine that walks a JDT model and runs rules.
- */
-public interface IJavaWebServiceRuleEngine
-{
- /**
- * Analyzes the given class in the context of the given
- * project for compliance to a set of JAX-RPC rules.
- * @param project The project context of the analysis.
- * @param rootClass The IType of the class to analyze.
- * @param rules The rules to use for the analysis.
- * @return An IStatus summarizing the results of the analysis.
- */
- public IStatus analyze ( IProject project, IType rootClass, JavaWebServiceRuleSet rules );
-
- /**
- * Returns the JDTResolver in use by this analyzer.
- * The JDTResolver is guaranteed not to be null only
- * after the analyze method has been invoked and before
- * the first rule is visited. This method is intended
- * for use by implementations of IJavaWebServiceRule.
- * @return The JDTResolver in use by this analyzer.
- */
- public JDTResolver getJDTResolver ();
-
- /**
- * Returns the progress monitor in use by this analyzer,
- * or null if no progress monitor is in use.
- * This method is intended for use by implementations
- * of IJavaWebServiceRule.
- * @return The progress monitor in use by this analyzer,
- * or null for none.
- */
- public IProgressMonitor getProgressMonitor ();
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceAnalyzer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceAnalyzer.java
deleted file mode 100644
index 115efb770..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceAnalyzer.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- * 20060607 145604 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.jst.ws.internal.conformance.rules.JAXRPCRuleSetFactory;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This class provides convenience methods for analyzing
- * compliance of Java service classes and value types to
- * the JAX-RPC 1.1 specification. Typical usage of this
- * class:
- * <code>
- * IType type = JAXRPCWebServiceAnalyzer.asType(myJavaFileResource);
- * JavaWebServiceRuleSet rules = JAXRPCWebServiceAnalyzer.getRuleSet();
- * JAXRPCWebServiceAnalyzer.getRuleEngine().analyze(type,rules,myProgressMonitor);
- * </code>
- * @author cbrealey
- */
-public class JAXRPCWebServiceAnalyzer
-{
- private JavaWebServiceRuleSet ruleSet_;
-
- /**
- * Constructs a new JAX-RPC Web service analyzer,
- * a convenience class wrapped around a
- * JAXRPCWebServiceAnalyzer.
- */
- public JAXRPCWebServiceAnalyzer ()
- {
- ruleSet_ = JAXRPCRuleSetFactory.newRuleSet();
- }
-
- /**
- * Returns the set of rules in use, the contents of
- * which can be manipulated and will be respected by
- * this analyzer. In other words, this method returns a
- * reference to, not a copy of, the set of rules in use.
- * @return The set of rules in use by the analyzer.
- */
- public JavaWebServiceRuleSet getRuleSet ()
- {
- return ruleSet_;
- }
-
- /**
- * Analyzes the Java service class represented by the given
- * JDT type for compliance to the JAX-RPC for compliance to
- * the JAX-RPC specification.
- * Progress monitoring is provided by the given monitor.
- * @param project The project context in which the analysis
- * should take place.
- * @param rootClass The Java service class to analyze.
- * @param monitor The progress monitor to use,
- * or null if monitoring is not desired.
- * @return A status object whose severity, message and
- * child status objects, if any, describe any JAX-RPC
- * rules that may be compromised by the service class.
- * Never returns null.
- */
- public IStatus analyze ( IProject project, IType rootClass, IProgressMonitor monitor )
- {
- IJavaWebServiceRuleEngine engine = new JAXRPCWebServiceRuleEngine(monitor);
- return engine.analyze(project,rootClass,ruleSet_);
- }
-
- /**
- * Analyzes the Java service class represented by the given
- * JDT type for compliance to the JAX-RPC for compliance to
- * the JAX-RPC specification.
- * Progress monitoring is provided by the given monitor.
- * @param project The project context in which the analysis
- * should take place.
- * @param rootClass The fully qualified name of the
- * Java service class to analyze.
- * @param monitor The progress monitor to use,
- * or null if monitoring is not desired.
- * @return A status object whose severity, message and
- * child status objects, if any, describe any JAX-RPC
- * rules that may be compromised by the service class.
- * Never returns null.
- */
- public IStatus analyze ( IProject project, String rootClass, IProgressMonitor monitor )
- {
- try
- {
- IType rootType = asType(rootClass,project);
- if (rootType == null)
- {
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_UNRESOLVED_CLASS,rootClass,project.getName());
- return new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,message,null);
- }
- return analyze(project,rootType,monitor);
- }
- catch (JavaModelException e)
- {
- // An exception may be thrown from the call to asType(...),
- // not from the call to analyze(...). Exceptions within the
- // analyze(...) method are captured in the returned IStatus.
- return new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,"Internal error",e);
- }
- }
-
- /**
- * Analyzes the Java service class represented by the given
- * ".java" compilation unit or ".class" file for compliance
- * to the JAX-RPC specification.
- * Progress monitoring is provided by the given monitor.
- * @param project The project context in which the analysis
- * should take place.
- * @param rootClass The Java service class to analyze.
- * @param monitor The progress monitor to use,
- * or null if monitoring is not desired.
- * @return A status object whose severity, message and
- * child status objects, if any, describe any JAX-RPC
- * rules that may be compromised by the service class.
- * Never returns null.
- */
- public IStatus analyze ( IProject project, IFile rootClass, IProgressMonitor monitor )
- {
- try
- {
- IType rootType = asType(rootClass);
- if (rootType == null)
- {
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_UNRESOLVED_CLASS,rootClass.getFullPath().toString(),project.getName());
- return new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,message,null);
- }
- return analyze(project,rootType,monitor);
- }
- catch (JavaModelException e)
- {
- // An exception may be thrown from the call to asType(...),
- // not from the call to analyze(...). Exceptions within the
- // analyze(...) method are captured in the returned IStatus.
- return new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,"Internal error",e);
- }
- }
-
- /**
- * Returns the Java type represented by the given file,
- * or null if no such type can be clearly determined.
- * @param file The file whose type to infer, usually a
- * ".java" or ".class" file. For ".java" files, this
- * method will return the primary type.
- * @return The inferred JDT Java type.
- * @throws JavaModelException If the given file could not
- * mapped to a JDT IType.
- */
- private static IType asType ( String qname, IProject project )
- throws JavaModelException
- {
- IType type = null;
- IJavaElement javaElement = JavaCore.create(project);
- if (javaElement instanceof IJavaProject)
- {
- IJavaProject javaProject = (IJavaProject)javaElement;
- type = javaProject.findType(qname);
- }
- return type;
- }
- /**
- * Returns the Java type represented by the given file,
- * or null if no such type can be clearly determined.
- * @param file The file whose type to infer, usually a
- * ".java" or ".class" file. For ".java" files, this
- * method will return the primary type.
- * @return The inferred JDT Java type.
- * @throws JavaModelException If the given file could not
- * mapped to a JDT IType.
- */
- private static IType asType ( IFile file )
- throws JavaModelException
- {
- IType type = null;
- IJavaElement javaElement = JavaCore.create(file);
- if (javaElement instanceof ICompilationUnit)
- {
- ICompilationUnit compilationUnit = (ICompilationUnit)javaElement;
- type = compilationUnit.findPrimaryType();
- }
- else if (javaElement instanceof IClassFile)
- {
- IClassFile classFile = (IClassFile)javaElement;
- type = classFile.getType();
- }
- return type;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceRuleEngine.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceRuleEngine.java
deleted file mode 100644
index 33597f06f..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JAXRPCWebServiceRuleEngine.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- * 20060711 149411 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.Stack;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @author cbrealey
- * This engine navigated JDT classes according to a JAX-RPC
- * interpretation. The root class is considered to be a
- * candidate JAX-RPC service class, and any non-standard
- * or non-primitive types used by the methods of the service
- * class are considered to be candidates for JAX-RPC value
- * type classes.
- */
-public class JAXRPCWebServiceRuleEngine implements IJavaWebServiceRuleEngine
-{
- /**
- * Creates a new JAX-RPC analysis engine with the given
- * progress monitor.
- * @param progressMonitor The progress monitor for the
- * engine to use, or null if monitoring is not desired.
- */
- public JAXRPCWebServiceRuleEngine ( IProgressMonitor progressMonitor )
- {
- progressMonitor_ = progressMonitor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine#analyze(org.eclipse.core.resources.IProject, org.eclipse.jdt.core.IType, org.eclipse.jst.ws.internal.conformance.JavaWebServiceRuleSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus analyze ( IProject project, IType rootClass, JavaWebServiceRuleSet rules )
- {
- visited_ = new HashSet();
- peanutTrail_ = new Stack();
- resolver_ = new JDTResolver(project,progressMonitor_);
- IStatus status = null;
- rules.init(this);
- try
- {
- analyzeServiceClass(rootClass,rules);
- String inCaseOfFailureMessage = NLS.bind(WSPluginMessages.MSG_JAXRPC11_NOT_COMPLIANT,rootClass.getFullyQualifiedName());
- status = rules.getResults(inCaseOfFailureMessage);
- }
- catch (JavaModelException e)
- {
- status = new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,"Internal Error",e);
- }
- return status;
- }
-
- private void analyzeServiceClass ( IType type, JavaWebServiceRuleSet rules )
- throws JavaModelException
- {
- rules.visitClass(type,peanutTrail_);
- visited_.add(type.getFullyQualifiedName());
- push(type);
- try
- {
- IType[] superClasses = resolver_.getSuperClasses(type);
- IMethod[] methods = resolver_.getPublicMethods(type,superClasses);
- for (int m=0; m<methods.length; m++)
- {
- analyzeMethod(methods[m],rules);
- }
- }
- finally
- {
- pop();
- }
- }
-
- private void analyzeMethod ( IMethod method, JavaWebServiceRuleSet rules )
- throws JavaModelException
- {
- rules.visitMethod(method,peanutTrail_);
- push(method);
- try
- {
- IType returnType = resolver_.getReturnType(method);
- analyzeDataType(returnType,rules);
- IType[] parameterTypes = resolver_.getParameterTypes(method);
- for (int p=0; p<parameterTypes.length; p++)
- {
- analyzeDataType(parameterTypes[p],rules);
- }
- IType[] exceptionTypes = resolver_.getExceptionTypes(method);
- for (int e=0; e<exceptionTypes.length; e++)
- {
- analyzeExceptionType(exceptionTypes[e],rules);
- }
- }
- finally
- {
- pop();
- }
- }
-
- private void analyzeDataType ( IType type, JavaWebServiceRuleSet rules )
- throws JavaModelException
- {
- if (type != null && !resolver_.isStandardType(type.getFullyQualifiedName()) && !visited_.contains(type.getFullyQualifiedName()))
- {
- rules.visitClass(type,peanutTrail_);
- visited_.add(type.getFullyQualifiedName());
- push(type);
- try
- {
- IType[] superClasses = resolver_.getSuperClasses(type);
- IField[] fields = resolver_.getPublicFields(type,superClasses);
- for (int f=0; f<fields.length; f++)
- {
- analyzeField(fields[f],rules);
- }
- IJavaBeanProperty[] properties = resolver_.getPublicProperties(type,superClasses);
- for (int p=0; p<properties.length; p++)
- {
- analyzeProperty(properties[p],rules);
- }
- }
- finally
- {
- pop();
- }
- }
- }
-
- private void analyzeField ( IField field, JavaWebServiceRuleSet rules )
- throws JavaModelException
- {
- if (field != null)
- {
- rules.visitField(field,peanutTrail_);
- push(field);
- try
- {
- //TODO: Get qualified name of the field type
- //and determine if we need to build an IType
- //for it and analyze it.
- IType type = resolver_.getFieldType(field);
- analyzeDataType(type,rules);
- }
- finally
- {
- pop();
- }
- }
- }
-
- private void analyzeProperty ( IJavaBeanProperty property, JavaWebServiceRuleSet rules )
- throws JavaModelException
- {
- if (property != null)
- {
- rules.visitProperty(property,peanutTrail_);
- push(property);
- try
- {
- IType type = resolver_.getPropertyType(property);
- analyzeDataType(type,rules);
- }
- finally
- {
- pop();
- }
- }
- }
-
- private void analyzeExceptionType ( IType type, JavaWebServiceRuleSet rules )
- throws JavaModelException
- {
- if (type != null && !resolver_.isStandardType(type.getFullyQualifiedName()) && !visited_.contains(type.getFullyQualifiedName()))
- {
- rules.visitException(type,peanutTrail_);
- visited_.add(type.getFullyQualifiedName());
- push(type);
- try
- {
- // We trust java.lang.Exception/Throwable as superclasses
- // for service specific exception classes, therefore we do
- // not try to analyze their properties (some of which would
- // otherwise violate JAX-RPC's rules anyways).
- IType[] superClasses = resolver_.getSuperClasses(type,"java.lang.Exception");
- IJavaBeanProperty[] properties = resolver_.getPublicProperties(type,superClasses);
- for (int p=0; p<properties.length; p++)
- {
- analyzeProperty(properties[p],rules);
- }
- }
- finally
- {
- pop();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine#getJDTResolver()
- */
- public JDTResolver getJDTResolver ()
- {
- return resolver_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine#getProgressMonitor()
- */
- public IProgressMonitor getProgressMonitor ()
- {
- return progressMonitor_;
- }
-
- /*
- * Pushes a peanut onto the peanut trail.
- */
- private void push ( Object peanut )
- {
- peanutTrail_.push(peanut);
- }
-
- /*
- * Pops a peanut off the peanut trail.
- */
- private void pop ()
- {
- peanutTrail_.pop();
- }
-
- /*
- * The JDTResolver used by this analyzer.
- */
- private JDTResolver resolver_;
-
- /*
- * The progress monitor used by this analyzer.
- */
- private IProgressMonitor progressMonitor_;
-
- /*
- * This set keeps track of the fully qualified names of
- * classes we have visited so that we don't visit the same
- * service class, value type or exception class more than once.
- */
- private Set visited_;
-
- /*
- * This stack keeps a trail of JDT objects back to the
- * service class we began with. This can be useful to
- * visitors that need to inspect the JDT elements that
- * enclose the currently visited element.
- */
- private Stack peanutTrail_;
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JDTResolver.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JDTResolver.java
deleted file mode 100644
index c1ed6fd1b..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JDTResolver.java
+++ /dev/null
@@ -1,877 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- * 20060711 149411 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-
-/**
- * @author cbrealey
- * A JDTResolver provides several convenience methods for
- * navigating references between Java classes, methods,
- * fields and properties. A JDTResolver is constructed
- * for a Java project whose effective classpath will
- * govern the scope of search operations performed by the
- * JDTResolver whenever it needs to convert a signature
- * into a JDT IType object.
- */
-public class JDTResolver
-{
- /**
- * Creates a new JDTResolver for the given project.
- * @param project The project providing the context
- * @param monitor The progress monitor for this resolver
- * to use, or null if progress monitoring is not desired.
- * within which this resolver will search for classes.
- */
- public JDTResolver ( IProject project, IProgressMonitor monitor )
- {
- javaProject_ = JavaCore.create(project);
- monitor_ = monitor;
- }
-
- /**
- * Returns true if and only if the given JDT IType is an interface.
- * @param jdtType The type to analyze.
- * @return True if and only if the given JDT IType is an interface.
- * @throws JavaModelException If the JDT model fails to
- * analyze the given type.
- */
- public boolean isInterface ( IType jdtType )
- throws JavaModelException
- {
- return jdtType.isInterface();
- }
-
- /**
- * Returns true if and only if the given JDT IType is an abstract class.
- * @param jdtType The type to analyze.
- * @return True if and only if the given JDT IType is an abstract class.
- * @throws JavaModelException If the JDT model fails to
- * analyze the given type.
- */
- public boolean isAbstract ( IType jdtType )
- throws JavaModelException
- {
- return Flags.isAbstract(jdtType.getFlags());
- }
-
- /**
- * Returns true if and only if instances of the given JDT IType
- * can be instantiated via a public default constructor. The class
- * must have an explicit public default constructor, or have no
- * explicit constructors at all to meet this criteria.
- * @param jdtType The type to analyze.
- * @return True if and only if instances of the type are
- * public default constructable.
- * @throws JavaModelException If the JDT model fails to
- * analyze the given type.
- */
- public boolean isConstructable ( IType jdtType )
- throws JavaModelException
- {
- IMethod[] methods = jdtType.getMethods();
- int numberOfConstructors = 0;
- for (int m=0; m<methods.length; m++)
- {
- if (methods[m].isConstructor())
- {
- numberOfConstructors++;
- if (methods[m].getNumberOfParameters() == 0 && Flags.isPublic(methods[m].getFlags()))
- {
- return true;
- }
- }
- }
- return numberOfConstructors == 0;
- }
-
- /**
- * Returns true if and only if the given fully qualified
- * type name is a type from the standard JDK, that is,
- * if the given type name belongs under the "java" or
- * "javax" packages.
- * @param typeName The name of the type to check.
- * @return True if and only if the type is a non-primitive,
- * Java standard type.
- */
- public boolean isStandardType ( String typeName )
- {
- return typeName.startsWith("java.") || typeName.startsWith("javax.");
- }
-
- /**
- * Returns true if and only if the given type name is a
- * Java primitive type.
- * @param typeName The name of the type to check.
- * @return True if and only if the type is a Java primitive type.
- */
- public boolean isPrimitiveType ( String typeName )
- {
- for (int i=0; i<primitiveTypes_.length; i++)
- {
- if (primitiveTypes_[i].equals(typeName))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns true if and only if the given fully qualified
- * type name is a Java wrapper type.
- * @param typeName The name of the type to check.
- * @return True if and only if the type is a Java wrapper type.
- */
- public boolean isWrapperType ( String typeName )
- {
- for (int i=0; i<wrapperTypes_.length; i++)
- {
- if (wrapperTypes_[i].equals(typeName))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns true if and only if the given fully qualified
- * type name is a Java primitive or standard type supported
- * by the JAX-RPC specification.
- * @param typeName The name of the type to check.
- * @return True if and only if the type is a Java wrapper type.
- */
- public boolean isJAXRPCStandardType ( String typeName )
- {
- for (int i=0; i<jaxrpcTypes_.length; i++)
- {
- if (jaxrpcTypes_[i].equals(typeName))
- {
- return true;
- }
- }
- if (isWrapperType(typeName) && !"java.lang.Character".equals(typeName))
- {
- return true;
- }
- if (isPrimitiveType(typeName) && !"char".equals(typeName))
- {
- return true;
- }
- return false;
- }
-
- /**
- * Returns an array of zero or more JDT IType objects
- * for the public fields belonging to the given type
- * @param jdtType The type to analyze.
- * @param jdtSuperTypes Any supertypes to analyze,
- * or null to analyze only the <code>jdtType</code>.
- * @return An array of zero or more public field types.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given types to satisfy this request.
- */
- public IField[] getPublicFields ( IType jdtType, IType[] jdtSuperClasses )
- throws JavaModelException
- {
- List fieldsList = new LinkedList();
- harvestPublicFields(jdtType,fieldsList);
- if (jdtSuperClasses != null)
- {
- for (int t=0; t<jdtSuperClasses.length; t++)
- {
- harvestPublicFields(jdtSuperClasses[t],fieldsList);
- }
- }
- return (IField[])fieldsList.toArray(new IField[0]);
- }
-
- /**
- * Returns an array of zero or more JDT IMethod objects
- * for the public methods belonging to the given type.
- * @param jdtType The type to analyze.
- * @param jdtSuperTypes Any supertypes to analyze,
- * or null to analyze only the <code>jdtType</code>.
- * @return An array of zero or more public methods.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given types to satisfy this request.
- */
- public IMethod[] getPublicMethods ( IType jdtType, IType[] jdtSuperClasses )
- throws JavaModelException
- {
- List methodsList = new LinkedList();
- harvestPublicMethods(jdtType,methodsList);
- if (jdtSuperClasses != null)
- {
- for (int t=0; t<jdtSuperClasses.length; t++)
- {
- harvestPublicMethods(jdtSuperClasses[t],methodsList);
- }
- }
- return (IMethod[])methodsList.toArray(new IMethod[0]);
- }
-
- /**
- * Returns an array of zero or more JDT IType objects
- * for the public properties (getters and/or setters)
- * belonging to the given type.
- * @param jdtType The type to analyze.
- * @param jdtSuperTypes Any supertypes to analyze,
- * or null to analyze only the <code>jdtType</code>.
- * @return An array of zero or more public property types.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given types to satisfy this request.
- */
- public IJavaBeanProperty[] getPublicProperties ( IType jdtType, IType[] jdtSuperClasses )
- throws JavaModelException
- {
- IMethod[] methods = getPublicMethods(jdtType,jdtSuperClasses);
- Map properties = new HashMap();
- for (int m=0; m<methods.length; m++)
- {
- String name = getGetterName(methods[m]);
- if (name != null)
- {
- JavaBeanProperty property = (JavaBeanProperty)properties.get(name);
- if (property == null)
- {
- property = new JavaBeanProperty();
- property.setName(name);
- properties.put(name,property);
- }
- property.setGetter(methods[m]);
- }
- else
- {
- name = getSetterName(methods[m]);
- if (name != null)
- {
- JavaBeanProperty property = (JavaBeanProperty)properties.get(name);
- if (property == null)
- {
- property = new JavaBeanProperty();
- property.setName(name);
- properties.put(name,property);
- }
- property.setSetter(methods[m]);
- }
- }
- }
- return (IJavaBeanProperty[])properties.values().toArray(new JavaBeanProperty[0]);
- }
-
- /**
- * Returns the JDT IType object for the given field.
- * @param jdtField The field to analyze.
- * @return The field type.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given field to satisfy this request.
- */
- public IType getFieldType ( IField jdtField )
- throws JavaModelException
- {
- IJavaElement elem = jdtField.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String signature = jdtField.getTypeSignature();
- String typeName = getTypeNameFromSignature(signature);
- return findType(typeName,ancestor);
- }
-
- /**
- * Returns the type name for the given field.
- * @param jdtField The field to analyze.
- * @return The field type name.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given field to satisfy this request.
- */
- public String getFieldTypeName ( IField jdtField )
- throws JavaModelException
- {
- IJavaElement elem = jdtField.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String signature = jdtField.getTypeSignature();
- String typeName = getTypeNameFromSignature(signature);
- return resolveType(typeName,ancestor);
- }
-
- /**
- * Returns the JDT IType object for the given bean property.
- * @param javaBeanProperty The bean property to analyze.
- * @return The property type.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given bean property to satisfy this request.
- */
- public IType getPropertyType ( IJavaBeanProperty javaBeanProperty )
- throws JavaModelException
- {
- IMethod method = javaBeanProperty.getGetter();
- if (method != null)
- {
- return getReturnType(method);
- }
- else
- {
- method = javaBeanProperty.getSetter();
- if (method != null)
- {
- IType[] parameters = getParameterTypes(method);
- if (parameters.length > 0)
- {
- //
- // It's the last parameter's type we want,
- // for indexed or non-indexed setters.
- //
- return parameters[parameters.length-1];
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the type name for the given bean property.
- * @param javaBeanProperty The bean property to analyze.
- * @return The property type name.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given bean property to satisfy this request.
- */
- public String getPropertyTypeName ( IJavaBeanProperty javaBeanProperty )
- throws JavaModelException
- {
- IMethod method = javaBeanProperty.getGetter();
- if (method != null)
- {
- return getReturnTypeName(method);
- }
- else
- {
- method = javaBeanProperty.getSetter();
- if (method != null)
- {
- String[] parameterTypeNames = getParameterTypeNames(method);
- if (parameterTypeNames.length > 0)
- {
- return parameterTypeNames[0];
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the JDT IType object for the return type
- * of the given method, or null if the method is void.
- * @param jdtMethod The method to analyze.
- * @return The method return type, or null if none.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given method to satisfy this request.
- */
- public IType getReturnType ( IMethod jdtMethod )
- throws JavaModelException
- {
- IJavaElement elem = jdtMethod.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String signature = jdtMethod.getReturnType();
- String typeName = getTypeNameFromSignature(signature);
- return findType(typeName,ancestor);
- }
-
- /**
- * Returns the type name for the return type
- * of the given method, or null if the method is void.
- * @param jdtMethod The method to analyze.
- * @return The method return type name, or null if none.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given method to satisfy this request.
- */
- public String getReturnTypeName ( IMethod jdtMethod )
- throws JavaModelException
- {
- IJavaElement elem = jdtMethod.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String signature = jdtMethod.getReturnType();
- String typeName = getTypeNameFromSignature(signature);
- return resolveType(typeName,ancestor);
- }
-
- /**
- * Returns an array of zero or more JDT IType objects
- * for the parameters of the given method.
- * @param jdtMethod The method to analyze.
- * @return An array of zero or more parameter types.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given method to satisfy this request.
- */
- public IType[] getParameterTypes ( IMethod jdtMethod )
- throws JavaModelException
- {
- IJavaElement elem = jdtMethod.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String[] signatures = jdtMethod.getParameterTypes();
- IType[] types = new IType[signatures.length];
- for (int s=0; s<signatures.length; s++)
- {
- String typeName = getTypeNameFromSignature(signatures[s]);
- types[s] = findType(typeName,ancestor);
- }
- return types;
- }
-
- /**
- * Returns an array of zero or more type names
- * for the parameters of the given method.
- * @param jdtMethod The method to analyze.
- * @return An array of zero or more parameter type names.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given method to satisfy this request.
- */
- public String[] getParameterTypeNames ( IMethod jdtMethod )
- throws JavaModelException
- {
- IJavaElement elem = jdtMethod.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String[] signatures = jdtMethod.getParameterTypes();
- String[] typeNames = new String[signatures.length];
- for (int s=0; s<signatures.length; s++)
- {
- String typeName = getTypeNameFromSignature(signatures[s]);
- typeNames[s] = resolveType(typeName,ancestor);
- }
- return typeNames;
- }
-
- /**
- * Returns an array of zero or more JDT IType objects
- * for the exceptions thrown by the given method.
- * @param jdtMethod The method to analyze.
- * @return An array of zero or more exception types.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given method to satisfy this request.
- */
- public IType[] getExceptionTypes ( IMethod jdtMethod )
- throws JavaModelException
- {
- IJavaElement elem = jdtMethod.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String[] signatures = jdtMethod.getExceptionTypes();
- IType[] types = new IType[signatures.length];
- for (int s=0; s<signatures.length; s++)
- {
- String typeName = getTypeNameFromSignature(signatures[s]);
- types[s] = findType(typeName,ancestor);
- }
- return types;
- }
-
- /**
- * Returns an array of zero or more type names
- * for the exceptions thrown by the given method.
- * @param jdtMethod The method to analyze.
- * @return An array of zero or more exception type names.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given method to satisfy this request.
- */
- public String[] getExceptionTypeNames ( IMethod jdtMethod )
- throws JavaModelException
- {
- IJavaElement elem = jdtMethod.getAncestor(IJavaElement.TYPE);
- IType ancestor = elem instanceof IType ? (IType)elem : null;
- String[] signatures = jdtMethod.getExceptionTypes();
- String[] typeNames = new String[signatures.length];
- for (int s=0; s<signatures.length; s++)
- {
- String typeName = getTypeNameFromSignature(signatures[s]);
- typeNames[s] = resolveType(typeName,ancestor);
- }
- return typeNames;
- }
-
- /**
- * Returns an array of zero or more types representing
- * the superclasses, if any, of the given IType in bottom-up
- * order excluding java.lang.Object.
- * @param jdtType The type to analyze.
- * @return An array of zero or more superclass types.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given type to satisfy this request.
- */
- public IType[] getSuperClasses ( IType jdtType )
- throws JavaModelException
- {
- return getSuperClasses(jdtType,"java.lang.Object");
- }
-
- /**
- * Returns an array of zero or more types representing
- * the superclasses, if any, of the given IType.
- * Under normal circumstances, java.lang.Object is included.
- * @param jdtType The type to analyze.
- * @param stopClassName The name of a stop class used to limit
- * the superclasses returned to the caller. If the stop class
- * is null or names a class not found in the hierarchy, all
- * superclasses are returned. Otherwise, only superclasses up
- * to but excluding the stop class are returned.
- * @return An array of zero or more superclass types.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given type to satisfy this request.
- */
- public IType[] getSuperClasses ( IType jdtType, String stopClassName )
- throws JavaModelException
- {
- ITypeHierarchy hierarchy = jdtType.newSupertypeHierarchy(monitor_);
- IType[] allSuperClasses = hierarchy.getAllSuperclasses(jdtType);
- List superClasses = new LinkedList();
- for (int i=0; i<allSuperClasses.length; i++)
- {
- if (allSuperClasses[i].getFullyQualifiedName().equals(stopClassName))
- break;
- superClasses.add(allSuperClasses[i]);
- }
- return (IType[])superClasses.toArray(new IType[0]);
- }
-
- /**
- * Extracts the qualified type name from a JDT signature.
- * @param signature The signature to examine.
- * @return The qualified type name from the signature.
- */
- public String getTypeNameFromSignature ( String signature )
- {
- String packageName = Signature.getSignatureQualifier(signature);
- String baseName = Signature.getSignatureSimpleName(signature);
- String typeName = (packageName.trim().equals("")?"":packageName+".") + baseName;
- return typeName;
- }
-
- /**
- * Attempts to resolve an unresolved type name in the
- * context of the given ancestor type (ie. the type
- * acting as the context within which the type name
- * should be resolved).
- * @param typeName The qualified name of the type to find.
- * @param ancestor The type providing the context within
- * which to look up the type.
- * @return The qualified name, or the original type name
- * if it could not be resolved.
- */
- public String resolveType ( String typeName, IType ancestor )
- throws JavaModelException
- {
- if (ancestor != null)
- {
- String[][] matches = ancestor.resolveType(typeName);
- if (matches != null && matches.length > 0)
- {
- StringBuffer qname = new StringBuffer();
- int n = matches[0].length;
- for (int j=0; j<n-1; j++)
- {
- qname.append(matches[0][j]).append(".");
- }
- if (n >= 0)
- {
- qname.append(matches[0][n-1]);
- }
- return qname.toString();
- }
- }
- return typeName;
- }
-
- /**
- * Attempts to find a JDT IType object for the given
- * resolved or unresolved type name in the context of
- * the given ancestor type (ie. the type acting as the
- * context within which the type name should be resolved).
- * @param typeName The qualified name of the type to find.
- * @param ancestor The type providing the context within
- * which to look up the type.
- * @return The IType object of the given qualified name,
- * or null if no type could be found in the workspace.
- */
- public IType findType ( String typeName, IType ancestor )
- throws JavaModelException
- {
- IType type = javaProject_.findType(typeName);
- if (type == null && ancestor != null)
- {
- String[][] matches = ancestor.resolveType(typeName);
- if (matches != null)
- {
- int i=0;
- while (type == null && i<matches.length)
- {
- StringBuffer qname = new StringBuffer();
- int n = matches[i].length;
- for (int j=0; j<n-1; j++)
- {
- qname.append(matches[i][j]).append(".");
- }
- if (n >= 0)
- {
- qname.append(matches[i][n-1]);
- }
- type = javaProject_.findType(qname.toString());
- i++;
- }
- }
- }
- return type;
- }
-
- /**
- * Finds all public, non-constructor IMethods belonging
- * to the given IType and adds them to the given list.
- * @param jdtType The type whose methods are to be harvested.
- * @param list The list to which the harvested methods will be added.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given type to satisfy this request.
- */
- public void harvestPublicMethods ( IType jdtType, List list )
- throws JavaModelException
- {
- IMethod[] methods = jdtType.getMethods();
- for (int m=0; m<methods.length; m++)
- {
- if (!methods[m].isConstructor() && Flags.isPublic(methods[m].getFlags()))
- {
- list.add(methods[m]);
- }
- }
- }
-
- /**
- * Finds all public IFields belonging
- * to the given IType and adds them to the given list.
- * @param jdtType The type whose fields are to be harvested.
- * @param list The list to which the harvested fields will be added.
- * @throws JavaModelException If the JDT engine fails to
- * analyze the given type to satisfy this request.
- */
- public void harvestPublicFields ( IType jdtType, List list )
- throws JavaModelException
- {
- IField[] fields = jdtType.getFields();
- for (int f=0; f<fields.length; f++)
- {
- if (Flags.isPublic(fields[f].getFlags()))
- {
- list.add(fields[f]);
- }
- }
- }
-
- /**
- * If the given method is a getter according to the Bean spec
- * (eg. "MyType getMyProperty ()" or "boolean isMyProperty ()")
- * return the corresponding bean property name (eg. "myProperty"),
- * otherwise, return null.
- * @param method The method to check.
- * @return The property name or none if the method is not a getter.
- */
- public String getGetterName ( IMethod method )
- {
- try
- {
- String methodName = method.getElementName();
- if (methodName.startsWith("get") && methodName.length() > 3)
- {
- String signature = method.getSignature();
- String returnTypeName = Signature.getReturnType(signature);
- //
- // Getters must not be void.
- //
- if (returnTypeName != null && returnTypeName != Signature.SIG_VOID)
- {
- String[] parameterSignatures = method.getParameterTypes();
- //
- // Non-indexed getters must have zero parameters.
- //
- if (parameterSignatures.length == 0)
- {
- return methodName.substring(3,4).toLowerCase() + methodName.substring(4);
- }
- //
- // Indexed getters must have exactly one parameter of type "int".
- //
- else if (parameterSignatures.length == 1)
- {
- String indexTypeName = getTypeNameFromSignature(parameterSignatures[0]);
- if (indexTypeName.equals("int"))
- {
- return methodName.substring(3,4).toLowerCase() + methodName.substring(4);
- }
- }
- }
- }
- else if (methodName.startsWith("is") && methodName.length() > 2)
- {
- String signature = method.getSignature();
- String returnTypeName = Signature.getReturnType(signature);
- //
- // "is" getters must be boolean.
- //
- if (Signature.SIG_BOOLEAN.equals(returnTypeName))
- {
- //
- // "is" getters must have no parameters.
- //
- if (method.getParameterTypes().length == 0)
- {
- return methodName.substring(2,3).toLowerCase() + methodName.substring(3);
- }
- }
- }
- }
- catch (JavaModelException e)
- {
- return null;
- }
- return null;
- }
-
- /**
- * If the given method is a setter according to the Bean spec
- * (eg. "void setMyProperty (MyType)" return the corresponding
- * bean property name (eg. "myProperty"), otherwise, return null.
- * @param method The method to check.
- * @return The property name or none if the method is not a setter.
- */
- public String getSetterName ( IMethod method )
- {
- try
- {
- String methodName = method.getElementName();
- if (methodName.startsWith("set") && methodName.length() > 3)
- {
- String signature = method.getSignature();
- String returnTypeName = Signature.getReturnType(signature);
- //
- // Setters must be void.
- //
- if (Signature.SIG_VOID.equals(returnTypeName))
- {
- String[] parameterSignatures = method.getParameterTypes();
- //
- // Non-indexed setters must have exactly one parameter.
- //
- if (parameterSignatures.length == 1)
- {
- return methodName.substring(3,4).toLowerCase() + methodName.substring(4);
- }
- //
- // Indexed setters must have exactly two parameters,
- // the first of which must be "int".
- //
- else if (parameterSignatures.length == 2)
- {
- if (Signature.SIG_INT.equals(parameterSignatures[0]))
- {
- return methodName.substring(3,4).toLowerCase() + methodName.substring(4);
- }
- }
- }
- }
- }
- catch (JavaModelException e)
- {
- return null;
- }
- return null;
- }
-
- /*
- * The Java project that governs the search scope for this resolver.
- */
- private IJavaProject javaProject_;
-
- /*
- * The progress monitor to use, if any.
- */
- private IProgressMonitor monitor_;
-
- /*
- * The set of Java wrapper types.
- */
- private static String[] wrapperTypes_ = {
- "java.lang.Character",
- "java.lang.Boolean",
- "java.lang.Byte",
- "java.lang.Short",
- "java.lang.Integer",
- "java.lang.Long",
- "java.lang.Float",
- "java.lang.Double"
- };
-
- /*
- * The set of Java primitive types.
- */
- private static String[] primitiveTypes_ = {
- "char",
- "boolean",
- "byte",
- "short",
- "int",
- "long",
- "float",
- "double"
- };
-
- /*
- * The set of JAX-RPC supported Java standard types,
- * excluding primitives and wrapper types.
- */
- private static String[] jaxrpcTypes_ = {
- "boolean",
- "byte",
- "short",
- "int",
- "long",
- "float",
- "double",
- "java.lang.String",
- "java.lang.Boolean",
- "java.lang.Byte",
- "java.lang.Short",
- "java.lang.Integer",
- "java.lang.Long",
- "java.lang.Float",
- "java.lang.Double",
- "java.util.Date",
- "java.util.Calendar",
- "java.math.BigInteger",
- "java.math.BigDecimal",
- "java.net.URI",
- "javax.xml.namespace.QName"
- };
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaBeanProperty.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaBeanProperty.java
deleted file mode 100644
index 529d5529d..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaBeanProperty.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-
-/**
- * @author cbrealey
- * This is a garden variety implementation of IJavaBeanProperty,
- * constructable by default and equipped with getters and setters
- * for the properties of IJavaBeanProperty.
- */
-public class JavaBeanProperty implements IJavaBeanProperty
-{
- private String name_;
- private boolean indexed_;
- private IMethod getter_;
- private IMethod setter_;
- private IMethod indexedGetter_;
- private IMethod indexedSetter_;
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty#getName()
- */
- public String getName ()
- {
- return name_;
- }
-
- /**
- * Sets the "name" property of this Java Bean Property descriptor.
- * @param name The string value to set.
- */
- public void setName ( String name )
- {
- name_ = name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty#isIndexed()
- */
- public boolean isIndexed ()
- {
- return indexed_;
- }
-
- /**
- * Sets the "indexed" property of this Java Bean Property descriptor.
- * @param indexed The boolean value to set.
- */
- public void setIndexed ( boolean indexed )
- {
- indexed_ = indexed;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty#getGetter()
- */
- public IMethod getGetter ()
- {
- return getter_;
- }
-
- /**
- * Sets the "getter" property of this Java Bean Property descriptor.
- * @param getter The IMethod to set.
- */
- public void setGetter ( IMethod getter )
- {
- getter_ = getter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty#getSetter()
- */
- public IMethod getSetter ()
- {
- return setter_;
- }
-
- /**
- * Sets the "setter" property of this Java Bean Property descriptor.
- * @param setter The IMethod to set.
- */
- public void setSetter ( IMethod setter )
- {
- setter_ = setter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty#getIndexedGetter()
- */
- public IMethod getIndexedGetter ()
- {
- return indexedGetter_;
- }
-
- /**
- * Sets the "indexedGetter" property of this Java Bean Property descriptor.
- * @param indexedGetter The IMethod to set.
- */
- public void setIndexedGetter ( IMethod indexedGetter )
- {
- indexedGetter_ = indexedGetter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty#getIndexedSetter()
- */
- public IMethod getIndexedSetter ()
- {
- return indexedSetter_;
- }
-
- /**
- * Sets the "indexedSetter" property of this Java Bean Property descriptor.
- * @param indexedSetter The IMethod to set.
- */
- public void setIndexedSetter ( IMethod indexedSetter )
- {
- indexedSetter_ = indexedSetter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty#getDeclaringType()
- */
- public IType getDeclaringType ()
- {
- IMethod method = getGetter();
- if (method == null) method = getSetter();
- if (method == null) method = getIndexedGetter();
- if (method == null) method = getIndexedSetter();
- return method != null ? method.getDeclaringType() : null;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRule.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRule.java
deleted file mode 100644
index 39ffa312d..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRule.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-
-/**
- * A basic default implementation of IJavaWebServiceRule.
- */
-public class JavaWebServiceRule implements IJavaWebServiceRule
-{
- protected IJavaWebServiceRuleEngine engine_;
- protected List statusList_;
- protected int id_;
- protected String namespace_;
- protected String name_;
- protected String description_;
-
- protected JavaWebServiceRule ()
- {
- // Not publicly constructable.
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#getId()
- */
- public int getId ()
- {
- return id_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#getNamespace()
- */
- public String getNamespace ()
- {
- return namespace_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#getName()
- */
- public String getName ()
- {
- return name_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#getDescription()
- */
- public String getDescription ()
- {
- return description_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#init()
- */
- public void init ( IJavaWebServiceRuleEngine engine )
- {
- engine_ = engine;
- statusList_ = new LinkedList();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#visitClass(org.eclipse.jdt.core.IType, java.util.Stack)
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail )
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#visitException(org.eclipse.jdt.core.IField, java.util.Stack)
- */
- public void visitException ( IType jdtClass, Stack peanutTrail )
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#visitField(org.eclipse.jdt.core.IField, java.util.Stack)
- */
- public void visitField ( IField jdtField, Stack peanutTrail )
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#visitProperty(org.eclipse.jdt.core.IMethod, org.eclipse.jdt.core.IMethod, java.util.Stack)
- */
- public void visitProperty ( IJavaBeanProperty beanProperty, Stack peanutTrail )
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#visitMethod(org.eclipse.jdt.core.IMethod, java.util.Stack)
- */
- public void visitMethod ( IMethod jdtMethod, Stack peanutTrail )
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRule#getResults()
- */
- public IStatus getResults ()
- {
- IStatus status = null;
- if (statusList_.size() == 0)
- {
- status = new Status(IStatus.OK,"org.eclipse.jst.ws",0,"",null);
- }
- else
- {
- MultiStatus multiStatus = new MultiStatus("org.eclipse.jst.ws",0,"",null);
- Iterator i = statusList_.iterator();
- while (i.hasNext())
- {
- multiStatus.add((IStatus)i.next());
- }
- status = multiStatus;
- }
- return status;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRuleSet.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRuleSet.java
deleted file mode 100644
index f48771487..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/JavaWebServiceRuleSet.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-
-/**
- * @author cbrealey
- * This object manages a set of rules.
- * Rules in the set may be enabled or disabled.
- */
-public class JavaWebServiceRuleSet
-{
- private Set enabledRules_ = new HashSet();
- private Set disabledRules_ = new HashSet();
-
- /**
- * Creates a new, initially empty set of rules.
- */
- public JavaWebServiceRuleSet ()
- {
- // Nothing to do.
- }
-
- /**
- * Creates a new set of rules initialized with those
- * from the given array of <code>rules</code>.
- * @param rules An array of rules to add.
- */
- public JavaWebServiceRuleSet ( IJavaWebServiceRule[] rules )
- {
- addRules(rules);
- }
-
- /**
- * Adds a <code>rule</code> to the set.
- * Rules added to the set are initially enabled.
- * @param rule The rule to add.
- */
- public void addRule ( IJavaWebServiceRule rule )
- {
- enabledRules_.add(rule);
- }
-
- /**
- * Adds several <code>rules</code> to the set.
- * Rules added to the set are initially enabled.
- * @param rules The array of rules to add.
- */
- public void addRules ( IJavaWebServiceRule[] rules )
- {
- enabledRules_.addAll(Arrays.asList(rules));
- }
-
- /**
- * Marks the given <code>rule</code> as disabled or enabled.
- * This method has no effect if the rule is not already in
- * the set, in other words, this method will not have the
- * side effect of adding a rule to the set.
- * @param rule The rule to disable or enable.
- * @param disabled True to disable the rule or false to enable it.
- * @return True if a change in status was actually made.
- */
- public boolean setRuleDisabled ( IJavaWebServiceRule rule, boolean disabled )
- {
- if (disabled)
- {
- if (enabledRules_.remove(rule))
- {
- disabledRules_.add(rule);
- return true;
- }
- }
- else
- {
- if (disabledRules_.remove(rule))
- {
- enabledRules_.add(rule);
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the number of rules in the set.
- * @return The number of rules in the set.
- */
- public int size ()
- {
- return enabledRules_.size() + disabledRules_.size();
- }
-
- /**
- * Returns the number of enabled rules in the set.
- * @return The number of enabled rules in the set.
- */
- public int numberEnabled ()
- {
- return enabledRules_.size();
- }
-
- /**
- * Returns the number of disabled rules in the set.
- * @return The number of disabled rules in the set.
- */
- public int numberDisabled ()
- {
- return disabledRules_.size();
- }
-
- /**
- * Returns an array of all currently enabled rules from the set.
- * @return An array of all currently enabled rules from the set.
- */
- public IJavaWebServiceRule[] getEnabledRules ()
- {
- return (IJavaWebServiceRule[])enabledRules_.toArray(new IJavaWebServiceRule[0]);
- }
-
- /**
- * Returns an array of all currently disabled rules from the set.
- * @return An array of all currently disabled rules from the set.
- */
- public IJavaWebServiceRule[] getDisabledRules ()
- {
- return (IJavaWebServiceRule[])disabledRules_.toArray(new IJavaWebServiceRule[0]);
- }
-
- /**
- * Initializes all rules in the set by calling
- * their init() methods with the given engine.
- * @param engine The engine initializing
- */
- public void init ( IJavaWebServiceRuleEngine engine )
- {
- Iterator i = enabledRules_.iterator();
- while (i.hasNext())
- {
- IJavaWebServiceRule rule = (IJavaWebServiceRule)i.next();
- rule.init(engine);
- }
- }
-
- /**
- * Visits the "visitClass" method of all rules in the set.
- * @param jdtClass The JDT IType being visited.
- * @param peanutTrail The stack of objects up to the root.
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail )
- {
- Iterator i = enabledRules_.iterator();
- while (i.hasNext())
- {
- IJavaWebServiceRule rule = (IJavaWebServiceRule)i.next();
- rule.visitClass(jdtClass,peanutTrail);
- }
- }
-
- /**
- * Visits the "visitException" method of all rules in the set.
- * @param jdtClass The JDT IType being visited.
- * @param peanutTrail The stack of objects up to the root.
- */
- public void visitException ( IType jdtClass, Stack peanutTrail )
- {
- Iterator i = enabledRules_.iterator();
- while (i.hasNext())
- {
- IJavaWebServiceRule rule = (IJavaWebServiceRule)i.next();
- rule.visitException(jdtClass,peanutTrail);
- }
- }
-
-
- /**
- * Visits the "visitField" method of all rules in the set.
- * @param jdtClass The JDT IField being visited.
- * @param peanutTrail The stack of objects up to the root.
- */
- public void visitField ( IField jdtField, Stack peanutTrail )
- {
- Iterator i = enabledRules_.iterator();
- while (i.hasNext())
- {
- IJavaWebServiceRule rule = (IJavaWebServiceRule)i.next();
- rule.visitField(jdtField,peanutTrail);
- }
- }
-
- /**
- * Visits the "visitProperty" method of all rules in the set.
- * @param jdtClass The IJavaBeanProperty being visited.
- * @param peanutTrail The stack of objects up to the root.
- */
- public void visitProperty ( IJavaBeanProperty beanProperty, Stack peanutTrail )
- {
- Iterator i = enabledRules_.iterator();
- while (i.hasNext())
- {
- IJavaWebServiceRule rule = (IJavaWebServiceRule)i.next();
- rule.visitProperty(beanProperty,peanutTrail);
- }
- }
-
- /**
- * Visits the "visitMethod" method of all rules in the set.
- * @param jdtClass The JDT IMethod being visited.
- * @param peanutTrail The stack of objects up to the root.
- */
- public void visitMethod ( IMethod jdtMethod, Stack peanutTrail )
- {
- Iterator i = enabledRules_.iterator();
- while (i.hasNext())
- {
- IJavaWebServiceRule rule = (IJavaWebServiceRule)i.next();
- rule.visitMethod(jdtMethod,peanutTrail);
- }
- }
-
- /**
- * Collects the results of all rules in the set together.
- * If one or more warnings or errors are found, returns
- * a status object whose top level message is the root
- * message passed to this message, otherwise, returns a
- * basic "OK" status.
- * @param rootMessage The warning/error message to act as
- * the root message if necessary (ie. if at least one rule
- * in the set reported at least one warning/error).
- * @return The collective status.
- */
- public IStatus getResults ( String rootMessage )
- {
- List list = new LinkedList();
- Iterator e = enabledRules_.iterator();
- while (e.hasNext())
- {
- IJavaWebServiceRule rule = (IJavaWebServiceRule)e.next();
- IStatus status = rule.getResults();
- if (!status.isOK())
- {
- list.add(status);
- }
- }
- if (list.size() > 0)
- {
- MultiStatus multiStatus = new MultiStatus("org.eclipse.jst.ws",0,rootMessage,null);
- Iterator l = list.iterator();
- while (l.hasNext())
- {
- IStatus status = (IStatus)l.next();
- multiStatus.addAll(status);
- }
- return multiStatus;
- }
- else
- {
- return new Status(IStatus.OK,"org.eclipse.jst.ws",0,"",null);
- }
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0001.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0001.java
deleted file mode 100644
index 144107980..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0001.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance.rules;
-
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.jst.ws.internal.conformance.JDTResolver;
-import org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This rule checks if a service class
- * is public default constructable.
- */
-public class JAXRPCRule0001 extends JavaWebServiceRule
-{
- /**
- * Creates a new instance of this rule.
- */
- public JAXRPCRule0001 ()
- {
- id_ = 1;
- namespace_ = "http://www.eclipse.org/webtools/org.eclipse.jst.ws/jaxrpc/1.1";
- name_ = null;
- description_ = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitClass(org.eclipse.jdt.core.IType, java.util.Stack)
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail )
- {
- // An empty peanut trail implies this is the root
- // class or JAX-RPC service class.
- if (peanutTrail.size() == 0)
- {
- try
- {
- JDTResolver resolver = engine_.getJDTResolver();
- if (!resolver.isConstructable(jdtClass) || resolver.isInterface(jdtClass) || resolver.isAbstract(jdtClass))
- {
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_RULE_0001,jdtClass.getFullyQualifiedName());
- statusList_.add(new Status(IStatus.WARNING,"org.eclipse.jst.ws",0,message,null));
- }
- }
- catch (JavaModelException e)
- {
- statusList_.add(new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,"Internal error",e));
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0002.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0002.java
deleted file mode 100644
index 7049c3356..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0002.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance.rules;
-
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.jst.ws.internal.conformance.JDTResolver;
-import org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This rule checks if a value type class
- * is public default constructable.
- */
-public class JAXRPCRule0002 extends JavaWebServiceRule
-{
- /**
- * Creates a new instance of this rule.
- */
- public JAXRPCRule0002 ()
- {
- id_ = 2;
- namespace_ = "http://www.eclipse.org/webtools/org.eclipse.jst.ws/jaxrpc/1.1";
- name_ = null;
- description_ = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitClass(org.eclipse.jdt.core.IType, java.util.Stack)
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail )
- {
- // An empty peanut trail implies this is the root class
- // root class or JAX-RPC service class, whereas a non-empty
- // peanut trail implies this is a class from a method, field
- // or property signature. In the former case, remember the
- // qualified name of the type just in case we need it for the
- // latter case.
- if (peanutTrail.size() == 0)
- {
- serviceClassName_ = jdtClass.getFullyQualifiedName();
- }
- else
- {
- try
- {
- JDTResolver resolver = engine_.getJDTResolver();
- String qname = jdtClass.getFullyQualifiedName();
- if (!resolver.isStandardType(qname))
- {
- if (!resolver.isConstructable(jdtClass) || resolver.isInterface(jdtClass) || resolver.isAbstract(jdtClass))
- {
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_RULE_0002,qname,serviceClassName_);
- statusList_.add(new Status(IStatus.WARNING,"org.eclipse.jst.ws",0,message,null));
- }
- }
- }
- catch (JavaModelException e)
- {
- statusList_.add(new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,"Internal error",e));
- }
- }
- }
-
- private String serviceClassName_;
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0003.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0003.java
deleted file mode 100644
index bc65bcda5..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0003.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance.rules;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine;
-import org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This rule verifies that a service class has no overloaded methods.
- */
-public class JAXRPCRule0003 extends JavaWebServiceRule
-{
- /**
- * Creates a new instance of this rule.
- */
- public JAXRPCRule0003 ()
- {
- id_ = 3;
- namespace_ = "http://www.eclipse.org/webtools/org.eclipse.jst.ws/jaxrpc/1.1";
- name_ = null;
- description_ = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#init(org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine)
- */
- public void init ( IJavaWebServiceRuleEngine engine )
- {
- super.init(engine);
- methodNames_ = new HashMap();
- overloadedMethodNames_ = new HashSet();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitClass(org.eclipse.jdt.core.IType, java.util.Stack)
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail )
- {
- //
- // An empty peanut trail implies this is the root
- // class, aka. JAX-RPC service class. Put aside
- // the class name in case visitMethod() needs it.
- //
- if (peanutTrail.size() == 0)
- {
- serviceClassName_ = jdtClass.getFullyQualifiedName();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitMethod(org.eclipse.jdt.core.IMethod, java.util.Stack)
- */
- public void visitMethod ( IMethod jdtMethod, Stack peanutTrail )
- {
- //
- // A peanut trail of length one implies this is a method
- // belonging to the root class, aka. JAX-RPC service class.
- //
- if (peanutTrail.size() == 1)
- {
- try
- {
- //
- // If we have encountered this method already but haven't
- // reported the overload condition, report it.
- //
- String methodName = jdtMethod.getElementName();
- String firstParameterSignature = (String)methodNames_.get(methodName);
- String thisParameterSignature = flattenedSignatureOf(jdtMethod);
- if (thisParameterSignature != null)
- {
- if (firstParameterSignature != null)
- {
- //
- // If we have encountered this method's name already,
- // but have not yet determined if it is overloaded,
- // then compare this method's parameter signature with
- // that of the "first signature" of the method name.
- // The moment we find a second signature for a given
- // method name, we have an overload condition.
- //
- if (!overloadedMethodNames_.contains(methodName) && !thisParameterSignature.equals(firstParameterSignature))
- {
- overloadedMethodNames_.add(methodName);
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_RULE_0003,methodName,serviceClassName_);
- statusList_.add(new Status(IStatus.WARNING,"org.eclipse.jst.ws",0,message,null));
- }
- }
- else
- {
- //
- // If we have recorded no signature for the given method
- // name (ie. we have not encountered the method name yet),
- // then record this one. Any "first signature" will do.
- //
- methodNames_.put(methodName,thisParameterSignature);
- }
- }
- }
- catch (JavaModelException e)
- {
- // Do nothing.
- }
- }
- }
-
- /*
- * Grabs the types of the parameters of the given method
- * and flattens then into a single string sufficient to
- * distinguish between overloaded vs. overridden methods.
- */
- private String flattenedSignatureOf ( IMethod jdtMethod )
- throws JavaModelException
- {
- String[] signatures = engine_.getJDTResolver().getParameterTypeNames(jdtMethod);
- StringBuffer flattenedSignature = new StringBuffer();
- for (int s=0; s<signatures.length; s++)
- {
- flattenedSignature.append(signatures[s]).append(",");
- }
- return flattenedSignature.toString();
- }
-
- private Map methodNames_;
- private Set overloadedMethodNames_;
- private String serviceClassName_;
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0005.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0005.java
deleted file mode 100644
index c66cf7a51..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0005.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance.rules;
-
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine;
-import org.eclipse.jst.ws.internal.conformance.JDTResolver;
-import org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This rule verifies that the methods of a service class
- * uses only JAX-RPC supported types.
- */
-public class JAXRPCRule0005 extends JavaWebServiceRule
-{
- /**
- * Creates a new instance of this rule.
- */
- public JAXRPCRule0005 ()
- {
- id_ = 5;
- namespace_ = "http://www.eclipse.org/webtools/org.eclipse.jst.ws/jaxrpc/1.1";
- name_ = null;
- description_ = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#init(org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine)
- */
- public void init ( IJavaWebServiceRuleEngine engine )
- {
- super.init(engine);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitClass(org.eclipse.jdt.core.IType, java.util.Stack)
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail )
- {
- //
- // An empty peanut trail implies this is the root
- // class, aka. JAX-RPC service class. Put aside
- // the class name in case visitMethod() needs it.
- //
- if (peanutTrail.size() == 0)
- {
- serviceClassName_ = jdtClass.getFullyQualifiedName();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitMethod(org.eclipse.jdt.core.IMethod, java.util.Stack)
- */
- public void visitMethod ( IMethod jdtMethod, Stack peanutTrail )
- {
- //
- // A peanut trail of length one implies this is a method
- // belonging to the root class, aka. JAX-RPC service class.
- //
- if (peanutTrail.size() == 1)
- {
- try
- {
- String methodName = jdtMethod.getElementName();
- //
- // Check the method return type for compliance.
- // Any Java primitive or standard ("java." or "javax.") type
- // that is not supported by JAX-RPC will get flagged.
- // Any non-primitive or non-standard type is presumed to be a
- // potential value type and is bypassed since the rule engine
- // will navigate into the potential value type's class.
- //
- JDTResolver resolver = engine_.getJDTResolver();
- String returnTypeName = resolver.getReturnTypeName(jdtMethod);
- if ((resolver.isPrimitiveType(returnTypeName) || resolver.isStandardType(returnTypeName)) && !resolver.isJAXRPCStandardType(returnTypeName))
- {
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_RULE_0005,new String[] {methodName,serviceClassName_,returnTypeName});
- statusList_.add(new Status(IStatus.WARNING,"org.eclipse.jst.ws",0,message,null));
- }
- //
- // Check the method parameter types for compliance.
- // Same comment as above, only applied to the method's parameters.
- //
- String[] parameterTypeNames = resolver.getParameterTypeNames(jdtMethod);
- for (int p=0; p<parameterTypeNames.length; p++)
- {
- if ((resolver.isPrimitiveType(parameterTypeNames[p]) || resolver.isStandardType(parameterTypeNames[p])) && !resolver.isJAXRPCStandardType(parameterTypeNames[p]))
- {
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_RULE_0005,new String[] {methodName,serviceClassName_,parameterTypeNames[p]});
- statusList_.add(new Status(IStatus.WARNING,"org.eclipse.jst.ws",0,message,null));
- }
- }
- }
- catch (JavaModelException e)
- {
- // Do nothing.
- }
- }
- }
-
- private String serviceClassName_;
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0006.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0006.java
deleted file mode 100644
index 407afd319..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRule0006.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance.rules;
-
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.ws.internal.WSPluginMessages;
-import org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty;
-import org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine;
-import org.eclipse.jst.ws.internal.conformance.JDTResolver;
-import org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This rule verifies that the fields and properties of a
- * value type class uses only JAX-RPC supported types.
- */
-public class JAXRPCRule0006 extends JavaWebServiceRule
-{
- /**
- * Creates a new instance of this rule.
- */
- public JAXRPCRule0006 ()
- {
- id_ = 6;
- namespace_ = "http://www.eclipse.org/webtools/org.eclipse.jst.ws/jaxrpc/1.1";
- name_ = null;
- description_ = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#init(org.eclipse.jst.ws.internal.conformance.IJavaWebServiceRuleEngine)
- */
- public void init ( IJavaWebServiceRuleEngine engine )
- {
- super.init(engine);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitClass(org.eclipse.jdt.core.IType, java.util.Stack)
- */
- public void visitClass ( IType jdtClass, Stack peanutTrail )
- {
- //
- // An empty peanut trail implies this is the root
- // class, aka. JAX-RPC service class. Put aside
- // the class name in case visitMethod() needs it.
- //
- if (peanutTrail.size() == 0)
- {
- serviceClassName_ = jdtClass.getFullyQualifiedName();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitMethod(org.eclipse.jdt.core.IMethod, java.util.Stack)
- */
- public void visitField ( IField jdtField, Stack peanutTrail )
- {
- //
- // A peanut trail of length greater than one implies this is a
- // field belonging to a class other than the root (aka. JAX-RPC
- // service) class, namely a presumed value type class.
- //
- if (peanutTrail.size() > 1)
- {
- try
- {
- //
- // Any Java primitive or standard ("java." or "javax.") type
- // that is not supported by JAX-RPC will get flagged.
- // Any non-primitive or non-standard type is presumed to be a
- // potential value type and is bypassed since the rule engine
- // will navigate into the potential value type's class.
- //
- JDTResolver resolver = engine_.getJDTResolver();
- String fieldTypeName = resolver.getFieldTypeName(jdtField);
- if ((resolver.isPrimitiveType(fieldTypeName) || resolver.isStandardType(fieldTypeName)) && !resolver.isJAXRPCStandardType(fieldTypeName))
- {
- //
- // The field pretty much MUST be declared in a type or
- // we would not have gotten here. Still, best to be safe.
- //
- IType valueType = jdtField.getDeclaringType();
- if (valueType != null)
- {
- String valueTypeClassName = valueType.getFullyQualifiedName();
- String fieldName = jdtField.getElementName();
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_RULE_0006,new String[] {fieldName,valueTypeClassName,serviceClassName_,fieldTypeName});
- statusList_.add(new Status(IStatus.WARNING,"org.eclipse.jst.ws",0,message,null));
- }
- }
- }
- catch (JavaModelException e)
- {
- // Do nothing.
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.conformance.JavaWebServiceRule#visitProperty(org.eclipse.jst.ws.internal.conformance.IJavaBeanProperty, java.util.Stack)
- */
- public void visitProperty ( IJavaBeanProperty property, Stack peanutTrail )
- {
- //
- // A peanut trail of length greater than one implies this is a
- // property belonging to a class other than the root (aka. JAX-RPC
- // service) class, namely a presumed value type class.
- //
- if (peanutTrail.size() > 1)
- {
- try
- {
- //
- // Any Java primitive or standard ("java." or "javax.") type
- // that is not supported by JAX-RPC will get flagged.
- // Any non-primitive or non-standard type is presumed to be a
- // potential value type and is bypassed since the rule engine
- // will navigate into the potential value type's class.
- //
- JDTResolver resolver = engine_.getJDTResolver();
- String propertyTypeName = resolver.getPropertyTypeName(property);
- if ((resolver.isPrimitiveType(propertyTypeName) || resolver.isStandardType(propertyTypeName)) && !resolver.isJAXRPCStandardType(propertyTypeName))
- {
- //
- // The field pretty much MUST be declared in a type or
- // we would not have gotten here. Still, best to be safe.
- //
- IType valueType = property.getDeclaringType();
- if (valueType != null)
- {
- String valueTypeClassName = valueType.getFullyQualifiedName();
- String propertyName = property.getName();
- String message = NLS.bind(WSPluginMessages.MSG_JAXRPC11_RULE_0006,new String[] {propertyName,valueTypeClassName,serviceClassName_,propertyTypeName});
- statusList_.add(new Status(IStatus.WARNING,"org.eclipse.jst.ws",0,message,null));
- }
- }
- }
- catch (JavaModelException e)
- {
- // Do nothing.
- }
- }
- }
-
- private String serviceClassName_;
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRuleSetFactory.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRuleSetFactory.java
deleted file mode 100644
index 0f1c7a63b..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/conformance/rules/JAXRPCRuleSetFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.conformance.rules;
-
-import org.eclipse.jst.ws.internal.conformance.JavaWebServiceRuleSet;
-
-/**
- * A factory that produces a JavaWebServiceRuleSet
- * for the JAX-RPC 1.1 specification.
- */
-public class JAXRPCRuleSetFactory
-{
- private JAXRPCRuleSetFactory ()
- {
- // Not publicly constructable.
- }
-
- /**
- * Returns a set of rules for analyzing Java classes
- * for compliance to the rules of JAX-RPC 1.1.
- * @return A set of JAX-RPC 1.1 analysis rules.
- */
- public static JavaWebServiceRuleSet newRuleSet ()
- {
- JavaWebServiceRuleSet set = new JavaWebServiceRuleSet();
- set.addRule(new JAXRPCRule0001());
- set.addRule(new JAXRPCRule0002());
- set.addRule(new JAXRPCRule0003());
- set.addRule(new JAXRPCRule0005());
- set.addRule(new JAXRPCRule0006());
- return set;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentScenarioContext.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentScenarioContext.java
deleted file mode 100644
index f2defd083..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentScenarioContext.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060216 127138 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.context;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension;
-import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry;
-import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
-import org.eclipse.wst.command.internal.env.context.PersistentContext;
-import com.ibm.icu.util.StringTokenizer;
-
-
-public class PersistentScenarioContext extends PersistentContext implements ScenarioContext
-{
- public PersistentScenarioContext()
- {
- super(WebServicePlugin.getInstance());
- }
-
- public void load()
- {
- ScenarioDefaults defaults = new ScenarioDefaults();
- String[] ids = defaults.getWebServiceTestTypes();
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < ids.length; i++)
- {
- if (i != 0) sb.append(",");
- sb.append(ids[i]);
- }
- String nonJavaTestService = defaults.getNonJavaTestServiceDefault();
- setDefaultStringIfNoDefault(PREFERENCE_WEBSERVICE_TEST_TYPES, sb.toString());
- setDefaultStringIfNoDefault(PREFERENCE_NON_JAVA_TEST_SERVICE, nonJavaTestService);
-
- setDefaultStringIfNoDefault(PREFERENCE_CLIENT_WEBSERVICE_TYPE, defaults.webserviceClientTypeDefault() );
- setDefaultStringIfNoDefault(PREFERENCE_WEBSERVICE_TYPE, defaults.webserviceTypeIdDefault() );
- setDefaultBooleanIfNoDefault(PREFERENCE_GENERATE_PROXY, defaults.generateProxyDefault() );
- setDefaultBooleanIfNoDefault(PREFERENCE_LAUNCH_WEBSERVICE_EXPLORER, defaults.launchWebserviceExplorerDefault() );
- setDefaultBooleanIfNoDefault(PREFERENCE_INSTALL_WEBSERVICE, defaults.installWebserviceDefault() );
- setDefaultBooleanIfNoDefault(PREFERENCE_INSTALL_CLIENT, defaults.installClientDefault() );
- setDefaultBooleanIfNoDefault(PREFERENCE_START_WEBSERVICE, defaults.startWebserviceDefault() );
- setDefaultBooleanIfNoDefault(PREFERENCE_TEST_WEBSERVICE, defaults.testWebserviceDefault() );
- setDefaultBooleanIfNoDefault(PREFERENCE_MONITOR_WEBSERVICE, defaults.getMonitorWebServiceDefault());
- setDefaultBooleanIfNoDefault(PREFERENCE_LAUNCH_SAMPLE, defaults.launchSample() );
-
- setDefaultIntIfNoDefault(PREFERENCE_GENERATE_WEBSERVICE, defaults.serviceGenerationDefault()); //jvh
- setDefaultIntIfNoDefault(PREFERENCE_GENERATE_CLIENT, defaults.clientGenerationDefault());
- }
-
- public String[] getNonJavaTestService()
- {
- WebServiceTestRegistry registry = WebServiceTestRegistry.getInstance();
- String[] testTypes = getWebServiceTestTypes();
- Vector newTestCases = new Vector();
- for (int i = 0; i < testTypes.length; i++)
- {
- WebServiceTestExtension wse = (WebServiceTestExtension) registry
- .getWebServiceExtensionsByName(testTypes[i]);
- if (wse.testWSDL())
- newTestCases.addElement(testTypes[i]);
- }
- String[] wsdlTestArray = new String[newTestCases.size()];
- Enumeration e = newTestCases.elements();
- int i = 0;
- while(e.hasMoreElements()){
- wsdlTestArray[i] = (String)e.nextElement();
- i++;
- }
-
- return wsdlTestArray;
- }
-
- public void setWebServiceTestTypes(String[] ids)
- {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < ids.length; i++)
- {
- if (i != 0) sb.append(",");
- sb.append(ids[i]);
- }
- setValue(PREFERENCE_WEBSERVICE_TEST_TYPES, sb.toString());
- }
-
- public String[] getWebServiceTestTypes()
- {
- StringTokenizer st = new StringTokenizer(
- getValueAsString(PREFERENCE_WEBSERVICE_TEST_TYPES), ",");
- String[] s = new String[st.countTokens()];
- for (int i = 0; i < s.length; i++)
- s[i] = st.nextToken();
- return s;
- }
-
- public ScenarioContext copy()
- {
- TransientScenarioContext context = new TransientScenarioContext();
- context.setWebServiceTestTypes(getWebServiceTestTypes());
- context.setNonJavaTestService(getNonJavaTestService());
-
- context.setClientWebServiceType( getClientWebServiceType() );
- context.setWebServiceType( getWebServiceType() );
- context.setLaunchWebServiceExplorer( getLaunchWebServiceExplorer() );
- context.setStartWebService( getStartWebService() );
- context.setGenerateProxy( getGenerateProxy() );
- context.setTestWebService( getTestWebService() );
- context.setMonitorWebService(getMonitorWebService());
- context.setLaunchSampleEnabled( isLaunchSampleEnabled() );
-
- return context;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getClientWebServiceType()
- */
- public String getClientWebServiceType()
- {
- return getValueAsString(PREFERENCE_CLIENT_WEBSERVICE_TYPE);
- }
-
- public String getClientWebServiceTypeDefault()
- {
- return getDefaultString(PREFERENCE_CLIENT_WEBSERVICE_TYPE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getGenerateProxy()
- */
- public boolean getGenerateProxy()
- {
- return getValueAsBoolean(PREFERENCE_GENERATE_PROXY);
- }
-
- public boolean getGenerateProxyDefault()
- {
- return getDefaultBoolean(PREFERENCE_GENERATE_PROXY);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getLaunchWebServiceExplorer()
- */
- public boolean getLaunchWebServiceExplorer()
- {
- return getValueAsBoolean(PREFERENCE_LAUNCH_WEBSERVICE_EXPLORER);
- }
-
- public boolean getLaunchWebServiceExplorerDefault()
- {
- return getDefaultBoolean(PREFERENCE_LAUNCH_WEBSERVICE_EXPLORER);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getStartWebService()
- */
- public boolean getStartWebService()
- {
- return getValueAsBoolean(PREFERENCE_START_WEBSERVICE);
- }
-
- public boolean getStartWebServiceDefault()
- {
- return getDefaultBoolean(PREFERENCE_START_WEBSERVICE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getInstallWebService()
- */
- public boolean getInstallWebService()
- {
- return getValueAsBoolean(PREFERENCE_INSTALL_WEBSERVICE);
- }
-
- public boolean getInstallWebServiceDefault()
- {
- return getDefaultBoolean(PREFERENCE_INSTALL_WEBSERVICE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getInstallWebService()
- */
- public boolean getInstallClient()
- {
- return getValueAsBoolean(PREFERENCE_INSTALL_CLIENT);
- }
-
- public boolean getInstallClientDefault()
- {
- return getDefaultBoolean(PREFERENCE_INSTALL_CLIENT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getTestWebService()
- */
- public boolean getTestWebService()
- {
- return getValueAsBoolean(PREFERENCE_TEST_WEBSERVICE);
- }
-
- public boolean getTestWebServiceDefault()
- {
- return getDefaultBoolean(PREFERENCE_TEST_WEBSERVICE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getWebServiceType()
- */
- public String getWebServiceType()
- {
- return getValueAsString(PREFERENCE_WEBSERVICE_TYPE);
- }
-
- public String getWebServiceTypeDefault()
- {
- return getDefaultString(PREFERENCE_WEBSERVICE_TYPE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setClientWebServiceType(java.lang.String)
- */
- public void setClientWebServiceType(String value)
- {
- setValue( PREFERENCE_CLIENT_WEBSERVICE_TYPE, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setGenerateProxy(boolean)
- */
- public void setGenerateProxy(boolean value)
- {
- setValue( PREFERENCE_GENERATE_PROXY, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setLaunchWebServiceExplorer(boolean)
- */
- public void setLaunchWebServiceExplorer(boolean value)
- {
- setValue( PREFERENCE_LAUNCH_WEBSERVICE_EXPLORER, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setInstallWebService(boolean)
- */
- public void setInstallWebService(boolean value)
- {
- setValue( PREFERENCE_INSTALL_WEBSERVICE, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setInstallWebService(boolean)
- */
- public void setInstallClient(boolean value)
- {
- setValue( PREFERENCE_INSTALL_CLIENT, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setStartWebService(boolean)
- */
- public void setStartWebService(boolean value)
- {
- setValue( PREFERENCE_START_WEBSERVICE, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setTestWebService(boolean)
- */
- public void setTestWebService(boolean value)
- {
- setValue( PREFERENCE_TEST_WEBSERVICE, value);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setWebServiceType(java.lang.String)
- */
- public void setWebServiceType(String value)
- {
- setValue( PREFERENCE_WEBSERVICE_TYPE, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getMonitorWebService()
- */
- public boolean getMonitorWebService()
- {
- return getValueAsBoolean(PREFERENCE_MONITOR_WEBSERVICE);
- }
-
- public boolean getMonitorWebServiceDefault()
- {
- return getDefaultBoolean(PREFERENCE_MONITOR_WEBSERVICE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setMonitorWebService(boolean)
- */
- public void setMonitorWebService(boolean value)
- {
- setValue(PREFERENCE_MONITOR_WEBSERVICE, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getLaunchSampleEnabledDefault()
- */
- public boolean getLaunchSampleEnabledDefault()
- {
- return getDefaultBoolean(PREFERENCE_LAUNCH_SAMPLE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#isLaunchSampleEnabled()
- */
- public boolean isLaunchSampleEnabled()
- {
- return getValueAsBoolean(PREFERENCE_LAUNCH_SAMPLE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setLaunchSampleEnabled(boolean)
- */
- public void setLaunchSampleEnabled(boolean value)
- {
- setValue( PREFERENCE_LAUNCH_SAMPLE, value);
- }
-
- //jvh
- public int getGenerateWebService()
- {
- return getValueAsInt(PREFERENCE_GENERATE_WEBSERVICE);
- }
-
- public int getGenerateWebServiceDefault()
- {
- return getDefaultInt(PREFERENCE_GENERATE_WEBSERVICE);
- }
-
- public void setGenerateWebService(int value)
- {
- setValue(PREFERENCE_GENERATE_WEBSERVICE, value);
- }
-
- public int getGenerateClientDefault()
- {
- return getDefaultInt(PREFERENCE_GENERATE_CLIENT);
- }
-
- public int getGenerateClient()
- {
- return getValueAsInt(PREFERENCE_GENERATE_CLIENT);
- }
-
- public void setGenerateClient(int value)
- {
- setValue(PREFERENCE_GENERATE_CLIENT, value);
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentUDDIPreferenceContext.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentUDDIPreferenceContext.java
deleted file mode 100644
index f5888125b..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/PersistentUDDIPreferenceContext.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.context;
-
-import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
-import org.eclipse.wst.command.internal.env.context.PersistentContext;
-
-
-public class PersistentUDDIPreferenceContext extends PersistentContext implements UDDIPreferenceContext
-{
- public PersistentUDDIPreferenceContext()
- {
- super(WebServicePlugin.getInstance());
- }
-
- public void load()
- {
- setDefault(PREFERENCE_UDDI_CAT_DATA_COLUMN_DELIMITER, UDDIPreferenceDefaults.getUddiCatDataColumnDelimiter());
- setDefault(PREFERENCE_UDDI_CAT_DATA_STRING_DELIMITER, UDDIPreferenceDefaults.getUddiCatDataStringDelimiter());
- }
-
- public void setUddiCatDataColumnDelimiter(String delimiter)
- {
- setValue(PREFERENCE_UDDI_CAT_DATA_COLUMN_DELIMITER, delimiter);
- }
-
- public String getUddiCatDataColumnDelimiter()
- {
- return getValueAsString(PREFERENCE_UDDI_CAT_DATA_COLUMN_DELIMITER);
- }
-
- public void setUddiCatDataStringDelimiter(String delimiter)
- {
- setValue(PREFERENCE_UDDI_CAT_DATA_STRING_DELIMITER, delimiter);
- }
-
- public String getUddiCatDataStringDelimiter()
- {
- return getValueAsString(PREFERENCE_UDDI_CAT_DATA_STRING_DELIMITER);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioContext.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioContext.java
deleted file mode 100644
index 6f8725edd..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioContext.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.context;
-
-public interface ScenarioContext
-{
- public final String PREFERENCE_WEBSERVICE_TEST_TYPES = "webServiceTestTypes";
-
- public final String PREFERENCE_NON_JAVA_TEST_SERVICE= "nonJavaTestService";
-
- public final String PREFERENCE_WEBSERVICE_TYPE = "webServiceType";
-
- public final String PREFERENCE_START_WEBSERVICE = "startWebService";
-
- public final String PREFERENCE_INSTALL_WEBSERVICE = "installWebService";
-
- public final String PREFERENCE_INSTALL_CLIENT = "installClient";
-
- public final String PREFERENCE_LAUNCH_WEBSERVICE_EXPLORER = "launchWebServiceExplorer";
-
- public final String PREFERENCE_GENERATE_PROXY = "generateProxy";
-
- public final String PREFERENCE_CLIENT_WEBSERVICE_TYPE = "clientWebServiceType";
-
- public final String PREFERENCE_TEST_WEBSERVICE = "testWebService";
-
- public final String PREFERENCE_MONITOR_WEBSERVICE = "monitorWebService";
-
- public final String PREFERENCE_LAUNCH_SAMPLE = "launchSample";
-
- public final String PREFERENCE_GENERATE_WEBSERVICE = "generateWebService"; //jvh
- public final String PREFERENCE_GENERATE_CLIENT = "generateClient"; //jvh
-
- public final static int WS_TEST=0;
- public final static int WS_START=1;
- public final static int WS_INSTALL=2;
- public final static int WS_DEPLOY=3;
- public final static int WS_ASSEMBLE=4;
- public final static int WS_DEVELOP=5;
- public final static int WS_NONE=6;
-
- public String[] getWebServiceTestTypes();
- public void setWebServiceTestTypes(String[] testTypes);
-
- public String[] getNonJavaTestService();
-
- public String getWebServiceType();
- public String getWebServiceTypeDefault();
- public void setWebServiceType( String value );
-
- public boolean getInstallWebService();
- public boolean getInstallWebServiceDefault();
- public void setInstallWebService( boolean value );
-
- public boolean getInstallClient();
- public boolean getInstallClientDefault();
- public void setInstallClient( boolean value );
-
- public boolean getStartWebService();
- public boolean getStartWebServiceDefault();
- public void setStartWebService( boolean value );
-
- public boolean getLaunchWebServiceExplorer();
- public boolean getLaunchWebServiceExplorerDefault();
- public void setLaunchWebServiceExplorer( boolean value );
-
- public boolean getGenerateProxy();
- public boolean getGenerateProxyDefault();
- public void setGenerateProxy( boolean value );
-
- public String getClientWebServiceType();
- public String getClientWebServiceTypeDefault();
- public void setClientWebServiceType( String value );
-
- public boolean getTestWebService();
- public boolean getTestWebServiceDefault();
- public void setTestWebService( boolean value );
-
- public boolean getMonitorWebService();
- public boolean getMonitorWebServiceDefault();
- public void setMonitorWebService(boolean value);
-
- public boolean isLaunchSampleEnabled();
- public boolean getLaunchSampleEnabledDefault();
- public void setLaunchSampleEnabled( boolean value );
-
- public int getGenerateWebServiceDefault();
- public int getGenerateWebService();
- public void setGenerateWebService(int value);
-
- public int getGenerateClientDefault();
- public int getGenerateClient();
- public void setGenerateClient(int value);
-
- public ScenarioContext copy();
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java
deleted file mode 100644
index 2ed3f5643..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.context;
-
-
-import org.eclipse.jst.ws.internal.data.LabelsAndIds;
-import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry;
-
-
-
-public class ScenarioDefaults
-{
-
-
- public String[] getWebServiceTestTypes()
- {
- //we will set the home grown sample as the first choice
- WebServiceTestRegistry testRegistry = WebServiceTestRegistry.getInstance();
-
- LabelsAndIds labelsandids = testRegistry.getLabelsAndIDs();
- String[] labels = labelsandids.getLabels_();
- String[] ids = labelsandids.getIds_();
-
- String[] newNames = new String[labels.length];
- int index = -1;
- for(int i = 0;i<ids.length;i++){
- if(ids[i].equals("org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WebServiceSampleTest"))
- index = i;
- }
- if(index != -1){
- newNames[0] = labels[index];
- int j = 1;
- for(int i = 0;i<labels.length;i++){
- if(i != index){
- newNames[j] = labels[i];
- j++;
- }
- }
- }
- else return labels;
-
- return newNames;
- }
-
- public String getNonJavaTestServiceDefault()
- {
- return "Web Services Explorer";
- }
-
- public String webserviceTypeIdDefault()
- {
- return "0/org.eclipse.jst.ws.wsImpl.java";
- }
-
- public int serviceGenerationDefault()
- {
- return ScenarioContext.WS_START;
- }
-
- public int clientGenerationDefault()
- {
- return ScenarioContext.WS_NONE;
- }
-
- public boolean startWebserviceDefault()
- {
- return true;
- }
-
- public boolean installWebserviceDefault()
- {
- return true;
- }
-
- public boolean installClientDefault()
- {
- return true;
- }
-
- public boolean launchWebserviceExplorerDefault()
- {
- return false;
- }
-
- public boolean generateProxyDefault()
- {
- return false;
- }
-
- public String webserviceClientTypeDefault()
- {
- return "org.eclipse.jst.ws.client.type.java";
- }
-
- public boolean testWebserviceDefault()
- {
- return false;
- }
-
- public boolean getMonitorWebServiceDefault()
- {
- return false;
- }
-
- public boolean launchSample()
- {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/TransientScenarioContext.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/TransientScenarioContext.java
deleted file mode 100644
index d1701982e..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/TransientScenarioContext.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.context;
-
-public class TransientScenarioContext implements ScenarioContext
-{
- private String[] webServiceTestTypes;
- private String[] nonJavaTestService;
- private String webServiceType_;
- private boolean installWebService_;
- private boolean installClient_;
- private boolean startWebService_;
- private boolean launchWebServiceExplorer_;
- private boolean generateProxy_;
- private String clientWebServiceType_;
- private boolean testWebService_;
- private boolean monitorWebService;
- private boolean launchSample_;
- private int generateWebService_; //jvh
- private int generateClient_; //jvh
-
- private ScenarioDefaults defaults = new ScenarioDefaults();
-
- public TransientScenarioContext () {}
-
- public String[] getNonJavaTestService()
- {
- return nonJavaTestService;
- }
-
- public void setNonJavaTestService(String[] nonJavaTestService)
- {
- this.nonJavaTestService = nonJavaTestService;
- }
-
- public void setWebServiceTestTypes(String[] webServiceTestTypes)
- {
- this.webServiceTestTypes = webServiceTestTypes;
- }
-
- public String[] getWebServiceTestTypes()
- {
- return webServiceTestTypes;
- }
-
- public ScenarioContext copy() {
- TransientScenarioContext context = new TransientScenarioContext();
- context.setWebServiceTestTypes(getWebServiceTestTypes());
- context.setNonJavaTestService(getNonJavaTestService());
-
- context.setWebServiceType( getWebServiceType() );
- context.setClientWebServiceType( getClientWebServiceType() );
- context.setGenerateProxy( getGenerateProxy() );
- context.setLaunchWebServiceExplorer( getLaunchWebServiceExplorer() );
- context.setInstallWebService( getInstallWebService() );
- context.setInstallClient( getInstallClient() );
- context.setStartWebService( getStartWebService() );
- context.setTestWebService( getTestWebService() );
- context.setMonitorWebService(getMonitorWebService());
- context.setLaunchSampleEnabled( isLaunchSampleEnabled() );
- context.setGenerateWebService(getGenerateWebService()); //jvh
- return context;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getClientWebServiceType()
- */
- public String getClientWebServiceType()
- {
- return clientWebServiceType_;
- }
-
- public String getClientWebServiceTypeDefault(){ return defaults.webserviceClientTypeDefault(); }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getGenerateProxy()
- */
- public boolean getGenerateProxy()
- {
- return generateProxy_;
- }
-
- public boolean getGenerateProxyDefault(){ return defaults.generateProxyDefault(); }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getLaunchWebServiceExplorer()
- */
- public boolean getLaunchWebServiceExplorer()
- {
- return launchWebServiceExplorer_;
- }
-
- public boolean getLaunchWebServiceExplorerDefault(){ return defaults.launchWebserviceExplorerDefault(); }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getInstallWebService()
- */
- public boolean getInstallWebService()
- {
- return installWebService_;
- }
-
- public boolean getInstallWebServiceDefault(){ return defaults.installWebserviceDefault(); }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getInstallWebService()
- */
- public boolean getInstallClient()
- {
- return installClient_;
- }
-
- public boolean getInstallClientDefault(){ return defaults.installClientDefault(); }
-
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getStartWebService()
- */
- public boolean getStartWebService()
- {
- return startWebService_;
- }
-
- public boolean getStartWebServiceDefault(){ return defaults.startWebserviceDefault(); }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getTestWebService()
- */
- public boolean getTestWebService()
- {
- return testWebService_;
- }
-
- public boolean getTestWebServiceDefault(){ return defaults.testWebserviceDefault(); }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getWebServiceType()
- */
- public String getWebServiceType()
- {
- return webServiceType_;
- }
-
- public String getWebServiceTypeDefault(){ return defaults.webserviceTypeIdDefault(); }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setClientWebServiceType(java.lang.String)
- */
- public void setClientWebServiceType(String value)
- {
- clientWebServiceType_ = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setGenerateProxy(boolean)
- */
- public void setGenerateProxy(boolean value)
- {
- generateProxy_ = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setLaunchWebServiceExplorer(boolean)
- */
- public void setLaunchWebServiceExplorer(boolean value)
- {
- launchWebServiceExplorer_ = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setInstallWebService(boolean)
- */
- public void setInstallWebService(boolean value)
- {
- installWebService_ = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setInstallWebService(boolean)
- */
- public void setInstallClient(boolean value)
- {
- installClient_ = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setStartWebService(boolean)
- */
- public void setStartWebService(boolean value)
- {
- startWebService_ = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setTestWebService(boolean)
- */
- public void setTestWebService(boolean value)
- {
- testWebService_ = value;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setWebServiceType(java.lang.String)
- */
- public void setWebServiceType(String value)
- {
- webServiceType_ = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getMonitorWebService()
- */
- public boolean getMonitorWebService()
- {
- return monitorWebService;
- }
-
- public boolean getMonitorWebServiceDefault()
- {
- return defaults.getMonitorWebServiceDefault();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setMonitorWebService(boolean)
- */
- public void setMonitorWebService(boolean value)
- {
- monitorWebService = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#getLaunchSampleEnabledDefault()
- */
- public boolean getLaunchSampleEnabledDefault()
- {
- return defaults.launchSample();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#isLaunchSampleEnabled()
- */
- public boolean isLaunchSampleEnabled()
- {
- return launchSample_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.context.ScenarioContext#setLaunchSampleEnabled(boolean)
- */
- public void setLaunchSampleEnabled(boolean value)
- {
- launchSample_ = value;
- }
-
- public void setGenerateWebService(int value)
- {
- generateWebService_ = value;
- }
-
- public int getGenerateWebServiceDefault()
- {
- return defaults.serviceGenerationDefault();
- }
-
- public int getGenerateWebService()
- {
- return generateWebService_;
- }
-
- public int getGenerateClientDefault()
- {
- return defaults.clientGenerationDefault();
- }
-
- public int getGenerateClient()
- {
- return generateClient_;
- }
-
- public void setGenerateClient(int value)
- {
- generateClient_ = value;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceContext.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceContext.java
deleted file mode 100644
index a24addb41..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceContext.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.context;
-
-public interface UDDIPreferenceContext
-{
- /*
- * This constant String is used to lookup the column delimiter for user-defined UDDI
- * Category data.
- */
- public static final String PREFERENCE_UDDI_CAT_DATA_COLUMN_DELIMITER = "uddiCatDataColumnDelimiter";
-
- /*
- * This constant String is used to lookup the string delimiter for user-defined UDDI
- * Category data.
- */
- public static final String PREFERENCE_UDDI_CAT_DATA_STRING_DELIMITER = "uddiCatDataStringDelimiter";
-
- public void setUddiCatDataColumnDelimiter(String delimiter);
- public String getUddiCatDataColumnDelimiter();
- public void setUddiCatDataStringDelimiter(String delimiter);
- public String getUddiCatDataStringDelimiter();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceDefaults.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceDefaults.java
deleted file mode 100644
index 39eba91a8..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/UDDIPreferenceDefaults.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.internal.context;
-
-public class UDDIPreferenceDefaults
-{
- public static final String getUddiCatDataColumnDelimiter()
- {
- return "#";
- }
-
- public static final String getUddiCatDataStringDelimiter()
- {
- return "\"";
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/LabelsAndIds.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/LabelsAndIds.java
deleted file mode 100644
index 4bd0f64e4..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/LabelsAndIds.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/**
- */
-package org.eclipse.jst.ws.internal.data;
-
-public class LabelsAndIds
-{
- private String[] labels_;
- private String[] ids_;
-
- /**
- * @return Returns the ids_.
- */
- public String[] getIds_()
- {
- return ids_;
- }
- /**
- * @param ids_ The ids_ to set.
- */
- public void setIds_(String[] ids_)
- {
- this.ids_ = ids_;
- }
- /**
- * @return Returns the labels_.
- */
- public String[] getLabels_()
- {
- return labels_;
- }
- /**
- * @param labels_ The labels_ to set.
- */
- public void setLabels_(String[] labels_)
- {
- this.labels_ = labels_;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/TypeRuntimeServer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/TypeRuntimeServer.java
deleted file mode 100644
index 25b44417c..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/data/TypeRuntimeServer.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner
- *******************************************************************************/
-/**
- */
-package org.eclipse.jst.ws.internal.data;
-
-public class TypeRuntimeServer
-{
- private String typeId_ = "";
- private String runtimeId_ = "";
- private String serverId_ = "";
- private String serverInstanceId_;
-
- /**
- * @return Returns the runtimeId_.
- */
- public String getRuntimeId()
- {
- return runtimeId_;
- }
- /**
- * @param runtimeId_ The runtimeId_ to set.
- */
- public void setRuntimeId(String runtimeId_)
- {
- this.runtimeId_ = runtimeId_;
- }
- /**
- * @return Returns the serverId_.
- */
- public String getServerId()
- {
- return serverId_;
- }
- /**
- * @param serverId_ The serverId_ to set.
- */
- public void setServerId(String serverId_)
- {
- this.serverId_ = serverId_;
- }
- /**
- * @return Returns the serverInstanceId_.
- */
- public String getServerInstanceId()
- {
- return serverInstanceId_;
- }
- /**
- * @param serverInstanceId_ The serverInstanceId_ to set.
- */
- public void setServerInstanceId(String serverInstanceId_)
- {
- this.serverInstanceId_ = serverInstanceId_;
- }
- /**
- * @return Returns the typeId_.
- */
- public String getTypeId()
- {
- return typeId_;
- }
- /**
- * @param typeId_ The typeId_ to set.
- */
- public void setTypeId(String typeId_)
- {
- this.typeId_ = typeId_;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return "type(" + typeId_ + ") runtime(" + runtimeId_ + ") factory(" + serverId_ + ") servInstId(" + serverInstanceId_ + ")";
- }
-
- public boolean equals(Object object)
- {
- if (object != null && object instanceof TypeRuntimeServer)
- {
- TypeRuntimeServer trs = (TypeRuntimeServer)object;
- String trsTypeId = trs.getTypeId();
- String trsRuntimeId = trs.getRuntimeId();
- String trsServerId = trs.getServerId();
- String trsServerInstanceId = trs.getServerInstanceId();
-
- boolean typeIdsMatch = ((typeId_ == null) && (trsTypeId == null)) || ((typeId_ != null) && (typeId_.equals(trsTypeId)));
- if (!typeIdsMatch) return false;
- boolean runtimeIdsMatch = ((runtimeId_ == null) && (trsRuntimeId == null)) || ((runtimeId_ != null) && (runtimeId_.equals(trsRuntimeId)));
- if (!runtimeIdsMatch) return false;
- boolean serverIdsMatch = ((serverId_ == null) && (trsServerId == null)) || ((serverId_ != null) && (serverId_.equals(trsServerId)));
- if (!serverIdsMatch) return false;
- boolean serverInstanceIdsMatch = ((serverInstanceId_ == null) && (trsServerInstanceId == null)) || ((serverInstanceId_ != null) && (serverInstanceId_.equals(trsServerInstanceId)));
- if (!serverInstanceIdsMatch) return false;
-
- return true;
- }
-
- return false;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/dialog/IStatusDialogConstants.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/dialog/IStatusDialogConstants.java
deleted file mode 100644
index 5831b233a..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/dialog/IStatusDialogConstants.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.dialog;
-
-/**
-* Constants for status dialogs
-*/
-public interface IStatusDialogConstants {
-
- /*
- * Button ID for the "Yes" button
- */
- public static final int YES_ID = 2;
- /*
- * Button ID for the "Yes to all" button
- */
- public static final int YES_TO_ALL_ID = 4;
- /*
- * Button ID for the "Cancel" button
- */
- public static final int CANCEL_ID = 1;
- /*
- * Button ID for the "OK" button
- */
- public static final int OK_ID = 0;
- /*
- * Button ID for the "Details" button
- */
- public static final int DETAILS_ID = 13;
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExecutable.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExecutable.java
deleted file mode 100644
index 9660fbb82..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExecutable.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext;
-
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-
-/**
-* All Extensions with exectutable extensions should implement this
-* to fit our framework
-*/
-public interface WebServiceExecutable
-{
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
- /**
- *Returns a wizard fragment for this exention type
- *
- */
- public AbstractDataModelOperation getFinishCommand();
-}
-
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtension.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtension.java
deleted file mode 100644
index 4332d0a74..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtension.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-
-/**
-* This represents an extension in the plugin registry
-* It job is to act as a proxy to the iconfigelement
-*/
-public interface WebServiceExtension
-{
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- /**
- * If the extension has code that needs to be executed or a fragment added
- * @return WebServiceExecutable this interface holds executable code and a
- * fragment
- */
- public Object getWebServiceExecutableExtension();
-
- /**
- * This is the config element that holds the extension info
- * @param IConfigurationElement Extension element
- */
- public void setConfigElement(IConfigurationElement configElement);
-
- /**
- * If the extension has code that
- * @return IConfigurationElement Extension element
- */
- public IConfigurationElement getConfigElement();
-}
-
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionImpl.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionImpl.java
deleted file mode 100644
index 7d9d92fe5..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionImpl.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.wst.common.environment.EnvironmentService;
-import org.eclipse.wst.common.environment.ILog;
-
-
-
-
-
-/**
-* This represents an extension in the plugin registry
-* It job is to act as a proxy to the iconfigelement
-*/
-public class WebServiceExtensionImpl implements WebServiceExtension
-{
-
- private ILog log_;
-
- /*
- * The ConfigElement that holds extension info
- */
- protected IConfigurationElement configElement_;
-
- /*
- * The extension executable
- */
- protected WebServiceExecutable webServiceExecutable_;
-
-
- public WebServiceExtensionImpl(IConfigurationElement configElement)
- {
- configElement_ = configElement;
- log_ = EnvironmentService.getEclipseLog();
- }
-
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- /**
- * If the extension has code that needs to be executed or a fragment added
- * @return WebServiceExecutable this interface holds executable code and a
- * fragment
- */
- public Object getWebServiceExecutableExtension()
- {
- if(webServiceExecutable_ != null) return webServiceExecutable_;
-
- try{
- return configElement_.createExecutableExtension("class");
- }catch (CoreException e){
- log_.log(ILog.ERROR, 5029, this, "getWebServiceExecutableExtension",e);
- }
-
- return null;
- }
-
- /**
- * This is the config element that holds the extension info
- * @param IConfigurationElement Extension element
- */
- public void setConfigElement(IConfigurationElement configElement)
- {
- configElement_ = configElement;
- }
-
- /**
- * This is the config element that holds the extension info
- * @return IConfigurationElement Extension element
- */
- public IConfigurationElement getConfigElement()
- {
- return configElement_;
- }
-
- /**
- * The name of the extension being used
- * @return String name of this extension
- */
- public String getName()
- {
- return getConfigElement().getAttribute( "name" );
- }
-
-
-}
-
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistry.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistry.java
deleted file mode 100644
index afc1d0721..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistry.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext;
-
-
-/**
-* Returns the names of the extensions for a given extension-point
-* also returns the extension objects
-*
-*/
-public interface WebServiceExtensionRegistry
-{
-
- /**
- * Returns the names of all registered extensions
- * @return The names of all registered extensions.
- */
- public String[] getWebServiceExtensionNames ();
-
- /**
- * Returns the extension object of the given name
- *@return WebServiceExtension object
- */
- public WebServiceExtension getWebServiceExtensionsByName( String name);
-
- /**
- * Returns All extention objects in this registry
- *@return WebServiceExtension objects
- */
- public WebServiceExtension[] getWebServiceExtensions();
-
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java
deleted file mode 100644
index 46bea11f7..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext;
-
-import java.util.Hashtable;
-import java.util.Vector;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jst.ws.internal.data.LabelsAndIds;
-
-
-/**
-* This is a generic registry which sets up general code in handling
-* IConfigElements for an extension
-*/
-public abstract class WebServiceExtensionRegistryImpl implements WebServiceExtensionRegistry
-{
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- protected Hashtable nameExtensionTable_;
- protected Vector id_;
- protected Vector label_;
- private LabelsAndIds labelsandids_;
-
- public WebServiceExtensionRegistryImpl()
- {
- nameExtensionTable_ = new Hashtable();
- label_ = new Vector();
- id_ = new Vector();
- loadExtensions();
- }
-
- /**
- * Children registries will have different extension types
- * @return WebserviceExtension holds a config elem
- * for that extension capable of creating an executable file
- */
- public abstract WebServiceExtension createWebServiceExtension(IConfigurationElement configElement);
-
- /**
- * Children must implement how they get the IConfigurationElement[]
- * @return IConfigurationElement[] an array of elements particular to that
- * extension
- */
- public abstract IConfigurationElement[] getConfigElements();
-
- /*
- * Loads WebServiceExtensions for WebServiceClientTest into this registry.
- * This is done by querying the plugin registry for all extensions
- * that extend webServiceClientTest
- */
- protected void loadExtensions ()
- {
- IConfigurationElement[] config = getConfigElements();
-
- for(int idx=0; idx<config.length; idx++)
- {
- IConfigurationElement elem = config[idx];
- String label = elem.getAttribute( "label" );
- String id = elem.getAttribute( "id" );
- WebServiceExtension webServiceExtension = createWebServiceExtension(elem);
- nameExtensionTable_.put(label,webServiceExtension);
- label_.add(label);
- id_.add(id);
- }
- }
-
- /**
- * Returns the names of all registered extensions
- * @return The names of all registered extensions.
- */
- public String[] getWebServiceExtensionNames ()
- {
- return (String[])nameExtensionTable_.keySet().toArray( new String[0] );
- }
-
- /**
- * Return the names and Ids
- */
- public LabelsAndIds getLabelsAndIDs()
- {
- labelsandids_ = new LabelsAndIds();
- labelsandids_.setLabels_((String[])label_.toArray( new String[0] ));
- labelsandids_.setIds_((String[])id_.toArray( new String[0] ));
- return labelsandids_;
- }
-
- /**
- * Returns the extension object of the given name
- * @return WebServiceExtension object
- */
- public WebServiceExtension getWebServiceExtensionsByName( String name)
- {
- return (WebServiceExtension)nameExtensionTable_.get(name);
- }
-
- /**
- * Returns All extention objects in this registry
- *@return WebServiceExtension objects
- */
- public WebServiceExtension[] getWebServiceExtensions()
- {
- return (WebServiceExtension[])nameExtensionTable_.values().toArray( new WebServiceExtension[0] );
- }
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/JavaProxyTestCommand.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/JavaProxyTestCommand.java
deleted file mode 100644
index 4eae34196..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/JavaProxyTestCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext.test;
-
-import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection;
-
-public interface JavaProxyTestCommand extends WebServiceTestFinishCommand
-{
-
- /**
- * This holds an info class that comes from user input or some calcilations that needs to be
- * used for the finish
- */
-
- public void setJspFolder(String jspFolder);
-
- public void setRunClientTest(boolean runClientTest);
-
- public void setSampleProject(String sampleProject);
-
- public void setProxyBean(String proxyBean);
-
- public void setSetEndpointMethod(String setEndpointMethod);
-
- public void setClientProject(String clientProject);
-
- public void setMethods(BooleanSelection[] methods);
-
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WSDLTestFinishCommand.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WSDLTestFinishCommand.java
deleted file mode 100644
index 1b29e53d4..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WSDLTestFinishCommand.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext.test;
-
-public interface WSDLTestFinishCommand extends WebServiceTestFinishCommand
-{
- public void setServiceProject(String serverProject);
- public void setWsdlServiceURL(String wsdlURI);
- public void setExternalBrowser(boolean external);
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java
deleted file mode 100644
index 288193988..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060816 104870 kathy@ca.ibm.com - Kathy Chan
- * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jst.ws.internal.ext.WebServiceExtensionImpl;
-
-
-
-/**
-* This represents an extension in the plugin registry
-* It job is to act as a proxy to the iconfigelement
-* In particular it holds a client test extension element
-*/
-public class WebServiceTestExtension extends WebServiceExtensionImpl
-{
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- private List supportedRuntimes_ = new ArrayList();
-
- public WebServiceTestExtension(IConfigurationElement configElement)
- {
- super(configElement);
-
- String runtimesList = getConfigElement().getAttribute("supportedClientRuntimes");
-
- addRuntimes(runtimesList);
- }
-
- /**
- * Adds a list of space delimited runtime IDs.
- *
- * @param runtimesList The list of runtime IDs.
- */
- public void addRuntimes(String runtimesList) {
-
- if (runtimesList == null)
- return;
-
- String[] runtimes = runtimesList.split("\\s+");
-
- for (int i = 0; i < runtimes.length; i++) {
- if (runtimes[i].length() > 0)
- supportedRuntimes_.add(runtimes[i]);
- }
- }
-
- /**
- * Will this testClient generate code
- * @return boolean true if codegen needed
- */
- public boolean isCodeGenNeeded()
- {
- return Boolean.valueOf(getConfigElement().getAttribute( "codeGenerated" )).booleanValue();
- }
-
- /**
- * Use the default Folder Provided by us
- * @return boolean true if no special folder requires
- */
- public boolean useDefaultCodeGenFolder()
- {
- return Boolean.valueOf(getConfigElement().getAttribute( "defaultcodegenfolder" )).booleanValue();
- }
-
- /**
- * Use Special Folder for generated code
- * @return String special folder name
- */
- public String getCodeGenFolder()
- {
- return getConfigElement().getAttribute( "codegenfolder" );
- }
-
- /**
- * Do we need to launch something
- * @return Boolean if true launch codegen
- */
- public boolean isLaunchRequired()
- {
- return Boolean.valueOf(getConfigElement().getAttribute( "launchRequired" )).booleanValue();
- }
-
- /**
- * Do we need the methods for the proxy
- * @return boolean true if proxy methods needed
- */
- public boolean areMethodsNeeded()
- {
- return Boolean.valueOf(getConfigElement().getAttribute( "methodsneeded" )).booleanValue();
- }
-
- /**
- * Does this test machine need a server
- * @return boolean true if a server is required
- */
- public boolean isServerNeeded()
- {
- return Boolean.valueOf(getConfigElement().getAttribute( "serverRequired" )).booleanValue();
- }
-
- /**
- * Use the Default Server chosen by the wizard
- * @return boolean true if the default server is wanted
- */
- public boolean useDefaultServer()
- {
- return Boolean.valueOf(getConfigElement().getAttribute( "defaultserver" )).booleanValue();
- }
-
- /**
- * Use the Default Server chosen by the wizard
- * @return boolean true if the default server is wanted
- */
- public String useServer()
- {
- return getConfigElement().getAttribute( "useserver" );
- }
-
- public boolean testWSDL()
- {
- String wsdl = getConfigElement().getAttribute( "testWSDL" );
- if(wsdl.equals("yes") || wsdl.equals("true"))
- return true;
-
- return false;
- }
-
- /**
- * Returns the id attribute of this WebServiceTestExtension
- *
- * @return The value of the id attribute.
- */
- public String getId() {
- return getConfigElement().getAttribute( "id" );
- }
-
- /**
- * Does this extension allow extenders to restrict the runtimes that are supported?
- *
- * @return The value of the allowRunimesRestriction attribute, false if not present.
- */
- public boolean allowClientRuntimesRestriction() {
- return Boolean.valueOf(getConfigElement().getAttribute( "allowClientRuntimesRestriction" )).booleanValue();
- }
-
- /**
- * Determines if this WebServiceTestExtension supports the give client runtime ID.
- *
- * @return true if the client runtime ID is supported, false otherwise.
- */
- public boolean supportsRuntime(String runtimeId) {
-
- if (!allowClientRuntimesRestriction() || supportedRuntimes_.isEmpty())
- return true;
-
- return supportedRuntimes_.contains(runtimeId);
- }
-}
-
-
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestFinishCommand.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestFinishCommand.java
deleted file mode 100644
index 74193670b..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestFinishCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext.test;
-
-import java.util.List;
-import org.eclipse.wst.server.core.IServer;
-
-public interface WebServiceTestFinishCommand
-{
-
- /**
- * If the command needs a server this is the chosen
- * client serverID
- * @param sampleServerTypeID
- */
- public void setServerTypeID(String serviceServerTypeID);
-
- /**
- * This is the IServer if required
- * @param sampleExistingServer
- */
- public void setExistingServer(IServer serviceExistingServer);
-
- /**
- * This is the endpoints if monitor service is enabled
- * @param endpoints
- */
- public void setEndpoint(List endpoints);
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java
deleted file mode 100644
index fdb9adfaf..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.ext.test;
-
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jst.ws.internal.ext.WebServiceExtension;
-import org.eclipse.jst.ws.internal.ext.WebServiceExtensionRegistryImpl;
-
-public class WebServiceTestRegistry extends WebServiceExtensionRegistryImpl
-{
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
- /*
- * This is a singleton becasue it was decided that the memory foot print
- * is not as expensive as the time taken retrieving the data
- *
- */
-
-
- private static WebServiceTestRegistry wstr;
-
- public static WebServiceTestRegistry getInstance()
- {
- if(wstr == null) wstr = new WebServiceTestRegistry();
- return wstr;
- }
-
- private WebServiceTestRegistry()
- {
- super();
- }
-
- /**
- * Helper method to "join" an existing value and a new value together by
- * a space in between. Handles special case when either value is null.
- *
- * @param existingValue The existing value
- * @param newValue The new value
- * @return If eiter the existing or new value is null, simply returns the
- * new value as is (which could be null). Otherwise returns the value joined
- * by a space.
- */
- private String genNewValue(String existingValue, String newValue) {
-
- if (existingValue == null || newValue == null)
- return newValue;
-
- return existingValue + " " + newValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.ws.internal.ext.WebServiceExtensionRegistryImpl#loadExtensions()
- */
- protected void loadExtensions ()
- {
- // keep track of the support runtimes for each test facility ID
- Hashtable supportedClientRuntimes = new Hashtable();
-
- IConfigurationElement[] config = getConfigElements();
-
- for(int idx=0; idx<config.length; idx++)
- {
- IConfigurationElement elem = config[idx];
- String label = elem.getAttribute( "label" );
- String id = elem.getAttribute( "id" );
-
- // label is found, hence we have a master extension element
- if (label != null) {
- WebServiceExtension webServiceExtension = createWebServiceExtension(elem);
- nameExtensionTable_.put(label,webServiceExtension);
- label_.add(label);
- id_.add(id);
- }
-
- // slave extension element, which only has the id and supportedClientRuntimes attributes
- else {
- String existingValue = (String) supportedClientRuntimes.get(id);
- String newValue = genNewValue(existingValue, elem.getAttribute("supportedClientRuntimes"));
-
- if (newValue != null)
- supportedClientRuntimes.put(id, newValue);
- }
- }
-
- // merge any supportedClientRuntimes attributes from the slave elements back to the master elements
-
- Iterator iter = nameExtensionTable_.values().iterator();
-
- while (iter.hasNext()) {
- WebServiceTestExtension webServiceTestExtension = (WebServiceTestExtension) iter.next();
-
- // skip if the extension does not allow restriction on the supported client runtimes
- if (webServiceTestExtension.allowClientRuntimesRestriction()) {
- String id = webServiceTestExtension.getId();
- webServiceTestExtension.addRuntimes((String) supportedClientRuntimes.get(id));
- }
- }
- }
-
- /**
- * Children registries will have different extension types
- * @return WebserviceExtension holds a config elem
- * for that extension capable of creating an executable file
- */
- public WebServiceExtension createWebServiceExtension(IConfigurationElement configElement)
- {
- return new WebServiceTestExtension(configElement);
- }
-
- /**
- * Children must implement how they get the IConfigurationElement[]
- * @return IConfigurationElement[] an array of elements particular to that
- * extension
- */
- public IConfigurationElement[] getConfigElements()
- {
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] config = reg.getConfigurationElementsFor(
- "org.eclipse.jst.ws.consumption.ui",
- "tester");
- return config;
- }
-
-
-
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/plugin/WebServicePlugin.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/plugin/WebServicePlugin.java
deleted file mode 100644
index b520d136a..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/plugin/WebServicePlugin.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060424 115690 sengpl@ca.ibm.com - Seng Phung-Lu
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.plugin;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.jst.ws.internal.context.PersistentScenarioContext;
-import org.eclipse.jst.ws.internal.context.PersistentUDDIPreferenceContext;
-import org.eclipse.jst.ws.internal.context.ScenarioContext;
-import org.eclipse.jst.ws.internal.context.UDDIPreferenceContext;
-import org.eclipse.wst.command.internal.env.context.PersistentResourceContext;
-import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
-
-
-/**
-* This is the plugin class for the Web Services plugin.
-* <p>
-* This plugin contains the bulk of the Web Services runtime.
-* Only the graphical user interface portion of the runtime is
-* found elsewhere - in the org.eclipse.jst.ws.ui plugin.
-*/
-public class WebServicePlugin extends Plugin
-{
- /**
- * The identifier of the descriptor of this plugin in plugin.xml.
- */
- public static final String ID = "org.eclipse.jst.ws";
-
- /**
- * The reference to the singleton instance of this plugin.
- */
- private static WebServicePlugin instance_;
-
- private PersistentResourceContext resourceContext_;
- private PersistentScenarioContext scenarioContext_;
- private PersistentUDDIPreferenceContext uddiPreferenceContext;
-
- /**
- * Constructs a runtime plugin object for this plugin.
- */
- public WebServicePlugin()
- {
- super();
- instance_ = this;
- }
-
- /**
- * Returns the singleton instance of this plugin.
- * @return The WebServicePlugin singleton.
- */
- public static WebServicePlugin getInstance ()
- {
- return instance_;
- }
-
- protected void initializeDefaultPluginPreferences()
- {
- ((PersistentUDDIPreferenceContext) getUDDIPreferenceContext()).load();
- }
-
- public ResourceContext getResourceContext()
- {
- if (resourceContext_ == null)
- resourceContext_ = PersistentResourceContext.getInstance();
- return resourceContext_;
- }
-
- public ScenarioContext getScenarioContext()
- {
- if (scenarioContext_ == null)
- {
- scenarioContext_ = new PersistentScenarioContext();
- scenarioContext_.load();
- }
-
- return scenarioContext_;
- }
-
- public UDDIPreferenceContext getUDDIPreferenceContext()
- {
- if (uddiPreferenceContext == null)
- uddiPreferenceContext = new PersistentUDDIPreferenceContext();
- return uddiPreferenceContext;
- }
-
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaClientInfo.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaClientInfo.java
deleted file mode 100644
index 919002b0b..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaClientInfo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060620 147864 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.wsrt;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
-
-/**
- * This subclass of WebServiceClientInfo adds properties
- * relevant to descriptors of Java Web service clients.
- */
-public class WebServiceJavaClientInfo extends WebServiceClientInfo
-{
- private IType jdtType_;
-
- /**
- * Returns the JDT IType of the primary Java proxy class
- * of a Web service client, or null if no such class has
- * been located.
- * @return The JDT IType of the Java client proxy class.
- */
- public IType getType ()
- {
- return jdtType_;
- }
-
- /**
- * Sets the JDT IType of the primary Java proxy class
- * of a Web service client.
- * @param jdtType The JDT IType of the Java client proxy class.
- */
- public void setType ( IType jdtType )
- {
- jdtType_ = jdtType;
- }
-}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaInfo.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaInfo.java
deleted file mode 100644
index 66d9ec99b..000000000
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/wsrt/WebServiceJavaInfo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060620 147864 cbrealey@ca.ibm.com - Chris Brealey
- *******************************************************************************/
-
-package org.eclipse.jst.ws.internal.wsrt;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo;
-
-/**
- * This subclass of WebServiceInfo adds properties
- * relevant to descriptors of Java Web services.
- */
-public class WebServiceJavaInfo extends WebServiceInfo
-{
- private IType jdtType_;
-
- /**
- * Returns the JDT IType of the primary Java implementation
- * class of a Web service, or null if no such class has
- * been located.
- * @return The JDT IType of the Java implementation class.
- */
- public IType getType ()
- {
- return jdtType_;
- }
-
- /**
- * Sets the JDT IType of the primary Java implementation
- * class of a Web service.
- * @param jdtType The JDT IType of the Java implementation class.
- */
- public void setType ( IType jdtType )
- {
- jdtType_ = jdtType;
- }
-}

Back to the top