Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

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.java39
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java353
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java24
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java83
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java116
-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.java345
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java121
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java328
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java86
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java170
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java125
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java290
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java40
-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.java306
-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.java34
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java217
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java361
-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.java139
-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.java552
-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.java404
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java240
-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.java330
-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.java196
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java289
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java78
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java60
39 files changed, 0 insertions, 6228 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 27ab2ee71..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java
+++ /dev/null
@@ -1,39 +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
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-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
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-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 b8b315dd6..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java
+++ /dev/null
@@ -1,353 +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.Arrays;
-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.project.J2EEProjectUtilities;
-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.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) {
- e.printStackTrace();
- }
- IVirtualComponent component = null;
- if (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.isJspType()) {
- resource = ((IProject) resource).getFile(((JSPType) webType).getJspFile()); //$NON-NLS-1$
- } 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) {
- 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;
- String jspPath = resource.getProjectRelativePath().removeFirstSegments(1).toString();
- if (jsp.getJspFile().equals(jspPath)) {
- 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) {
- IModule deployable = null;
- Iterator iterator = Arrays.asList(ServerUtil.getModules(J2EEProjectUtilities.DYNAMIC_WEB)).iterator(); //$NON-NLS-1$
- String componentName = null;
- if (component != null)
- componentName = component.getName();
- else
- return getModuleProject(project, iterator);
- while (iterator.hasNext()) {
- Object next = iterator.next();
- if (next instanceof IModule) {
- deployable = (IModule) next;
- if (deployable.getName().equals(componentName)) {
- return deployable;
- }
- }
- }
- return null;
- }
-
- 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())) //$NON-NLS-1$
- 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 J2EEProjectUtilities.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 9f213a95d..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java
+++ /dev/null
@@ -1,24 +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
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-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 777e92514..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java
+++ /dev/null
@@ -1,31 +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
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-
-/**
- * @author vijayb
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Style - Code Templates
- */
-public interface FileURL {
- 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 53e2075da..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java
+++ /dev/null
@@ -1,83 +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
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.logger.proxy.Logger;
-
-/**
- * @author vijayb
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Style - Code Templates
- */
-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) {
- Logger.getLogger().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 c188cc3d2..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java
+++ /dev/null
@@ -1,116 +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.runtime.IConfigurationElement;
-import org.eclipse.jem.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)
- */
- 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;
- for (Iterator fileURLExtItr = getFileURLExtensions().iterator(); fileURLExtItr.hasNext();) {
- fileURLExt = (FileURLExtension) fileURLExtItr.next();
- return fileURLExt.getInstance();
- }
- return null;
- }
-
- /**
- * 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 300a3456d..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java
+++ /dev/null
@@ -1,345 +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.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();
- 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.WebApp) {
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) 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);
- if (webApp != null) {
- 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
- InitParam param = WebapplicationFactory.eINSTANCE.createInitParam();
- param.setParamName(stringArray[0]);
- param.setParamValue(stringArray[1]);
- param.setDescription(stringArray[2]);
- // Set the param to the filter model list of init params
- filter.getInitParams().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.WebApp) {
- 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();
-
- // 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.WebApp) {
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) 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 2cb81c4b6..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java
+++ /dev/null
@@ -1,121 +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
- */
- 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();
- 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.WebApp ){
- // 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.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) 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 ea5c6c8a7..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java
+++ /dev/null
@@ -1,328 +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.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();
- 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 org.eclipse.jst.javaee.web.WebApp) {
-
- 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();
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) 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.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) modelObject;
- 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();
-
- // 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 org.eclipse.jst.javaee.web.WebApp) {
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) 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 6270f239c..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java
+++ /dev/null
@@ -1,86 +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 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.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 {
-
- 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 (!model.getBooleanProperty(USE_ANNOTATIONS))
- {
- 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 1023fc33d..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java
+++ /dev/null
@@ -1,170 +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.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_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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-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 int NAME = 0;
- public static final int VALUE = 1;
- public static final int DESCRIPTION = 2;
-
- public CreateFilterTemplateModel(IDataModel dataModel) {
- super(dataModel);
- }
-
- 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);
- }
-
- return collection;
- }
-
- public String getFilterName() {
- return getProperty(CLASS_NAME).trim();
- }
-
- 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(",");
- }
- }
-
- return builder.toString();
- }
-
- 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;
- }
-
-}
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 dd3dd4ad8..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java
+++ /dev/null
@@ -1,125 +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 java.util.Collection;
-import java.util.List;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class CreateListenerTemplateModel extends CreateWebClassTemplateModel {
-
- 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);
- }
-
- 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 1c0d4958c..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java
+++ /dev/null
@@ -1,290 +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_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.SERVICE_SIGNATURE;
-import static org.eclipse.jst.j2ee.web.IServletConstants.SERVLET_INIT_SIGNATURE;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-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);
- }
-
- 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);
- }
-
- 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;
- }
-
-}
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 aaa08c32e..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java
+++ /dev/null
@@ -1,40 +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 org.eclipse.jst.j2ee.internal.common.operations.CreateJavaEEArtifactTemplateModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class CreateWebClassTemplateModel extends
- CreateJavaEEArtifactTemplateModel {
-
- 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);
- }
-
-}
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 0531a050e..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 = "";
- if ((dispatchers & REQUEST) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_R") + " ";
- }
- if ((dispatchers & FORWARD) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_F") + " ";
- }
- if ((dispatchers & INCLUDE) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_I") + " ";
- }
- if ((dispatchers & ERROR) > 0) {
- result += WebAppEditResourceHandler.getString("DISPATCHER_E") + " ";
- }
- 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 6ee53ab45..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java
+++ /dev/null
@@ -1,306 +0,0 @@
-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;
- protected final String TEXT_1 = "package ";
- protected final String TEXT_2 = ";";
- protected final String TEXT_3 = NL;
- protected final String TEXT_4 = NL + "import ";
- protected final String TEXT_5 = ";";
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "/**" + NL + " * Servlet Filter implementation class ";
- protected final String TEXT_9 = NL + " *" + NL + " * @web.filter" + NL + " * name=\"";
- protected final String TEXT_10 = "\"" + NL + " * display-name=\"";
- protected final String TEXT_11 = "\"";
- protected final String TEXT_12 = NL + " * description=\"";
- protected final String TEXT_13 = "\"";
- protected final String TEXT_14 = NL + " *" + NL + " * @web.filter-mapping";
- protected final String TEXT_15 = NL + " * url-pattern=\"";
- protected final String TEXT_16 = "\"";
- protected final String TEXT_17 = NL + " * servlet-name=\"";
- protected final String TEXT_18 = "\"";
- protected final String TEXT_19 = NL + " * dispatcher=\"";
- protected final String TEXT_20 = "\"";
- protected final String TEXT_21 = NL + " *" + NL + " * @web.filter-init-param" + NL + " * name=\"";
- protected final String TEXT_22 = "\"" + NL + " * value=\"";
- protected final String TEXT_23 = "\"";
- protected final String TEXT_24 = NL + " * description=\"";
- protected final String TEXT_25 = "\"";
- protected final String TEXT_26 = NL + " */";
- protected final String TEXT_27 = NL + "public ";
- protected final String TEXT_28 = "abstract ";
- protected final String TEXT_29 = "final ";
- protected final String TEXT_30 = "class ";
- protected final String TEXT_31 = " extends ";
- protected final String TEXT_32 = " implements ";
- protected final String TEXT_33 = ", ";
- protected final String TEXT_34 = " {";
- protected final String TEXT_35 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public ";
- protected final String TEXT_36 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }";
- protected final String TEXT_37 = NL + " " + NL + " /**" + NL + " * @see ";
- protected final String TEXT_38 = "#";
- protected final String TEXT_39 = "(";
- protected final String TEXT_40 = ")" + NL + " */" + NL + " public ";
- protected final String TEXT_41 = "(";
- protected final String TEXT_42 = ") {" + NL + " super(";
- protected final String TEXT_43 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }";
- protected final String TEXT_44 = NL + NL + "\t/**" + NL + " * @see ";
- protected final String TEXT_45 = "#";
- protected final String TEXT_46 = "(";
- protected final String TEXT_47 = ")" + NL + " */" + NL + " public ";
- protected final String TEXT_48 = " ";
- protected final String TEXT_49 = "(";
- protected final String TEXT_50 = ") {" + NL + " // TODO Auto-generated method stub";
- protected final String TEXT_51 = NL + "\t\t\treturn ";
- protected final String TEXT_52 = ";";
- protected final String TEXT_53 = NL + " }";
- protected final String TEXT_54 = NL + NL + "\t/**" + NL + "\t * @see Filter#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
- protected final String TEXT_55 = 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}";
- protected final String TEXT_56 = 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}";
- protected final String TEXT_57 = NL + NL + "}";
- protected final String TEXT_58 = 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 (model.isPublic()) {
-
- stringBuffer.append(TEXT_27);
-
- }
-
- if (model.isAbstract()) {
-
- stringBuffer.append(TEXT_28);
-
- }
-
- if (model.isFinal()) {
-
- stringBuffer.append(TEXT_29);
-
- }
-
- stringBuffer.append(TEXT_30);
- stringBuffer.append( model.getClassName() );
-
- String superClass = model.getSuperclassName();
- if (superClass != null && superClass.length() > 0) {
-
- stringBuffer.append(TEXT_31);
- stringBuffer.append( superClass );
-
- }
-
- List<String> interfaces = model.getInterfaces();
- if ( interfaces.size() > 0) {
-
- stringBuffer.append(TEXT_32);
-
- }
-
- for (int i = 0; i < interfaces.size(); i++) {
- String INTERFACE = (String) interfaces.get(i);
- if (i > 0) {
-
- stringBuffer.append(TEXT_33);
-
- }
-
- stringBuffer.append( INTERFACE );
-
- }
-
- stringBuffer.append(TEXT_34);
-
- if (!model.hasEmptySuperclassConstructor()) {
-
- stringBuffer.append(TEXT_35);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_36);
-
- }
-
- if (model.shouldGenSuperclassConstructors()) {
- List<Constructor> constructors = model.getConstructors();
- for (Constructor constructor : constructors) {
- if (constructor.isPublic() || constructor.isProtected()) {
-
- stringBuffer.append(TEXT_37);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_38);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_39);
- stringBuffer.append( constructor.getParamsForJavadoc() );
- stringBuffer.append(TEXT_40);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_41);
- stringBuffer.append( constructor.getParamsForDeclaration() );
- stringBuffer.append(TEXT_42);
- stringBuffer.append( constructor.getParamsForCall() );
- stringBuffer.append(TEXT_43);
-
- }
- }
- }
-
-
- if (model.shouldImplementAbstractMethods()) {
- for (Method method : model.getUnimplementedMethods()) {
-
- stringBuffer.append(TEXT_44);
- stringBuffer.append( method.getContainingJavaClass() );
- stringBuffer.append(TEXT_45);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_46);
- stringBuffer.append( method.getParamsForJavadoc() );
- stringBuffer.append(TEXT_47);
- stringBuffer.append( method.getReturnType() );
- stringBuffer.append(TEXT_48);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_49);
- stringBuffer.append( method.getParamsForDeclaration() );
- stringBuffer.append(TEXT_50);
-
- String defaultReturnValue = method.getDefaultReturnValue();
- if (defaultReturnValue != null) {
-
- stringBuffer.append(TEXT_51);
- stringBuffer.append( defaultReturnValue );
- stringBuffer.append(TEXT_52);
-
- }
-
- stringBuffer.append(TEXT_53);
-
- }
- }
-
- if (model.shouldGenDestroy()) {
- stringBuffer.append(TEXT_54);
- }
- if (model.shouldGenDoFilter()) {
- stringBuffer.append(TEXT_55);
- }
- if (model.shouldGenInit()) {
- stringBuffer.append(TEXT_56);
- }
- stringBuffer.append(TEXT_57);
- stringBuffer.append(TEXT_58);
- 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 c40d48624..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java
+++ /dev/null
@@ -1,34 +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$
-
-}
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 dca429f96..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java
+++ /dev/null
@@ -1,217 +0,0 @@
-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;
- protected final String TEXT_1 = "package ";
- protected final String TEXT_2 = ";";
- protected final String TEXT_3 = NL;
- protected final String TEXT_4 = NL + "import ";
- protected final String TEXT_5 = ";";
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "/**" + NL + " * Application Lifecycle Listener implementation class ";
- protected final String TEXT_9 = NL + " *";
- protected final String TEXT_10 = NL + " * @web.listener";
- protected final String TEXT_11 = NL + " */";
- protected final String TEXT_12 = NL + "public ";
- protected final String TEXT_13 = "abstract ";
- protected final String TEXT_14 = "final ";
- protected final String TEXT_15 = "class ";
- protected final String TEXT_16 = " extends ";
- protected final String TEXT_17 = " implements ";
- protected final String TEXT_18 = ", ";
- protected final String TEXT_19 = " {";
- protected final String TEXT_20 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public ";
- protected final String TEXT_21 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }";
- protected final String TEXT_22 = NL + " " + NL + " /**" + NL + " * @see ";
- protected final String TEXT_23 = "#";
- protected final String TEXT_24 = "(";
- protected final String TEXT_25 = ")" + NL + " */" + NL + " public ";
- protected final String TEXT_26 = "(";
- protected final String TEXT_27 = ") {" + NL + " super(";
- protected final String TEXT_28 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }";
- protected final String TEXT_29 = NL + NL + "\t/**" + NL + " * @see ";
- protected final String TEXT_30 = "#";
- protected final String TEXT_31 = "(";
- protected final String TEXT_32 = ")" + NL + " */" + NL + " public ";
- protected final String TEXT_33 = " ";
- protected final String TEXT_34 = "(";
- protected final String TEXT_35 = ") {" + NL + " // TODO Auto-generated method stub";
- protected final String TEXT_36 = NL + "\t\t\treturn ";
- protected final String TEXT_37 = ";";
- protected final String TEXT_38 = NL + " }";
- protected final String TEXT_39 = NL + "\t" + NL + "}";
- protected final String TEXT_40 = 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 (model.isPublic()) {
-
- stringBuffer.append(TEXT_12);
-
- }
-
- if (model.isAbstract()) {
-
- stringBuffer.append(TEXT_13);
-
- }
-
- if (model.isFinal()) {
-
- stringBuffer.append(TEXT_14);
-
- }
-
- stringBuffer.append(TEXT_15);
- stringBuffer.append( model.getClassName() );
-
- String superClass = model.getSuperclassName();
- if (superClass != null && superClass.length() > 0) {
-
- stringBuffer.append(TEXT_16);
- stringBuffer.append( superClass );
-
- }
-
- List<String> interfaces = model.getInterfaces();
- if ( interfaces.size() > 0) {
-
- stringBuffer.append(TEXT_17);
-
- }
-
- for (int i = 0; i < interfaces.size(); i++) {
- String INTERFACE = (String) interfaces.get(i);
- if (i > 0) {
-
- stringBuffer.append(TEXT_18);
-
- }
-
- stringBuffer.append( INTERFACE );
-
- }
-
- stringBuffer.append(TEXT_19);
-
- if (!model.hasEmptySuperclassConstructor()) {
-
- stringBuffer.append(TEXT_20);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_21);
-
- }
-
- if (model.shouldGenSuperclassConstructors()) {
- List<Constructor> constructors = model.getConstructors();
- for (Constructor constructor : constructors) {
- if (constructor.isPublic() || constructor.isProtected()) {
-
- stringBuffer.append(TEXT_22);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_23);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_24);
- stringBuffer.append( constructor.getParamsForJavadoc() );
- stringBuffer.append(TEXT_25);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_26);
- stringBuffer.append( constructor.getParamsForDeclaration() );
- stringBuffer.append(TEXT_27);
- stringBuffer.append( constructor.getParamsForCall() );
- stringBuffer.append(TEXT_28);
-
- }
- }
- }
-
-
- if (model.shouldImplementAbstractMethods()) {
- for (Method method : model.getUnimplementedMethods()) {
-
- stringBuffer.append(TEXT_29);
- stringBuffer.append( method.getContainingJavaClass() );
- stringBuffer.append(TEXT_30);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_31);
- stringBuffer.append( method.getParamsForJavadoc() );
- stringBuffer.append(TEXT_32);
- stringBuffer.append( method.getReturnType() );
- stringBuffer.append(TEXT_33);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_34);
- stringBuffer.append( method.getParamsForDeclaration() );
- stringBuffer.append(TEXT_35);
-
- String defaultReturnValue = method.getDefaultReturnValue();
- if (defaultReturnValue != null) {
-
- stringBuffer.append(TEXT_36);
- stringBuffer.append( defaultReturnValue );
- stringBuffer.append(TEXT_37);
-
- }
-
- stringBuffer.append(TEXT_38);
-
- }
- }
-
- stringBuffer.append(TEXT_39);
- stringBuffer.append(TEXT_40);
- 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 6521747e9..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java
+++ /dev/null
@@ -1,361 +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.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)))
- 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 = (IFilterMappingItem) 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 "";
- }
- 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 "";
- }
-
- /**
- * 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;
- }
-
-}
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 8ece2c933..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java
+++ /dev/null
@@ -1,139 +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 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)) {
- 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;
- } else {
- 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 720c704a7..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java
+++ /dev/null
@@ -1,552 +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.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(".jsp")) { //$NON-NLS-1$
- 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 "";
- }
- 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 "";
- }
-
- /**
- * 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 474740f02..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
+++ /dev/null
@@ -1,404 +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.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.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.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * 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;
- private String existingClassNameCache;
-
- 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(DISPLAY_NAME);
- propertyNames.add(DESCRIPTION);
- propertyNames.add(USE_EXISTING_CLASS);
- propertyNames.add(USE_ANNOTATIONS);
-
- 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();
-
- // Otherwise check super for default value for property
- return super.getDefaultProperty(propertyName);
- }
-
- /**
- * 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 10af881ee..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java
+++ /dev/null
@@ -1,240 +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
- */
- 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 ff81e0f5e..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java
+++ /dev/null
@@ -1,330 +0,0 @@
-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;
- protected final String TEXT_1 = "package ";
- protected final String TEXT_2 = ";";
- protected final String TEXT_3 = NL;
- protected final String TEXT_4 = NL + "import ";
- protected final String TEXT_5 = ";";
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "/**" + NL + " * Servlet implementation class ";
- protected final String TEXT_9 = NL + " *" + NL + " * @web.servlet" + NL + " * name=\"";
- protected final String TEXT_10 = "\"" + NL + " * display-name=\"";
- protected final String TEXT_11 = "\"";
- protected final String TEXT_12 = NL + " * description=\"";
- protected final String TEXT_13 = "\"";
- protected final String TEXT_14 = NL + " *" + NL + " * @web.servlet-mapping" + NL + " * url-pattern=\"";
- protected final String TEXT_15 = "\"";
- protected final String TEXT_16 = NL + " *" + NL + " * @web.servlet-init-param" + NL + " * name=\"";
- protected final String TEXT_17 = "\"" + NL + " * value=\"";
- protected final String TEXT_18 = "\"";
- protected final String TEXT_19 = NL + " * description=\"";
- protected final String TEXT_20 = "\"";
- protected final String TEXT_21 = NL + " */";
- protected final String TEXT_22 = NL + "public ";
- protected final String TEXT_23 = "abstract ";
- protected final String TEXT_24 = "final ";
- protected final String TEXT_25 = "class ";
- protected final String TEXT_26 = " extends ";
- protected final String TEXT_27 = " implements ";
- protected final String TEXT_28 = ", ";
- protected final String TEXT_29 = " {";
- protected final String TEXT_30 = NL + "\tprivate static final long serialVersionUID = 1L;";
- protected final String TEXT_31 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public ";
- protected final String TEXT_32 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }";
- protected final String TEXT_33 = NL + " " + NL + " /**" + NL + " * @see ";
- protected final String TEXT_34 = "#";
- protected final String TEXT_35 = "(";
- protected final String TEXT_36 = ")" + NL + " */" + NL + " public ";
- protected final String TEXT_37 = "(";
- protected final String TEXT_38 = ") {" + NL + " super(";
- protected final String TEXT_39 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }";
- protected final String TEXT_40 = NL + NL + "\t/**" + NL + " * @see ";
- protected final String TEXT_41 = "#";
- protected final String TEXT_42 = "(";
- protected final String TEXT_43 = ")" + NL + " */" + NL + " public ";
- protected final String TEXT_44 = " ";
- protected final String TEXT_45 = "(";
- protected final String TEXT_46 = ") {" + NL + " // TODO Auto-generated method stub";
- protected final String TEXT_47 = NL + "\t\t\treturn ";
- protected final String TEXT_48 = ";";
- protected final String TEXT_49 = NL + " }";
- protected final String TEXT_50 = 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}";
- protected final String TEXT_51 = NL + NL + "\t/**" + NL + "\t * @see Servlet#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
- protected final String TEXT_52 = 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}";
- protected final String TEXT_53 = 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}";
- protected final String TEXT_54 = 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}";
- protected final String TEXT_55 = 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}";
- protected final String TEXT_56 = 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}";
- protected final String TEXT_57 = 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}";
- protected final String TEXT_58 = 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}";
- protected final String TEXT_59 = 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}";
- protected final String TEXT_60 = 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}";
- protected final String TEXT_61 = 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}";
- protected final String TEXT_62 = 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}";
- protected final String TEXT_63 = NL + NL + "}";
- protected final String TEXT_64 = 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 (model.isPublic()) {
-
- stringBuffer.append(TEXT_22);
-
- }
-
- if (model.isAbstract()) {
-
- stringBuffer.append(TEXT_23);
-
- }
-
- if (model.isFinal()) {
-
- stringBuffer.append(TEXT_24);
-
- }
-
- stringBuffer.append(TEXT_25);
- stringBuffer.append( model.getClassName() );
-
- String superClass = model.getSuperclassName();
- if (superClass != null && superClass.length() > 0) {
-
- stringBuffer.append(TEXT_26);
- stringBuffer.append( superClass );
-
- }
-
- List<String> interfaces = model.getInterfaces();
- if ( interfaces.size() > 0) {
-
- stringBuffer.append(TEXT_27);
-
- }
-
- for (int i = 0; i < interfaces.size(); i++) {
- String INTERFACE = (String) interfaces.get(i);
- if (i > 0) {
-
- stringBuffer.append(TEXT_28);
-
- }
-
- stringBuffer.append( INTERFACE );
-
- }
-
- stringBuffer.append(TEXT_29);
-
- if (model.isGenericServletSuperclass()) {
-
- stringBuffer.append(TEXT_30);
-
- }
-
-
- if (!model.hasEmptySuperclassConstructor()) {
-
- stringBuffer.append(TEXT_31);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_32);
-
- }
-
- if (model.shouldGenSuperclassConstructors()) {
- List<Constructor> constructors = model.getConstructors();
- for (Constructor constructor : constructors) {
- if (constructor.isPublic() || constructor.isProtected()) {
-
- stringBuffer.append(TEXT_33);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_34);
- stringBuffer.append( model.getSuperclassName() );
- stringBuffer.append(TEXT_35);
- stringBuffer.append( constructor.getParamsForJavadoc() );
- stringBuffer.append(TEXT_36);
- stringBuffer.append( model.getClassName() );
- stringBuffer.append(TEXT_37);
- stringBuffer.append( constructor.getParamsForDeclaration() );
- stringBuffer.append(TEXT_38);
- stringBuffer.append( constructor.getParamsForCall() );
- stringBuffer.append(TEXT_39);
-
- }
- }
- }
-
-
- if (model.shouldImplementAbstractMethods()) {
- for (Method method : model.getUnimplementedMethods()) {
-
- stringBuffer.append(TEXT_40);
- stringBuffer.append( method.getContainingJavaClass() );
- stringBuffer.append(TEXT_41);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_42);
- stringBuffer.append( method.getParamsForJavadoc() );
- stringBuffer.append(TEXT_43);
- stringBuffer.append( method.getReturnType() );
- stringBuffer.append(TEXT_44);
- stringBuffer.append( method.getName() );
- stringBuffer.append(TEXT_45);
- stringBuffer.append( method.getParamsForDeclaration() );
- stringBuffer.append(TEXT_46);
-
- String defaultReturnValue = method.getDefaultReturnValue();
- if (defaultReturnValue != null) {
-
- stringBuffer.append(TEXT_47);
- stringBuffer.append( defaultReturnValue );
- stringBuffer.append(TEXT_48);
-
- }
-
- stringBuffer.append(TEXT_49);
-
- }
- }
-
- if (model.shouldGenInit()) {
- stringBuffer.append(TEXT_50);
- }
- if (model.shouldGenDestroy()) {
- stringBuffer.append(TEXT_51);
- }
- if (model.shouldGenGetServletConfig()) {
- stringBuffer.append(TEXT_52);
- }
- if (model.shouldGenGetServletInfo()) {
- stringBuffer.append(TEXT_53);
- }
- if (model.shouldGenService() && !model.isHttpServletSuperclass()) {
- stringBuffer.append(TEXT_54);
- }
- if (model.shouldGenService() && model.isHttpServletSuperclass()) {
- stringBuffer.append(TEXT_55);
- }
- if (model.shouldGenDoGet()) {
- stringBuffer.append(TEXT_56);
- }
- if (model.shouldGenDoPost()) {
- stringBuffer.append(TEXT_57);
- }
- if (model.shouldGenDoPut()) {
- stringBuffer.append(TEXT_58);
- }
- if (model.shouldGenDoDelete()) {
- stringBuffer.append(TEXT_59);
- }
- if (model.shouldGenDoHead()) {
- stringBuffer.append(TEXT_60);
- }
- if (model.shouldGenDoOptions()) {
- stringBuffer.append(TEXT_61);
- }
- if (model.shouldGenDoTrace()) {
- stringBuffer.append(TEXT_62);
- }
- stringBuffer.append(TEXT_63);
- stringBuffer.append(TEXT_64);
- 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 52d3f91de..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java
+++ /dev/null
@@ -1,196 +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.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-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() {
- // TODO Auto-generated method stub
- 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 {
- WebArtifactEdit webEdit = null;
- try {
- // TODO migrate to flex project
- // webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead( nestedProject
- // );
- if (webEdit != null) {
- webEdit.setServerContextRoot(webModule.getContextRoot());
- }
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- // if (wnr != null) {
- // wnr.setContextRoot(webModule.getContextRoot());
- // }
- }
-
- /*
- * (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) {
- String contentFolder = null;
-
- // WebSettings webSettings = new WebSettings(project, webSettingsFile);
- // if (webSettings != null) {
- // contentFolder = webSettings.getWebContentName();
- // }
- // To do: Needs work here, no content folder exists now
- WebArtifactEdit webEdit = null;
- try {
- // TODO migrate to flex project
- // webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(project);
- if (webEdit != null) {
-
- }
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
-
- return contentFolder;
- }
-
- /*
- * (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) {
- WebArtifactEdit webEdit = null;
- try {
- // TODO migrate to flex project
- // webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(project);
- if (webEdit != null) {
- return webEdit.getServerContextRoot();
- }
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- 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 37c97592a..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
+++ /dev/null
@@ -1,289 +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.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.ILog;
-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;
-
-
-/**
- * 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);
- }
-
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- 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()
- */
- public String getPluginID() {
- return PLUGIN_ID;
- }
-
- public static void log( final Exception e )
- {
- final ILog log = WebPlugin.getDefault().getLog();
- final String msg = "Encountered an unexpected exception.";
-
- log.log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, 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);
- }
-
-}
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 ce7642360..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java
+++ /dev/null
@@ -1,78 +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_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 e8f789cd8..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java
+++ /dev/null
@@ -1,60 +0,0 @@
-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 kraev
- */
-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("/")) {
- if (urlPattern.indexOf("*.") == -1) {
- return true;
- } else {
- return false;
- }
- }
-
- // Extension Mappings must not contain '/' characters
- if (urlPattern.startsWith("*.")) {
- if (urlPattern.indexOf('/') == -1) {
- return true;
- } else {
- return false;
- }
- }
-
- // The URL Pattern is neither a Path Mapping, nor Extension Mapping
- // Therefore, it is invalid
- return false;
- }
-
-}

Back to the top