diff options
Diffstat (limited to 'plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java')
-rw-r--r-- | plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java deleted file mode 100644 index 7c01687b0..000000000 --- a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java +++ /dev/null @@ -1,82 +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 - **************************************************************************************************/ -package org.eclipse.wst.web.internal.deployables; - -import java.util.Properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.util.IStaticWeb; - -public class StaticWebDeployable extends ComponentDeployable implements IStaticWeb { - - public StaticWebDeployable(IProject project, IVirtualComponent component) { - super(project); - } - - public String getContextRoot() { - Properties props = component.getMetaProperties(); - if(props.containsKey("context-root")) //$NON-NLS-1$ - return props.getProperty("context-root"); //$NON-NLS-1$ - return component.getName(); - } - - public String getURI(IModule module) { - IVirtualComponent comp = ComponentCore.createComponent(module.getProject()); - String aURI = null; - if (comp !=null) { - if (!comp.isBinary() && isProjectOfType(module.getProject(),IModuleConstants.WST_WEB_MODULE)) { - IVirtualReference ref = component.getReference(comp.getName()); - aURI = ref.getRuntimePath().append(comp.getName()+".war").toString(); //$NON-NLS-1$ - } - } - - if (aURI !=null && aURI.length()>1 && aURI.startsWith("/")) //$NON-NLS-1$ - aURI = aURI.substring(1); - return aURI; - } - - private boolean isProjectOfType(IProject project, String typeID) { - IFacetedProject facetedProject = null; - try { - facetedProject = ProjectFacetsManager.create(project); - } catch (CoreException e) { - return false; - } - - if (facetedProject !=null && ProjectFacetsManager.isProjectFacetDefined(typeID)) { - IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(typeID); - return projectFacet!=null && facetedProject.hasProjectFacet(projectFacet); - } - return false; - } - - public String getVersion() { - IFacetedProject facetedProject = null; - try { - facetedProject = ProjectFacetsManager.create(component.getProject()); - if (facetedProject !=null && ProjectFacetsManager.isProjectFacetDefined(IModuleConstants.WST_WEB_MODULE)) { - IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.WST_WEB_MODULE); - return facetedProject.getInstalledVersion(projectFacet).getVersionString(); - } - } catch (Exception e) { - //Ignore - } - return "1.0"; //$NON-NLS-1$ - } - -}
\ No newline at end of file |