diff options
Diffstat (limited to 'plugins/org.eclipse.jst.jee')
67 files changed, 0 insertions, 5642 deletions
diff --git a/plugins/org.eclipse.jst.jee/.classpath b/plugins/org.eclipse.jst.jee/.classpath deleted file mode 100644 index 5696f49d3..000000000 --- a/plugins/org.eclipse.jst.jee/.classpath +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="earproject"/> - <classpathentry kind="src" path="common"/> - <classpathentry kind="src" path="jeecreation"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/org.eclipse.jst.jee/.cvsignore b/plugins/org.eclipse.jst.jee/.cvsignore deleted file mode 100644 index ce1b2797f..000000000 --- a/plugins/org.eclipse.jst.jee/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -javaCompiler...args -build.xml -temp.folder -@dot diff --git a/plugins/org.eclipse.jst.jee/.project b/plugins/org.eclipse.jst.jee/.project deleted file mode 100644 index 92ef5e329..000000000 --- a/plugins/org.eclipse.jst.jee/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jst.jee</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/plugins/org.eclipse.jst.jee/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.jst.jee/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index e30ee73bc..000000000 --- a/plugins/org.eclipse.jst.jee/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,95 +0,0 @@ -#Mon Jun 08 16:58:21 EDT 2009 -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.comparingIdentical=error -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.emptyStatement=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedParameter=warning -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=error -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.compiler.problem.fieldHiding=error -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error -eclipse.preferences.version=1 -org.eclipse.jdt.core.incompleteClasspath=error -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.deadCode=error -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeUncheckedExceptions=disabled -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.compiler.problem.fallthroughCase=error -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error -org.eclipse.jdt.core.compiler.problem.autoboxing=warning -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.compiler.problem.parameterAssignment=error -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= diff --git a/plugins/org.eclipse.jst.jee/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.jst.jee/.settings/org.eclipse.pde.prefs deleted file mode 100644 index c8197c506..000000000 --- a/plugins/org.eclipse.jst.jee/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,15 +0,0 @@ -#Sat Nov 10 03:28:42 EST 2007 -compilers.incompatible-environment=1 -compilers.p.build=0 -compilers.p.deprecated=1 -compilers.p.missing-packages=2 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.jst.jee/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.jee/META-INF/MANIFEST.MF deleted file mode 100644 index cf4fcdf84..000000000 --- a/plugins/org.eclipse.jst.jee/META-INF/MANIFEST.MF +++ /dev/null @@ -1,37 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name.0 -Bundle-SymbolicName: org.eclipse.jst.jee;singleton:=true -Bundle-Version: 1.0.401.qualifier -Bundle-Activator: org.eclipse.jst.jee.JEEPlugin -Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", - org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)", - org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", - org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jst.j2ee;bundle-version="[1.1.0,1.2.0)", - org.eclipse.wst.common.frameworks;bundle-version="[1.2.0,2.0.0)", - org.eclipse.jst.common.frameworks;bundle-version="[1.1.0,1.2.0)", - org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)", - org.eclipse.emf.common;bundle-version="[2.2.0,3.0.0)", - org.eclipse.wst.web;bundle-version="[1.1.0,1.2.0)", - org.eclipse.jst.j2ee.core;bundle-version="[1.1.0,2.0.0)", - org.eclipse.core.commands;bundle-version="[3.2.0,4.0.0)", - org.eclipse.wst.server.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.2.0,2.0.0)", - org.eclipse.emf.ecore;bundle-version="[2.2.0,3.0.0)", - org.eclipse.jst.server.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.emf.ecore.xmi;bundle-version="[2.2.0,3.0.0)", - org.eclipse.wst.common.emf;bundle-version="[1.1.103,2.0.0)", - org.eclipse.jst.j2ee.jca;bundle-version="[1.1.0,2.0.0)" -Eclipse-LazyStart: true -Export-Package: org.eclipse.jst.jee, - org.eclipse.jst.jee.contenttype, - org.eclipse.jst.jee.internal.deployables, - org.eclipse.jst.jee.model.internal, - org.eclipse.jst.jee.model.internal.common, - org.eclipse.jst.jee.model.internal.mergers, - org.eclipse.jst.jee.project.facet -Bundle-Vendor: %Bundle-Vendor.0 -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/plugins/org.eclipse.jst.jee/about.html b/plugins/org.eclipse.jst.jee/about.html deleted file mode 100644 index 0799bdb88..000000000 --- a/plugins/org.eclipse.jst.jee/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>June, 2008</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor's license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML> diff --git a/plugins/org.eclipse.jst.jee/build.properties b/plugins/org.eclipse.jst.jee/build.properties deleted file mode 100644 index 7b78de349..000000000 --- a/plugins/org.eclipse.jst.jee/build.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2007 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 -############################################################################### -source.. = earproject/,\ - jeecreation/,\ - common/ -output.. = bin/ -bin.includes = plugin.xml,\ - .,\ - META-INF/,\ - plugin.properties,\ - license/,\ - about.html -src.includes = schema/,\ - component.xml diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractAnnotationFactory.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractAnnotationFactory.java deleted file mode 100644 index 0cf699edc..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractAnnotationFactory.java +++ /dev/null @@ -1,421 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.common; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IImportDeclaration; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IMember; -import org.eclipse.jdt.core.IMemberValuePair; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.javaee.core.Description; -import org.eclipse.jst.javaee.core.EjbLocalRef; -import org.eclipse.jst.javaee.core.InjectionTarget; -import org.eclipse.jst.javaee.core.JavaeeFactory; -import org.eclipse.jst.javaee.core.ResAuthType; -import org.eclipse.jst.javaee.core.ResSharingScopeType; -import org.eclipse.jst.javaee.core.ResourceRef; -import org.eclipse.jst.javaee.core.RunAs; -import org.eclipse.jst.javaee.core.SecurityRole; -import org.eclipse.jst.javaee.core.SecurityRoleRef; -import org.eclipse.jst.javaee.ejb.SessionBean; - -/** - * @author Kiril Mitov k.mitov@sap.com - * - */ -public abstract class AbstractAnnotationFactory { - - /** - * @param value - * @return true if "value" is an array of objects. - */ - protected static boolean isArrayOfObject(Object value) { - return Object[].class.isInstance(value); - } - - protected Object getAnnotatedValue(String name, IMemberValuePair[] memberValuePairs) throws JavaModelException { - for (IMemberValuePair pair : memberValuePairs) { - if (name.equals(pair.getMemberName())) { - return pair.getValue(); - } - } - return null; - } - - protected boolean containsImport(ICompilationUnit unit, String importt) throws JavaModelException { - for (IImportDeclaration declaration : unit.getImports()) { - if (declaration.getElementName().equals(importt)) - return true; - } - return false; - } - - /** - * Resolve the given <code>toResolve</code> string to an IType in the - * context of <code>declaringType</code> - * - * @param declaringType - * @param toResolve - * the type that should be resolved. - * @return the resolved type or <code>null</code> if such type can not be - * resolved. Returns <code>null</code> if toResolve is - * <code>null</code> - * @throws JavaModelException - */ - protected IType resolveType(IType declaringType, String toResolve) throws JavaModelException { - if (toResolve == null) - return null; - String[][] fullTypeName = declaringType.resolveType(toResolve); - if (fullTypeName != null) - return declaringType.getJavaProject().findType(fullTypeName[0][0], fullTypeName[0][1]); - return null; - } - - protected void processEjbAnnotation(IAnnotation annotation, List<EjbLocalRef> localRefs, IMember member, - Collection<IType> dependedTypes) throws JavaModelException { - int memberType = member.getElementType(); - IMemberValuePair[] pairs = annotation.getMemberValuePairs(); - - String beanInterfaceValue = (String) getAnnotatedValue("beanInterface", pairs); //$NON-NLS-1$ - beanInterfaceValue = internalProcessInjection(beanInterfaceValue, member, dependedTypes); - if (beanInterfaceValue == null) - return; - - /* - * The name of the reference should be the value of the "name" - * attribute. If there is no "name" attribute then the name of the - * reference is the qualified name of the member. Check this at - * Enterprise Java Beans, 3.0, Section 14.1.5.3 - */ - String refName = (String) getAnnotatedValue("name", pairs); //$NON-NLS-1$ - if (refName == null) { - refName = getMemberQualifiedName(member); - } - EjbLocalRef ref = JavaeeFactory.eINSTANCE.createEjbLocalRef(); - ref.setEjbRefName(refName); - localRefs.add(ref); - ref.setLocal(beanInterfaceValue); - ref.setLocalHome(beanInterfaceValue); - ref.setEjbLink((String) getAnnotatedValue("beanName", pairs)); //$NON-NLS-1$ - ref.setMappedName((String) getAnnotatedValue("mappedName", pairs)); //$NON-NLS-1$ - if (memberType == IJavaElement.METHOD || memberType == IJavaElement.FIELD) { - createInjectionTarget(refName, ref.getInjectionTargets(), annotation); - } - } - - private void createInjectionTarget(String refName, List<InjectionTarget> injectionTargets, IAnnotation annotation) { - InjectionTarget injectionTarget = JavaeeFactory.eINSTANCE.createInjectionTarget(); - int index = refName.indexOf('/'); - if (index != -1) { - injectionTarget.setInjectionTargetClass(refName.substring(0, index)); - injectionTarget.setInjectionTargetName(refName.substring(index + 1)); - } else { - injectionTarget.setInjectionTargetName(refName); - injectionTarget.setInjectionTargetClass("");//$NON-NLS-1$ - } - injectionTargets.add(injectionTarget); - } - - /** - * Resource annotation can be placed on class, method, field. - * - * Checks are made if the resource annotation is valid. - * <p> - * If on class there should be a "type" attribute. If on method the method - * must have one param with type that is an interface. If on field the field - * type must be an interface. - * - * If the type of the method/field can not be resolved the result will - * contain the unresolved value. - * - * In case the type of method/field is array, wildcard, simple type this is - * not a place for the annotation. - * </p> - * - * <p> - * In case of method/field the type specified using the "type" attribute has - * a higher priority that the method/field type. - * </p> - * - * <p> - * Only resolved types are added to dependedTypes - * </p> - * - * @param sessionBean - * @param member - * @param annotation - * @param dependedTypes - * @throws JavaModelException - */ - protected void processResourceRefAnnotation(IAnnotation annotation, List<ResourceRef> resourceRefs, IMember member, - Collection<IType> dependedTypes) throws JavaModelException { - - IMemberValuePair[] pairs = annotation.getMemberValuePairs(); - String specifiedType = (String) getAnnotatedValue("type", pairs); //$NON-NLS-1$ - specifiedType = internalProcessInjection(specifiedType, member, dependedTypes); - if (specifiedType == null) - return; - String refName = (String) getAnnotatedValue("name", pairs); //$NON-NLS-1$ - if (refName == null) - refName = getMemberQualifiedName(member); - ResourceRef ref = JavaeeFactory.eINSTANCE.createResourceRef(); - ref.setResRefName(refName); - ref.setResType(specifiedType); - ref.setMappedName((String) getAnnotatedValue("mappedName", pairs)); //$NON-NLS-1$ - String description = (String) getAnnotatedValue("description", pairs); //$NON-NLS-1$ - if (description != null) { - Description desc = JavaeeFactory.eINSTANCE.createDescription(); - desc.setValue(description); - ref.getDescriptions().clear(); - ref.getDescriptions().add(desc); - } - if (member.getElementType() == IJavaElement.METHOD || member.getElementType() == IJavaElement.FIELD) { - createInjectionTarget(refName, ref.getInjectionTargets(), annotation); - } - String value = (String) getAnnotatedValue("authenticationType", pairs); //$NON-NLS-1$ - /* - * the default value is AuthenticationType.APPLICATION which is handled - * by the EMF. no need to check for this value - */ - if ("AuthenticationType.CONTAINER".equals(value)) { //$NON-NLS-1$ - ref.setResAuth(ResAuthType.CONTAINER_LITERAL); - } else if ("CONTAINER".equals(value) //$NON-NLS-1$ - && containsImport(member.getCompilationUnit(), "AuthenticationType.CONTAINER")) { //$NON-NLS-1$ - ref.setResAuth(ResAuthType.CONTAINER_LITERAL); - } - Boolean shareable = (Boolean) getAnnotatedValue("shareable", pairs); //$NON-NLS-1$ - /* - * The default value for sharable is true. Check and process only - * unsharable - */ - if (Boolean.FALSE.equals(shareable)) - ref.setResSharingScope(ResSharingScopeType.UNSHAREABLE_LITERAL); - - resourceRefs.add(ref); - } - - /** - * The method has the task of processing the member along with the specified - * member and return a String. The result is to be used as a reference value - * for the injection on this member. Usage are the - * - * @EJB and - * @Resource annotations. - * - * <p> - * If the specifiedType is <code>null</code> and member is of type - * IJavaElement.TYPE the method returns <code>null</code> - * </p> - * - * <p> - * If the type of the member can be resolved and is an interface the method - * returns <code>null</code>. Here the "type" of the member is the result - * from {@link #getUnresolvedType(IMember)} - * </p> - * - * - * Only if the specifiedType can be calculated and is resolved it is added - * to the dependedTypes. If the specifiedType can not be resolved nothing is - * added to dependedTypes. - * - * @see {@link #processEjbAnnotation(IAnnotation, SessionBean, IMember, Collection)} - * @see #processResourceRefAnnotation(SessionBean, IMember, IAnnotation, - * Collection) - * - * @param specifiedType - * @param member - * @param dependedTypes - * @return - * @throws JavaModelException - */ - private String internalProcessInjection(final String specifiedType, IMember member, Collection<IType> dependedTypes) - throws JavaModelException { - boolean methodOrField = member.getElementType() == IJavaElement.METHOD - || member.getElementType() == IJavaElement.FIELD; - IType declaringType = (IType) (member.getElementType() == IJavaElement.TYPE ? member : member - .getDeclaringType()); - String memberType = getUnresolvedType(member); - // not type for this member can be retrieved. If member is a method or - // field this means there is an error. - if (getClassTypeSignature(memberType) == null && methodOrField) - return null; - - // both type are null. This is not a valid case. This will hapen for a - // type without specified type. - if (specifiedType == null && memberType == null) - return null; - - String innerSpecifiedType = specifiedType; - - IType resolvedType = resolveType(declaringType, memberType); - // we were able to get a type for the param of a method or type of - // a field. - // check if it is an interface. It might not be resolved, but we have a - // value - // for unresolved. - if (methodOrField) { - // if the resolved type is not null and it is not an interface this - // annotation is not valid - if (resolvedType != null) { - if (resolvedType.isInterface()) - memberType = resolvedType.getFullyQualifiedName(); - else - // invalid - if the method is with param that is not an - // interface. Or the type of the field is not an interface. - return null; - } - } - // from now one use only the specified type for type resolving. If there - // is no specified type use the member type. The check for whether they - // were both null is previously made - IType resolvedSpecifiedType = null; - if (innerSpecifiedType == null) { - innerSpecifiedType = memberType; - resolvedSpecifiedType = resolvedType; - } else - resolvedSpecifiedType = resolveType(declaringType, innerSpecifiedType); - if (resolvedSpecifiedType != null) { - if (resolvedSpecifiedType.isInterface()) { - innerSpecifiedType = resolvedSpecifiedType.getFullyQualifiedName(); - dependedTypes.add(resolvedSpecifiedType); - } else - // we have resolved the specified type and it is not an - // interface. Not a valid annotation. - return null; - } - return innerSpecifiedType; - } - - /** - * This method returns a qualified name for this member. The name is to be - * used as ejb-ref-name. - * - * If the member is a type then fullyQualifiedName of the type is returned. - * - * If the member is a <code>field</code> declared in a <code>type</code> - * then the result is - * <code>type.getFullyQualifiedName() +"/" + field.elementName</code> - * - * If the member is a <code>method</code> declared in a <code>type</code> - * and method name begins with "set" then: for type name = - * "org.eclipse.Bean" and method name = "setMethodOne()" the result is - * "org.eclipse.Bean/methodOne" - * - * Check this at Enterprise Java Beans, 3.0, Section 14.1.5.3 - * - * @param member - * @return - */ - private String getMemberQualifiedName(IMember member) { - String memberName = member.getElementName(); - int elementType = member.getElementType(); - if (elementType == IJavaElement.METHOD && memberName.startsWith("set")) { //$NON-NLS-1$ - char ch = Character.toLowerCase(memberName.charAt(3)); - memberName = ch + memberName.substring(4); - } - return elementType == IJavaElement.TYPE ? ((IType) member).getFullyQualifiedName() : member.getDeclaringType() - .getFullyQualifiedName() - + "/" + memberName; //$NON-NLS-1$ - } - - /** - * Return the javaee type of this member. For types return <code>null</code>. - * For methods with one param return the java type of this param. For fields - * return the return the java type of the field. - * - * If the result is <code>null</code> then this member is not valid and a - * javaee type can not be returned. This may happen for a method with more - * then one param or for a field with a class type or primitive type - * - * @param member - * @param memberType - * - * @return - * @throws JavaModelException - */ - private String getUnresolvedType(IMember member) throws JavaModelException { - int memberType = member.getElementType(); - String unresolvedTypeName = null; - if (memberType == IJavaElement.FIELD) { - unresolvedTypeName = Signature.toString(((IField) member).getTypeSignature()); - } else if (memberType == IJavaElement.METHOD) { - IMethod method = (IMethod) member; - if (method.getNumberOfParameters() != 1) - return null; - unresolvedTypeName = Signature.toString(method.getParameterTypes()[0]); - } else if (memberType == IJavaElement.TYPE) - return null; - return unresolvedTypeName; - } - - /** - * Returns the type signature for toResolve only if toResolve is a class or - * interface. - * - * @param toResolve - * @return <code>null</code> if toResolve is <code>null</code> or simple - * type, array type, wildcard type - * - */ - private String getClassTypeSignature(String toResolve) { - if (toResolve == null) - return null; - - String innerToResolve = Signature.createTypeSignature(toResolve, false); - if (Signature.getTypeSignatureKind(innerToResolve) != Signature.CLASS_TYPE_SIGNATURE) - return null; - return innerToResolve; - } - - protected void processDeclareRoles(Result result, List<SecurityRoleRef> securityRoleRefs, IAnnotation annotation, - IType type) throws JavaModelException { - IMemberValuePair[] pairs = annotation.getMemberValuePairs(); - Object values = getAnnotatedValue("value", pairs); //$NON-NLS-1$ - if (!isArrayOfObject(values)) - return; - for (Object roleName : (Object[]) values) { - SecurityRole role = JavaeeFactory.eINSTANCE.createSecurityRole(); - role.setRoleName((String) roleName); - result.getAdditional().add(role); - SecurityRoleRef ref = JavaeeFactory.eINSTANCE.createSecurityRoleRef(); - ref.setRoleName((String) roleName); - securityRoleRefs.add(ref); - } - } - - protected void processResourcesAnnotation(IAnnotation annotation, List<ResourceRef> resourceRefs, IType type, - Collection<IType> dependedTypes) throws JavaModelException { - IMemberValuePair[] pairs = annotation.getMemberValuePairs(); - if (!isArrayOfObject(pairs[0].getValue())) - return; - Object[] values = (Object[]) pairs[0].getValue(); - for (Object resourceAnnotation : values) { - processResourceRefAnnotation((IAnnotation) resourceAnnotation, resourceRefs, type, dependedTypes); - } - } - - protected void processRunAs(IAnnotation annotation,RunAs runAs) throws JavaModelException { - IMemberValuePair[] pairs = annotation.getMemberValuePairs(); - if (pairs.length == 1) { - String value = (String) getAnnotatedValue("value", pairs); //$NON-NLS-1$ - runAs.setRoleName(value); - } - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractAnnotationModelProvider.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractAnnotationModelProvider.java deleted file mode 100644 index e2a2ac902..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractAnnotationModelProvider.java +++ /dev/null @@ -1,571 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.common; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderEvent; -import org.eclipse.jst.j2ee.model.IModelProviderListener; -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.javaee.core.SecurityRole; -import org.eclipse.jst.javaee.core.SecurityRoleRef; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.jee.JEEPlugin; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; - -/** - * Base implementation for model providers based on annotations in java files. - * - * Listeners can be registered with {@link #addListener(IModelProviderListener)} - * - * @author Kiril Mitov k.mitov@sap.com - * - */ -public abstract class AbstractAnnotationModelProvider<T> implements IElementChangedListener, IModelProvider { - - private static final String JAVA_EXTENSION = "java"; //$NON-NLS-1$ - - /** - * Find the security role with the given name in the given assembly - * descriptor. - * - * @param assembly - * @param name - * @return <code>null</code> if a security role with this name can not be - * found - */ - private static SecurityRole findRole(Collection<SecurityRole> securityRoles, String name) { - for (SecurityRole role : securityRoles) { - if (role.getRoleName().equals(name)) - return role; - } - return null; - } - - protected T modelObject; - - private Collection<IModelProviderListener> listeners; - - private Lock listenersLock = new ReentrantLock(); - - protected IFacetedProject facetedProject; - - private ManyToOneRelation<SecurityRoleRef, SecurityRole> rolesToRolesRef = new ManyToOneRelation<SecurityRoleRef, SecurityRole>(); - - /** - * Constructs a new AnnotationReader for this faceted project. An illegal - * argument if a project with value <code>null</code> is passed. No loading - * is done in this constructor. Loading the model is made on demand when - * calling {@link #getModelObject()}. - * - * @param project - * the ejb project. Can not be <code>null</code> - */ - public AbstractAnnotationModelProvider(IFacetedProject project) { - if (project == null) - throw new IllegalArgumentException("The project argument can not be null"); //$NON-NLS-1$ - this.facetedProject = project; - } - - public T getConcreteModel() { - if (modelObject == null) { - preLoad(); - try { - loadModel(); - /* - * Adding the resource change listener after loading the model. - * No resource change event are acceptable while loading the - * model. - */ - postLoad(); - } catch (CoreException e) { - log(e.getStatus()); - return null; - } - } - return modelObject; - } - - public Object getModelObject() { - return getConcreteModel(); - } - - public Object getModelObject(IPath modelPath) { - return getConcreteModel(); - } - - protected abstract void loadModel() throws CoreException; - - protected void preLoad() { - } - - protected void postLoad() { - JavaCore.addElementChangedListener(this); - } - - /** - * Notifies the currently registered listeners with this model event. If the - * {@link IModelProviderEvent#getChangedResources()} is empty or - * <code>null</code> the method returns immediately. - * - * @param event - * the event that should be send to the listeners - */ - protected void notifyListeners(final IModelProviderEvent event) { - if (listeners == null) - return; - listenersLock.lock(); - try { - IModelProviderListener[] backup = listeners.toArray(new IModelProviderListener[listeners.size()]); - notifyListeners(backup, event); - backup = null; - } finally { - listenersLock.unlock(); - } - } - - /** - * Clears the list of listeners. No notifications can occur while clearing - * the listeners. - */ - protected void clearListeners() { - if (listeners == null) - return; - try { - listenersLock.lock(); - listeners.clear(); - listeners = null; - } finally { - listenersLock.unlock(); - } - } - - private void notifyListeners(final IModelProviderListener[] aListeners, final IModelProviderEvent event) { - if (event.getChangedResources() == null || event.getChangedResources().isEmpty()) - return; - for (final IModelProviderListener listener : aListeners) { - SafeRunner.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - } - - public void run() throws Exception { - listener.modelsChanged(event); - } - }); - } - } - - /** - * @return the currently registered listeners. - */ - protected Collection<IModelProviderListener> getListeners() { - if (listeners == null) { - listeners = new ArrayList<IModelProviderListener>(); - } - return listeners; - } - - /** - * Adds a listener to this instance. No listeners can be added during - * notifying the current listeners. - * - * @param listener - */ - public void addListener(IModelProviderListener listener) { - listenersLock.lock(); - try { - getModelObject(); - getListeners().add(listener); - } finally { - listenersLock.unlock(); - } - } - - /** - * Removes the listener from this instance. Has no effect if an identical - * listener is not registered. - * - * @param listener - * the listener to be removed. - */ - public void removeListener(IModelProviderListener listener) { - listenersLock.lock(); - try { - getListeners().remove(listener); - } finally { - listenersLock.unlock(); - } - - } - - /** - * @param javaProject - * @return true if the given project contains resources that are relative to - * the model. This method returns <code>true</code> for the - * ejbProject on which this instance is working a <code>true</code> - * for its client project. - */ - protected boolean isProjectRelative(IJavaProject javaProject) { - if (javaProject == null || facetedProject == null) - return false; - else if (javaProject.getProject().equals(facetedProject.getProject())) - return true; - return false; - } - - /** - * Dispose the current instance. The actual dispose may occur in another - * thread. Use {@link #addListener(IModelProviderListener)} to register a - * listener that will be notified when the instance is disposed. After all - * the listeners are notified the list of listeners is cleared. - */ - public void dispose() { - IModelProviderEvent modelEvent = createModelProviderEvent(); - modelEvent.addResource(facetedProject.getProject()); - modelEvent.setEventCode(IModelProviderEvent.UNLOADED_RESOURCE); - JavaCore.removeElementChangedListener(this); - modelObject = null; - notifyListeners(modelEvent); - clearListeners(); - } - - /** - * Process a unit as "removed". The method is allowed not to make checks - * whether the unit was added/removed/change. It is processing the unit as - * "removed". - * - * If no model object depends on the given file "modelEvent" is not changed. - * - * @see #processAddedCompilationUnit(IModelProviderEvent, ICompilationUnit) - * @param modelEvent - * subclasses should "fill" modelEvent with information about the - * change that has happened. This event will be propagated to - * model provided listeners. - * @param file - * the file to be removed. - * @throws CoreException - * if there was an error during parsing the file - */ - protected abstract void processRemovedCompilationUnit(IModelProviderEvent modelEvent, ICompilationUnit unit) - throws CoreException; - - /** - * Process a unit as "added". The method is allowed not to make checks - * whether the unit was added/removed/change. It is processing the file as - * "added". It is the responsibility of the caller to make sure the - * processing of the file as added will not leave the model in a wrong - * state. - * - * modelEvent is changed to contain information about the added modelObject. - * - * @see #processRemovedCompilationUnit(IModelProviderEvent, - * ICompilationUnit) - * @param modelEvent - * subclasses should "fill" modelEvent with information about the - * change that has happened. This event will be propagated to - * model provided listeners. - * @param file - * the file that was added - * @throws CoreException - */ - protected abstract void processAddedCompilationUnit(IModelProviderEvent modelEvent, ICompilationUnit file) - throws CoreException; - - /** - * Process a unit as "changed". The method is allowed not to make checks - * whether the unit was added/removed/change. It is processing the unit as - * "changed". It is the responsibility of the caller to make sure the - * processing of the file as "changed" will not leave the model in a wrong - * state. - * - * @see #processAddedCompilationUnit(IModelProviderEvent, ICompilationUnit) - * @see #processRemovedCompilationUnit(IModelProviderEvent, - * ICompilationUnit) - * @param modelEvent - * subclasses should "fill" modelEvent with information about the - * change that has happened. This event will be propagated to - * model provided listeners. - * @param unit - * the unti that was changed - * @throws CoreException - */ - protected abstract void processChangedCompilationUnit(IModelProviderEvent modelEvent, ICompilationUnit file) - throws CoreException; - - protected void log(IStatus status) { - } - - protected MyModelProviderEvent createModelProviderEvent() { - return new MyModelProviderEvent(0, null, facetedProject.getProject()); - } - - // ---------------SECURITY ROLES ---------------------------// - protected abstract Collection<SecurityRole> getSecurityRoles(); - - protected abstract Collection<SecurityRoleRef> getSecurityRoleRefs(JavaEEObject target); - - /** - * Deletes the connection maintained by the given bean and the security - * roles defined in the bean. If this is the only bean in which the role is - * defined, the role will also be deleted. Calling this method makes sense - * only if the bean and the security role and the bean were connected with - * {@link #connectWithRole(SecurityRole, SessionBean)} - * - * <p> - * If the bean is not of type org.eclipse.jst.javaee.ejb.SessionBean the - * method returns immediately. - * </p> - * - * @see #connectWithRole(SecurityRole, SessionBean) - * @see #rolesToRolesRef - * @param bean - */ - protected void disconnectFromRoles(JavaEEObject target) { - Collection<SecurityRole> roles = getSecurityRoles(); - if (roles == null) - return; - Collection<SecurityRoleRef> refs = getSecurityRoleRefs(target); - if (refs == null) - return; - for (SecurityRoleRef ref : refs) { - SecurityRole role = rolesToRolesRef.getTarget(ref); - rolesToRolesRef.disconnectSource(ref); - if (!rolesToRolesRef.containsTarget(role)) { - getSecurityRoles().remove(role); - } - } - } - - /** - * A security role was found in the given file. Add this security role to - * the assembly descriptor. If the ejbJar does not have an assembly - * descriptor a new one is created. - * - * @see #connectRoleWithBean(SecurityRole, SessionBean)s - * @param file - * @param securityRole - */ - protected void securityRoleFound(JavaEEObject object, SecurityRole securityRole) { - connectWithRole(securityRole, object); - } - - /** - * A security role can be defined in more the one bean. A bean can define - * more then one security role. This means we have a many-to-many relation - * between sessionBeans and securityRoles. - * - * <p> - * Luckily a sessionBean contains a list of securityRoleRefs. This method - * creates a connection between the securityRole contained in the assembly - * descriptor and the security role ref contained in the bean. - * - * If a security role is define only in one bean, deleting the bean means - * deleting the security role. But if the security role is defined in two - * beans only deleting both beans will result in deleting the security role. - * </p> - * - * @see #disconnectFromRoles(JavaEEObject) - * @see #rolesToRolesRef - * @param securityRole - * @param target - */ - private void connectWithRole(SecurityRole securityRole, JavaEEObject target) { - Collection<SecurityRole> roles = getSecurityRoles(); - if (roles == null) - return; - Collection<SecurityRoleRef> refs = getSecurityRoleRefs(target); - if (refs == null) - return; - /* - * If there is a security role with this name use the existing security - * role. - */ - SecurityRole role = findRole(roles, securityRole.getRoleName()); - if (role == null) { - roles.add(securityRole); - role = securityRole; - } - for (SecurityRoleRef ref : refs) { - if (ref.getRoleName().equals(role.getRoleName())) - rolesToRolesRef.connect(ref, role); - } - } - - public void elementChanged(final ElementChangedEvent javaEvent) { - if (javaEvent.getType() == ElementChangedEvent.POST_RECONCILE) - internalPostReconcile(javaEvent); - else if (javaEvent.getType() == ElementChangedEvent.POST_CHANGE) - internalPostChange(javaEvent); - } - - private void internalPostChange(ElementChangedEvent javaEvent) { - IModelProviderEvent modelEvent = createModelProviderEvent(); - // handles ElementChangedEvent.POST_CHANGE - the case when the - // compilation unit has been changed - for (IJavaElementDelta child : javaEvent.getDelta().getAffectedChildren()) { - if (child.getElement() instanceof IJavaProject) { - processChangedProject(modelEvent, child); - notifyListeners(modelEvent); - } - } - } - - private void internalPostReconcile(final ElementChangedEvent javaEvent) { - IModelProviderEvent modelEvent = createModelProviderEvent(); - if (javaEvent.getDelta().getElement() instanceof ICompilationUnit) { - recursevilyProcessCompilationUnits(modelEvent, javaEvent.getDelta()); - notifyListeners(modelEvent); - } - } - - protected void processChangedProject(IModelProviderEvent event, IJavaElementDelta projectDelta) { - if (!isProjectRelative(projectDelta.getElement().getJavaProject())) { - return; - } - Assert.isTrue(projectDelta.getElement() instanceof IJavaProject, - "An invalid change notification has occured. Element is <" + projectDelta.getElement() + ">"); //$NON-NLS-1$//$NON-NLS-2$ - if (((projectDelta.getFlags() & IJavaElementDelta.F_OPENED) != 0) - || projectDelta.getKind() == IJavaElementDelta.ADDED) { - try { - loadModel(); - } catch (CoreException e) { - JEEPlugin.getDefault().getLog().log( - new Status(IStatus.ERROR, JEEPlugin.getDefault().getPluginID(), e.getMessage(), e)); - } - } - - if (((projectDelta.getFlags() & IJavaElementDelta.F_CLOSED) != 0) - || projectDelta.getKind() == IJavaElementDelta.REMOVED) { - dispose(); - } - - processChangedProjectChildren(event, projectDelta); - } - - protected void processChangedProjectChildren(IModelProviderEvent event, IJavaElementDelta projectDelta) { - for (IJavaElementDelta childDelta : projectDelta.getAffectedChildren()) { - if (!(childDelta.getElement() instanceof IPackageFragmentRoot)) { - continue; - } - if ((childDelta.getFlags() & IJavaElementDelta.F_CHILDREN) != 0) { - recursevilyProcessPackages(event, childDelta); - } - } - } - - public void recursevilyProcessPackages(IModelProviderEvent modelEvent, IJavaElementDelta delta) { - if (delta.getElement() instanceof IPackageFragment) { - try { - IPackageFragment fragment = (IPackageFragment) delta.getElement(); - if (delta.getKind() == IJavaElementDelta.ADDED) { - for (ICompilationUnit unit : fragment.getCompilationUnits()) { - processAddedCompilationUnit(modelEvent, unit); - } - } else if (delta.getKind() == IJavaElementDelta.REMOVED) { - if (delta.getKind() == IJavaElementDelta.REMOVED) { - processRemovedPackage(modelEvent, delta); - } - } else if (delta.getKind() == IJavaElementDelta.CHANGED) { - recursevilyProcessCompilationUnits(modelEvent, delta); - } - } catch (CoreException e) { - JEEPlugin.getDefault().getLog().log( - new Status(IStatus.ERROR, JEEPlugin.getDefault().getPluginID(), e.getMessage(), e)); - } - } else { - for (IJavaElementDelta childDelta : delta.getAffectedChildren()) { - recursevilyProcessPackages(modelEvent, childDelta); - } - } - } - - protected abstract void processRemovedPackage(IModelProviderEvent modelEvent, IJavaElementDelta delta) - throws CoreException; - - public void recursevilyProcessCompilationUnits(IModelProviderEvent modelEvent, IJavaElementDelta delta) { - if (delta.getElement() instanceof ICompilationUnit) { - if (!isProjectRelative(delta.getElement().getJavaProject())) - return; - try { - final ICompilationUnit unit = (ICompilationUnit) delta.getElement(); - - if (delta.getKind() == IJavaElementDelta.ADDED) { - processAddedCompilationUnit(modelEvent, unit); - } - if (delta.getKind() == IJavaElementDelta.REMOVED) { - processRemovedCompilationUnit(modelEvent, unit); - } - if (delta.getKind() == IJavaElementDelta.CHANGED) { - if (((delta.getFlags() & IJavaElementDelta.F_PRIMARY_RESOURCE) == 0) - || ((delta.getFlags() & IJavaElementDelta.F_PRIMARY_WORKING_COPY) == 0)) { - modelEvent - .setEventCode(IModelProviderEvent.KNOWN_RESOURCES_CHANGED | modelEvent.getEventCode()); - processChangedCompilationUnit(modelEvent, unit); - } - } - } catch (CoreException e) { - JEEPlugin.getDefault().getLog().log( - new Status(IStatus.ERROR, JEEPlugin.getDefault().getPluginID(), e.getMessage(), e)); - } - } else { - for (IJavaElementDelta childDelta : delta.getAffectedChildren()) { - recursevilyProcessCompilationUnits(modelEvent, childDelta); - } - } - } - - protected void visitJavaFiles(final Collection<ICompilationUnit> javaFiles, final IPackageFragmentRoot root) - throws CoreException { - if (root.getKind() != IPackageFragmentRoot.K_SOURCE) - return; - root.getCorrespondingResource().accept(new IResourceProxyVisitor() { - public boolean visit(IResourceProxy proxy) throws CoreException { - if (proxy.getType() == IResource.FILE) { - if (proxy.getName().endsWith("." + JAVA_EXTENSION)) { //$NON-NLS-1$ - IFile file = (IFile) proxy.requestResource(); - if (!root.getJavaProject().isOnClasspath(file)) - return false; - if (!file.isSynchronized(IResource.DEPTH_ONE)) - return false; - javaFiles.add(JavaCore.createCompilationUnitFrom(file)); - } - return false; - } - return true; - } - }, IContainer.NONE); - - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractMergedModelProvider.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractMergedModelProvider.java deleted file mode 100644 index a42a72aea..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/AbstractMergedModelProvider.java +++ /dev/null @@ -1,372 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.common; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceImpl; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderEvent; -import org.eclipse.jst.j2ee.model.IModelProviderListener; -import org.eclipse.jst.jee.JEEPlugin; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; - -/** - * A base class for model providers providing a merged view between two - * different model providers. The instance will be called "mergedModelProvider" - * where the two composed providers will be called "internalProviders" - * - * This class introduces the notation of a disposed state. {@link #dispose()} is - * used to dispose the model provider. {@link #isDisposed()} is used to get the - * state of the provider. If the method {@link #getModelObject()} is called for - * a model provider in a disposed state, the provider should try to move to a - * non disposed state and return a correct model object. - * {@link #getModelObject()} is loading the model. Specific implementations may - * throw exceptions so calling {@link #getModelObject()} on a disposed provider - * does not guarantee that calling {@link #isDisposed()} after that will return - * <code>false</code>. - * - * <p> - * Subclasses may enable/disable notifications from internalProviders with the - * methods {@link #enableInternalNotifications()} and - * {@link #disableInternalNotifications()}. - * </p> - * - * <p> - * internalProviders are loaded with {@link #loadDeploymentDescriptorModel()} - * and {@link #loadAnnotationModel(Object)}. This methods should be overridden to - * provide specific model providers. Loading the model providers is wrapped in a - * workspace runnable to assure proper access to the workspace. - * </p> - * - * <p> - * The mergedModelProvider is a listener to the internalProviders. After - * disposing the instance of a mergedModelProvider it should no longer accept - * notifications from the internalProviders. It should also properly "dispose" - * the internalProviders if needed. - * </p> - * - * @author Kiril Mitov k.mitov@sap.com - * - */ -public abstract class AbstractMergedModelProvider<T> implements IModelProvider { - - protected IModelProvider ddProvider; - - protected IModelProvider annotationModelProvider; - - private class AnnotationModelListener implements IModelProviderListener { - public void modelsChanged(IModelProviderEvent event) { - if (disposeIfNeeded(event)) - return; - AbstractMergedModelProvider.this.annotationModelChanged(event); - } - } - - private class XmlModelListener implements IModelProviderListener { - public void modelsChanged(IModelProviderEvent event) { - if (disposeIfNeeded(event)) - return; - AbstractMergedModelProvider.this.xmlModelChanged(event); - } - } - - /** - * @param event - * @return true if the model provider is disposed. - */ - private boolean disposeIfNeeded(IModelProviderEvent event) { - if (isDisposed() || mergedModel == null) - return true; - if (shouldDispose(event)) { - dispose(); - notifyListeners(event); - return true; - } - return false; - } - - private Collection<IModelProviderListener> listeners; - - protected IProject project; - - private AnnotationModelListener annotationModelListener; - private XmlModelListener xmlModelListener; - - protected T mergedModel; - - protected long cache_last_change; - - public AbstractMergedModelProvider(IProject project) { - this.project = project; - } - - public void addListener(IModelProviderListener listener) { - getListeners().add(listener); - } - - /** - * Returns the model merged from annotation and xml model. If the project is - * closed or does not exist the returns <code>null</code> - * - * @see org.eclipse.jst.j2ee.model.IModelProvider#getModelObject() - */ - public Object getModelObject() { - return getMergedModel(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.model.IModelProvider#modify(java.lang.Runnable, - * org.eclipse.core.runtime.IPath) - */ - public void modify(Runnable runnable, IPath modelPath) { - } - - public void removeListener(IModelProviderListener listener) { - getListeners().remove(listener); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jst.j2ee.model.IModelProvider#validateEdit(org.eclipse.core - * .runtime.IPath, java.lang.Object) - */ - public IStatus validateEdit(IPath modelPath, Object context) { - if (ddProvider == null) - getModelObject(); - return ddProvider.validateEdit(modelPath, context); - } - - /** - * Called when the annotationModel has changed. See also - * {@link #enableInternalNotifications()} and - * {@link #disableInternalNotifications()} - * - * @param event - */ - protected abstract void annotationModelChanged(IModelProviderEvent event); - - /** - * Called when the xmlModel has changed. See also - * {@link #enableInternalNotifications()} and - * {@link #disableInternalNotifications()} - * - * @param event - */ - protected abstract void xmlModelChanged(IModelProviderEvent event); - - /** - * Return a merged view of the two passed models. - * - * @param ddModel - * @param annotationsModel - * @return - */ - protected abstract T merge(T ddModel, T annotationsModel); - - /** - * Load the annotation model in the context of the ddModel. - * - * @param ddModel - * @return - * @throws CoreException - */ - protected abstract IModelProvider loadAnnotationModel(T ddModel) throws CoreException; - - /** - * @return - * @throws CoreException - */ - protected abstract IModelProvider loadDeploymentDescriptorModel() throws CoreException; - - public Collection<IModelProviderListener> getListeners() { - if (listeners == null) - listeners = new ArrayList<IModelProviderListener>(); - return listeners; - } - - protected T getMergedModel() { - try { - if (mergedModel == null || hasToReloadModel()){ - mergedModel = loadModel(); - } - } catch (CoreException e) { - JEEPlugin.getDefault().getLog().log(e.getStatus()); - return null; - } - return mergedModel; - } - - private boolean hasToReloadModel() { - long lastModificationTimeOfDDFile = getLastModificationTimeOfDDFile(); - return lastModificationTimeOfDDFile == -1 ? false : lastModificationTimeOfDDFile != cache_last_change; - } - - private long getLastModificationTimeOfDDFile() { - if (ddProvider == null || ((EObject)ddProvider.getModelObject()).eResource() == null){ - return -1; - } - return WorkbenchResourceHelper.getFile(((EObject)ddProvider.getModelObject()).eResource()).getLocalTimeStamp(); - } - - /** - * @return a merged view of the models from the internalProviders. This may - * include loading the internalProviders. - * @throws CoreException - */ - protected T loadModel() throws CoreException { - if (!project.isAccessible()) - throw new IllegalStateException("The project <" + project + "> is not accessible."); //$NON-NLS-1$//$NON-NLS-2$ - project.getWorkspace().run(new LoadModelsWorkspaceRunnable(), project, IWorkspace.AVOID_UPDATE, - new NullProgressMonitor()); - return mergedModel; - } - - @SuppressWarnings("unchecked") - private void loadProviders() throws CoreException { - if (ddProvider == null || hasToReloadModel()) { - if (hasToReloadModel()) - ((EObject)ddProvider.getModelObject()).eResource().unload(); - ddProvider = loadDeploymentDescriptorModel(); - } - if (ddProvider == null || ddProvider.getModelObject() == null) - return; - if (annotationModelProvider == null) - annotationModelProvider = loadAnnotationModel((T) ddProvider.getModelObject()); - if (annotationModelProvider == null || annotationModelProvider.getModelObject() == null) - return; - T ddModel = (T) ddProvider.getModelObject(); - T annotationModel = (T) annotationModelProvider.getModelObject(); - mergedModel = createNewModelInstance(); - initMergedModelResource((EObject) ddModel); - - enableInternalNotifications(); - merge(ddModel, annotationModel); - } - - private class LoadModelsWorkspaceRunnable implements IWorkspaceRunnable { - public void run(IProgressMonitor monitor) throws CoreException { - loadProviders(); - } - } - - /** - * Creates a new instance of the model that will be used for mergedModel - * - * @return - */ - protected abstract T createNewModelInstance(); - - protected void initMergedModelResource(EObject ddModel) { - Resource resourceDD = ddModel.eResource(); - if (ddProvider != null){ - cache_last_change = getLastModificationTimeOfDDFile(); - } - - Resource resourceMM = ((EObject) mergedModel).eResource(); - if (resourceDD != null && resourceMM == null) { - ResourceImpl resRes = new ResourceImpl(resourceDD.getURI()); - resRes.getContents().add((EObject) mergedModel); - } - - } - - /** - * The method is used for enabling notifications from the internalProviders. - * This will add the appropriate listener to the internalProviders so that - * {@link #annotationModelChanged(IModelProviderEvent)} and - * {@link #xmlModelChanged(IModelProviderEvent)} are called when needed. - */ - protected final void enableInternalNotifications() { - xmlModelListener = new XmlModelListener(); - ddProvider.addListener(xmlModelListener); - annotationModelListener = new AnnotationModelListener(); - annotationModelProvider.addListener(annotationModelListener); - } - - /** - * Disable notifications from internalProviders. See also - * {@link #enableInternalNotifications()} - */ - protected final void disableInternalNotifications() { - ddProvider.removeListener(xmlModelListener); - annotationModelProvider.removeListener(annotationModelListener); - } - - protected void notifyListeners(final IModelProviderEvent event) { - event.setModel(this); - event.setProject(project); - final Collection<IModelProviderListener> listeners = getListeners(); - IModelProviderListener[] backup = listeners.toArray(new IModelProviderListener[listeners.size()]); - for (final IModelProviderListener listener : backup) { - SafeRunner.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - } - - public void run() throws Exception { - listener.modelsChanged(event); - } - }); - } - backup = null; - } - - protected boolean shouldDispose(IModelProviderEvent event) { - return (event.getEventCode() == IModelProviderEvent.UNLOADED_RESOURCE); - } - - /** - * Returns the dispose state of this model provider. When the provider is - * disposed it can not be used until getModelObject is called again. - * - * Subclasses may override this method. - * - * @return true if the model provider is to be treated as disposed - */ - public boolean isDisposed() { - return (ddProvider == null && annotationModelProvider == null); - } - - /** - * Dispose the model provider. If the provider is already disposed the - * method has no effect. - * - * Subclasses may override this method. - * - * @see #isDisposed() - */ - public void dispose() { - if (isDisposed()) - return; - disableInternalNotifications(); - ddProvider = null; - annotationModelProvider = null; - mergedModel = null; - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/ManyToOneRelation.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/ManyToOneRelation.java deleted file mode 100644 index 67111da15..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/ManyToOneRelation.java +++ /dev/null @@ -1,127 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.common; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; - -/** - * Introduces the notation of many-to-one relation. This is where the M and O of - * the type signature comes from. - * - * Many unique "source" objects refer to one and only "target" object. - * - * The class maintains a connection between the target and all the sources that - * are referring to it. - * - * @author Kiril Mitov k.mitov@sap.com - * - * @param <M> - * the type of the "source" objects. - * @param <O> - * the type of the "target" objects. - */ -public class ManyToOneRelation<M, O> { - - private Map<M, O> manyToOne = new HashMap<M, O>(); - - /** - * Connects the given source with the given target. If this source was - * previously connected with another target the old connection is lost. - * - * @param source - * @param target - * @return - */ - public boolean connect(M source, O target) { - manyToOne.put(source, target); - return false; - } - - /** - * @param source - * @return <code>true</code> if the relation contains the given source - */ - public boolean containsSource(M source) { - return manyToOne.containsKey(source); - } - - /** - * @param target - * @return <code>true</code> if the relation contains the given target - */ - public boolean containsTarget(O target) { - return manyToOne.containsValue(target); - } - - /** - * @param source - * @return the target with which this source is connected - */ - public O getTarget(M source) { - return manyToOne.get(source); - } - - /** - * @param target - * @return all the targets that are connected with this source or empty - * collection if there are no sources connected with this target. - */ - public Collection<M> getSources(O target) { - Collection<M> files = new LinkedList<M>(); - for (Map.Entry<M, O> entry : manyToOne.entrySet()) { - if (entry.getValue().equals(target)) - files.add(entry.getKey()); - } - return files; - } - - /** - * Removes the connection between this source and the corresponding target. - * Other sources will still point to the same target. - * - * The target is removed if this was the only source pointing to it and - * {@link #containsTarget(Object)} will return false. - * - * @param source - */ - public void disconnectSource(M source) { - manyToOne.remove(source); - } - - /** - * Removes the given target from the relation. All the sources that are - * pointing to this target are also removed. - * - * If you take the "result" of {@link #getSources(target)} and after that - * call this method then {@link #containsSource(Object)} will return - * <code>false</code> for every object in "result". - * - * @param target - */ - public void disconnect(O target) { - for (Iterator<O> iter = manyToOne.values().iterator(); iter.hasNext();) { - if (iter.next().equals(target)) - iter.remove(); - } - } - - /** - * @return a collection of the targets. - */ - public Collection<O> getTargets() { - return manyToOne.values(); - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/MyModelProviderEvent.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/MyModelProviderEvent.java deleted file mode 100644 index bf5ef7945..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/MyModelProviderEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.common; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderEvent; - -/** - * @author Kiril Mitov k.mitov@sap.com - * - */ -class MyModelProviderEvent implements IModelProviderEvent { - private IModelProvider model; - private IProject proj; - private int event; - - private List resources; - - public MyModelProviderEvent(int anEventCode, IModelProvider model, IProject proj) { - setEventCode(anEventCode); - setModel(model); - setProject(proj); - resources = new ArrayList(); - } - - public void setProject(IProject project) { - proj = project; - - } - - public void addResource(Object resource) { - resources.add(resource); - } - - public void addResources(Collection<Object> someResources) { - resources.addAll(someResources); - - } - - public List<Object> getChangedResources() { - return resources; - } - - public int getEventCode() { - return event; - } - - public IModelProvider getModel() { - return model; - } - - public void setChangedResources(List<Object> newChangedResources) { - throw new UnsupportedOperationException(); - } - - public void setEventCode(int newEventCode) { - event = newEventCode; - } - - public void setModel(IModelProvider newModel) { - model = newModel; - - } - - public IProject getProject() { - return proj; - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/Result.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/Result.java deleted file mode 100644 index ef519af1b..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/common/Result.java +++ /dev/null @@ -1,61 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.common; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; - -import org.eclipse.jdt.core.IType; -import org.eclipse.jst.javaee.core.JavaEEObject; - -/** - * @author Kiril Mitov k.mitov@sap.com - * - */ -public class Result { - - private Collection<IType> dependedTypes; - - private Collection<JavaEEObject> modelObjects; - - private JavaEEObject mainObject; - - public Result() { - dependedTypes = new HashSet<IType>(); - // most of the time there will be only one object in the model objects - // list. Exceptions are made for results that will contain security - // roles for example. This is way here the modelObjects collection is - // ArrayList with size 1 - modelObjects = new ArrayList<JavaEEObject>(1); - } - - public JavaEEObject getMainObject() { - return mainObject; - } - - public void setMainObject(JavaEEObject mainObject) { - this.mainObject = mainObject; - modelObjects.add(mainObject); - } - - public Collection<JavaEEObject> getAdditional() { - return modelObjects; - } - - public Collection<IType> getDependedTypes() { - return dependedTypes; - } - - public boolean isEmpty() { - return mainObject == null && getAdditional().isEmpty(); - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/BaseRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/BaseRefsMerger.java deleted file mode 100644 index 79e45f641..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/BaseRefsMerger.java +++ /dev/null @@ -1,68 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -/** - * Base abstract class for JNDI mergers - * - * @author Dimitar Giormov - */ -public abstract class BaseRefsMerger extends ModelElementsMerger { - - /** - * Constructor for the class - * - * @param baseList - - * base list of references that have higher priority and are - * result of the merge. - * @param toMergeList - - * toMerge list of references - */ - public BaseRefsMerger(List baseList, List toMergeList) { - super(baseList, toMergeList); - } - - /** - * When an entry with the same name is present in both lists, missing valuse - * in base are filled by toMerge element. - * - * @param baseList - - * base list of references - * @param toMergeList - - * toMerge list of references - */ - protected abstract void copyMissingPropertesInBase(Object base, Object toMerge); - - /** - * @param itListBase - * @param itListToMerge - * @return - */ - protected List mergeIngectionTargets(List itListBase, List itListToMerge) { - // TODO - List result = new ArrayList(); - return result; - } - - /** - * @param descrListBase - * @param descrListToMerge - * @return - */ - protected List mergeDescriptions(List descrListBase, List descrListToMerge) { - List result = new ArrayList(); - return result; - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/EJBRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/EJBRefsMerger.java deleted file mode 100644 index 6394266c7..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/EJBRefsMerger.java +++ /dev/null @@ -1,163 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.EjbLocalRef; -import org.eclipse.jst.javaee.core.EjbRef; - -/** - * EjbRef and EjbLocalRef merger. - * - * @author Dimitar Giormov - */ -public class EJBRefsMerger extends BaseRefsMerger { - - /** - * Constructor for the EjbRefs merger. - * - * @param _baseEjbRefs - base list of references that have higher priority and are result of the merge. - * @param _toMergeEjbRefs - toMerge list of references - */ - public EJBRefsMerger(List _baseEjbRefs, List _toMergeEjbRefs) { - super(_baseEjbRefs, _toMergeEjbRefs); - - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.common.ModelElementsMerger#process() - */ - @Override - public List process() throws ModelException { - List warnings = new ArrayList(); - if (getToMergeElemets() == null || getToMergeElemets().isEmpty()){ - return warnings; - } - - for (Object object : getToMergeElemets()) { - Object findMatchingRef = null; - if(object instanceof EjbLocalRef){ - findMatchingRef = findMatchingLocalRef(getBaseElements(), object); - } else { - findMatchingRef = findMatchingRef(getBaseElements(), object); - } - if (findMatchingRef != null){ - copyMissingPropertesInBase(findMatchingRef, object); - } else{ - getBaseElements().add(EcoreUtil.copy((EObject) object)); - } - - - } - - - return warnings; - } - - private static EjbRef findMatchingRef(List xmlRefs, - Object ref) throws ModelException { - EjbRef result = null; - for (Object currentXMLRef: xmlRefs) { - if (isMatchingRef(currentXMLRef, ref)) { - result = (EjbRef) currentXMLRef; - break; - } - } - return result; - } - - private static EjbLocalRef findMatchingLocalRef(List xmlRefs, - Object ref) throws ModelException { - EjbLocalRef result = null; - for (Object currentXMLRef: xmlRefs) { - if (isMatchingRef(currentXMLRef, ref)) { - result = (EjbLocalRef) currentXMLRef; - break; - } - } - return result; -} - - private static boolean isMatchingRef(Object xmlRef, - Object annotatedRef) throws ModelException { - boolean result = false; - String xmlRefName = (xmlRef instanceof EjbRef) ? ((EjbRef)xmlRef).getEjbRefName() : ((EjbLocalRef)xmlRef).getEjbRefName(); - String annotatedRefName = (annotatedRef instanceof EjbRef) ? ((EjbRef)annotatedRef).getEjbRefName() : ((EjbLocalRef)annotatedRef).getEjbRefName(); - if (xmlRefName.equals(annotatedRefName)) { -// if(!isMatchingTargetBean(xmlRef, annotatedRef)){ -// //TODO check if correct -// return false; -// } - result = true; - } - - return result; - } - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge) { - if(base instanceof EjbRef){ - copyEjbRefPropsInBase((EjbRef)base, (EjbRef)toMerge); - } else if (base instanceof EjbLocalRef){ - copyEjbLocalRefPropsInBase((EjbLocalRef)base, (EjbLocalRef)toMerge); - } - } - - private void copyEjbLocalRefPropsInBase(EjbLocalRef base, EjbLocalRef toMerge) { - if (base.getEjbLink() == null){ - base.setEjbLink(toMerge.getEjbLink()); - } - - if (base.getMappedName() == null){ - base.setMappedName(toMerge.getMappedName()); - } - - if (!base.isSetEjbRefType()){ - base.setEjbRefType(toMerge.getEjbRefType()); - } - - if (base.getLocal() == null){ - base.setLocal(toMerge.getLocal()); - } - - if (base.getLocalHome() == null){ - base.setLocalHome(toMerge.getLocalHome()); - } - - } - - private void copyEjbRefPropsInBase(EjbRef base, EjbRef toMerge) { - if (base.getEjbLink() == null){ - base.setEjbLink(toMerge.getEjbLink()); - } - - if (base.getMappedName() == null){ - base.setMappedName(toMerge.getMappedName()); - } - - if (!base.isSetEjbRefType()){ - base.setEjbRefType(toMerge.getEjbRefType()); - } - - if (base.getRemote() == null){ - base.setRemote(toMerge.getRemote()); - } - - if (base.getHome() == null){ - base.setHome(toMerge.getHome()); - } - - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/EnvEntriesMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/EnvEntriesMerger.java deleted file mode 100644 index c06478331..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/EnvEntriesMerger.java +++ /dev/null @@ -1,85 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.EnvEntry; - -/** - * Merges Environment Entries. - * - * @author Dimitar Giormov - */ -public class EnvEntriesMerger extends BaseRefsMerger { - - /** - * Constructor for the class. - * - * @param baseList - base list with environment entries - * @param toMergeList - toMerge list with environment entries - */ - public EnvEntriesMerger(List baseList, List toMergeList) { - super(baseList, toMergeList); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.common.ModelElementsMerger#process() - */ - @Override - public List process() throws ModelException { - List warnings = new ArrayList(); - for (Object oToMerge : getToMergeElemets()) { - EnvEntry envEntry = (EnvEntry) oToMerge; - boolean found = false; - for (Object oBase : getBaseElements()) { - EnvEntry envEntryBase = (EnvEntry) oBase; - if (envEntryBase.getEnvEntryName().equals(envEntry.getEnvEntryName())){ - copyMissingPropertesInBase(envEntryBase, envEntry); - found = true; - break; - } - } - if (found){ - continue; - } - getBaseElements().add(EcoreUtil.copy((EObject) oToMerge)); - } - return warnings; - } - - - protected void copyMissingPropertesInBase(EnvEntry baseElement, EnvEntry toMergeElement) { - if(baseElement.getEnvEntryValue() == null){ - baseElement.setEnvEntryValue(toMergeElement.getEnvEntryValue()); - } - - if(baseElement.getMappedName() == null){ - baseElement.setMappedName(toMergeElement.getMappedName()); - } - - if(!baseElement.isSetEnvEntryType()){ - baseElement.setEnvEntryType(toMergeElement.getEnvEntryType()); - } - - mergeIngectionTargets(baseElement.getInjectionTargets(), toMergeElement.getInjectionTargets()); - mergeDescriptions(baseElement.getDescriptions(), toMergeElement.getDescriptions()); - } - - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge){ - copyMissingPropertesInBase((EnvEntry) base, (EnvEntry) toMerge); - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/IMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/IMerger.java deleted file mode 100644 index 1af4622db..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/IMerger.java +++ /dev/null @@ -1,29 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.List; - -/** - * Base interface for all merger classes. - * - * @author Dimitar Giormov - */ -public interface IMerger { - - /** - * Process method is the actual merge process. It will generate list of warnngs or throw exception. - * - * @return list of warnings gathered during execution. - * @throws Exception - */ - public abstract List process() throws Exception; -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/JNDIRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/JNDIRefsMerger.java deleted file mode 100644 index f8cbf1db4..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/JNDIRefsMerger.java +++ /dev/null @@ -1,119 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.javaee.web.WebApp; - -/** - * - * JNDI References merger. It can be applied on Enterprise beans or Web resource artifacts. - * - * @author Dimitar Giormov - */ -public class JNDIRefsMerger extends ModelElementMerger { - - /** - * - * @param base - base list of references that have higher priority and are result of the merge. - * @param toMerge - toMerge list of references - * @param kind - */ - public JNDIRefsMerger(JavaEEObject base, - JavaEEObject toMerge, int kind) { - super(base, toMerge, kind); - - } - - /** - * @return - */ - SessionBean getBaseSessionBean() { - return (SessionBean) getBase(); - } - - /** - * @return - */ - SessionBean getToMergeSessionBean () { - return (SessionBean) getToMerge(); - } - - /** - * @return - */ - MessageDrivenBean getBaseMdbBean() { - return (MessageDrivenBean) getBase(); - } - - /** - * @return - */ - MessageDrivenBean getToMergeMdbBean () { - return (MessageDrivenBean) getToMerge(); - } - - /** - * @return - */ - WebApp getBaseWebApp() { - return (WebApp) getBase(); - } - - /** - * @return - */ - WebApp getToMergeWebApp() { - return (WebApp) getToMerge(); - } - - @Override - public List process() throws ModelException { - List warnings = new ArrayList(); - if(getBase() instanceof SessionBean){ - warnings.addAll(new EnvEntriesMerger(getBaseSessionBean().getEnvEntries(), getToMergeSessionBean().getEnvEntries()).process()); - warnings.addAll(new ResourceEnvRefsMerger(getBaseSessionBean().getResourceEnvRefs(), getToMergeSessionBean().getResourceEnvRefs()).process()); - warnings.addAll(new ResourceRefsMerger(getBaseSessionBean().getResourceRefs(), getToMergeSessionBean().getResourceRefs()).process()); - warnings.addAll(new MessageDestinationRefsMerger(getBaseSessionBean().getMessageDestinationRefs(), getToMergeSessionBean().getMessageDestinationRefs()).process()); - warnings.addAll(new ServiceRefsMerger(getBaseSessionBean().getServiceRefs(), getToMergeSessionBean().getServiceRefs()).process()); - warnings.addAll(new PersistenceContextRefsMerger(getBaseSessionBean().getPersistenceContextRefs(), getToMergeSessionBean().getPersistenceContextRefs()).process()); - warnings.addAll(new PersistenceUnitRefsMerger(getBaseSessionBean().getPersistenceUnitRefs(), getToMergeSessionBean().getPersistenceUnitRefs()).process()); - warnings.addAll(new EJBRefsMerger(getBaseSessionBean().getEjbLocalRefs(), getToMergeSessionBean().getEjbLocalRefs()).process()); - warnings.addAll(new EJBRefsMerger(getBaseSessionBean().getEjbRefs(), getToMergeSessionBean().getEjbRefs()).process()); - } else if(getBase() instanceof MessageDrivenBean) { - warnings.addAll(new EnvEntriesMerger(getBaseMdbBean().getEnvEntries(), getToMergeMdbBean().getEnvEntries()).process()); - warnings.addAll(new ResourceEnvRefsMerger(getBaseMdbBean().getResourceEnvRefs(), getToMergeMdbBean().getResourceEnvRefs()).process()); - warnings.addAll(new ResourceRefsMerger(getBaseMdbBean().getResourceRefs(), getToMergeMdbBean().getResourceRefs()).process()); - warnings.addAll(new MessageDestinationRefsMerger(getBaseMdbBean().getMessageDestinationRefs(), getToMergeMdbBean().getMessageDestinationRefs()).process()); - warnings.addAll(new ServiceRefsMerger(getBaseMdbBean().getServiceRefs(), getToMergeMdbBean().getServiceRefs()).process()); - warnings.addAll(new PersistenceContextRefsMerger(getBaseMdbBean().getPersistenceContextRefs(), getToMergeMdbBean().getPersistenceContextRefs()).process()); - warnings.addAll(new PersistenceUnitRefsMerger(getBaseMdbBean().getPersistenceUnitRefs(), getToMergeMdbBean().getPersistenceUnitRefs()).process()); - warnings.addAll(new EJBRefsMerger(getBaseMdbBean().getEjbLocalRefs(), getToMergeMdbBean().getEjbLocalRefs()).process()); - warnings.addAll(new EJBRefsMerger(getBaseMdbBean().getEjbRefs(), getToMergeMdbBean().getEjbRefs()).process()); - } else if(getBase() instanceof WebApp) { - warnings.addAll(new EnvEntriesMerger(getBaseWebApp().getEnvEntries(), getToMergeWebApp().getEnvEntries()).process()); - warnings.addAll(new ResourceEnvRefsMerger(getBaseWebApp().getResourceEnvRefs(), getToMergeWebApp().getResourceEnvRefs()).process()); - warnings.addAll(new ResourceRefsMerger(getBaseWebApp().getResourceRefs(), getToMergeWebApp().getResourceRefs()).process()); - warnings.addAll(new MessageDestinationRefsMerger(getBaseWebApp().getMessageDestinationRefs(), getToMergeWebApp().getMessageDestinationRefs()).process()); - warnings.addAll(new ServiceRefsMerger(getBaseWebApp().getServiceRefs(), getToMergeWebApp().getServiceRefs()).process()); - warnings.addAll(new PersistenceContextRefsMerger(getBaseWebApp().getPersistenceContextRefs(), getToMergeWebApp().getPersistenceContextRefs()).process()); - warnings.addAll(new PersistenceUnitRefsMerger(getBaseWebApp().getPersistenceUnitRefs(), getToMergeWebApp().getPersistenceUnitRefs()).process()); - warnings.addAll(new EJBRefsMerger(getBaseWebApp().getEjbLocalRefs(), getToMergeWebApp().getEjbLocalRefs()).process()); - warnings.addAll(new EJBRefsMerger(getBaseWebApp().getEjbRefs(), getToMergeWebApp().getEjbRefs()).process()); - } - return warnings; - } - } diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/MessageDestinationRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/MessageDestinationRefsMerger.java deleted file mode 100644 index 0dd696946..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/MessageDestinationRefsMerger.java +++ /dev/null @@ -1,89 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.MessageDestinationRef; - -/** - * MessageDestinationRefsMerger merges MessageDestinationRef objects. - * - * @author Dimitar Giormov - * - */ -public class MessageDestinationRefsMerger extends BaseRefsMerger { - - - /** - * Constructor for the class. - * - * @param base - base list with message destination references. - * that have higher priority and are result of the merge. - * @param toMerge - toMerge list to be imported in base list. - */ - public MessageDestinationRefsMerger(List base, List toMerge) { - super(base, toMerge); - } - - @Override - public List<String> process() throws ModelException { - List<String> warnings = new ArrayList<String>(); - for (Object oToMerge : getToMergeElemets()) { - MessageDestinationRef envEntry = (MessageDestinationRef) oToMerge; - boolean found = false; - for (Object oBase : getBaseElements()) { - MessageDestinationRef envEntryBase = (MessageDestinationRef) oBase; - if (envEntryBase.getMessageDestinationRefName().equals(envEntry.getMessageDestinationRefName())){ - copyMissingPropertesInBase(envEntryBase, envEntry); - found = true; - break; - } - } - if (found){ - continue; - } - getBaseElements().add(EcoreUtil.copy((EObject) oToMerge)); - } - return warnings; - } - - protected void copyMissingPropertesInBase(MessageDestinationRef baseElement, MessageDestinationRef toMergeElement) { - - if(baseElement.getMappedName() == null){ - baseElement.setMappedName(toMergeElement.getMappedName()); - } - - if(baseElement.getMessageDestinationLink() == null){ - baseElement.setMessageDestinationLink(toMergeElement.getMessageDestinationLink()); - } - - if(baseElement.getMessageDestinationType() == null){ - baseElement.setMessageDestinationType(toMergeElement.getMessageDestinationType()); - } - - if(!baseElement.isSetMessageDestinationUsage()){ - baseElement.setMessageDestinationUsage(toMergeElement.getMessageDestinationUsage()); - } - - mergeIngectionTargets(baseElement.getInjectionTargets(), toMergeElement.getInjectionTargets()); - mergeDescriptions(baseElement.getDescriptions(), toMergeElement.getDescriptions()); - } - - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge){ - copyMissingPropertesInBase((MessageDestinationRef) base, (MessageDestinationRef) toMerge); - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelElementMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelElementMerger.java deleted file mode 100644 index 1a77f5869..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelElementMerger.java +++ /dev/null @@ -1,81 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008, 2010 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.List; - -import org.eclipse.jst.javaee.core.JavaEEObject; - -/** - * Model element merger is bease class for Java EE mergers. - * It contains the base and toMerge elements. - * - * Base element is the main element that values will be taken with highest priority. - * toMerge element will give all of his extra values to base. - * - * @author Dimitar Giormov - */ -public abstract class ModelElementMerger implements IMerger { - - public static int ADD = 0x1; - - public static int CHANGE = 0x2; - - public static int REMOVE = 0x4; - - public static int COPY = 0x8; - - JavaEEObject base; - JavaEEObject toMerger; - - private int kind; - - - /** - * Constructor of the class. - * - * @param _base element is the main element that values will be taken with highest priority. - * @param _toMerge element will give all of his extra values to base. - * @param _kind - */ - public ModelElementMerger(JavaEEObject _base, JavaEEObject _toMerge, int _kind) { - base = _base; - toMerger = _toMerge; - kind = _kind; - } - - /** - * Returns the base element, which is also the merged result. - * - * @return base element. - */ - protected JavaEEObject getBase() { - return base; - } - - /** - * - * @return toMerge element, which will be merged in base. - */ - protected JavaEEObject getToMerge() { - return toMerger; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.Merger#process() - */ - public abstract List process() throws ModelException; - - public int getKind() { - return kind; - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelElementsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelElementsMerger.java deleted file mode 100644 index 4031ab524..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelElementsMerger.java +++ /dev/null @@ -1,58 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -/** - * Base merger adapted to deal with Lists. - * - * @author Dimitar Giormov - * - */ -public class ModelElementsMerger implements IMerger { - - private List baseElements; - private List toMergeList; - - /** - * @param _baseList - * @param _toMergeList - */ - public ModelElementsMerger(List _baseList, List _toMergeList) { - baseElements = _baseList; - toMergeList = _toMergeList; - } - - - /** - * @return - */ - protected List getBaseElements() { - return baseElements; - } - - /** - * @return - */ - protected List getToMergeElemets() { - return toMergeList; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.Merger#process() - */ - public List process() throws ModelException { - List warnings = new ArrayList(); - return warnings; - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelException.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelException.java deleted file mode 100644 index 7958d0f39..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ModelException.java +++ /dev/null @@ -1,35 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -/** - * ModelException is thrown when invalid values or inconsistencies are detected in the model. - * - * @author Dimitar Giormov - */ -public class ModelException extends Exception { - - /** - * - */ - private static final long serialVersionUID = -1239223181526060738L; - - - public ModelException(Exception e) { - super(e); - } - - - public ModelException() { - super(); - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/PersistenceContextRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/PersistenceContextRefsMerger.java deleted file mode 100644 index 1537de5a5..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/PersistenceContextRefsMerger.java +++ /dev/null @@ -1,111 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.PersistenceContextRef; -import org.eclipse.jst.javaee.core.PropertyType; - -/** - * Merges persistence context references artifacts. - * - * @author Dimitar Giormov - * - */ -public class PersistenceContextRefsMerger extends BaseRefsMerger { - - /** - * Constructor for the class. - * - * @param base - base list with persistence context references. - * that have higher priority and are result of the merge. - * @param toMerge - toMerge list to be imported in base list. - */ - public PersistenceContextRefsMerger(List _base, List _toMerge) { - super(_base, _toMerge); - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.common.ModelElementsMerger#process() - */ - @Override - public List process() throws ModelException { - List warnings = new ArrayList(); - for (Object oToMerge : getToMergeElemets()) { - PersistenceContextRef envEntry = (PersistenceContextRef) oToMerge; - boolean found = false; - for (Object oBase : getBaseElements()) { - PersistenceContextRef envEntryBase = (PersistenceContextRef) oBase; - if (envEntryBase.getPersistenceContextRefName().equals(envEntry.getPersistenceContextRefName())){ - copyMissingPropertesInBase(envEntryBase, envEntry); - found = true; - break; - } - } - if (found){ - continue; - } - getBaseElements().add(EcoreUtil.copy((EObject) oToMerge)); - } - return warnings; - } - - - protected void copyMissingPropertesInBase(PersistenceContextRef baseElement, PersistenceContextRef toMergeElement) { - if(baseElement.getPersistenceUnitName() == null){ - baseElement.setPersistenceUnitName(toMergeElement.getPersistenceUnitName()); - } - - if(baseElement.getPersistenceContextType() == null){ - baseElement.setPersistenceContextType(toMergeElement.getPersistenceContextType()); - } - - if(baseElement.getMappedName() == null){ - baseElement.setMappedName(toMergeElement.getMappedName()); - } - - copyMissingPersistentPropertiesInBase(baseElement.getPersistenceProperties(), toMergeElement.getPersistenceProperties()); - } - - - private void copyMissingPersistentPropertiesInBase( - List persistenceProperties, List persistenceProperties2) { - for (Object mergeProps : persistenceProperties2) { - PropertyType mProp = (PropertyType) mergeProps; - if(!containsProperty(persistenceProperties , mProp)){ - persistenceProperties.add( mProp); - } - - } - } - - private boolean containsProperty(List list, PropertyType p){ - for (Object baseProps : list) { - PropertyType bProp = (PropertyType) baseProps; - if(p.getName().equals(bProp.getName())){ - return true; - } - } - return false; - } - - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge){ - copyMissingPropertesInBase((PersistenceContextRef) base, (PersistenceContextRef) toMerge); - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/PersistenceUnitRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/PersistenceUnitRefsMerger.java deleted file mode 100644 index 1a0ad73a4..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/PersistenceUnitRefsMerger.java +++ /dev/null @@ -1,81 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.PersistenceUnitRef; - -/** - * - * Merges persistence unit references artifacts. - * - * @author Dimitar Giormov - */ - -public class PersistenceUnitRefsMerger extends BaseRefsMerger { - - /** - * Constructor for the class. - * - * @param base - base list with persistence unit references. - * that have higher priority and are result of the merge. - * @param toMerge - toMerge list to be imported in base list. - */ - public PersistenceUnitRefsMerger(List base, List toMerge) { - super(base, toMerge); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.common.ModelElementsMerger#process() - */ - @Override - public List process() throws ModelException { - List warnings = new ArrayList(); - for (Object oToMerge : getToMergeElemets()) { - PersistenceUnitRef resRef = (PersistenceUnitRef) oToMerge; - boolean found = false; - for (Object oBase : getBaseElements()) { - PersistenceUnitRef resRefBase = (PersistenceUnitRef) oBase; - if (resRefBase.getPersistenceUnitRefName().equals(resRef.getPersistenceUnitRefName())){ - copyMissingPropertesInBase(resRefBase, resRef); - found = true; - break; - } - } - if (found){ - continue; - } - getBaseElements().add(EcoreUtil.copy((EObject) oToMerge)); - } - return warnings; - } - - - protected void copyMissingPropertesInBase(PersistenceUnitRef baseElement, PersistenceUnitRef toMergeElement) { - if(baseElement.getPersistenceUnitName() == null){ - baseElement.setPersistenceUnitName(toMergeElement.getPersistenceUnitName()); - } - if(baseElement.getMappedName() == null){ - baseElement.setMappedName(toMergeElement.getMappedName()); - } - } - - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge){ - copyMissingPropertesInBase((PersistenceUnitRef) base, (PersistenceUnitRef) toMerge); - } - -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ResourceEnvRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ResourceEnvRefsMerger.java deleted file mode 100644 index ca70efa3b..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ResourceEnvRefsMerger.java +++ /dev/null @@ -1,82 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.ResourceEnvRef; - -/** - * Merges Resource Environment References artifacts. - * - * @author Dimitar Giormov - * - */ -public class ResourceEnvRefsMerger extends BaseRefsMerger { - - /** - * Constructor for the class. - * - * @param base - base list with resource environment references. - * that have higher priority and are result of the merge. - * @param toMerge - toMerge list to be imported in base list. - */ - public ResourceEnvRefsMerger(List base, List toMerge) { - super(base, toMerge); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.common.ModelElementsMerger#process() - */ - @Override - public List process() throws ModelException { - List warnings = new ArrayList(); - for (Object oToMerge : getToMergeElemets()) { - ResourceEnvRef resEnvRef = (ResourceEnvRef) oToMerge; - boolean found = false; - for (Object oBase : getBaseElements()) { - ResourceEnvRef resourceEnvRefBase = (ResourceEnvRef) oBase; - if (resourceEnvRefBase.getResourceEnvRefName().equals(resEnvRef.getResourceEnvRefName())){ - copyMissingPropertesInBase(resourceEnvRefBase, resEnvRef); - found = true; - break; - } - } - if (found){ - continue; - } - getBaseElements().add(EcoreUtil.copy((EObject) oToMerge)); - } - return warnings; - } - - protected void copyMissingPropertesInBase(ResourceEnvRef baseRef, ResourceEnvRef toMergeRef) { - if(baseRef.getResourceEnvRefType() == null){ - baseRef.setResourceEnvRefType(toMergeRef.getResourceEnvRefType()); - } - - if(baseRef.getMappedName() == null){ - baseRef.setMappedName(toMergeRef.getMappedName()); - } - - mergeIngectionTargets(baseRef.getInjectionTargets(), toMergeRef.getInjectionTargets()); - mergeDescriptions(baseRef.getDescriptions(), toMergeRef.getDescriptions()); - } - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge) { - copyMissingPropertesInBase((ResourceEnvRef) base, (ResourceEnvRef)toMerge); - - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ResourceRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ResourceRefsMerger.java deleted file mode 100644 index 1fff46b95..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ResourceRefsMerger.java +++ /dev/null @@ -1,89 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.ResourceRef; - -/** - * Merges Resource References artifacts. - * - * @author Dimitar Giormov - * - */ -public class ResourceRefsMerger extends BaseRefsMerger { - - /** - * Constructor for the class. - * - * @param base - base list with resource references. - * that have higher priority and are result of the merge. - * @param toMerge - toMerge list to be imported in base list. - */ - public ResourceRefsMerger(List base, List toMerge) { - super(base, toMerge); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.common.ModelElementsMerger#process() - */ - @Override - public List process() throws ModelException { - List warnings = new ArrayList(); - for (Object oToMerge : getToMergeElemets()) { - ResourceRef resRef = (ResourceRef) oToMerge; - boolean found = false; - for (Object oBase : getBaseElements()) { - ResourceRef resRefBase = (ResourceRef) oBase; - if (resRefBase.getResRefName().equals(resRef.getResRefName())){ - copyMissingPropertesInBase(resRefBase, resRef); - found = true; - break; - } - } - if (found){ - continue; - } - getBaseElements().add(EcoreUtil.copy((EObject) oToMerge)); - } - return warnings; - } - - protected void copyMissingPropertesInBase(ResourceRef baseElement, ResourceRef toMergeElement) { - if(baseElement.getResType() == null){ - baseElement.setResType(toMergeElement.getResType()); - } - - if(!baseElement.isSetResAuth()){ - baseElement.setResAuth(toMergeElement.getResAuth()); - } - - if(!baseElement.isSetResSharingScope()){ - baseElement.setResSharingScope(toMergeElement.getResSharingScope()); - } - - if(baseElement.getMappedName() == null){ - baseElement.setMappedName(toMergeElement.getMappedName()); - } - - - } - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge) { - copyMissingPropertesInBase((ResourceRef) base, (ResourceRef )toMerge); - - } -} diff --git a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ServiceRefsMerger.java b/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ServiceRefsMerger.java deleted file mode 100644 index 38f7bba7e..000000000 --- a/plugins/org.eclipse.jst.jee/common/org/eclipse/jst/jee/model/internal/mergers/ServiceRefsMerger.java +++ /dev/null @@ -1,83 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.model.internal.mergers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.javaee.core.ServiceRef; - -/** - * @author Dimitar Giormov - * - */ -public class ServiceRefsMerger extends BaseRefsMerger { - - - /** - * Constructor for the class. - * - * @param base - base list with service references. - * that have higher priority and are result of the merge. - * @param toMerge - toMerge list to be imported in base list. - */ - public ServiceRefsMerger(List _baseRefs, List _toMergeRefs) { - super(_baseRefs, _toMergeRefs); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.javaee.ejb.model.mergers.common.ModelElementsMerger#process() - */ - @Override -public List process() throws ModelException { - List warnings = new ArrayList(); - for (Object oToMerge : getToMergeElemets()) { - ServiceRef servivceRef = (ServiceRef) oToMerge; - boolean found = false; - for (Object oBase : getBaseElements()) { - ServiceRef ServiceRefBase = (ServiceRef) oBase; - if (ServiceRefBase.getServiceRefName().equals(servivceRef.getServiceRefName())){ - copyMissingPropertesInBase(ServiceRefBase, servivceRef); - found = true; - break; - } - } - if (found){ - continue; - } - getBaseElements().add(EcoreUtil.copy((EObject) oToMerge)); - } - return warnings; - } - - - @Override - protected void copyMissingPropertesInBase(Object base, Object toMerge) { - copyMissingPropertesInBase((ServiceRef) base, (ServiceRef) toMerge); - } - protected void copyMissingPropertesInBase(ServiceRef base, ServiceRef toMerge) { - if (base.getMappedName() == null){ - base.setMappedName(toMerge.getMappedName()); - } - - if (base.getWsdlFile() == null){ - base.setWsdlFile(toMerge.getWsdlFile()); - } - // if (base.getServiceInterface().equals("javax.xml.ws.Service")) { - if (base.getServiceInterface() == null) { - base.setServiceInterface(toMerge.getServiceInterface()); - } - // } - } - -} diff --git a/plugins/org.eclipse.jst.jee/component.xml b/plugins/org.eclipse.jst.jee/component.xml deleted file mode 100644 index 22b7b1444..000000000 --- a/plugins/org.eclipse.jst.jee/component.xml +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jst.jee"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jst.jee" fragment="false"/><plugin id="org.eclipse.jst.jee.ejb" fragment="false"/><plugin id="org.eclipse.jst.jee.ui" fragment="false"/><plugin id="org.eclipse.jst.jee.web" fragment="false"/></component> diff --git a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/JEEPlugin.java b/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/JEEPlugin.java deleted file mode 100644 index 31d4b9f1a..000000000 --- a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/JEEPlugin.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jee; - -import org.eclipse.wst.common.frameworks.internal.WTPPlugin; -import org.osgi.framework.BundleContext; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import java.lang.Throwable; -import org.eclipse.core.runtime.CoreException; - -/** - * The activator class controls the plug-in life cycle - */ -public class JEEPlugin extends WTPPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jst.jee"; //$NON-NLS-1$ - - // The shared instance - private static JEEPlugin plugin; - - private JEEPreferences preferences = null; - - /** - * The constructor - */ - public JEEPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static JEEPlugin getDefault() { - return plugin; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.WTPPlugin#getPluginID() - */ - @Override - public String getPluginID() { - return PLUGIN_ID; - } - - /** - * @return Returns the preferences. - */ - public JEEPreferences getJEEPreferences() { - if (this.preferences == null) - this.preferences = new JEEPreferences(this); - return this.preferences; - } - - @Override - protected void initializeDefaultPluginPreferences() { - getJEEPreferences().initializeDefaultPreferences(); - } - - public static IStatus createStatus(int severity, String message, Throwable exception) { - return new Status(severity, PLUGIN_ID, message, exception); - } - - public static IStatus createStatus(int severity, String message) { - return createStatus(severity, message, null); - } - - public static void logError(Throwable exception) { - Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception)); - } - - public static void logError(CoreException exception) { - Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() ); - } - -} diff --git a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/JEEPreferences.java b/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/JEEPreferences.java deleted file mode 100644 index 345480efe..000000000 --- a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/JEEPreferences.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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 Jan 26, 2004 - * - * To change the template for this generated file go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -package org.eclipse.jst.jee; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; - - -/** - * @author mdelder - */ -public class JEEPreferences { - - public interface Keys { - - - - } - - - - - - private Plugin owner = null; - private Preferences preferences = null; - private boolean persistOnChange = false; - - public JEEPreferences(Plugin owner) { - this.owner = owner; - } - - protected void initializeDefaultPreferences() { - - // placeholder - // we had to move generate_dd to jst.j2ee as jst.jee is not in the pre-req of many plug-ins - } - - - - - - - public void firePreferenceChanged() { - if (isPersistOnChange()) - persist(); - } - - public void persist() { - getOwner().savePluginPreferences(); - } - - /** - * @return Returns the persistOnChange. - */ - public boolean isPersistOnChange() { - return this.persistOnChange; - } - - /** - * @param persistOnChange - * The persistOnChange to set. - */ - public void setPersistOnChange(boolean persistOnChange) { - this.persistOnChange = persistOnChange; - } - - public Preferences getPreferences() { - if (this.preferences == null) - this.preferences = getOwner().getPluginPreferences(); - return this.preferences; - } - - /** - * @return Returns the owner. - */ - private Plugin getOwner() { - return this.owner; - } - - /** - * Returns the current value of the boolean-valued property with the - * given name. - * The given name must not be <code>null</code>. - * - * @param name the name of the property - * @return the boolean-valued property - */ - public boolean getBoolean(String name) { - return getPreferences().getBoolean(name); - } - - /** - * Sets the current value of the boolean-valued property with the - * given name. The given name must not be <code>null</code>. - * @param name the name of the property - * @param value the new current value of the property - */ - public void setValue(String name, boolean value) { - getPreferences().setValue(name, value); - firePreferenceChanged(); - } - -} diff --git a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java b/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java deleted file mode 100644 index 067b4795b..000000000 --- a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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.jee.internal.deployables; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.internal.deployables.J2EEDeployableFactory; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.model.ModuleDelegate; -import org.eclipse.wst.web.internal.deployables.FlatComponentDeployable; - -/** - * J2EE module factory. - */ -public class JEEDeployableFactory extends J2EEDeployableFactory { - protected Map <IModule, ModuleDelegate> moduleDelegates = new HashMap<IModule, ModuleDelegate>(5); - - public static final String JEE_ID = "org.eclipse.jst.jee.server"; //$NON-NLS-1$ - public static JEEDeployableFactory JEE_INSTANCE; - public static JEEDeployableFactory jeeInstance() { - if( JEE_INSTANCE == null ) { - ensureFactoryLoaded(JEE_ID); - } - return JEE_INSTANCE; - } - - public JEEDeployableFactory() { - super(); - } - - @Override - public void initialize() { - super.initialize(); - if( getId().equals(JEE_ID)) - JEE_INSTANCE = this; - } - - - @Override - protected FlatComponentDeployable createModuleDelegate(IProject project, IVirtualComponent component) { - return new JEEFlexProjDeployable(project, component); - } - - @Override - protected boolean canHandleProject(IProject p) { - // First check the component is of type Java EE, then check J2EE version - IVirtualComponent comp = ComponentCore.createComponent(p); - return (JavaEEProjectUtilities.usesJavaEEComponent(comp) && J2EEProjectUtilities.isJEEProject(p)); - } - - @Override - protected FlatComponentDeployable getNestedDelegate(IVirtualComponent component) { - return new JEEFlexProjDeployable(component.getProject(), component); - } - -} diff --git a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEFlexProjDeployable.java b/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEFlexProjDeployable.java deleted file mode 100644 index 14a9b0397..000000000 --- a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEFlexProjDeployable.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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.jee.internal.deployables; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.internal.EjbModuleExtensionHelper; -import org.eclipse.jst.j2ee.internal.IEJBModelExtenderManager; -import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.javaee.ejb.EnterpriseBeans; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.server.core.IModule; - -/** - * JEE module superclass. - */ -public class JEEFlexProjDeployable extends J2EEFlexProjDeployable { - - /** - * Constructor for JEEFlexProjDeployable. - * - * @param project - * @param aComponent - */ - public JEEFlexProjDeployable(IProject project, IVirtualComponent aComponent) { - super(project, aComponent); - } - - /** - * Constructor for JEEFlexProjDeployable. - * - * @param project - */ - public JEEFlexProjDeployable(IProject project) { - super(project); - } - - @Override - protected IModule gatherModuleReference(IVirtualComponent component, IChildModuleReference child ) { - if (!child.isBinary()) - return super.gatherModuleReference(component, child); - return JEEDeployableFactory.jeeInstance().createChildModule(this, child); - } - - - /*_________________________________ - * - * Methods for specific J2EE / JEE Interfaces are below - *_________________________________ - */ - public String getJNDIName(String ejbName, String interfaceName) { - if (!JavaEEProjectUtilities.isEJBProject(component.getProject())) - return null; - - EjbModuleExtensionHelper modHelper = null; - EJBJar jar = null; - - IModelProvider model = ModelProviderManager.getModelProvider(component.getProject()); - if (model != null) { - jar = (EJBJar) model.getModelObject(); - SessionBean bean = getSessionBeanNamed(jar, ejbName); - modHelper = IEJBModelExtenderManager.INSTANCE.getEJBModuleExtension(null); - return modHelper == null ? null : modHelper.getJavaEEJNDIName(jar, bean, interfaceName); - } - - return null; - } - /** - * Return List of Session beans in this jar. - * @return java.util.List - */ - public SessionBean getSessionBeanNamed(EJBJar jar, String beanName) { - - EnterpriseBeans allBeans = jar.getEnterpriseBeans(); - for (Iterator iterator = allBeans.getSessionBeans().iterator(); iterator.hasNext();) { - SessionBean bean = (SessionBean) iterator.next(); - if (bean.getEjbName().equals(beanName)) - return bean; - } - return null; - } - -} diff --git a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/project/facet/EarFacetInstallDelegate.java b/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/project/facet/EarFacetInstallDelegate.java deleted file mode 100644 index 04c209617..000000000 --- a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/project/facet/EarFacetInstallDelegate.java +++ /dev/null @@ -1,115 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.jee.project.facet; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.common.project.facet.WtpUtils; -import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit; -import org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil; -import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants; -import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties; -import org.eclipse.jst.jee.JEEPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * @deprecated - This class had duplicated functionality. Please use {@link org.eclipse.jst.j2ee.project.facet.EarFacetInstallDelegate} - */ -public final class EarFacetInstallDelegate implements IDelegate { - - public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - IDataModel model = (IDataModel) cfg; - - if (monitor != null) { - monitor.worked(1); - } - // Add WTP natures. - - WtpUtils.addNaturestoEAR(project); - - final IVirtualComponent c = ComponentCore.createComponent(project, false); - c.create(0, null); - - final IVirtualFolder earroot = c.getRootFolder(); - earroot.createLink(new Path("/" + model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR)), 0, null); //$NON-NLS-1$ - - try { - ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null); - } catch (ExecutionException e) { - JEEPlugin.logError(e); - } - - if( fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_60 || fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_50) { - if(model.getBooleanProperty(IJ2EEFacetInstallDataModelProperties.GENERATE_DD)){ - // Create the deployment descriptor (web.xml) if one doesn't exist - IFile appXmlFile = earroot.getUnderlyingFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI)); - if (!appXmlFile.exists()) { - try { - if(!appXmlFile.getParent().exists() - && (appXmlFile.getParent().getType() == IResource.FOLDER)){ - ((IFolder)appXmlFile.getParent()).create(true, true, monitor); - } - String appXmlContents = null; - if(fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_60) { - appXmlContents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<application id=\"Application_ID\" version=\"6\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd\">\n <display-name> \n" + project.getName() + "</display-name> \n </application> "; //$NON-NLS-1$ //$NON-NLS-2$ - } - else { - appXmlContents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<application id=\"Application_ID\" version=\"5\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd\">\n <display-name> \n" + project.getName() + "</display-name> \n </application> "; //$NON-NLS-1$ //$NON-NLS-2$ - } - appXmlFile.create(new ByteArrayInputStream(appXmlContents.getBytes("UTF-8")), true, monitor); //$NON-NLS-1$ - } catch (UnsupportedEncodingException e) { - JEEPlugin.logError(e); - } - } - } - } - else { - if (!earroot.getUnderlyingFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI)).exists()) { - String ver = model.getStringProperty(IFacetDataModelProperties.FACET_VERSION_STR); - int nVer = J2EEVersionUtil.convertVersionStringToInt(ver); - EARArtifactEdit.createDeploymentDescriptor(project, nVer); - } - } - } - - finally { - if (monitor != null) { - monitor.done(); - } - } - } - -} diff --git a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/project/facet/EarFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/project/facet/EarFacetPostInstallDelegate.java deleted file mode 100644 index bc14bdb7e..000000000 --- a/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/project/facet/EarFacetPostInstallDelegate.java +++ /dev/null @@ -1,94 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.jee.project.facet; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider; -import org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationOperation; -import org.eclipse.jst.jee.JEEPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * @deprecated - This class had duplicated functionality. Please use {@link org.eclipse.jst.j2ee.project.facet.EarFacetPostInstallDelegate} - */ -public final class EarFacetPostInstallDelegate implements IDelegate { - - public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - IDataModel model = (IDataModel) cfg; - - if (monitor != null) { - monitor.worked(1); - } - - final IVirtualComponent c = ComponentCore.createComponent(project); - - Set dependentProjects = new HashSet(); - dependentProjects.addAll((List) model.getProperty(IEarFacetInstallDataModelProperties.J2EE_PROJECTS_LIST)); - dependentProjects.addAll((List) model.getProperty(IEarFacetInstallDataModelProperties.JAVA_PROJECT_LIST)); - if (!dependentProjects.isEmpty()) { - List dependentComponents = new ArrayList(dependentProjects.size()); - for (Iterator iterator = dependentProjects.iterator(); iterator.hasNext();) { - IProject depProject = (IProject) iterator.next(); - IVirtualComponent depComp = ComponentCore.createComponent(depProject); - if (depComp == null) { - JavaProjectMigrationOperation utilOp = J2EEProjectUtilities.createFlexJavaProjectForProjectOperation(depProject); - utilOp.execute(null, null); - depComp = ComponentCore.createComponent(depProject); - } - - dependentComponents.add(depComp); - } - - final IDataModel dataModel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider()); - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, c); - List modList = (List) dataModel.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST); - modList.addAll(dependentComponents); - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList); - try { - dataModel.getDefaultOperation().execute(null, null); - } catch (ExecutionException e) { - JEEPlugin.logError(e); - } - } - - } - - finally { - if (monitor != null) { - monitor.done(); - } - } - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEE6ContentDescriber.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEE6ContentDescriber.java deleted file mode 100644 index 0338b6c57..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEE6ContentDescriber.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2009 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.jee.contenttype; - -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.content.IContentDescriber; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek; - -/** - * A content describer for detecting a j2ee module - */ -public final class JEE6ContentDescriber implements IContentDescriber { - public JEE6ContentDescriber() { - super(); - } - - public final static QualifiedName JEEVERSION = new QualifiedName("jee-version", "5.0"); //$NON-NLS-1$ //$NON-NLS-2$ - - public int describe(InputStream contents, IContentDescription description) throws IOException { - - JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(contents); - switch (quickPeek.getType()) { - case JavaEEQuickPeek.APPLICATION_CLIENT_TYPE: - case JavaEEQuickPeek.APPLICATION_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.JEE_6_0_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.EJB_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.EJB_3_1_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.WEB_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.WEB_3_0_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.WEBFRAGMENT_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.WEBFRAGMENT_3_0_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.CONNECTOR_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.JCA_1_6_ID: - return VALID; - } - return INVALID; - } - - return INVALID; - } - - public QualifiedName[] getSupportedOptions() { - - return new QualifiedName[] { JEEVERSION }; - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEEContentDescriber.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEEContentDescriber.java deleted file mode 100644 index dd4e85aa7..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEEContentDescriber.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 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.jee.contenttype; - -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.content.IContentDescriber; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek; - -/** - * A content describer for detecting a j2ee module - */ -public final class JEEContentDescriber implements IContentDescriber { - public JEEContentDescriber() { - super(); - } - - public final static QualifiedName JEEVERSION = new QualifiedName("jee-version", "5.0"); //$NON-NLS-1$ //$NON-NLS-2$ - - public int describe(InputStream contents, IContentDescription description) throws IOException { - - JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(contents); - switch (quickPeek.getType()) { - case JavaEEQuickPeek.APPLICATION_CLIENT_TYPE: - case JavaEEQuickPeek.APPLICATION_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.JEE_5_0_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.EJB_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.EJB_3_0_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.WEB_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.WEB_2_5_ID: - return VALID; - } - return INVALID; - } - - return INVALID; - } - - public QualifiedName[] getSupportedOptions() { - - return new QualifiedName[] { JEEVERSION }; - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProvider.java deleted file mode 100644 index 135cb4538..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProvider.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.javaee.applicationclient.ApplicationClient; -import org.eclipse.jst.javaee.applicationclient.ApplicationClientDeploymentDescriptor; -import org.eclipse.jst.javaee.applicationclient.ApplicationclientFactory; -import org.eclipse.jst.javaee.applicationclient.IApplicationClientResource; -import org.eclipse.jst.javaee.core.DisplayName; -import org.eclipse.jst.javaee.core.JavaeeFactory; - -public class AppClient5ModelProvider extends JEE5ModelProvider { - - private static final String APPCLIENT5_CONTENT_TYPE = "org.eclipse.jst.jee.ee5appclientDD"; //$NON-NLS-1$ - public AppClient5ModelProvider(IProject proj) { - super(); - this.proj = proj; - setDefaultResourcePath(new Path(J2EEConstants.APP_CLIENT_DD_URI)); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.model.IModelProvider#getModelObject(org.eclipse.core.runtime.IPath) - */ - @Override - public Object getModelObject(IPath modelPath) { - IApplicationClientResource appRes = (IApplicationClientResource)getModelResource(modelPath); - if (appRes != null && appRes.getRootObject() != null) - return appRes.getApplicationClient(); - return null; - } - @Override - protected String getContentTypeDescriber() { - return APPCLIENT5_CONTENT_TYPE; - } - @Override - public void populateRoot(XMLResourceImpl res, String name) { - ApplicationClientDeploymentDescriptor dd = ApplicationclientFactory.eINSTANCE.createApplicationClientDeploymentDescriptor(); - dd.getXMLNSPrefixMap().put("", J2EEConstants.JAVAEE_NS_URL); //$NON-NLS-1$ - dd.getXMLNSPrefixMap().put("xsi", J2EEConstants.XSI_NS_URL); //$NON-NLS-1$ - - ApplicationClient client = ApplicationclientFactory.eINSTANCE.createApplicationClient(); - DisplayName dn = JavaeeFactory.eINSTANCE.createDisplayName(); - dn.setValue(name); - client.getDisplayNames().add(dn); - - String version = J2EEProjectUtilities.getJ2EEProjectVersion(proj); - if(version != null && version.equals(J2EEVersionConstants.VERSION_5_0_TEXT)) { - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.APP_CLIENT_SCHEMA_LOC_5); - client.setVersion(J2EEVersionConstants.VERSION_5_TEXT); - } - else { - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.APP_CLIENT_SCHEMA_LOC_6); - client.setVersion(J2EEVersionConstants.VERSION_6_TEXT); - } - - dd.setApplicationClient(client); - res.getContents().add((EObject) dd); - } - - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProviderFactory.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProviderFactory.java deleted file mode 100644 index 3e5758787..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProviderFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderFactory; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class AppClient5ModelProviderFactory implements IModelProviderFactory { - - public IModelProvider create(IProject project) { - return new AppClient5ModelProvider(project); - } - - public IModelProvider create(IVirtualComponent component) { - return new AppClient5ModelProvider(component.getProject()); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/Connector16ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/Connector16ModelProvider.java deleted file mode 100644 index 2546b4d03..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/Connector16ModelProvider.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.jee.model.internal; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.javaee.core.DisplayName; -import org.eclipse.jst.javaee.core.JavaeeFactory; -import org.eclipse.jst.javaee.jca.Connector; -import org.eclipse.jst.javaee.jca.ConnectorDeploymentDescriptor; -import org.eclipse.jst.javaee.jca.IConnectorResource; -import org.eclipse.jst.javaee.jca.JcaFactory; - -public class Connector16ModelProvider extends JEE5ModelProvider { - - private static final String CONNECTOR16_CONTENT_TYPE = "org.eclipse.jst.jee.ee6connectorDD"; //$NON-NLS-1$ - public Connector16ModelProvider(IProject proj) { - super(); - this.proj = proj; - setDefaultResourcePath(new Path(J2EEConstants.RAR_DD_URI)); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.model.IModelProvider#getModelObject(org.eclipse.core.runtime.IPath) - */ - @Override - public Object getModelObject(IPath modelPath) { - IConnectorResource connectorRes = (IConnectorResource)getModelResource(modelPath); - if (connectorRes != null && connectorRes.getRootObject() != null) - return connectorRes.getConnector(); - return null; - } - @Override - protected String getContentTypeDescriber() { - return CONNECTOR16_CONTENT_TYPE; - } - @Override - public void populateRoot(XMLResourceImpl res, String name) { - ConnectorDeploymentDescriptor dd = JcaFactory.eINSTANCE.createConnectorDeploymentDescriptor(); - dd.getXMLNSPrefixMap().put("", J2EEConstants.JAVAEE_NS_URL); //$NON-NLS-1$ - dd.getXMLNSPrefixMap().put("xsi", J2EEConstants.XSI_NS_URL); //$NON-NLS-1$ - - Connector connector = JcaFactory.eINSTANCE.createConnector(); - DisplayName dn = JavaeeFactory.eINSTANCE.createDisplayName(); - dn.setValue(name); - connector.getDisplayNames().add(dn); - - String version = J2EEProjectUtilities.getJ2EEProjectVersion(proj); - if(version != null && version.equals(J2EEVersionConstants.VERSION_1_6_TEXT)) { - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.CONNECTOR_SCHEMA_LOC_1_6); - connector.setVersion(J2EEVersionConstants.VERSION_1_6_TEXT); - } - else - { - // default to 1.6 for now - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.CONNECTOR_SCHEMA_LOC_1_6); - connector.setVersion(J2EEVersionConstants.VERSION_1_6_TEXT); - } - dd.setConnector(connector); - res.getContents().add((EObject) dd); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/Connector16ModelProviderFactory.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/Connector16ModelProviderFactory.java deleted file mode 100644 index 84f38cef8..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/Connector16ModelProviderFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderFactory; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class Connector16ModelProviderFactory implements IModelProviderFactory { - - public IModelProvider create(IProject project) { - return new Connector16ModelProvider(project); - } - - public IModelProvider create(IVirtualComponent component) { - return new Connector16ModelProvider(component.getProject()); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProvider.java deleted file mode 100644 index 46f938ba4..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProvider.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.j2ee.application.WebModule; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.model.IEARModelProvider; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.javaee.application.Application; -import org.eclipse.jst.javaee.application.ApplicationDeploymentDescriptor; -import org.eclipse.jst.javaee.application.ApplicationFactory; -import org.eclipse.jst.javaee.application.IApplicationResource; -import org.eclipse.jst.javaee.application.Module; -import org.eclipse.jst.javaee.core.DisplayName; -import org.eclipse.jst.javaee.core.JavaeeFactory; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; - -public class EAR5ModelProvider extends JEE5ModelProvider implements IEARModelProvider { - - private static final String EAR5_CONTENT_TYPE = "org.eclipse.jst.jee.ee5earDD"; //$NON-NLS-1$ - public EAR5ModelProvider(IProject proj) { - super(); - this.proj = proj; - setDefaultResourcePath(new Path(J2EEConstants.APPLICATION_DD_URI)); - } - @Override - protected String getContentTypeDescriber() { - return EAR5_CONTENT_TYPE; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.model.IModelProvider#getModelObject(org.eclipse.core.runtime.IPath) - */ - @Override - public Object getModelObject(IPath modelPath) { - IApplicationResource earRes = (IApplicationResource)getModelResource(modelPath); - if (earRes != null && earRes.getRootObject() != null) - return earRes.getApplication(); - return null; - } - - public String getModuleURI(IVirtualComponent moduleComp) { - IVirtualComponent comp = ComponentCore.createComponent(proj); - IVirtualReference [] refs = comp.getReferences(); - for(int i=0; i<refs.length; i++){ - if(refs[i].getDependencyType() == IVirtualReference.DEPENDENCY_TYPE_USES){ - if(refs[i].getReferencedComponent().equals(moduleComp)){ - return refs[i].getArchiveName(); - } - } - } - return null; - } - /** - * This method will return the context root in this application for the passed in web project. - * - * @param webProject - * @return contextRoot String - */ - public String getWebContextRoot(IProject webProject) { - if (webProject == null || !JavaEEProjectUtilities.isDynamicWebProject(webProject)) - return null; - IVirtualComponent webComp = ComponentCore.createComponent(webProject); - String webModuleURI = getModuleURI(webComp); - if (webModuleURI != null) { - Module webModule = ((Application)getModelObject()).getModule(webModuleURI, null); - if (webModule != null) - return webModule.getWeb().getContextRoot(); - } - return null; - } - @Override - public void populateRoot(XMLResourceImpl res, String name) { - ApplicationDeploymentDescriptor dd = ApplicationFactory.eINSTANCE.createApplicationDeploymentDescriptor(); - dd.getXMLNSPrefixMap().put("", J2EEConstants.JAVAEE_NS_URL); //$NON-NLS-1$ - dd.getXMLNSPrefixMap().put("xsi", J2EEConstants.XSI_NS_URL); //$NON-NLS-1$ - - Application ear = ApplicationFactory.eINSTANCE.createApplication(); - DisplayName dn = JavaeeFactory.eINSTANCE.createDisplayName(); - dn.setValue(name); - ear.getDisplayNames().add(dn); - - String version = J2EEProjectUtilities.getJ2EEProjectVersion(proj); - if(version != null && version.equals(J2EEVersionConstants.VERSION_5_0_TEXT)) { - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.APPLICATION_SCHEMA_LOC_5); - ear.setVersion(J2EEVersionConstants.VERSION_5_TEXT); - } - else { - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.APPLICATION_SCHEMA_LOC_6); - ear.setVersion(J2EEVersionConstants.VERSION_6_TEXT); - } - - dd.setApplication(ear); - res.getContents().add((EObject) dd); - } - - /** - * This method will set the context root on the application for the passed in contextRoot. - * - * @param webProject - * @param aContextRoot - */ - public void setWebContextRoot(IProject webProject, String aContextRoot) { - if (webProject == null || !JavaEEProjectUtilities.isDynamicWebProject(webProject)) - return; - IVirtualComponent webComp = ComponentCore.createComponent(webProject); - String webModuleURI = getModuleURI(webComp); - if (webModuleURI != null) { - WebModule webModule = (WebModule) ((Application)getModelObject()).getModule(webModuleURI, null); - if (webModule != null) - webModule.setContextRoot(aContextRoot); - // TODO - should this method save? Or should the caller be required to save? - } - } -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProviderFactory.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProviderFactory.java deleted file mode 100644 index c36483017..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProviderFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderFactory; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class EAR5ModelProviderFactory implements IModelProviderFactory { - - public IModelProvider create(IProject project) { - return new EAR5ModelProvider(project); - } - - public IModelProvider create(IVirtualComponent component) { - return new EAR5ModelProvider(component.getProject()); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java deleted file mode 100644 index 199fd7d45..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java +++ /dev/null @@ -1,526 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jee.model.internal; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jem.util.emf.workbench.FlexibleProjectResourceSet; -import org.eclipse.jem.util.emf.workbench.ProjectResourceSet; -import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase; -import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderEvent; -import org.eclipse.jst.j2ee.model.IModelProviderListener; -import org.eclipse.jst.j2ee.model.ModelProviderEvent; -import org.eclipse.jst.javaee.core.internal.util.JavaeeResourceImpl; -import org.eclipse.jst.jee.JEEPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil; -import org.eclipse.wst.common.componentcore.internal.impl.PlatformURLModuleConnection; -import org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateInputProvider; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidator; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorImpl; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter; - -public class JEE5ModelProvider implements IModelProvider, ResourceStateInputProvider, ResourceStateValidator, IModelProviderListener{ - - protected XMLResourceImpl writableResource; - protected IProject proj; - protected IPath defaultResourcePath; - protected ResourceStateValidator stateValidator; - protected ResourceAdapter resourceAdapter = new ResourceAdapter(); - protected final ListenerList listeners = new ListenerList(); - //private static boolean resourceChangeListenerEnabled = false; - - private List modelResources = new ArrayList(); - protected class ResourceAdapter extends AdapterImpl { - @Override - public void notifyChanged(Notification notification) { - if (notification.getEventType() == Notification.SET - && notification.getFeatureID(null) == Resource.RESOURCE__IS_LOADED) { - resourceIsLoadedChanged((Resource) notification.getNotifier(), notification.getOldBooleanValue(), notification.getNewBooleanValue()); - } else if (notification.getFeatureID(null) == Resource.RESOURCE__IS_MODIFIED) - resourceChanged((Resource) notification.getNotifier()); - } - @Override - public boolean equals(Object arg0) { - - return this.getClass().equals(arg0.getClass()); - } - - @Override - public int hashCode() { - - return getClass().hashCode(); - } - } - - public JEE5ModelProvider() { - super(); - } - - protected ProjectResourceSet getResourceSet(IProject proj2) { - return (ProjectResourceSet)WorkbenchResourceHelperBase.getResourceSet(proj); - } - - public XMLResourceImpl getWritableResource() { - return writableResource; - } - - public void setWritableResource(XMLResourceImpl writableResource) { - this.writableResource = writableResource; - } - - protected void resourceChanged(Resource aResource) { - if (hasListeners()) { - int eventCode = ModelProviderEvent.KNOWN_RESOURCES_CHANGED; - ModelProviderEvent evt = new ModelProviderEvent(eventCode, this, proj); - evt.addResource(aResource); - notifyListeners(evt); - } - } - - protected void resourceIsLoadedChanged(Resource aResource, boolean oldValue, boolean newValue) { - if (hasListeners()) { - int eventCode = newValue ? ModelProviderEvent.LOADED_RESOURCE : ModelProviderEvent.UNLOADED_RESOURCE; - ModelProviderEvent evt = new ModelProviderEvent(eventCode, this, proj); - evt.addResource(aResource); - notifyListeners(evt); - } - } - private void addManagedResource(XMLResourceImpl res) { - modelResources.add(res); - if (!res.eAdapters().contains(resourceAdapter)) - res.eAdapters().add(resourceAdapter); - } - /** - * Returns true if there are any listeners - */ - public boolean hasListeners() { - return !listeners.isEmpty(); - } - - private URI getModuleURI(URI uri) { - URI moduleuri = ModuleURIUtil.fullyQualifyURI(proj,getContentTypeDescriber()); - IPath requestPath = new Path(moduleuri.path()).append(new Path(uri.path())); - URI resourceURI = URI.createURI(PlatformURLModuleConnection.MODULE_PROTOCOL + requestPath.toString()); - return resourceURI; - } - - protected XMLResourceImpl getModelResource(final IPath modelPath) { - if(proj == null || !proj.isAccessible()){ - throw new IllegalStateException("The project <" + proj + "> is not accessible."); //$NON-NLS-1$//$NON-NLS-2$ - } - if (writableResource != null) { - addManagedResource(writableResource); - return writableResource; - } - IPath innerModelPath = modelPath; - if ((innerModelPath == null) || innerModelPath.equals(IModelProvider.FORCESAVE)) - innerModelPath = getDefaultResourcePath(); - ProjectResourceSet resSet = getResourceSet(proj); - IVirtualFolder container = ComponentCore.createComponent(proj).getRootFolder(); - String modelPathURI = innerModelPath.toString(); - URI uri = URI.createURI(modelPathURI); - - IPath projURIPath = new Path("");//$NON-NLS-1$ - projURIPath = projURIPath.append(container.getProjectRelativePath()); - projURIPath = projURIPath.addTrailingSeparator(); - projURIPath = projURIPath.append(innerModelPath); - URI projURI = URI.createURI(projURIPath.toString()); - XMLResourceImpl res = null; - try { - if (proj.getFile(projURI.toString()).exists()) - { - res = (XMLResourceImpl) resSet.getResource(getModuleURI(uri),true); - addManagedResource(res); - } else {//First find in resource set, then create if not found new Empty Resource. - XMLResourceImpl newRes = createModelResource(innerModelPath, resSet, projURI); - addManagedResource(newRes); - return newRes; - } - } catch (WrappedException ex) { - if (ex.getCause() instanceof FileNotFoundException) - return null; - throw ex; - } - return res; - } - - - protected XMLResourceImpl createModelResource(IPath modelPath, ProjectResourceSet resourceSet, URI uri) { - // First try to find existing cached resource. - XMLResourceImpl res = (XMLResourceImpl)resourceSet.getResource(getModuleURI(uri), false); - if (res == null || !res.isLoaded()) { - // Create temp resource if no file exists - res= (XMLResourceImpl)((FlexibleProjectResourceSet)resourceSet).createResource(getModuleURI(uri),WTPResourceFactoryRegistry.INSTANCE.getFactory(uri, getContentType(getContentTypeDescriber()))); - populateRoot(res, resourceSet.getProject().getName()); - } - return res; - } - - public void populateRoot(XMLResourceImpl res, String string) { - } - - private IContentDescription getContentType(String contentTypeDescriber) { - if (contentTypeDescriber != null) - return Platform.getContentTypeManager().getContentType(contentTypeDescriber).getDefaultDescription(); - return null; - } - - public IPath getDefaultResourcePath() { - return defaultResourcePath; - } - - public void setDefaultResourcePath(IPath defaultResourcePath) { - this.defaultResourcePath = defaultResourcePath; - } - - public Object getModelObject() { - return getModelObject(getDefaultResourcePath()); - } - - public Object getModelObject(IPath modelPath) { - return null; - } - - /** - * Used to optionally define an associated content type for XML file creation - * @return - */ - protected String getContentTypeDescriber() { - - return null; - } - - - - public IStatus validateEdit(final IPath modelPath, final Object context) { - IPath innaerModelPath = modelPath; - Object innerContext = context; - if (innaerModelPath == null) - innaerModelPath = getDefaultResourcePath(); - IWorkspace work = ResourcesPlugin.getWorkspace(); - IFile file = WorkbenchResourceHelper.getFile(getModelResource(innaerModelPath)); - if (file != null && file.exists()) { - IFile[] files = { file }; - if (innerContext == null) - innerContext = IWorkspace.VALIDATE_PROMPT; - return work.validateEdit(files, innerContext); - } - return Status.OK_STATUS; - } - - public void modify(Runnable runnable, IPath modelPath) { - //About to modify and save this model - try { - JavaeeResourceImpl res = (JavaeeResourceImpl)getModelResource(modelPath); - if (res != null) - setWritableResource(res); - runnable.run(); - try { - if (res != null) { - if (modelPath != null && modelPath.equals(IModelProvider.FORCESAVE)) - res.save(Collections.EMPTY_MAP,true); - else - res.save(Collections.EMPTY_MAP); - } - } catch (IOException e) { - JEEPlugin.logError(e); - } - } catch (Exception ex) { - JEEPlugin.logError(ex); - } finally { - setWritableResource(null); - } - - } - -// private class ResourceChangeListener implements IResourceChangeListener { -// public void resourceChanged(IResourceChangeEvent event) { -// IResourceDelta delta= event.getDelta(); -// // make sure that there is a delta (since some events don't have one) -// if (delta != null) -// { -// IResourceDelta[] affectedChildren= delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED , IResource.FILE); -// IResourceDelta projectDelta = null; -// IResource changedResource = null; -// IProject changedProject = null; -// IPath resourcePath = null; -// -// for (int i= 0; i < affectedChildren.length; i++) { -// projectDelta = affectedChildren[i]; -// changedResource = projectDelta.getResource(); -// changedProject = changedResource.getProject(); -// HashSet<IPath> currentResources = modelResources.get(changedProject); -// // only deal with the projects that have resources that have been loaded -// if (currentResources != null) -// { -// // if this is a project deletion, remove the project from the HashMap. -// if (changedResource == changedProject && projectDelta.getKind() == IResourceDelta.REMOVED) -// { -// modelResources.remove(changedProject); -// // if modelResources is empty, we should self-destruct -// if (modelResources.isEmpty()) -// { -// resourceChangeListenerEnabled = false; -// ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); -// } -// } -// else -// { -// Iterator<IPath> iter = currentResources.iterator(); -// ArrayList<IPath> toUnload = new ArrayList<IPath>(); -// // check each resource that was loaded from the project to see if it is part of the change -// while (iter.hasNext()) -// { -// resourcePath = iter.next(); -// if (projectDelta.findMember(resourcePath) != null) -// { -// // limit the list of resources that need to be unloaded to those that have changed -// toUnload.add(resourcePath); -// } -// } -// if (toUnload.size() > 0) -// { -// Resource current = null; -// ProjectResourceSet resourceSet = getResourceSet(changedProject); -// URIConverter uriConverter = resourceSet.getURIConverter(); -// HashSet<URI> resourceURIs = new HashSet<URI>(); -// iter = toUnload.iterator(); -// while (iter.hasNext()) -// { -// // convert all of the resources to URIs - this is a faster match during the compare -// resourceURIs.add(uriConverter.normalize(URI.createURI(iter.next().toString()))); -// } -// Iterator<Resource> iter2 = resourceSet.getResources().iterator(); -// while (iter2.hasNext()) -// { -// current = iter2.next(); -// if (resourceURIs.contains(current.getURI())) -// { -// current.unload(); -// } -// } -// } -// } -// } -// } -// } -// } -// } - - public void addListener(IModelProviderListener listener) { - - listeners.add(listener); - } - - public void removeListener(IModelProviderListener listener) - { - listeners.remove(listener); - } - /** - * Save only resources that need to be saved (i.e., no other references). - */ - public void modelsChanged(IModelProviderEvent anEvent) { - int code = anEvent.getEventCode(); - switch (code) { - case IModelProviderEvent.REMOVED_RESOURCE : { - if (hasResourceReference(anEvent.getChangedResources())) - removeResources(anEvent.getChangedResources()); - else - return; - break; - } - } - if (hasListeners()) { - anEvent.setModel(this); - notifyListeners(anEvent); - } - } - protected void removeResources(List aList) { - Resource res; - for (int i = 0; i < aList.size(); i++) { - res = (Resource) aList.get(i); - removeResource(res) ; - } - } - /** - * Remove reference to the aResource. - */ - protected boolean removeResource(Resource aResource) { - if (aResource != null) { - aResource.eAdapters().remove(resourceAdapter); - return getResources().remove(aResource); - } - return false; - } - - /** - * Return true if any Resource in the list of - * - * @resources is referenced by me. - */ - protected boolean hasResourceReference(List tResources) { - for (int i = 0; i < tResources.size(); i++) { - if (hasResourceReference((Resource) tResources.get(i))) - return true; - } - return false; - } - /** - * Return true if aResource is referenced by me. - */ - protected boolean hasResourceReference(Resource aResource) { - if (aResource != null) - return getResources().contains(aResource); - return false; - } - - /** - * Notify listeners of - * - * @anEvent. - */ - protected void notifyListeners(IModelProviderEvent anEvent) { - - NotifyRunner notifier = new NotifyRunner(anEvent); - - Object[] notifyList = listeners.getListeners(); - for (int i = 0; i < notifyList.length; i++) { - notifier.setListener( (IModelProviderListener) notifyList[i] ); - SafeRunner.run(notifier); - } - } - public class NotifyRunner implements ISafeRunnable { - - private final IModelProviderEvent event; - private IModelProviderListener listener; - - public NotifyRunner(IModelProviderEvent event) { - Assert.isNotNull(event); - this.event = event; - } - - - public void setListener(IModelProviderListener listener) { - this.listener = listener; - } - - public void handleException(Throwable exception) { - JEEPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JEEPlugin.PLUGIN_ID, 0, exception.getMessage(), exception)); - - } - - public void run() throws Exception { - if(listener != null) - listener.modelsChanged(event); - } - - } - public ResourceStateValidator getStateValidator() { - if (stateValidator == null) - stateValidator = createStateValidator(); - return stateValidator; - } - - /** - * Method createStateValidator. - * - * @return ResourceStateValidator - */ - private ResourceStateValidator createStateValidator() { - return new ResourceStateValidatorImpl(this); - } - - protected EnterpriseArtifactEdit createArtifactEdit() { - return null; - } - - public void checkActivation(ResourceStateValidatorPresenter presenter) throws CoreException { - getStateValidator().checkActivation(presenter); - - } - - public boolean checkReadOnly() { - return getStateValidator().checkReadOnly(); - } - - public boolean checkSave(ResourceStateValidatorPresenter presenter) throws CoreException { - return getStateValidator().checkSave(presenter); - } - - public void lostActivation(ResourceStateValidatorPresenter presenter) throws CoreException { - getStateValidator().lostActivation(presenter); - - } - - public IStatus validateState(ResourceStateValidatorPresenter presenter) throws CoreException { - if (presenter == null) - return Status.OK_STATUS; - return getStateValidator().validateState(presenter); - } - - public void cacheNonResourceValidateState(List roNonResourceFiles) { - // do nothing - } - - public List getNonResourceFiles() { - return null; - } - - public List getNonResourceInconsistentFiles() { - return null; - } - - public List getResources() { - return modelResources; - } - - - public boolean isDirty() { - - List list = getResources(); - for (int i = 0; i < list.size(); i++) { - if (((Resource) list.get(i)).isModified()) - return true; - } - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index c398d896a..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class AppClientCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IWebCreateDeploymentFilesDataModelProperties { - @Override - public IDataModelOperation getDefaultOperation() { - return new AppClientCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesOperation.java deleted file mode 100644 index 373d4adcd..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class AppClientCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public AppClientCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - @Override - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - provider.modify(new Runnable(){ - public void run() { - } - }, IModelProvider.FORCESAVE); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ConnectorCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ConnectorCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index b1e68e1c0..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ConnectorCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class ConnectorCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider { - @Override - public IDataModelOperation getDefaultOperation() { - return new ConnectorCreateDeploymentFilesFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ConnectorCreateDeploymentFilesFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ConnectorCreateDeploymentFilesFilesOperation.java deleted file mode 100644 index 9745d05d2..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ConnectorCreateDeploymentFilesFilesOperation.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.jee.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class ConnectorCreateDeploymentFilesFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public ConnectorCreateDeploymentFilesFilesOperation(IDataModel model) { - super(model); - } - - @Override - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - provider.modify(new Runnable(){ - public void run() { - } - }, IModelProvider.FORCESAVE); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelOperation.java deleted file mode 100644 index 60e2b17b5..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelOperation.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class CreateDeploymentFilesDataModelOperation extends - AbstractDataModelOperation { - - public CreateDeploymentFilesDataModelOperation(IDataModel model) { - super(model); - } - - @Override - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - IProject targetProject = (IProject) model.getProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT); - createDeploymentFiles(targetProject, monitor); - return OK_STATUS; - } - - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - // do nothing - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index 225deaa82..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import java.util.Set; - -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class CreateDeploymentFilesDataModelProvider extends - AbstractDataModelProvider implements ICreateDeploymentFilesDataModelProperties { - - @Override - public Object getDefaultProperty(String propertyName) { - if(ICreateDeploymentFilesDataModelProperties.GENERATE_DD.equals(propertyName)){ - return true; - } - return super.getDefaultProperty(propertyName); - } - - @Override - public Set getPropertyNames() { - Set propertyNames = super.getPropertyNames(); - propertyNames.add(GENERATE_DD); - propertyNames.add(TARGET_PROJECT); - return propertyNames; - } - @Override - public IDataModelOperation getDefaultOperation() { - return new CreateDeploymentFilesDataModelOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index 9c7e8f788..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class EJBCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IEJBCreateDeploymentFilesDataModelProperties { - @Override - public IDataModelOperation getDefaultOperation() { - return new EJBCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesOperation.java deleted file mode 100644 index bc8e1c22f..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class EJBCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public EJBCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - @Override - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - provider.modify(new Runnable(){ - public void run() { - } - }, IModelProvider.FORCESAVE); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index 9ec86833c..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class EarCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IEarCreateDeploymentFilesDataModelProperties { - @Override - public IDataModelOperation getDefaultOperation() { - return new EarCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesOperation.java deleted file mode 100644 index 18ac26945..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.jee.JEEPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class EarCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public EarCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - @Override - protected void createDeploymentFiles(IProject project, final IProgressMonitor monitor) { - final IVirtualComponent component = ComponentCore.createComponent(project); - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - provider.modify(new Runnable(){ - public void run() { - IVirtualReference[] componentReferences = J2EEProjectUtilities.getJ2EEModuleReferences(component); - if(componentReferences != null && componentReferences.length > 0){ - final IDataModel dataModel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider()); - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, component); - Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>(); - for(int i = 0; i < componentReferences.length; i++) { - IVirtualComponent referencedComponent = componentReferences[i].getReferencedComponent(); - if (componentReferences[i].getRuntimePath().toString().equals("/")){ //$NON-NLS-1$ - uriMap.put(referencedComponent, componentReferences[i].getArchiveName()); - } else { - uriMap.put(referencedComponent, componentReferences[i].getRuntimePath().append((new Path(componentReferences[i].getArchiveName())).lastSegment()).toString()); - } - } - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap); - try { - dataModel.getDefaultOperation().execute(monitor, null); - } catch (ExecutionException e) { - JEEPlugin.logError(e); - } - } - } - }, IModelProvider.FORCESAVE); - - - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IAppClientCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IAppClientCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 6ed3be670..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IAppClientCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IAppClientCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = AppClientCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IConnectorCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IConnectorCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 0fae47727..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IConnectorCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.jee.project.facet; - -public interface IConnectorCreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = ConnectorCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ICreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ICreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index dd3ab5ff4..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ICreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties; - -public interface ICreateDeploymentFilesDataModelProperties extends - IDataModelProperties { - - public static final String TARGET_PROJECT = "ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT"; //$NON-NLS-1$ - /** - * boolean property for Java EE 5 projects, to create/not create a deployment descriptor, - * The default value is false - */ - public static final String GENERATE_DD = "ICreateDeploymentFilesDataModelProperties.GENERATE_DD"; //$NON-NLS-1$ - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEJBCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEJBCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 72d50e2fa..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEJBCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IEJBCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = EJBCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEarCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEarCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 5f1d59b69..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEarCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IEarCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = EarCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IWebCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IWebCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 243337685..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IWebCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IWebCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = WebCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/JEEFacetInstallDelegate.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/JEEFacetInstallDelegate.java deleted file mode 100644 index 54cc129a8..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/JEEFacetInstallDelegate.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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.jee.project.facet; - -import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDelegate; - -public abstract class JEEFacetInstallDelegate extends J2EEFacetInstallDelegate { - // this class used to have methods but now due to refactoring/model support it does not. -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index 15c93e4b9..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class WebCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IWebCreateDeploymentFilesDataModelProperties { - @Override - public IDataModelOperation getDefaultOperation() { - return new WebCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesOperation.java deleted file mode 100644 index 08e6747ce..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.javaee.web.WebFactory; -import org.eclipse.jst.javaee.web.WelcomeFileList; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class WebCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public WebCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - @Override - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - - provider.modify(new Runnable(){ - public void run() { - WebApp webApp = (WebApp) provider.getModelObject(); - - // welcome file list - List<String> welcomeFiles = Arrays.asList( - "index.html", //$NON-NLS-1$ - "index.htm", //$NON-NLS-1$ - "index.jsp", //$NON-NLS-1$ - "default.html", //$NON-NLS-1$ - "default.htm", //$NON-NLS-1$ - "default.jsp" //$NON-NLS-1$ - ); - - // Add the welcome-file-list tag - WelcomeFileList welcomeFileList = WebFactory.eINSTANCE.createWelcomeFileList(); - welcomeFileList.getWelcomeFiles().addAll(welcomeFiles); - webApp.getWelcomeFileLists().add(welcomeFileList); - } - }, IModelProvider.FORCESAVE); - - } - -} diff --git a/plugins/org.eclipse.jst.jee/license/berkeley_license.html b/plugins/org.eclipse.jst.jee/license/berkeley_license.html deleted file mode 100644 index 5f2e66fc1..000000000 --- a/plugins/org.eclipse.jst.jee/license/berkeley_license.html +++ /dev/null @@ -1,45 +0,0 @@ -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> -<title>License</title> -</head> - -<body> -<p> -<b>Copyright 1994-2006 Sun Microsystems, Inc. All Rights Reserved.</b> -</p> -<p>Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: -</p> -<ul> -<li>Redistribution of source code must retain the above copyright notice, this -list of conditions and the following disclaimer.<br><br></li> -<li>Redistribution in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution.</li> -</ul> -<p>Neither the name of Sun Microsystems, Inc. or the names of contributors may -be used to endorse or promote products derived from this software without -specific prior written permission. -</p> -<p>This software is provided "AS IS," without a warranty of any kind. -ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") -AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS -DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY -LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, -CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND -REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR -INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. -</p> -<p>You acknowledge that this software is not designed, licensed or intended -for use in the design, construction, operation or maintenance of any nuclear facility. -</p> -</body> -</html> - - - diff --git a/plugins/org.eclipse.jst.jee/plugin.properties b/plugins/org.eclipse.jst.jee/plugin.properties deleted file mode 100644 index ad17edf82..000000000 --- a/plugins/org.eclipse.jst.jee/plugin.properties +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2007 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 -############################################################################### -# properties file for org.eclipse.jst.jee -Bundle-Name.0 = Java EE common Plug-in -Bundle-Vendor.0 = Eclipse Web Tools Platform -ee5ejbContentType=Java EE 5 EJB Content -ee5webContentType=Java EE 5 Web Content -ee5earContentType=Java EE 5 EAR Content -ee5appclientContentType=Java EE 5 Application Client Content -ee6connectorContentType=Java EE 6 Connector Content -ee6ejbContentType=Java EE 6 EJB Content -ee6webContentType=Java EE 6 Web Content -ee6webfragmentContentType=Java EE 6 Web Fragment Content -ee6earContentType=Java EE 6 EAR Content -ee6appclientContentType=Java EE 6 Application Client Content
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.jee/plugin.xml b/plugins/org.eclipse.jst.jee/plugin.xml deleted file mode 100644 index f6ad99935..000000000 --- a/plugins/org.eclipse.jst.jee/plugin.xml +++ /dev/null @@ -1,349 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<plugin> - <extension-point id="jeeModelExtension" name="JEE Model Extension" schema="schema/jeeModelExtension.exsd"/> - - <!--J EE5 --> - <extension - point="org.eclipse.wst.common.modulecore.resourceFactories"> - <resourceFactory - class="org.eclipse.jst.javaee.web.internal.util.WebResourceFactoryImpl" - isDefault="false" - shortSegment="web.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee5webDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.ejb.internal.util.EjbResourceFactoryImpl" - isDefault="false" - shortSegment="ejb-jar.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee5ejbDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.applicationclient.internal.util.ApplicationclientResourceFactoryImpl" - isDefault="false" - shortSegment="application-client.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee5appclientDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.application.internal.util.ApplicationResourceFactoryImpl" - isDefault="false" - shortSegment="application.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee5earDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.jca.internal.util.JcaResourceFactoryImpl" - isDefault="false" - shortSegment="ra.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee6connectorDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.web.internal.util.WebResourceFactoryImpl" - isDefault="false" - shortSegment="web.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee6webDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.ejb.internal.util.EjbResourceFactoryImpl" - isDefault="false" - shortSegment="ejb-jar.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee6ejbDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.applicationclient.internal.util.ApplicationclientResourceFactoryImpl" - isDefault="false" - shortSegment="application-client.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee6appclientDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.application.internal.util.ApplicationResourceFactoryImpl" - isDefault="false" - shortSegment="application.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee6earDD"> - </contentTypeBinding> - </resourceFactory> - <resourceFactory - class="org.eclipse.jst.javaee.webfragment.internal.util.WebfragmentResourceFactoryImpl" - isDefault="false" - shortSegment="web-fragment.xml"> - <contentTypeBinding - contentTypeId="org.eclipse.jst.jee.ee6webfragmentDD"> - </contentTypeBinding> - </resourceFactory> - </extension> - - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee" - class="org.eclipse.jst.javaee.core.internal.metadata.JavaeePackage"> - </package> - </extension> - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" - class="org.eclipse.jst.javaee.ejb.internal.metadata.EjbPackage"> - </package> - </extension> - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee/application-client_5.xsd" - class="org.eclipse.jst.javaee.applicationclient.internal.metadata.ApplicationclientPackage"> - </package> - </extension> - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee/application_5.xsd" - class="org.eclipse.jst.javaee.application.internal.metadata.ApplicationPackage"> - </package> - </extension> - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - class="org.eclipse.jst.javaee.web.internal.metadata.WebPackage"> - </package> - </extension> - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd" - class="org.eclipse.jst.javaee.webfragment.internal.metadata.WebfragmentPackage"> - </package> - </extension> - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee/connector_1_6.xsd" - class="org.eclipse.jst.javaee.jca.internal.metadata.JcaPackage"> - </package> - </extension> - <extension - point="org.eclipse.emf.ecore.generated_package"> - <package - uri="http://java.sun.com/xml/ns/javaee/jsp" - class="org.eclipse.jst.javaee.jsp.internal.metadata.JspPackage"> - </package> - </extension> - - <extension - point="org.eclipse.wst.server.core.moduleFactories"> - <moduleFactory - projects="true" - class="org.eclipse.jst.jee.internal.deployables.JEEDeployableFactory" - id="org.eclipse.jst.jee.server"> - <moduleType - types="jst.ear" - versions="6.0,5.0"> - </moduleType> - <moduleType - types="jst.appclient" - versions="6.0,5.0,1.2,1.3,1.4"> - </moduleType> - <moduleType - types="jst.web" - versions="3.0,2.5,2.2,2.3,2.4"> - </moduleType> - <moduleType - types="jst.ejb" - versions="3.1,3.0,1.1,2.0,2.1"> - </moduleType> - <moduleType - types="jst.connector" - versions="1.0,1.5,1.6"> - </moduleType> - <moduleType - types="jst.utility" - versions="1.0"> - </moduleType> - <moduleType - types="jst.webfragment" - versions="3.0"> - </moduleType> - </moduleFactory> - </extension> - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="ejb-jar.xml" - id="ee5ejbDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee5ejbContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEEContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="ejb-jar.xml" - id="ee6ejbDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee6ejbContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEE6ContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="web.xml" - id="ee5webDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee5webContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEEContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="web.xml" - id="ee6webDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee6webContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEE6ContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="web-fragment.xml" - id="ee6webfragmentDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee6webfragmentContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEE6ContentDescriber"> - </describer> - </content-type> - </extension> - - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="application.xml" - id="ee5earDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee5earContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEEContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="application.xml" - id="ee6earDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee6earContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEE6ContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="application-client.xml" - id="ee5appclientDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee5appclientContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEEContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="application-client.xml" - id="ee6appclientDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee6appclientContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEE6ContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.core.contenttype.contentTypes"> - <content-type - file-names="ra.xml" - id="ee6connectorDD" - base-type="org.eclipse.core.runtime.xml" - name="%ee6connectorContentType" - priority="high"> - <describer - class="org.eclipse.jst.jee.contenttype.JEE6ContentDescriber"> - </describer> - </content-type> - </extension> - - <extension - point="org.eclipse.jst.j2ee.J2EEModelProvider"> - <provider> - <modelProvider factoryClass="org.eclipse.jst.jee.model.internal.EAR5ModelProviderFactory"/> - <facet id="jst.ear" versions="5.0,6.0"/> - </provider> - </extension> - - <extension - point="org.eclipse.jst.j2ee.J2EEModelProvider"> - <provider> - <modelProvider factoryClass="org.eclipse.jst.jee.model.internal.AppClient5ModelProviderFactory"/> - <facet id="jst.appclient" versions="5.0,6.0"/> - </provider> - </extension> - - <extension - point="org.eclipse.jst.j2ee.J2EEModelProvider"> - <provider> - <modelProvider factoryClass="org.eclipse.jst.jee.model.internal.Connector16ModelProviderFactory"/> - <facet id="jst.connector" versions="1.6"/> - </provider> - </extension> - -</plugin> diff --git a/plugins/org.eclipse.jst.jee/schema/jeeModelExtension.exsd b/plugins/org.eclipse.jst.jee/schema/jeeModelExtension.exsd deleted file mode 100644 index 0a6da6031..000000000 --- a/plugins/org.eclipse.jst.jee/schema/jeeModelExtension.exsd +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.jst.jee"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.jst.jee" id="jeeModelExtension" name="JEE Model Extension"/> - </appInfo> - <documentation> - [Enter description of this extension point.] - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute translatable="true"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="jeeModelExtension"> - <complexType> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - ID used to identify a model implementation of the IJEEModel interface - </documentation> - </annotation> - </attribute> - <attribute name="priority" type="string" use="required"> - <annotation> - <documentation> - Priority used to determine which implementation is active - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - -</schema> |