diff options
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator')
40 files changed, 0 insertions, 5683 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/application/ApplicationTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/application/ApplicationTranslator.java deleted file mode 100644 index 6385efc2e..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/application/ApplicationTranslator.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 1, 2003 - * - * To change this generated comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.model.translator.application; - -import org.eclipse.jst.j2ee.application.ApplicationPackage; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.xml.EarDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author dfholttp - * - * To change this generated comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class ApplicationTranslator extends RootTranslator implements EarDeploymentDescriptorXmlMapperI, J2EEConstants { - public static ApplicationTranslator INSTANCE = new ApplicationTranslator(); - private static Translator[] children13; - private static Translator[] children14; - private static ApplicationPackage APPLICATION_PKG = ApplicationPackage.eINSTANCE; - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - - public ApplicationTranslator() { - super(APPLICATION, ApplicationPackage.eINSTANCE.getApplication()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - protected Translator[] create13Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(ICON+"/"+SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), //$NON-NLS-1$ - new Translator(ICON+"/"+LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), //$NON-NLS-1$ - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new ModuleTranslator(), - CommonTranslators.createSecurityRoleTranslator13(APPLICATION_PKG.getApplication_SecurityRoles()), - }; - } - - protected Translator[] create14Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(VERSION, APPLICATION_PKG.getApplication_Version(), DOM_ATTRIBUTE), - new ConstantAttributeTranslator(XML_NS, J2EE_NS_URL), - new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL), - new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, J2EE_NS_URL+' '+APPLICATION_SCHEMA_LOC_1_4), - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new ModuleTranslator(), - CommonTranslators.createSecurityRoleTranslator14(APPLICATION_PKG.getApplication_SecurityRoles()), - }; - - } -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/application/ModuleTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/application/ModuleTranslator.java deleted file mode 100644 index 1ffd1e923..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/application/ModuleTranslator.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 1, 2003 - * - * To change this generated comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.model.translator.application; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.application.ApplicationFactory; -import org.eclipse.jst.j2ee.application.ApplicationPackage; -import org.eclipse.jst.j2ee.application.Module; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.xml.EarDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.ReadAheadHelper; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class ModuleTranslator extends Translator implements EarDeploymentDescriptorXmlMapperI { - private static final ApplicationPackage APPLICATION_PKG = ApplicationPackage.eINSTANCE; - - private static final Translator ALT_DD_TRANSLATOR = createAltDDTranslator(); - private static final Translator[] WEB_TRANSLATORS = createWebModuleTranslators(); - private static final Translator[] EJB_TRANSLATORS = createEJBModuleTranslators(); - private static final Translator[] JAVA_TRANSLATORS = createJavaModuleTranslators(); - private static final Translator[] CONNECTOR_TRANSLATORS = createConnectorModuleTranslators(); - //private static final - - /** - * @param domNameAndPath - * @param eClass - */ - public ModuleTranslator() { - super(MODULE, APPLICATION_PKG.getApplication_Modules()); - addReadAheadHelper(new ReadAheadHelper(MODULE, new String[] { EJB, JAVA, WEB, CONNECTOR }, null)); - } - - /** - * @return - */ - private static Translator[] createConnectorModuleTranslators() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(CONNECTOR, APPLICATION_PKG.getModule_Uri()), - ALT_DD_TRANSLATOR, - // CommonTranslators.createDeploymentExtensionTranslator(APPLICATION_PKG.getModule_Extensions()) - }; - } - - /** - * @return - */ - private static Translator[] createJavaModuleTranslators() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(JAVA, APPLICATION_PKG.getModule_Uri()), - ALT_DD_TRANSLATOR, - // CommonTranslators.createDeploymentExtensionTranslator(APPLICATION_PKG.getModule_Extensions()) - }; - } - - /** - * @return - */ - private static Translator[] createEJBModuleTranslators() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(EJB, APPLICATION_PKG.getModule_Uri()), - ALT_DD_TRANSLATOR, - // CommonTranslators.createDeploymentExtensionTranslator(APPLICATION_PKG.getModule_Extensions()) - }; - } - - /** - * @return - */ - private static Translator[] createWebModuleTranslators() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(WEB + "/" + WEB_URI, APPLICATION_PKG.getModule_Uri()), //$NON-NLS-1$ - new Translator(WEB + "/" + CONTEXT_ROOT, APPLICATION_PKG.getWebModule_ContextRoot()), //$NON-NLS-1$ - ALT_DD_TRANSLATOR, - // CommonTranslators.createDeploymentExtensionTranslator(APPLICATION_PKG.getModule_Extensions()) - }; - - } - - private static Translator createAltDDTranslator() { - return new Translator(ALT_DD, ApplicationPackage.eINSTANCE.getModule_AltDD()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - else if (((Module) o).isEjbModule()) - return EJB_TRANSLATORS; - else if (((Module) o).isConnectorModule()) - return CONNECTOR_TRANSLATORS; - else if (((Module) o).isWebModule()) - return WEB_TRANSLATORS; - else if (((Module) o).isJavaModule()) - return JAVA_TRANSLATORS; - else - throw new IllegalStateException("Internal error: Module Type excepted"); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - ApplicationFactory fact = ApplicationFactory.eINSTANCE; - if (EJB.equals(readAheadName)) - return fact.createEjbModule(); - else if (WEB.equals(readAheadName)) - return fact.createWebModule(); - else if (JAVA.equals(readAheadName)) - return fact.createJavaClientModule(); - else if (CONNECTOR.equals(readAheadName)) - return fact.createConnectorModule(); - else - return fact.createModule(); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#isManagedByParent() - */ - public boolean isManagedByParent() { - return false; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/client/ApplicationClientTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/client/ApplicationClientTranslator.java deleted file mode 100644 index 76f1f6e3c..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/client/ApplicationClientTranslator.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.client; - -import org.eclipse.jst.j2ee.client.ClientPackage; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.model.translator.common.EnvEntryTranslator; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class ApplicationClientTranslator extends RootTranslator implements DeploymentDescriptorXmlMapperI, J2EEConstants { - public static ApplicationClientTranslator INSTANCE = new ApplicationClientTranslator(); - public static final String CALLBACK_HANDLER = "callback-handler"; //$NON-NLS-1$ - public static final String APPLICATION_CLIENT = "application-client"; //$NON-NLS-1$ - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - private static Translator[] children13; - private static Translator[] children14; - - protected ApplicationClientTranslator() { - super(APPLICATION_CLIENT, ClientPackage.eINSTANCE.getApplicationClient()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - protected Translator[] create13Children() { - ClientPackage ePackageClient=ClientPackage.eINSTANCE; - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(SMALL_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new EnvEntryTranslator(ePackageClient.getApplicationClient_EnvironmentProps(), true, false), - CommonTranslators.createEJBRefTranslator13(ePackageClient.getApplicationClient_EjbReferences()), - CommonTranslators.createResourceRefTranslator13(ePackageClient.getApplicationClient_ResourceRefs()), - //J2EE 1.3 - CommonTranslators.createResourceEnvRefTranslator13(ePackageClient.getApplicationClient_ResourceEnvRefs()), - new JavaClassTranslator(CALLBACK_HANDLER, ePackageClient.getApplicationClient_CallbackHandler()), - }; - } - - protected Translator[] create14Children() { - ClientPackage ePackageClient=ClientPackage.eINSTANCE; - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(VERSION, ePackageClient.getApplicationClient_Version(), DOM_ATTRIBUTE), - new ConstantAttributeTranslator(XML_NS, J2EE_NS_URL), - new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL), - new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, J2EE_NS_URL+' '+APP_CLIENT_SCHEMA_LOC_1_4), - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new EnvEntryTranslator(ePackageClient.getApplicationClient_EnvironmentProps(), true, true), - CommonTranslators.createEJBRefTranslator14(ePackageClient.getApplicationClient_EjbReferences()), - CommonTranslators.createServiceRefGroupTranslator(ePackageClient.getApplicationClient_ServiceRefs()), - CommonTranslators.createResourceRefTranslator14(ePackageClient.getApplicationClient_ResourceRefs()), - CommonTranslators.createResourceEnvRefTranslator14(ePackageClient.getApplicationClient_ResourceEnvRefs()), - CommonTranslators.createMessageDestinationRefTranslator(ePackageClient.getApplicationClient_MessageDestinationRefs()), - new JavaClassTranslator(CALLBACK_HANDLER, ePackageClient.getApplicationClient_CallbackHandler()), - CommonTranslators.createMessageDestinationTranslator(ePackageClient.getApplicationClient_MessageDestinations()), - // CommonTranslators.createDeploymentExtensionTranslator(ePackageClient.getApplicationClient_DeploymentExtensions()) - }; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/BooleanTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/BooleanTranslator.java deleted file mode 100644 index 27885a25e..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/BooleanTranslator.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 21, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.model.translator.common; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author administrator - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class BooleanTranslator extends Translator { - - - /** - * @param domNameAndPath - * @param aFeature - */ - public BooleanTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature, BOOLEAN_LOWERCASE); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(java.lang.String, org.eclipse.emf.ecore.EObject) - */ - public Object convertStringToValue(String strValue, EObject owner) { - if (strValue == null) - return Boolean.FALSE; - else if (strValue.toUpperCase().equals("1") || strValue.toUpperCase().equals("YES")) //$NON-NLS-1$ //$NON-NLS-2$ - return Boolean.TRUE; - else - return Boolean.valueOf(strValue); - } - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/CommonTranslators.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/CommonTranslators.java deleted file mode 100644 index f2f723359..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/CommonTranslators.java +++ /dev/null @@ -1,423 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 20, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.common; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; -import org.eclipse.jst.j2ee.webservice.wsclient.Webservice_clientPackage; -import org.eclipse.wst.common.internal.emf.resource.DependencyTranslator; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * A static helper for creating Generic common J2EE translators - */ -public class CommonTranslators implements DeploymentDescriptorXmlMapperI { - - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - private static Webservice_clientPackage WEBSERVICE_PKG = Webservice_clientPackage.eINSTANCE; - public static final Translator[] EMPTY_CHILDREN = new Translator[] {}; - private static final Translator EJB_REF_NAME_TRANSLATOR = new Translator(EJB_REF_NAME, COMMON_PKG.getEjbRef_Name()); - private static final Translator EJB_REF_TYPE_TRANSLATOR = new Translator(EJB_REF_TYPE, COMMON_PKG.getEjbRef_Type()); //Enumeration - private static final Translator EJB_LINK_TRANSLATOR = new Translator(EJB_LINK, COMMON_PKG.getEjbRef_Link()); - - private static final Translator RES_REF_NAME_TRANSLATOR = new Translator(RES_REF_NAME, COMMON_PKG.getResourceRef_Name()); - private static final Translator RES_TYPE_TRANSLATOR = new Translator(RES_TYPE, COMMON_PKG.getResourceRef_Type()); - private static final Translator RES_AUTH_TRANSLATOR = new ResAuthTranslator(); - private static final Translator RES_SHARING_SCOPE_TRANSLATOR = new Translator(RES_SHARING_SCOPE, COMMON_PKG.getResourceRef_ResSharingScope()); - - private static final Translator RES_ENV_REF_NAME_TRANSLATOR = new Translator(RESOURCE_ENV_REF_NAME, COMMON_PKG.getResourceEnvRef_Name()); - private static final Translator RES_ENV_REF_TYPE_TRANSLATOR = new JavaClassTranslator(RESOURCE_ENV_REF_TYPE, COMMON_PKG.getResourceEnvRef_Type()); - - private static final Translator SEC_REF_ROLE_NAME_TRANSALTOR = new Translator(ROLE_NAME, COMMON_PKG.getSecurityRoleRef_Name()); - private static final Translator SEC_REF_ROLE_LINK_TRANSLATOR = new Translator(ROLE_LINK, COMMON_PKG.getSecurityRoleRef_Link()); - - private static final Translator RUNAS_ROLE_NAME_TRANSLATOR = new DependencyTranslator(ROLE_NAME, COMMON_PKG.getIdentity_RoleName(), COMMON_PKG.getRunAsSpecifiedIdentity_Identity()); - - private static final Translator SECURITY_ROLE_NAME_TRANSLATOR = new Translator(ROLE_NAME, COMMON_PKG.getSecurityRole_RoleName()); - - public static final Translator DESCRIPTIONS_TRANSLATOR = createDescriptionTranslator(COMMON_PKG.getDescriptionGroup_Descriptions()); - public static final Translator DISPLAYNAMES_TRANSLATOR = createDisplayNameTranslator(COMMON_PKG.getDescriptionGroup_DisplayNames()); - public static final Translator ICONS_TRANSLATOR = createIconTranslator(); - - //The Official Concept of JNDIEnvRefGroup FOR J2EE 1.4 - public static final Translator JNDI_REF_GROUP_ENV_ENTRY_1_4 = new EnvEntryTranslator(COMMON_PKG.getJNDIEnvRefsGroup_EnvironmentProperties(), true, true); - public static final Translator JNDI_REF_GROUP_EJB_REF_1_4 = CommonTranslators.createEJBRefTranslator14(COMMON_PKG.getJNDIEnvRefsGroup_EjbRefs()); - public static final Translator JNDI_REF_GROUP_EJB_LOCAL_REF_1_4 = CommonTranslators.createEJBLocalRefTranslator14(COMMON_PKG.getJNDIEnvRefsGroup_EjbLocalRefs()); - public static final Translator JNDI_REF_GROUP_SERVICE_REF_1_4 = CommonTranslators.createServiceRefGroupTranslator(COMMON_PKG.getJNDIEnvRefsGroup_ServiceRefs()); - public static final Translator JNDI_REF_GROUP_RESOURCE_REF_1_4 = CommonTranslators.createResourceRefTranslator14(COMMON_PKG.getJNDIEnvRefsGroup_ResourceRefs()); - public static final Translator JNDI_REF_GROUP_RESOURCE_ENV_REF_1_4 = CommonTranslators.createResourceEnvRefTranslator14(COMMON_PKG.getJNDIEnvRefsGroup_ResourceEnvRefs()); - public static final Translator JNDI_REF_GROUP_MESSAGE_DEST_REF_1_4 = CommonTranslators.createMessageDestinationRefTranslator(COMMON_PKG.getJNDIEnvRefsGroup_MessageDestinationRefs()); - - //The unofficial concept of JNDIEnvRefGroup FOR J2EE 1.3 - public static final Translator JNDI_REF_GROUP_ENV_ENTRY_1_3 = new EnvEntryTranslator(COMMON_PKG.getJNDIEnvRefsGroup_EnvironmentProperties(), true, false); - public static final Translator JNDI_REF_GROUP_EJB_REF_1_3 = CommonTranslators.createEJBRefTranslator13(COMMON_PKG.getJNDIEnvRefsGroup_EjbRefs()); - public static final Translator JNDI_REF_GROUP_EJB_LOCAL_REF_1_3 = CommonTranslators.createEJBLocalRefTranslator13(COMMON_PKG.getJNDIEnvRefsGroup_EjbLocalRefs()); - public static final Translator JNDI_REF_GROUP_RESOURCE_REF_1_3 = CommonTranslators.createResourceRefTranslator13(COMMON_PKG.getJNDIEnvRefsGroup_ResourceRefs()); - public static final Translator JNDI_REF_GROUP_RESOURCE_ENV_REF_1_3 = CommonTranslators.createResourceEnvRefTranslator13(COMMON_PKG.getJNDIEnvRefsGroup_ResourceEnvRefs()); - - public static final Translator LISTENER_CLASS_TRANSLATOR = new JavaClassTranslator(LISTENER_CLASS, COMMON_PKG.getListener_ListenerClass()); - - private CommonTranslators() { - super(); - } - - public static Translator createSecurityRoleRefTranslator13(EStructuralFeature feature) { - - GenericTranslator result = new GenericTranslator(SECURITY_ROLE_REF, feature); - result.setChildren(new Translator[] { - new Translator(DESCRIPTION, COMMON_PKG.getSecurityRoleRef_Description()), - SEC_REF_ROLE_NAME_TRANSALTOR, - SEC_REF_ROLE_LINK_TRANSLATOR - }); - return result; - } - - public static Translator createSecurityRoleRefTranslator14(EStructuralFeature feature) { - - GenericTranslator result = new GenericTranslator(SECURITY_ROLE_REF, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getSecurityRoleRef_Descriptions()), - SEC_REF_ROLE_NAME_TRANSALTOR, - SEC_REF_ROLE_LINK_TRANSLATOR - }); - return result; - } - - public static Translator createResourceEnvRefTranslator13(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(RESOURCE_ENV_REF, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getResourceEnvRef_Description()), - RES_ENV_REF_NAME_TRANSLATOR, - RES_ENV_REF_TYPE_TRANSLATOR - }); - return result; - } - - public static Translator createResourceEnvRefTranslator14(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(RESOURCE_ENV_REF, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getResourceEnvRef_Descriptions()), - RES_ENV_REF_NAME_TRANSLATOR, - RES_ENV_REF_TYPE_TRANSLATOR, - //J2EE1.4 Added - // createDeploymentExtensionTranslator(COMMON_PKG.getResourceEnvRef_Extensions()) - }); - return result; - } - - public static Translator createResourceRefTranslator13(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(RESOURCE_REF, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getResourceRef_Description()), - RES_REF_NAME_TRANSLATOR, - RES_TYPE_TRANSLATOR, - RES_AUTH_TRANSLATOR, - //EJB 2.0 Added - RES_SHARING_SCOPE_TRANSLATOR, - }); - return result; - } - - public static Translator createResourceRefTranslator14(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(RESOURCE_REF, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getResourceRef_Descriptions()), - RES_REF_NAME_TRANSLATOR, - RES_TYPE_TRANSLATOR, - RES_AUTH_TRANSLATOR, - //EJB 2.0 Added - RES_SHARING_SCOPE_TRANSLATOR, - - //J2EE1.4 Added - // createDeploymentExtensionTranslator(COMMON_PKG.getResourceRef_Extensions()) - }); - return result; - } - - public static Translator createSecurityRoleTranslator13(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(SECURITY_ROLE, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getSecurityRole_Description()), - SECURITY_ROLE_NAME_TRANSLATOR - }); - return result; - } - - public static Translator createSecurityRoleTranslator14(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(SECURITY_ROLE, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getSecurityRole_Descriptions()), - SECURITY_ROLE_NAME_TRANSLATOR - }); - return result; - } - - public static Translator createEJBRefTranslator13(EStructuralFeature feature) { - return createEJBRefTranslator13(feature, false); - } - - public static Translator createEJBLocalRefTranslator13(EStructuralFeature feature) { - return createEJBRefTranslator13(feature, true); - } - private static Translator createEJBRefTranslator13(EStructuralFeature feature, boolean local) { - String nodeName = local ? EJB_LOCAL_REF : EJB_REF; - String homeTag = local ? LOCAL_HOME : HOME; - String remoteTag = local ? LOCAL : REMOTE; - EStructuralFeature homeFeature = local ? COMMON_PKG.getEJBLocalRef_LocalHome() : COMMON_PKG.getEjbRef_Home(); - EStructuralFeature remoteFeature = local ? COMMON_PKG.getEJBLocalRef_Local() : COMMON_PKG.getEjbRef_Remote(); - - GenericTranslator result = new GenericTranslator(nodeName, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getEjbRef_Description()), - EJB_REF_NAME_TRANSLATOR, - EJB_REF_TYPE_TRANSLATOR, - new Translator(homeTag, homeFeature), - new Translator(remoteTag, remoteFeature), - EJB_LINK_TRANSLATOR - }); - return result; - } - - public static Translator createEJBRefTranslator14(EStructuralFeature feature) { - return createEJBRefTranslator14(feature, false); - } - - public static Translator createEJBLocalRefTranslator14(EStructuralFeature feature) { - return createEJBRefTranslator14(feature, true); - } - private static Translator createEJBRefTranslator14(EStructuralFeature feature, boolean local) { - String nodeName = local ? EJB_LOCAL_REF : EJB_REF; - String homeTag = local ? LOCAL_HOME : HOME; - String remoteTag = local ? LOCAL : REMOTE; - EStructuralFeature homeFeature = local ? COMMON_PKG.getEJBLocalRef_LocalHome() : COMMON_PKG.getEjbRef_Home(); - EStructuralFeature remoteFeature = local ? COMMON_PKG.getEJBLocalRef_Local() : COMMON_PKG.getEjbRef_Remote(); - - GenericTranslator result = new GenericTranslator(nodeName, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getEjbRef_Descriptions()), - EJB_REF_NAME_TRANSLATOR, - EJB_REF_TYPE_TRANSLATOR, - new Translator(homeTag, homeFeature), - new Translator(remoteTag, remoteFeature), - EJB_LINK_TRANSLATOR, - // createDeploymentExtensionTranslator(COMMON_PKG.getEjbRef_Extensions()) - }); - return result; - } - - - public static Translator createRunAsTranslator13(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(RUN_AS, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getSecurityIdentity_Description()), - //new DependencyTranslator(DES,) - RUNAS_ROLE_NAME_TRANSLATOR - }); - return result; - } - - - public static Translator createRunAsTranslator14(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(RUN_AS, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getSecurityIdentity_Descriptions()), - RUNAS_ROLE_NAME_TRANSLATOR - }); - return result; - } - - - - public static Translator createMessageDestinationRefTranslator(EStructuralFeature feature){ - GenericTranslator result = new GenericTranslator(MESSAGE_DEST_REF,feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getMessageDestinationRef_Descriptions()), - new Translator(MESSAGE_DEST_REF_NAME,COMMON_PKG.getMessageDestinationRef_Name()), - new Translator(MESSAGE_DEST_TYPE,COMMON_PKG.getMessageDestinationRef_Type()), - new Translator(MESSAGE_DEST_USAGE,COMMON_PKG.getMessageDestinationRef_Usage()), - new Translator(MESSAGE_DEST_LINK,COMMON_PKG.getMessageDestinationRef_Link()), - //createDeploymentExtensionTranslator(COMMON_PKG.getMessageDestinationRef_Extensions()) - }); - - return result; - } - - public static Translator createMessageDestinationTranslator(EStructuralFeature feature){ - GenericTranslator result = new GenericTranslator(MESSAGE_DEST,feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - DESCRIPTIONS_TRANSLATOR, - DISPLAYNAMES_TRANSLATOR, - ICONS_TRANSLATOR, - new Translator(MESSAGE_DEST_NAME,COMMON_PKG.getMessageDestination_Name()), - //createDeploymentExtensionTranslator(COMMON_PKG.getMessageDestination_Extensions()) - }); - - return result; - } - - /** - * This model was model from Websphere Webservices - * @param reference - * @return - */ - public static Translator createServiceRefGroupTranslator(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(SERVICE_REF, feature); - result.setChildren( new Translator[] { - IDTranslator.INSTANCE, - DESCRIPTIONS_TRANSLATOR, - DISPLAYNAMES_TRANSLATOR, - ICONS_TRANSLATOR, - new Translator(SERVICE_REF_NAME, WEBSERVICE_PKG.getServiceRef_ServiceRefName()), - new JavaClassTranslator(SERVICE_INTERFACE, WEBSERVICE_PKG.getServiceRef_ServiceInterface()), - new Translator(WSDL_FILE, WEBSERVICE_PKG.getServiceRef_WsdlFile()), - new Translator(JAXRPC_MAPPING_FILE, WEBSERVICE_PKG.getServiceRef_JaxrpcMappingFile()), - createQNameTranslator(SERVICE_QNAME, WEBSERVICE_PKG.getServiceRef_ServiceQname()), - createPortComponentRefTranslator(), - createServiceRefHandlerTranslator(), - }); - - - return result; - } - - public static Translator createQNameTranslator(String domName, EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(domName, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(Translator.TEXT_ATTRIBUTE_VALUE, CommonPackage.eINSTANCE.getQName_CombinedQName()) - }); - return result; - } - - /** - * This model was model from Websphere Webservices - * @return - */ - public static Translator createServiceRefHandlerTranslator() { - GenericTranslator result = new GenericTranslator(HANDLER, WEBSERVICE_PKG.getServiceRef_Handlers()); - result.setChildren(new Translator[]{ - IDTranslator.INSTANCE, - DESCRIPTIONS_TRANSLATOR, - DISPLAYNAMES_TRANSLATOR, - ICONS_TRANSLATOR, - new Translator(HANDLER_NAME, WEBSERVICE_PKG.getHandler_HandlerName()), - new JavaClassTranslator(HANDLER_CLASS, WEBSERVICE_PKG.getHandler_HandlerClass()), - createParamValueType(HANDLER_INIT_PARAM, WEBSERVICE_PKG.getHandler_InitParams()), - createQNameTranslator(SOAP_HEADER, WEBSERVICE_PKG.getHandler_SoapHeaders()), - new Translator(SOAP_ROLE, WEBSERVICE_PKG.getHandler_SoapRoles()), - new Translator(PORT_NAME, WEBSERVICE_PKG.getHandler_PortNames()) - }); - - return result; - } - - /** - * @return - */ - public static Translator createPortComponentRefTranslator() { - GenericTranslator result = new GenericTranslator(PORT_COMPONENT_REF, WEBSERVICE_PKG.getServiceRef_PortComponentRefs()); - result.setChildren( new Translator[]{ - IDTranslator.INSTANCE, - new JavaClassTranslator(SERVICE_ENPOINT_INTERFACE, WEBSERVICE_PKG.getPortComponentRef_ServiceEndpointInterface()), - new Translator(PORT_COMPONENT_LINK , WEBSERVICE_PKG.getPortComponentRef_PortComponentLink()) - }); - return result; - } - - /** - * @return - */ - public static Translator createDescriptionTranslator(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(DESCRIPTION, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(LANG, COMMON_PKG.getDescription_Lang(), Translator.DOM_ATTRIBUTE), - new Translator(Translator.TEXT_ATTRIBUTE_VALUE, COMMON_PKG.getDescription_Value()) - }); - return result; - } - - /** - * @return - */ - public static Translator createDisplayNameTranslator(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(DISPLAY_NAME, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(LANG, COMMON_PKG.getDisplayName_Lang(), Translator.DOM_ATTRIBUTE), - new Translator(Translator.TEXT_ATTRIBUTE_VALUE, COMMON_PKG.getDisplayName_Value()) - }); - return result; - } - - - /** - * @return - */ - public static Translator createIconTranslator() { - GenericTranslator result = new GenericTranslator(ICON, COMMON_PKG.getDescriptionGroup_Icons()); - result.setChildren(new Translator[] { - new Translator(LANG, COMMON_PKG.getIconType_Lang(), Translator.DOM_ATTRIBUTE), - IDTranslator.INSTANCE, - new Translator(SMALL_ICON, COMMON_PKG.getIconType_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getIconType_LargeIcon()) - }); - return result; - } - -// public static Translator createDeploymentExtensionTranslator(EStructuralFeature feature) { -// return createDeploymentExtensionTranslator(DEPLOY_EXT, feature); -// } -// -// public static Translator createDeploymentExtensionTranslator(String domName, EStructuralFeature feature) { -// GenericTranslator result = new GenericTranslator(domName, feature); -// result.setChildren(new Translator[] { -// new Translator(NAMESPACE, COMMON_PKG.getDeploymentExtension_Namespace(), Translator.DOM_ATTRIBUTE), -// new Translator(MUSTUNDERSTAND, COMMON_PKG.getDeploymentExtension_MustUnderstand(), Translator.DOM_ATTRIBUTE), -// IDTranslator.INSTANCE, -// Translator.createParentAndTextAttributeTranslator(EXT_ELEMENT, COMMON_PKG.getDeploymentExtension_ExtensionElements(), COMMON_PKG.getExtensibleType_Value()) -// }); -// return result; -// } - - public static Translator createParamValueType(String domName, EStructuralFeature feature){ - GenericTranslator result = new GenericTranslator(domName, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createDescriptionTranslator(COMMON_PKG.getParamValue_Descriptions()), - new Translator(PARAM_NAME, COMMON_PKG.getParamValue_Name()), - new Translator(PARAM_VALUE, COMMON_PKG.getParamValue_Value()), - }); - return result; - } - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/EnvEntryTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/EnvEntryTranslator.java deleted file mode 100644 index cf6ec6206..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/EnvEntryTranslator.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.common; - - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EnvEntryTranslator extends Translator implements DeploymentDescriptorXmlMapperI { - private boolean isJ2EE14; - private static Translator[] children; - private static Translator[] reorderedChildren; - //Hacks because of inconsistencies in the servlet spec - boolean typeBeforeValue = true; - /** - * Constructor for EnvEntryTranslator. - * @param domNameAndPath - * @param aFeature - */ - public EnvEntryTranslator(EStructuralFeature aFeature, boolean writeTypeBeforeValue, boolean isJ2EE14) { - super(ENV_ENTRY, aFeature); - typeBeforeValue = writeTypeBeforeValue; - this.isJ2EE14 = isJ2EE14; - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren() - */ - public Translator[] getChildren(Object obj, int versionID) { - //Hava to you create a different one each time - children = createChildren(); - setReorderedChildren(); - - if (typeBeforeValue) - return children; - - return reorderedChildren; - } - - protected Translator[] createChildren() { - CommonPackage ePackageCommon = CommonPackage.eINSTANCE; - Translator descriptionTranslator; - if (isJ2EE14) - descriptionTranslator = CommonTranslators.createDescriptionTranslator(ePackageCommon.getEnvEntry_Descriptions()); - else - descriptionTranslator = new Translator(DESCRIPTION, ePackageCommon.getEnvEntry_Description()); - - return new Translator[] { - IDTranslator.INSTANCE, - descriptionTranslator, - new Translator(ENV_ENTRY_NAME, ePackageCommon.getEnvEntry_Name()), - new EnvEntryTypeTranslator(), - new Translator(ENV_ENTRY_VALUE, ePackageCommon.getEnvEntry_Value()) - }; - } - - protected void setReorderedChildren() { - reorderedChildren = new Translator[children.length]; - System.arraycopy(children, 0, reorderedChildren, 0, children.length); - Translator temp = reorderedChildren[3]; - reorderedChildren[3] = reorderedChildren[4]; - reorderedChildren[4] = temp; - } - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/EnvEntryTypeTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/EnvEntryTypeTranslator.java deleted file mode 100644 index afecd56ad..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/EnvEntryTypeTranslator.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.common; - -import org.eclipse.emf.common.util.Enumerator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EnvEntryTypeTranslator extends Translator implements DeploymentDescriptorXmlMapperI { - private static final String JAVA_LANG= "java.lang."; //$NON-NLS-1$ - private static final int SUBSTRING_LENGTH = JAVA_LANG.length(); - public EnvEntryTypeTranslator() { - super(ENV_ENTRY_TYPE, CommonPackage.eINSTANCE.getEnvEntry_Type()); - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(String) - */ - public Object convertStringToValue(String strValue, EObject owner) { - if (strValue != null && strValue.startsWith(JAVA_LANG)) - return super.convertStringToValue(strValue.substring(SUBSTRING_LENGTH), owner); - - return null; - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#convertValueToString(Object) - */ - public String convertValueToString(Object value, EObject owner) { - if (value != null) - return JAVA_LANG + ((Enumerator)value).getName(); - return null; - } - - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/JavaClassTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/JavaClassTranslator.java deleted file mode 100644 index e8d24f9fb..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/JavaClassTranslator.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.common; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; -import org.eclipse.wst.common.internal.emf.resource.TranslatorPath; - -public class JavaClassTranslator extends Translator { - - /** - * Constructor for JavaClassTranslator. - * @param domNameAndPath - * @param aFeature - */ - public JavaClassTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - /** - * Constructor for JavaClassTranslator. - * @param domNameAndPath - * @param aFeature - * @param path - */ - public JavaClassTranslator(String domNameAndPath, EStructuralFeature aFeature, TranslatorPath path) { - super(domNameAndPath, aFeature, path); - } - - /** - * Constructor for JavaClassTranslator. - * @param domNameAndPath - * @param aFeature - * @param paths - */ - public JavaClassTranslator(String domNameAndPath, EStructuralFeature aFeature, TranslatorPath[] paths) { - super(domNameAndPath, aFeature, paths); - } - - /** - * Constructor for JavaClassTranslator. - * @param domNameAndPath - * @param aFeature - * @param style - */ - public JavaClassTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) { - super(domNameAndPath, aFeature, style); - } - - public Object convertStringToValue(String nodeName, String readAheadName, String value, Notifier owner) { - Object result = null; - if (value != null) { - result = convertStringToValue(value, (EObject) owner); - } - - return result; - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(String) - */ - public Object convertStringToValue(String strValue, EObject owner) { - if (strValue != null) { - String qualifiedName = removePreceedingAndTrailingPeriods(strValue.trim()); - if (owner != null) { - Resource ownerRes = owner.eResource(); - if (ownerRes != null) { - ResourceSet rs = ownerRes.getResourceSet(); - if (rs != null) { - //Try to reflect the type directly. If nothing is returned - //or an error occurs, return a proxy. - Object javaClass = null; - try { - javaClass = JavaRefFactory.eINSTANCE.reflectType(qualifiedName, rs); - } catch (Exception e) { - //Ignore - } - if (javaClass != null) - return javaClass; - } - } - } - return JavaRefFactory.eINSTANCE.createClassRef(qualifiedName); - } - return null; - } - private String removePreceedingAndTrailingPeriods(String qualifiedName) { - char[] characters = qualifiedName.toCharArray(); - int startIndex = 0; - for (; startIndex < characters.length && characters[startIndex] == '.'; startIndex++); - int qualifiedNameEnd = qualifiedName.length() - 1; - int endIndex = qualifiedNameEnd; - for (; endIndex > -1 && characters[endIndex] == '.'; endIndex--) - if (startIndex == 0 && endIndex == qualifiedNameEnd) - return qualifiedName; - return qualifiedName.substring(startIndex, endIndex + 1); - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#convertValueToString(Object) - */ - public String convertValueToString(Object value, EObject owner) { - if (value != null) - return ((JavaClass) value).getQualifiedName(); - return null; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/ResAuthTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/ResAuthTranslator.java deleted file mode 100644 index fdf8b9898..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/common/ResAuthTranslator.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 30, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.common; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.common.ResAuthTypeBase; -import org.eclipse.jst.j2ee.common.ResourceRef; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.internal.emf.resource.Translator; -/** - * @author schacher - */ -public class ResAuthTranslator extends Translator implements DeploymentDescriptorXmlMapperI { - - private static final String CONTAINER_AUTH = "CONTAINER"; //$NON-NLS-1$ - private static final String SERVLET_AUTH = "SERVLET"; //$NON-NLS-1$ - public ResAuthTranslator() { - super(RES_AUTH, CommonPackage.eINSTANCE.getResourceRef_Auth()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(java.lang.String, org.eclipse.emf.ecore.EObject) - */ - public Object convertStringToValue(String strValue, EObject owner) { - if (isWeb((ResourceRef)owner)) - return convertWebStringToValue(strValue, owner); - - return super.convertStringToValue(strValue, owner); - } - - /** - * @param strValue - * @param owner - * @return - */ - private Object convertWebStringToValue(String strValue, EObject owner) { - if (SERVLET_AUTH.equals(strValue)) - return ResAuthTypeBase.APPLICATION_LITERAL; - else if (CONTAINER_AUTH.equals(strValue)) - return ResAuthTypeBase.CONTAINER_LITERAL; - else - return super.convertStringToValue(strValue, owner); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#convertValueToString(java.lang.Object, org.eclipse.emf.ecore.EObject) - */ - public String convertValueToString(Object value, EObject owner) { - if (isWeb22(((ResourceRef)owner))) - return convertWebValueToString(value, owner); - - return super.convertValueToString(value, owner); - } - - /** - * @param value - * @param owner - */ - private String convertWebValueToString(Object value, EObject owner) { - if (ResAuthTypeBase.APPLICATION_LITERAL == value) - return SERVLET_AUTH; - else if (ResAuthTypeBase.CONTAINER_LITERAL == value) - return CONTAINER_AUTH; - else - return super.convertValueToString(value, owner); - } - - protected boolean isWeb(ResourceRef ref) { - EObject owner = ref.eContainer(); - return (owner instanceof WebApp); - } - protected boolean isWeb22(ResourceRef ref) { - return isWeb(ref) && ((WebApp)ref.eContainer()).getVersionID() <= J2EEVersionConstants.WEB_2_2_ID; - } - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/connector/ConnectorTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/connector/ConnectorTranslator.java deleted file mode 100644 index 82616b81e..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/connector/ConnectorTranslator.java +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.connector; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.BooleanTranslator; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.xml.RarDeploymentDescriptorXmlMapperI; -import org.eclipse.jst.j2ee.jca.JcaPackage; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - - -public class ConnectorTranslator extends RootTranslator implements RarDeploymentDescriptorXmlMapperI, J2EEConstants { - public static ConnectorTranslator INSTANCE = new ConnectorTranslator(); - public static final String CONNECTOR = "connector"; //$NON-NLS-1$ - private static JcaPackage CONNECTOR_PKG = JcaPackage.eINSTANCE; - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - private static Translator[] children13; - private static Translator[] children14; - - private static final Translator VENDOR_NAME_TRANSLATOR = new Translator(VENDOR_NAME, CONNECTOR_PKG.getConnector_VendorName()); - private static final Translator EIS_TYPE_TRANSLATOR = new Translator(EIS_TYPE, CONNECTOR_PKG.getConnector_EisType()); - - private static final Translator CONFIG_PROPERTY_NAME_TRANSLATOR= new Translator(CONFIG_PROPERTY_NAME, CONNECTOR_PKG.getConfigProperty_Name()); - private static final Translator CONFIG_PROPERTY_TYPE_TRANSLATOR= new Translator(CONFIG_PROPERTY_TYPE, CONNECTOR_PKG.getConfigProperty_Type()); - private static final Translator CONFIG_PROPERTY_VALUE_TRANSLATOR= new Translator(CONFIG_PROPERTY_VALUE, CONNECTOR_PKG.getConfigProperty_Value()); - - private static final Translator SECURITY_PERMISSION_SPEC_TRANSLATOR = new Translator(SECURITY_PERMISSION_SPEC, CONNECTOR_PKG.getSecurityPermission_Specification()); - - private static final Translator AUTH_MECH_TYPE_TRANSLATOR = new Translator(AUTH_MECH_TYPE, CONNECTOR_PKG.getAuthenticationMechanism_AuthenticationMechanismType()); - private static final Translator CREDENTIAL_INTERFACE_TRANSLATOR = new Translator(CREDENTIAL_INTERFACE, CONNECTOR_PKG.getAuthenticationMechanism_CredentialInterface()); - - private static final BooleanTranslator LICENSE_REQUIRED_TRANSLATOR = new BooleanTranslator(LICENSE_REQUIRED, CONNECTOR_PKG.getLicense_Required()); - - public ConnectorTranslator() { - super(CONNECTOR, JcaPackage.eINSTANCE.getConnector()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - protected Translator[] create13Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName() ), - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new Translator(ICON+"/"+SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon() ), //$NON-NLS-1$ - new Translator(ICON+"/"+LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon() ), //$NON-NLS-1$ - VENDOR_NAME_TRANSLATOR, - new Translator(SPEC_VERSION, CONNECTOR_PKG.getConnector_SpecVersion() ), - EIS_TYPE_TRANSLATOR, - new Translator(VERSION, CONNECTOR_PKG.getConnector_Version() ), - createLicenseTranslator13(), - createResourceAdapterTranslator13() - }; - } - - protected Translator[] create14Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(VERSION, CONNECTOR_PKG.getConnector_SpecVersion(), DOM_ATTRIBUTE), - new ConstantAttributeTranslator(XML_NS, J2EE_NS_URL), - new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL), - new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, J2EE_NS_URL+' '+CONNECTOR_SCHEMA_LOC_1_5), - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - VENDOR_NAME_TRANSLATOR, - EIS_TYPE_TRANSLATOR, - new Translator(RESOURCEADAPTER_VERSION, CONNECTOR_PKG.getConnector_Version()), - createLicenseTranslator14(), - createResourceAdapterTranslator14(), - }; - } - - private Translator createResourceAdapterTranslator14() { - GenericTranslator result = new GenericTranslator(RESOURCEADAPTER, CONNECTOR_PKG.getConnector_ResourceAdapter()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(RESOURCEADAPTER_CLASS,CONNECTOR_PKG.getResourceAdapter_ResourceAdapterClass()), - createConfigurationPropertyTranslator14(CONNECTOR_PKG.getResourceAdapter_ConfigProperties()), - createOutboundTranslator(), - createInboundTranslator(), - createAdminObjectTranslator(), - createSecurityPermissionsTranslator() - }); - return result; - } - - private Translator createOutboundTranslator() { - GenericTranslator result = new GenericTranslator(OUTBOUND_RESOURCEADAPTER, CONNECTOR_PKG.getResourceAdapter_OutboundResourceAdapter()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createConnectionDefinationTranslator(), - new Translator(TRANSACTION_SUPPORT, CONNECTOR_PKG.getOutboundResourceAdapter_TransactionSupport()), - createAuthMechanismTranslator14(CONNECTOR_PKG.getOutboundResourceAdapter_AuthenticationMechanisms()), - new BooleanTranslator(REAUTHENTICATION_SUPPORT, CONNECTOR_PKG.getOutboundResourceAdapter_ReauthenticationSupport()), - }); - return result; - } - - private Translator createInboundTranslator() { - GenericTranslator result = new GenericTranslator(INBOUND_RESOURCEADAPTER, CONNECTOR_PKG.getResourceAdapter_InboundResourceAdapter()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createMessageAdapterTranslator() - }); - - return result; - } - - private Translator createMessageAdapterTranslator() { - GenericTranslator result = new GenericTranslator(MESSAGEADAPTER, CONNECTOR_PKG.getInboundResourceAdapter_MessageAdapter()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createMessageListenerTranslator(), - }); - - return result; - } - - private Translator createMessageListenerTranslator() { - GenericTranslator result = new GenericTranslator(MESSAGELISTENER, CONNECTOR_PKG.getMessageAdapter_MessageListeners()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(MESSAGELISTENER_TYPE, CONNECTOR_PKG.getMessageListener_MessageListenerType()), - createActivationSpecTranslator() - }); - return result; - } - - private Translator createActivationSpecTranslator() { - GenericTranslator result = new GenericTranslator(ACTIVATIONSPEC, CONNECTOR_PKG.getMessageListener_ActivationSpec()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(ACTIVATIONSPEC_CLASS, CONNECTOR_PKG.getActivationSpec_ActivationSpecClass()), - createRequiredConfigPropertyTranslator() - }); - return result; - } - - private Translator createRequiredConfigPropertyTranslator() { - GenericTranslator result = new GenericTranslator(REQUIRED_CONFIG_PROPERTY, CONNECTOR_PKG.getActivationSpec_RequiredConfigProperties()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(CONNECTOR_PKG.getRequiredConfigPropertyType_Descriptions()), - new Translator(CONFIG_PROPERTY_NAME, CONNECTOR_PKG.getRequiredConfigPropertyType_Name()) - }); - return result; - } - - private Translator createAdminObjectTranslator() { - GenericTranslator result = new GenericTranslator(ADMINOBJECT, CONNECTOR_PKG.getResourceAdapter_AdminObjects()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(ADMINOBJECT_INTERFACE, CONNECTOR_PKG.getAdminObject_AdminObjectInterface()), - new Translator(ADMINOBJECT_CLASS, CONNECTOR_PKG.getAdminObject_AdminObjectClass()), - createConfigurationPropertyTranslator14(CONNECTOR_PKG.getAdminObject_ConfigProperties()) - - }); - return result; - } - - private Translator createConnectionDefinationTranslator() { - GenericTranslator result = new GenericTranslator(CONNECTION_DEFINITION, CONNECTOR_PKG.getOutboundResourceAdapter_ConnectionDefinitions()); - result.setChildren(new Translator[] { - new Translator(MANAGEDCONNECTIONFACTORY_CLASS, CONNECTOR_PKG.getConnectionDefinition_ManagedConnectionFactoryClass()), - createConfigurationPropertyTranslator14(CONNECTOR_PKG.getConnectionDefinition_ConfigProperties()), - new Translator(CONNECTIONFACTORY_INTERFACE, CONNECTOR_PKG.getConnectionDefinition_ConnectionFactoryInterface()), - new Translator(CONNECTIONFACTORY_IMPL_CLASS, CONNECTOR_PKG.getConnectionDefinition_ConnectionFactoryImplClass()), - new Translator(CONNECTION_INTERFACE, CONNECTOR_PKG.getConnectionDefinition_ConnectionInterface()), - new Translator(CONNECTION_IMPL_CLASS, CONNECTOR_PKG.getConnectionDefinition_ConnectionImplClass()), - }); - return result; - } - - public Translator createResourceAdapterTranslator13() { - GenericTranslator result = new GenericTranslator(RESOURCEADAPTER, CONNECTOR_PKG.getConnector_ResourceAdapter()); - result.setChildren(new Translator[] { - new Translator(MANAGEDCONNECTIONFACTORY_CLASS, CONNECTOR_PKG.getResourceAdapter_ManagedConnectionFactoryClass() ), - new Translator(CONNECTIONFACTORY_INTERFACE, CONNECTOR_PKG.getResourceAdapter_ConnectionFactoryInterface() ), - new Translator(CONNECTIONFACTORY_IMPL_CLASS, CONNECTOR_PKG.getResourceAdapter_ConnectionFactoryImplClass() ), - new Translator(CONNECTION_INTERFACE, CONNECTOR_PKG.getResourceAdapter_ConnectionInterface()), - new Translator(CONNECTION_IMPL_CLASS, CONNECTOR_PKG.getResourceAdapter_ConnectionImplClass()), - new Translator(TRANSACTION_SUPPORT, CONNECTOR_PKG.getResourceAdapter_TransactionSupport() ), - createConfigurationPropertyTranslator13(CONNECTOR_PKG.getResourceAdapter_ConfigProperties()), - createAuthMechanismTranslator13(CONNECTOR_PKG.getResourceAdapter_AuthenticationMechanisms()), - new BooleanTranslator(REAUTHENTICATION_SUPPORT, CONNECTOR_PKG.getResourceAdapter_ReauthenticationSupport()), - createSecurityPermissionsTranslator() - - - }); - return result; - } - - public Translator createSecurityPermissionsTranslator() { - GenericTranslator result = new GenericTranslator(SECURITY_PERMISSION, CONNECTOR_PKG.getResourceAdapter_SecurityPermissions()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, CONNECTOR_PKG.getSecurityPermission_Description()), - SECURITY_PERMISSION_SPEC_TRANSLATOR - }); - return result; - } - - public Translator createAuthMechanismTranslator13(EStructuralFeature afeature) { - GenericTranslator result = new GenericTranslator(AUTH_MECHANISM, afeature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, CONNECTOR_PKG.getAuthenticationMechanism_Description()), - AUTH_MECH_TYPE_TRANSLATOR, - CREDENTIAL_INTERFACE_TRANSLATOR - }); - return result; - } - - public Translator createAuthMechanismTranslator14(EStructuralFeature afeature) { - GenericTranslator result = new GenericTranslator(AUTH_MECHANISM, afeature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(CONNECTOR_PKG.getAuthenticationMechanism_Descriptions()), - AUTH_MECH_TYPE_TRANSLATOR, - CREDENTIAL_INTERFACE_TRANSLATOR - }); - return result; - } - - - public Translator createConfigurationPropertyTranslator13(EStructuralFeature afeature) { - GenericTranslator result = new GenericTranslator(CONFIG_PROPERTY, afeature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, CONNECTOR_PKG.getConfigProperty_Description()), - CONFIG_PROPERTY_NAME_TRANSLATOR, - CONFIG_PROPERTY_TYPE_TRANSLATOR, - CONFIG_PROPERTY_VALUE_TRANSLATOR - }); - return result; - } - - public Translator createConfigurationPropertyTranslator14(EStructuralFeature afeature) { - GenericTranslator result = new GenericTranslator(CONFIG_PROPERTY, afeature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(CONNECTOR_PKG.getConfigProperty_Descriptions()), - CONFIG_PROPERTY_NAME_TRANSLATOR, - CONFIG_PROPERTY_TYPE_TRANSLATOR, - CONFIG_PROPERTY_VALUE_TRANSLATOR - }); - return result; - } - - public Translator createLicenseTranslator13() { - GenericTranslator result = new GenericTranslator(LICENSE, CONNECTOR_PKG.getConnector_License()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, CONNECTOR_PKG.getLicense_Description()), - LICENSE_REQUIRED_TRANSLATOR - }); - return result; - } - - public Translator createLicenseTranslator14() { - GenericTranslator result = new GenericTranslator(LICENSE, CONNECTOR_PKG.getConnector_License()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(CONNECTOR_PKG.getLicense_Descriptions()), - LICENSE_REQUIRED_TRANSLATOR - }); - return result; - } -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/AbstractEJBTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/AbstractEJBTranslator.java deleted file mode 100644 index 896d4acf8..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/AbstractEJBTranslator.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 31, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public abstract class AbstractEJBTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI, J2EEVersionConstants { - protected static final EjbPackage EJB_PKG = EjbPackage.eINSTANCE; - protected static final CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - - - /** - * @param domNameAndPath - * @param aFeature - */ - public AbstractEJBTranslator(String domNameAndPath) { - super(domNameAndPath, EJB_PKG.getEJBJar_EnterpriseBeans()); - } - - - protected Translator[] create13Children() { - Translator[] start = getCommonBeginMaps13(); - Translator[] middle = getSpecificMaps(J2EE_1_3_ID); - Translator[] end = getEndMaps13(); - return (Translator[]) concat(start, concat(middle, end)); - } - - protected Translator[] create14Children() { - Translator[] start = getCommonBeginMaps14(); - Translator[] middle = getSpecificMaps(J2EE_1_4_ID); - Translator[] end = getEndMaps14(); - //Translator[] deploymentExt = getDeploymentExtensionMaps(); - return (Translator[]) concat(start, concat(middle, end)); - } - - protected Translator[] getCommonBeginMaps13() { - - Translator[] beginMaps = new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(EJB_NAME, EJB_PKG.getEnterpriseBean_Name()) - }; - - if (usesHomeRemoteAttributes()) - return (Translator[])concat(concat(beginMaps, getHomeRemoteMaps()), getEJBClassMap()); - return (Translator[])concat(beginMaps, getEJBClassMap()); - } - - - protected Translator[] getCommonBeginMaps14() { - - Translator[] beginMaps = new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new Translator(EJB_NAME, EJB_PKG.getEnterpriseBean_Name()) - }; - if (usesHomeRemoteAttributes()) - return (Translator[])concat(concat(beginMaps, getHomeRemoteMaps()), getEJBClassMap()); - return (Translator[])concat(beginMaps, getEJBClassMap()); - } - - protected Translator[] getHomeRemoteMaps() { - return new Translator[] { - new JavaClassTranslator(HOME, EJB_PKG.getEnterpriseBean_HomeInterface()), - new JavaClassTranslator(REMOTE, EJB_PKG.getEnterpriseBean_RemoteInterface()), - //Begin EJB 2.0 - new JavaClassTranslator(LOCAL_HOME, EJB_PKG.getEnterpriseBean_LocalHomeInterface()), - new JavaClassTranslator(LOCAL, EJB_PKG.getEnterpriseBean_LocalInterface()) - //End EJB 2.0 - }; - } - - protected Translator[] getEJBClassMap() { - return new Translator[] { - new JavaClassTranslator(EJB_CLASS, EJB_PKG.getEnterpriseBean_EjbClass()) - }; - } - - protected boolean usesHomeRemoteAttributes() { - return true; - } - - - protected Translator[] getEndMaps13() { - return new Translator[] { - CommonTranslators.JNDI_REF_GROUP_ENV_ENTRY_1_3, - CommonTranslators.JNDI_REF_GROUP_EJB_REF_1_3, - CommonTranslators.JNDI_REF_GROUP_EJB_LOCAL_REF_1_3, - CommonTranslators.createSecurityRoleRefTranslator13(EJB_PKG.getEnterpriseBean_SecurityRoleRefs()), - new SecurityIdentityTranslator(), - CommonTranslators.JNDI_REF_GROUP_RESOURCE_REF_1_3, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_ENV_REF_1_3 - }; - - } - - protected Translator[] getEndMaps14() { - return new Translator[] { - CommonTranslators.JNDI_REF_GROUP_ENV_ENTRY_1_4, - CommonTranslators.JNDI_REF_GROUP_EJB_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_EJB_LOCAL_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_SERVICE_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_ENV_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_MESSAGE_DEST_REF_1_4, - CommonTranslators.createSecurityRoleRefTranslator14(EJB_PKG.getEnterpriseBean_SecurityRoleRefs()), - new SecurityIdentityTranslator(), - }; - - } - - protected abstract Translator[] getSpecificMaps(int versionID); - -// protected Translator[] getDeploymentExtensionMaps(){ -// return new Translator[] { -// CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getEnterpriseBean_Extensions()) -// }; -// } -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/AcknowledgeModeTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/AcknowledgeModeTranslator.java deleted file mode 100644 index c8fef2562..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/AcknowledgeModeTranslator.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 31, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.AcknowledgeMode; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class AcknowledgeModeTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI { - - public static final String AUTO_ACKNOWLEDGE = "Auto-acknowledge"; //$NON-NLS-1$ - public static final String DUPS_OK_ACKNOWLEDGE = "Dups-ok-acknowledge"; //$NON-NLS-1$ - /** - * @param domNameAndPath - * @param aFeature - */ - public AcknowledgeModeTranslator() { - super(ACKNOWLEDGE_MODE, EjbPackage.eINSTANCE.getMessageDriven_AcknowledgeMode()); - } - - - public Object convertStringToValue(String strValue, EObject owner) { - if (AUTO_ACKNOWLEDGE.equalsIgnoreCase(strValue)) - return AcknowledgeMode.AUTO_ACKNOWLEDGE_LITERAL; - else if (DUPS_OK_ACKNOWLEDGE.equalsIgnoreCase(strValue)) - return AcknowledgeMode.DUPS_OK_ACKNOWLEDGE_LITERAL; - else - return super.convertStringToValue(strValue, owner); - } - - public String convertValueToString(Object value, EObject owner) { - if (AcknowledgeMode.AUTO_ACKNOWLEDGE_LITERAL.equals(value)) - return AUTO_ACKNOWLEDGE; - else if (AcknowledgeMode.DUPS_OK_ACKNOWLEDGE_LITERAL.equals(value)) - return DUPS_OK_ACKNOWLEDGE; - else - return super.convertValueToString(value, owner); - } - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/CMPFieldTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/CMPFieldTranslator.java deleted file mode 100644 index 7861a6fe2..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/CMPFieldTranslator.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 2, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.jst.j2ee.ejb.CMPAttribute; -import org.eclipse.jst.j2ee.ejb.ContainerManagedEntity; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author administrator - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class CMPFieldTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI { - public static EjbPackage EJB_PKG = EjbPackage.eINSTANCE; - public static Translator[] children; - public CMPFieldTranslator(){ - super(CMP_FIELD, EJB_PKG.getContainerManagedEntity_PersistentAttributes()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren() - */ - protected Translator[] getChildren() { - if (children == null) - children = createChildren(); - return children; - } - - protected Translator[] createChildren(){ - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION,EJB_PKG.getCMPAttribute_Description()), - new Translator(FIELD_NAME, EcorePackage.eINSTANCE.getENamedElement_Name()) - }; - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getMOFChildren(org.eclipse.emf.ecore.EObject) - */ - public List getMOFChildren(EObject mofObject) { - switch(((ContainerManagedEntity)mofObject).getVersionID()) { - - case J2EEVersionConstants.EJB_1_0_ID: - case J2EEVersionConstants.EJB_1_1_ID: - - return super.getMOFChildren(mofObject); - - case J2EEVersionConstants.EJB_2_0_ID: - case J2EEVersionConstants.EJB_2_1_ID: default: - - return get20CMPAttributes((ContainerManagedEntity)mofObject); - } - } - - public List get20CMPAttributes(ContainerManagedEntity cmp) { - List allAttributes, removed, result; - removed = null; - allAttributes = cmp.getPersistentAttributes(); - int size = allAttributes.size(); - CMPAttribute att = null; - for (int i = 0; i < size; i++) { - att = (CMPAttribute) allAttributes.get(i); - if (att.isDerived()) { - if (removed == null) - removed = new ArrayList(); - removed.add(att); - } - } - if (removed != null) { - result = new ArrayList(size); - result.addAll(allAttributes); - result.removeAll(removed); - } else - result = allAttributes; - return result; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/CMPVersionTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/CMPVersionTranslator.java deleted file mode 100644 index f1743cd16..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/CMPVersionTranslator.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 3, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.ContainerManagedEntity; -import org.eclipse.jst.j2ee.ejb.EJBJar; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class CMPVersionTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI { - - /** - * @param domNameAndPath - * @param eClass - */ - public CMPVersionTranslator() { - super(CMP_VERSION, EjbPackage.eINSTANCE.getContainerManagedEntity_Version()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getMOFValue(org.eclipse.emf.ecore.EObject) - */ - public Object getMOFValue(EObject mofObject) { - EJBJar parent = ((ContainerManagedEntity)mofObject).getEjbJar(); - if (parent.getVersionID() >= J2EEVersionConstants.EJB_2_0_ID) - return super.getMOFValue(mofObject); - return null; - } - - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/ContainerManagedEntityTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/ContainerManagedEntityTranslator.java deleted file mode 100644 index ce47a35e9..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/ContainerManagedEntityTranslator.java +++ /dev/null @@ -1,447 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 31, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.EjbFactory; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class ContainerManagedEntityTranslator extends EntityTranslator { - - private static Translator[] children13; - private static Translator[] children14; - /** - * @param domNameAndPath - * @param aFeature - */ - public ContainerManagedEntityTranslator() { - super(); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - return EjbFactory.eINSTANCE.createContainerManagedEntity(); - } - //TODO Uncomment all commented code and fix - /* - protected String extractStringValue(MapInfo map, EObject mofObject) { - if (map.getDOMName().equals(PRIMKEY_FIELD)) { - CMPAttribute attr = getContainerManagedEntity().getPrimaryKeyAttribute(); - return attr == null ? getSpecifiedPrimKeyFieldName() : attr.getName(); - } else - return super.extractStringValue(map, mofObject); - - } - - protected String getSpecifiedPrimKeyFieldName() { - return CMPSpecAdapter.getSpecifiedPrimKeyFieldName(getContainerManagedEntity()); - } - */ - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - protected String getPersistenceType() { - return CONTAINER; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.internal.internal.model.translator.ejb.EntityTranslator#getSpecificMaps() - */ - protected Translator[] getSpecificMaps(int versionID) { - Translator[] cmpTranslators = new Translator[] { - //Begin EJB 2.0 added - new CMPVersionTranslator(), - new Translator(ABSTRACT_SCHEMA_NAME, EJB_PKG.getContainerManagedEntity_AbstractSchemaName()), - //End EJB 2.0 added - - new CMPFieldTranslator(), - new PrimKeyFieldTranslator(), - }; - return (Translator[]) concat(super.getSpecificMaps(versionID), cmpTranslators); - } - - - protected Translator[] getEndMaps13() { - //Added for EJB 2.0 - Translator[] queryT = new Translator[] { - createQueryTranslators() - }; - return (Translator[]) concat(super.getEndMaps13(), queryT); - } - - protected Translator[] getEndMaps14() { - //Added for EJB 2.0 - Translator[] queryT = new Translator[] { - createQueryTranslators() - }; - return (Translator[]) concat(super.getEndMaps14(), queryT); - } - - public static Translator createQueryTranslators() { - GenericTranslator result = new GenericTranslator(QUERY, EJB_PKG.getContainerManagedEntity_Queries()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getQuery_Description()), - createQueryMethodTranslators(), - new Translator(RESULT_TYPE_MAPPING, EJB_PKG.getQuery_ReturnTypeMapping()), - new Translator(EJB_QL, EJB_PKG.getQuery_EjbQL()) - }); - return result; - } - - public static Translator createQueryMethodTranslators() { - GenericTranslator result = new GenericTranslator(QUERY_METHOD, EJB_PKG.getQuery_QueryMethod()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(METHOD_NAME, EJB_PKG.getMethodElement_Name()), - new MethodParamsTranslator(EJB_PKG.getMethodElement_Parms()) - }); - return result; - } - - /* - protected void primUpdateDOMFeature(MapInfo map, Node node, EObject mofObject) { - if (map == noFeaturePrimKeyMapInfo) - return; - if (map.getDOMName().equals(CMP_VERSION)) { - updateDOMCmpVersionIfNecessary(map, node, mofObject); - return; - } - super.primUpdateDOMFeature(map, node, mofObject); - //If the primary key class has changed, this will impact the primary key field - if (map.getDOMName().equals(PRIM_KEY_CLASS)) { - String specifiedPrimKeyField = CMPSpecAdapter.getSpecifiedPrimKeyFieldName(getContainerManagedEntity()); - try { - super.primUpdateDOMFeature(noFeaturePrimKeyMapInfo, node, mofObject); - } finally { - CMPSpecAdapter.setPrimKeyFieldFromXml(specifiedPrimKeyField, getContainerManagedEntity()); - } - } - } - - - protected void updateDOMCmpVersionIfNecessary(MapInfo map, Node node, EObject mofObject) { - if (!(mofObject instanceof ContainerManagedEntity)) - return; - - EJBJar parent = ((ContainerManagedEntity)mofObject).getEjbJar(); - if (parent.isVersion2_0Descriptor()) - super.primUpdateDOMFeature(map, node, mofObject); - } - protected void primUpdateDOMMultiFeature(MapInfo map, Node node, EObject mofObject) { - if (map == featurePrimKeyMapInfo) - super.primUpdateDOMFeature(noFeaturePrimKeyMapInfo, node, mofObject); - else - super.primUpdateDOMMultiFeature(map, node, mofObject); - } - protected boolean primUpdateMOFFeature(MapInfo map, Node node, EObject mofObject) { - boolean hasChanged = super.primUpdateMOFFeature(map, node, mofObject); - //If the key class has changed, from the xml side, then we need to make sure we stamp the primkey field - //as being specified from xml, since we will not automatically remove that node - if (map.getDOMName().equals(PRIM_KEY_CLASS)) { - updateXmlKeyField(noFeaturePrimKeyMapInfo, node); - if (hasChanged) - updateMOFPrimKeyFieldFeature(featurePrimKeyMapInfo, getNode(), true); - } - return hasChanged; - } - protected void primUpdateMOFMultiFeature(MapInfo map, Node node, EObject mofObject) { - if (map == noFeaturePrimKeyMapInfo) - return; - if (map.getDOMName().equals(PRIMKEY_FIELD)) { - updateMOFPrimKeyFieldFeature(map, node, false); - } else if (map.getDOMName().equals(CMP_FIELD)) { - //cache the old list of cmp attributes before update - List cmpAttributesListCOPY = new ArrayList(); - cmpAttributesListCOPY.addAll(getContainerManagedEntity().getPersistentAttributes()); - - //do the update - super.primUpdateMOFMultiFeature(map, node, mofObject); - - List newCmpAttributeList = getContainerManagedEntity().getPersistentAttributes(); - //key the cmp attribute list and the key attribute list. - performKeySynchronization(cmpAttributesListCOPY, newCmpAttributeList); - } else - super.primUpdateMOFMultiFeature(map, node, mofObject); - } - /** - * Method that synchronizies the list of cmp attributes that are keys with the key attribute list. - * When keys are added and deleted from the cmp attribute list. - * - * @param List cmpAttributesListCOPY - Copy of the cmp attribute list before any attributes where added - * or removed. - * @param List newCmpAttributeList - List of cmp attributes after a modification has occured. - */ - /* - protected void performKeySynchronization( List cmpAttributesListCOPY, List newCmpAttributeList ) { - if( cmpAttributesListCOPY != null && newCmpAttributeList != null ) { - - //add and removes keys based on what the adapters give back - - List addedCmpAttributeList = getCmpAttributesDeltaList( cmpAttributesListCOPY, newCmpAttributeList ); - if( addedCmpAttributeList != null && !addedCmpAttributeList.isEmpty() ) { - //determine if any of the added attributes are keys, if so get a list of them. - List addedKeyAttributeList = getKeyAttributesFromList( addedCmpAttributeList, getContainerManagedEntity().getPrimaryKey() ); - //now, add the keys to the list. - addKeysToKeyAttributeList( addedKeyAttributeList, getContainerManagedEntity() ); - }// if - - List subtractedCmpAttributeList = getCmpAttributesDeltaList( newCmpAttributeList, cmpAttributesListCOPY ); - if( subtractedCmpAttributeList != null && !subtractedCmpAttributeList.isEmpty() ) { - //determine if any of the subtracted attributes are keys, if so get a list of them. - List subtractedKeyAttributeList = getKeyAttributesFromList( subtractedCmpAttributeList, getContainerManagedEntity().getPrimaryKey() ); - //now, subtract the keys from the list. - removeKeysFromKeyAttributeList( subtractedKeyAttributeList, getContainerManagedEntity() ); - }// if - - }// if - }// performKeySynchronization - - /** - * Remove a bunch of keys from the current key attribute list. - * - * @param List subtractedKeyAttributeList - The list of keys to subtract from the key attributes list. - * @param ContainerManagedEntity cmp - The current container managed entity. - */ - - /* - public static void removeKeysFromKeyAttributeList( List subtractedKeyAttributeList, ContainerManagedEntity cmp ) { - if( subtractedKeyAttributeList != null && !subtractedKeyAttributeList.isEmpty() ) { - //Subtract the key attributes from the container managed entity - Iterator kli = subtractedKeyAttributeList.iterator(); - - while( kli.hasNext() ) { - CMPAttribute cmpAttribute = (CMPAttribute)kli.next(); - String cmpAttributeName = cmpAttribute.getName(); - if( cmpAttributeName != null ) { - if( cmp != null && cmp.getKeyAttributes() != null ) { - List keyAttributeList = cmp.getKeyAttributes(); - keyAttributeList.remove( cmpAttribute ); - }// if - }// if - }// while - }// if - }// performKeySynchronization - - /** - * Adds a bunch of keys to the current key attribute list. - * - * @param List addedCmpAttributeList - The list of keys to add to the key attributes list. - * @param ContainerManagedEntity cmp - The current container managed entity. - */ - - /* - public static void addKeysToKeyAttributeList( List addedKeyAttributeList, ContainerManagedEntity cmp ) { - if( addedKeyAttributeList != null && !addedKeyAttributeList.isEmpty() ) { - //Add the key attributes to the container managed entity - Iterator kli = addedKeyAttributeList.iterator(); - - while( kli.hasNext() ) { - CMPAttribute cmpAttribute = (CMPAttribute)kli.next(); - String cmpAttributeName = cmpAttribute.getName(); - if( cmpAttributeName != null ) { - if( cmp != null && cmp.getKeyAttributes() != null ) - cmp.addKeyAttributeName( cmpAttributeName ); - }// if - }// while - }// if - }// addKeysToKeyAttributeList - - /** - * Gets the key attributes contained in the list. - * - * @param List attributeList - List of attributes. - * @param JavaClass primaryKey - The primary key of the cmp. - * @return List - */ - - /* - public static List getKeyAttributesFromList( List attributeList, JavaClass primaryKey ) { - if (primaryKey == null || attributeList == null || attributeList.isEmpty()) - return Collections.EMPTY_LIST; - - List foundKeyAttributeList = new ArrayList(); - Iterator it = attributeList.iterator(); - while( it.hasNext() ) { - CMPAttribute cmpAttr = (CMPAttribute)it.next(); - if( cmpAttr != null ) { - String cmpAttributeName = cmpAttr.getName(); - if (cmpAttributeName != null) { - Field keyField = primaryKey.getField(cmpAttributeName); - if (keyField != null) - foundKeyAttributeList.add(cmpAttr); - }// if - } //if - }// while - return foundKeyAttributeList; - }// getKeyAttributesFromList - - /** - * Gets the delta elements of two lists - * - * @param List firstList - The list that is being compared too. - * @param List secondList - The list to check the difference of. - * @return List - */ - - /* - protected List getCmpAttributesDeltaList( List firstList, List secondList ) { - List diffAttributeList = new ArrayList(); - - if( firstList != null && secondList != null ) { - Iterator it = secondList.iterator(); - while( it.hasNext() ) { - CMPAttribute cmpAttribute = (CMPAttribute)it.next(); - if( cmpAttribute != null && !firstList.contains( cmpAttribute ) ) { - diffAttributeList.add( cmpAttribute ); - }// if - }// while - return diffAttributeList; - }// if - return java.util.Collections.EMPTY_LIST; - }// getCmpAttributesDeltaList - - protected void updateMOFPrimKeyFieldFeature(MapInfo map, Node node, boolean force) { - Resource res = getEObject().eResource(); - boolean modFlag = res == null ? false : res.isModified(); - String keyField = getDOMText(map, node); - //Determine if the prim-key field has changed. If so, then recompute the keys; otherwise leave - //it alone - if (keyField != null) - keyField = keyField.trim(); - CMPAttribute existingKeyAtt = getContainerManagedEntity().getPrimaryKeyAttribute(); - String existingKeyField = existingKeyAtt == null ? null : existingKeyAtt.getName(); - if (!force - && ((keyField == null && existingKeyField == null) - || (keyField != null && keyField.equals(existingKeyField)) - || (existingKeyField != null && existingKeyField.equals(keyField)))) - return; - - try { - getContainerManagedEntity().clearKeyAttributes(); //necessary to clear reflected flag - CMPAttribute keyAtt = null; - CMPSpecAdapter.setPrimKeyFieldFromXml(keyField, getContainerManagedEntity()); - if (keyField != null) { - keyAtt = getContainerManagedEntity().addKeyAttributeName(keyField, false); - if (keyAtt != null) { - //This is an invalid state. - String className = getContainerManagedEntity().getPrimaryKeyName(); - JavaClass ref = null; - if (className != null) - ref = JavaClassImpl.createClassRef(className); - keyAtt.setEType(ref); - } - } else { - //Hack to force the UI to refresh - EList keys = getContainerManagedEntity().getKeyAttributes(); - if (!keys.isEmpty()) - keys.set(0, keys.get(0)); - } - } finally { - if (res != null && res.isTrackingModification()) - res.setModified(modFlag); - } - } - protected void updateXmlKeyField(MapInfo map, Node node) { - String keyField = getDOMText(map, node); - CMPSpecAdapter.setPrimKeyFieldFromXml(keyField, getContainerManagedEntity()); - } - - /** - * @see AbstractDOMNodeAdapter#getMOFChildren(EObject, MapInfo) - */ - /* - protected List getMOFChildren(EObject mofObject, MapInfo map) { - if (getContainerManagedEntity().isVersion2_X() && CMP_FIELD.equals(map.getDOMName())) - return get20CMPAttributes((ContainerManagedEntity)mofObject); - else - return super.getMOFChildren(mofObject, map); - } - - /** - * Method get20CMPAttributes. - * @param containerManagedEntity - * @return List - */ - - /* - private List get20CMPAttributes(ContainerManagedEntity cmp) { - List allAttributes, removed, result; - removed = null; - allAttributes = cmp.getPersistentAttributes(); - int size = allAttributes.size(); - CMPAttribute att = null; - for (int i = 0; i < size; i++) { - att = (CMPAttribute) allAttributes.get(i); - if (att.isDerived()) { - if (removed == null) - removed = new ArrayList(); - removed.add(att); - } - } - if (removed != null) { - result = new ArrayList(size); - result.addAll(allAttributes); - result.removeAll(removed); - } else - result = allAttributes; - return result; - } - - /** - * @see com.ibm.etools.mof2dom.AbstractDOMNodeAdapter#notifyChanged(new ENotificationImpl((InternalEObject)Notifier, int,(EStructuralFeature) EObject, Object, Object, int)) - */ - - /* - public void notifyChanged(Notification notification) { - if (notification.getEventType() == ContainerManagedEntity.DERIVED_FLAG_CHANGE) - updateDOMFeature(getMap(CMP_FIELD), getNode(), getEObject()); - else - super.notifyChanged(notification); - } - - private MapInfo getMap(String aNodeName) { - for (int i = 0; i < fMaps.length; i++) { - if (aNodeName.equals(fMaps[i].getDOMName())) - return fMaps[i]; - } - return null; - } - */ - } - - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EJBJarTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EJBJarTranslator.java deleted file mode 100644 index 49afd53cc..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EJBJarTranslator.java +++ /dev/null @@ -1,426 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 27, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.SourceLinkTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; -import org.eclipse.wst.common.internal.emf.resource.TranslatorPath; - -/** - * @author schacher - */ -public class EJBJarTranslator extends RootTranslator implements EjbDeploymentDescriptorXmlMapperI, J2EEConstants { - private static final EjbPackage EJB_PKG = EjbPackage.eINSTANCE; - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - public static EJBJarTranslator INSTANCE = new EJBJarTranslator(); - private static Translator[] children13; - private static Translator[] children14; - - public static TranslatorPath ENTERPRISE_BEAN_NAME_TRANSLATOR_PATH = - new TranslatorPath( - new Translator[] { - new Translator(EJB_JAR, ROOT_FEATURE), - new Translator(EnterpriseBeansTranslator.ENTERPRISE_BEANS_PATH, EJB_PKG.getEJBJar_EnterpriseBeans()), - new Translator(EJB_NAME, EJB_PKG.getEnterpriseBean_Name())}); - - - private static final Translator CMR_FIELD_NAME_TRANSLATOR = new Translator(CMR_FIELD_NAME, EcorePackage.eINSTANCE.getENamedElement_Name()); - private static final Translator CMR_FIELD_TYPE_TRANSLATOR = new JavaClassTranslator(CMR_FIELD_TYPE, EJB_PKG.getCMRField_CollectionType()); - private static final Translator ROLE_SOURCE_EJB_NAME_SOURCELINK_TRANSLATOR = new SourceLinkTranslator(EJB_NAME, EJB_PKG.getRoleSource_EntityBean(), ENTERPRISE_BEAN_NAME_TRANSLATOR_PATH); - private static final Translator EJB_RELATIONSHIP_ROLE_NAME_TRANSLATOR = new Translator(EJB_RELATIONSHIP_ROLE_NAME, EJB_PKG.getEJBRelationshipRole_RoleName()); - private static final Translator MULTIPLICITY_TRANSLATOR = new MultiplicityTranslator(); - private static final Translator CASCADE_DELETE_TRANSLATOR = new Translator(CASCADE_DELETE, EJB_PKG.getEJBRelationshipRole_CascadeDelete(), Translator.EMPTY_TAG); - private static final Translator EJB_RELATION_NAME_TRANSLATOR = new Translator(EJB_RELATION_NAME, EJB_PKG.getEJBRelation_Name()); - private static final Translator UNCHECKED_TRANSLATOR = new Translator(UNCHECKED, EJB_PKG.getMethodPermission_Unchecked(), Translator.EMPTY_TAG); - private static final Translator METHOD_PERMISSION_ROLE_NAME_SOURCELINK_TRANSLATOR = new SourceLinkTranslator(ROLE_NAME,EJB_PKG.getMethodPermission_Roles(),new TranslatorPath( - new Translator[] { - new Translator(ASSEMBLY_DESCRIPTOR, CONTAINER_FEATURE), - new Translator(SECURITY_ROLE, EJB_PKG.getAssemblyDescriptor_SecurityRoles()), - new Translator(ROLE_NAME, CommonPackage.eINSTANCE.getSecurityRole_RoleName()) - })); - private static final Translator SEC_ROLE_NAME_TRANSLATOR = new Translator(ROLE_NAME, CommonPackage.eINSTANCE.getSecurityRole_RoleName(), new TranslatorPath( - new Translator[] { - new Translator(ASSEMBLY_DESCRIPTOR, CONTAINER_FEATURE), - new Translator(METHOD_PERMISSION, EJB_PKG.getAssemblyDescriptor_MethodPermissions()), - new Translator(SECURITY_ROLE, EJB_PKG.getMethodPermission_Roles()), - new Translator(ROLE_NAME, CommonPackage.eINSTANCE.getSecurityRole_RoleName()) - })); - - private static final Translator TRANS_ATTRIBUTE_TRANSLATOR = new Translator(TRANS_ATTRIBUTE, EJB_PKG.getMethodTransaction_TransactionAttribute()); - private static final Translator METHOD_ELEMENT_EJB_NAME_SOURCELINK_TRANSLATOR = new SourceLinkTranslator(EJB_NAME, EJB_PKG.getMethodElement_EnterpriseBean(), EJBJarTranslator.ENTERPRISE_BEAN_NAME_TRANSLATOR_PATH); - private static final Translator METHOD_NAME_TRANSLATOR = new Translator(METHOD_NAME, EJB_PKG.getMethodElement_Name()); - private static final Translator METHOD_PARAM_TRANSLATOR = new MethodParamsTranslator(EJB_PKG.getMethodElement_Parms()); - private static final Translator METHOD_ELEMENT_KIND_TRANSLATOR = new MethodElementKindTranslator(); - - public EJBJarTranslator() { - super(EJB_JAR, EJB_PKG.getEJBJar()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - protected Translator[] create13Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new EnterpriseBeansTranslator(), - createRelationshipsTranslator13(), - createAssemblyDescriptorTranslator13(), - new Translator(EJB_CLIENT_JAR, EJB_PKG.getEJBJar_EjbClientJar()), - }; - } - - protected Translator[] create14Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(VERSION, EJB_PKG.getEJBJar_Version(), DOM_ATTRIBUTE), - new ConstantAttributeTranslator(XML_NS, J2EE_NS_URL), - new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL), - new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, J2EE_NS_URL+' '+EJB_JAR_SCHEMA_LOC_2_1), - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new EnterpriseBeansTranslator(), - createRelationshipsTranslator14(), - createAssemblyDescriptorTranslator14(), - new Translator(EJB_CLIENT_JAR, EJB_PKG.getEJBJar_EjbClientJar()), - // CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getEJBJar_Extensions()) - }; - } - - public static Translator createRelationshipsTranslator13() { - GenericTranslator result = new GenericTranslator(RELATIONSHIPS, EJB_PKG.getEJBJar_RelationshipList()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getRelationships_Description()), - createEJBRelationsTranslator13(), - }); - return result; - } - - private static Translator createEJBRelationsTranslator13() { - GenericTranslator result = new GenericTranslator(EJB_RELATION, EJB_PKG.getRelationships_EjbRelations()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getEJBRelation_Description()), - EJB_RELATION_NAME_TRANSLATOR, - createEJBRelationshipRoleTranslator13(), - }); - return result; - } - - private static Translator createEJBRelationshipRoleTranslator13() { - GenericTranslator result = new GenericTranslator(EJB_RELATIONSHIP_ROLE, EJB_PKG.getEJBRelation_RelationshipRoles()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getEJBRelationshipRole_Description()), - EJB_RELATIONSHIP_ROLE_NAME_TRANSLATOR, - MULTIPLICITY_TRANSLATOR, - CASCADE_DELETE_TRANSLATOR, - createRelationshipRoleSourceTranslator13(), - createCMRFieldTranslator13(), - }); - return result; - } - - private static Translator createRelationshipRoleSourceTranslator13() { - GenericTranslator result = new GenericTranslator(RELATIONSHIP_ROLE_SOURCE, EJB_PKG.getEJBRelationshipRole_Source()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getRoleSource_Description()), - ROLE_SOURCE_EJB_NAME_SOURCELINK_TRANSLATOR, - }); - return result; - } - - private static Translator createCMRFieldTranslator13() { - GenericTranslator result = new GenericTranslator(CMR_FIELD, EJB_PKG.getEJBRelationshipRole_CmrField()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getCMPAttribute_Description()), - CMR_FIELD_NAME_TRANSLATOR, - CMR_FIELD_TYPE_TRANSLATOR - }); - return result; - } - - - /** - * J2EE 1.4 Relationship - * - */ - public static Translator createRelationshipsTranslator14() { - GenericTranslator result = new GenericTranslator(RELATIONSHIPS, EJB_PKG.getEJBJar_RelationshipList()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getRelationships_Descriptions()), - createEJBRelationsTranslator14(), - // CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getRelationships_Extensions()) - }); - return result; - } - - private static Translator createEJBRelationsTranslator14() { - GenericTranslator result = new GenericTranslator(EJB_RELATION, EJB_PKG.getRelationships_EjbRelations()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getEJBRelation_Descriptions()), - EJB_RELATION_NAME_TRANSLATOR, - createEJBRelationshipRoleTranslator14(), - // CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getEJBRelation_Extensions()) - }); - return result; - } - - private static Translator createEJBRelationshipRoleTranslator14() { - GenericTranslator result = new GenericTranslator(EJB_RELATIONSHIP_ROLE, EJB_PKG.getEJBRelation_RelationshipRoles()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getEJBRelationshipRole_Descriptions()), - EJB_RELATIONSHIP_ROLE_NAME_TRANSLATOR, - MULTIPLICITY_TRANSLATOR, - CASCADE_DELETE_TRANSLATOR, - createRelationshipRoleSourceTranslator14(), - createCMRFieldTranslator14(), - // CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getEJBRelationshipRole_Extensions()) - }); - return result; - } - - private static Translator createRelationshipRoleSourceTranslator14() { - GenericTranslator result = new GenericTranslator(RELATIONSHIP_ROLE_SOURCE, EJB_PKG.getEJBRelationshipRole_Source()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getRoleSource_Descriptions()), - ROLE_SOURCE_EJB_NAME_SOURCELINK_TRANSLATOR - }); - return result; - } - - private static Translator createCMRFieldTranslator14() { - GenericTranslator result = new GenericTranslator(CMR_FIELD, EJB_PKG.getEJBRelationshipRole_CmrField()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getCMPAttribute_Descriptions()), - CMR_FIELD_NAME_TRANSLATOR, - CMR_FIELD_TYPE_TRANSLATOR, - // CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getCMPAttribute_Extensions()) - }); - return result; - } - - /* - * <= J2EE 1.3 Assembly Descriptor - */ - public static Translator createAssemblyDescriptorTranslator13() { - GenericTranslator result = new GenericTranslator(ASSEMBLY_DESCRIPTOR, EJB_PKG.getEJBJar_AssemblyDescriptor()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - createSecurityRoleTranslator13(), - createMethodPermissionTranslator13(), - createMethodTransactionTranslator13(), - createExcludesListTranslator13(), - }); - return result; - } - - public static Translator createMethodPermissionTranslator13() { - GenericTranslator result = new GenericTranslator(METHOD_PERMISSION, EJB_PKG.getAssemblyDescriptor_MethodPermissions()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getMethodPermission_Description()), - UNCHECKED_TRANSLATOR, - METHOD_PERMISSION_ROLE_NAME_SOURCELINK_TRANSLATOR, - createMethodElementTranslators13(EJB_PKG.getMethodPermission_MethodElements()) - }); - - return result; - } - - //TODO: NEED TO FIGURE OUT SECURITY PATH - public static Translator createSecurityRoleTranslator13() { - GenericTranslator result = new GenericTranslator(SECURITY_ROLE, EJB_PKG.getAssemblyDescriptor_SecurityRoles()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, CommonPackage.eINSTANCE.getSecurityRole_Description()), - SEC_ROLE_NAME_TRANSLATOR - }); - - return result; - } - - public static Translator createMethodTransactionTranslator13() { - GenericTranslator result = new GenericTranslator(CONTAINER_TRANSACTION, EJB_PKG.getAssemblyDescriptor_MethodTransactions()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getMethodTransaction_Description()), - createMethodElementTranslators13(EJB_PKG.getMethodTransaction_MethodElements()), - TRANS_ATTRIBUTE_TRANSLATOR - }); - - return result; - } - - public static Translator createExcludesListTranslator13() { - GenericTranslator result = new GenericTranslator(EXCLUDE_LIST, EJB_PKG.getAssemblyDescriptor_ExcludeList()); - result.setChildren( new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getExcludeList_Description()), - createMethodElementTranslators13(EJB_PKG.getExcludeList_MethodElements()) - }); - return result; - } - - public static Translator createMethodElementTranslators13(EStructuralFeature eFeature) { - GenericTranslator result = new GenericTranslator(METHOD, eFeature); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, EJB_PKG.getMethodElement_Description()), - METHOD_ELEMENT_EJB_NAME_SOURCELINK_TRANSLATOR, - METHOD_ELEMENT_KIND_TRANSLATOR, - METHOD_NAME_TRANSLATOR, - METHOD_PARAM_TRANSLATOR - }); - return result; - } - - - /* - * J2EE 1.4 Assembly Descriptor - */ - public static Translator createAssemblyDescriptorTranslator14() { - GenericTranslator result = new GenericTranslator(ASSEMBLY_DESCRIPTOR, EJB_PKG.getEJBJar_AssemblyDescriptor()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - createSecurityRoleTranslator14(), - createMethodPermissionTranslator14(), - createMethodTransactionTranslator14(), - CommonTranslators.createMessageDestinationTranslator(EJB_PKG.getAssemblyDescriptor_MessageDestinations()), - createExcludesListTranslator14(), - // CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getAssemblyDescriptor_Extensions()) - }); - return result; - } - - public static Translator createMethodPermissionTranslator14() { - GenericTranslator result = new GenericTranslator(METHOD_PERMISSION, EJB_PKG.getAssemblyDescriptor_MethodPermissions()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getMethodPermission_Descriptions()), - UNCHECKED_TRANSLATOR, - METHOD_PERMISSION_ROLE_NAME_SOURCELINK_TRANSLATOR, - createMethodElementTranslators14(EJB_PKG.getMethodPermission_MethodElements()) - }); - - return result; - } - - //TODO: NEED TO FIGURE OUT SECURITY PATH - public static Translator createSecurityRoleTranslator14() { - GenericTranslator result = new GenericTranslator(SECURITY_ROLE, EJB_PKG.getAssemblyDescriptor_SecurityRoles()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(CommonPackage.eINSTANCE.getSecurityRole_Descriptions()), - SEC_ROLE_NAME_TRANSLATOR - }); - - return result; - } - - public static Translator createMethodTransactionTranslator14() { - GenericTranslator result = new GenericTranslator(CONTAINER_TRANSACTION, EJB_PKG.getAssemblyDescriptor_MethodTransactions()); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getMethodTransaction_Descriptions()), - createMethodElementTranslators14(EJB_PKG.getMethodTransaction_MethodElements()), - TRANS_ATTRIBUTE_TRANSLATOR - }); - - return result; - } - - public static Translator createExcludesListTranslator14() { - GenericTranslator result = new GenericTranslator(EXCLUDE_LIST, EJB_PKG.getAssemblyDescriptor_ExcludeList()); - result.setChildren( new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getExcludeList_Descriptions()), - createMethodElementTranslators14(EJB_PKG.getExcludeList_MethodElements()) - }); - return result; - } - - public static Translator createMethodElementTranslators14(EStructuralFeature eFeature) { - GenericTranslator result = new GenericTranslator(METHOD, eFeature); - result.setChildren( - new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createDescriptionTranslator(EJB_PKG.getMethodElement_Descriptions()), - METHOD_ELEMENT_EJB_NAME_SOURCELINK_TRANSLATOR, - METHOD_ELEMENT_KIND_TRANSLATOR, - METHOD_NAME_TRANSLATOR, - METHOD_PARAM_TRANSLATOR - }); - return result; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EnterpriseBeansTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EnterpriseBeansTranslator.java deleted file mode 100644 index eba27c161..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EnterpriseBeansTranslator.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 27, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.MultiObjectTranslator; -import org.eclipse.wst.common.internal.emf.resource.ReadAheadHelper; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class EnterpriseBeansTranslator extends MultiObjectTranslator implements EjbDeploymentDescriptorXmlMapperI { - public static final String ENTERPRISE_BEANS_PATH = ENTERPRISE_BEANS+'/'+ENTITY+','+SESSION+','+MESSAGE_DRIVEN; - private static final EjbPackage EJB_PKG = EjbPackage.eINSTANCE; - private static final SessionTranslator SESSION_TRANSLATOR = new SessionTranslator(); - private static final EntityTranslator BMP_TRANSLATOR = new EntityTranslator(); - private static final ContainerManagedEntityTranslator CMP_TRANSLATOR= new ContainerManagedEntityTranslator(); - private static final MessageDrivenTranslator MESSAGE_DRIVEN_TRANSLATOR = new MessageDrivenTranslator(); - private static Map delegates; - static { - delegates = new HashMap(7); - delegates.put(SESSION, SESSION_TRANSLATOR); - delegates.put(BEAN, BMP_TRANSLATOR); - delegates.put(CONTAINER, CMP_TRANSLATOR); - delegates.put(MESSAGE_DRIVEN, MESSAGE_DRIVEN_TRANSLATOR); - } - - /** - * @param domNameAndPath - * @param eClass - */ - public EnterpriseBeansTranslator() { - super(ENTERPRISE_BEANS_PATH, EJB_PKG.getEJBJar_EnterpriseBeans()); - addReadAheadHelper(new ReadAheadHelper(ENTITY, new String[] {BEAN, CONTAINER}, PERSISTENCE_TYPE )); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.MultiObjectTranslator#getDelegateFor(org.eclipse.emf.ecore.EObject) - */ - public Translator getDelegateFor(EObject o) { - switch (o.eClass().getClassifierID()) { - case EjbPackage.SESSION : - return SESSION_TRANSLATOR; - case EjbPackage.ENTITY: - return BMP_TRANSLATOR; - case EjbPackage.CONTAINER_MANAGED_ENTITY: - return CMP_TRANSLATOR; - case EjbPackage.MESSAGE_DRIVEN: - return MESSAGE_DRIVEN_TRANSLATOR; - } - throw new IllegalStateException("Bean type delegate expected"); //$NON-NLS-1$ - } - - public Translator getDelegateFor(String domName, String readAheadName) { - Translator result = null; - if (readAheadName != null) - result = (Translator) delegates.get(readAheadName); - else - result = (Translator) delegates.get(domName); - - if (result == null) - throw new IllegalStateException("Bean type delegate expected"); //$NON-NLS-1$ - - return result; - } - - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EntityTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EntityTranslator.java deleted file mode 100644 index ef05ac4a9..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/EntityTranslator.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 31, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.ejb.EjbFactory; -import org.eclipse.jst.j2ee.internal.model.translator.common.BooleanTranslator; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class EntityTranslator extends AbstractEJBTranslator { - - private static Translator[] children13; - private static Translator[] children14; - - private class PersistenceTypeTranslator extends Translator { - - public PersistenceTypeTranslator() { - super(PERSISTENCE_TYPE, (EStructuralFeature) null); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#extractStringValue(org.eclipse.emf.ecore.EObject) - */ - public String extractStringValue(EObject emfObject) { - return getPersistenceType(); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#convertValueToString(java.lang.Object, org.eclipse.emf.ecore.EObject) - */ - public String convertValueToString(Object value, EObject owner) { - return getPersistenceType(); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getMOFChildren(org.eclipse.emf.ecore.EObject) - */ - public List getMOFChildren(EObject mofObject) { - return Collections.singletonList(getPersistenceType()); - } - - - } - - protected String getPersistenceType() { - return BEAN; - } - /** - * @param domNameAndPath - * @param aFeature - */ - public EntityTranslator() { - super(ENTERPRISE_BEANS + '/' + ENTITY); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.internal.internal.model.translator.ejb.AbstractEJBTranslator#getSpecificMaps() - */ - protected Translator[] getSpecificMaps(int versionID) { - Translator reentrantTranslator = null; - switch (versionID) { - case J2EE_1_2_ID : - case J2EE_1_3_ID : - reentrantTranslator = new Translator(REENTRANT, EJB_PKG.getEntity_Reentrant(), UNSET_IF_NULL); - break; - case J2EE_1_4_ID : - reentrantTranslator = new BooleanTranslator(REENTRANT, EJB_PKG.getEntity_Reentrant()); - default : - break; - } - return new Translator[] { new PersistenceTypeTranslator(), new JavaClassTranslator(PRIM_KEY_CLASS, EJB_PKG.getEntity_PrimaryKey()), reentrantTranslator }; - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - return EjbFactory.eINSTANCE.createEntity(); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MessageDrivenDestinationTypeTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MessageDrivenDestinationTypeTranslator.java deleted file mode 100644 index 724902835..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MessageDrivenDestinationTypeTranslator.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 3, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.common.util.Enumerator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author administrator - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class MessageDrivenDestinationTypeTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI { - protected static final EjbPackage EJB_PKG = EjbPackage.eINSTANCE; - public static final String JAVAX_JMS = "javax.jms."; //$NON-NLS-1$ - - - public MessageDrivenDestinationTypeTranslator() { - super(DESTINATION_TYPE, EJB_PKG.getMessageDrivenDestination_Type()); - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#convertValueToString(java.lang.Object, org.eclipse.emf.ecore.EObject) - */ - public String convertValueToString(Object value, EObject owner) { - if (value != null){ - Enumerator enumerator = (Enumerator) value; - if (enumerator != null) - return JAVAX_JMS + enumerator.toString(); - } - return super.convertValueToString(value, owner); - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(java.lang.String, org.eclipse.emf.ecore.EObject) - */ - public Object convertStringToValue(String strValue, EObject owner) { - String correct = strValue; - if (strValue != null) - correct = strValue.substring(JAVAX_JMS.length()); - return super.convertStringToValue(correct, owner); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MessageDrivenTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MessageDrivenTranslator.java deleted file mode 100644 index 8d9c762b7..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MessageDrivenTranslator.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 31, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.EjbFactory; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class MessageDrivenTranslator extends AbstractEJBTranslator { - private static Translator[] children13; - private static Translator[] children14; - - private static Translator TRANSACTION_TYPE_XLATOR = new Translator(TRANSACTION_TYPE, EJB_PKG.getMessageDriven_TransactionType()); - - /** - * @param domNameAndPath - * @param aFeature - */ - public MessageDrivenTranslator() { - super(ENTERPRISE_BEANS+'/'+MESSAGE_DRIVEN); - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.internal.internal.model.translator.ejb.AbstractEJBTranslator#getSpecificMaps() - */ - protected Translator[] getSpecificMaps(int versionID) { - switch (versionID) { - case J2EE_1_4_ID: - return getSpecificMaps14(); - default: - return getSpecificMaps13(); - } - } - - protected Translator[] getSpecificMaps13() { - - return new Translator[] { - TRANSACTION_TYPE_XLATOR, - - //EJB 2.0 PATH - new Translator(MESSAGE_SELECTOR, EJB_PKG.getMessageDriven_MessageSelector()), - new AcknowledgeModeTranslator(), - createMessageDrivenDestinationTranslator(), - - }; - } - - protected Translator[] getSpecificMaps14() { - - return new Translator[] { - //EJB 2.1 Only - new JavaClassTranslator(MESSAGING_TYPE, EJB_PKG.getMessageDriven_MessagingType()), - //Both - TRANSACTION_TYPE_XLATOR, - //EJB 2.1 PATH - new JavaClassTranslator(MESSAGE_DEST_TYPE, EJB_PKG.getMessageDriven_MessageDestination()), - new Translator(MESSAGE_DEST_LINK, EJB_PKG.getMessageDriven_Link()), - createActivationConfigurationMaps(), - }; - } - - - /** - * @return - */ - private Translator createActivationConfigurationMaps() { - GenericTranslator result = new GenericTranslator(ACTIVATION_CONF, EJB_PKG.getMessageDriven_ActivationConfig()); - result.setChildren(new Translator[]{ - CommonTranslators.createDescriptionTranslator(EJB_PKG.getActivationConfig_Descriptions()), - createActivationConfigPropertiesMap(), - // CommonTranslators.createDeploymentExtensionTranslator(EJB_PKG.getActivationConfig_Extensions()) - }); - - return result; - } - - - /** - * @return - */ - private Translator createActivationConfigPropertiesMap() { - GenericTranslator result = new GenericTranslator(ACTIVATION_CONF_PROPERTY, EJB_PKG.getActivationConfig_ConfigProperties()); - result.setChildren(new Translator[] { - new Translator(ACTIVATION_CONF_PROPERTY_NAME, EJB_PKG.getActivationConfigProperty_Name()), - new Translator(ACTIVATION_CONF_PROPERTY_VALUE, EJB_PKG.getActivationConfigProperty_Value()) - }); - return result; - } - - - /** - * @return - */ - protected Translator createMessageDrivenDestinationTranslator() { - GenericTranslator result = new GenericTranslator(MESSAGE_DRIVEN_DESTINATION,EJB_PKG.getMessageDriven_Destination()); - result.setChildren( new Translator[]{ - new MessageDrivenDestinationTypeTranslator(), - new Translator(SUBSCRIPTION_DURABILITY, EJB_PKG.getMessageDrivenDestination_SubscriptionDurability()) - }); - return result; - } - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - return EjbFactory.eINSTANCE.createMessageDriven(); - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.internal.internal.model.translator.ejb.AbstractEJBTranslator#getEndMaps13() - */ - protected Translator[] getEndMaps13() { - return new Translator[] { - CommonTranslators.JNDI_REF_GROUP_ENV_ENTRY_1_3, - CommonTranslators.JNDI_REF_GROUP_EJB_REF_1_3, - CommonTranslators.JNDI_REF_GROUP_EJB_LOCAL_REF_1_3, - new SecurityIdentityTranslator(), - CommonTranslators.JNDI_REF_GROUP_RESOURCE_REF_1_3, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_ENV_REF_1_3 - }; - } - - protected Translator[] getEndMaps14() { - return new Translator[] { - CommonTranslators.JNDI_REF_GROUP_ENV_ENTRY_1_4, - CommonTranslators.JNDI_REF_GROUP_EJB_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_EJB_LOCAL_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_SERVICE_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_ENV_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_MESSAGE_DEST_REF_1_4, - new SecurityIdentityTranslator(), - }; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.internal.internal.model.translator.ejb.AbstractEJBTranslator#usesHomeRemoteAttributes() - */ - protected boolean usesHomeRemoteAttributes() { - return false; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MethodElementKindTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MethodElementKindTranslator.java deleted file mode 100644 index 668735ab5..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MethodElementKindTranslator.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.ejb; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.ejb.MethodElement; -import org.eclipse.jst.j2ee.ejb.MethodElementKind; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class MethodElementKindTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI { - private static final EjbPackage EJB_PKG = EjbPackage.eINSTANCE; - /** - * @param domNameAndPath - * @param eClass - */ - public MethodElementKindTranslator(){ - super(METHOD_INTF, EJB_PKG.getMethodElement_Type()); - } - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(java.lang.String, org.eclipse.emf.ecore.EObject) - */ - public Object convertStringToValue(String strValue, EObject owner) { - Object obj = super.convertStringToValue(strValue, owner); - if(obj != null) - return obj; - String correct = strValue; - if (strValue.equalsIgnoreCase("HOME")) //$NON-NLS-1$ - correct = "Home"; //$NON-NLS-1$ - else if (strValue.equalsIgnoreCase("REMOTE")) //$NON-NLS-1$ - correct = "Remote"; //$NON-NLS-1$ - else if (strValue.equalsIgnoreCase("LOCALHOME")) //$NON-NLS-1$ - correct = "LocalHome"; //$NON-NLS-1$ - else if (strValue.equalsIgnoreCase("LOCAL")) //$NON-NLS-1$ - correct = "Local"; //$NON-NLS-1$ - return super.convertStringToValue(correct, owner); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#isSetMOFValue(org.eclipse.emf.ecore.EObject) - */ - public boolean isSetMOFValue(EObject emfObject) { - if (((MethodElement)emfObject).getType() == MethodElementKind.UNSPECIFIED_LITERAL) - return false; - return super.isSetMOFValue(emfObject); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getMOFChildren(org.eclipse.emf.ecore.EObject) - */ - public List getMOFChildren(EObject mofObject) { - List result = super.getMOFChildren(mofObject); - if(result != null && result.size() > 0) { - MethodElementKind methodIntf = (MethodElementKind) result.get(0); - if(methodIntf.getValue() == MethodElementKind.UNSPECIFIED) - result = Collections.EMPTY_LIST; - } - return result; - } - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MethodParamsTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MethodParamsTranslator.java deleted file mode 100644 index 988252fb8..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MethodParamsTranslator.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 2, 2003 - * - * To change this generated comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import java.util.List; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.ejb.MethodElement; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author dfholttp - * - * To change this generated comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class MethodParamsTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI{ - protected static final EjbPackage EJB_PKG = EjbPackage.eINSTANCE; - - //private EStructuralFeature eFeature; - - public MethodParamsTranslator(EStructuralFeature eFeature) { - super(METHOD_PARAMS+'/'+METHOD_PARAM , eFeature); - //this.eFeature = eFeature; - this.fStyle |= Translator.EMPTY_CONTENT_IS_SIGNIFICANT; - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#isMultiValued() - */ - public boolean isMultiValued() { - return true; - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getMOFChildren(org.eclipse.emf.ecore.EObject) - */ - public List getMOFChildren(EObject mofObject) { - return ((MethodElement)mofObject).getMethodParams(); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#setMOFValue(org.eclipse.emf.ecore.EObject, java.lang.Object) - */ - public void setMOFValue(EObject mofObject, Object value) { - List methodParams = ((MethodElement)mofObject).getMethodParams(); - - if(value == null || value.toString().length() == 0) { - if(methodParams == null || methodParams.size() == 0 ) { - setMOFValueFromEmptyDOMPath(mofObject); - } - } else { - ((MethodElement)mofObject).addMethodParams((String)value); - } - } - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#setMOFValue(org.eclipse.emf.common.notify.Notifier, java.lang.Object, int) - */ - public void setMOFValue(Notifier owner, Object value, int newIndex) { - ((MethodElement)owner).addMethodParams((String)value); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#clearList(org.eclipse.emf.ecore.EObject) - */ - public void clearList(EObject mofObject) { - ((MethodElement)mofObject).eUnset(feature); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#shouldRenderEmptyDOMPath(org.eclipse.emf.ecore.EObject) - */ - public boolean shouldRenderEmptyDOMPath(EObject eObject) { - MethodElement me = ((MethodElement)eObject); - return me.hasMethodParams() && me.getMethodParams().isEmpty(); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#setMOFValueFromEmptyDOMPath(org.eclipse.emf.ecore.EObject) - */ - public void setMOFValueFromEmptyDOMPath(EObject eObject) { - ((MethodElement)eObject).applyZeroParams(); - } -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MultiplicityTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MultiplicityTranslator.java deleted file mode 100644 index ddd1b5bf3..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/MultiplicityTranslator.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 2, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author administrator - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class MultiplicityTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI{ - - public MultiplicityTranslator(){ - super(MULTIPLICITY,EjbPackage.eINSTANCE.getEJBRelationshipRole_Multiplicity()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(java.lang.String, org.eclipse.emf.ecore.EObject) - */ - public Object convertStringToValue(String strValue, EObject owner) { - String correct = strValue; - if (strValue.toUpperCase().equals("ONE")) //$NON-NLS-1$ - correct = "One"; //$NON-NLS-1$ - else if (strValue.toUpperCase().equals("MANY")) //$NON-NLS-1$ - correct = "Many"; //$NON-NLS-1$ - - return super.convertStringToValue(correct, owner); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/PrimKeyFieldTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/PrimKeyFieldTranslator.java deleted file mode 100644 index 20d3124e6..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/PrimKeyFieldTranslator.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 3, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.jst.j2ee.ejb.ContainerManagedEntity; -import org.eclipse.jst.j2ee.ejb.EjbFactory; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.SourceLinkTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; -import org.eclipse.wst.common.internal.emf.resource.TranslatorPath; - -/** - * @author jlanuti - */ -public class PrimKeyFieldTranslator extends SourceLinkTranslator implements EjbDeploymentDescriptorXmlMapperI { - - /** - * @param domNameAndPath - * @param eClass - * @param TranslatorPath - */ - public PrimKeyFieldTranslator() { - super(PRIMKEY_FIELD, EjbPackage.eINSTANCE.getContainerManagedEntity_PrimKeyField(),new TranslatorPath( - new Translator[] { - new Translator(CMP_FIELD, EjbPackage.eINSTANCE.getContainerManagedEntity_PersistentAttributes()), - new Translator(FIELD_NAME, EcorePackage.eINSTANCE.getENamedElement_Name()) - })); - } - - protected String getSpecifiedPrimKeyFieldName(ContainerManagedEntity cmp) { - return cmp.getPrimKeyField().getName(); - } - - /** - * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(java.lang.String, org.eclipse.emf.ecore.EObject) - */ - public Object convertStringToValue(String strValue, EObject owner) { - // try and convert the string to a cmp attribute, otherwise create a proxy - Object result = super.convertStringToValue(strValue, owner); - if (result == null || result == strValue /*reference check is valid here*/) { - result = EjbFactory.eINSTANCE.createCMPAttribute(); - if (strValue == null) strValue = "";//$NON-NLS-1$ - ((InternalEObject)result).eSetProxyURI(URI.createURI(strValue)); - } - return result; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/SecurityIdentityTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/SecurityIdentityTranslator.java deleted file mode 100644 index c219b7700..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/SecurityIdentityTranslator.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Apr 1, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.common.RunAsSpecifiedIdentity; -import org.eclipse.jst.j2ee.common.SecurityIdentity; -import org.eclipse.jst.j2ee.ejb.EjbPackage; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.xml.EjbDeploymentDescriptorXmlMapperI; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.ReadAheadHelper; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class SecurityIdentityTranslator extends Translator implements EjbDeploymentDescriptorXmlMapperI { - private static final CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - - private static final Translator[] RUN_AS_TRANSLATORS = createRunAsTranslators(); - - private static final Translator[] USE_CALLER_TRANSLATORS = createUseCallerTranslators(); - - - private static Translator[] createRunAsTranslators() { - GenericTranslator runAsTranslator = new GenericTranslator(RUN_AS, COMMON_PKG.getRunAsSpecifiedIdentity_Identity()); - runAsTranslator.setChildren(new Translator[] { - new Translator(DESCRIPTION, COMMON_PKG.getIdentity_Description()), - new Translator(ROLE_NAME, COMMON_PKG.getIdentity_RoleName()) - }); - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getSecurityIdentity_Description()), - runAsTranslator - }; - } - - private static Translator[] createUseCallerTranslators() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getSecurityIdentity_Description()), - new Translator(USE_CALLER_IDENTITY, null, EMPTY_TAG) - }; - } - - /** - * @param domNameAndPath - * @param aFeature - */ - public SecurityIdentityTranslator() { - super(SECURITY_IDENTITY, EjbPackage.eINSTANCE.getEnterpriseBean_SecurityIdentity()); - addReadAheadHelper(new ReadAheadHelper(SECURITY_IDENTITY, new String[] {RUN_AS, USE_CALLER_IDENTITY}, null)); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - if (((SecurityIdentity)o).isRunAsSpecifiedIdentity()) - return RUN_AS_TRANSLATORS; - else if (((SecurityIdentity)o).isUseCallerIdentity()) - return USE_CALLER_TRANSLATORS; - else - throw new IllegalStateException("Internal error: Security Identity Type expected"); //$NON-NLS-1$ - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - CommonFactory fact = CommonFactory.eINSTANCE; - if (RUN_AS.equals(readAheadName)) { - RunAsSpecifiedIdentity result = fact.createRunAsSpecifiedIdentity(); - result.setIdentity(fact.createIdentity()); - return result; - } else if (USE_CALLER_IDENTITY.equals(readAheadName)) - return fact.createUseCallerIdentity(); - else - return null; - } - - public boolean isManagedByParent() { - return false; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/SessionTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/SessionTranslator.java deleted file mode 100644 index 853d4c372..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/ejb/SessionTranslator.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 31, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.ejb; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.ejb.EjbFactory; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class SessionTranslator extends AbstractEJBTranslator { - - private static Translator[] children13; - private static Translator[] children14; - /** - * @param domNameAndPath - * @param aFeature - */ - public SessionTranslator() { - super(ENTERPRISE_BEANS+'/'+SESSION); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.internal.internal.model.translator.ejb.AbstractEJBTranslator#getSpecificMaps() - */ - protected Translator[] getSpecificMaps(int versionID) { - return new Translator[] { - new Translator(SESSION_TYPE, EJB_PKG.getSession_SessionType(), UNSET_IF_NULL), //Enumeration - new Translator(TRANSACTION_TYPE, EJB_PKG.getSession_TransactionType(), UNSET_IF_NULL) //Enumeration - }; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.internal.internal.model.translator.ejb.AbstractEJBTranslator#getEJBClassMap() - * - * Support 1.4 and 1.3 - */ - protected Translator[] getEJBClassMap() { - return new Translator[] { - //J2EE 1.4 - new JavaClassTranslator(SERVICE_ENDPOINT,EJB_PKG.getSession_ServiceEndpoint()), - //J2EE 1.3 - new JavaClassTranslator(EJB_CLASS, EJB_PKG.getEnterpriseBean_EjbClass()) - }; - - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - return EjbFactory.eINSTANCE.createSession(); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - - - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/ErrorPageTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/ErrorPageTranslator.java deleted file mode 100644 index 45c05770f..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/ErrorPageTranslator.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 21, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.webapplication; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.jst.j2ee.internal.xml.WarDeploymentDescriptorXmlMapperI; -import org.eclipse.jst.j2ee.webapplication.ErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emf.resource.ReadAheadHelper; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class ErrorPageTranslator extends Translator implements WarDeploymentDescriptorXmlMapperI { - private static Translator[] ERROR_CODE_XLATORS = new Translator[] { - new Translator(ERROR_CODE, WebapplicationPackage.eINSTANCE.getErrorCodeErrorPage_ErrorCode()), - new Translator(LOCATION, WebapplicationPackage.eINSTANCE.getErrorPage_Location()) - }; - private static Translator[] EXCEPTION_TYPE_XLATORS = new Translator[] { - new JavaClassTranslator(EXCEPTION_TYPE, WebapplicationPackage.eINSTANCE.getExceptionTypeErrorPage_ExceptionType()), - new Translator(LOCATION, WebapplicationPackage.eINSTANCE.getErrorPage_Location()) - }; - - public ErrorPageTranslator() { - super(ERROR_PAGE, WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages()); - addReadAheadHelper(new ReadAheadHelper(ERROR_PAGE, new String[] {ERROR_CODE, EXCEPTION_TYPE}, null)); - - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - WebapplicationFactory fact = WebapplicationPackage.eINSTANCE.getWebapplicationFactory(); - if (ERROR_CODE.equals(readAheadName)) - return fact.createErrorCodeErrorPage(); - else if (EXCEPTION_TYPE.equals(readAheadName)) - return fact.createExceptionTypeErrorPage(); - else - return null; - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - if (((ErrorPage)o).isErrorCode()) - return ERROR_CODE_XLATORS; - else if (((ErrorPage)o).isExceptionType()) - return EXCEPTION_TYPE_XLATORS; - else - throw new IllegalStateException("Internal error: ErrorCode expected"); //$NON-NLS-1$ - } - - public boolean isManagedByParent() { - return false; - } -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebAppTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebAppTranslator.java deleted file mode 100644 index 86a64527c..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebAppTranslator.java +++ /dev/null @@ -1,548 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 18, 2003 - */ -package org.eclipse.jst.j2ee.internal.model.translator.webapplication; - - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.BooleanTranslator; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.model.translator.common.EnvEntryTranslator; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.jst.j2ee.internal.xml.WarDeploymentDescriptorXmlMapperI; -import org.eclipse.jst.j2ee.jsp.JspPackage; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.SourceLinkTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; -import org.eclipse.wst.common.internal.emf.resource.TranslatorPath; - - -/** - * @author schacher - * - * To change this generated comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class WebAppTranslator extends RootTranslator implements WarDeploymentDescriptorXmlMapperI, J2EEConstants { - private static WebapplicationPackage WEBAPP_PKG = WebapplicationPackage.eINSTANCE; - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - private static JspPackage JSP_PKG = JspPackage.eINSTANCE; - public static WebAppTranslator INSTANCE = new WebAppTranslator(); - private static Translator[] children13; - private static Translator[] children14; - - private static final Translator SERVLET_MAPPING_TRANSLATOR = createServletMappingTranslator(); - private static final Translator SESSION_CONFIG_TRANSLATOR = createSessionConfigTranslator(); - private static final Translator WELCOMEFILE_TRANSLATOR = createFileListTranslator(); - private static final Translator MIME_MAPPING_TRANSLATOR = createMimeMappingTranslator(); - private static final Translator ERROR_PAGE_TRANSLATOR = new ErrorPageTranslator(); - private static final Translator LOGIN_CONFIG_TRANSLATOR = createLoginConfigTranslator(); - private static final Translator DISTRIBUTABLE_TRANSLATOR = new Translator(DISTRIBUTABLE, WEBAPP_PKG.getWebApp_Distributable(), EMPTY_TAG); - - private static final Translator WEB_RESOURCE_NAME_TRANSLATOR = new Translator(WEB_RESOURCE_NAME, WEBAPP_PKG.getWebResourceCollection_WebResourceName()); - private static final Translator URL_PATTERN_TRANSLATOR = new Translator(URL_PATTERN, WEBAPP_PKG.getWebResourceCollection_UrlPattern()); - private static final Translator HTTP_METHOD_TRANSLATOR = new Translator(HTTP_METHOD, WEBAPP_PKG.getWebResourceCollection_HttpMethod()); - - private static final Translator ROLE_NAME_TRANSLATOR = new Translator(ROLE_NAME, WEBAPP_PKG.getAuthConstraint_Roles()); - private static final Translator TRANSPORT_GUARANTEE_TRANSLATOR = new Translator(TRANSPORT_GUARANTEE, WEBAPP_PKG.getUserDataConstraint_TransportGuarantee()); - - - protected WebAppTranslator() { - super(WEB_APP, WEBAPP_PKG.getWebApp()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children13 == null) - children13 = create13Children(); - return children13; - default : - if (children14 == null) - children14 = create14Children(); - return children14; - } - } - - - protected Translator[] create13Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(SMALL_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - DISTRIBUTABLE_TRANSLATOR, - createContextParam13Translator(), - createFilter13Translator(), - createFilterMapping13Translator(), - createListener13Translator(), - createServlet13Translator(), - SERVLET_MAPPING_TRANSLATOR, - SESSION_CONFIG_TRANSLATOR, - MIME_MAPPING_TRANSLATOR, - WELCOMEFILE_TRANSLATOR, - ERROR_PAGE_TRANSLATOR, - createTagLibTranslator13(WEBAPP_PKG.getWebApp_TagLibs()), - CommonTranslators.JNDI_REF_GROUP_RESOURCE_ENV_REF_1_3, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_REF_1_3, - createSecurityConstraintTranslator13(), - LOGIN_CONFIG_TRANSLATOR, - CommonTranslators.createSecurityRoleTranslator13(WEBAPP_PKG.getWebApp_SecurityRoles()), - new EnvEntryTranslator(COMMON_PKG.getJNDIEnvRefsGroup_EnvironmentProperties(), false, false), - CommonTranslators.JNDI_REF_GROUP_EJB_REF_1_3, - CommonTranslators.JNDI_REF_GROUP_EJB_LOCAL_REF_1_3 - }; - } - - - protected Translator[] create14Children() { - Translator[] begin = new Translator[] { - IDTranslator.INSTANCE, - new Translator(VERSION, WEBAPP_PKG.getWebApp_Version(), DOM_ATTRIBUTE), - new ConstantAttributeTranslator(XML_NS, J2EE_NS_URL), - new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL), - new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, J2EE_NS_URL+' '+WEB_APP_SCHEMA_LOC_2_4), - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - DISTRIBUTABLE_TRANSLATOR, - CommonTranslators.createParamValueType(CONTEXT_PARAM, WEBAPP_PKG.getWebApp_ContextParams()), - createFilter14Translator(), - createFilterMapping14Translator(), - createListener14Translator(), - createServlet14Translator(), - SERVLET_MAPPING_TRANSLATOR, - SESSION_CONFIG_TRANSLATOR, - MIME_MAPPING_TRANSLATOR, - WELCOMEFILE_TRANSLATOR, - ERROR_PAGE_TRANSLATOR, - createJSPConfigTranslators(), - createSecurityConstraintTranslators14(), - LOGIN_CONFIG_TRANSLATOR, - CommonTranslators.createSecurityRoleTranslator14(WEBAPP_PKG.getWebApp_SecurityRoles()) - }; - Translator[] end = new Translator[] { - CommonTranslators.createMessageDestinationTranslator(WEBAPP_PKG.getWebApp_MessageDestinations()), - createLocaleEncodingMappingListTranslator(), - // CommonTranslators.createDeploymentExtensionTranslator(WEBAPP_PKG.getWebApp_Extensions()) - }; - - - return (Translator[])concat(begin,concat(createJNDIEnvironmentRefsGroupTranslator(), end)); - } - - public static Translator createSecurityConstraintTranslators14() { - GenericTranslator result = new GenericTranslator(SECURITY_CONSTRAINT, WEBAPP_PKG.getWebApp_Constraints()); - result.setChildren(new Translator[] { - CommonTranslators.createDisplayNameTranslator(WEBAPP_PKG.getSecurityConstraint_DisplayNames()), - createWebResourceCollectionTranslator14(), - createAuthConstraintTranslator14(), - createUserDataConstraintTranslator14(), - }); - return result; - } - - private static Translator createWebResourceCollectionTranslator14() { - GenericTranslator result = new GenericTranslator(WEB_RESOURCE_COLLECTION, WEBAPP_PKG.getSecurityConstraint_WebResourceCollections()); - result.setChildren(new Translator[] { - WEB_RESOURCE_NAME_TRANSLATOR, - CommonTranslators.createDescriptionTranslator(WEBAPP_PKG.getWebResourceCollection_Descriptions()), - URL_PATTERN_TRANSLATOR, - HTTP_METHOD_TRANSLATOR - }); - return result; - } - - private static Translator createAuthConstraintTranslator14() { - GenericTranslator result = new GenericTranslator(AUTH_CONSTRAINT, WEBAPP_PKG.getSecurityConstraint_AuthConstraint()); - result.setChildren(new Translator[] { - CommonTranslators.createDescriptionTranslator(WEBAPP_PKG.getAuthConstraint_Descriptions()), - ROLE_NAME_TRANSLATOR - }); - return result; - } - - private static Translator createUserDataConstraintTranslator14() { - GenericTranslator result = new GenericTranslator(USER_DATA_CONSTRAINT, WEBAPP_PKG.getSecurityConstraint_UserDataConstraint()); - result.setChildren(new Translator[] { - CommonTranslators.createDescriptionTranslator(WEBAPP_PKG.getUserDataConstraint_Descriptions()), - TRANSPORT_GUARANTEE_TRANSLATOR - }); - return result; - } - - - private Translator createJSPConfigTranslators() { - GenericTranslator result = new GenericTranslator(JSP_CONFIG, WEBAPP_PKG.getWebApp_JspConfig()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createTagLibTranslator14(JSP_PKG.getJSPConfig_TagLibs()), - createJSPPropertyGroupTranslator() - }); - - return result; - } - - - /** - * @return - */ - private Translator createJSPPropertyGroupTranslator() { - GenericTranslator result = new GenericTranslator(JSP_PROPERTY_GROUP, JSP_PKG.getJSPConfig_PropertyGroups()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new Translator(URL_PATTERN, JSP_PKG.getJSPPropertyGroup_UrlPattern()), - new BooleanTranslator(EL_IGNORED, JSP_PKG.getJSPPropertyGroup_ElIgnored()), - new Translator(PAGE_ENCODING, JSP_PKG.getJSPPropertyGroup_PageEncoding()), - new BooleanTranslator(SCRIPTING_INVALID, JSP_PKG.getJSPPropertyGroup_ScriptingInvalid()), - new BooleanTranslator(IS_XML,JSP_PKG.getJSPPropertyGroup_IsXML()), - new Translator(INCLUDE_PRELUDE, JSP_PKG.getJSPPropertyGroup_IncludePreludes()), - new Translator(INCLUDE_CODA, JSP_PKG.getJSPPropertyGroup_IncludeCodas()) - }); - return result; - } - - - private Translator createLocaleEncodingMappingListTranslator() { - GenericTranslator result = new GenericTranslator(LOCALE_ENCODING_MAPPING_LIST, WEBAPP_PKG.getWebApp_LocalEncodingMappingList()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - createLocaleEncodingMapping() - }); - return result; - - } - - - /** - * @return - */ - private Translator createLocaleEncodingMapping() { - GenericTranslator result = new GenericTranslator(LOCALE_ENCODING_MAPPING, WEBAPP_PKG.getLocalEncodingMappingList_LocalEncodingMappings()); - result.setChildren(new Translator[] { - new Translator(LOCALE, WEBAPP_PKG.getLocalEncodingMapping_Locale()), - new Translator(ENCODING, WEBAPP_PKG.getLocalEncodingMapping_Encoding()) - }); - return result; - - } - - - /** - * @return - */ - private Translator[] createJNDIEnvironmentRefsGroupTranslator() { - return new Translator[] { - CommonTranslators.JNDI_REF_GROUP_ENV_ENTRY_1_4, - CommonTranslators.JNDI_REF_GROUP_EJB_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_EJB_LOCAL_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_SERVICE_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_RESOURCE_ENV_REF_1_4, - CommonTranslators.JNDI_REF_GROUP_MESSAGE_DEST_REF_1_4 - }; - } - - - /** - * @return - */ - private Translator createFilterMapping14Translator() { - Translator dispatcher = new Translator(DISPATCHER, WEBAPP_PKG.getFilterMapping_DispatcherType()); - return GenericTranslator.appendChild((GenericTranslator)createFilterMapping13Translator(),dispatcher); - } - - public static Translator createContextParam13Translator() { - GenericTranslator result = new GenericTranslator(CONTEXT_PARAM, WEBAPP_PKG.getWebApp_Contexts()); - result.setChildren(new Translator[] { - new Translator(PARAM_NAME, WEBAPP_PKG.getContextParam_ParamName()), - new Translator(PARAM_VALUE, WEBAPP_PKG.getContextParam_ParamValue()), - new Translator(DESCRIPTION, WEBAPP_PKG.getContextParam_Description()), - }); - return result; - } - - public static Translator createFilter13Translator() { - GenericTranslator result = new GenericTranslator(FILTER, WEBAPP_PKG.getWebApp_Filters()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(SMALL_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(FILTER_NAME, WEBAPP_PKG.getFilter_Name(), - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, Translator.CONTAINER_FEATURE), - new Translator(FILTER_MAPPING, WEBAPP_PKG.getWebApp_FilterMappings()), - })), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new JavaClassTranslator(FILTER_CLASS, WEBAPP_PKG.getFilter_FilterClass()), - createInitParamTranslator(WEBAPP_PKG.getFilter_InitParams()) - }); - return result; - } - - - public static Translator createFilter14Translator() { - GenericTranslator result = new GenericTranslator(FILTER, WEBAPP_PKG.getWebApp_Filters()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new Translator(FILTER_NAME, WEBAPP_PKG.getFilter_Name(), - //TODO: Make sure the path is still valid - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, Translator.CONTAINER_FEATURE), - new Translator(FILTER_MAPPING, WEBAPP_PKG.getWebApp_FilterMappings()), - })), - new JavaClassTranslator(FILTER_CLASS, WEBAPP_PKG.getFilter_FilterClass()), - CommonTranslators.createParamValueType(INIT_PARAM,WEBAPP_PKG.getFilter_InitParamValues()) - }); - return result; - } - - public static Translator createFilterMapping13Translator() { - GenericTranslator result = new GenericTranslator(FILTER_MAPPING, WEBAPP_PKG.getWebApp_FilterMappings()); - result.setChildren(new Translator[] { - new SourceLinkTranslator(FILTER_NAME, WEBAPP_PKG.getFilterMapping_Filter(), - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, Translator.CONTAINER_FEATURE), - new Translator(FILTER, WEBAPP_PKG.getWebApp_Filters()), - new Translator(FILTER_MAPPING, WEBAPP_PKG.getFilter_Name()) - })), - new Translator(URL_PATTERN, WEBAPP_PKG.getFilterMapping_UrlPattern()), - new SourceLinkTranslator(SERVLET_NAME, WEBAPP_PKG.getFilterMapping_Servlet(), - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, Translator.CONTAINER_FEATURE), - new Translator(SERVLET, WEBAPP_PKG.getWebApp_Servlets()), - new Translator(SERVLET_NAME, WEBAPP_PKG.getServlet_ServletName()) - }), Translator.STRING_RESULT_OK), - }); - return result; - } - - public static Translator createInitParamTranslator(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(INIT_PARAM, feature); - result.setChildren(new Translator[] { - new Translator(PARAM_NAME, WEBAPP_PKG.getInitParam_ParamName()), - new Translator(PARAM_VALUE, WEBAPP_PKG.getInitParam_ParamValue()), - new Translator(DESCRIPTION, WEBAPP_PKG.getInitParam_Description()), - }); - return result; - } - - public static Translator createListener13Translator() { - GenericTranslator result = new GenericTranslator(LISTENER, WEBAPP_PKG.getWebApp_Listeners()); - result.setChildren(new Translator[] { - CommonTranslators.LISTENER_CLASS_TRANSLATOR - }); - return result; - } - - public static Translator createListener14Translator() { - GenericTranslator result = new GenericTranslator(LISTENER, WEBAPP_PKG.getWebApp_Listeners()); - result.setChildren(new Translator[] { - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - CommonTranslators.LISTENER_CLASS_TRANSLATOR - }); - return result; - } - - public static Translator createServlet13Translator() { - GenericTranslator result = new GenericTranslator(SERVLET, WEBAPP_PKG.getWebApp_Servlets()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(SMALL_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON_PATH, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(SERVLET_NAME, WEBAPP_PKG.getServlet_ServletName(), - new TranslatorPath[] { - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, WEBAPP_PKG.getServlet_WebApp()), - new Translator(SERVLET_MAPPING, WEBAPP_PKG.getWebApp_ServletMappings()), - }), - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, WEBAPP_PKG.getServlet_WebApp()), - new Translator(FILTER_MAPPING, WEBAPP_PKG.getWebApp_FilterMappings()), - }), - }), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new WebTypeTranslator(), //servlet-class or jsp-file - createInitParamTranslator(WEBAPP_PKG.getServlet_Params()), - new Translator(LOAD_ON_STARTUP, WEBAPP_PKG.getServlet_LoadOnStartup()), - CommonTranslators.createRunAsTranslator13(WEBAPP_PKG.getServlet_RunAs()), - CommonTranslators.createSecurityRoleRefTranslator13(WEBAPP_PKG.getServlet_SecurityRoleRefs()) - }); - return result; - } - - public static Translator createServlet14Translator() { - GenericTranslator result = new GenericTranslator(SERVLET, WEBAPP_PKG.getWebApp_Servlets()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new Translator(SERVLET_NAME, WEBAPP_PKG.getServlet_ServletName(), - new TranslatorPath[] { - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, WEBAPP_PKG.getServlet_WebApp()), - new Translator(SERVLET_MAPPING, WEBAPP_PKG.getWebApp_ServletMappings()), - }), - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, WEBAPP_PKG.getServlet_WebApp()), - new Translator(FILTER_MAPPING, WEBAPP_PKG.getWebApp_FilterMappings()), - }), - }), - new WebTypeTranslator(), //servlet-class or jsp-file - CommonTranslators.createParamValueType(INIT_PARAM,WEBAPP_PKG.getServlet_InitParams()), - new Translator(LOAD_ON_STARTUP, WEBAPP_PKG.getServlet_LoadOnStartup()), - CommonTranslators.createRunAsTranslator14(WEBAPP_PKG.getServlet_RunAs()), - CommonTranslators.createSecurityRoleRefTranslator14(WEBAPP_PKG.getServlet_SecurityRoleRefs()), - // CommonTranslators.createDeploymentExtensionTranslator(WEBAPP_PKG.getServlet_Extensions()) - }); - return result; - } - - public static Translator createServletMappingTranslator() { - GenericTranslator result = new GenericTranslator(SERVLET_MAPPING, WEBAPP_PKG.getWebApp_ServletMappings()); - result.setChildren(new Translator[] { - new SourceLinkTranslator(SERVLET_NAME, WEBAPP_PKG.getServletMapping_Servlet(), - new TranslatorPath(new Translator[] { - new Translator(WEB_APP, CONTAINER_FEATURE), - new Translator(SERVLET, WEBAPP_PKG.getWebApp_Servlets()), - new Translator(SERVLET_NAME, WEBAPP_PKG.getServlet_ServletName()) - })), - new Translator(URL_PATTERN, WEBAPP_PKG.getServletMapping_UrlPattern()) - }); - return result; - } - - public static Translator createSessionConfigTranslator() { - GenericTranslator result = new GenericTranslator(SESSION_CONFIG, WEBAPP_PKG.getWebApp_SessionConfig()); - result.setChildren(new Translator[] { - new Translator(SESSION_TIMEOUT, WebapplicationPackage.eINSTANCE.getSessionConfig_SessionTimeout()), - }); - return result; - } - - public static Translator createMimeMappingTranslator() { - GenericTranslator result = new GenericTranslator(MIME_MAPPING, WEBAPP_PKG.getWebApp_MimeMappings()); - result.setChildren(new Translator[] { - new Translator(EXTENSION, WEBAPP_PKG.getMimeMapping_Extension()), - new Translator(MIME_TYPE, WEBAPP_PKG.getMimeMapping_MimeType()), - - }); - return result; - } - - public static Translator createFileListTranslator() { - GenericTranslator result = new GenericTranslator(WELCOME_FILE_LIST, WEBAPP_PKG.getWebApp_FileList()); - result.setChildren(new Translator[] { - createParentAndTextAttributeTranslator(WELCOME_FILE, WEBAPP_PKG.getWelcomeFileList_File(), WEBAPP_PKG.getWelcomeFile_WelcomeFile()) - }); - return result; - } - - public static Translator createTagLibTranslator14(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(TAGLIB, feature); - result.setChildren(new Translator[] { - new Translator(TAGLIB_URI, JSP_PKG.getTagLibRefType_TaglibURI()), - new Translator(TAGLIB_LOCATION, JSP_PKG.getTagLibRefType_TaglibLocation()) - }); - return result; - } - public static Translator createTagLibTranslator13(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(TAGLIB, feature); - result.setChildren(new Translator[] { - new Translator(TAGLIB_URI, WEBAPP_PKG.getTagLibRef_TaglibURI()), - new Translator(TAGLIB_LOCATION, WEBAPP_PKG.getTagLibRef_TaglibLocation()) - }); - return result; - } - public static Translator createSecurityConstraintTranslator13() { - GenericTranslator result = new GenericTranslator(SECURITY_CONSTRAINT, WEBAPP_PKG.getWebApp_Constraints()); - result.setChildren(new Translator[] { - new Translator(DISPLAY_NAME, WEBAPP_PKG.getSecurityConstraint_DisplayName()), - createWebResourceCollectionTranslator13(), - createAuthConstraintTranslator13(), - createUserDataConstraintTranslator13(), - }); - return result; - } - - private static Translator createWebResourceCollectionTranslator13() { - GenericTranslator result = new GenericTranslator(WEB_RESOURCE_COLLECTION, WEBAPP_PKG.getSecurityConstraint_WebResourceCollections()); - result.setChildren(new Translator[] { - WEB_RESOURCE_NAME_TRANSLATOR, - new Translator(DESCRIPTION,WEBAPP_PKG.getWebResourceCollection_Description()), - URL_PATTERN_TRANSLATOR, - HTTP_METHOD_TRANSLATOR - }); - return result; - } - - private static Translator createAuthConstraintTranslator13() { - GenericTranslator result = new GenericTranslator(AUTH_CONSTRAINT, WEBAPP_PKG.getSecurityConstraint_AuthConstraint()); - result.setChildren(new Translator[] { - new Translator(DESCRIPTION, WEBAPP_PKG.getAuthConstraint_Description()), - ROLE_NAME_TRANSLATOR - }); - return result; - } - - private static Translator createUserDataConstraintTranslator13() { - GenericTranslator result = new GenericTranslator(USER_DATA_CONSTRAINT, WEBAPP_PKG.getSecurityConstraint_UserDataConstraint()); - result.setChildren(new Translator[] { - new Translator(DESCRIPTION, WEBAPP_PKG.getUserDataConstraint_Description()), - TRANSPORT_GUARANTEE_TRANSLATOR - }); - return result; - } - - public static Translator createLoginConfigTranslator() { - GenericTranslator result = new GenericTranslator(LOGIN_CONFIG, WEBAPP_PKG.getWebApp_LoginConfig()); - result.setChildren(new Translator[] { - new Translator(AUTH_METHOD, WEBAPP_PKG.getLoginConfig_AuthMethod(), Translator.ENUM_FEATURE_WITH_HYPHENS), - new Translator(REALM_NAME, WEBAPP_PKG.getLoginConfig_RealmName()), - createFormLoginConfigTranslator() - }); - return result; - } - - public static Translator createFormLoginConfigTranslator() { - GenericTranslator result = new GenericTranslator(FORM_LOGIN_CONFIG, WEBAPP_PKG.getLoginConfig_FormLoginConfig()); - result.setChildren(new Translator[] { - new Translator(FORM_LOGIN_PAGE, WEBAPP_PKG.getFormLoginConfig_FormLoginPage()), - new Translator(FORM_ERROR_PAGE, WEBAPP_PKG.getFormLoginConfig_FormErrorPage()), - }); - return result; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebTypeTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebTypeTranslator.java deleted file mode 100644 index 22027b2c8..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebTypeTranslator.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - *******************************************************************************/ -/* - * Created on Mar 20, 2003 - * - */ -package org.eclipse.jst.j2ee.internal.model.translator.webapplication; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.xml.WarDeploymentDescriptorXmlMapperI; -import org.eclipse.jst.j2ee.webapplication.WebType; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * @author schacher - */ -public class WebTypeTranslator extends Translator implements WarDeploymentDescriptorXmlMapperI { - - private static Translator[] SERVLET_XLATORS = new Translator[] { - new Translator(TEXT_ATTRIBUTE_VALUE, WebapplicationPackage.eINSTANCE.getServletType_ClassName()) - }; - private static Translator[] JSP_XLATORS = new Translator[] { - new Translator(TEXT_ATTRIBUTE_VALUE, WebapplicationPackage.eINSTANCE.getJSPType_JspFile()) - }; - - public WebTypeTranslator() { - super(SERVLET_CLASS+','+JSP_FILE, WebapplicationPackage.eINSTANCE.getServlet_WebType()); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - if (((WebType)o).isJspType()) - return JSP_XLATORS; - else if (((WebType)o).isServletType()) - return SERVLET_XLATORS; - else - throw new IllegalStateException("Internal error: Web Type expected"); //$NON-NLS-1$ - } - - - public String getDOMName(Object value) { - if (((WebType)value).isJspType()) - return JSP_FILE; - else if (((WebType)value).isServletType()) - return SERVLET_CLASS; - else - throw new IllegalStateException("Internal error: Web Type expected"); //$NON-NLS-1$ - } - - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - WebapplicationFactory fact = WebapplicationPackage.eINSTANCE.getWebapplicationFactory(); - if (SERVLET_CLASS.equals(nodeName)) - return fact.createServletType(); - else if (JSP_FILE.equals(nodeName)) - return fact.createJSPType(); - else - return null; - } - - public boolean isManagedByParent() { - return false; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/EJBLinkTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/EJBLinkTranslator.java deleted file mode 100644 index 8fe6d8d81..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/EJBLinkTranslator.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddFactory; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddPackage; -import org.eclipse.wst.common.internal.emf.resource.Translator; - - - -public class EJBLinkTranslator extends Translator implements WsddXmlMapperI { - - private static Translator[] EJB_LINK_XLATORS = new Translator[] { - new Translator(TEXT_ATTRIBUTE_VALUE, WsddPackage.eINSTANCE.getEJBLink_EjbLink()) - }; - - public EJBLinkTranslator() { - super(EJB_LINK, WsddPackage.eINSTANCE.getServiceImplBean_EEJBLink()); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - - return EJB_LINK_XLATORS; - } - - - public String getDOMName(Object value) { - return EJB_LINK; - } - - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - WsddFactory fact = WsddPackage.eINSTANCE.getWsddFactory(); - return fact.createEJBLink(); - - } - - public boolean isManagedByParent() { - return false; - } - -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/ElementNameTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/ElementNameTranslator.java deleted file mode 100644 index dd3913ecc..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/ElementNameTranslator.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.webservice.jaxrpcmap.JaxrpcmapFactory; -import org.eclipse.jst.j2ee.webservice.jaxrpcmap.JaxrpcmapPackage; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class ElementNameTranslator extends Translator implements JaxrpcmapXmlMapperI { - - private static Translator[] ELEMENT_NAME_XLATORS = new Translator[] { - new Translator(TEXT_ATTRIBUTE_VALUE, JaxrpcmapPackage.eINSTANCE.getElementName_Text()) - }; - - public ElementNameTranslator() { - super(ELEMENT_NAME, JaxrpcmapPackage.eINSTANCE.getConstructorParameterOrder_ElementNames()); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - - return ELEMENT_NAME_XLATORS; - } - - - public String getDOMName(Object value) { - return ELEMENT_NAME; - } - - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - JaxrpcmapFactory fact = JaxrpcmapPackage.eINSTANCE.getJaxrpcmapFactory(); - return fact.createElementName(); - - } - - public boolean isManagedByParent() { - return false; - } - -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/InterfaceMappingTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/InterfaceMappingTranslator.java deleted file mode 100644 index 15bd4a1f3..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/InterfaceMappingTranslator.java +++ /dev/null @@ -1,301 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.webservice.jaxrpcmap.JaxrpcmapFactory; -import org.eclipse.jst.j2ee.webservice.jaxrpcmap.JaxrpcmapPackage; -import org.eclipse.jst.j2ee.webservice.jaxrpcmap.ServiceEndpointInterfaceMapping; -import org.eclipse.jst.j2ee.webservice.jaxrpcmap.ServiceInterfaceMapping; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class InterfaceMappingTranslator extends Translator implements JaxrpcmapXmlMapperI { - - - private static Translator[] SERVICE_INTERFACE_10XLATORS = new Translator[] { - new Translator(SERVICE_INTERFACE, JaxrpcmapPackage.eINSTANCE.getServiceInterfaceMapping_ServiceInterface()), - create10WSDLServiceNameTranslator(), - createPortMappingTranslator() - }; - - private static Translator[] SERVICE_INTERFACE_11XLATORS = new Translator[] { - new Translator(SERVICE_INTERFACE, JaxrpcmapPackage.eINSTANCE.getServiceInterfaceMapping_ServiceInterface()), - CommonTranslators.createQNameTranslator(WSDL_SERVICE_NAME, JaxrpcmapPackage.eINSTANCE.getServiceInterfaceMapping_WsdlServiceName()), - createPortMappingTranslator() - }; - - private static Translator[] SEI_10XLATORS = new Translator[] { - new Translator(SERVICE_ENDPOINT_INTERFACE, JaxrpcmapPackage.eINSTANCE.getServiceEndpointInterfaceMapping_ServiceEndpointInterface()), - create10WSDLPortTypeTranslator(), - create10WSDLBindingTranslator(), - create10SEMethodMappingTranslator() - }; - - private static Translator[] SEI_11XLATORS = new Translator[] { - new Translator(SERVICE_ENDPOINT_INTERFACE, JaxrpcmapPackage.eINSTANCE.getServiceEndpointInterfaceMapping_ServiceEndpointInterface()), - CommonTranslators.createQNameTranslator(WSDL_PORT_TYPE, JaxrpcmapPackage.eINSTANCE.getServiceEndpointInterfaceMapping_WsdlPortType()), - CommonTranslators.createQNameTranslator(WSDL_BINDING, JaxrpcmapPackage.eINSTANCE.getServiceEndpointInterfaceMapping_WsdlBinding()), - create11SEMethodMappingTranslator() - }; - - public InterfaceMappingTranslator() { - super(SERVICE_INTERFACE_MAPPING+','+SERVICE_ENDPOINT_INTERFACE_MAPPING, JaxrpcmapPackage.eINSTANCE.getJavaWSDLMapping_InterfaceMappings()); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - if (o instanceof ServiceInterfaceMapping) - return getServiceInterfaceTranslator(versionID); - else if (o instanceof ServiceEndpointInterfaceMapping) - return getSEITranslator(versionID); - else - throw new IllegalStateException("Internal error: InterfaceMapping expected"); //$NON-NLS-1$ - } - - - public String getDOMName(Object value) { - if (value instanceof ServiceInterfaceMapping) - return SERVICE_INTERFACE_MAPPING; - else if (value instanceof ServiceEndpointInterfaceMapping) - return SERVICE_ENDPOINT_INTERFACE_MAPPING; - else - throw new IllegalStateException("Internal error: InterfaceMapping expected"); //$NON-NLS-1$ - } - - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - JaxrpcmapFactory fact = JaxrpcmapPackage.eINSTANCE.getJaxrpcmapFactory(); - if (SERVICE_INTERFACE_MAPPING.equals(nodeName)) - return fact.createServiceInterfaceMapping(); - else if (SERVICE_ENDPOINT_INTERFACE_MAPPING.equals(nodeName)) - return fact.createServiceEndpointInterfaceMapping(); - else - return null; - } - - public boolean isManagedByParent() { - return false; - } - - private Translator[] getServiceInterfaceTranslator(int versionID) - { - switch (versionID) { - case J2EEVersionConstants.J2EE_1_2_ID : - case J2EEVersionConstants.J2EE_1_3_ID : - return SERVICE_INTERFACE_10XLATORS; - default : - return SERVICE_INTERFACE_11XLATORS; - } - - } - - private Translator[] getSEITranslator(int versionID) - { - switch (versionID) { - case J2EEVersionConstants.J2EE_1_2_ID : - case J2EEVersionConstants.J2EE_1_3_ID : - return SEI_10XLATORS; - default : - return SEI_11XLATORS; - } - - } - private static Translator create10WSDLServiceNameTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - CommonPackage commonPackage = CommonPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_SERVICE_NAME, jaxrpcmapPackage.getServiceInterfaceMapping_WsdlServiceName()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, commonPackage.getQName_NamespaceURI()), - new Translator(LOCALPART, commonPackage.getQName_LocalPart()) - }); - return result; - } - - private static Translator createPortMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(PORT_MAPPING, jaxrpcmapPackage.getServiceInterfaceMapping_PortMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PORT_NAME, jaxrpcmapPackage.getPortMapping_PortName()), - new Translator(JAVA_PORT_NAME, jaxrpcmapPackage.getPortMapping_JavaPortName()) - }); - return result; - } - /* - private static Translator create10PortMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(PORT_MAPPING, jaxrpcmapPackage.getServiceInterfaceMapping_PortMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PORT_NAME, jaxrpcmapPackage.getPortMapping_PortName()), - new Translator(JAVA_PORT_NAME, jaxrpcmapPackage.getPortMapping_JavaPortName()) - }); - return result; - } - */ - - private static Translator create10WSDLPortTypeTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - CommonPackage commonPackage = CommonPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_PORT_TYPE, jaxrpcmapPackage.getServiceEndpointInterfaceMapping_WsdlPortType()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, commonPackage.getQName_NamespaceURI()), - new Translator(LOCALPART, commonPackage.getQName_LocalPart()) - }); - return result; - } - - private static Translator create10WSDLBindingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - CommonPackage commonPackage = CommonPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_BINDING, jaxrpcmapPackage.getServiceEndpointInterfaceMapping_WsdlBinding()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, commonPackage.getQName_NamespaceURI()), - new Translator(LOCALPART, commonPackage.getQName_LocalPart()) - }); - return result; - } - - private static Translator create10SEMethodMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(SERVICE_ENDPOINT_METHOD_MAPPING, jaxrpcmapPackage.getServiceEndpointInterfaceMapping_ServiceEndpointMethodMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(JAVA_METHOD_NAME, jaxrpcmapPackage.getServiceEndpointMethodMapping_JavaMethodName()), - new Translator(WSDL_OPERATION, jaxrpcmapPackage.getServiceEndpointMethodMapping_WsdlOperation()), - new Translator(WRAPPED_ELEMENT, jaxrpcmapPackage.getServiceEndpointMethodMapping_WrappedElement(), Translator.EMPTY_TAG), - create10MethodParamPartsMappingTranslator(), - create10WSDLReturnValueMappingTranslator() - }); - return result; - } - - private static Translator create11SEMethodMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(SERVICE_ENDPOINT_METHOD_MAPPING, jaxrpcmapPackage.getServiceEndpointInterfaceMapping_ServiceEndpointMethodMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(JAVA_METHOD_NAME, jaxrpcmapPackage.getServiceEndpointMethodMapping_JavaMethodName()), - new Translator(WSDL_OPERATION, jaxrpcmapPackage.getServiceEndpointMethodMapping_WsdlOperation()), - new Translator(WRAPPED_ELEMENT, jaxrpcmapPackage.getServiceEndpointMethodMapping_WrappedElement(), Translator.EMPTY_TAG), - create11MethodParamPartsMappingTranslator(), - create11WSDLReturnValueMappingTranslator() - }); - return result; - } - - private static Translator create10MethodParamPartsMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(METHOD_PARAM_PARTS_MAPPING, jaxrpcmapPackage.getServiceEndpointMethodMapping_MethodParamPartsMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PARAM_POSITION, jaxrpcmapPackage.getMethodParamPartsMapping_ParamPosition()), - new Translator(PARAM_TYPE, jaxrpcmapPackage.getMethodParamPartsMapping_ParamType()), - create10WSDLMessageMappingTranslator() - }); - return result; - } - - private static Translator create11MethodParamPartsMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(METHOD_PARAM_PARTS_MAPPING, jaxrpcmapPackage.getServiceEndpointMethodMapping_MethodParamPartsMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PARAM_POSITION, jaxrpcmapPackage.getMethodParamPartsMapping_ParamPosition()), - new Translator(PARAM_TYPE, jaxrpcmapPackage.getMethodParamPartsMapping_ParamType()), - create11WSDLMessageMappingTranslator() - }); - return result; - } - - private static Translator create10WSDLMessageMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_MESSAGE_MAPPING, jaxrpcmapPackage.getMethodParamPartsMapping_WsdlMessageMapping()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - create10WSDLMessageTranslator(jaxrpcmapPackage.getWSDLMessageMapping_WsdlMessage()), - new Translator(WSDL_MESSAGE_PART_NAME, jaxrpcmapPackage.getWSDLMessageMapping_WsdlMessagePartName()), - new Translator(PARAMETER_MODE, jaxrpcmapPackage.getWSDLMessageMapping_ParameterMode()), - new Translator(SOAP_HEADER, jaxrpcmapPackage.getWSDLMessageMapping_SoapHeader(), Translator.EMPTY_TAG), - }); - return result; - } - - private static Translator create11WSDLMessageMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_MESSAGE_MAPPING, jaxrpcmapPackage.getMethodParamPartsMapping_WsdlMessageMapping()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.createQNameTranslator(WSDL_MESSAGE, jaxrpcmapPackage.getWSDLMessageMapping_WsdlMessage()), - new Translator(WSDL_MESSAGE_PART_NAME, jaxrpcmapPackage.getWSDLMessageMapping_WsdlMessagePartName()), - new Translator(PARAMETER_MODE, jaxrpcmapPackage.getWSDLMessageMapping_ParameterMode()), - new Translator(SOAP_HEADER, jaxrpcmapPackage.getWSDLMessageMapping_SoapHeader(), Translator.EMPTY_TAG), - }); - return result; - } - - private static Translator create10WSDLMessageTranslator(EStructuralFeature feature) { - //JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - CommonPackage commonPackage = CommonPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_MESSAGE, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, commonPackage.getQName_NamespaceURI()), - new Translator(LOCALPART, commonPackage.getQName_LocalPart()) - }); - return result; - } - - private static Translator create10WSDLReturnValueMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_RETURN_VALUE_MAPPING, jaxrpcmapPackage.getServiceEndpointMethodMapping_WsdlReturnValueMapping()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(METHOD_RETURN_VALUE, jaxrpcmapPackage.getWSDLReturnValueMapping_MethodReturnValue()), - create10WSDLMessageTranslator(jaxrpcmapPackage.getWSDLReturnValueMapping_WsdlMessage()), - new Translator(WSDL_MESSAGE_PART_NAME, jaxrpcmapPackage.getWSDLReturnValueMapping_WsdlMessagePartName()) - }); - return result; - } - - private static Translator create11WSDLReturnValueMappingTranslator() { - JaxrpcmapPackage jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - GenericTranslator result = new GenericTranslator(WSDL_RETURN_VALUE_MAPPING, jaxrpcmapPackage.getServiceEndpointMethodMapping_WsdlReturnValueMapping()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(METHOD_RETURN_VALUE, jaxrpcmapPackage.getWSDLReturnValueMapping_MethodReturnValue()), - CommonTranslators.createQNameTranslator(WSDL_MESSAGE, jaxrpcmapPackage.getWSDLReturnValueMapping_WsdlMessage()), - new Translator(WSDL_MESSAGE_PART_NAME, jaxrpcmapPackage.getWSDLReturnValueMapping_WsdlMessagePartName()) - }); - return result; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/JaxrpcmapTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/JaxrpcmapTranslator.java deleted file mode 100644 index 2a383776e..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/JaxrpcmapTranslator.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.webservice.internal.WebServiceConstants; -import org.eclipse.jst.j2ee.webservice.jaxrpcmap.JaxrpcmapPackage; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - - - - -public class JaxrpcmapTranslator extends RootTranslator implements JaxrpcmapXmlMapperI, J2EEConstants{ - public static JaxrpcmapTranslator INSTANCE = new JaxrpcmapTranslator(); - private static Translator[] children10; - private static Translator[] children11; - private JaxrpcmapPackage jaxrpcmapPackage; - private CommonPackage commonPackage; - - - protected JaxrpcmapTranslator() { - super(JAVA_WSDL_MAPPING, JaxrpcmapPackage.eINSTANCE.getJavaWSDLMapping()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - jaxrpcmapPackage = JaxrpcmapPackage.eINSTANCE; - commonPackage = CommonPackage.eINSTANCE; - - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children10 == null) - { - children10 = create10Children(); - } - return children10; - default : - if (children11 == null) - { - children11 = create11Children(); - } - return children11; - } - } - - - protected Translator[] create10Children() { - - return new Translator[] { - IDTranslator.INSTANCE, - createPackageMappingTranslator(), - create10JavaXMLTypeMappingTranslator(), - create10ExceptionMappingTranslator(), - new InterfaceMappingTranslator() - }; - } - - protected Translator[] create11Children() { - - return new Translator[] { - IDTranslator.INSTANCE, - new ConstantAttributeTranslator(XML_NS, J2EE_NS_URL), - new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL), - new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, J2EE_NS_URL+' '+WebServiceConstants.JAXRPCMAP_SCHEMA_LOC), - new ConstantAttributeTranslator(VERSION, WebServiceConstants.WEBSERVICE_SCHEMA_VERSION), - createPackageMappingTranslator(), - create11JavaXMLTypeMappingTranslator(), - create11ExceptionMappingTranslator(), - new InterfaceMappingTranslator() - }; - } - - public Translator createPackageMappingTranslator() { - - GenericTranslator result = new GenericTranslator(PACKAGE_MAPPING, jaxrpcmapPackage.getJavaWSDLMapping_PackageMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PACKAGE_TYPE, jaxrpcmapPackage.getPackageMapping_PackageType()), - new Translator(NAMESPACEURI, jaxrpcmapPackage.getPackageMapping_NamespaceURI()) - }); - return result; - } - - public Translator create10JavaXMLTypeMappingTranslator() { - - GenericTranslator result = new GenericTranslator(JAVA_XML_TYPE_MAPPING, jaxrpcmapPackage.getJavaWSDLMapping_JavaXMLTypeMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(CLASS_TYPE, jaxrpcmapPackage.getJavaXMLTypeMapping_ClassType()), - create10RootTypeQnameTranslator(), - new Translator(QNAME_SCOPE, jaxrpcmapPackage.getJavaXMLTypeMapping_QnameScope()), - create10VariableMappingTranslator() - }); - return result; - } - - public Translator create11JavaXMLTypeMappingTranslator() { - - GenericTranslator result = new GenericTranslator(JAVA_XML_TYPE_MAPPING, jaxrpcmapPackage.getJavaWSDLMapping_JavaXMLTypeMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(JAVA_TYPE, jaxrpcmapPackage.getJavaXMLTypeMapping_ClassType()), - new Translator(ANONYMOUS_TYPE_QNAME, jaxrpcmapPackage.getJavaXMLTypeMapping_AnonymousTypeQname()), - CommonTranslators.createQNameTranslator(ROOT_TYPE_QNAME, jaxrpcmapPackage.getJavaXMLTypeMapping_RootTypeQname()), - //create10RootTypeQnameTranslator(), //RootTypeQName is still going to work the old (1.3) way because of anonymous types. - new Translator(QNAME_SCOPE, jaxrpcmapPackage.getJavaXMLTypeMapping_QnameScope()), - create11VariableMappingTranslator() - }); - return result; - } - - public Translator create10ExceptionMappingTranslator() { - - GenericTranslator result = new GenericTranslator(EXCEPTION_MAPPING, jaxrpcmapPackage.getJavaWSDLMapping_ExceptionMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(EXCEPTION_TYPE, jaxrpcmapPackage.getExceptionMapping_ExceptionType()), - create10WSDLMessageTranslator(), - createConstructorParamOrderTranslator() - }); - return result; - } - - public Translator create11ExceptionMappingTranslator() { - - GenericTranslator result = new GenericTranslator(EXCEPTION_MAPPING, jaxrpcmapPackage.getJavaWSDLMapping_ExceptionMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(EXCEPTION_TYPE, jaxrpcmapPackage.getExceptionMapping_ExceptionType()), - CommonTranslators.createQNameTranslator(WSDL_MESSAGE, jaxrpcmapPackage.getExceptionMapping_WsdlMessage()), - new Translator(WSDL_MESSAGE_PART_NAME, jaxrpcmapPackage.getExceptionMapping_WsdlMessagePartName()), - createConstructorParamOrderTranslator() - }); - return result; - } - - public Translator createInterfaceMappingTranslator() { - - GenericTranslator result = new GenericTranslator(SERVICE_INTERFACE_MAPPING, jaxrpcmapPackage.getJavaWSDLMapping()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PACKAGE_TYPE, jaxrpcmapPackage.getPackageMapping_PackageType()), - new Translator(NAMESPACEURI, jaxrpcmapPackage.getPackageMapping_NamespaceURI()) - }); - return result; - } - - - public Translator create10RootTypeQnameTranslator() { - - GenericTranslator result = new GenericTranslator(ROOT_TYPE_QNAME, jaxrpcmapPackage.getJavaXMLTypeMapping_RootTypeQname()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, commonPackage.getQName_NamespaceURI()), - new Translator(LOCALPART, commonPackage.getQName_LocalPart()) - }); - return result; - } - - public Translator create10VariableMappingTranslator() { - - GenericTranslator result = new GenericTranslator(VARIABLE_MAPPING, jaxrpcmapPackage.getJavaXMLTypeMapping_VariableMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(JAVA_VARIABLE_NAME, jaxrpcmapPackage.getVariableMapping_JavaVariableName()), - new Translator(DATA_MEMBER, jaxrpcmapPackage.getVariableMapping_DataMember(), Translator.EMPTY_TAG), - new Translator(XML_ELEMENT_NAME, jaxrpcmapPackage.getVariableMapping_XmlElementName()) - }); - return result; - } - - public Translator create11VariableMappingTranslator() { - - GenericTranslator result = new GenericTranslator(VARIABLE_MAPPING, jaxrpcmapPackage.getJavaXMLTypeMapping_VariableMappings()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(JAVA_VARIABLE_NAME, jaxrpcmapPackage.getVariableMapping_JavaVariableName()), - new Translator(DATA_MEMBER, jaxrpcmapPackage.getVariableMapping_DataMember(), Translator.EMPTY_TAG), - new Translator(XML_ATTRIBUTE_NAME, jaxrpcmapPackage.getVariableMapping_XmlAttributeName()), - new Translator(XML_ELEMENT_NAME, jaxrpcmapPackage.getVariableMapping_XmlElementName()), - new Translator(XML_WILDCARD, jaxrpcmapPackage.getVariableMapping_XmlWildcard(), Translator.EMPTY_TAG) - }); - return result; - } - - public Translator create10WSDLMessageTranslator() { - - GenericTranslator result = new GenericTranslator(WSDL_MESSAGE, jaxrpcmapPackage.getExceptionMapping_WsdlMessage()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, commonPackage.getQName_NamespaceURI()), - new Translator(LOCALPART, commonPackage.getQName_LocalPart()) - }); - return result; - } - - public Translator createConstructorParamOrderTranslator() { - GenericTranslator result = new GenericTranslator(CONSTRUCTOR_PARAMETER_ORDER, jaxrpcmapPackage.getExceptionMapping_ConstructorParameterOrder()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new ElementNameTranslator() - }); - return result; - } - -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/JaxrpcmapXmlMapperI.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/JaxrpcmapXmlMapperI.java deleted file mode 100644 index 4bfc870dc..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/JaxrpcmapXmlMapperI.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - -//imports for J2EE core classes -//import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; - -/** - * This interface represents a catalog of all the tag names which occur in - * an web service deployment descriptor. Interface shared by readers and - * writers to have access to common constants - */ -public interface JaxrpcmapXmlMapperI extends WebServiceCommonXmlMapperI -{ - public String JAVA_WSDL_MAPPING ="java-wsdl-mapping"; //$NON-NLS-1$ - public String CLASS_TYPE ="class-type";//$NON-NLS-1$ - public String JAVA_TYPE ="java-type"; //$NON-NLS-1$ - public String CONSTRUCTOR_PARAMETER_ORDER ="constructor-parameter-order";//$NON-NLS-1$ - public String DATA_MEMBER ="data-member";//$NON-NLS-1$ - public String ELEMENT_NAME ="element-name";//$NON-NLS-1$ - public String EXCEPTION_MAPPING ="exception-mapping";//$NON-NLS-1$ - public String EXCEPTION_TYPE ="exception-type";//$NON-NLS-1$ - public String JAVA_METHOD_NAME ="java-method-name";//$NON-NLS-1$ - public String JAVA_PORT_NAME ="java-port-name";//$NON-NLS-1$ - public String JAVA_VARIABLE_NAME ="java-variable-name";//$NON-NLS-1$ - public String JAVA_XML_TYPE_MAPPING ="java-xml-type-mapping";//$NON-NLS-1$ - public String METHOD_PARAM_PARTS_MAPPING ="method-param-parts-mapping";//$NON-NLS-1$ - public String METHOD_RETURN_VALUE ="method-return-value";//$NON-NLS-1$ - public String PACKAGE_MAPPING ="package-mapping";//$NON-NLS-1$ - public String PACKAGE_TYPE ="package-type";//$NON-NLS-1$ - public String PARAMETER_MODE ="parameter-mode";//$NON-NLS-1$ - public String PARAM_POSITION ="param-position";//$NON-NLS-1$ - public String PARAM_TYPE ="param-type";//$NON-NLS-1$ - public String PORT_MAPPING ="port-mapping";//$NON-NLS-1$ - public String QNAME_SCOPE ="qname-scope";//$NON-NLS-1$ - public String ANONYMOUS_TYPE_QNAME = "anonymous-type-qname";//$NON-NLS-1$ - public String ROOT_TYPE_QNAME ="root-type-qname";//$NON-NLS-1$ - //public String SERVICE_ENDPOINT_INTERFACE ="service-endpoint-interface"; - public String SERVICE_ENDPOINT_INTERFACE_MAPPING ="service-endpoint-interface-mapping";//$NON-NLS-1$ - public String SERVICE_ENDPOINT_METHOD_MAPPING ="service-endpoint-method-mapping";//$NON-NLS-1$ - //public String SERVICE_INTERFACE ="service-interface"; - public String SERVICE_INTERFACE_MAPPING ="service-interface-mapping";//$NON-NLS-1$ - //public String SOAP_HEADER ="soap_header"; - public String VARIABLE_MAPPING ="variable-mapping";//$NON-NLS-1$ - public String WRAPPED_ELEMENT ="wrapped-element";//$NON-NLS-1$ - public String WSDL_BINDING ="wsdl-binding";//$NON-NLS-1$ - public String WSDL_MESSAGE ="wsdl-message";//$NON-NLS-1$ - public String WSDL_MESSAGE_MAPPING ="wsdl-message-mapping";//$NON-NLS-1$ - public String WSDL_MESSAGE_PART_NAME ="wsdl-message-part-name";//$NON-NLS-1$ - public String WSDL_OPERATION ="wsdl-operation";//$NON-NLS-1$ - public String WSDL_PORT_TYPE ="wsdl-port-type";//$NON-NLS-1$ - public String WSDL_RETURN_VALUE_MAPPING ="wsdl-return-value-mapping";//$NON-NLS-1$ - public String WSDL_SERVICE_NAME ="wsdl-service-name";//$NON-NLS-1$ - public String XML_ATTRIBUTE_NAME ="xml-attribute-name";//$NON-NLS-1$ - public String XML_ELEMENT_NAME ="xml-element-name";//$NON-NLS-1$ - public String XML_WILDCARD ="xml-wildcard";//$NON-NLS-1$ -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/SOAPRoleTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/SOAPRoleTranslator.java deleted file mode 100644 index fd0a35aa6..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/SOAPRoleTranslator.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory; -import org.eclipse.jst.j2ee.webservice.wscommon.WscommonPackage; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddPackage; -import org.eclipse.wst.common.internal.emf.resource.Translator; - - - -public class SOAPRoleTranslator extends Translator implements WsddXmlMapperI { - - private static Translator[] SOAP_ROLE_XLATORS = new Translator[] { - new Translator(TEXT_ATTRIBUTE_VALUE, WscommonPackage.eINSTANCE.getSOAPRole_SoapRole()) - }; - - public SOAPRoleTranslator() { - super(SOAP_ROLE, WsddPackage.eINSTANCE.getHandler_SoapRoles()); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - - return SOAP_ROLE_XLATORS; - } - - - public String getDOMName(Object value) { - return SOAP_ROLE; - } - - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - WscommonFactory fact = WscommonPackage.eINSTANCE.getWscommonFactory(); - return fact.createSOAPRole(); - - } - - public boolean isManagedByParent() { - return false; - } - -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/ServletLinkTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/ServletLinkTranslator.java deleted file mode 100644 index cf3abda0e..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/ServletLinkTranslator.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddFactory; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddPackage; -import org.eclipse.wst.common.internal.emf.resource.Translator; - - - -public class ServletLinkTranslator extends Translator implements WsddXmlMapperI { - - private static Translator[] SERVLET_LINK_XLATORS = new Translator[] { - new Translator(TEXT_ATTRIBUTE_VALUE, WsddPackage.eINSTANCE.getServletLink_ServletLink()) - }; - - public ServletLinkTranslator() { - super(SERVLET_LINK, WsddPackage.eINSTANCE.getServiceImplBean_EServletLink()); - } - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (o == null) - return CommonTranslators.EMPTY_CHILDREN; - - return SERVLET_LINK_XLATORS; - } - - - public String getDOMName(Object value) { - return SERVLET_LINK; - } - - - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#createEMFObject(java.lang.String, java.lang.String) - */ - public EObject createEMFObject(String nodeName, String readAheadName) { - WsddFactory fact = WsddPackage.eINSTANCE.getWsddFactory(); - return fact.createServletLink(); - - } - - public boolean isManagedByParent() { - return false; - } - -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WebServiceCommonXmlMapperI.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WebServiceCommonXmlMapperI.java deleted file mode 100644 index 9bf68c74c..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WebServiceCommonXmlMapperI.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - -//imports for J2EE core classes -import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; - -/** - * This interface represents a catalog of all the tag names which occur in - * an web service deployment descriptor. Interface shared by readers and - * writers to have access to common constants - */ -public interface WebServiceCommonXmlMapperI extends DeploymentDescriptorXmlMapperI -{ -// public String WSDL_FILE = "wsdl-file"; -// public String JAXRPC_MAPPING_FILE = "jaxrpc-mapping-file"; - public String NAMESPACEURI = "namespaceURI";//$NON-NLS-1$ - public String LOCALPART = "localpart";//$NON-NLS-1$ -// public String SERVICE_INTERFACE = "service-interface"; - public String SERVICE_ENDPOINT_INTERFACE = "service-endpoint-interface";//$NON-NLS-1$ -// public String HANDLER = "handler"; -// public String HANDLER_NAME = "handler-name"; -// public String HANDLER_CLASS = "handler-class"; - public String INIT_PARAM = "init-param";//$NON-NLS-1$ -// public String PARAM_NAME = "param-name"; -// public String PARAM_VALUE = "param-value"; -// public String SOAP_HEADER = "soap-header"; -// public String SOAP_ROLE = "soap-role"; -// public String PORT_NAME = "port-name"; - -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WebServicesTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WebServicesTranslator.java deleted file mode 100644 index a223ee7c7..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WebServicesTranslator.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.internal.model.translator.common.JavaClassTranslator; -import org.eclipse.jst.j2ee.internal.xml.WebServicesDeploymentDescriptorXmlMapperI; -import org.eclipse.jst.j2ee.webservice.wsclient.Webservice_clientPackage; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class WebServicesTranslator extends RootTranslator implements WebServicesDeploymentDescriptorXmlMapperI{ - public static WebServicesTranslator INSTANCE = new WebServicesTranslator(); - public static final String WEBSERVICESCLIENT = WEB_SERVICES_CLIENT; - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - - private static Webservice_clientPackage WEBSERVICECLIENT_PKG = Webservice_clientPackage.eINSTANCE; - - private static Translator[] children13; - - public WebServicesTranslator() { - super(WEBSERVICESCLIENT, Webservice_clientPackage.eINSTANCE.getWebServicesClient()); - } - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - if (children13 == null) - children13 = create13Children(); - return children13; - } - - protected Translator[] create13Children() { - return new Translator[] { - IDTranslator.INSTANCE, - createServiceRefGroupTranslator13(), - createComponentScopedRefs13() - }; - } - /** - * This model was model from Websphere Webservices - * @param reference - * @return - */ - public static Translator createServiceRefGroupTranslator13() { - GenericTranslator result = new GenericTranslator(SERVICE_REF, WEBSERVICECLIENT_PKG.getWebServicesClient_ServiceRefs()); - result.setChildren( new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(SERVICE_REF_NAME, WEBSERVICECLIENT_PKG.getServiceRef_ServiceRefName()), - new JavaClassTranslator(SERVICE_INTERFACE, WEBSERVICECLIENT_PKG.getServiceRef_ServiceInterface()), - new Translator(WSDL_FILE, WEBSERVICECLIENT_PKG.getServiceRef_WsdlFile()), - new Translator(JAXRPC_MAPPING_FILE, WEBSERVICECLIENT_PKG.getServiceRef_JaxrpcMappingFile()), - createQNameTranslator10(SERVICE_QNAME, WEBSERVICECLIENT_PKG.getServiceRef_ServiceQname()), - CommonTranslators.createPortComponentRefTranslator(), - createServiceRefHandlerTranslator13(), - }); - - - return result; - } - /** - * This model was model from Websphere Webservices - * @return - */ - public static Translator createServiceRefHandlerTranslator13() { - GenericTranslator result = new GenericTranslator(HANDLER, WEBSERVICECLIENT_PKG.getServiceRef_Handlers()); - result.setChildren(new Translator[]{ - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(HANDLER_NAME, WEBSERVICECLIENT_PKG.getHandler_HandlerName()), - new JavaClassTranslator(HANDLER_CLASS, WEBSERVICECLIENT_PKG.getHandler_HandlerClass()), - createParamValueType13(HANDLER_INIT_PARAM, WEBSERVICECLIENT_PKG.getHandler_InitParams()), - createQNameTranslator10(SOAP_HEADER, WEBSERVICECLIENT_PKG.getHandler_SoapHeaders()), - new Translator(SOAP_ROLE, WEBSERVICECLIENT_PKG.getHandler_SoapRoles()), - new Translator(PORT_NAME, WEBSERVICECLIENT_PKG.getHandler_PortNames()) - }); - - return result; - } - /** - * @return - */ - private Translator createComponentScopedRefs13() { - GenericTranslator result = new GenericTranslator(COMP_SCOPED_REFS, WEBSERVICECLIENT_PKG.getWebServicesClient_ComponentScopedRefs()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(COMP_COMPONENT_NAME, WEBSERVICECLIENT_PKG.getComponentScopedRefs_ComponentName()), - createServiceRefGroupTranslator13(WEBSERVICECLIENT_PKG.getComponentScopedRefs_ServiceRefs()) - }); - return result; - } - - /** - * This model was model from Websphere Webservices - * @param reference - * @return - */ - public static Translator createServiceRefGroupTranslator13(EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(SERVICE_REF, feature); - result.setChildren( new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new Translator(SERVICE_REF_NAME, WEBSERVICECLIENT_PKG.getServiceRef_ServiceRefName()), - new JavaClassTranslator(SERVICE_INTERFACE, WEBSERVICECLIENT_PKG.getServiceRef_ServiceInterface()), - new Translator(WSDL_FILE, WEBSERVICECLIENT_PKG.getServiceRef_WsdlFile()), - new Translator(JAXRPC_MAPPING_FILE, WEBSERVICECLIENT_PKG.getServiceRef_JaxrpcMappingFile()), - createQNameTranslator10(SERVICE_QNAME, WEBSERVICECLIENT_PKG.getServiceRef_ServiceQname()), - CommonTranslators.createPortComponentRefTranslator(), - CommonTranslators.createServiceRefHandlerTranslator(), - }); - - - return result; - } - - public static Translator createQNameTranslator10(String domName, EStructuralFeature feature) { - GenericTranslator result = new GenericTranslator(domName, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, COMMON_PKG.getQName_NamespaceURI()), - new Translator(LOCALPART, COMMON_PKG.getQName_LocalPart()) - }); - return result; - } - - public static Translator createParamValueType13(String domName, EStructuralFeature feature){ - GenericTranslator result = new GenericTranslator(domName, feature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PARAM_NAME, COMMON_PKG.getParamValue_Name()), - new Translator(PARAM_VALUE, COMMON_PKG.getParamValue_Value()), - new Translator(DESCRIPTION, COMMON_PKG.getParamValue_Description()) - }); - return result; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WsddTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WsddTranslator.java deleted file mode 100644 index 1ffa29a36..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WsddTranslator.java +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.model.translator.common.CommonTranslators; -import org.eclipse.jst.j2ee.webservice.internal.WebServiceConstants; -import org.eclipse.jst.j2ee.webservice.wscommon.WscommonPackage; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddPackage; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.GenericTranslator; -import org.eclipse.wst.common.internal.emf.resource.IDTranslator; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - - - - -public class WsddTranslator extends RootTranslator implements WsddXmlMapperI, J2EEConstants{ - public static WsddTranslator INSTANCE = new WsddTranslator(); - private static Translator[] children10; - private static Translator[] children11; - - private static WsddPackage WSDD_PKG = WsddPackage.eINSTANCE; - private static WscommonPackage WSCOMMON_PKG = WscommonPackage.eINSTANCE; - private static CommonPackage COMMON_PKG = CommonPackage.eINSTANCE; - - protected WsddTranslator() { - super(WEBSERVICES, WsddPackage.eINSTANCE.getWebServices()); - } - - /* (non-Javadoc) - * @see com.ibm.etools.emf2xml.impl.Translator#getChildren(java.lang.Object, int) - */ - public Translator[] getChildren(Object o, int versionID) { - - - - switch (versionID) { - case (J2EE_1_2_ID) : - case (J2EE_1_3_ID) : - if (children10 == null) - { - children10 = create10Children(); - } - return children10; - default : - if (children11 == null) - { - children11 = create11Children(); - } - return children11; - } - } - - - protected Translator[] create10Children() { - return new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - create10WebServiceDescTranslator() - }; - } - - protected Translator[] create11Children() { - - return new Translator[] { - IDTranslator.INSTANCE, - new ConstantAttributeTranslator(XML_NS, J2EE_NS_URL), - new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL), - new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, J2EE_NS_URL+' '+WebServiceConstants.WEBSERVICE_SCHEMA_LOC), - new ConstantAttributeTranslator(VERSION, WebServiceConstants.WEBSERVICE_SCHEMA_VERSION), - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - create11WebServiceDescTranslator() - }; - } - - public Translator create10WebServiceDescTranslator() { - GenericTranslator result = new GenericTranslator(WEBSERVICE_DESCRIPTION, WSDD_PKG.getWebServices_WebServiceDescriptions()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, WSDD_PKG.getWebServiceDescription_Description()), - new Translator(DISPLAY_NAME, WSDD_PKG.getWebServiceDescription_DisplayName()), - new Translator(SMALL_ICON, WSDD_PKG.getWebServiceDescription_SmallIcon()), - new Translator(LARGE_ICON, WSDD_PKG.getWebServiceDescription_LargeIcon()), - new Translator(WEBSERVICE_DESCRIPTION_NAME, WSDD_PKG.getWebServiceDescription_WebServiceDescriptionName()), - new Translator(WSDL_FILE, WSDD_PKG.getWebServiceDescription_WsdlFile()), - new Translator(JAXRPC_MAPPING_FILE, WSDD_PKG.getWebServiceDescription_JaxrpcMappingFile()), - create10PortComponentTranslator() - }); - return result; - } - - public Translator create11WebServiceDescTranslator() { - - GenericTranslator result = new GenericTranslator(WEBSERVICE_DESCRIPTION, WSDD_PKG.getWebServices_WebServiceDescriptions()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - create11DescriptionTranslator(WSDD_PKG.getWebServiceDescription_DescriptionType()), - create11DisplayNameTranslator(WSDD_PKG.getWebServiceDescription_DisplayNameType()), - create11IconTranslator(WSDD_PKG.getWebServiceDescription_IconType()), - new Translator(WEBSERVICE_DESCRIPTION_NAME, WSDD_PKG.getWebServiceDescription_WebServiceDescriptionName()), - new Translator(WSDL_FILE, WSDD_PKG.getWebServiceDescription_WsdlFile()), - new Translator(JAXRPC_MAPPING_FILE, WSDD_PKG.getWebServiceDescription_JaxrpcMappingFile()), - create11PortComponentTranslator() - }); - return result; - } - - - - public Translator create10PortComponentTranslator() { - GenericTranslator result = new GenericTranslator(PORT_COMPONENT, WSDD_PKG.getWebServiceDescription_PortComponents()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, WSDD_PKG.getPortComponent_Description()), - new Translator(DISPLAY_NAME, WSDD_PKG.getPortComponent_DisplayName()), - new Translator(SMALL_ICON, WSDD_PKG.getPortComponent_SmallIcon()), - new Translator(LARGE_ICON, WSDD_PKG.getPortComponent_LargeIcon()), - new Translator(PORT_COMPONENT_NAME, WSDD_PKG.getPortComponent_PortComponentName()), - create10WsdlPortTranslator(), - new Translator(SERVICE_ENPOINT_INTERFACE, WSDD_PKG.getPortComponent_ServiceEndpointInterface()), - createServiceImplBeanTranslator(), - createHandler10Translator() - }); - return result; - } - - public Translator create11PortComponentTranslator() { - GenericTranslator result = new GenericTranslator(PORT_COMPONENT, WSDD_PKG.getWebServiceDescription_PortComponents()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, WSDD_PKG.getPortComponent_Description()), - new Translator(DISPLAY_NAME, WSDD_PKG.getPortComponent_DisplayName()), - new Translator(SMALL_ICON, WSDD_PKG.getPortComponent_SmallIcon()), - new Translator(LARGE_ICON, WSDD_PKG.getPortComponent_LargeIcon()), - new Translator(PORT_COMPONENT_NAME, WSDD_PKG.getPortComponent_PortComponentName()), - CommonTranslators.createQNameTranslator(WSDL_PORT, WSDD_PKG.getPortComponent_WsdlPort()), - new Translator(SERVICE_ENPOINT_INTERFACE, WSDD_PKG.getPortComponent_ServiceEndpointInterface()), - createServiceImplBeanTranslator(), - createHandler11Translator() - }); - return result; - } - - public Translator create10WsdlPortTranslator() { - GenericTranslator result = new GenericTranslator(WSDL_PORT, WSDD_PKG.getPortComponent_WsdlPort()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, COMMON_PKG.getQName_NamespaceURI()), - new Translator(LOCALPART, COMMON_PKG.getQName_LocalPart()) - }); - return result; - } - - - public Translator createServiceImplBeanTranslator() { - GenericTranslator result = new GenericTranslator(SERVICE_IMPL_BEAN, WSDD_PKG.getPortComponent_ServiceImplBean()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new ServletLinkTranslator(), - new EJBLinkTranslator() - }); - return result; - } - - - public Translator createHandler10Translator() { - GenericTranslator result = new GenericTranslator(HANDLER, WSDD_PKG.getPortComponent_Handlers()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(DESCRIPTION, COMMON_PKG.getCompatibilityDescriptionGroup_Description()), - new Translator(DISPLAY_NAME, COMMON_PKG.getCompatibilityDescriptionGroup_DisplayName()), - new Translator(SMALL_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getCompatibilityDescriptionGroup_LargeIcon()), - new Translator(HANDLER_NAME, WSDD_PKG.getHandler_HandlerName()), - new Translator(HANDLER_CLASS, WSDD_PKG.getHandler_HandlerClass()), - create10InitParamTranslator(), - create10SOAPHeaderTranslator(), - new SOAPRoleTranslator() - }); - return result; - } - - public Translator createHandler11Translator() { - GenericTranslator result = new GenericTranslator(HANDLER, WSDD_PKG.getPortComponent_Handlers()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - CommonTranslators.DESCRIPTIONS_TRANSLATOR, - CommonTranslators.DISPLAYNAMES_TRANSLATOR, - CommonTranslators.ICONS_TRANSLATOR, - new Translator(HANDLER_NAME, WSDD_PKG.getHandler_HandlerName()), - new Translator(HANDLER_CLASS, WSDD_PKG.getHandler_HandlerClass()), - create11InitParamTranslator(), - CommonTranslators.createQNameTranslator(SOAP_HEADER, WSDD_PKG.getHandler_SoapHeaders()), - new SOAPRoleTranslator() - }); - return result; - } - - public Translator create10InitParamTranslator() { - GenericTranslator result = new GenericTranslator(INIT_PARAM, WSDD_PKG.getHandler_InitParams()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(PARAM_NAME, WSCOMMON_PKG.getInitParam_ParamName()), - new Translator(PARAM_VALUE, WSCOMMON_PKG.getInitParam_ParamValue()), - new Translator(DESCRIPTION, WSCOMMON_PKG.getInitParam_Description()) - }); - return result; - } - - public Translator create11InitParamTranslator() { - GenericTranslator result = new GenericTranslator(INIT_PARAM, WSDD_PKG.getHandler_InitParams()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - create11DescriptionTranslator(WSCOMMON_PKG.getInitParam_DescriptionTypes()), - new Translator(PARAM_NAME, WSCOMMON_PKG.getInitParam_ParamName()), - new Translator(PARAM_VALUE, WSCOMMON_PKG.getInitParam_ParamValue()) - }); - return result; - } - - - public Translator create10SOAPHeaderTranslator() { - GenericTranslator result = new GenericTranslator(SOAP_HEADER, WSDD_PKG.getHandler_SoapHeaders()); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(NAMESPACEURI, COMMON_PKG.getQName_NamespaceURI()), - new Translator(LOCALPART, COMMON_PKG.getQName_LocalPart()) - }); - return result; - } - - public Translator create11DescriptionTranslator(EStructuralFeature afeature) { - GenericTranslator result = new GenericTranslator(DESCRIPTION, afeature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(LANG, COMMON_PKG.getDescription_Lang(), Translator.DOM_ATTRIBUTE), - new Translator(Translator.TEXT_ATTRIBUTE_VALUE, COMMON_PKG.getDescription_Value()) - }); - return result; - } - public Translator create11DisplayNameTranslator(EStructuralFeature afeature) { - GenericTranslator result = new GenericTranslator(DISPLAY_NAME, afeature); - result.setChildren(new Translator[] { - IDTranslator.INSTANCE, - new Translator(LANG, COMMON_PKG.getDisplayName_Lang(), Translator.DOM_ATTRIBUTE), - new Translator(Translator.TEXT_ATTRIBUTE_VALUE, COMMON_PKG.getDisplayName_Value()) - }); - return result; - } - - private Translator create11IconTranslator(EStructuralFeature afeature) { - GenericTranslator result = new GenericTranslator(ICON, afeature); - result.setChildren(new Translator[] { - new Translator(LANG, COMMON_PKG.getIconType_Lang(), Translator.DOM_ATTRIBUTE), - IDTranslator.INSTANCE, - new Translator(SMALL_ICON, COMMON_PKG.getIconType_SmallIcon()), - new Translator(LARGE_ICON, COMMON_PKG.getIconType_LargeIcon()) - }); - return result; - } - -} - diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WsddXmlMapperI.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WsddXmlMapperI.java deleted file mode 100644 index a435cb5d2..000000000 --- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webservices/WsddXmlMapperI.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.j2ee.internal.model.translator.webservices; - -//imports for J2EE core classes -//import org.eclipse.jst.j2ee.internal.xml.DeploymentDescriptorXmlMapperI; - -/** - * This interface represents a catalog of all the tag names which occur in - * an web service deployment descriptor. Interface shared by readers and - * writers to have access to common constants - */ -public interface WsddXmlMapperI extends WebServiceCommonXmlMapperI -{ - public String WEBSERVICES = "webservices";//$NON-NLS-1$ - public String WEBSERVICE_DESCRIPTION = "webservice-description";//$NON-NLS-1$ - public String WEBSERVICE_DESCRIPTION_NAME = "webservice-description-name";//$NON-NLS-1$ - public String PORT_COMPONENT = "port-component";//$NON-NLS-1$ - public String PORT_COMPONENT_NAME = "port-component-name";//$NON-NLS-1$ - public String WSDL_PORT = "wsdl-port";//$NON-NLS-1$ - public String SERVICE_IMPL_BEAN = "service-impl-bean";//$NON-NLS-1$ - public String SERVLET_LINK = "servlet-link";//$NON-NLS-1$ - //EJB_LINK is defined in DeploymentDescriptorXmlMapperI - //public String EJB_LINK = "ejb-link"; - -} - |