Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee.web/web/org/eclipse')
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java33
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java367
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java30
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java77
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java148
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AbstractSupertypesValidator.java87
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java351
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java122
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java329
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java89
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java269
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java131
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java329
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java50
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterMappingItem.java68
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterSupertypesValidator.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java597
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/IFilterMappingItem.java30
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java43
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewListenerClassDataModelProperties.java15
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java109
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java45
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java234
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java371
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassOperation.java95
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java141
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassOperation.java99
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java553
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java105
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java443
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java241
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletSupertypesValidator.java65
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java526
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java124
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java152
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java310
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java85
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java68
39 files changed, 0 insertions, 6983 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java
deleted file mode 100644
index 4dc14e23d..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Feb 8, 2005
- */
-package org.eclipse.jst.j2ee.internal.web.deployables;
-
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
-
-/**
- * @author blancett
- */
-public class ModuleAdapter extends AdapterImpl {
-
- J2EEFlexProjDeployable delegate;
-
- public void setModuleDelegate(J2EEFlexProjDeployable moduleDelegate) {
- delegate = moduleDelegate;
- }
-
- public J2EEFlexProjDeployable getDelegate() {
- return delegate;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java
deleted file mode 100644
index 1646bc17d..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.deployables;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURL;
-import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURLExtensionReader;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.webapplication.JSPType;
-import org.eclipse.jst.j2ee.webapplication.Servlet;
-import org.eclipse.jst.j2ee.webapplication.ServletMapping;
-import org.eclipse.jst.j2ee.webapplication.ServletType;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webapplication.WebType;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.util.WebResource;
-
-/**
- * @version 1.0
- * @author
- */
-public class WebDeployableArtifactUtil {
-
- private final static String GENERIC_SERVLET_CLASS_TYPE = "javax.servlet.GenericServlet"; //$NON-NLS-1$
- private final static String CACTUS_SERVLET_CLASS_TYPE = "org.apache.cactus.server.ServletTestRedirector"; //$NON-NLS-1$
-
- public WebDeployableArtifactUtil() {
- super();
- }
-
- public static IModuleArtifact getModuleObject(Object obj) {
- IResource resource = null;
- if (obj instanceof IResource)
- resource = (IResource) obj;
- if (obj instanceof IModuleArtifact)
- resource = ((IModuleArtifact) obj).getModule().getProject();
- else if (obj instanceof IAdaptable)
- resource = (IResource) ((IAdaptable) obj).getAdapter(IResource.class);
- else if (obj instanceof EObject) {
- resource = ProjectUtilities.getProject((EObject) obj);
- if (obj instanceof Servlet) {
- Servlet servlet = ((Servlet) obj);
- Resource servResource = servlet.eResource();
- IVirtualResource[] resources = null;
- try {
- IResource eclipeServResoruce = WorkbenchResourceHelper.getFile(servResource);
- resources = ComponentCore.createResources(eclipeServResoruce);
- } catch (Exception e) {
- WebPlugin.logError(e);
- }
- IVirtualComponent component = null;
- if (resources != null && resources[0] != null)
- component = resources[0].getComponent();
- String mapping = null;
- java.util.List mappings = ((Servlet) obj).getMappings();
- if (mappings != null && !mappings.isEmpty()) {
- ServletMapping map = (ServletMapping) mappings.get(0);
- mapping = map.getUrlPattern();
- }
- if (mapping != null) {
- return new WebResource(getModule(resource.getProject(), component), new Path(mapping));
- }
- WebType webType = ((Servlet) obj).getWebType();
- if (webType == null) {
- return null;
- } else if (webType.isJspType()) {
- if (component != null) {
- IPath jspFilePath = new Path(((JSPType) webType).getJspFile());
- resource = component.getRootFolder().getUnderlyingFolder().getFile(jspFilePath);
- }
- } else if (webType.isServletType()) {
- return new WebResource(getModule(resource.getProject(), component), new Path("servlet/" + ((ServletType) webType).getClassName())); //$NON-NLS-1$
- }
- }
- }
- if (resource == null)
- return null;
-
- if (resource instanceof IProject) {
- IProject project = (IProject) resource;
- if (hasInterestedComponents(project))
- return new WebResource(getModule(project, null), project.getProjectRelativePath());
- }
-
- if (!hasInterestedComponents(resource.getProject()))
- return null;
- if (isCactusJunitTest(resource))
- return null;
-
- IPath resourcePath = resource.getFullPath();
- IVirtualResource[] resources = ComponentCore.createResources(resource);
- IVirtualComponent component = null;
- if (resources.length <= 0 || resources[0] == null )
- return null;
- component = resources[0].getComponent();
- String className = getServletClassName(resource);
- if (className != null && component != null) {
- String mapping = getServletMapping(resource, true, className, component.getName());
- if (mapping != null) {
- return new WebResource(getModule(resource.getProject(), component), new Path(mapping));
- }
- // if there is no servlet mapping, provide direct access to the servlet
- // through the fully qualified class name
- return new WebResource(getModule(resource.getProject(), component), new Path("servlet/" + className)); //$NON-NLS-1$
-
- }
- if (className == null && component != null) {
- WebArtifactEdit webEdit = null;
- try {
- webEdit = WebArtifactEdit.getWebArtifactEditForRead(component);
- List servlets = webEdit.getWebApp().getServlets();
- for (int i=0; i<servlets.size(); i++) {
- Servlet servlet = (Servlet) servlets.get(i);
- WebType type = servlet.getWebType();
- if (type.isJspType()) {
- JSPType jsp = (JSPType)type;
- IPath rootPath = component.getRootFolder().getProjectRelativePath();
- IPath jspPath = resource.getProjectRelativePath().removeFirstSegments(rootPath.segmentCount());
- if (jsp.getJspFile().equals(jspPath.makeAbsolute().toString())) {
- List mappings = servlet.getMappings();
- String mapping = null;
- if (mappings != null && !mappings.isEmpty()) {
- ServletMapping map = (ServletMapping) mappings.get(0);
- mapping = map.getUrlPattern();
- if (mapping != null)
- return new WebResource(getModule(resource.getProject(), component), new Path(mapping));
- }
- }
- }
- }
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- }
- resourcePath = resources[0].getRuntimePath();
-
- // Extension read to get the correct URL for Java Server Faces file if
- // the jsp is of type jsfaces.
- FileURL jspURL = FileURLExtensionReader.getInstance().getFilesURL();
- if (jspURL != null) {
- IPath correctJSPPath = jspURL.getFileURL(resource, resourcePath);
- if (correctJSPPath != null && correctJSPPath.toString().length() > 0)
- return new WebResource(getModule(resource.getProject(), component), correctJSPPath);
- }
- // return Web resource type
-
- return new WebResource(getModule(resource.getProject(), component), resourcePath);
- }
-
- protected static IModule getModule(IProject project, IVirtualComponent component) {
- String componentName = null;
- if (component != null)
- componentName = component.getName();
-
- // check for jst.web modules first
- IModule[] modules = ServerUtil.getModules(IJ2EEFacetConstants.DYNAMIC_WEB);
- for (IModule module : modules) {
- if ((project == null || project.equals(module.getProject()))
- && (componentName == null || componentName.equals(module.getName())))
- return module;
- }
-
- // otherwise fall back to other types of web modules on the project
- if (project != null) {
- modules = ServerUtil.getModules(project);
- for (IModule module : modules) {
- if (componentName == null || componentName.equals(module.getName()))
- return module;
- }
- }
- return null;
- }
-
- /**
- * @deprecated - see getModule() for better logic for finding a project's IModule
- */
- protected static IModule getModuleProject(IProject project, Iterator iterator) {
- IModule deployable = null;
- while (iterator.hasNext()) {
- Object next = iterator.next();
- if (next instanceof IModule) {
- deployable = (IModule) next;
- if (deployable.getProject().equals(project))
- return deployable;
- }
- }
- return null;
- }
-
- /**
- *
- * Very temporary api - TODO - rip this out by 1.0
- */
- private static boolean isCactusJunitTest(IResource resource) {
- return getClassNameForType(resource, CACTUS_SERVLET_CLASS_TYPE) != null;
- }
-
-
-
- private static IType[] getTypes(IJavaElement element) {
- try {
- if (element.getElementType() != IJavaElement.COMPILATION_UNIT)
- return null;
-
- return ((ICompilationUnit) element).getAllTypes();
- } catch (Exception e) {
- return null;
- }
- }
-
- public static String getServletClassName(IResource resource) {
- return getClassNameForType(resource, GENERIC_SERVLET_CLASS_TYPE);
- }
-
- public static String getClassNameForType(IResource resource, String superType) {
- if (resource == null)
- return null;
-
- try {
- IProject project = resource.getProject();
- IPath path = resource.getFullPath();
- if (!project.hasNature(JavaCore.NATURE_ID) || path == null)
- return null;
-
- IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
- if (!javaProject.isOpen())
- javaProject.open(new NullProgressMonitor());
-
- // output location may not be on classpath
- IPath outputPath = javaProject.getOutputLocation();
- if (outputPath != null && "class".equals(path.getFileExtension()) && outputPath.isPrefixOf(path)) { //$NON-NLS-1$
- int count = outputPath.segmentCount();
- path = path.removeFirstSegments(count);
- }
-
- // remove initial part of classpath
- IClasspathEntry[] classPathEntry = javaProject.getResolvedClasspath(true);
- if (classPathEntry != null) {
- int size = classPathEntry.length;
- for (int i = 0; i < size; i++) {
- IPath classPath = classPathEntry[i].getPath();
- if (classPath.isPrefixOf(path)) {
- int count = classPath.segmentCount();
- path = path.removeFirstSegments(count);
- i += size;
- }
- }
- }
-
- // get java element
- IJavaElement javaElement = javaProject.findElement(path);
-
- IType[] types = getTypes(javaElement);
- if (types != null) {
- int size2 = types.length;
- for (int i = 0; i < size2; i++) {
- if (hasSuperclass(types[i], superType))
- return types[i].getFullyQualifiedName();
- }
- }
- return null;
- } catch (Exception e) {
- return null;
- }
- }
-
- public static boolean hasSuperclass(IType type, String superClassName) {
- try {
- ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null);
- IType[] superClasses = hierarchy.getAllSuperclasses(type);
-
- int size = superClasses.length;
- for (int i = 0; i < size; i++) {
- if (superClassName.equals(superClasses[i].getFullyQualifiedName()))
- return true;
- }
- return false;
- } catch (Exception e) {
- return false;
- }
- }
-
- public static String getServletMapping(IResource resource, boolean isServlet, String typeName, String componentName) {
- if (typeName == null || typeName.equals("")) //$NON-NLS-1$
- return null;
-
- IProject project = resource.getProject();
- WebArtifactEdit edit = null;
- WebApp webApp = null;
- try {
- edit = WebArtifactEdit.getWebArtifactEditForRead(project);
- edit.getDeploymentDescriptorRoot();
- webApp = edit.getWebApp();
- if (webApp == null)
- return null;
- Iterator iterator = webApp.getServlets().iterator();
- while (iterator.hasNext()) {
- Servlet servlet = (Servlet) iterator.next();
- boolean valid = false;
-
- WebType webType = servlet.getWebType();
- if (webType.isServletType() && isServlet) {
- ServletType type = (ServletType) webType;
- if (typeName.equals(type.getClassName()))
- valid = true;
- } else if (webType.isJspType() && !isServlet) {
- JSPType type = (JSPType) webType;
- if (typeName.equals(type.getJspFile()))
- valid = true;
- }
- if (valid) {
- java.util.List mappings = servlet.getMappings();
- if (mappings != null && !mappings.isEmpty()) {
- ServletMapping map = (ServletMapping) mappings.get(0);
- return map.getUrlPattern();
- }
- }
- }
- return null;
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- protected static boolean hasInterestedComponents(IProject project) {
- return JavaEEProjectUtilities.isDynamicWebProject(project);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java
deleted file mode 100644
index 80d9381af..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Feb 21, 2005
- */
-package org.eclipse.jst.j2ee.internal.web.deployables;
-
-/**
- * Key Class for adapter manager
- */
-public class WebModuleArtifact {
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java
deleted file mode 100644
index 325dcb75e..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 13, 2004
- */
-package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-
-/**
- * @author vijayb
- */
-public interface FileURL {
-
- /**
- * @return The existingURL if no suitable extender is found, else the
- * path corresponding to the passed in resource.
- */
- public IPath getFileURL(IResource resource, IPath existingURL);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java
deleted file mode 100644
index 05575af41..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 13, 2004
- */
-package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-
-/**
- * @author vijayb
- */
-public class FileURLExtension {
- private String id = null;
- private FileURL instance;
- private boolean errorCondition = false;
- private IConfigurationElement element;
- public static final String FILE_URL_EXTENSION = "fileURL"; //$NON-NLS-1$
- public static final String RUN = "run"; //$NON-NLS-1$
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
-
-
- /**
- *
- */
- public FileURLExtension() {
- super();
- }
-
- public FileURL getInstance() {
- try {
- if (this.instance == null && !this.errorCondition)
- this.instance = (FileURL) this.element.createExecutableExtension("run"); //$NON-NLS-1$
- } catch (Throwable e) {
- WebPlugin.logError(e);
- this.errorCondition = true;
- }
- return this.instance;
- }
-
- public FileURLExtension(IConfigurationElement element) {
- if (!FILE_URL_EXTENSION.equals(element.getName()))
- throw new IllegalArgumentException("Extensions must be of the type \"" + FILE_URL_EXTENSION + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
- this.element = element;
- init();
- }
-
- private void init() {
- this.id = this.element.getAttribute(ATT_ID);
-
- }
-
- /**
- * @return Returns the id.
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * @param id
- * The id to set.
- */
- public void setId(String id) {
- this.id = id;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java
deleted file mode 100644
index ac29b3be1..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 13, 2004
- */
-package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.common.core.util.RegistryReader;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-
-/**
- * @author vijayb
- *
- * This class loads all the extensions that define the correct URL string for the Java Server Faces
- * file
- *
- *
- */
-public class FileURLExtensionReader extends RegistryReader {
- static FileURLExtensionReader instance = null;
- protected List fileURLExtensions;
-
- /**
- * @param registry
- * @param pluginID
- * @param extensionPoint
- */
- public FileURLExtensionReader() {
- super(WebPlugin.PLUGIN_ID, "fileURL"); //$NON-NLS-1$
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- @Override
- public boolean readElement(IConfigurationElement element) {
- if (FileURLExtension.FILE_URL_EXTENSION.equals(element.getName())) {
- addExtension(element);
- return true;
- }
- return false;
- }
-
- /**
- * Sets the extension point.
- *
- * @param extensions
- * The extensions to set
- */
- protected void addExtension(IConfigurationElement newExtension) {
- getFileURLExtensions().add(new FileURLExtension(newExtension));
- }
-
- /**
- * Sets the extension point.
- *
- * @param extensions
- * The extensions to set
- */
- protected void addExtensionPoint(FileURLExtensionReader newExtension) {
- if (this.fileURLExtensions == null)
- this.fileURLExtensions = new ArrayList();
- this.fileURLExtensions.add(newExtension);
- }
-
- /**
- * @return the appropriate handler for the project based on priorities of those which are
- * available and enabled
- */
- public FileURL getFilesURL() {
- FileURLExtension fileURLExt;
- ArrayList<FileURL> fileUrlList = new ArrayList<FileURL>();
- FileURL currentURL = null;
- for (Iterator fileURLExtItr = getFileURLExtensions().iterator(); fileURLExtItr.hasNext();) {
- fileURLExt = (FileURLExtension) fileURLExtItr.next();
- currentURL = fileURLExt.getInstance();
- if (currentURL != null)
- fileUrlList.add(currentURL);
- }
- if (fileUrlList.size() == 1)
- return fileUrlList.get(0);
- return new FileURLWrapper(fileUrlList);
- }
-
-
-
- private class FileURLWrapper implements FileURL {
- ArrayList<FileURL> myUrlList = new ArrayList<FileURL>();
- public FileURLWrapper(ArrayList<FileURL> newUrlList)
- {
- myUrlList = newUrlList;
- }
- public IPath getFileURL(IResource resource, IPath existingURL) {
- IPath retVal = existingURL;
- for (FileURL fileUrl: myUrlList){
- retVal = fileUrl.getFileURL(resource, existingURL);
- if (retVal != existingURL && retVal != null)
- {
- return retVal;
- }
- }
- return retVal;
- }
- }
-
-
- /**
- * Gets the instance.
- *
- * @return Returns a FileURLExtensionReader
- */
- public static FileURLExtensionReader getInstance() {
- if (instance == null) {
- instance = new FileURLExtensionReader();
- instance.readRegistry();
- }
- return instance;
- }
-
- /**
- * @return Returns the handlerExtensions.
- */
- protected List getFileURLExtensions() {
- if (this.fileURLExtensions == null)
- this.fileURLExtensions = new ArrayList();
- return this.fileURLExtensions;
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AbstractSupertypesValidator.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AbstractSupertypesValidator.java
deleted file mode 100644
index 6f1cce40f..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AbstractSupertypesValidator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.PROJECT;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class AbstractSupertypesValidator {
-
- private static ITypeHierarchy typeHierarchyCache = null;
-
- protected static String getSuperclass(IDataModel dataModel) {
- return dataModel.getStringProperty(SUPERCLASS);
- }
-
- protected static List getInterfaces(IDataModel dataModel) {
- return (List) dataModel.getProperty(INTERFACES);
- }
-
- protected static IJavaProject getJavaProject(IDataModel dataModel) {
- return JavaCore.create((IProject) dataModel.getProperty(PROJECT));
- }
-
- protected static boolean hasSuperclass(IDataModel dataModel,
- String typeName, String superTypeName) {
- try {
- IType type = getJavaProject(dataModel).findType(typeName);
- if (type != null) {
- ITypeHierarchy typeHierarchy = getTypeHierarchy(type);
- for (IType superType : typeHierarchy.getAllSuperclasses(type)) {
- if (superTypeName.equals(superType.getFullyQualifiedName()))
- return true;
- }
- }
- } catch (JavaModelException e) {
- WebPlugin.log(e);
- }
-
- return false;
- }
-
- protected static boolean hasSuperInterface(IDataModel dataModel,
- String typeName, String superTypeName) {
- try {
- IType type = getJavaProject(dataModel).findType(typeName);
- if (type != null) {
- ITypeHierarchy typeHierarchy = getTypeHierarchy(type);
- for (IType superType : typeHierarchy.getAllSuperInterfaces(type)) {
- if (superTypeName.equals(superType.getFullyQualifiedName()))
- return true;
- }
- }
- } catch (JavaModelException e) {
- WebPlugin.log(e);
- }
-
- return false;
- }
-
- private static ITypeHierarchy getTypeHierarchy(IType type) throws JavaModelException {
- if (typeHierarchyCache == null || !type.equals(typeHierarchyCache.getType())) {
- typeHierarchyCache = type.newTypeHierarchy(null);
- }
- return typeHierarchyCache;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java
deleted file mode 100644
index 331dae4a0..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Description;
-import org.eclipse.jst.j2ee.common.ParamValue;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
-import org.eclipse.jst.j2ee.webapplication.DispatcherType;
-import org.eclipse.jst.j2ee.webapplication.Filter;
-import org.eclipse.jst.j2ee.webapplication.FilterMapping;
-import org.eclipse.jst.j2ee.webapplication.InitParam;
-import org.eclipse.jst.j2ee.webapplication.Servlet;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
-import org.eclipse.jst.javaee.core.DisplayName;
-import org.eclipse.jst.javaee.core.JavaeeFactory;
-import org.eclipse.jst.javaee.core.UrlPatternType;
-import org.eclipse.jst.javaee.web.WebFactory;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * This class, AddFilter Operation is a IDataModelOperation following the
- * IDataModel wizard and operation framework.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- *
- * This operation subclasses the ArtifactEditProviderOperation so the changes
- * made to the deployment descriptor models are saved to the artifact edit
- * model.
- * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
- *
- * It is the operation which should be used when adding a new filter to a web
- * app. This uses the NewFilterClassDataModelProvider to retrieve properties set by the
- * user in order to create the custom filter.
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider
- *
- * This operation will add the metadata necessary into the web deployment descriptor.
- * To actually create the java class for the filter, the operation uses the NewFilterClassOperation.
- * The NewFilterClassOperation shares the same data model provider.
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassOperation
- *
- * Clients may subclass this operation to provide their own behavior on filter
- * creation. The execute method can be extended to do so. Also,
- * generateFilterMetaData and creteFilterClass are exposed.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class AddFilterOperation extends AddWebClassOperation {
-
- /**
- * This is the constructor which should be used when creating the operation.
- * It will not accept null parameter. It will not return null.
- *
- * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
- *
- * @param dataModel
- * @return AddFilterOperation
- */
- public AddFilterOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- @Override
- protected NewJavaEEArtifactClassOperation getNewClassOperation() {
- return new NewFilterClassOperation(getDataModel());
- }
-
- /**
- * Subclasses may extend this method to add their own generation steps for
- * the creation of the metadata for the web deployment descriptor. This
- * implementation uses the J2EE models to create the Filter model instance,
- * any init params specified, and any filter mappings. It then adds these
- * to the web application model. This will then be written out to the
- * deployment descriptor file. This method does not accept null parameters.
- *
- * @see Filter
- * @see AddFilterOperation#createFilter(String)
- * @see AddFilterOperation#setUpInitParams(List, Filter)
- * @see AddFilterOperation#setUpURLMappings(List, Filter)
- *
- * @param aModel
- * @param qualifiedClassName
- */
- @Override
- protected void generateMetaData(IDataModel aModel, String qualifiedClassName) {
- // Set up the filter modelled object
- Object filter = createFilter(qualifiedClassName);
-
- // Set up the InitParams if any
- List initParamList =
- (List) aModel.getProperty(INIT_PARAM);
- if (initParamList != null)
- setUpInitParams(initParamList, filter);
-
- // Set up the filter mappings if any
- List filterMappingsList =
- (List) aModel.getProperty(FILTER_MAPPINGS);
-
- if (filterMappingsList != null && !filterMappingsList.isEmpty())
- setUpMappings(filterMappingsList, filter);
- }
-
- /**
- * This method is intended for private use only. This method is used to
- * create the filter modeled object, to set any parameters specified in
- * the data model, and then to add the filter instance to the web
- * application model. This method does not accept null parameters. It will
- * not return null.
- *
- * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
- * String)
- * @see WebapplicationFactory#createFilter()
- * @see Filter
- *
- * @param qualifiedClassName
- * @return Filter instance
- */
- /**
- * @param qualifiedClassName
- * @return
- */
- private Object createFilter(String qualifiedClassName) {
- // Get values from data model
- String displayName =
- model.getStringProperty(DISPLAY_NAME);
- String description =
- model.getStringProperty(DESCRIPTION);
-
- // Create the filter instance and set up the parameters from data model
- Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
- if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- Filter filter = WebapplicationFactory.eINSTANCE.createFilter();
- filter.setName(displayName);
- filter.setDisplayName(displayName);
- filter.setDescription(description);
- filter.setFilterClassName(qualifiedClassName);
-
- // Add the filter to the web application model
- WebApp webApp = (WebApp) modelObject;
- webApp.getFilters().add(filter);
- return filter;
- } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon) {
- org.eclipse.jst.javaee.web.IWebCommon webApp = (org.eclipse.jst.javaee.web.IWebCommon) modelObject;
- org.eclipse.jst.javaee.web.Filter filter = WebFactory.eINSTANCE.createFilter();
- DisplayName displayNameObj = JavaeeFactory.eINSTANCE.createDisplayName();
- displayNameObj.setValue(displayName);
- filter.getDisplayNames().add(displayNameObj);
- filter.setFilterName(displayName);
- filter.setFilterClass(qualifiedClassName);
- webApp.getFilters().add(filter);
- // Should be return Filter's instance
- return filter;
- }
- // Return the filter instance
- return null;
- }
-
- /**
- * This method is intended for internal use only. This is used to create any
- * init params for the new filter metadata. It will not accept null
- * parameters. The init params are set on the filter modeled object.
- *
- * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
- * String)
- * @see WebapplicationFactory#createInitParam()
- *
- * @param initParamList
- * @param filter
- */
- private void setUpInitParams(List initParamList, Object filterObj) {
- // Get the web app instance from the data model
- Object modelObject = provider.getModelObject();
- if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- WebApp webApp = (WebApp) modelObject;
- Filter filter = (Filter) filterObj;
-
- // If J2EE 1.4, add the param value and description info instances
- // to the filter init params
- if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
- for (int iP = 0; iP < initParamList.size(); iP++) {
- String[] stringArray = (String[]) initParamList.get(iP);
- // Create 1.4 common param value
- ParamValue param = CommonFactory.eINSTANCE.createParamValue();
- param.setName(stringArray[0]);
- param.setValue(stringArray[1]);
- // Create 1.4 common descripton value
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(stringArray[2]);
- // Set the description on the param
- param.getDescriptions().add(descriptionObj);
- param.setDescription(stringArray[2]);
- // Set the param to the filter model list of init params
- filter.getInitParamValues().add(param);
- }
- }
- // If J2EE 1.2 or 1.3, use the filter specific init param instances
- else {
- for (int iP = 0; iP < initParamList.size(); iP++) {
- String[] stringArray = (String[]) initParamList.get(iP);
- // Create the web init param
- InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam();
- // Set the param name
- ip.setParamName(stringArray[0]);
- // Set the param value
- ip.setParamValue(stringArray[1]);
- // Set the param description
- ip.setDescription(stringArray[2]);
- // Add the init param to the filter model list of params
- filter.getInitParams().add(ip);
- }
- }
- } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon) {
- org.eclipse.jst.javaee.web.Filter filter = (org.eclipse.jst.javaee.web.Filter) filterObj;
-
- for (int iP = 0; iP < initParamList.size(); iP++) {
- String[] stringArray = (String[]) initParamList.get(iP);
- // Create 1.4 common param value
- org.eclipse.jst.javaee.core.ParamValue param =
- JavaeeFactory.eINSTANCE.createParamValue();
- param.setParamName(stringArray[0]);
- param.setParamValue(stringArray[1]);
-
- org.eclipse.jst.javaee.core.Description descriptionObj =
- JavaeeFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(stringArray[2]);
- // Set the description on the param
- param.getDescriptions().add(descriptionObj);
- // Add the param to the filter model list of init params
- filter.getInitParams().add(param);
- }
- }
- }
-
- /**
- * This method is intended for internal use only. This method is used to
- * create the filter mapping modelled objects so the metadata for the
- * filter mappings is store in the web deployment descriptor. This method
- * will not accept null parameters. The filter mappings are added to the
- * web application modeled object.
- *
- * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
- * String)
- * @see WebapplicationFactory#createFilterMapping()
- *
- * @param urlMappingList
- * @param filter
- */
- private void setUpMappings(List filterMappingsList, Object filterObj) {
- // Get the web app modelled object from the data model
- // WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
- Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
-
- // Create the filter mappings if any
- if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- WebApp webApp = (WebApp) modelObject;
- Filter filter = (Filter) filterObj;
- if (filterMappingsList != null)
- for (int iM = 0; iM < filterMappingsList.size(); iM++) {
- IFilterMappingItem filterMapping = (IFilterMappingItem) filterMappingsList.get(iM);
- // Create the filter mapping instance from the web factory
- FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
- // Set the filter
- mapping.setFilter(filter);
- if (filterMapping.isUrlPatternType()) {
- // Set the URL pattern to map the filter to
- mapping.setUrlPattern(filterMapping.getName());
- } else {
- // Set the Servlet Name to map the filter to
- Servlet servlet = webApp.getServletNamed(filterMapping.getName());
- mapping.setServlet(servlet);
- }
- //Set dispatcher options for the filter mapping if any.
- int dispatchers = filterMapping.getDispatchers();
- EList dispatcherTypes = mapping.getDispatcherType();
- if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
- dispatcherTypes.add(DispatcherType.REQUEST_LITERAL);
- }
- if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
- dispatcherTypes.add(DispatcherType.FORWARD_LITERAL);
- }
- if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
- dispatcherTypes.add(DispatcherType.INCLUDE_LITERAL);
- }
- if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
- dispatcherTypes.add(DispatcherType.ERROR_LITERAL);
- }
- // Add the filter mapping to the web application modelled list
- webApp.getFilterMappings().add(mapping);
- }
- } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon) {
- org.eclipse.jst.javaee.web.IWebCommon webApp = (org.eclipse.jst.javaee.web.IWebCommon) modelObject;
- org.eclipse.jst.javaee.web.Filter filter = (org.eclipse.jst.javaee.web.Filter) filterObj;
-
- // Create the filter mapping instance from the web factory
- org.eclipse.jst.javaee.web.FilterMapping mapping = null;
- // Create the filter mappings if any
- if (filterMappingsList != null) {
- for (int i = 0; i < filterMappingsList.size(); i++) {
- mapping = WebFactory.eINSTANCE.createFilterMapping();
- mapping.setFilterName(filter.getFilterName());
- IFilterMappingItem filterMapping = (IFilterMappingItem) filterMappingsList.get(i);
- if (filterMapping.getMappingType() == IFilterMappingItem.URL_PATTERN) {
- // Set the URL pattern to map the filter to
- UrlPatternType url = JavaeeFactory.eINSTANCE.createUrlPatternType();
- url.setValue(filterMapping.getName());
- mapping.getUrlPatterns().add(url);
- } else {
- mapping.getServletNames().add(filterMapping.getName());
- }
- //Set dispatcher options for the filter mapping if any.
- int dispatchers = filterMapping.getDispatchers();
- if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
- mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.REQUEST_LITERAL);
- }
- if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
- mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.FORWARD_LITERAL);
- }
- if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
- mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.INCLUDE_LITERAL);
- }
- if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
- mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.ERROR_LITERAL);
- }
- // Add the filter mapping to the web application model list
- webApp.getFilterMappings().add(mapping);
- }
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java
deleted file mode 100644
index 98afadf18..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Listener;
-import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.javaee.core.JavaeeFactory;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * This class, AddListenerOperation is a IDataModelOperation following the IDataModel wizard and
- * operation framework.
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- *
- * This operation subclasses the ArtifactEditProviderOperation so the changes made to the deployment descriptor
- * models are saved to the artifact edit model.
- * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
- *
- * It is the operation which should be used when adding a new application lifecycle listener to
- * a web app, whether that be an annotated listener or a non annotated listener. This uses the
- * NewListenerClassDataModelProvider to retrieve properties set by the user in order to create the custom
- * listener class.
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider
- *
- * In the non annotated case, this operation will add the metadata necessary into the web deployment
- * descriptor. In the annotated case, it will not, it will leave this up to the parsing of the
- * annotations to build the deployment descriptor artifacts. To actually create the java class for
- * the listener, the operation uses the NewListenerClassOperation. The NewListenerClassOperation
- * shares the same data model provider.
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassOperation
- *
- * Clients may subclass this operation to provide their own behavior on listener creation. The execute
- * method can be extended to do so. Also, generateListenerMetaData and creteListenerClass are exposed.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class AddListenerOperation extends AddWebClassOperation {
-
- /**
- * This is the constructor which should be used when creating the operation.
- * It will not accept null parameter. It will not return null.
- * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
- *
- * @param dataModel
- * @return AddListenerOperation
- */
- public AddListenerOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- @Override
- protected NewJavaEEArtifactClassOperation getNewClassOperation() {
- return new NewListenerClassOperation(getDataModel());
- }
-
- /**
- * Subclasses may extend this method to add their own generation steps for the creation of the
- * metadata for the web deployment descriptor. This implementation uses the J2EE models to create
- * the Listener model instance. It then adds these to the web application model. This will then be
- * written out to the deployment descriptor file. This method does not accept null parameters.
- * @see Listener
- * @see AddListenerOperation#createListener(String)
- *
- * @param aModel
- * @param qualifiedClassName
- */
- @Override
- protected void generateMetaData(IDataModel aModel, String qualifiedClassName) {
- // Set up the listener modeled object
- createListener(qualifiedClassName);
- }
-
- /**
- * This method is intended for private use only. This method is used to create the listener
- * modeled object, to set any parameters specified in the data model, and then to add the
- * listener instance to the web application model. This method does not accept null parameters.
- * It will not return null.
- * @see AddListenerOperation#generateListenerMetaData(IDataModel, String)
- * @see CommonFactory#createListener()
- * @see Listener
- *
- * @param qualifiedClassName
- * @return Listener instance
- */
- private Object createListener(String qualifiedClassName) {
- Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
- if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp ){
- // Create the listener instance and set up the parameters from data model
- Listener listener = CommonFactory.eINSTANCE.createListener();
- listener.setListenerClassName(qualifiedClassName);
-
- // Add the listener to the web application model
- WebApp webApp = (WebApp) modelObject;
- webApp.getListeners().add(listener);
- return listener;
- } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon ){
- // Create the listener instance and set up the parameters from data model
- org.eclipse.jst.javaee.core.Listener listener = JavaeeFactory.eINSTANCE.createListener();
- listener.setListenerClass(qualifiedClassName);
-
- // Add the listener to the web application model
- org.eclipse.jst.javaee.web.IWebCommon webApp = (org.eclipse.jst.javaee.web.IWebCommon) modelObject;
- webApp.getListeners().add(listener);
- return listener;
- }
-
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java
deleted file mode 100644
index d41b140f8..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 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
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.IS_SERVLET_TYPE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-
-import java.util.List;
-
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Description;
-import org.eclipse.jst.j2ee.common.ParamValue;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
-import org.eclipse.jst.j2ee.webapplication.InitParam;
-import org.eclipse.jst.j2ee.webapplication.JSPType;
-import org.eclipse.jst.j2ee.webapplication.Servlet;
-import org.eclipse.jst.j2ee.webapplication.ServletMapping;
-import org.eclipse.jst.j2ee.webapplication.ServletType;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
-import org.eclipse.jst.javaee.core.DisplayName;
-import org.eclipse.jst.javaee.core.JavaeeFactory;
-import org.eclipse.jst.javaee.core.UrlPatternType;
-import org.eclipse.jst.javaee.web.IWebCommon;
-import org.eclipse.jst.javaee.web.WebFactory;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * This class, AddServlet Operation is a IDataModelOperation following the IDataModel wizard and
- * operation framework.
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- *
- * This operation subclasses the ArtifactEditProviderOperation so the changes made to the deployment descriptor
- * models are saved to the artifact edit model.
- * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
- *
- * It is the operation which should be used when adding a new servlet to
- * a web app, whether that be an annotated servlet or a non annotated servlet. This uses the
- * NewServletClassDataModelProvider to retrieve properties set by the user in order to create the custom
- * servet.
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewServletClassDataModelProvider
- *
- * In the non annotated case, this operation will add the metadata necessary into the web deployment
- * descriptor. In the annotated case, it will not, it will leave this up to the parsing of the
- * annotations to build the deployment descriptor artifacts. To actually create the java class for
- * the servlet, the operation uses the NewServletClassOperation. The NewServletClassOperation
- * shares the same data model provider.
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation
- *
- * Clients may subclass this operation to provide their own behaviour on servlet creation. The execute
- * method can be extended to do so. Also, generateServletMetaData and creteServletClass are exposed.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class AddServletOperation extends AddWebClassOperation {
-
- /**
- * This is the constructor which should be used when creating the operation.
- * It will not accept null parameter. It will not return null.
- * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
- *
- * @param dataModel
- * @return AddServletOperation
- */
-
-
- public AddServletOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- @Override
- protected NewJavaEEArtifactClassOperation getNewClassOperation() {
- return new NewServletClassOperation(getDataModel());
- }
-
- @Override
- protected void generateMetaData(IDataModel model, String qualifiedClassName) {
- boolean isServletType = model.getBooleanProperty(IS_SERVLET_TYPE);
- generateMetaData(model, qualifiedClassName, isServletType);
- }
-
- /**
- * Subclasses may extend this method to add their own generation steps for the creation of the
- * metadata for the web deployment descriptor. This implementation uses the J2EE models to create
- * the Servlet model instance, any init params specified, and any servlet mappings. It then adds
- * these to the web application model. This will then be written out to the deployment descriptor
- * file. This method does not accept null parameters.
- * @see Servlet
- * @see AddServletOperation#createServlet(String, boolean)
- * @see AddServletOperation#setUpInitParams(List, Servlet)
- * @see AddServletOperation#setUpURLMappings(List, Servlet)
- *
- * @param aModel
- * @param qualifiedClassName
- * @param isServletType
- */
- protected void generateMetaData(IDataModel aModel, String qualifiedClassName, boolean isServletType) {
- // Set up the servlet modelled object
- Object servlet = createServlet(qualifiedClassName, isServletType);
-
- // Set up the InitParams if any
- List initParamList = (List) aModel.getProperty(INIT_PARAM);
- if (initParamList != null)
- setUpInitParams(initParamList, servlet);
-
- // Set up the servlet URL mappings if any
- List urlMappingList = (List) aModel.getProperty(URL_MAPPINGS);
- if (urlMappingList != null)
- setUpURLMappings(urlMappingList, servlet);
- }
-
- /**
- * This method is intended for private use only. This method is used to create the servlet
- * modelled object, to set any parameters specified in the data model, and then to add the
- * servlet instance to the web application model. This method does not accpet null parameters.
- * It will not return null.
- * @see AddServletOperation#generateServletMetaData(NewServletClassDataModel, String, boolean)
- * @see WebapplicationFactory#createServlet()
- * @see Servlet
- *
- * @param qualifiedClassName
- * @param isServletType
- * @return Servlet instance
- */
- private Object createServlet(String qualifiedClassName, boolean isServletType) {
- // Get values from data model
- String displayName = model.getStringProperty(DISPLAY_NAME);
- String description = model.getStringProperty(DESCRIPTION);
-
- // Create the servlet instance and set up the parameters from data model
- Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
- if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
-
- Servlet servlet = WebapplicationFactory.eINSTANCE.createServlet();
- servlet.setDisplayName(displayName);
- servlet.setServletName(displayName);
- servlet.setDescription(description);
- // Handle servlet case
- if (isServletType) {
- ServletType servletType = WebapplicationFactory.eINSTANCE.createServletType();
- servletType.setClassName(qualifiedClassName);
- servlet.setWebType(servletType);
- }
- // Handle JSP case
- else {
- JSPType jspType = WebapplicationFactory.eINSTANCE.createJSPType();
- jspType.setJspFile(qualifiedClassName);
- servlet.setWebType(jspType);
- }
- // Add the servlet to the web application model
-
- //WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
- WebApp webApp = (WebApp) modelObject;
- webApp.getServlets().add(servlet);
- return servlet;
- } else if (modelObject instanceof IWebCommon) {
-
- org.eclipse.jst.javaee.web.Servlet servlet = WebFactory.eINSTANCE.createServlet();
-
- DisplayName displayNameObj = JavaeeFactory.eINSTANCE.createDisplayName();
- displayNameObj.setValue(displayName);
- servlet.getDisplayNames().add(displayNameObj);
-
- servlet.setServletName(displayName);
-
- org.eclipse.jst.javaee.core.Description descriptionObj = JavaeeFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(description);
- servlet.getDescriptions().add(descriptionObj);
-
- // Handle servlet case
- if (isServletType) {
- servlet.setServletClass(qualifiedClassName);
- }
- // Handle JSP case
- else {
- servlet.setJspFile(qualifiedClassName);
- }
- // Add the servlet to the web application model
-
- //WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
- IWebCommon webApp = (IWebCommon) modelObject;
- webApp.getServlets().add(servlet);
- return servlet;
- }
- // Return the servlet instance
- return null;
- }
-
- /**
- * This method is intended for internal use only. This is used to create any init params
- * for the new servlet metadata. It will not accept null parameters. The init params are
- * set on the servlet modelled object.
- * @see AddServletOperation#generateServletMetaData(NewServletClassDataModel, String, boolean)
- * @see WebapplicationFactory#createInitParam()
- *
- * @param initParamList
- * @param servlet
- */
- private void setUpInitParams(List initParamList, Object servletObj) {
- // Get the web app instance from the data model
- Object modelObject = provider.getModelObject();
- if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- WebApp webApp = (WebApp) modelObject;
- Servlet servlet = (Servlet) servletObj;
-
- // If J2EE 1.4, add the param value and description info instances to the servlet init params
- if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
- for (int iP = 0; iP < initParamList.size(); iP++) {
- String[] stringArray = (String[]) initParamList.get(iP);
- // Create 1.4 common param value
- ParamValue param = CommonFactory.eINSTANCE.createParamValue();
- param.setName(stringArray[0]);
- param.setValue(stringArray[1]);
- // Create 1.4 common descripton value
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(stringArray[2]);
- // Set the description on the param
- param.getDescriptions().add(descriptionObj);
- param.setDescription(stringArray[2]);
- // Add the param to the servlet model list of init params
- servlet.getInitParams().add(param);
- }
- }
- // If J2EE 1.2 or 1.3, use the servlet specific init param instances
- else {
- for (int iP = 0; iP < initParamList.size(); iP++) {
- String[] stringArray = (String[]) initParamList.get(iP);
- // Create the web init param
- InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam();
- // Set the param name
- ip.setParamName(stringArray[0]);
- // Set the param value
- ip.setParamValue(stringArray[1]);
- // Set the param description
- ip.setDescription(stringArray[2]);
- // Add the init param to the servlet model list of params
- servlet.getParams().add(ip);
- }
- }
- } else if (modelObject instanceof org.eclipse.jst.javaee.web.WebApp) {
- org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) servletObj;
-
- for (int iP = 0; iP < initParamList.size(); iP++) {
- String[] stringArray = (String[]) initParamList.get(iP);
- // Create 1.4 common param value
- org.eclipse.jst.javaee.core.ParamValue param= JavaeeFactory.eINSTANCE.createParamValue();
- param.setParamName(stringArray[0]);
- param.setParamValue(stringArray[1]);
-
- org.eclipse.jst.javaee.core.Description descriptionObj = JavaeeFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(stringArray[2]);
- // Set the description on the param
- param.getDescriptions().add(descriptionObj);
- // Add the param to the servlet model list of init params
- servlet.getInitParams().add(param);
- }
- }
- }
-
- /**
- * This method is intended for internal use only. This method is used to create the servlet
- * mapping modelled objects so the metadata for the servlet mappings is store in the web
- * deployment descriptor. This method will not accept null parameters. The servlet mappings
- * are added to the web application modelled object.
- * @see AddServletOperation#generateServletMetaData(NewServletClassDataModel, String, boolean)
- * @see WebapplicationFactory#createServletMapping()
- *
- * @param urlMappingList
- * @param servlet
- */
- private void setUpURLMappings(List urlMappingList, Object servletObj) {
- // Get the web app modelled object from the data model
- //WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
- Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
- // Create the servlet mappings if any
- if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- WebApp webApp = (WebApp) modelObject;
- Servlet servlet = (Servlet) servletObj;
- for (int iM = 0; iM < urlMappingList.size(); iM++) {
- String[] stringArray = (String[]) urlMappingList.get(iM);
- // Create the servlet mapping instance from the web factory
- ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
- // Set the servlet and servlet name
- mapping.setServlet(servlet);
- mapping.setName(servlet.getServletName());
- // Set the URL pattern to map the servlet to
- mapping.setUrlPattern(stringArray[0]);
- // Add the servlet mapping to the web application modelled list
- webApp.getServletMappings().add(mapping);
- }
- } else if (modelObject instanceof IWebCommon) {
- IWebCommon webApp = (IWebCommon) modelObject;
- org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) servletObj;
-
- // Create the servlet mappings if any
- if (urlMappingList.size() > 0) {
- // Create the servlet mapping instance from the web factory
- org.eclipse.jst.javaee.web.ServletMapping mapping = WebFactory.eINSTANCE.createServletMapping();
-
- mapping.setServletName(servlet.getServletName());
- for (int i = 0; i < urlMappingList.size(); i++) {
- String[] stringArray = (String[]) urlMappingList.get(i);
- // Set the URL pattern to map the servlet to
- UrlPatternType url = JavaeeFactory.eINSTANCE.createUrlPatternType();
- url.setValue(stringArray[0]);
- mapping.getUrlPatterns().add(url);
- }
- // Add the servlet mapping to the web application model list
- webApp.getServletMappings().add(mapping);
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java
deleted file mode 100644
index eecc6c3e0..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.GENERATE_DD;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.REGISTER_IN_WEB_XML;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.operations.AddJavaEEArtifactOperation;
-import org.eclipse.jst.jee.project.facet.ICreateDeploymentFilesDataModelProperties;
-import org.eclipse.jst.jee.project.facet.IWebCreateDeploymentFilesDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class AddWebClassOperation extends AddJavaEEArtifactOperation {
- protected Path WEB_APP_XML_PATH = new Path(J2EEConstants.WEBAPP_DD_URI);
- public AddWebClassOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- /**
- * Subclasses may extend this method to add their own actions during
- * execution. The implementation of the execute method drives the running of
- * the operation. This implementation will create the filter class, and
- * then it will create the filter metadata for the web deployment descriptor.
- * This method will accept null as a parameter.
- *
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.core.runtime.IAdaptable)
- * @see AddFilterOperation#createFilterClass()
- * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
- * String)
- *
- * @param monitor
- * IProgressMonitor
- * @param info
- * IAdaptable
- * @throws CoreException
- * @throws InterruptedException
- * @throws InvocationTargetException
- */
- @Override
- public IStatus doExecute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
-
- boolean useExisting = model.getBooleanProperty(USE_EXISTING_CLASS);
- String qualifiedClassName = model.getStringProperty(CLASS_NAME);
-
- // create the java class
- if (!useExisting)
- qualifiedClassName = createClass();
-
- // If the filter is not annotated, generate the filter metadata for the DD
- if (useExisting || (!model.getBooleanProperty(USE_ANNOTATIONS) && model.getBooleanProperty(REGISTER_IN_WEB_XML)))
- {
- if (model.getBooleanProperty(GENERATE_DD))
- {
- IDataModel ddModel = DataModelFactory.createDataModel(IWebCreateDeploymentFilesDataModelProperties.class);
- ddModel.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT, getTargetProject());
- ddModel.getDefaultOperation().execute(monitor, info);
- }
- generateMetaData(model, qualifiedClassName);
- }
-
- return OK_STATUS;
- }
-
- protected abstract void generateMetaData(IDataModel aModel, String qualifiedClassName);
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java
deleted file mode 100644
index 411615212..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DESTROY;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DO_FILTER;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DESTROY_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DO_FILTER_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.FILTER_INIT_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DESTROY;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_FILTER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_INIT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_INIT_PARAM;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CHAIN;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CONFIG;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_IO_EXCEPTION;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_FILTER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_DISPATCHER_TYPE;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jst.j2ee.internal.common.operations.Method;
-import org.eclipse.jst.j2ee.webapplication.DispatcherType;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class CreateFilterTemplateModel extends CreateWebClassTemplateModel {
-
- public static final String ATT_FILTER_NAME = "filterName"; //$NON-NLS-1$
- public static final String ATT_SERVLET_NAMES = "servletNames"; //$NON-NLS-1$
- public static final String ATT_DISPATCHER_TYPES= "dispatcherTypes"; //$NON-NLS-1$
-
- public static final int NAME = 0;
- public static final int VALUE = 1;
- public static final int DESCRIPTION = 2;
-
- public CreateFilterTemplateModel(IDataModel dataModel) {
- super(dataModel);
- }
-
- @Override
- public Collection<String> getImports() {
- Collection<String> collection = super.getImports();
-
- if (shouldGenInit()) {
- collection.add(QUALIFIED_FILTER_CONFIG);
- collection.add(QUALIFIED_SERVLET_EXCEPTION);
- }
-
- if (shouldGenDoFilter()) {
- collection.add(QUALIFIED_SERVLET_REQUEST);
- collection.add(QUALIFIED_SERVLET_RESPONSE);
- collection.add(QUALIFIED_FILTER_CHAIN);
- collection.add(QUALIFIED_IO_EXCEPTION);
- collection.add(QUALIFIED_SERVLET_EXCEPTION);
- }
- if (SERVLET_3.equals(getJavaEEVersion())){
- collection.add(QUALIFIED_WEB_FILTER);
- if (getInitParams()!= null && getInitParams().size()>0){
- collection.add(QUALIFIED_ANNOTATION_INIT_PARAM);
- }
- if (hasDispatchers()){
- collection.add(QUALIFIED_ANNOTATION_DISPATCHER_TYPE);
- }
- }
-
- return collection;
- }
-
- public String getFilterName() {
- return super.getDisplayName();
- }
-
- public boolean shouldGenInit() {
- return implementImplementedMethod(METHOD_INIT);
- }
-
- public boolean shouldGenDoFilter() {
- return implementImplementedMethod(METHOD_DO_FILTER);
- }
-
- public boolean shouldGenDestroy() {
- return implementImplementedMethod(METHOD_DESTROY);
- }
-
- public List<String[]> getInitParams() {
- return (List) dataModel.getProperty(INIT_PARAM);
- }
-
- public String getInitParam(int index, int type) {
- List<String[]> params = getInitParams();
- if (index < params.size()) {
- String[] stringArray = params.get(index);
- return stringArray[type];
- }
- return null;
- }
-
- public List<IFilterMappingItem> getFilterMappings() {
- return (List<IFilterMappingItem>) dataModel.getProperty(FILTER_MAPPINGS);
- }
-
- public IFilterMappingItem getFilterMapping(int index) {
- List<IFilterMappingItem> mappings = getFilterMappings();
- if (index < mappings.size()) {
- return mappings.get(index);
- }
- return null;
- }
-
- public String getDispatcherList(IFilterMappingItem mapping) {
- List<String> list = new ArrayList<String>();
-
- int dispatchers = mapping.getDispatchers();
- if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
- list.add(DispatcherType.REQUEST_LITERAL.getLiteral());
- }
- if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
- list.add(DispatcherType.FORWARD_LITERAL.getLiteral());
- }
- if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
- list.add(DispatcherType.INCLUDE_LITERAL.getLiteral());
- }
- if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
- list.add(DispatcherType.ERROR_LITERAL.getLiteral());
- }
-
- StringBuilder builder = new StringBuilder();
- Iterator<String> iterator = list.iterator();
- while (iterator.hasNext()) {
- builder.append(iterator.next());
- if (iterator.hasNext()) {
- builder.append(","); //$NON-NLS-1$
- }
- }
-
- return builder.toString();
- }
-
- public List<String> getDispatcherListWeb3(IFilterMappingItem mapping) {
- List<String> list = new ArrayList<String>();
-
- int dispatchers = mapping.getDispatchers();
- if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
- list.add("DispatcherType.REQUEST"); //$NON-NLS-1$
- }
- if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
- list.add("DispatcherType.FORWARD"); //$NON-NLS-1$
- }
- if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
- list.add("DispatcherType.INCLUDE"); //$NON-NLS-1$
- }
- if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
- list.add("DispatcherType.ERROR"); //$NON-NLS-1$
- }
-
- return list;
- }
-
- protected boolean implementImplementedMethod(String methodName) {
- if (dataModel.getBooleanProperty(ABSTRACT_METHODS)) {
- if (methodName.equals(METHOD_INIT))
- return dataModel.getBooleanProperty(INIT);
- else if (methodName.equals(METHOD_DO_FILTER))
- return dataModel.getBooleanProperty(DO_FILTER);
- else if (methodName.equals(METHOD_DESTROY))
- return dataModel.getBooleanProperty(DESTROY);
- }
- return false;
- }
-
- @Override
- public Collection<Method> getUnimplementedMethods() {
- Collection<Method> unimplementedMethods = super.getUnimplementedMethods();
- Iterator<Method> iterator = unimplementedMethods.iterator();
-
- while (iterator.hasNext()) {
- Method method = iterator.next();
- if ((METHOD_INIT.equals(method.getName()) && FILTER_INIT_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DESTROY.equals(method.getName()) && DESTROY_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DO_FILTER.equals(method.getName()) && DO_FILTER_SIGNATURE.equals(method.getSignature()))) {
- iterator.remove();
- }
- }
-
- return unimplementedMethods;
- }
-
- public boolean hasDispatchers(){
- List<IFilterMappingItem> filterMappings = getFilterMappings();
- for (IFilterMappingItem filterMapping : filterMappings) {
- if (filterMapping.getDispatchersAsString().length()>0){
- return true;
- }
- }
- return false;
- }
-
- public Map<String, Object> getClassAnnotationParams() {
- Map<String, Object> result = new Hashtable<String, Object>();
-
- String dispName = getFilterName().trim();
- if (!dispName.equals(getClassName()) && (dispName.length() > 0))
- result.put(ATT_FILTER_NAME, dispName);
-
- String description = getDescription().trim();
- if (description.length() > 0)
- result.put(ATT_DESCRIPTION, description);
-
- List<IFilterMappingItem> filterMappings = getFilterMappings();
- List<String> urlMappings = new ArrayList<String>();
- List<String> servletNames = new ArrayList<String>();
- List<String> dispatcherTypes = new ArrayList<String>();
- for (IFilterMappingItem filterMapping : filterMappings) {
- List<String> dispatcherList = getDispatcherListWeb3(filterMapping);
- if (dispatcherList != null && dispatcherList.size()>0){
- for (String disp : dispatcherList) {
- if (!dispatcherTypes.contains(disp)){
- dispatcherTypes.add(disp);
- }
- }
-
- }
- if (filterMapping.isUrlPatternType()) {
- urlMappings.add(filterMapping.getName());
- } else if (filterMapping.isServletNameType()) {
- servletNames.add(filterMapping.getName());
- }
- }
- if (urlMappings.size() > 0) {
- result.put(ATT_URL_PATTERNS, urlMappings);
- }
- if (dispatcherTypes.size() > 0) {
- result.put(ATT_DISPATCHER_TYPES, dispatcherTypes);
- }
- if (servletNames.size() > 0) {
- result.put(ATT_SERVLET_NAMES, servletNames);
- }
-
-
- List<String[]> initParams = getInitParams();
- if (initParams != null && initParams.size() > 0) {
- result.put(ATT_INIT_PARAMS, initParams);
- }
-
- return result;
- }
-
-}
-
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java
deleted file mode 100644
index 0bad9329e..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_BINDING_EVENT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_BINDING_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_EVENT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_EVENT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_EVENT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_EVENT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_LISTENER;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class CreateListenerTemplateModel extends CreateWebClassTemplateModel {
-
- @Override
- public Collection<String> getImports() {
- Collection<String> collection = super.getImports();
-
- if (implementServletContextListener()) {
- collection.add(QUALIFIED_SERVLET_CONTEXT_LISTENER);
- collection.add(QUALIFIED_SERVLET_CONTEXT_EVENT);
- }
-
- if (implementServletContextAttributeListener()) {
- collection.add(QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER);
- collection.add(QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_EVENT);
- }
-
- if (implementHttpSessionListener()) {
- collection.add(QUALIFIED_HTTP_SESSION_LISTENER);
- collection.add(QUALIFIED_HTTP_SESSION_EVENT);
- }
-
- if (implementHttpSessionAttributeListener()) {
- collection.add(QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER);
- collection.add(QUALIFIED_HTTP_SESSION_BINDING_EVENT);
- }
-
- if (implementHttpSessionActivationListener()) {
- collection.add(QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER);
- collection.add(QUALIFIED_HTTP_SESSION_EVENT);
- }
-
- if (implementHttpSessionBindingListener()) {
- collection.add(QUALIFIED_HTTP_SESSION_BINDING_LISTENER);
- collection.add(QUALIFIED_HTTP_SESSION_BINDING_EVENT);
- }
-
- if (implementServletRequestListener()) {
- collection.add(QUALIFIED_SERVLET_REQUEST_LISTENER);
- collection.add(QUALIFIED_SERVLET_REQUEST_EVENT);
- }
-
- if (implementServletRequestAttributeListener()) {
- collection.add(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER);
- collection.add(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT);
- }
-
- if (SERVLET_3.equals(getJavaEEVersion())){
- collection.add(QUALIFIED_WEB_LISTENER);
- }
-
- return collection;
- }
-
- public CreateListenerTemplateModel(IDataModel dataModel) {
- super(dataModel);
- }
-
- public boolean implementServletContextListener() {
- return implementInterface(QUALIFIED_SERVLET_CONTEXT_LISTENER);
- }
-
- public boolean implementServletContextAttributeListener() {
- return implementInterface(QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER);
- }
-
- public boolean implementHttpSessionListener() {
- return implementInterface(QUALIFIED_HTTP_SESSION_LISTENER);
- }
-
- public boolean implementHttpSessionAttributeListener() {
- return implementInterface(QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER);
- }
-
- public boolean implementHttpSessionActivationListener() {
- return implementInterface(QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER);
- }
-
- public boolean implementHttpSessionBindingListener() {
- return implementInterface(QUALIFIED_HTTP_SESSION_BINDING_LISTENER);
- }
-
- public boolean implementServletRequestListener() {
- return implementInterface(QUALIFIED_SERVLET_REQUEST_LISTENER);
- }
-
- public boolean implementServletRequestAttributeListener() {
- return implementInterface(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER);
- }
-
- private boolean implementInterface(String iface) {
- List<String> interfaces = getQualifiedInterfaces();
- if (interfaces != null) {
- return interfaces.contains(iface);
- }
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java
deleted file mode 100644
index 4f6a59d96..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 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
- * Kiril Mitov, k.mitov@sap.com - bug 204160
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-/*
- * Created on Aug 6, 2004
- */
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DESTROY;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_DELETE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_GET;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_HEAD;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_OPTIONS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_POST;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_PUT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_TRACE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_CONFIG;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_INFO;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.SERVICE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DESTROY_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DO_DELETE_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DO_GET_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DO_HEAD_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DO_POST_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DO_PUT_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.DO_TRACE_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.GET_SERVLET_CONFIG_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.GET_SERVLET_INFO_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.HTTP_SERVICE_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DESTROY;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_DELETE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_GET;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_HEAD;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_OPTIONS;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_POST;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_PUT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_TRACE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_GET_SERVLET_CONFIG;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_GET_SERVLET_INFO;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_INIT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_SERVICE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_TO_STRING;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_INIT_PARAM;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET_REQUEST;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET_RESPONSE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_IO_EXCEPTION;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONFIG;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_SERVLET;
-import static org.eclipse.jst.j2ee.web.IServletConstants.SERVICE_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.SERVLET_INIT_SIGNATURE;
-
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jst.j2ee.internal.common.operations.Method;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author jlanuti
- */
-public class CreateServletTemplateModel extends CreateWebClassTemplateModel {
-
- public static final int NAME = 0;
- public static final int VALUE = 1;
- public static final int DESCRIPTION = 2;
-
- public CreateServletTemplateModel(IDataModel dataModel) {
- super(dataModel);
- }
-
- @Override
- public Collection<String> getImports() {
- Collection<String> collection = super.getImports();
-
- if (shouldGenInit()) {
- collection.add(QUALIFIED_SERVLET_CONFIG);
- collection.add(QUALIFIED_SERVLET_EXCEPTION);
- }
-
- if (shouldGenGetServletConfig()) {
- collection.add(QUALIFIED_SERVLET_CONFIG);
- }
-
- if (shouldGenService()) {
- if (isHttpServletSuperclass()) {
- collection.add(QUALIFIED_HTTP_SERVLET_REQUEST);
- collection.add(QUALIFIED_HTTP_SERVLET_RESPONSE);
- } else {
- collection.add(QUALIFIED_SERVLET_REQUEST);
- collection.add(QUALIFIED_SERVLET_RESPONSE);
- }
-
- collection.add(QUALIFIED_SERVLET_EXCEPTION);
- collection.add(QUALIFIED_IO_EXCEPTION);
- }
-
- if (shouldGenDoGet() || shouldGenDoPost() || shouldGenDoPut() ||
- shouldGenDoDelete() || shouldGenDoHead() ||
- shouldGenDoOptions() || shouldGenDoTrace()) {
- collection.add(QUALIFIED_HTTP_SERVLET_REQUEST);
- collection.add(QUALIFIED_HTTP_SERVLET_RESPONSE);
- collection.add(QUALIFIED_SERVLET_EXCEPTION);
- collection.add(QUALIFIED_IO_EXCEPTION);
- }
-
- if (SERVLET_3.equals(getJavaEEVersion())){
- collection.add(QUALIFIED_WEB_SERVLET);
- if (getInitParams()!= null && getInitParams().size()>0){
- collection.add(QUALIFIED_ANNOTATION_INIT_PARAM);
- }
-
-
-
- }
-
- return collection;
- }
-
- public String getServletName() {
- return super.getDisplayName();
- }
-
- /**
- * @deprecated Use {@link #getClassName()} instead. Will be removed post WTP
- * 3.0.
- *
- * @see CreateWebClassTemplateModel#getClassName()
- */
- public String getServletClassName() {
- return super.getClassName();
- }
-
- public boolean shouldGenInit() {
- return implementImplementedMethod(METHOD_INIT);
- }
-
- public boolean shouldGenDestroy() {
- return implementImplementedMethod(METHOD_DESTROY);
- }
-
- public boolean shouldGenGetServletConfig() {
- return implementImplementedMethod(METHOD_GET_SERVLET_CONFIG);
- }
-
- public boolean shouldGenGetServletInfo() {
- return implementImplementedMethod(METHOD_GET_SERVLET_INFO);
- }
-
- public boolean shouldGenService() {
- return implementImplementedMethod(METHOD_SERVICE);
- }
-
- public boolean shouldGenDoGet() {
- return implementImplementedMethod(METHOD_DO_GET);
- }
-
- public boolean shouldGenDoPost() {
- return implementImplementedMethod(METHOD_DO_POST);
- }
-
- public boolean shouldGenDoPut() {
- return implementImplementedMethod(METHOD_DO_PUT);
- }
-
- public boolean shouldGenDoDelete() {
- return implementImplementedMethod(METHOD_DO_DELETE);
- }
-
- public boolean shouldGenDoHead() {
- return implementImplementedMethod(METHOD_DO_HEAD);
- }
-
- public boolean shouldGenDoOptions() {
- return implementImplementedMethod(METHOD_DO_OPTIONS);
- }
-
- public boolean shouldGenDoTrace() {
- return implementImplementedMethod(METHOD_DO_TRACE);
- }
-
- public boolean shouldGenToString() {
- return implementImplementedMethod(METHOD_TO_STRING);
- }
-
- public boolean isGenericServletSuperclass() {
- return ServletSupertypesValidator.isGenericServletSuperclass(dataModel);
- }
-
- public boolean isHttpServletSuperclass() {
- return ServletSupertypesValidator.isHttpServletSuperclass(dataModel);
- }
-
- public List<String[]> getInitParams() {
- return (List) dataModel.getProperty(INIT_PARAM);
- }
-
- public String getInitParam(int index, int type) {
- List<String[]> params = getInitParams();
- if (index < params.size()) {
- String[] stringArray = params.get(index);
- return stringArray[type];
- }
- return null;
- }
-
- public List<String[]> getServletMappings() {
- return (List) dataModel.getProperty(URL_MAPPINGS);
- }
-
- public String getServletMapping(int index) {
- List<String[]> mappings = getServletMappings();
- if (index < mappings.size()) {
- String[] map = mappings.get(index);
- return map[0];
- }
- return null;
- }
-
- /**
- * @deprecated Use {@link #getDescription()} instead. Will be removed post
- * WTP 3.0.
- *
- * @see CreateWebClassTemplateModel#getDescription()
- */
- public String getServletDescription() {
- return super.getDescription();
- }
-
- protected boolean implementImplementedMethod(String methodName) {
- if (dataModel.getBooleanProperty(ABSTRACT_METHODS)) {
- if (methodName.equals(METHOD_INIT))
- return dataModel.getBooleanProperty(INIT);
- else if (methodName.equals(METHOD_DESTROY))
- return dataModel.getBooleanProperty(DESTROY);
- else if (methodName.equals(METHOD_GET_SERVLET_CONFIG))
- return dataModel.getBooleanProperty(GET_SERVLET_CONFIG);
- else if (methodName.equals(METHOD_GET_SERVLET_INFO))
- return dataModel.getBooleanProperty(GET_SERVLET_INFO);
- else if (methodName.equals(METHOD_SERVICE))
- return dataModel.getBooleanProperty(SERVICE);
- else if (methodName.equals(METHOD_DO_GET))
- return dataModel.getBooleanProperty(DO_GET);
- else if (methodName.equals(METHOD_DO_POST))
- return dataModel.getBooleanProperty(DO_POST);
- else if (methodName.equals(METHOD_DO_PUT))
- return dataModel.getBooleanProperty(DO_PUT);
- else if (methodName.equals(METHOD_DO_DELETE))
- return dataModel.getBooleanProperty(DO_DELETE);
- else if (methodName.equals(METHOD_DO_HEAD))
- return dataModel.getBooleanProperty(DO_HEAD);
- else if (methodName.equals(METHOD_DO_OPTIONS))
- return dataModel.getBooleanProperty(DO_OPTIONS);
- else if (methodName.equals(METHOD_DO_TRACE))
- return dataModel.getBooleanProperty(DO_TRACE);
- }
- return false;
- }
-
- @Override
- public Collection<Method> getUnimplementedMethods() {
- Collection<Method> unimplementedMethods = super.getUnimplementedMethods();
- Iterator<Method> iterator = unimplementedMethods.iterator();
-
- while (iterator.hasNext()) {
- Method method = iterator.next();
- if ((METHOD_INIT.equals(method.getName()) && SERVLET_INIT_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DESTROY.equals(method.getName()) && DESTROY_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_GET_SERVLET_CONFIG.equals(method.getName()) && GET_SERVLET_CONFIG_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_GET_SERVLET_INFO.equals(method.getName()) && GET_SERVLET_INFO_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_SERVICE.equals(method.getName()) && SERVICE_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_SERVICE.equals(method.getName()) && HTTP_SERVICE_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DO_GET.equals(method.getName()) && DO_GET_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DO_POST.equals(method.getName()) && DO_POST_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DO_PUT.equals(method.getName()) && DO_PUT_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DO_DELETE.equals(method.getName()) && DO_DELETE_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DO_HEAD.equals(method.getName()) && DO_HEAD_SIGNATURE.equals(method.getSignature())) ||
- (METHOD_DO_OPTIONS.equals(method.getName()) && METHOD_DO_OPTIONS.equals(method.getSignature())) ||
- (METHOD_DO_TRACE.equals(method.getName()) && DO_TRACE_SIGNATURE.equals(method.getSignature()))) {
- iterator.remove();
- }
- }
-
- return unimplementedMethods;
- }
-
- public Map<String, Object> getClassAnnotationParams() {
- Map<String, Object> result = new Hashtable<String, Object>();
-
- String dispName = getServletName().trim();
- if (!dispName.equals(getClassName()) && (dispName.length() > 0))
- result.put(ATT_NAME, dispName);
-
- String description = getDescription().trim();
- if (description.length() > 0)
- result.put(ATT_DESCRIPTION, description);
-
- List<String[]> servletMappings = getServletMappings();
- if (servletMappings != null && servletMappings.size() > 0) {
- result.put(ATT_URL_PATTERNS, servletMappings);
- }
-
- List<String[]> initParams = getInitParams();
- if (initParams != null && initParams.size() > 0) {
- result.put(ATT_INIT_PARAMS, initParams);
- }
-
- return result;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java
deleted file mode 100644
index 809662a6e..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- * Carl Anderson, ccc@us.ibm.com - handle null superclass (no runtime) (bug 214950)
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.JAVA_EE_VERSION;
-
-import org.eclipse.jst.j2ee.internal.common.operations.CreateJavaEEArtifactTemplateModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class CreateWebClassTemplateModel extends
- CreateJavaEEArtifactTemplateModel {
-
- public static final String ATT_URL_PATTERNS = "urlPatterns"; //$NON-NLS-1$
- public static final String ATT_INIT_PARAMS = "initParams"; //$NON-NLS-1$
-
- public static final String SERVLET_3 = "3.0"; //$NON-NLS-1$
-
- public CreateWebClassTemplateModel(IDataModel dataModel) {
- super(dataModel);
- }
-
- public String getDisplayName() {
- return dataModel.getStringProperty(DISPLAY_NAME);
- }
-
- public String getDescription() {
- return dataModel.getStringProperty(DESCRIPTION);
- }
-
- public boolean isAnnotated() {
- return dataModel.getBooleanProperty(USE_ANNOTATIONS);
- }
-
- public String getJavaEEVersion() {
- return dataModel.getStringProperty(JAVA_EE_VERSION);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterMappingItem.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterMappingItem.java
deleted file mode 100644
index 59394f252..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterMappingItem.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
-
-public class FilterMappingItem implements IFilterMappingItem {
-
- private int mappingType;
- private int dispatchers;
- private String mapping;
-
- public FilterMappingItem(int type, String mapping) {
- mappingType = type;
- this.mapping = mapping;
- }
-
- public FilterMappingItem(int type, String mapping, int dispatchers) {
- this(type, mapping);
- this.dispatchers = dispatchers;
- }
-
- public int getMappingType() {
- return mappingType;
- }
-
- public boolean isUrlPatternType() {
- return mappingType == IFilterMappingItem.URL_PATTERN;
- }
-
- public boolean isServletNameType() {
- return mappingType == IFilterMappingItem.SERVLET_NAME;
- }
-
- public int getDispatchers() {
- return dispatchers;
- }
-
- public String getDispatchersAsString() {
- String result = ""; //$NON-NLS-1$
- if ((dispatchers & REQUEST) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_R") + " "; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if ((dispatchers & FORWARD) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_F") + " "; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if ((dispatchers & INCLUDE) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_I") + " "; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if ((dispatchers & ERROR) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_E") + " "; //$NON-NLS-1$ //$NON-NLS-2$
- }
- return result.trim();
- }
-
- public String getName() {
- return mapping;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterSupertypesValidator.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterSupertypesValidator.java
deleted file mode 100644
index fb7c510fe..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterSupertypesValidator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class FilterSupertypesValidator extends AbstractSupertypesValidator {
-
- public static boolean isFilterSuperclass(IDataModel dataModel) {
- if (hasSuperInterface(dataModel, getSuperclass(dataModel), QUALIFIED_FILTER))
- return true;
-
- for (Object iface : getInterfaces(dataModel)) {
- if (hasSuperInterface(dataModel, (String) iface, QUALIFIED_FILTER))
- return true;
- }
-
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java
deleted file mode 100644
index 8855c0852..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java
+++ /dev/null
@@ -1,597 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 SAP AG 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
- *
- * This class has been generated from a javajet template.
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.*;
-import org.eclipse.jst.j2ee.internal.common.operations.*;
-
-public class FilterTemplate
-{
- protected static String nl;
- public static synchronized FilterTemplate create(String lineSeparator)
- {
- nl = lineSeparator;
- FilterTemplate result = new FilterTemplate();
- nl = null;
- return result;
- }
-
- public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
- protected final String TEXT_1 = "package "; //$NON-NLS-1$
- protected final String TEXT_2 = ";"; //$NON-NLS-1$
- protected final String TEXT_3 = NL;
- protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
- protected final String TEXT_5 = ";"; //$NON-NLS-1$
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "/**" + NL + " * Servlet Filter implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_9 = NL + " *" + NL + " * @web.filter" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_10 = "\"" + NL + " * display-name=\""; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_11 = "\""; //$NON-NLS-1$
- protected final String TEXT_12 = NL + " * description=\""; //$NON-NLS-1$
- protected final String TEXT_13 = "\""; //$NON-NLS-1$
- protected final String TEXT_14 = NL + " *" + NL + " * @web.filter-mapping"; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_15 = NL + " * url-pattern=\""; //$NON-NLS-1$
- protected final String TEXT_16 = "\""; //$NON-NLS-1$
- protected final String TEXT_17 = NL + " * servlet-name=\""; //$NON-NLS-1$
- protected final String TEXT_18 = "\""; //$NON-NLS-1$
- protected final String TEXT_19 = NL + " * dispatcher=\""; //$NON-NLS-1$
- protected final String TEXT_20 = "\""; //$NON-NLS-1$
- protected final String TEXT_21 = NL + " *" + NL + " * @web.filter-init-param" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_22 = "\"" + NL + " * value=\""; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_23 = "\""; //$NON-NLS-1$
- protected final String TEXT_24 = NL + " * description=\""; //$NON-NLS-1$
- protected final String TEXT_25 = "\""; //$NON-NLS-1$
- protected final String TEXT_26 = NL + " */"; //$NON-NLS-1$
- protected final String TEXT_27 = NL + "@WebFilter"; //$NON-NLS-1$
- protected final String TEXT_28 = "(\""; //$NON-NLS-1$
- protected final String TEXT_29 = "\")"; //$NON-NLS-1$
- protected final String TEXT_30 = "({ "; //$NON-NLS-1$
- protected final String TEXT_31 = ", "; //$NON-NLS-1$
- protected final String TEXT_32 = "\""; //$NON-NLS-1$
- protected final String TEXT_33 = "\""; //$NON-NLS-1$
- protected final String TEXT_34 = " })"; //$NON-NLS-1$
- protected final String TEXT_35 = "("; //$NON-NLS-1$
- protected final String TEXT_36 = ", "; //$NON-NLS-1$
- protected final String TEXT_37 = NL + "\t\t"; //$NON-NLS-1$
- protected final String TEXT_38 = " = \""; //$NON-NLS-1$
- protected final String TEXT_39 = "\""; //$NON-NLS-1$
- protected final String TEXT_40 = " = { "; //$NON-NLS-1$
- protected final String TEXT_41 = ", "; //$NON-NLS-1$
- protected final String TEXT_42 = NL + "\t\t\t\t"; //$NON-NLS-1$
- protected final String TEXT_43 = "\""; //$NON-NLS-1$
- protected final String TEXT_44 = "\""; //$NON-NLS-1$
- protected final String TEXT_45 = NL + "\t\t"; //$NON-NLS-1$
- protected final String TEXT_46 = " "; //$NON-NLS-1$
- protected final String TEXT_47 = "}"; //$NON-NLS-1$
- protected final String TEXT_48 = " = { "; //$NON-NLS-1$
- protected final String TEXT_49 = ", "; //$NON-NLS-1$
- protected final String TEXT_50 = NL + "\t\t\t\t"; //$NON-NLS-1$
- protected final String TEXT_51 = "\""; //$NON-NLS-1$
- protected final String TEXT_52 = "\""; //$NON-NLS-1$
- protected final String TEXT_53 = NL + "\t\t"; //$NON-NLS-1$
- protected final String TEXT_54 = " "; //$NON-NLS-1$
- protected final String TEXT_55 = "}"; //$NON-NLS-1$
- protected final String TEXT_56 = " = { "; //$NON-NLS-1$
- protected final String TEXT_57 = ", "; //$NON-NLS-1$
- protected final String TEXT_58 = NL + "\t\t\t\t@WebInitParam(name = \""; //$NON-NLS-1$
- protected final String TEXT_59 = "\", value = \""; //$NON-NLS-1$
- protected final String TEXT_60 = "\""; //$NON-NLS-1$
- protected final String TEXT_61 = ", description = \""; //$NON-NLS-1$
- protected final String TEXT_62 = "\""; //$NON-NLS-1$
- protected final String TEXT_63 = ")"; //$NON-NLS-1$
- protected final String TEXT_64 = NL + "\t\t}"; //$NON-NLS-1$
- protected final String TEXT_65 = " = {"; //$NON-NLS-1$
- protected final String TEXT_66 = ", "; //$NON-NLS-1$
- protected final String TEXT_67 = NL + "\t\t\t\t"; //$NON-NLS-1$
- protected final String TEXT_68 = NL + "\t\t"; //$NON-NLS-1$
- protected final String TEXT_69 = " "; //$NON-NLS-1$
- protected final String TEXT_70 = "}" + NL + "\t\t\t\t\t"; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_71 = ")"; //$NON-NLS-1$
- protected final String TEXT_72 = NL + "public "; //$NON-NLS-1$
- protected final String TEXT_73 = "abstract "; //$NON-NLS-1$
- protected final String TEXT_74 = "final "; //$NON-NLS-1$
- protected final String TEXT_75 = "class "; //$NON-NLS-1$
- protected final String TEXT_76 = " extends "; //$NON-NLS-1$
- protected final String TEXT_77 = " implements "; //$NON-NLS-1$
- protected final String TEXT_78 = ", "; //$NON-NLS-1$
- protected final String TEXT_79 = " {"; //$NON-NLS-1$
- protected final String TEXT_80 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- protected final String TEXT_81 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_82 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_83 = "#"; //$NON-NLS-1$
- protected final String TEXT_84 = "("; //$NON-NLS-1$
- protected final String TEXT_85 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_86 = "("; //$NON-NLS-1$
- protected final String TEXT_87 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_88 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_89 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_90 = "#"; //$NON-NLS-1$
- protected final String TEXT_91 = "("; //$NON-NLS-1$
- protected final String TEXT_92 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_93 = " "; //$NON-NLS-1$
- protected final String TEXT_94 = "("; //$NON-NLS-1$
- protected final String TEXT_95 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_96 = NL + "\t\t\treturn "; //$NON-NLS-1$
- protected final String TEXT_97 = ";"; //$NON-NLS-1$
- protected final String TEXT_98 = NL + " }"; //$NON-NLS-1$
- protected final String TEXT_99 = NL + NL + "\t/**" + NL + "\t * @see Filter#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_100 = NL + NL + "\t/**" + NL + "\t * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)" + NL + "\t */" + NL + "\tpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\t// place your code here" + NL + "" + NL + "\t\t// pass the request along the filter chain" + NL + "\t\tchain.doFilter(request, response);" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
- protected final String TEXT_101 = NL + NL + "\t/**" + NL + "\t * @see Filter#init(FilterConfig)" + NL + "\t */" + NL + "\tpublic void init(FilterConfig fConfig) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_102 = NL + NL + "}"; //$NON-NLS-1$
- protected final String TEXT_103 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
- CreateFilterTemplateModel model = (CreateFilterTemplateModel) argument;
-
- model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME);
-
-
- if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) {
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append( model.getJavaPackageName() );
- stringBuffer.append(TEXT_2);
-
- }
-
- stringBuffer.append(TEXT_3);
-
- Collection<String> imports = model.getImports();
- for (String anImport : imports) {
-
- stringBuffer.append(TEXT_4);
- stringBuffer.append( anImport );
- stringBuffer.append(TEXT_5);
-
- }
-
- stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(TEXT_8);
- stringBuffer.append( model.getClassName() );
-
- if (model.isAnnotated()) {
-
- stringBuffer.append(TEXT_9);
- stringBuffer.append( model.getFilterName() );
- stringBuffer.append(TEXT_10);
- stringBuffer.append( model.getFilterName() );
- stringBuffer.append(TEXT_11);
-
- if (model.getDescription() != null && model.getDescription().length() > 0) {
-
- stringBuffer.append(TEXT_12);
- stringBuffer.append( model.getDescription() );
- stringBuffer.append(TEXT_13);
-
- }
-
- List<IFilterMappingItem> mappings = model.getFilterMappings();
- for (IFilterMappingItem mapping : mappings) {
-
- stringBuffer.append(TEXT_14);
-
- if (mapping.isUrlPatternType()) {
-
- stringBuffer.append(TEXT_15);
- stringBuffer.append( mapping.getName() );
- stringBuffer.append(TEXT_16);
-
- } else if (mapping.isServletNameType()) {
-
- stringBuffer.append(TEXT_17);
- stringBuffer.append( mapping.getName() );
- stringBuffer.append(TEXT_18);
-
- }
-
- String dispatcher = model.getDispatcherList(mapping);
- if (dispatcher.length() > 0) {
-
- stringBuffer.append(TEXT_19);
- stringBuffer.append( dispatcher );
- stringBuffer.append(TEXT_20);
-
- }
- }
-
- List<String[]> initParams = model.getInitParams();
- if (initParams != null && initParams.size() > 0) {
- for (int i = 0; i < initParams.size(); i++) {
- String name = model.getInitParam(i, CreateFilterTemplateModel.NAME);
- String value = model.getInitParam(i, CreateFilterTemplateModel.VALUE);
- String description = model.getInitParam(i, CreateFilterTemplateModel.DESCRIPTION);
-
- stringBuffer.append(TEXT_21);
- stringBuffer.append( name );
- stringBuffer.append(TEXT_22);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_23);
-
- if (description != null && description.length() > 0) {
-
- stringBuffer.append(TEXT_24);
- stringBuffer.append( description );
- stringBuffer.append(TEXT_25);
-
- }
- }
- }
- }
-
- stringBuffer.append(TEXT_26);
-
- if ("3.0".equals(model.getJavaEEVersion())) { //$NON-NLS-1$
-
- stringBuffer.append(TEXT_27);
-
- Map<String, Object> params = model.getClassAnnotationParams();
- if (params.size() == 1 && params.containsKey(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
- List<String> mappings = (List<String>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS);
- if (mappings.size() == 1) {
- String value = mappings.get(0);
-
- stringBuffer.append(TEXT_28);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_29);
-
- } else {
-
- stringBuffer.append(TEXT_30);
-
- boolean needComma = false;
- for (String mapping : mappings) {
- if (needComma) {
-
- stringBuffer.append(TEXT_31);
-
- }
-
- stringBuffer.append(TEXT_32);
- stringBuffer.append( mapping );
- stringBuffer.append(TEXT_33);
-
- needComma = true;
- }
-
- stringBuffer.append(TEXT_34);
-
- }
- } else if (!params.isEmpty()) {
-
- stringBuffer.append(TEXT_35);
-
- Set<String> keys = params.keySet();
- boolean needNewLine = keys.contains(CreateFilterTemplateModel.ATT_INIT_PARAMS) ||
- (keys.contains(CreateFilterTemplateModel.ATT_URL_PATTERNS) &&
- ((List<String>) params.get(CreateFilterTemplateModel.ATT_URL_PATTERNS)).size() > 1) ||
- (keys.contains(CreateFilterTemplateModel.ATT_SERVLET_NAMES) &&
- ((List<String>) params.get(CreateFilterTemplateModel.ATT_SERVLET_NAMES)).size() > 1);
- boolean needComma = false;
- for (String key : keys) {
- if (needComma) {
-
- stringBuffer.append(TEXT_36);
-
- }
-
- if (needNewLine) {
-
- stringBuffer.append(TEXT_37);
-
- }
-
- if (key.equals(CreateFilterTemplateModel.ATT_FILTER_NAME) || key.equals(CreateFilterTemplateModel.ATT_DESCRIPTION)) {
- String value = (String) params.get(key);
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_38);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_39);
-
- } else if (key.equals(CreateFilterTemplateModel.ATT_URL_PATTERNS)) {
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_40);
-
- List<String> mappings = (List<String>) params.get(key);
- boolean needComma2 = false;
- boolean needNewLine2 = mappings.size() > 1;
- for (String mapping : mappings) {
- if (needComma2) {
-
- stringBuffer.append(TEXT_41);
-
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_42);
-
- }
-
- stringBuffer.append(TEXT_43);
- stringBuffer.append( mapping );
- stringBuffer.append(TEXT_44);
-
- needComma2 = true;
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_45);
-
- } else {
-
- stringBuffer.append(TEXT_46);
-
- }
-
- stringBuffer.append(TEXT_47);
-
- } else if (key.equals(CreateFilterTemplateModel.ATT_SERVLET_NAMES)) {
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_48);
-
- List<String> servletNames = (List<String>) params.get(key);
- boolean needComma2 = false;
- boolean needNewLine2 = servletNames.size() > 1;
- for (String servletName : servletNames) {
- if (needComma2) {
-
- stringBuffer.append(TEXT_49);
-
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_50);
-
- }
-
- stringBuffer.append(TEXT_51);
- stringBuffer.append( servletName );
- stringBuffer.append(TEXT_52);
-
- needComma2 = true;
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_53);
-
- } else {
-
- stringBuffer.append(TEXT_54);
-
- }
-
- stringBuffer.append(TEXT_55);
-
- } else if (key.equals(CreateFilterTemplateModel.ATT_INIT_PARAMS)) {
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_56);
-
- List<String[]> initParams = (List<String[]>) params.get(key);
- boolean needComma2 = false;
- for (String[] initParam : initParams) {
- if (needComma2) {
-
- stringBuffer.append(TEXT_57);
-
- }
-
- String name = initParam[CreateFilterTemplateModel.NAME];
- String value = initParam[CreateFilterTemplateModel.VALUE];
- String description = initParam[CreateFilterTemplateModel.DESCRIPTION];
-
- stringBuffer.append(TEXT_58);
- stringBuffer.append( name );
- stringBuffer.append(TEXT_59);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_60);
-
- if (description != null && description.length() > 0) {
-
- stringBuffer.append(TEXT_61);
- stringBuffer.append( description );
- stringBuffer.append(TEXT_62);
-
- }
-
- stringBuffer.append(TEXT_63);
-
- needComma2 = true;
- }
-
- stringBuffer.append(TEXT_64);
-
- } else if (key.equals(CreateFilterTemplateModel.ATT_DISPATCHER_TYPES)) {
- List<String> dispatcherTypes = (List<String>) params.get(key);
- boolean needComma2 = false;
- boolean needNewLine2 = dispatcherTypes.size() > 1;
- if (dispatcherTypes.size()>0){
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_65);
-
- }
- for (String dispType : dispatcherTypes) {
- if (needComma2) {
-
- stringBuffer.append(TEXT_66);
-
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_67);
-
- }
-
- stringBuffer.append( dispType );
-
- needComma2 = true;
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_68);
-
- } else {
-
- stringBuffer.append(TEXT_69);
-
- }
-
- stringBuffer.append(TEXT_70);
-
- }
- needComma = true;
- }
-
- stringBuffer.append(TEXT_71);
-
- }
- }
-
-
- if (model.isPublic()) {
-
- stringBuffer.append(TEXT_72);
-
- }
-
- if (model.isAbstract()) {
-
- stringBuffer.append(TEXT_73);
-
- }
-
- if (model.isFinal()) {
-
- stringBuffer.append(TEXT_74);
-
- }
-
- stringBuffer.append(TEXT_75);
- stringBuffer.append( model.getClassName() );
-
- String superClass = model.getSuperclassName();
- if (superClass != null && superClass.length() > 0) {
-
- stringBuffer.append(TEXT_76);
- stringBuffer.append( superClass );
-
- }
-
- List<String> interfaces = model.getInterfaces();
- if ( interfaces.size() > 0) {
-
- stringBuffer.append(TEXT_77);
-
- }
-
- for (int i = 0; i < interfaces.size(); i++) {
- String INTERFACE = interfaces.get(i);
- if (i > 0) {
-
- stringBuffer.append(TEXT_78);
-
- }
-
- stringBuffer.append( INTERFACE );
-
- }
-
- stringBuffer.append(TEXT_79);
-
- if (!model.hasEmptySuperclassConstructor()) {
-
- stringBuffer.append(TEXT_80);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_81);
-
- }
-
- if (model.shouldGenSuperclassConstructors()) {
- List<Constructor> constructors = model.getConstructors();
- for (Constructor constructor : constructors) {
- if (constructor.isPublic() || constructor.isProtected()) {
-
- stringBuffer.append(TEXT_82);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_83);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_84);
- stringBuffer.append( constructor.getParamsForJavadoc() );
- stringBuffer.append(TEXT_85);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_86);
- stringBuffer.append( constructor.getParamsForDeclaration() );
- stringBuffer.append(TEXT_87);
- stringBuffer.append( constructor.getParamsForCall() );
- stringBuffer.append(TEXT_88);
-
- }
- }
- }
-
-
- if (model.shouldImplementAbstractMethods()) {
- for (Method method : model.getUnimplementedMethods()) {
-
- stringBuffer.append(TEXT_89);
- stringBuffer.append( method.getContainingJavaClass() );
- stringBuffer.append(TEXT_90);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_91);
- stringBuffer.append( method.getParamsForJavadoc() );
- stringBuffer.append(TEXT_92);
- stringBuffer.append( method.getReturnType() );
- stringBuffer.append(TEXT_93);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_94);
- stringBuffer.append( method.getParamsForDeclaration() );
- stringBuffer.append(TEXT_95);
-
- String defaultReturnValue = method.getDefaultReturnValue();
- if (defaultReturnValue != null) {
-
- stringBuffer.append(TEXT_96);
- stringBuffer.append( defaultReturnValue );
- stringBuffer.append(TEXT_97);
-
- }
-
- stringBuffer.append(TEXT_98);
-
- }
- }
-
- if (model.shouldGenDestroy()) {
- stringBuffer.append(TEXT_99);
- }
- if (model.shouldGenDoFilter()) {
- stringBuffer.append(TEXT_100);
- }
- if (model.shouldGenInit()) {
- stringBuffer.append(TEXT_101);
- }
- stringBuffer.append(TEXT_102);
- stringBuffer.append(TEXT_103);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/IFilterMappingItem.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/IFilterMappingItem.java
deleted file mode 100644
index 4fd6f9271..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/IFilterMappingItem.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-public interface IFilterMappingItem {
-
- public static int URL_PATTERN = 0;
- public static int SERVLET_NAME = 1;
-
- public static int REQUEST = 1 << 1;
- public static int FORWARD = 1 << 2;
- public static int INCLUDE = 1 << 3;
- public static int ERROR = 1 << 4;
-
- public String getName();
- public int getMappingType();
- public boolean isUrlPatternType();
- public boolean isServletNameType();
- public int getDispatchers();
- public String getDispatchersAsString();
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java
deleted file mode 100644
index 029c7c550..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-public interface INewFilterClassDataModelProperties extends INewWebClassDataModelProperties {
-
- /**
- * Optional, boolean property used to specify whether to generate the init method.
- * The default is false.
- */
- public static final String INIT = "NewFilterClassDataModel.INIT"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the destroy method.
- * The default is false.
- */
- public static final String DESTROY = "NewFilterClassDataModel.DESTROY"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doFilter method.
- * The default is true.
- */
- public static final String DO_FILTER = "NewFilterClassDataModel.DO_FILTER"; //$NON-NLS-1$
-
- /**
- * Optional, List property used to cache all the init params defined on the filter.
- */
- public static final String INIT_PARAM = "NewFilterClassDataModel.INIT_PARAM"; //$NON-NLS-1$
-
- /**
- * Optional, List propety used to cache all the filter mappings for this filter on the web application.
- */
- public static final String FILTER_MAPPINGS = "NewFilterClassDataModel.FILTER_MAPPINGS"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewListenerClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewListenerClassDataModelProperties.java
deleted file mode 100644
index d408e9c77..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewListenerClassDataModelProperties.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-public interface INewListenerClassDataModelProperties extends INewWebClassDataModelProperties {
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java
deleted file mode 100644
index 583f9a547..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 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
- * Kiril Mitov, k.mitov@sap.com - bug 204160
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-public interface INewServletClassDataModelProperties extends INewWebClassDataModelProperties {
- /**
- * Optional, boolean property used to specify whether to generate the init method.
- * The default is false.
- */
- public static final String INIT = "NewServletClassDataModel.INIT"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the destroy method. The default is false.
- */
- public static final String DESTROY = "NewServletClassDataModel.DESTROY"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the getServletInfo method. The default is false.
- */
- public static final String GET_SERVLET_INFO = "NewServletClassDataModel.GET_SERVLET_INFO"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the getServletConfig method. The default is false.
- */
- public static final String GET_SERVLET_CONFIG = "NewServletClassDataModel.GET_SERVLET_CONFIG"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the service method. The default is false.
- */
- public static final String SERVICE = "NewServletClassDataModel.SERVICE"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doGet method. The default is true.
- */
- public static final String DO_GET = "NewServletClassDataModel.DO_GET"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doPost method.
- * The default is true.
- */
- public static final String DO_POST = "NewServletClassDataModel.DO_POST"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doPut method. The default is false.
- */
- public static final String DO_PUT = "NewServletClassDataModel.DO_PUT"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doDelete method. The default is false.
- */
- public static final String DO_DELETE = "NewServletClassDataModel.DO_DELETE"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doHead method. The default is false.
- */
- public static final String DO_HEAD = "NewServletClassDataModel.DO_HEAD"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doOptions method. The default is false.
- */
- public static final String DO_OPTIONS = "NewServletClassDataModel.DO_OPTIONS"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doTrace method. The default is false.
- */
- public static final String DO_TRACE = "NewServletClassDataModel.DO_TRACE"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether to generate the doTrace method. The default is false.
- */
- public static final String TO_STRING = "NewServletClassDataModel.TO_STRING"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to determine if building JSP or servlet.
- * The default is true.
- */
- public static final String IS_SERVLET_TYPE = "NewServletClassDataModel.IS_SERVLET_TYPE"; //$NON-NLS-1$
-
- /**
- * Optional, List property used to cache all the init params defined on the servlet.
- */
- public static final String INIT_PARAM = "NewServletClassDataModel.INIT_PARAM"; //$NON-NLS-1$
-
- /**
- * Optional, List propety used to cache all the servlet mappings for this servlet on the web application.
- */
- public static final String URL_MAPPINGS = "NewServletClassDataModel.URL_MAPPINGS"; //$NON-NLS-1$
-
- /**
- * Do not set! The javajet template file used in creating the annotated servlet template class
- */
- public static final String TEMPLATE_FILE = "NewServletClassDataModel.TEMPLATE_FILE"; //$NON-NLS-1$
-
- /**
- * Do not set! The javajet template file used in creating the non-annotated servlet template class
- */
- public static final String NON_ANNOTATED_TEMPLATE_FILE = "NewServletClassDataModel.NON_ANNOTATED_TEMPLATE_FILE"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java
deleted file mode 100644
index 5650d4141..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
-import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
-
-public interface INewWebClassDataModelProperties extends INewJavaClassDataModelProperties, IAnnotationsDataModel {
-
- /**
- * Required, String property of the display name for the filter
- */
- public static final String DISPLAY_NAME = "NewServletClassDataModel.DISPLAY_NAME"; //$NON-NLS-1$
-
- /**
- * Optional, String property of the description info for the filter
- */
- public static final String DESCRIPTION = "NewServletClassDataModel.DESCRIPTION"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether or not to generate a new java class.
- * The default is false.
- */
- public static final String USE_EXISTING_CLASS = "NewServletClassDataModel.USE_EXISTING_CLASS"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether or not to generate artifacts in web.xml
- */
- public static final String REGISTER_IN_WEB_XML = "NewServletClassDataModel.REGISTER_IN_WEB_XML"; //$NON-NLS-1$
-
- /**
- * Optional, boolean property used to specify whether or not to generate artifacts in web.xml
- */
- public static final String JAVA_EE_VERSION = "NewServletClassDataModel.JAVA_EE_VERSION"; //$NON-NLS-1$
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java
deleted file mode 100644
index b268e4803..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 SAP AG 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
- *
- * This class has been generated from a javajet template.
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.*;
-import org.eclipse.jst.j2ee.internal.common.operations.*;
-
-public class ListenerTemplate
-{
- protected static String nl;
- public static synchronized ListenerTemplate create(String lineSeparator)
- {
- nl = lineSeparator;
- ListenerTemplate result = new ListenerTemplate();
- nl = null;
- return result;
- }
-
- public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
- protected final String TEXT_1 = "package "; //$NON-NLS-1$
- protected final String TEXT_2 = ";"; //$NON-NLS-1$
- protected final String TEXT_3 = NL;
- protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
- protected final String TEXT_5 = ";"; //$NON-NLS-1$
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "/**" + NL + " * Application Lifecycle Listener implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_9 = NL + " *"; //$NON-NLS-1$
- protected final String TEXT_10 = NL + " * @web.listener"; //$NON-NLS-1$
- protected final String TEXT_11 = NL + " */"; //$NON-NLS-1$
- protected final String TEXT_12 = NL + "@WebListener"; //$NON-NLS-1$
- protected final String TEXT_13 = NL + "public "; //$NON-NLS-1$
- protected final String TEXT_14 = "abstract "; //$NON-NLS-1$
- protected final String TEXT_15 = "final "; //$NON-NLS-1$
- protected final String TEXT_16 = "class "; //$NON-NLS-1$
- protected final String TEXT_17 = " extends "; //$NON-NLS-1$
- protected final String TEXT_18 = " implements "; //$NON-NLS-1$
- protected final String TEXT_19 = ", "; //$NON-NLS-1$
- protected final String TEXT_20 = " {"; //$NON-NLS-1$
- protected final String TEXT_21 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- protected final String TEXT_22 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_23 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_24 = "#"; //$NON-NLS-1$
- protected final String TEXT_25 = "("; //$NON-NLS-1$
- protected final String TEXT_26 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_27 = "("; //$NON-NLS-1$
- protected final String TEXT_28 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_29 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_30 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_31 = "#"; //$NON-NLS-1$
- protected final String TEXT_32 = "("; //$NON-NLS-1$
- protected final String TEXT_33 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_34 = " "; //$NON-NLS-1$
- protected final String TEXT_35 = "("; //$NON-NLS-1$
- protected final String TEXT_36 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_37 = NL + "\t\t\treturn "; //$NON-NLS-1$
- protected final String TEXT_38 = ";"; //$NON-NLS-1$
- protected final String TEXT_39 = NL + " }"; //$NON-NLS-1$
- protected final String TEXT_40 = NL + "\t" + NL + "}"; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_41 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
- CreateListenerTemplateModel model = (CreateListenerTemplateModel) argument;
-
- model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME);
-
-
- if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) {
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append( model.getJavaPackageName() );
- stringBuffer.append(TEXT_2);
-
- }
-
- stringBuffer.append(TEXT_3);
-
- Collection<String> imports = model.getImports();
- for (String anImport : imports) {
-
- stringBuffer.append(TEXT_4);
- stringBuffer.append( anImport );
- stringBuffer.append(TEXT_5);
-
- }
-
- stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(TEXT_8);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_9);
-
- if (model.isAnnotated()) {
-
- stringBuffer.append(TEXT_10);
-
- }
-
- stringBuffer.append(TEXT_11);
-
- if ("3.0".equals(model.getJavaEEVersion())) { //$NON-NLS-1$
-
- stringBuffer.append(TEXT_12);
-
-}
-
-
- if (model.isPublic()) {
-
- stringBuffer.append(TEXT_13);
-
- }
-
- if (model.isAbstract()) {
-
- stringBuffer.append(TEXT_14);
-
- }
-
- if (model.isFinal()) {
-
- stringBuffer.append(TEXT_15);
-
- }
-
- stringBuffer.append(TEXT_16);
- stringBuffer.append( model.getClassName() );
-
- String superClass = model.getSuperclassName();
- if (superClass != null && superClass.length() > 0) {
-
- stringBuffer.append(TEXT_17);
- stringBuffer.append( superClass );
-
- }
-
- List<String> interfaces = model.getInterfaces();
- if ( interfaces.size() > 0) {
-
- stringBuffer.append(TEXT_18);
-
- }
-
- for (int i = 0; i < interfaces.size(); i++) {
- String INTERFACE = interfaces.get(i);
- if (i > 0) {
-
- stringBuffer.append(TEXT_19);
-
- }
-
- stringBuffer.append( INTERFACE );
-
- }
-
- stringBuffer.append(TEXT_20);
-
- if (!model.hasEmptySuperclassConstructor()) {
-
- stringBuffer.append(TEXT_21);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_22);
-
- }
-
- if (model.shouldGenSuperclassConstructors()) {
- List<Constructor> constructors = model.getConstructors();
- for (Constructor constructor : constructors) {
- if (constructor.isPublic() || constructor.isProtected()) {
-
- stringBuffer.append(TEXT_23);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_24);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_25);
- stringBuffer.append( constructor.getParamsForJavadoc() );
- stringBuffer.append(TEXT_26);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_27);
- stringBuffer.append( constructor.getParamsForDeclaration() );
- stringBuffer.append(TEXT_28);
- stringBuffer.append( constructor.getParamsForCall() );
- stringBuffer.append(TEXT_29);
-
- }
- }
- }
-
-
- if (model.shouldImplementAbstractMethods()) {
- for (Method method : model.getUnimplementedMethods()) {
-
- stringBuffer.append(TEXT_30);
- stringBuffer.append( method.getContainingJavaClass() );
- stringBuffer.append(TEXT_31);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_32);
- stringBuffer.append( method.getParamsForJavadoc() );
- stringBuffer.append(TEXT_33);
- stringBuffer.append( method.getReturnType() );
- stringBuffer.append(TEXT_34);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_35);
- stringBuffer.append( method.getParamsForDeclaration() );
- stringBuffer.append(TEXT_36);
-
- String defaultReturnValue = method.getDefaultReturnValue();
- if (defaultReturnValue != null) {
-
- stringBuffer.append(TEXT_37);
- stringBuffer.append( defaultReturnValue );
- stringBuffer.append(TEXT_38);
-
- }
-
- stringBuffer.append(TEXT_39);
-
- }
- }
-
- stringBuffer.append(TEXT_40);
- stringBuffer.append(TEXT_41);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java
deleted file mode 100644
index c928ef946..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DESTROY;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DO_FILTER;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.jst.j2ee.web.validation.UrlPattern;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-public class NewFilterClassDataModelProvider extends
- NewWebClassDataModelProvider {
-
- /**
- * String array of the default, minimum required fully qualified Filter
- * interfaces
- */
- private final static String[] FILTER_INTERFACES = { QUALIFIED_FILTER };
-
- @Override
- public boolean isPropertyEnabled(String propertyName) {
- if (ABSTRACT_METHODS.equals(propertyName)) {
- return false;
- } else if (INIT.equals(propertyName)) {
- return false;
- } else if (DESTROY.equals(propertyName)) {
- return false;
- } else if (DO_FILTER.equals(propertyName)) {
- return false;
- }
- // Otherwise return super implementation
- return super.isPropertyEnabled(propertyName);
- }
-
- /**
- * Subclasses may extend this method to provide their own default operation
- * for this data model provider. This implementation uses the
- * AddFilterOperation to drive the filter creation. It will not return null.
- *
- * @see IDataModel#getDefaultOperation()
- *
- * @return IDataModelOperation AddFilterOperation
- */
- @Override
- public IDataModelOperation getDefaultOperation() {
- return new AddFilterOperation(getDataModel());
- }
-
- /**
- * Subclasses may extend this method to add their own data model's
- * properties as valid base properties.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#getPropertyNames()
- */
- @Override
- public Set getPropertyNames() {
- // Add filter specific properties defined in this data model
- Set propertyNames = super.getPropertyNames();
-
- propertyNames.add(INIT);
- propertyNames.add(DESTROY);
- propertyNames.add(DO_FILTER);
- propertyNames.add(INIT_PARAM);
- propertyNames.add(FILTER_MAPPINGS);
-
- return propertyNames;
- }
-
- /**
- * Subclasses may extend this method to provide their own default values for
- * any of the properties in the data model hierarchy. This method does not
- * accept a null parameter. It may return null. This implementation sets
- * annotation use to be true, and to generate a filter with doFilter.
- *
- * @see NewJavaClassDataModelProvider#getDefaultProperty(String)
- * @see IDataModelProvider#getDefaultProperty(String)
- *
- * @param propertyName
- * @return Object default value of property
- */
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(DESTROY))
- return Boolean.TRUE;
- else if (propertyName.equals(DO_FILTER))
- return Boolean.TRUE;
- else if (propertyName.equals(INIT))
- return Boolean.TRUE;
- else if (propertyName.equals(FILTER_MAPPINGS))
- return getDefaultFilterMapping();
- else if (propertyName.equals(INTERFACES))
- return getFilterInterfaces();
-
- // Otherwise check super for default value for property
- return super.getDefaultProperty(propertyName);
- }
-
- /**
- * Returns the default Url Mapping depending upon the display name of the
- * Filter
- *
- * @return List containting the default Url Mapping
- */
- private Object getDefaultFilterMapping() {
- List filterMappings = null;
- String text = (String) getProperty(DISPLAY_NAME);
- if (text != null) {
- filterMappings = new ArrayList();
- filterMappings.add(new FilterMappingItem(FilterMappingItem.URL_PATTERN, "/" + text)); //$NON-NLS-1$
- }
- return filterMappings;
- }
-
- /**
- * Subclasses may extend this method to provide their own validation on any
- * of the valid data model properties in the hierarchy. This implementation
- * adds validation for the init params, filter mappings, display name, and
- * existing class fields specific to the filter java class creation. It does
- * not accept a null parameter. This method will not return null.
- *
- * @see NewJavaClassDataModelProvider#validate(String)
- *
- * @param propertyName
- * @return IStatus is property value valid?
- */
- @Override
- public IStatus validate(String propertyName) {
- // If our default is the superclass, we know it is ok
- if (propertyName.equals(SUPERCLASS) && "".equals(getStringProperty(propertyName))) //$NON-NLS-1$
- return WTPCommonPlugin.OK_STATUS;
- // Validate init params
- if (propertyName.equals(INIT_PARAM))
- return validateInitParamList((List) getProperty(propertyName));
- // Validate url pattern and servlet name mappings
- if (propertyName.equals(FILTER_MAPPINGS))
- return validateFilterMappingList((List) getProperty(FILTER_MAPPINGS));
- // Validate the filter name in DD
- if (propertyName.equals(DISPLAY_NAME))
- return validateDisplayName(getStringProperty(propertyName));
-
- // Otherwise defer to super to validate the property
- return super.validate(propertyName);
- }
-
- /**
- * This method is intended for internal use only. It will be used to
- * validate the init params list to ensure there are not any duplicates.
- * This method will accept a null paramter. It will not return null.
- *
- * @see NewFilterClassDataModelProvider#validate(String)
- *
- * @param prop
- * @return IStatus is init params list valid?
- */
- private IStatus validateInitParamList(List prop) {
- if (prop != null && !prop.isEmpty()) {
- // Ensure there are not duplicate entries in the list
- boolean dup = hasDuplicatesInStringArrayList(prop);
- if (dup) {
- String msg = WebMessages.ERR_DUPLICATED_INIT_PARAMETER;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
- // Return OK
- return WTPCommonPlugin.OK_STATUS;
- }
-
- /**
- * This method is intended for internal use only. This will validate the
- * filter mappings list and ensure there are not duplicate entries. It will
- * accept a null parameter. It will not return null.
- *
- * @see NewFilterClassDataModelProvider#validate(String)
- *
- * @param prop
- * @return IStatus is filter mapping list valid?
- */
- private IStatus validateFilterMappingList(List prop) {
- if (prop != null && !prop.isEmpty()) {
- // Ensure there are not duplicates in the mapping list
- boolean dup = hasDuplicatesInFilterMappingItemList(prop);
- if (dup) {
- String msg = WebMessages.ERR_DUPLICATED_URL_MAPPING;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- String isValidValue = validateValue(prop);
- if (isValidValue != null && isValidValue.length() > 0) {
- NLS.bind(WebMessages.ERR_URL_PATTERN_INVALID, isValidValue);
- String resourceString = WebMessages.getResourceString(WebMessages.ERR_URL_PATTERN_INVALID, new String[]{isValidValue});
- return WTPCommonPlugin.createErrorStatus(resourceString);
- }
- } else {
- String msg = WebMessages.ERR_FILTER_MAPPING_EMPTY;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- // Return OK
- return WTPCommonPlugin.OK_STATUS;
- }
-
- private boolean hasDuplicatesInFilterMappingItemList(List<IFilterMappingItem> input) {
- // If list is null or empty return false
- if (input == null) return false;
- int n = input.size();
- boolean dup = false;
- // nested for loops to check each element to see if other elements are the same
- for (int i = 0; i < n; i++) {
- IFilterMappingItem item = input.get(i);
- for (int j = i + 1; j < n; j++) {
- IFilterMappingItem item2 = input.get(j);
- if (item.getName().equals(item2.getName()) &&
- item.getMappingType() == item2.getMappingType()) {
- dup = true;
- break;
- }
- }
- if (dup) break;
- }
- // Return boolean status for duplicates
- return dup;
- }
-
- /**
- * This method is intended for internal use only. It provides a simple
- * algorithm for detecting if there are invalid pattern's value in a list.
- * It will accept a null parameter.
- *
- * @see NewFilterClassDataModelProvider#validateFilterMappingList(List)
- *
- * @param input
- * @return String first invalid pattern's value
- */
- private String validateValue(List prop) {
- if (prop == null) {
- return ""; //$NON-NLS-1$
- }
- int size = prop.size();
- for (int i = 0; i < size; i++) {
- IFilterMappingItem filterMappingValue = (IFilterMappingItem) prop.get(i);
- if (filterMappingValue.isUrlPatternType() &&
- !UrlPattern.isValid(filterMappingValue.getName()))
- return filterMappingValue.getName();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * This method will return the list of filter interfaces to be implemented
- * for the new servlet java class. It will intialize the list using lazy
- * initialization to the minimum interfaces required by the data model
- * FILTER_INTERFACES. This method will not return null.
- *
- * @see #FILTER_INTERFACES
- *
- * @return List of servlet interfaces to be implemented
- */
- private List getFilterInterfaces() {
- if (interfaceList == null) {
- interfaceList = new ArrayList();
- // Add minimum required list of servlet interfaces to be implemented
- for (int i = 0; i < FILTER_INTERFACES.length; i++) {
- interfaceList.add(FILTER_INTERFACES[i]);
- }
- }
- // Return interface list
- return interfaceList;
- }
-
- /**
- * This method is intended for internal use only. This will validate whether
- * the display name selected is a valid display name for the filter in the
- * specified web application. It will make sure the name is not empty and
- * that it doesn't already exist in the web app. This method will accept
- * null as a parameter. It will not return null.
- *
- * @see NewFilterClassDataModelProvider#validate(String)
- *
- * @param prop
- * @return IStatus is filter display name valid?
- */
- private IStatus validateDisplayName(String prop) {
- // Ensure the filter display name is not null or empty
- if (prop == null || prop.trim().length() == 0) {
- String msg = WebMessages.ERR_DISPLAY_NAME_EMPTY;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- if (getTargetProject() == null || getTargetComponent() == null)
- return WTPCommonPlugin.OK_STATUS;
-
- IModelProvider provider = ModelProviderManager.getModelProvider(getTargetProject());
- Object mObj = provider.getModelObject();
- if (mObj instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) mObj;
-
- List filters = webApp.getFilters();
- boolean exists = false;
- // Ensure the display does not already exist in the web application
- if (filters != null && !filters.isEmpty()) {
- for (int i = 0; i < filters.size(); i++) {
- String name = ((org.eclipse.jst.j2ee.webapplication.Filter) filters.get(i)).getName();
- if (prop.equals(name))
- exists = true;
- }
- }
- // If the filter name already exists, throw an error
- if (exists) {
- String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_NAME_EXIST, new String[]{prop});
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- } else if (mObj instanceof org.eclipse.jst.javaee.web.WebApp) {
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) mObj;
-
- List filters = webApp.getFilters();
- boolean exists = false;
- // Ensure the display does not already exist in the web application
- if (filters != null && !filters.isEmpty()) {
- for (int i = 0; i < filters.size(); i++) {
- String name = ((org.eclipse.jst.javaee.web.Filter) filters.get(i)).getFilterName();
- if (prop.equals(name))
- exists = true;
- }
- }
- // If the filter name already exists, throw an error
- if (exists) {
- String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_NAME_EXIST, new String[] {prop});
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
-
- // Otherwise, return OK
- return WTPCommonPlugin.OK_STATUS;
- }
-
- @Override
- public boolean propertySet(String propertyName, Object propertyValue) {
- if (DISPLAY_NAME.equals(propertyName) || CLASS_NAME.equals(propertyName)) {
- model.notifyPropertyChange(FILTER_MAPPINGS, IDataModel.DEFAULT_CHG);
- }
-
- return super.propertySet(propertyName, propertyValue);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassOperation.java
deleted file mode 100644
index a9675d08e..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassOperation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * The NewFilterClassOperation is an IDataModelOperation following the
- * IDataModel wizard and operation framework.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- *
- * It extends ArtifactEditProviderOperation to provide filter specific java
- * class generation.
- * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
- *
- * This operation is used by the AddFilterOperation to generate an
- * non annotated java class for an added filter. It shares the
- * NewFilterClassDataModelProvider with the AddFilterOperation to store the
- * appropriate properties required to generate the new filter.
- * @see org.eclipse.jst.j2ee.internal.web.operations.AddFilterOperation
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider
- *
- * A WTPJetEmitter filter template is used to create the class with the filter template.
- * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
- * @see org.eclipse.jst.j2ee.internal.web.operations.CreateFilterTemplateModel
- *
- * Subclasses may extend this operation to provide their own specific filter
- * java class generation. The execute method may be extended to do so. Also,
- * generateUsingTemplates is exposed.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class NewFilterClassOperation extends NewWebClassOperation {
-
- /**
- * folder location of the filter creation templates diretory
- */
- protected static final String TEMPLATE_FILE = "/templates/filter.javajet"; //$NON-NLS-1$
-
- /**
- * This is the constructor which should be used when creating a
- * NewFilterClassOperation. An instance of the NewFilterClassDataModel
- * should be passed in. This does not accept null parameter. It will not
- * return null.
- *
- * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
- * @see NewFilterClassDataModel
- *
- * @param dataModel
- * @return NewFilterClassOperation
- */
- public NewFilterClassOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- /**
- * This method will create an instance of the CreateFilterTemplate model to
- * be used in conjunction with the WTPJETEmitter. This method will not
- * return null.
- *
- * @see CreateFilterTemplateModel
- * @see NewFilterClassOperation#generateUsingTemplates(IProgressMonitor,
- * IPackageFragment)
- *
- * @return CreateFilterTemplateModel
- */
- @Override
- protected CreateFilterTemplateModel createTemplateModel() {
- return new CreateFilterTemplateModel(model);
- }
-
- @Override
- protected String getTemplateFile() {
- return TEMPLATE_FILE;
- }
-
- @Override
- protected FilterTemplate getTemplateImplementation() {
- return FilterTemplate.create(null);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java
deleted file mode 100644
index e509fd06b..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_BINDING_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_LISTENER;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * The NewListenerClassDataModelProvider is a subclass of
- * NewWebClassDataModelProvider and follows the IDataModel Operation and Wizard
- * frameworks.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- *
- * This data model provider is a subclass of the NewWebClassDataModelProvider,
- * which stores base properties necessary in the creation of a default java
- * class.
- * @see org.eclipse.jst.j2ee.internal.common.operations.NewWebClassDataModelProvider
- *
- * The NewListenerClassDataModelProvider provides more specific properties for
- * java class creation that are required in creating a listener java class. The
- * data model provider is used to store these values for the
- * NewListenerClassOperation.
- * @see org.eclipse.jst.j2ee.internal.web.operations.INewListenerClassDataModelProperties
- * That operation will create the listener java class based on the settings
- * defined here in the data model.
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassOperation
- *
- * This data model properties implements the IAnnotationsDataModel to get the
- * USE_ANNOTATIONS property for determining whether or not to generate an
- * annotated java class.
- * @see org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel
- *
- * Clients can subclass this data model provider to cache and provide their own
- * specific attributes. They should also provide their own validation methods,
- * properties interface, and default values for the properties they add.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class NewListenerClassDataModelProvider extends
- NewWebClassDataModelProvider {
-
- public static final String[] LISTENER_INTERFACES = {
- QUALIFIED_SERVLET_CONTEXT_LISTENER,
- QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER,
- QUALIFIED_HTTP_SESSION_LISTENER,
- QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER,
- QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER,
- QUALIFIED_HTTP_SESSION_BINDING_LISTENER,
- QUALIFIED_SERVLET_REQUEST_LISTENER,
- QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER
- };
-
- /**
- * Subclasses may extend this method to provide their own default operation
- * for this data model provider. This implementation uses the
- * AddListenerOperation to drive the listener creation. It will not return
- * null.
- *
- * @see IDataModel#getDefaultOperation()
- *
- * @return IDataModelOperation AddListenerOperation
- */
- @Override
- public IDataModelOperation getDefaultOperation() {
- return new AddListenerOperation(getDataModel());
- }
-
- /**
- * Subclasses may extend this method to provide their own validation on any
- * of the valid data model properties in the hierarchy. It does not accept a
- * null parameter. This method will not return null.
- *
- * @see NewJavaClassDataModelProvider#validate(String)
- *
- * @param propertyName
- * @return IStatus is property value valid?
- */
- @Override
- public IStatus validate(String propertyName) {
- if (propertyName.equals(INTERFACES)){
- if (!getBooleanProperty(USE_EXISTING_CLASS)) {
- return validateListeners();
- }
- }
- // Otherwise defer to super to validate the property
- return super.validate(propertyName);
- }
-
-
- /**
- * Checks if at least one of the application lifecycle listeners is
- * selected.
- */
- private IStatus validateListeners() {
- boolean atLeastOneSelected = false;
- Object value = model.getProperty(INTERFACES);
- if (value != null && (value instanceof List)) {
- List interfaces = (List) value;
- for (String iface : LISTENER_INTERFACES) {
- if (interfaces.contains(iface)) {
- atLeastOneSelected = true;
- break;
- }
- }
- }
-
- if (atLeastOneSelected) {
- return WTPCommonPlugin.OK_STATUS;
- }
- String msg = WebMessages.ERR_NO_LISTENER_SELECTED;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassOperation.java
deleted file mode 100644
index 41c2d37da..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassOperation.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * The NewListenerClassOperation is an IDataModelOperation following the
- * IDataModel wizard and operation framework.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- *
- * It extends ArtifactEditProviderOperation to provide listener specific java
- * class generation.
- * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
- *
- * This operation is used by the AddListenerOperation to generate either an
- * annotated or non annotated java class for an added application lifecycle listener.
- * It shares the NewListenerClassDataModelProvider with the AddListenerOperation to
- * store the appropriate properties required to generate the new listener.
- * @see org.eclipse.jst.j2ee.internal.web.operations.AddListenerOperation
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider
- *
- * In the annotated case, a WTPJetEmitter listener template is created and used
- * to generate the listener java class with the embedded annotated tags.
- * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
- * @see org.eclipse.jst.j2ee.internal.web.operations.CreateListenerTemplateModel
- *
- * In the non annotated case, the same emitter is used to create the class with
- * the non annotated listener template so the annotated tags are omitted.
- *
- * Subclasses may extend this operation to provide their own specific listener
- * java class generation. The execute method may be extended to do so. Also,
- * generateUsingTemplates is exposed.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class NewListenerClassOperation extends NewWebClassOperation {
-
- /**
- * folder location of the listener creation templates directory
- */
- protected static final String TEMPLATE_FILE = "/templates/listener.javajet"; //$NON-NLS-1$
-
- /**
- * This is the constructor which should be used when creating a
- * NewListenerClassOperation. An instance of the NewListenerClassDataModel
- * should be passed in. This does not accept null parameter. It will not
- * return null.
- *
- * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
- * @see NewListenerClassDataModel
- *
- * @param dataModel
- * @return NewListenerClassOperation
- */
- public NewListenerClassOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- /**
- * This method will create an instance of the CreateListenerTemplateModel to
- * be used in conjunction with the WTPJETEmitter. This method will not
- * return null.
- *
- * @see CreateListenerTemplateModel
- * @see NewListenerClassOperation#generateUsingTemplates(IProgressMonitor,
- * IPackageFragment)
- *
- * @return CreateListenerTemplateModel
- */
- @Override
- protected CreateListenerTemplateModel createTemplateModel() {
- return new CreateListenerTemplateModel(model);
- }
-
- @Override
- protected String getTemplateFile() {
- return TEMPLATE_FILE;
- }
-
- @Override
- protected ListenerTemplate getTemplateImplementation() {
- return ListenerTemplate.create(null);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java
deleted file mode 100644
index 9792723bd..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 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
- * Kiril Mitov, k.mitov@sap.com - bug 204160
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DESTROY;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_DELETE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_GET;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_HEAD;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_OPTIONS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_POST;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_PUT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_TRACE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_CONFIG;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_INFO;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.IS_SERVLET_TYPE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.NON_ANNOTATED_TEMPLATE_FILE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.SERVICE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.TEMPLATE_FILE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.TO_STRING;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.J2EEFileUtil;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.jst.j2ee.web.validation.UrlPattern;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * The NewServletClassDataModelProvider is a subclass of
- * NewWebClassDataModelProvider and follows the IDataModel Operation and Wizard
- * frameworks.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- *
- * This data model provider is a subclass of the NewWebClassDataModelProvider,
- * which stores base properties necessary in the creation of a web artifact
- * class.
- *
- * @see NewWebClassDataModelProvider
- *
- * The NewServletClassDataModelProvider provides more specific properties for
- * java class creation that are required in creating a servlet java class. The
- * data model provider is used to store these values for the
- * NewServletClassOperation.
- *
- * @see INewServletClassDataModelProperties
- *
- * That operation will create the servlet java class based on the settings
- * defined here in the data model.
- *
- * @see NewServletClassOperation
- *
- * This data model properties implements the IAnnotationsDataModel to get the
- * USE_ANNOTATIONS property for determining whether or not to generate an
- * annotated java class.
- *
- * @see org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel
- *
- * Clients can subclass this data model provider to cache and provide their own
- * specific attributes. They should also provide their own validation methods,
- * properties interface, and default values for the properties they add.
- */
-public class NewServletClassDataModelProvider extends
- NewWebClassDataModelProvider {
-
- /**
- * The fully qualified default servlet superclass: HttpServlet.
- */
- private final static String SERVLET_SUPERCLASS = QUALIFIED_HTTP_SERVLET;
-
- /**
- * String array of the default, minimum required fully qualified Servlet
- * interfaces
- */
- private final static String[] SERVLET_INTERFACES = { QUALIFIED_SERVLET };
-
- private final static String ANNOTATED_TEMPLATE_DEFAULT = "servlet.javajet"; //$NON-NLS-1$
-
- private final static String NON_ANNOTATED_TEMPLATE_DEFAULT = "servlet.javajet"; //$NON-NLS-1$
-
- /**
- * Subclasses may extend this method to provide their own default operation
- * for this data model provider. This implementation uses the
- * AddServletOperation to drive the servlet creation. It will not return
- * null.
- *
- * @see IDataModel#getDefaultOperation()
- *
- * @return IDataModelOperation AddServletOperation
- */
- @Override
- public IDataModelOperation getDefaultOperation() {
- return new AddServletOperation(model);
- }
-
- /**
- * Subclasses may extend this method to add their own data model's
- * properties as valid base properties.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#getPropertyNames()
- */
- @Override
- public Set getPropertyNames() {
- // Add servlet specific properties defined in this data model
- Set propertyNames = super.getPropertyNames();
-
- propertyNames.add(INIT);
- propertyNames.add(DESTROY);
- propertyNames.add(GET_SERVLET_CONFIG);
- propertyNames.add(GET_SERVLET_INFO);
- propertyNames.add(SERVICE);
- propertyNames.add(DO_GET);
- propertyNames.add(DO_POST);
- propertyNames.add(DO_PUT);
- propertyNames.add(DO_DELETE);
- propertyNames.add(DO_HEAD);
- propertyNames.add(DO_OPTIONS);
- propertyNames.add(DO_TRACE);
- propertyNames.add(TO_STRING);
- propertyNames.add(IS_SERVLET_TYPE);
- propertyNames.add(INIT_PARAM);
- propertyNames.add(URL_MAPPINGS);
- propertyNames.add(NON_ANNOTATED_TEMPLATE_FILE);
- propertyNames.add(TEMPLATE_FILE);
-
- return propertyNames;
- }
-
- @Override
- public boolean isPropertyEnabled(String propertyName) {
- if (ABSTRACT_METHODS.equals(propertyName)) {
- return ServletSupertypesValidator.isGenericServletSuperclass(model);
- } else if (INIT.equals(propertyName) ||
- DESTROY.equals(propertyName) ||
- GET_SERVLET_CONFIG.equals(propertyName) ||
- GET_SERVLET_INFO.equals(propertyName) ||
- SERVICE.equals(propertyName)) {
- boolean genericServlet = ServletSupertypesValidator.isGenericServletSuperclass(model);
- boolean inherit = model.getBooleanProperty(ABSTRACT_METHODS);
- return genericServlet && inherit;
- } else if (DO_GET.equals(propertyName) ||
- DO_POST.equals(propertyName) ||
- DO_PUT.equals(propertyName) ||
- DO_DELETE.equals(propertyName) ||
- DO_HEAD.equals(propertyName) ||
- DO_OPTIONS.equals(propertyName) ||
- DO_TRACE.equals(propertyName)) {
- boolean httpServlet = ServletSupertypesValidator.isHttpServletSuperclass(model);
- boolean inherit = model.getBooleanProperty(ABSTRACT_METHODS);
- return httpServlet && inherit;
- }
-
- // Otherwise return super implementation
- return super.isPropertyEnabled(propertyName);
- }
-
- /**
- * Subclasses may extend this method to provide their own default values for
- * any of the properties in the data model hierarchy. This method does not
- * accept a null parameter. It may return null. This implementation sets
- * annotation use to be true, and to generate a servlet with doGet and
- * doPost.
- *
- * @see NewWebClassDataModelProvider#getDefaultProperty(String)
- * @see IDataModelProvider#getDefaultProperty(String)
- *
- * @param propertyName
- * @return Object default value of property
- */
- @Override
- public Object getDefaultProperty(String propertyName) {
- // Generate a doPost and doGet methods by default only if a class
- // extending HttpServlet is selected
- if (propertyName.equals(DO_POST) || propertyName.equals(DO_GET)) {
- if (ServletSupertypesValidator.isHttpServletSuperclass(model))
- return Boolean.TRUE;
- }
-
- // Generate a service method by default only if a class
- // not extending HttpServlet is selected
- if (propertyName.equals(SERVICE)) {
- if (!ServletSupertypesValidator.isHttpServletSuperclass(model))
- return Boolean.TRUE;
- }
-
- if (propertyName.equals(INIT) || propertyName.equals(DESTROY) ||
- propertyName.equals(GET_SERVLET_CONFIG) || propertyName.equals(GET_SERVLET_INFO)) {
- if (!ServletSupertypesValidator.isGenericServletSuperclass(model))
- return Boolean.TRUE;
- }
-
- // Use servlet by default
- else if (propertyName.equals(IS_SERVLET_TYPE))
- return Boolean.TRUE;
- else if (propertyName.equals(DISPLAY_NAME)) {
- String className = getStringProperty(CLASS_NAME);
- if (className.endsWith(J2EEFileUtil.DOT_JSP)) {
- int index = className.lastIndexOf("/"); //$NON-NLS-1$
- className = className.substring(index+1,className.length()-4);
- } else {
- className = Signature.getSimpleName(className);
- }
- return className;
- }
- else if (propertyName.equals(URL_MAPPINGS))
- return getDefaultUrlMapping();
- else if (propertyName.equals(INTERFACES))
- return getServletInterfaces();
- else if (propertyName.equals(SUPERCLASS))
- return SERVLET_SUPERCLASS;
- else if (propertyName.equals(TEMPLATE_FILE))
- return ANNOTATED_TEMPLATE_DEFAULT;
- else if (propertyName.equals(NON_ANNOTATED_TEMPLATE_FILE))
- return NON_ANNOTATED_TEMPLATE_DEFAULT;
-
- // Otherwise check super for default value for property
- return super.getDefaultProperty(propertyName);
- }
-
- /**
- * Subclasses may extend this method to provide their own validation on any
- * of the valid data model properties in the hierarchy. This implementation
- * adds validation for the init params, servlet mappings, display name, and
- * existing class fields specific to the servlet java class creation. It
- * does not accept a null parameter. This method will not return null.
- *
- * @see NewWebClassDataModelProvider#validate(String)
- *
- * @param propertyName
- * @return IStatus is property value valid?
- */
- @Override
- public IStatus validate(String propertyName) {
- // Validate super class
- if (propertyName.equals(SUPERCLASS))
- return validateSuperClassName(getStringProperty(propertyName));
- // Validate init params
- if (propertyName.equals(INIT_PARAM))
- return validateInitParamList((List) getProperty(propertyName));
- // Validate servlet mappings
- if (propertyName.equals(URL_MAPPINGS))
- return validateURLMappingList((List) getProperty(propertyName));
- // Validate the servlet name in DD
- if (propertyName.equals(DISPLAY_NAME))
- return validateDisplayName(getStringProperty(propertyName));
-
- // Otherwise defer to super to validate the property
- return super.validate(propertyName);
- }
-
- @Override
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean result = false;
-
- if (SUPERCLASS.equals(propertyName)) {
- model.notifyPropertyChange(ABSTRACT_METHODS, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(INIT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DESTROY, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(GET_SERVLET_CONFIG, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(GET_SERVLET_INFO, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(SERVICE, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DO_GET, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DO_POST, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DO_PUT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DO_DELETE, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DO_HEAD, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DO_OPTIONS, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(DO_TRACE, IDataModel.ENABLE_CHG);
-
- if (!hasSuperClass()) {
- model.setProperty(ABSTRACT_METHODS, null);
- model.setProperty(INIT, null);
- model.setProperty(DESTROY, null);
- model.setProperty(GET_SERVLET_CONFIG, null);
- model.setProperty(GET_SERVLET_INFO, null);
- model.setProperty(SERVICE, null);
- model.setProperty(DO_GET, null);
- model.setProperty(DO_POST, null);
- model.setProperty(DO_PUT, null);
- model.setProperty(DO_DELETE, null);
- model.setProperty(DO_HEAD, null);
- model.setProperty(DO_OPTIONS, null);
- model.setProperty(DO_TRACE, null);
- }
-
- model.notifyPropertyChange(ABSTRACT_METHODS, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(INIT, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DESTROY, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(GET_SERVLET_CONFIG, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(GET_SERVLET_INFO, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(SERVICE, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DO_GET, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DO_POST, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DO_PUT, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DO_DELETE, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DO_HEAD, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DO_OPTIONS, IDataModel.DEFAULT_CHG);
- model.notifyPropertyChange(DO_TRACE, IDataModel.DEFAULT_CHG);
-
- if (!ServletSupertypesValidator.isServletSuperclass(model)) {
- List ifaces = (List) model.getProperty(INTERFACES);
- ifaces.add(QUALIFIED_SERVLET);
- }
- }
-
- return result || super.propertySet(propertyName, propertyValue);
- }
-
- /**
- * Subclasses may extend this method to provide their own validation of the specified java
- * classname. This implementation will ensure the class name is not set to Servlet and then will
- * forward on to the NewJavaClassDataModel to validate the class name as valid java. This method
- * does not accept null as a parameter. It will not return null.
- * It will check if the super class extends the javax.servlet.Servlet interface also.
- *
- * @param className
- * @return IStatus is java classname valid?
- */
- protected IStatus validateSuperClassName(String superclassName) {
- //If the servlet implements javax.servlet.Servlet, we do not need a super class
- if (ServletSupertypesValidator.isGenericServletSuperclass(model))
- return WTPCommonPlugin.OK_STATUS;
-
- // Check the super class as a java class
- IStatus status = null;
- if (superclassName.trim().length() > 0) {
- status = super.validate(SUPERCLASS);
- if (status.getSeverity() == IStatus.ERROR)
- return status;
- }
-
- if (!ServletSupertypesValidator.isServletSuperclass(model))
- return WTPCommonPlugin.createErrorStatus(WebMessages.ERR_SERVLET_INTERFACE);
-
- return status;
- }
-
- /**
- * Returns the default Url Mapping depending upon the display name of the Servlet
- *
- * @return List containting the default Url Mapping
- */
- private Object getDefaultUrlMapping() {
- List urlMappings = null;
- String text = (String) getProperty(DISPLAY_NAME);
- if (text != null) {
- urlMappings = new ArrayList();
- urlMappings.add(new String[] {"/" + text}); //$NON-NLS-1$
- }
- return urlMappings;
- }
-
- /**
- * This method is intended for internal use only. It will be used to
- * validate the init params list to ensure there are not any duplicates.
- * This method will accept a null paramter. It will not return null.
- *
- * @see NewServletClassDataModelProvider#validate(String)
- *
- * @param prop
- * @return IStatus is init params list valid?
- */
- private IStatus validateInitParamList(List prop) {
- if (prop != null && !prop.isEmpty()) {
- // Ensure there are not duplicate entries in the list
- boolean dup = hasDuplicatesInStringArrayList(prop);
- if (dup) {
- String msg = WebMessages.ERR_DUPLICATED_INIT_PARAMETER;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
- // Return OK
- return WTPCommonPlugin.OK_STATUS;
- }
-
- /**
- * This method is intended for internal use only. This will validate the
- * servlet mappings list and ensure there are not duplicate entries. It will
- * accept a null parameter. It will not return null.
- *
- * @see NewServletClassDataModelProvider#validate(String)
- *
- * @param prop
- * @return IStatus is servlet mapping list valid?
- */
- private IStatus validateURLMappingList(List prop) {
- if (prop != null && !prop.isEmpty()) {
- // Ensure there are not duplicates in the mapping list
- boolean dup = hasDuplicatesInStringArrayList(prop);
- if (dup) {
- String msg = WebMessages.ERR_DUPLICATED_URL_MAPPING;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- String isValidValue = validateValue(prop);
- if (isValidValue != null && isValidValue.length() > 0) {
- NLS.bind(WebMessages.ERR_URL_PATTERN_INVALID, isValidValue);
- String resourceString = WebMessages.getResourceString(WebMessages.ERR_URL_PATTERN_INVALID, new String[]{isValidValue});
- return WTPCommonPlugin.createErrorStatus(resourceString);
- }
- } else {
- String msg = WebMessages.ERR_URL_MAPPING_LIST_EMPTY;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- // Return OK
- return WTPCommonPlugin.OK_STATUS;
- }
-
- /**
- * This method is intended for internal use only. It provides a simple
- * algorithm for detecting if there are invalid pattern's value in a list.
- * It will accept a null parameter.
- *
- * @see NewServletClassDataModelProvider#validateURLMappingList(List)
- *
- * @param input
- * @return String first invalid pattern's value?
- */
- private String validateValue(List prop) {
- if (prop == null) {
- return ""; //$NON-NLS-1$
- }
- int size = prop.size();
- for (int i = 0; i < size; i++) {
- String urlMappingValue = ((String[]) prop.get(i))[0];
- if (!UrlPattern.isValid(urlMappingValue))
- return urlMappingValue;
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * This method will return the list of servlet interfaces to be implemented
- * for the new servlet java class. It will intialize the list using lazy
- * initialization to the minimum interfaces required by the data model
- * SERVLET_INTERFACES. This method will not return null.
- *
- * @see #SERVLET_INTERFACES
- *
- * @return List of servlet interfaces to be implemented
- */
- private List getServletInterfaces() {
- if (interfaceList == null) {
- interfaceList = new ArrayList();
- // Add minimum required list of servlet interfaces to be implemented
- for (int i = 0; i < SERVLET_INTERFACES.length; i++) {
- interfaceList.add(SERVLET_INTERFACES[i]);
- }
- // Remove the javax.servlet.Servlet interface from the list if the
- // superclass already implements it
- if (ServletSupertypesValidator.isServletSuperclass(model)) {
- interfaceList.remove(QUALIFIED_SERVLET);
- }
- }
- // Return interface list
- return interfaceList;
- }
-
- /**
- * This method is intended for internal use only. This will validate whether
- * the display name selected is a valid display name for the servlet in the
- * specified web application. It will make sure the name is not empty and
- * that it doesn't already exist in the web app. This method will accept
- * null as a parameter. It will not return null.
- *
- * @see NewServletClassDataModelProvider#validate(String)
- *
- * @param prop
- * @return IStatus is servlet display name valid?
- */
- private IStatus validateDisplayName(String prop) {
- // Ensure the servlet display name is not null or empty
- if (prop == null || prop.trim().length() == 0) {
- String msg = WebMessages.ERR_DISPLAY_NAME_EMPTY;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- if (getTargetProject() == null || getTargetComponent() == null)
- return WTPCommonPlugin.OK_STATUS;
-
- IModelProvider provider = ModelProviderManager.getModelProvider(getTargetProject());
- Object mObj = provider.getModelObject();
- if (mObj instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) mObj;
-
- List servlets = webApp.getServlets();
- boolean exists = false;
- // Ensure the display does not already exist in the web application
- if (servlets != null && !servlets.isEmpty()) {
- for (int i = 0; i < servlets.size(); i++) {
- String name = ((org.eclipse.jst.j2ee.webapplication.Servlet) servlets.get(i)).getServletName();
- if (prop.equals(name))
- exists = true;
- }
- }
- // If the servlet name already exists, throw an error
- if (exists) {
- String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_NAME_EXIST, new String[]{prop});
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- } else if (mObj instanceof org.eclipse.jst.javaee.web.WebApp) {
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) mObj;
-
- List servlets = webApp.getServlets();
- boolean exists = false;
- // Ensure the display does not already exist in the web application
- if (servlets != null && !servlets.isEmpty()) {
- for (int i = 0; i < servlets.size(); i++) {
- String name = ((org.eclipse.jst.javaee.web.Servlet) servlets.get(i)).getServletName();
- if (prop.equals(name))
- exists = true;
- }
- }
- // If the servlet name already exists, throw an error
- if (exists) {
- String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_NAME_EXIST, new String[]{prop});
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
-
- // Otherwise, return OK
- return WTPCommonPlugin.OK_STATUS;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java
deleted file mode 100644
index 72b180949..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 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
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * The NewServletClassOperation is an IDataModelOperation following the
- * IDataModel wizard and operation framework.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- *
- * It extends ArtifactEditProviderOperation to provide servlet specific java
- * class generation.
- * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
- *
- * This operation is used by the AddServletOperation to generate either an
- * annotated or non annotated java class for an added servlet. It shares the
- * NewServletClassDataModelProvider with the AddServletOperation to store the
- * appropriate properties required to generate the new servlet.
- * @see org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation
- * @see org.eclipse.jst.j2ee.internal.web.operations.NewServletClassDataModelProvider
- *
- * In the annotated case, a WTPJetEmitter servlet template is created and used
- * to generate the servlet java class with the embedded annotated tags.
- * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
- * @see org.eclipse.jst.j2ee.internal.web.operations.CreateServletTemplateModel
- *
- * In the non annotated case, the same emitter is used to create the class with
- * the non annotated servlet template so the annotated tags are omitted.
- *
- * Subclasses may extend this operation to provide their own specific servlet
- * java class generation. The execute method may be extended to do so. Also,
- * generateUsingTemplates is exposed.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class NewServletClassOperation extends NewWebClassOperation {
-
- /**
- * folder location of the servlet creation templates diretory
- */
- protected static final String TEMPLATE_DIR = "/templates/"; //$NON-NLS-1$
-
- /**
- * location of the servlet creation template file
- */
- protected static final String TEMPLATE_FILE = "/templates/servlet.javajet"; //$NON-NLS-1$
-
- /**
- * This is the constructor which should be used when creating a
- * NewServletClassOperation. An instance of the NewServletClassDataModel
- * should be passed in. This does not accept null parameter. It will not
- * return null.
- *
- * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
- * @see NewServletClassDataModel
- *
- * @param dataModel
- * @return NewServletClassOperation
- */
- public NewServletClassOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- /**
- * This method will create an instance of the CreateServletTemplate model to
- * be used in conjunction with the WTPJETEmitter. This method will not
- * return null.
- *
- * @see CreateServletTemplateModel
- * @see NewServletClassOperation#generateUsingTemplates(IProgressMonitor,
- * IPackageFragment)
- *
- * @return CreateServletTemplateModel
- */
- @Override
- protected CreateServletTemplateModel createTemplateModel() {
- return new CreateServletTemplateModel(model);
- }
-
- @Override
- protected String getTemplateFile() {
- return TEMPLATE_FILE;
- }
-
- @Override
- protected ServletTemplate getTemplateImplementation() {
- return ServletTemplate.create(null);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
deleted file mode 100644
index 54e84c0bd..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CONSTRUCTOR;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.MODIFIER_ABSTRACT;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.MODIFIER_PUBLIC;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SOURCE_FOLDER;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.JAVA_EE_VERSION;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.REGISTER_IN_WEB_XML;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-
-import java.io.File;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
-import org.eclipse.wst.common.componentcore.internal.util.FacetedProjectUtilities;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-
-/**
- * The NewWebClassDataModelProvider is a subclass of
- * NewJavaClassDataModelProvider and follows the IDataModel Operation and Wizard
- * frameworks.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- *
- * This data model provider is a subclass of the NewJavaClassDataModelProvider,
- * which stores base properties necessary in the creation of a default java
- * class.
- * @see org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider
- *
- * The NewWebClassDataModelProvider provides more specific properties for java
- * class creation that are required in creating a web artifact java class. The
- * data model provider is used to store these values for the
- * AddWebClassOperation.
- * @see org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties
- * That operation will create the web artifact java class based on the
- * settings defined here in the data model.
- * @see org.eclipse.jst.j2ee.internal.web.operations.AddWebClassOperation
- *
- * This data model properties implements the IAnnotationsDataModel to get the
- * USE_ANNOTATIONS property for determining whether or not to generate an
- * annotated java class.
- * @see org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel
- *
- * Clients can subclass this data model provider to cache and provide their own
- * specific attributes. They should also provide their own validation methods,
- * properties interface, and default values for the properties they add.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public abstract class NewWebClassDataModelProvider extends NewJavaClassDataModelProvider {
-
- /**
- * The fully qualified default superclass.
- */
- private final static String DEFAULT_SUPERCLASS = ""; //$NON-NLS-1$
-
- /**
- * The cache of all the interfaces the web artifact java class will
- * implement.
- */
- protected List interfaceList;
-
- private String classNameCache = ""; //$NON-NLS-1$
- private String existingClassNameCache = ""; //$NON-NLS-1$
-
- private static boolean useAnnotations = false;
-
- /**
- * Subclasses may extend this method to provide their own determination of
- * whether or not certain properties should be disabled or enabled. This
- * method does not accept null parameter. It will not return null. This
- * implementation makes sure annotation support is only allowed on web
- * projects of J2EE version 1.3 or higher.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#isPropertyEnabled(String)
- * @see IAnnotationsDataModel#USE_ANNOTATIONS
- *
- * @param propertyName
- * @return boolean should property be enabled?
- */
- @Override
- public boolean isPropertyEnabled(String propertyName) {
- // Annotations should only be enabled on a valid j2ee project of version 1.3 or higher
- if (USE_ANNOTATIONS.equals(propertyName)) {
- return !getBooleanProperty(USE_EXISTING_CLASS) && isAnnotationsSupported();
- } else if (MODIFIER_PUBLIC.equals(propertyName)) {
- return false;
- } else if (MODIFIER_ABSTRACT.equals(propertyName)) {
- return false;
- } else if (CONSTRUCTOR.equals(propertyName)) {
- return hasSuperClass();
- }
- // Otherwise return super implementation
- return super.isPropertyEnabled(propertyName);
- }
-
- /**
- * Subclasses may extend this method to add their own data model's
- * properties as valid base properties.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#getPropertyNames()
- */
- @Override
- public Set getPropertyNames() {
- // Add web artifact specific properties defined in this data model
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(REGISTER_IN_WEB_XML);
- propertyNames.add(DISPLAY_NAME);
- propertyNames.add(DESCRIPTION);
- propertyNames.add(USE_EXISTING_CLASS);
- propertyNames.add(USE_ANNOTATIONS);
- propertyNames.add(JAVA_EE_VERSION);
-
- return propertyNames;
- }
-
- /**
- * Subclasses may extend this method to provide their own default values for
- * any of the properties in the data model hierarchy. This method does not
- * accept a null parameter. It may return null. This implementation sets
- * annotation use to be true.
- *
- * @see NewJavaClassDataModelProvider#getDefaultProperty(String)
- * @see IDataModelProvider#getDefaultProperty(String)
- *
- * @param propertyName
- * @return Object default value of property
- */
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(DISPLAY_NAME))
- return Signature.getSimpleName(getStringProperty(CLASS_NAME));
- else if (propertyName.equals(USE_ANNOTATIONS))
- return shouldDefaultAnnotations();
- else if (propertyName.equals(SUPERCLASS))
- return DEFAULT_SUPERCLASS;
- else if (propertyName.equals(USE_EXISTING_CLASS))
- return Boolean.FALSE;
- else if (propertyName.equals(CONSTRUCTOR))
- return hasSuperClass();
- else if (propertyName.equals(REGISTER_IN_WEB_XML)){
- return !isJavaEE6Project();
- } else if (JAVA_EE_VERSION.equals(propertyName)){
- return getJavaEEVersion();
- }
- // Otherwise check super for default value for property
- return super.getDefaultProperty(propertyName);
- }
-
- @SuppressWarnings("restriction")
- public boolean isJavaEE6Project() {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
- if (project != null && project.isAccessible()){
- try {
- return (FacetedProjectFramework.hasProjectFacet(project, WebFacetUtils.WEB_FACET.getId(), WebFacetUtils.WEB_30.getVersionString())
- || FacetedProjectFramework.hasProjectFacet(project, WebFacetUtils.WEBFRAGMENT_FACET.getId(), WebFacetUtils.WEBFRAGMENT_30.getVersionString()));
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- return false;
- }
-
- @SuppressWarnings("restriction")
- public String getJavaEEVersion() {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
- String id = null;
- if(JavaEEProjectUtilities.isDynamicWebProject(project)){
- id = WebFacetUtils.WEB_FACET.getId();
- }else {
- id = WebFacetUtils.WEBFRAGMENT_FACET.getId();
- }
- return FacetedProjectUtilities.getProjectFacetVersion(project, id).getVersionString();
- }
-
- /**
- * Subclasses may extend this method to add their own specific behavior when
- * a certain property in the data model hierarchy is set. this method does
- * not accept null for the property name, but it will for propertyValue. It
- * will not return null. It will return false if the set fails. This
- * implementation verifies the display name is set to the class name, that
- * the annotations is disabled/enabled properly, and that the target project
- * name is determined from the source folder setting.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#propertySet(String,
- * Object)
- *
- * @param propertyName
- * @param propertyValue
- * @return boolean was property set?
- */
- @Override
- public boolean propertySet(String propertyName, Object propertyValue) {
- // If annotations is changed, notify an enablement change
- if (propertyName.equals(USE_ANNOTATIONS)) {
- useAnnotations = ((Boolean) propertyValue).booleanValue();
- if (useAnnotations && !isAnnotationsSupported())
- return true;
- model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
- }
- // If the source folder is changed, ensure we have the correct project name
- if (propertyName.equals(SOURCE_FOLDER)) {
- // Get the project name from the source folder name
- String sourceFolder = (String) propertyValue;
- int index = sourceFolder.indexOf(File.separator);
- String projectName = sourceFolder;
- if (index == 0)
- projectName = sourceFolder.substring(1);
- index = projectName.indexOf(File.separator);
- if (index != -1) {
- projectName = projectName.substring(0, index);
- setProperty(PROJECT_NAME, projectName);
- }
- }
- // Call super to set the property on the data model
- boolean result = super.propertySet(propertyName, propertyValue);
- // If class name is changed, update the display name to be the same
- if (propertyName.equals(CLASS_NAME) && !model.isPropertySet(DISPLAY_NAME)) {
- model.notifyPropertyChange(DISPLAY_NAME, IDataModel.DEFAULT_CHG);
- }
- // After the property is set, if project changed, update the nature and the annotations
- // enablement
- if (propertyName.equals(COMPONENT_NAME)) {
- model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
- }
- // After property is set, if annotations is set to true, update its value based on the new
- // level of the project
- if (getBooleanProperty(USE_ANNOTATIONS)) {
- if (!isAnnotationsSupported())
- setBooleanProperty(USE_ANNOTATIONS, false);
- }
- if (propertyName.equals(USE_EXISTING_CLASS)) {
- model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
-
- if (((Boolean) propertyValue).booleanValue()) {
- classNameCache = getStringProperty(CLASS_NAME);
- setProperty(CLASS_NAME, existingClassNameCache);
- } else {
- existingClassNameCache = getStringProperty(CLASS_NAME);
- setProperty(CLASS_NAME, classNameCache);
- }
- }
- // if super class is changed, notify the constructor checkbox to update
- // its enabled state
- if (SUPERCLASS.equals(propertyName)) {
- model.notifyPropertyChange(CONSTRUCTOR, IDataModel.ENABLE_CHG);
- if (!hasSuperClass()) {
- model.setProperty(CONSTRUCTOR, null);
- }
- model.notifyPropertyChange(CONSTRUCTOR, IDataModel.DEFAULT_CHG);
- }
-
- // Return whether property was set
- return result;
- }
-
- /**
- * This method is used to determine if annotations should try to enable
- * based on workspace settings
- *
- * @return does any valid annotation provider or xdoclet handler exist
- */
- //TODO add this method back in for defect 146696
-// protected boolean isAnnotationProviderDefined() {
-// boolean isControllerEnabled = AnnotationsControllerManager.INSTANCE.isAnyAnnotationsSupported();
-// final String preferred = AnnotationPreferenceStore.getProperty(AnnotationPreferenceStore.ANNOTATIONPROVIDER);
-// IAnnotationProvider annotationProvider = null;
-// boolean isProviderEnabled = false;
-// if (preferred != null) {
-// try {
-// annotationProvider = AnnotationUtilities.findAnnotationProviderByName(preferred);
-// } catch (Exception ex) {
-// //Default
-// }
-// if (annotationProvider != null && annotationProvider.isValid())
-// isProviderEnabled = true;
-// }
-// return isControllerEnabled || isProviderEnabled;
-// }
-
- /**
- * This method checks to see if valid annotation providers exist and if
- * valid project version levels exist.
- *
- * @return should annotations be supported for this project in this
- * workspace
- */
- protected boolean isAnnotationsSupported() {
- //TODO add this check back in for defect 146696
-// if (!isAnnotationProviderDefined())
-// return false;
- if (!model.isPropertySet(PROJECT_NAME))
- return true;
- if (getStringProperty(PROJECT_NAME).equals("")) //$NON-NLS-1$
- return true;
- IProject project = ProjectUtilities.getProject(getStringProperty(PROJECT_NAME));
- String moduleName = getStringProperty(COMPONENT_NAME);
- if (project == null || moduleName == null || moduleName.equals(""))return true; //$NON-NLS-1$
- int j2eeVersion = J2EEVersionUtil.convertVersionStringToInt(J2EEProjectUtilities.getJ2EEProjectVersion(project));
-
- return j2eeVersion > J2EEVersionConstants.VERSION_1_2;
-
- }
-
- /**
- * Subclasses may extend this method to provide their own validation on any
- * of the valid data model properties in the hierarchy. It does not accept a
- * null parameter. This method will not return null.
- *
- * @see NewJavaClassDataModelProvider#validate(String)
- *
- * @param propertyName
- * @return IStatus is property value valid?
- */
- @Override
- public IStatus validate(String propertyName) {
- if (propertyName.equals(SUPERCLASS)) {
- // If our default is the superclass, we know it is ok
- if (getStringProperty(propertyName).equals(DEFAULT_SUPERCLASS))
- return WTPCommonPlugin.OK_STATUS;
- }
-
- if (propertyName.equals(CLASS_NAME)) {
- if (getStringProperty(propertyName).length() !=0 && getBooleanProperty(USE_EXISTING_CLASS)) {
- return WTPCommonPlugin.OK_STATUS;
- }
- }
-
- // Otherwise defer to super to validate the property
- return super.validate(propertyName);
- }
-
- /**
- * This method is intended for internal use only. It provides a simple
- * algorithm for detecting if there are duplicate entries in a list. It will
- * accept a null parameter. It will not return null.
- *
- * @see NewWebClassDataModelProvider#validateInitParamList(List)
- * @see NewWebClassDataModelProvider#validateURLMappingList(List)
- *
- * @param input
- * @return boolean are there dups in the list?
- */
- protected boolean hasDuplicatesInStringArrayList(List input) {
- // If list is null or empty return false
- if (input == null)
- return false;
- int n = input.size();
- boolean dup = false;
- // nested for loops to check each element to see if other elements are the same
- for (int i = 0; i < n; i++) {
- String[] sArray1 = (String[]) input.get(i);
- for (int j = i + 1; j < n; j++) {
- String[] sArray2 = (String[]) input.get(j);
- if (isTwoStringArraysEqual(sArray1, sArray2)) {
- dup = true;
- break;
- }
- }
- if (dup)
- break;
- }
- // Return boolean status for duplicates
- return dup;
- }
-
- /**
- * This method is intended for internal use only. This checks to see if the
- * two string arrays are equal. If either of the arrays are null or empty,
- * it returns false.
- *
- * @see NewWebClassDataModelProvider#hasDuplicatesInStringArrayList(List)
- *
- * @param sArray1
- * @param sArray2
- * @return boolean are Arrays equal?
- */
- protected boolean isTwoStringArraysEqual(String[] sArray1, String[] sArray2) {
- // If either array is null, return false
- if (sArray1 == null || sArray2 == null)
- return false;
- int n1 = sArray1.length;
- int n2 = sArray1.length;
- // If either array is empty, return false
- if (n1 == 0 || n2 == 0)
- return false;
- // If they don't have the same length, return false
- if (n1 != n2)
- return false;
- // If their first elements do not match, return false
- if (!sArray1[0].equals(sArray2[0]))
- return false;
- // Otherwise return true
- return true;
- }
-
- protected boolean hasSuperClass() {
- String superClass = model.getStringProperty(SUPERCLASS);
- return (superClass == null) ? false : superClass.trim().length() > 0;
- }
-
- /**
- * @return boolean should the default annotations be true?
- */
- private static Boolean shouldDefaultAnnotations() {
- if (useAnnotations)
- return Boolean.TRUE;
- return Boolean.FALSE;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java
deleted file mode 100644
index 0cb28f7e3..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
-
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jst.common.internal.annotations.controller.AnnotationsController;
-import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager;
-import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager.Descriptor;
-import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * The NewWebClassOperation is an IDataModelOperation following the IDataModel
- * wizard and operation framework.
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- *
- * It extends AbstractDataModelOperation to provide web artifact specific java
- * class generation.
- * @see AbstractDataModelOperation
- *
- * This operation is used by the AddWebClassOperation to generate either an
- * annotated or non annotated java class for an added web artifact. It shares
- * the NewWebClassDataModelProvider with the AddWebClassOperation to store the
- * appropriate properties required to generate the new web artifact.
- *
- * @see AddWebClassOperation
- * @see NewWebClassDataModelProvider
- *
- * In the annotated case, a WTPJetEmitter listener template is created and used
- * to generate the listener java class with the embedded annotated tags.
- * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
- * @see CreateWebClassTemplateModel
- *
- * In the non annotated case, the same emitter is used to create the class with
- * the non annotated web artifact template so the annotated tags are omitted.
- *
- * Subclasses may extend this operation to provide their own specific web
- * artifact java class generation. The execute method may be extended to do so.
- * Also, generateUsingTemplates is exposed.
- *
- * The use of this class is EXPERIMENTAL and is subject to substantial changes.
- */
-public abstract class NewWebClassOperation extends NewJavaEEArtifactClassOperation {
-
- /**
- * XDoclet facet constants
- */
- private static final String JST_WEB_XDOCLET_VERSION = "1.2.3"; //$NON-NLS-1$
-
- /**
- * variable for the web plugin
- */
- protected static final String WEB_PLUGIN = "WEB_PLUGIN"; //$NON-NLS-1$
-
- /**
- * This is the constructor which should be used when creating a
- * NewWebClassOperation. An instance of the NewWebClassDataModel should be
- * passed in. This does not accept null parameter. It will not return null.
- *
- * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
- * @see NewListenerClassDataModel
- *
- * @param dataModel
- * @return NewListenerClassOperation
- */
- public NewWebClassOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- /**
- * Subclasses may extend this method to provide their own template based
- * creation of an annotated web artifact java class file. This implementation
- * uses the creation of a CreateWebClassTemplateModel and the WTPJetEmitter
- * to create the java class with the annotated tags. This method accepts
- * null for monitor, it does not accept null for fragment. If annotations
- * are not being used the tags will be omitted from the class.
- *
- * @see CreateWebClassTemplateModel
- * @see #generateTemplateSource(CreateWebClassTemplateModel, IProgressMonitor)
- *
- * @param monitor
- * @param fragment
- * @throws CoreException
- * @throws WFTWrappedException
- */
- @Override
- protected void generateUsingTemplates(IProgressMonitor monitor, IPackageFragment fragment) throws WFTWrappedException, CoreException {
- // Create the web artifact template model
- CreateWebClassTemplateModel tempModel = createTemplateModel();
- IProject project = getTargetProject();
- String source;
- try {
- // generate the java source based on the template model
- source = generateTemplateSource(WebPlugin.getPlugin(), tempModel, getTemplateFile(), getTemplateImplementation(), monitor);
- } catch (Exception e) {
- throw new WFTWrappedException(e);
- }
- if (fragment != null) {
- // Create the java file
- String javaFileName = tempModel.getClassName() + DOT_JAVA;
- ICompilationUnit cu = fragment.getCompilationUnit(javaFileName);
- // Add the compilation unit to the java file
- if (cu == null || !cu.exists())
- cu = fragment.createCompilationUnit(javaFileName, source, true, monitor);
- IFile aFile = (IFile) cu.getResource();
- // Let the annotations controller process the annotated resource
- AnnotationsController controller = AnnotationsControllerManager.INSTANCE.getAnnotationsController(project);
- if (controller != null)
- controller.process(aFile);
- }
-
- // Add the xdoclet facet, if necessary, for xdoclet listener creation
- try {
- installXDocletFacetIfNecessary(monitor, project);
- } catch (Exception e) {
- throw new WFTWrappedException(e);
- }
- }
-
- /**
- * This method is intended for internal use only. This will add an webdoclet facet to the project.
- *
- * @throws CoreException
- * @throws ExecutionException
- */
- private void installXDocletFacet(IProgressMonitor monitor, IProject project) throws CoreException, ExecutionException {
- IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- Set fixedFacets = facetedProject.getFixedProjectFacets();
- IDataModel dm = DataModelFactory.createDataModel(new FacetInstallDataModelProvider());
- dm.setProperty(IFacetDataModelProperties.FACET_ID, IJ2EEFacetConstants.DYNAMIC_WEB_XDOCLET);
- dm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, project.getName());
- dm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JST_WEB_XDOCLET_VERSION);
- IDataModel fdm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
- fdm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, project.getName());
-
- FacetDataModelMap map = (FacetDataModelMap) fdm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- map.add(dm);
-
- fdm.getDefaultOperation().execute(monitor, null);
- facetedProject.setFixedProjectFacets(fixedFacets);
- }
-
- /**
- * This method is intended for internal use only. This will check to see if it needs to add an
- * webdoclet facet to the project.
- *
- * @throws CoreException
- * @throws ExecutionException
- */
- private void installXDocletFacetIfNecessary(IProgressMonitor monitor, IProject project) throws CoreException, ExecutionException {
-
- // If not using annotations, ignore the xdoclet facet
- if (!model.getBooleanProperty(USE_ANNOTATIONS))
- return;
-
- // If an extended annotations processor is added, ignore the default xdoclet one
- Descriptor descriptor = AnnotationsControllerManager.INSTANCE.getDescriptor(getTargetComponent().getProject());
- if (descriptor != null)
- return;
-
- // Otherwise check and see if the xdoclet facet is on the project yet
- IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- if (!facetedProject.hasProjectFacet(WebFacetUtils.WEB_XDOCLET_FACET))
- return;
-
- // Install xdoclet facet
- installXDocletFacet(monitor, project);
- }
-
- /**
- * This method will create an instance of the CreateWebClassTemplateModel to
- * be used in conjunction with the WTPJETEmitter. This method will not
- * return null.
- *
- * @see CreateWebClassTemplateModel
- * @see NewWebClassOperation#generateUsingTemplates(IProgressMonitor,
- * IPackageFragment)
- *
- * @return CreateWebClassTemplateModel
- */
- protected abstract CreateWebClassTemplateModel createTemplateModel();
-
- /**
- * This method will return the location of the template file that will be
- * passed to the WTPJETEmitter to generate the template implementation
- * class.
- *
- * @return path to the template file.
- */
- protected abstract String getTemplateFile();
-
- /**
- * This method will return an instance of the template implementation class
- * that is statically compiled in the plugin. This instance can be used to
- * generate the artifact's code without using the WTPJETEmitter.
- *
- * @return an instance of the template implementation class.
- */
- protected abstract Object getTemplateImplementation();
-
- private IVirtualComponent getTargetComponent() {
- return ComponentCore.createComponent(getTargetProject());
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletSupertypesValidator.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletSupertypesValidator.java
deleted file mode 100644
index a911a6f55..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletSupertypesValidator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_GENERIC_SERVLET;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class ServletSupertypesValidator extends AbstractSupertypesValidator {
-
- public static boolean isHttpServletSuperclass(IDataModel dataModel) {
- if (QUALIFIED_HTTP_SERVLET.equals(getSuperclass(dataModel)))
- return true;
-
- if (hasSuperclass(dataModel, getSuperclass(dataModel), QUALIFIED_HTTP_SERVLET))
- return true;
-
- return false;
- }
-
- public static boolean isGenericServletSuperclass(IDataModel dataModel) {
- if (QUALIFIED_HTTP_SERVLET.equals(getSuperclass(dataModel)))
- return true;
-
- if (QUALIFIED_GENERIC_SERVLET.equals(getSuperclass(dataModel)))
- return true;
-
- if (hasSuperclass(dataModel, getSuperclass(dataModel), QUALIFIED_GENERIC_SERVLET))
- return true;
-
- return false;
- }
-
- public static boolean isServletSuperclass(IDataModel dataModel) {
- if (QUALIFIED_HTTP_SERVLET.equals(getSuperclass(dataModel)))
- return true;
-
- if (QUALIFIED_GENERIC_SERVLET.equals(getSuperclass(dataModel)))
- return true;
-
- if (getInterfaces(dataModel).contains(QUALIFIED_SERVLET))
- return true;
-
- if (hasSuperInterface(dataModel, getSuperclass(dataModel), QUALIFIED_SERVLET))
- return true;
-
- for (Object iface : getInterfaces(dataModel)) {
- if (hasSuperInterface(dataModel, (String) iface, QUALIFIED_SERVLET))
- return true;
- }
-
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java
deleted file mode 100644
index 3a4dd8732..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 SAP AG 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
- *
- * This class has been generated from a javajet template.
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.*;
-import org.eclipse.jst.j2ee.internal.common.operations.*;
-
-public class ServletTemplate
-{
- protected static String nl;
- public static synchronized ServletTemplate create(String lineSeparator)
- {
- nl = lineSeparator;
- ServletTemplate result = new ServletTemplate();
- nl = null;
- return result;
- }
-
- public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
- protected final String TEXT_1 = "package "; //$NON-NLS-1$
- protected final String TEXT_2 = ";"; //$NON-NLS-1$
- protected final String TEXT_3 = NL;
- protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
- protected final String TEXT_5 = ";"; //$NON-NLS-1$
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "/**" + NL + " * Servlet implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_9 = NL + " *" + NL + " * @web.servlet" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_10 = "\"" + NL + " * display-name=\""; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_11 = "\""; //$NON-NLS-1$
- protected final String TEXT_12 = NL + " * description=\""; //$NON-NLS-1$
- protected final String TEXT_13 = "\""; //$NON-NLS-1$
- protected final String TEXT_14 = NL + " *" + NL + " * @web.servlet-mapping" + NL + " * url-pattern=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_15 = "\""; //$NON-NLS-1$
- protected final String TEXT_16 = NL + " *" + NL + " * @web.servlet-init-param" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_17 = "\"" + NL + " * value=\""; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_18 = "\""; //$NON-NLS-1$
- protected final String TEXT_19 = NL + " * description=\""; //$NON-NLS-1$
- protected final String TEXT_20 = "\""; //$NON-NLS-1$
- protected final String TEXT_21 = NL + " */"; //$NON-NLS-1$
- protected final String TEXT_22 = NL + "@WebServlet"; //$NON-NLS-1$
- protected final String TEXT_23 = "(\""; //$NON-NLS-1$
- protected final String TEXT_24 = "\")"; //$NON-NLS-1$
- protected final String TEXT_25 = "({ "; //$NON-NLS-1$
- protected final String TEXT_26 = ", "; //$NON-NLS-1$
- protected final String TEXT_27 = "\""; //$NON-NLS-1$
- protected final String TEXT_28 = "\""; //$NON-NLS-1$
- protected final String TEXT_29 = " })"; //$NON-NLS-1$
- protected final String TEXT_30 = "("; //$NON-NLS-1$
- protected final String TEXT_31 = ", "; //$NON-NLS-1$
- protected final String TEXT_32 = NL + "\t\t"; //$NON-NLS-1$
- protected final String TEXT_33 = " = \""; //$NON-NLS-1$
- protected final String TEXT_34 = "\""; //$NON-NLS-1$
- protected final String TEXT_35 = " = { "; //$NON-NLS-1$
- protected final String TEXT_36 = ", "; //$NON-NLS-1$
- protected final String TEXT_37 = NL + "\t\t\t\t"; //$NON-NLS-1$
- protected final String TEXT_38 = "\""; //$NON-NLS-1$
- protected final String TEXT_39 = "\""; //$NON-NLS-1$
- protected final String TEXT_40 = NL + "\t\t"; //$NON-NLS-1$
- protected final String TEXT_41 = " "; //$NON-NLS-1$
- protected final String TEXT_42 = "}"; //$NON-NLS-1$
- protected final String TEXT_43 = " = { "; //$NON-NLS-1$
- protected final String TEXT_44 = ", "; //$NON-NLS-1$
- protected final String TEXT_45 = NL + "\t\t\t\t@WebInitParam(name = \""; //$NON-NLS-1$
- protected final String TEXT_46 = "\", value = \""; //$NON-NLS-1$
- protected final String TEXT_47 = "\""; //$NON-NLS-1$
- protected final String TEXT_48 = ", description = \""; //$NON-NLS-1$
- protected final String TEXT_49 = "\""; //$NON-NLS-1$
- protected final String TEXT_50 = ")"; //$NON-NLS-1$
- protected final String TEXT_51 = NL + "\t\t}"; //$NON-NLS-1$
- protected final String TEXT_52 = ")"; //$NON-NLS-1$
- protected final String TEXT_53 = NL + "public "; //$NON-NLS-1$
- protected final String TEXT_54 = "abstract "; //$NON-NLS-1$
- protected final String TEXT_55 = "final "; //$NON-NLS-1$
- protected final String TEXT_56 = "class "; //$NON-NLS-1$
- protected final String TEXT_57 = " extends "; //$NON-NLS-1$
- protected final String TEXT_58 = " implements "; //$NON-NLS-1$
- protected final String TEXT_59 = ", "; //$NON-NLS-1$
- protected final String TEXT_60 = " {"; //$NON-NLS-1$
- protected final String TEXT_61 = NL + "\tprivate static final long serialVersionUID = 1L;"; //$NON-NLS-1$
- protected final String TEXT_62 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- protected final String TEXT_63 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_64 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_65 = "#"; //$NON-NLS-1$
- protected final String TEXT_66 = "("; //$NON-NLS-1$
- protected final String TEXT_67 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_68 = "("; //$NON-NLS-1$
- protected final String TEXT_69 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_70 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_71 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_72 = "#"; //$NON-NLS-1$
- protected final String TEXT_73 = "("; //$NON-NLS-1$
- protected final String TEXT_74 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_75 = " "; //$NON-NLS-1$
- protected final String TEXT_76 = "("; //$NON-NLS-1$
- protected final String TEXT_77 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_78 = NL + "\t\t\treturn "; //$NON-NLS-1$
- protected final String TEXT_79 = ";"; //$NON-NLS-1$
- protected final String TEXT_80 = NL + " }"; //$NON-NLS-1$
- protected final String TEXT_81 = NL + NL + "\t/**" + NL + "\t * @see Servlet#init(ServletConfig)" + NL + "\t */" + NL + "\tpublic void init(ServletConfig config) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_82 = NL + NL + "\t/**" + NL + "\t * @see Servlet#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_83 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletConfig()" + NL + "\t */" + NL + "\tpublic ServletConfig getServletConfig() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null;" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- protected final String TEXT_84 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletInfo()" + NL + "\t */" + NL + "\tpublic String getServletInfo() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null; " + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- protected final String TEXT_85 = NL + NL + "\t/**" + NL + "\t * @see Servlet#service(ServletRequest request, ServletResponse response)" + NL + "\t */" + NL + "\tpublic void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_86 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_87 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_88 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_89 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_90 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_91 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_92 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_93 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- protected final String TEXT_94 = NL + NL + "}"; //$NON-NLS-1$
- protected final String TEXT_95 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
- CreateServletTemplateModel model = (CreateServletTemplateModel) argument;
-
- model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME);
-
-
- if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) {
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append( model.getJavaPackageName() );
- stringBuffer.append(TEXT_2);
-
- }
-
- stringBuffer.append(TEXT_3);
-
- Collection<String> imports = model.getImports();
- for (String anImport : imports) {
-
- stringBuffer.append(TEXT_4);
- stringBuffer.append( anImport );
- stringBuffer.append(TEXT_5);
-
- }
-
- stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(TEXT_8);
- stringBuffer.append( model.getClassName() );
-
- if (model.isAnnotated()) {
-
- stringBuffer.append(TEXT_9);
- stringBuffer.append( model.getServletName() );
- stringBuffer.append(TEXT_10);
- stringBuffer.append( model.getServletName() );
- stringBuffer.append(TEXT_11);
-
- if (model.getDescription() != null && model.getDescription().length() > 0) {
-
- stringBuffer.append(TEXT_12);
- stringBuffer.append( model.getDescription() );
- stringBuffer.append(TEXT_13);
-
- }
-
- List<String[]> mappings = model.getServletMappings();
- if (mappings != null && mappings.size() > 0) {
- for (int i = 0; i < mappings.size(); i++) {
- String map = model.getServletMapping(i);
- stringBuffer.append(TEXT_14);
- stringBuffer.append( map );
- stringBuffer.append(TEXT_15);
-
- }
- }
- List<String[]> initParams = model.getInitParams();
- if (initParams != null && initParams.size() > 0) {
- for (int i = 0; i < initParams.size(); i++) {
- String name = model.getInitParam(i, CreateServletTemplateModel.NAME);
- String value = model.getInitParam(i, CreateServletTemplateModel.VALUE);
- String description = model.getInitParam(i, CreateServletTemplateModel.DESCRIPTION);
-
- stringBuffer.append(TEXT_16);
- stringBuffer.append( name );
- stringBuffer.append(TEXT_17);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_18);
-
- if (description != null && description.length() > 0) {
-
- stringBuffer.append(TEXT_19);
- stringBuffer.append( description );
- stringBuffer.append(TEXT_20);
-
- }
- }
- }
- }
-
- stringBuffer.append(TEXT_21);
-
- if ("3.0".equals(model.getJavaEEVersion())) { //$NON-NLS-1$
-
- stringBuffer.append(TEXT_22);
-
- Map<String, Object> params = model.getClassAnnotationParams();
- if (params.size() == 1 && params.containsKey(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
- List<String[]> mappings = (List<String[]>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS);
- if (mappings.size() == 1) {
- String value = mappings.get(0)[0];
-
- stringBuffer.append(TEXT_23);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_24);
-
- } else {
-
- stringBuffer.append(TEXT_25);
-
- boolean needComma = false;
- for (String[] mapping : mappings) {
- if (needComma) {
-
- stringBuffer.append(TEXT_26);
-
- }
-
- stringBuffer.append(TEXT_27);
- stringBuffer.append( mapping[0] );
- stringBuffer.append(TEXT_28);
-
- needComma = true;
- }
-
- stringBuffer.append(TEXT_29);
-
- }
- } else if (!params.isEmpty()) {
-
- stringBuffer.append(TEXT_30);
-
- Set<String> keys = params.keySet();
- boolean needNewLine = keys.contains(CreateServletTemplateModel.ATT_INIT_PARAMS) ||
- (keys.contains(CreateServletTemplateModel.ATT_URL_PATTERNS) &&
- ((List<String[]>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS)).size() > 1);
- boolean needComma = false;
- for (String key : keys) {
- if (needComma) {
-
- stringBuffer.append(TEXT_31);
-
- }
-
- if (needNewLine) {
-
- stringBuffer.append(TEXT_32);
-
- }
-
- if (key.equals(CreateServletTemplateModel.ATT_NAME) || key.equals(CreateServletTemplateModel.ATT_DESCRIPTION)) {
- String value = (String) params.get(key);
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_33);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_34);
-
- } else if (key.equals(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_35);
-
- List<String[]> mappings = (List<String[]>) params.get(key);
- boolean needComma2 = false;
- boolean needNewLine2 = mappings.size() > 1;
- for (String[] mapping : mappings) {
- if (needComma2) {
-
- stringBuffer.append(TEXT_36);
-
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_37);
-
- }
-
- stringBuffer.append(TEXT_38);
- stringBuffer.append( mapping[0] );
- stringBuffer.append(TEXT_39);
-
- needComma2 = true;
- }
-
- if (needNewLine2) {
-
- stringBuffer.append(TEXT_40);
-
- } else {
-
- stringBuffer.append(TEXT_41);
-
- }
-
- stringBuffer.append(TEXT_42);
-
- } else if (key.equals(CreateServletTemplateModel.ATT_INIT_PARAMS)) {
-
- stringBuffer.append( key );
- stringBuffer.append(TEXT_43);
-
- List<String[]> initParams = (List<String[]>) params.get(key);
- boolean needComma2 = false;
- for (String[] initParam : initParams) {
- if (needComma2) {
-
- stringBuffer.append(TEXT_44);
-
- }
-
- String name = initParam[CreateServletTemplateModel.NAME];
- String value = initParam[CreateServletTemplateModel.VALUE];
- String description = initParam[CreateServletTemplateModel.DESCRIPTION];
-
- stringBuffer.append(TEXT_45);
- stringBuffer.append( name );
- stringBuffer.append(TEXT_46);
- stringBuffer.append( value );
- stringBuffer.append(TEXT_47);
-
- if (description != null && description.length() > 0) {
-
- stringBuffer.append(TEXT_48);
- stringBuffer.append( description );
- stringBuffer.append(TEXT_49);
-
- }
-
- stringBuffer.append(TEXT_50);
-
- needComma2 = true;
- }
-
- stringBuffer.append(TEXT_51);
-
- }
-
- needComma = true;
- }
-
- stringBuffer.append(TEXT_52);
-
- }
- }
-
-
- if (model.isPublic()) {
-
- stringBuffer.append(TEXT_53);
-
- }
-
- if (model.isAbstract()) {
-
- stringBuffer.append(TEXT_54);
-
- }
-
- if (model.isFinal()) {
-
- stringBuffer.append(TEXT_55);
-
- }
-
- stringBuffer.append(TEXT_56);
- stringBuffer.append( model.getClassName() );
-
- String superClass = model.getSuperclassName();
- if (superClass != null && superClass.length() > 0) {
-
- stringBuffer.append(TEXT_57);
- stringBuffer.append( superClass );
-
- }
-
- List<String> interfaces = model.getInterfaces();
- if ( interfaces.size() > 0) {
-
- stringBuffer.append(TEXT_58);
-
- }
-
- for (int i = 0; i < interfaces.size(); i++) {
- String INTERFACE = interfaces.get(i);
- if (i > 0) {
-
- stringBuffer.append(TEXT_59);
-
- }
-
- stringBuffer.append( INTERFACE );
-
- }
-
- stringBuffer.append(TEXT_60);
-
- if (model.isGenericServletSuperclass()) {
-
- stringBuffer.append(TEXT_61);
-
- }
-
-
- if (!model.hasEmptySuperclassConstructor()) {
-
- stringBuffer.append(TEXT_62);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_63);
-
- }
-
- if (model.shouldGenSuperclassConstructors()) {
- List<Constructor> constructors = model.getConstructors();
- for (Constructor constructor : constructors) {
- if (constructor.isPublic() || constructor.isProtected()) {
-
- stringBuffer.append(TEXT_64);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_65);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_66);
- stringBuffer.append( constructor.getParamsForJavadoc() );
- stringBuffer.append(TEXT_67);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_68);
- stringBuffer.append( constructor.getParamsForDeclaration() );
- stringBuffer.append(TEXT_69);
- stringBuffer.append( constructor.getParamsForCall() );
- stringBuffer.append(TEXT_70);
-
- }
- }
- }
-
-
- if (model.shouldImplementAbstractMethods()) {
- for (Method method : model.getUnimplementedMethods()) {
-
- stringBuffer.append(TEXT_71);
- stringBuffer.append( method.getContainingJavaClass() );
- stringBuffer.append(TEXT_72);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_73);
- stringBuffer.append( method.getParamsForJavadoc() );
- stringBuffer.append(TEXT_74);
- stringBuffer.append( method.getReturnType() );
- stringBuffer.append(TEXT_75);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_76);
- stringBuffer.append( method.getParamsForDeclaration() );
- stringBuffer.append(TEXT_77);
-
- String defaultReturnValue = method.getDefaultReturnValue();
- if (defaultReturnValue != null) {
-
- stringBuffer.append(TEXT_78);
- stringBuffer.append( defaultReturnValue );
- stringBuffer.append(TEXT_79);
-
- }
-
- stringBuffer.append(TEXT_80);
-
- }
- }
-
- if (model.shouldGenInit()) {
- stringBuffer.append(TEXT_81);
- }
- if (model.shouldGenDestroy()) {
- stringBuffer.append(TEXT_82);
- }
- if (model.shouldGenGetServletConfig()) {
- stringBuffer.append(TEXT_83);
- }
- if (model.shouldGenGetServletInfo()) {
- stringBuffer.append(TEXT_84);
- }
- if (model.shouldGenService() && !model.isHttpServletSuperclass()) {
- stringBuffer.append(TEXT_85);
- }
- if (model.shouldGenService() && model.isHttpServletSuperclass()) {
- stringBuffer.append(TEXT_86);
- }
- if (model.shouldGenDoGet()) {
- stringBuffer.append(TEXT_87);
- }
- if (model.shouldGenDoPost()) {
- stringBuffer.append(TEXT_88);
- }
- if (model.shouldGenDoPut()) {
- stringBuffer.append(TEXT_89);
- }
- if (model.shouldGenDoDelete()) {
- stringBuffer.append(TEXT_90);
- }
- if (model.shouldGenDoHead()) {
- stringBuffer.append(TEXT_91);
- }
- if (model.shouldGenDoOptions()) {
- stringBuffer.append(TEXT_92);
- }
- if (model.shouldGenDoTrace()) {
- stringBuffer.append(TEXT_93);
- }
- stringBuffer.append(TEXT_94);
- stringBuffer.append(TEXT_95);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java
deleted file mode 100644
index 47dd11a8a..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 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
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jan 13, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.osgi.util.NLS;
-
-
-/**
- * @author jialin
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class WebMessages extends NLS {
- private static final String BUNDLE_NAME = "web";//$NON-NLS-1$
-
- private WebMessages() {
- // Do not instantiate
- }
-
- public static String ERR_JAR_NAME_EMPTY;
- public static String ERR_JAR_NAME_EXIST;
- public static String ERR_JAVA_PROJECT_NAME_EMPTY;
- public static String ERR_JAVA_PROJECT_NAME_EXIST;
- public static String ERR_DUPLICATED_INIT_PARAMETER;
- public static String ERR_DUPLICATED_URL_MAPPING;
-
- public static String ERR_SERVLET_MAPPING_URL_PATTERN_EXIST;
- public static String KEY_3;
- public static String KEY_4;
- public static String KEY_5;
- public static String KEY_6;
- public static String ERR_FILTER_PARAMETER_NAME_EXIST;
- public static String ERR_FILTER_MAPPING_SERVLET_EXIST;
- public static String ERR_FILTER_MAPPING_SERVLET_DISPATCHER_TYPES_EMPTY;
- public static String ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY;
- public static String ERR_URL_MAPPING_LIST_EMPTY;
- public static String ERR_URL_PATTERN_INVALID;
- public static String ERR_FILTER_MAPPING_EMPTY;
- public static String ERR_DISPLAY_NAME_EMPTY;
- public static String ERR_SERVLET_CLASS_NAME_USED;
- public static String ERR_SERVLET_JAVA_CLASS_NAME_INVALID;
- public static String ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST;
- public static String ERR_SERVLET_NAME_EXIST;
- public static String ERR_SERVLET_DISPLAY_NAME_EXIST;
- public static String ERR_SERVLET_PARAMETER_NAME_EMPTY;
- public static String ERR_SERVLET_PARAMETER_NAME_EXIST;
- public static String ERR_SERVLET_PARAMETER_VALUE_EMPTY;
- public static String ERR_SERVLET_PARAMETER_VALUE_EXIST;
- public static String ERR_SERVLET_ROLE_REF_NAME_EMPTY;
- public static String ERR_SERVLET_ROLE_REF_NAME_EXIST;
- public static String ERR_SERVLET_ROLE_LINK_EMPTY;
- public static String ERR_SERVLET_INTERFACE;
-
- public static String ERR_FILTER_DISPLAY_NAME_EXIST;
- public static String ERR_FILTER_NAME_EXIST;
- public static String ERR_FILTER_CLASS_NAME_USED;
- public static String ERR_FILTER_CLASS_NAME_INVALID;
- public static String ERR_LISTENER_DISPLAY_NAME_EXIST;
- public static String ERR_LISTENER_CLASS_NAME_USED;
- public static String ERR_LISTENER_CLASS_NAME_INVALID;
-
- public static String ERR_PAGE_ENCODING_EMPTY;
- public static String ERR_PAGE_ENCODING_EXIST;
- public static String ERR_URL_PATTERN_EXIST;
- public static String ERR_INCLUDE_PRELUDES_EXIST;
- public static String ERR_INCLUDE_CODAS_EXIST;
- public static String ERR_SECURITY_CONSTRAINT_NAME_EMPTY;
- public static String ERR_SECURITY_CONSTRAINT_NAME_EXIST;
- public static String ERR_CONTEXT_PARAMETER_NAME_EMPTY;
- public static String ERR_CONTEXT_PARAMETER_NAME_EXIST;
- public static String ERR_RESOURCE_NAME_EMPTY;
- public static String ERR_RESOURCE_NAME_EXIST;
- public static String ERR_URL_PATTERNS_EMPTY;
- public static String ERR_MIME_MAPPING_EXTENSION_EMPTY;
- public static String ERR_MIME_MAPPING_EXTENSION_EXIST;
- public static String ERR_WELCOME_PAGE_EMPTY;
- public static String ERR_WELCOME_PAGE_EXIST;
- public static String ERR_ENV_ENTRY_NAME_EMPTY;
- public static String ERR_ENV_ENTRY_NAME_EXIST;
- public static String ERR_ERROR_CODE_EMPTY;
- public static String ERR_ERROR_CODE_MUST_BE_3_DIGITS;
- public static String ERR_ERROR_PAGE_LOCATION_EMPTY;
- public static String ERR_ERROR_PAGE_LOCATION_EXIST;
- public static String ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH;
- public static String ERR_EXCEPTION_TYPE_EMPTY;
- public static String ERR_EXCEPTION_SECURITY_ID_NO_BEANS;
- public static String ERR_EXCEPTION_ROLE_NAME_EMPTY;
- public static String ERR_LOCALE_NAME_EMPTY;
- public static String ERR_LOCALE_NAME_EXIST;
- public static String ERR_TAGLIBREF_URL_EMPTY;
- public static String ERR_TAGLIBREF_URL_EXIST;
- public static String ERR_MESSAGE_DESTINATION_NAME_EMPTY;
- public static String ERR_MESSAGE_DESTINATION_NAME_EXIST;
- public static String ERR_EXCEPTION_METHOD_ELEMENT_EMPTY;
- public static String ERR_EXCEPTION_METHOD_TRANSACTION_ATTRIBUTES_EMPTY;
- public static String ERR_SERVLET_LIST_EMPTY;
- public static String ERR_FILTER_LIST_EMPTY;
- public static String ERR_LISTENER_LIST_EMPTY;
- public static String ERR_NO_LISTENER_SELECTED;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, WebMessages.class);
- }
-
- public static String getResourceString(String key, Object[] args) {
- return NLS.bind(key, args);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java
deleted file mode 100644
index ffc41ce85..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Sep 29, 2003
- *
- * To change the template for this generated file go to Window&gt;Preferences&gt;Java&gt;Code
- * Generation&gt;Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.web.plugin;
-
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.application.WebModule;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleExtensionImpl;
-import org.eclipse.jst.j2ee.internal.moduleextension.WebModuleExtension;
-import org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.WebFacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-
-public class WebModuleExtensionImpl extends EarModuleExtensionImpl implements WebModuleExtension {
-
- /**
- *
- */
- public WebModuleExtensionImpl() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#createProjectInfo()
- */
- public J2EEJavaProjectInfo createProjectInfo() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#addWLPProjects(org.eclipse.core.resources.IProject,
- * java.util.Set)
- */
- public void addWLPProjects(IProject aProject, Set projectsToBuild) {
- // J2EEWebNatureRuntime nature = J2EEWebNatureRuntime.getRuntime(aProject);
- // if (nature == null)
- // return;
- // ILibModule[] libModules = nature.getLibModules();
- // for (int i = 0; i < libModules.length; i++) {
- // IProject p = libModules[i].getProject();
- // if (p.isAccessible())
- // projectsToBuild.add(libModules[i].getProject());
- // }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#setContextRootForModuleMapping(org.eclipse.jst.j2ee.internal.internal.application.WebModule,
- * org.eclipse.core.resources.IProject)
- */
- public void setContextRootForModuleMapping(WebModule webModule, IProject nestedProject) throws CoreException {
- // TODO migrate to flex project
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#hasRuntime(org.eclipse.core.resources.IProject)
- */
- public boolean hasRuntime(IProject project) {
- // return J2EEWebNatureRuntimeUtilities.hasJ2EERuntime(project);
- // To do: work based on module
- return false;
- }
-
- // public J2EEImportOperationOLD createImportOperation(IProject
- // nestedProject, WARFile warFile, EARImportConfiguration importConfig){
- // WarImportOperation op = new WarImportOperation(nestedProject, warFile);
- // //op.setServerTarget(info.getServerTarget());
- // HashMap opMap = importConfig.createProjectOption;
- // if(opMap != null && !opMap.isEmpty())
- // op.createWLProjectOptions = opMap;
- // return op;
- // }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#getContentFolder(org.eclipse.core.resources.IProject,
- * org.eclipse.jst.j2ee.internal.internal.commonarchivecore.File)
- */
-
- public String getContentFolder(IProject project, IFile webSettingsFile) {
- return null;
- // To do: Needs work here, no content folder exists now
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#compareWebContextRoot(org.eclipse.jst.j2ee.internal.internal.application.Module,
- * org.eclipse.core.resources.IProject)
- */
- public boolean compareWebContextRoot(Module module, IProject project) throws CoreException {
- String contextRoot = ((WebModule) module).getContextRoot();
- if (contextRoot != null)
- return ((contextRoot).equals(getServerContextRoot(project)));
- return false;
- }
-
- protected String getServerContextRoot(IProject project) {
- // TODO migrate to flex project
- return ""; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createProjectDataModel()
- */
- public IDataModel createProjectDataModel() {
- return DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createImportDataModel()
- */
- public IDataModel createImportDataModel() {
- return DataModelFactory.createDataModel(new WebComponentImportDataModelProvider());
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
deleted file mode 100644
index 5761790b6..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.plugin;
-
-import java.io.IOException;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.web.util.WebEditAdapterFactory;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import java.lang.Throwable;
-
-
-/**
- * This is a top-level class of the j2ee plugin.
- *
- */
-
-public class WebPlugin extends WTPPlugin implements ResourceLocator {
- // Default instance of the receiver
- private static WebPlugin inst;
- protected final IPath iconsFolder = new Path(Platform.getBundle(PLUGIN_ID).getEntry("icons").getPath()); //$NON-NLS-1$
- // Links View part of the plugin
- //public static final String LINKS_BUILDER_ID =
- // "com.ibm.etools.links.management.linksbuilder";//$NON-NLS-1$
- public static final String LINKS_BUILDER_ID = "com.ibm.etools.webtools.additions.linksbuilder"; //$NON-NLS-1$
- // LibDir Change Listener
- public static final String LIBDIRCHANGE_BUILDER_ID = "com.ibm.etools.webtools.LibDirBuilder"; //$NON-NLS-1$
- public static final String PLUGIN_ID = "org.eclipse.jst.j2ee.web"; //$NON-NLS-1$
- // LibCopy builder ID
- public static final String LIBCOPY_BUILDER_ID = "org.eclipse.jst.j2ee.LibCopyBuilder"; //$NON-NLS-1$
- // Validation part of the plugin
- //Global ResourceSet (somewhat global)
- private static IPath location;
- public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$
- "icons/full/cview16", //$NON-NLS-1$
- "icons/full/ctool16", //$NON-NLS-1$
- "icons/full/clcl16", //$NON-NLS-1$
- "icons/full/ovr16", //$NON-NLS-1$
- "icons/full/extra", //$NON-NLS-1$
- "icons/full/wizban", //$NON-NLS-1$
- "icons", //$NON-NLS-1$
- ""}; //$NON-NLS-1$
-
- /**
- * Create the J2EE plugin and cache its default instance
- */
- public WebPlugin() {
- super();
- if (inst == null)
- inst = this;
- }
-
- /**
- * Get the plugin singleton.
- */
- static public WebPlugin getDefault() {
- return inst;
- }
-
- /*
- * Javadoc copied from interface.
- */
- public URL getBaseURL() {
- return getBundle().getEntry("/"); //$NON-NLS-1$
- }
-
- public Object[] getJ2EEWebProjectMigrationExtensions() {
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint pct = registry.getExtensionPoint(getBundle().getSymbolicName(), "J2EEWebProjectMigrationExtension"); //$NON-NLS-1$
-
- IExtension[] extension = pct.getExtensions();
- List ret = new Vector();
- for (int l = 0; l < extension.length; ++l) {
- IExtension config = extension[l];
-
- IConfigurationElement[] cElems = config.getConfigurationElements();
- for (int i = 0; i < cElems.length; i++) {
- IConfigurationElement d = cElems[i];
- if (d.getName().equals("migration")) { //$NON-NLS-1$
- try {
- Object me = d.createExecutableExtension("run"); //$NON-NLS-1$
-
- ret.add(me);
- } catch (Exception ex) {
- // ignore this extension, keep going
- }
- }
- }
- }
-
- return ret.toArray();
- }
-
- /**
- * This gets a .gif from the icons folder.
- */
- public Object getImage(String key) {
- return J2EEPlugin.getImageURL(key, getBundle());
- }
-
- // ISSUE: this method is never used in WTP. Seems no need to be API
- public static IPath getInstallLocation() {
- if (location == null) {
- String installLocation = getDefault().getBundle().getLocation();
- location = new Path(installLocation);
- }
- return location;
- }
-
- public static URL getInstallURL() {
- return getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
- }
-
- /**
- * Get the singleton instance.
- */
- public static WebPlugin getPlugin() {
- return inst;
- }
-
- /**
- * Return the plugin directory location- the directory that all the plugins are located in (i.e.
- * d:\installdir\plugin)
- */
- public static IPath getPluginLocation(String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle != null) {
- try {
- IPath installPath = new Path(bundle.getEntry("/").toExternalForm()).removeTrailingSeparator(); //$NON-NLS-1$
- String installStr = Platform.asLocalURL(new URL(installPath.toString())).getFile();
- return new Path(installStr);
- } catch (IOException e) {
- //Do nothing
- }
- }
- return null;
- }
-
- /**
- * Return the Servlets Jar file path preference.
- *
- * @return String the file path to the servlets jar, or null if never specified.
- * @deprecated - the preference store is no longer on this plugin because of the UI dependency.
- */
- public String getPreferenceServletsJar() {
- // return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_SERVLET_JAR);
- return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$
- }
-
- /**
- * Return the Servlets Jar file path preference.
- *
- * @return String the file path to the servlets jar, or null if never specified.
- * @deprecated - the preference store is no longer on this plugin because of the UI dependency.
- */
- public String getPreferenceWebASJar() {
- //return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_WEBAS_JAR);
- return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$
- }
-
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * If this is called from an operation, in response to some other exception that was caught,
- * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
- * otherwise this can still be used to signal some other error condition within the operation,
- * or to throw a core exception in a context other than executing an operation
- *
- * Create a new IStatus of type ERROR using the J2EEPlugin ID. aCode is just an internal code.
- */
- public static IStatus newErrorStatus(int aCode, String aMessage, Throwable exception) {
- return newStatus(IStatus.ERROR, aCode, aMessage, exception);
- }
-
- /**
- * If this is called from an operation, in response to some other exception that was caught,
- * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
- * otherwise this can still be used to signal some other error condition within the operation,
- * or to throw a core exception in a context other than executing an operation
- *
- * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID
- */
- public static IStatus newErrorStatus(String aMessage, Throwable exception) {
- return newErrorStatus(0, aMessage, exception);
- }
-
- /**
- * If this is called from an operation, in response to some other exception that was caught,
- * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
- * otherwise this can still be used to signal some other error condition within the operation.
- *
- * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID
- */
- public static IStatus newOperationFailedStatus(String aMessage, Throwable exception) {
- return newStatus(IStatus.ERROR, IResourceStatus.OPERATION_FAILED, aMessage, exception);
- }
-
- /**
- * Create a new IStatus with a severity using the J2EEPlugin ID. aCode is just an internal code.
- */
- public static IStatus newStatus(int severity, int aCode, String aMessage, Throwable exception) {
- return new Status(severity, PLUGIN_ID, aCode, aMessage, exception);
- }
-
- /*
- * Javadoc copied from interface.
- */
- public String getString(String key) {
- return Platform.getResourceString(getBundle(), key);
- }
-
- /*
- * Javadoc copied from interface.
- */
- public String getString(String key, Object[] substitutions) {
- return MessageFormat.format(getString(key), substitutions);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- //WebAppResourceFactory.register(WTPResourceFactoryRegistry.INSTANCE);
- IAdapterManager manager = Platform.getAdapterManager();
- manager.registerAdapters(new WebEditAdapterFactory(), ArtifactEditModel.class);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.WTPPlugin#getPluginID()
- */
- @Override
- public String getPluginID() {
- return PLUGIN_ID;
- }
-
- public static void log( final Exception e )
- {
- logError(e);
- }
- public String getString(String key, boolean translate) {
- // TODO For now... translate not supported
- return getString(key);
- }
-
- public String getString(String key, Object[] substitutions, boolean translate) {
- // TODO For now... translate not supported
- return getString(key,substitutions);
- }
-
- 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() );
- }
-
- public static void logError(String message) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, message));
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java
deleted file mode 100644
index 07dd594c3..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.web;
-
-public interface IServletConstants {
-
- public static final String QUALIFIED_IO_EXCEPTION = "java.io.IOException"; //$NON-NLS-1$
-
- public static final String QUALIFIED_SERVLET = "javax.servlet.Servlet"; //$NON-NLS-1$
- public static final String QUALIFIED_GENERIC_SERVLET = "javax.servlet.GenericServlet"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SERVLET = "javax.servlet.http.HttpServlet"; //$NON-NLS-1$
-
- public static final String QUALIFIED_WEB_SERVLET = "javax.servlet.annotation.WebServlet"; //$NON-NLS-1$
- public static final String QUALIFIED_WEB_LISTENER = "javax.servlet.annotation.WebListener"; //$NON-NLS-1$
- public static final String QUALIFIED_WEB_FILTER = "javax.servlet.annotation.WebFilter"; //$NON-NLS-1$
- public static final String QUALIFIED_ANNOTATION_INIT_PARAM = "javax.servlet.annotation.WebInitParam"; //$NON-NLS-1$
- public static final String QUALIFIED_ANNOTATION_DISPATCHER_TYPE = "javax.servlet.DispatcherType"; //$NON-NLS-1$
-
-
- public static final String QUALIFIED_SERVLET_EXCEPTION = "javax.servlet.ServletException"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_CONFIG = "javax.servlet.ServletConfig"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_REQUEST = "javax.servlet.ServletRequest"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_RESPONSE = "javax.servlet.ServletResponse"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SERVLET_REQUEST = "javax.servlet.http.HttpServletRequest"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SERVLET_RESPONSE = "javax.servlet.http.HttpServletResponse"; //$NON-NLS-1$
-
- public static final String QUALIFIED_FILTER = "javax.servlet.Filter"; //$NON-NLS-1$
- public static final String QUALIFIED_FILTER_CONFIG = "javax.servlet.FilterConfig"; //$NON-NLS-1$
- public static final String QUALIFIED_FILTER_CHAIN = "javax.servlet.FilterChain"; //$NON-NLS-1$
-
- public static final String QUALIFIED_SERVLET_CONTEXT_LISTENER = "javax.servlet.ServletContextListener"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_CONTEXT_EVENT = "javax.servlet.ServletContextEvent"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER = "javax.servlet.ServletContextAttributeListener"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_EVENT = "javax.servlet.ServletContextAttributeEvent"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SESSION_LISTENER = "javax.servlet.http.HttpSessionListener"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SESSION_EVENT = "javax.servlet.http.HttpSessionEvent"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER = "javax.servlet.http.HttpSessionAttributeListener"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SESSION_BINDING_EVENT = "javax.servlet.http.HttpSessionBindingEvent"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER = "javax.servlet.http.HttpSessionActivationListener"; //$NON-NLS-1$
- public static final String QUALIFIED_HTTP_SESSION_BINDING_LISTENER = "javax.servlet.http.HttpSessionBindingListener"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_REQUEST_LISTENER = "javax.servlet.ServletRequestListener"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_REQUEST_EVENT = "javax.servlet.ServletRequestEvent"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER = "javax.servlet.ServletRequestAttributeListener"; //$NON-NLS-1$
- public static final String QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT = "javax.servlet.ServletRequestAttributeEvent"; //$NON-NLS-1$
-
- public static final String METHOD_INIT = "init"; //$NON-NLS-1$
- public static final String METHOD_DESTROY = "destroy"; //$NON-NLS-1$
- public static final String METHOD_GET_SERVLET_CONFIG = "getServletConfig"; //$NON-NLS-1$
- public static final String METHOD_GET_SERVLET_INFO = "getServletInfo"; //$NON-NLS-1$
- public static final String METHOD_SERVICE = "service"; //$NON-NLS-1$
- public static final String METHOD_DO_GET = "doGet"; //$NON-NLS-1$
- public static final String METHOD_DO_POST = "doPost"; //$NON-NLS-1$
- public static final String METHOD_DO_PUT = "doPut"; //$NON-NLS-1$
- public static final String METHOD_DO_DELETE = "doDelete"; //$NON-NLS-1$
- public static final String METHOD_DO_HEAD = "doHead"; //$NON-NLS-1$
- public static final String METHOD_DO_OPTIONS = "doOptions"; //$NON-NLS-1$
- public static final String METHOD_DO_TRACE = "doTrace"; //$NON-NLS-1$
- public static final String METHOD_TO_STRING = "toString"; //$NON-NLS-1$
- public static final String METHOD_DO_FILTER = "doFilter"; //$NON-NLS-1$
-
- public static final String SERVLET_INIT_SIGNATURE = "(Ljavax/servlet/ServletConfig;)V"; //$NON-NLS-1$
- public static final String DESTROY_SIGNATURE = "()V"; //$NON-NLS-1$
- public static final String GET_SERVLET_CONFIG_SIGNATURE = "()Ljavax/servlet/ServletConfig;"; //$NON-NLS-1$
- public static final String GET_SERVLET_INFO_SIGNATURE = "()Ljava/lang/String;"; //$NON-NLS-1$
- public static final String SERVICE_SIGNATURE = "(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V"; //$NON-NLS-1$
- public static final String HTTP_SERVICE_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String DO_GET_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String DO_POST_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String DO_PUT_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String DO_DELETE_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String DO_HEAD_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String DO_OPTIONS_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String DO_TRACE_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
- public static final String FILTER_INIT_SIGNATURE = "(Ljavax/servlet/FilterConfig;)V"; //$NON-NLS-1$
- public static final String DO_FILTER_SIGNATURE = "(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java
deleted file mode 100644
index 37e821041..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 SAP AG 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:
- * SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.web.validation;
-
-/**
- * Utility method for URL patterns.
- *
- * <p>
- * Could be used by components dealing with URL patterns like: Servlet and
- * Filter wizards, web.xml validators, etc.
- * </p>
- *
- * @author Kaloyan Raev
- */
-public class UrlPattern {
-
- /**
- * Validates an URL pattern.
- *
- * @param urlPattern
- * the string representation of the URL pattern to validate
- *
- * @return <code>true</code> if the given pattern is a valid one,
- * <code>false</code> - otherwise.
- */
- public static boolean isValid(String urlPattern) {
- // URL Pattern must not be empty string
- if (urlPattern.length() == 0)
- return false;
-
- // URL Pattern must not contain Carriage Return characters
- if (urlPattern.indexOf('\r') != -1)
- return false;
-
- // URL Pattern must not contain New Line characters
- if (urlPattern.indexOf('\n') != -1)
- return false;
-
- // Path Mappings must not contain "*." character sequences
- if (urlPattern.startsWith("/")) { //$NON-NLS-1$
- if (urlPattern.indexOf("*.") == -1) { //$NON-NLS-1$
- return true;
- }
- return false;
- }
-
- // Extension Mappings must not contain '/' characters
- if (urlPattern.startsWith("*.")) { //$NON-NLS-1$
- if (urlPattern.indexOf('/') == -1) {
- return true;
- }
- return false;
- }
-
- // The URL Pattern is neither a Path Mapping, nor Extension Mapping
- // Therefore, it is invalid
- return false;
- }
-
-}

Back to the top