diff options
Diffstat (limited to 'plugins/org.eclipse.wst.server.preview.adapter')
28 files changed, 0 insertions, 1815 deletions
diff --git a/plugins/org.eclipse.wst.server.preview.adapter/.classpath b/plugins/org.eclipse.wst.server.preview.adapter/.classpath deleted file mode 100644 index 196d49a46..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src/"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/org.eclipse.wst.server.preview.adapter/.cvsignore b/plugins/org.eclipse.wst.server.preview.adapter/.cvsignore deleted file mode 100644 index 33dd7de3d..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -bin -temp.folder -build.xml -@dot -src.zip -javaCompiler...args diff --git a/plugins/org.eclipse.wst.server.preview.adapter/.project b/plugins/org.eclipse.wst.server.preview.adapter/.project deleted file mode 100644 index e6caf7789..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.wst.server.preview.adapter</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> - </natures> -</projectDescription> diff --git a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index c8be4323e..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Nov 10 17:11:35 HST 2006 -eclipse.preferences.version=1 -encoding/<project>=ISO-8859-1 diff --git a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2920850ac..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,77 +0,0 @@ -#Thu Sep 13 15:25:06 EDT 2007 -eclipse.preferences.version=1 -instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=error -org.eclipse.jdt.core.builder.invalidClasspath=ignore -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=disabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=error -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.incompatibleJDKLevel=warning -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index a7cc1d0d0..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Feb 23 21:11:52 EST 2007 -eclipse.preferences.version=1 -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/> diff --git a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 08a60e5fc..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,14 +0,0 @@ -#Sat Apr 22 18:36:14 EDT 2006 -compilers.incompatible-environment=0 -compilers.p.build=0 -compilers.p.deprecated=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=0 -compilers.p.unknown-class=0 -compilers.p.unknown-element=0 -compilers.p.unknown-resource=0 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.wst.server.preview.adapter/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.server.preview.adapter/META-INF/MANIFEST.MF deleted file mode 100644 index 1ce6c06dc..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/META-INF/MANIFEST.MF +++ /dev/null @@ -1,16 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.wst.server.preview.adapter;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-Activator: org.eclipse.wst.server.preview.adapter.internal.core.PreviewPlugin -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Require-Bundle: org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)", - org.eclipse.wst.server.ui;bundle-version="[1.0.103,2.0.0)", - org.eclipse.debug.ui;bundle-version="[3.3.0,4.0.0)", - org.eclipse.wst.common.project.facet.ui;bundle-version="[1.2.0,2.0.0)" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.eclipse.wst.server.preview.adapter.internal.core;x-internal:=true, - org.eclipse.wst.server.preview.adapter.internal.ui;x-internal:=true diff --git a/plugins/org.eclipse.wst.server.preview.adapter/about.html b/plugins/org.eclipse.wst.server.preview.adapter/about.html deleted file mode 100644 index 2199df3f0..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>June, 2008</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor’s license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML> diff --git a/plugins/org.eclipse.wst.server.preview.adapter/build.properties b/plugins/org.eclipse.wst.server.preview.adapter/build.properties deleted file mode 100644 index f87c5e550..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - plugin.properties,\ - .,\ - plugin.xml,\ - about.html,\ - icons/ -bin.excludes = bin/**,\ - @dot/**,\ - temp.folder/** -source.. = src/ diff --git a/plugins/org.eclipse.wst.server.preview.adapter/icons/obj16/preview.gif b/plugins/org.eclipse.wst.server.preview.adapter/icons/obj16/preview.gif Binary files differdeleted file mode 100644 index b51ae39b8..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/icons/obj16/preview.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.server.preview.adapter/plugin.properties b/plugins/org.eclipse.wst.server.preview.adapter/plugin.properties deleted file mode 100644 index 7779d8118..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/plugin.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -pluginName=HTTP Preview Support -providerName=Eclipse.org - -previewRuntimeTypeName=HTTP Preview -previewRuntimeTypeDescription=A runtime to build static Web modules. - -previewServerTypeName=HTTP Preview -previewServerTypeDescription=A server to preview static Web modules. - -previewLaunchConfigurationType=HTTP Preview
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/plugin.xml b/plugins/org.eclipse.wst.server.preview.adapter/plugin.xml deleted file mode 100644 index d964a7a1f..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/plugin.xml +++ /dev/null @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<plugin> - <extension point="org.eclipse.wst.server.core.runtimeTypes"> - <runtimeType - id="org.eclipse.wst.server.preview.runtime" - name="%previewRuntimeTypeName" - description="%previewRuntimeTypeDescription" - facetRuntimeComponent="org.eclipse.wst.server.preview.runtime" - facetRuntimeVersion="1.0" - class="org.eclipse.wst.server.preview.adapter.internal.core.PreviewRuntime"> - <moduleType - types="wst.web" - versions="1.0"/> - </runtimeType> - </extension> - - <extension point="org.eclipse.wst.server.core.serverTypes"> - <serverType - id="org.eclipse.wst.server.preview.server" - name="%previewServerTypeName" - description="%previewServerTypeDescription" - supportsRemoteHosts="false" - runtime="true" - initialState="stopped" - hasConfiguration="false" - launchModes="run,debug,profile" - launchConfigId="org.eclipse.wst.server.preview.launchConfigurationType" - runtimeTypeId="org.eclipse.wst.server.preview.runtime" - class="org.eclipse.wst.server.preview.adapter.internal.core.PreviewServer" - behaviourClass="org.eclipse.wst.server.preview.adapter.internal.core.PreviewServerBehaviour"/> - </extension> - - <extension point="org.eclipse.wst.common.project.facet.core.runtimes"> - <runtime-component-type - id="org.eclipse.wst.server.preview.runtime"/> - - <runtime-component-version - type="org.eclipse.wst.server.preview.runtime" - version="1.0"/> - - <supported> - <runtime-component - id="org.eclipse.wst.server.preview.runtime" - version="1.0"/> - <facet - id="wst.web" - version="1.0"/> - </supported> - </extension> - - <extension point="org.eclipse.debug.core.launchConfigurationTypes"> - <launchConfigurationType - id="org.eclipse.wst.server.preview.launchConfigurationType" - name="%previewLaunchConfigurationType" - delegate="org.eclipse.wst.server.preview.adapter.internal.core.PreviewLaunchConfigurationDelegate" - modes="run,debug,profile"/> - </extension> - - <extension point="org.eclipse.wst.server.core.launchableAdapters"> - <launchableAdapter - id="org.eclipse.wst.server.preview" - class="org.eclipse.wst.server.preview.adapter.internal.core.PreviewLaunchableAdapterDelegate"/> - </extension> - - - <extension point="org.eclipse.wst.server.ui.serverImages"> - <image - id="org.eclipse.wst.server.preview.ui" - typeIds="org.eclipse.wst.server.preview.runtime,org.eclipse.wst.server.preview.server" - icon="icons/obj16/preview.gif"/> - </extension> - - <extension point="org.eclipse.wst.common.project.facet.ui.images"> - <image runtime-component-type="org.eclipse.wst.server.preview.runtime" - path="icons/obj16/preview.gif"/> - </extension> - - <extension point="org.eclipse.wst.common.project.facet.core.runtimes"> - <adapter> - <runtime-component id="org.eclipse.wst.server.preview.runtime"/> - <factory class="org.eclipse.wst.server.ui.FacetRuntimeComponentLabelProvider"/> - <type class="org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider"/> - </adapter> - </extension> - - <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets"> - <default-facets> - <runtime-component id="org.eclipse.wst.server.preview.runtime"/> - <facet id="wst.jsdt.web" version="1.0"/> - </default-facets> - </extension> - - <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> - <launchConfigurationTypeImage - id="org.eclipse.wst.server.preview.launchConfigurationTypeImage" - configTypeID="org.eclipse.wst.server.preview.launchConfigurationType" - icon="icons/obj16/preview.gif"> - </launchConfigurationTypeImage> - </extension> - - <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups"> - <launchConfigurationTabGroup - id="org.eclipse.wst.server.preview.launchConfigurationTabGroup" - type="org.eclipse.wst.server.preview.launchConfigurationType" - class="org.eclipse.wst.server.preview.adapter.internal.ui.PreviewLaunchConfigurationTabGroup"> - </launchConfigurationTabGroup> - </extension> -</plugin>
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/IMemento.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/IMemento.java deleted file mode 100644 index 6c81ad09f..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/IMemento.java +++ /dev/null @@ -1,64 +0,0 @@ -/********************************************************************** - * Copyright (c) 2003, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - **********************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; -/** - * Interface to a memento used for saving the important state of an object - * in a form that can be persisted in the file system. - * <p> - * Mementos were designed with the following requirements in mind: - * <ol> - * <li>Certain objects need to be saved and restored across platform sessions. - * </li> - * <li>When an object is restored, an appropriate class for an object might not - * be available. It must be possible to skip an object in this case.</li> - * <li>When an object is restored, the appropriate class for the object may be - * different from the one when the object was originally saved. If so, the - * new class should still be able to read the old form of the data.</li> - * </ol> - * </p> - * <p> - * Mementos meet these requirements by providing support for storing a - * mapping of arbitrary string keys to primitive values, and by allowing - * mementos to have other mementos as children (arranged into a tree). - * A robust external storage format based on XML is used. - * </p><p> - * This interface is not intended to be implemented by clients. - * </p> - */ -public interface IMemento { - /** - * Creates a new child of this memento with the given type. - * <p> - * The <code>getChild</code> and <code>getChildren</code> methods - * are used to retrieve children of a given type. - * </p> - * - * @param type the type - * @return a new child memento - */ - public IMemento createChild(String type); - - /** - * Sets the value of the given key to the given integer. - * - * @param key the key - * @param value the value - */ - public void putInteger(String key, int value); - - /** - * Sets the value of the given key to the given string. - * - * @param key the key - * @param value the value - */ - public void putString(String key, String value); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Messages.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Messages.java deleted file mode 100644 index 02386ce04..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Messages.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import org.eclipse.osgi.util.NLS; -/** - * Translated messages. - */ -public class Messages extends NLS { - public static String canModifyModules; - public static String httpPort; - - public static String errorPortInUse; - public static String errorPublish; - - static { - NLS.initializeMessages(PreviewPlugin.PLUGIN_ID + ".internal.core.Messages", Messages.class); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Messages.properties b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Messages.properties deleted file mode 100644 index e42ed17b9..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Messages.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -httpPort=HTTP Port -canModifyModules=Web modules can be modified. - -errorPublish=Error during publish -errorPortInUse=Port {0} required by {1} is already in use. The server may already be running in another process, or a system process may be using the port. \ - To start this server you will need to stop the other process or change the port number(s).
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PingThread.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PingThread.java deleted file mode 100644 index 546a0dd18..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PingThread.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.io.FileNotFoundException; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; - -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.internal.Server; -/** - * Thread used to ping server to test when it is started. - */ -public class PingThread { - // delay before pinging starts - private static final int PING_DELAY = 2000; - - // delay between pings - private static final int PING_INTERVAL = 250; - - // maximum number of pings before giving up - private int maxPings; - - private boolean stop = false; - private String url; - private IServer server; - private PreviewServerBehaviour behaviour; - - /** - * Create a new PingThread. - * - * @param server - * @param url - * @param behaviour - */ - public PingThread(IServer server, String url, PreviewServerBehaviour behaviour) { - super(); - this.server = server; - this.url = url; - this.behaviour = behaviour; - this.maxPings = guessMaxPings(); - Thread t = new Thread("Preview Ping Thread") { - public void run() { - ping(); - } - }; - t.setDaemon(true); - t.start(); - } - - private int guessMaxPings() { - int startTimeout = ((Server)server).getStartTimeout() * 1000; - if (startTimeout > 0) - return startTimeout / PING_INTERVAL; - return -1; - } - - /** - * Ping the server until it is started. Then set the server - * state to STATE_STARTED. - */ - protected void ping() { - int count = 0; - try { - Thread.sleep(PING_DELAY); - } catch (Exception e) { - // ignore - } - while (!stop) { - try { - if (count == maxPings) { - try { - server.stop(false); - } catch (Exception e) { - Trace.trace(Trace.FINEST, "Ping: could not stop server"); - } - stop = true; - break; - } - count++; - - Trace.trace(Trace.FINEST, "Ping: pinging " + count); - URL pingUrl = new URL(url); - URLConnection conn = pingUrl.openConnection(); - ((HttpURLConnection)conn).getResponseCode(); - - // ping worked - server is up - if (!stop) { - Trace.trace(Trace.FINEST, "Ping: success"); - Thread.sleep(200); - behaviour.setServerStarted(); - } - stop = true; - } catch (FileNotFoundException fe) { - try { - Thread.sleep(200); - } catch (Exception e) { - // ignore - } - behaviour.setServerStarted(); - stop = true; - } catch (Exception e) { - Trace.trace(Trace.FINEST, "Ping: failed"); - // pinging failed - if (!stop) { - try { - Thread.sleep(PING_INTERVAL); - } catch (InterruptedException e2) { - // ignore - } - } - } - } - } - - /** - * Tell the pinging to stop. - */ - public void stop() { - Trace.trace(Trace.FINEST, "Ping: stopping"); - stop = true; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewLaunchConfigurationDelegate.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewLaunchConfigurationDelegate.java deleted file mode 100644 index 2032f0eb4..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewLaunchConfigurationDelegate.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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 - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.core.model.LaunchConfigurationDelegate; -import org.eclipse.osgi.service.environment.Constants; - -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.ServerUtil; -import org.osgi.framework.Bundle; -/** - * - */ -public class PreviewLaunchConfigurationDelegate extends LaunchConfigurationDelegate { - private static final String[] REQUIRED_BUNDLE_IDS = new String[] { - "javax.servlet", - "javax.servlet.jsp", - "org.mortbay.jetty.server", - "org.mortbay.jetty.util", - "org.eclipse.wst.server.preview" - }; - - private static final String[] fgCandidateJavaFiles = {"javaw", "javaw.exe", "java", - "java.exe", "j9w", "j9w.exe", "j9", "j9.exe"}; - private static final String[] fgCandidateJavaLocations = {"bin" + File.separatorChar, - "jre" + File.separatorChar + "bin" + File.separatorChar}; - - private static final String MAIN_CLASS = "org.eclipse.wst.server.preview.internal.PreviewStarter"; - - public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { - IServer server = ServerUtil.getServer(configuration); - if (server == null) { - Trace.trace(Trace.FINEST, "Launch configuration could not find server"); - // throw CoreException(); - return; - } - - if (server.shouldPublish() && ServerCore.isAutoPublishing()) - server.publish(IServer.PUBLISH_INCREMENTAL, monitor); - - PreviewServerBehaviour previewServer = (PreviewServerBehaviour) server.loadAdapter(PreviewServerBehaviour.class, null); - - StringBuffer cp = new StringBuffer(); - int size = REQUIRED_BUNDLE_IDS.length; - for (int i = 0; i < size; i++) { - Bundle b = Platform.getBundle(REQUIRED_BUNDLE_IDS[i]); - IPath path = null; - if (b != null) - path = PreviewRuntime.getJarredPluginPath(b); - if (path == null) - throw new CoreException(new Status(IStatus.ERROR, PreviewPlugin.PLUGIN_ID, "Could not find required bundle " + REQUIRED_BUNDLE_IDS[i])); - - // run from workbench support - if (i == 4 && path.append("bin").toFile().exists()) - path = path.append("bin"); - - if (i > 0) - cp.append(File.pathSeparator); - cp.append(path.toOSString()); - } - - List<String> cmds = new ArrayList<String>(); - - // jre - File java = getJavaExecutable(); - if (java == null) - throw new CoreException(new Status(IStatus.ERROR, PreviewPlugin.PLUGIN_ID, "Could not find JRE executable")); - - cmds.add(java.getAbsolutePath()); - - cmds.add("-classpath"); - cmds.add(cp.toString()); - - cmds.add(MAIN_CLASS); - - cmds.add(previewServer.getTempDirectory().append("preview.xml").toOSString()); - - //setDefaultSourceLocator(launch, configuration); - - // launch the configuration - previewServer.setupLaunch(launch, mode, monitor); - - try { - String[] cmdLine = new String[cmds.size()]; - cmds.toArray(cmdLine); - Process p = DebugPlugin.exec(cmdLine, null); - if (p != null) { - IProcess pr = DebugPlugin.newProcess(launch, p, cmdLine[0]); - pr.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(cmdLine)); - launch.addProcess(pr); - previewServer.addProcessListener(pr); - } - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Problem creating preview process"); - } - } - - /** - * Prepares the command line from the specified array of strings. - * - * @param commandLine - * @return the command line string - */ - protected static String renderCommandLine(String[] commandLine) { - if (commandLine.length < 1) - return ""; //$NON-NLS-1$ - StringBuffer buf= new StringBuffer(); - for (int i= 0; i < commandLine.length; i++) { - buf.append(' '); - char[] characters= commandLine[i].toCharArray(); - StringBuffer command= new StringBuffer(); - boolean containsSpace= false; - for (int j = 0; j < characters.length; j++) { - char character= characters[j]; - if (character == '\"') { - command.append('\\'); - } else if (character == ' ') { - containsSpace = true; - } - command.append(character); - } - if (containsSpace) { - buf.append('\"'); - buf.append(command.toString()); - buf.append('\"'); - } else { - buf.append(command.toString()); - } - } - return buf.toString(); - } - - protected static File getJavaExecutable() { - // do not detect on the Mac OS - if (Platform.getOS().equals(Constants.OS_MACOSX)) - return null; - - // retrieve the 'java.home' system property. If that directory doesn't exist, return null - File javaHome; - try { - javaHome = new File(System.getProperty("java.home")).getCanonicalFile(); - } catch (IOException e) { - return null; - } - if (!javaHome.exists()) - return null; - - // find the 'java' executable file under the java home directory. If it can't be - // found, return null - return findJavaExecutable(javaHome); - } - - protected static File findJavaExecutable(File vmInstallLocation) { - // try each candidate in order, the first one found wins. Thus, the order - // of fgCandidateJavaLocations and fgCandidateJavaFiles is significant - for (int i = 0; i < fgCandidateJavaFiles.length; i++) { - for (int j = 0; j < fgCandidateJavaLocations.length; j++) { - File javaFile = new File(vmInstallLocation, fgCandidateJavaLocations[j] + fgCandidateJavaFiles[i]); - if (javaFile.isFile()) { - return javaFile; - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewLaunchableAdapterDelegate.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewLaunchableAdapterDelegate.java deleted file mode 100644 index a01d9dab4..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewLaunchableAdapterDelegate.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.net.URL; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.server.core.IModuleArtifact; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.model.LaunchableAdapterDelegate; -import org.eclipse.wst.server.core.util.HttpLaunchable; -import org.eclipse.wst.server.core.util.WebResource; - -public class PreviewLaunchableAdapterDelegate extends LaunchableAdapterDelegate { - /* - * @see LaunchableAdapterDelegate#getLaunchable(IServer, IModuleArtifact) - */ - public Object getLaunchable(IServer server, IModuleArtifact moduleArtifact) throws CoreException { - if (server == null || moduleArtifact == null) - return null; - - PreviewServer server2 = (PreviewServer) server.loadAdapter(PreviewServer.class, null); - if (server2 == null) - return null; - - try { - URL url = server2.getModuleRootURL(moduleArtifact.getModule()); - - if (moduleArtifact instanceof WebResource) { - WebResource resource = (WebResource) moduleArtifact; - String path = resource.getPath().toString(); - - if (path.startsWith("/")) - path = path.substring(1); - url = new URL(url.toExternalForm() + "/" + path); - } - return new HttpLaunchable(url); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Error in launchable adapter", e); - } - - return null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewPlugin.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewPlugin.java deleted file mode 100644 index 034ac8e5c..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewPlugin.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; -/** - * The HTTP server core plugin. - */ -public class PreviewPlugin extends Plugin { - public static final String PLUGIN_ID = "org.eclipse.wst.server.preview.adapter"; - - private static PreviewPlugin plugin; - - /** - * The constructor - */ - public PreviewPlugin() { - plugin = this; - } - - /** - * Returns the singleton instance of this plugin. - * - * @return an instance - */ - public static PreviewPlugin getInstance() { - return plugin; - } - - /** - * Return the install location preference. - * - * @param id a runtime type id - * @return the install location - */ - public static String getPreference(String id) { - return getInstance().getPluginPreferences().getString(id); - } - - /** - * Set the install location preference. - * - * @param id the runtimt type id - * @param value the location - */ - public static void setPreference(String id, String value) { - getInstance().getPluginPreferences().setValue(id, value); - getInstance().savePluginPreferences(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewRuntime.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewRuntime.java deleted file mode 100644 index 3fbec234a..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewRuntime.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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 - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -import org.eclipse.core.runtime.*; -import org.eclipse.wst.server.core.model.RuntimeDelegate; -import org.osgi.framework.Bundle; -/** - * HTTP preview runtime. - */ -public class PreviewRuntime extends RuntimeDelegate { - public static final String ID = "org.eclipse.wst.server.preview.runtime"; - - /** - * Create a new preview runtime. - */ - public PreviewRuntime() { - // do nothing - } - - /** - * Returns the path that corresponds to the specified bundle. - * - * @return a path - */ - protected static Path getPluginPath(Bundle bundle) { - try { - URL installURL = bundle.getEntry("/"); - URL localURL = FileLocator.toFileURL(installURL); - return new Path(localURL.getFile()); - } catch (IOException ioe) { - return null; - } - } - - protected static IPath getJarredPluginPath(Bundle bundle) { - try { - File file = FileLocator.getBundleFile(bundle); - return new Path(file.getCanonicalPath()); - } catch (IOException e) { - // ignore, return null - return null; - } - } - - public IStatus validate() { - IStatus status = super.validate(); - if (!status.isOK() && status.getMessage().length() > 0) - return status; - - return Status.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServer.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServer.java deleted file mode 100644 index 737b9900c..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServer.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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 - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.net.URL; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.IRuntimeType; -import org.eclipse.wst.server.core.IRuntimeWorkingCopy; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.IServerWorkingCopy; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.ServerPort; -import org.eclipse.wst.server.core.model.IURLProvider; -import org.eclipse.wst.server.core.model.ServerDelegate; -import org.eclipse.wst.server.core.util.IStaticWeb; -/** - * HTTP preview server. - */ -public class PreviewServer extends ServerDelegate implements IURLProvider { - public static final String ID = "org.eclipse.wst.server.preview.server"; - - public static final String PROPERTY_PORT = "port"; - - /** - * PreviewServer. - */ - public PreviewServer() { - super(); - } - - protected void initialize() { - // do nothing - } - - public PreviewRuntime getPreviewRuntime() { - if (getServer().getRuntime() == null) - return null; - - return (PreviewRuntime) getServer().getRuntime().loadAdapter(PreviewRuntime.class, null); - } - - /** - * Return the root URL of this module. - * - * @param module a module - * @return java.net.URL - */ - public URL getModuleRootURL(IModule module) { - try { - String base = "http://localhost"; - - int port = getPort(); - URL url = null; - if (port == 80) - url = new URL(base + "/"); - else - url = new URL(base + ":" + port + "/"); - - String type = module.getModuleType().getId(); - if ("wst.web".equals(type)) { - IStaticWeb staticWeb = (IStaticWeb) module.loadAdapter(IStaticWeb.class, null); - return new URL(url, staticWeb.getContextRoot()); - } - return url; - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Could not get root URL", e); - return null; - } - } - - /* - * Returns the child module(s) of this module. - */ - public IModule[] getChildModules(IModule[] module) { - return new IModule[0]; - } - - /* - * Returns the root module(s) of this module. - */ - public IModule[] getRootModules(IModule module) throws CoreException { - return new IModule[] { module }; - } - - /** - * Returns true if the given project is supported by this server, and false - * otherwise. - * - * @param add modules - * @param remove modules - * @return the status - */ - public IStatus canModifyModules(IModule[] add, IModule[] remove) { - return new Status(IStatus.OK, PreviewPlugin.PLUGIN_ID, 0, Messages.canModifyModules, null); - } - - public ServerPort[] getServerPorts() { - int port = getPort(); - ServerPort[] ports = { new ServerPort("http", Messages.httpPort, port, "http") }; - return ports; - } - - public int getPort() { - return getAttribute(PreviewServer.PROPERTY_PORT, 8080); - } - - public void setPort(int port) { - setAttribute(PreviewServer.PROPERTY_PORT, port); - } - - public static IServer createPreviewServer(String serverName) { - try { - NullProgressMonitor monitor = new NullProgressMonitor(); - IRuntimeType runtimeType = ServerCore.findRuntimeType(PreviewRuntime.ID); - IRuntimeWorkingCopy runtimeCopy = runtimeType.createRuntime(PreviewRuntime.ID, monitor); - IRuntime runtime = runtimeCopy.save(true, monitor); - - IServerType serverType = ServerCore.findServerType(ID); - IServerWorkingCopy workingCopy = serverType.createServer(ID, null, runtime, monitor); - workingCopy.setName(serverName); - workingCopy.setHost("localhost"); - return workingCopy.save(true, monitor); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Error creating server", e); - } - - return null; - } - - public static IServer findPreviewServer(String id) { - IServer[] servers = ServerCore.getServers(); - for (IServer server : servers) { - if (server.getId().equals(id)) - return server; - } - return null; - } - - public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException { - // do nothing - } - - /** - * Return a string representation of this object. - * - * @return java.lang.String - */ - public String toString() { - return "PreviewServer"; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServerBehaviour.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServerBehaviour.java deleted file mode 100644 index ea0f5ec39..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServerBehaviour.java +++ /dev/null @@ -1,293 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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 - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerPort; -import org.eclipse.wst.server.core.model.IModuleResource; -import org.eclipse.wst.server.core.model.IModuleResourceDelta; -import org.eclipse.wst.server.core.model.ServerBehaviourDelegate; -import org.eclipse.wst.server.core.util.IStaticWeb; -import org.eclipse.wst.server.core.util.ProjectModule; -import org.eclipse.wst.server.core.util.PublishUtil; -import org.eclipse.wst.server.core.util.SocketUtil; -/** - * Preview server. - */ -public class PreviewServerBehaviour extends ServerBehaviourDelegate { - // the thread used to ping the server to check for startup - protected transient PingThread ping = null; - protected transient IDebugEventSetListener processListener; - - /** - * PreviewServer. - */ - public PreviewServerBehaviour() { - super(); - } - - public void initialize(IProgressMonitor monitor) { - // do nothing - } - - public PreviewRuntime getPreviewRuntime() { - if (getServer().getRuntime() == null) - return null; - - return (PreviewRuntime) getServer().getRuntime().loadAdapter(PreviewRuntime.class, null); - } - - public PreviewServer getPreviewServer() { - return (PreviewServer) getServer().getAdapter(PreviewServer.class); - } - - /** - * Returns the runtime base path for relative paths in the server - * configuration. - * - * @return the base path - */ - public IPath getRuntimeBaseDirectory() { - return getServer().getRuntime().getLocation(); - } - - /** - * Setup for starting the server. - * - * @param launch ILaunch - * @param launchMode String - * @param monitor IProgressMonitor - * @throws CoreException if anything goes wrong - */ - protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException { - // check that ports are free - ServerPort[] ports = getPreviewServer().getServerPorts(); - int port = ports[0].getPort(); - - if (SocketUtil.isPortInUse(port, 5)) - throw new CoreException(new Status(IStatus.ERROR, PreviewPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorPortInUse, new String[] {port + "", getServer().getName()}), null)); - - // generate preview config file - XMLMemento memento = XMLMemento.createWriteRoot("server"); - memento.putInteger("port", port); - - IModule[] modules = getServer().getModules(); - for (IModule module : modules) { - IMemento mod = memento.createChild("module"); - mod.putString("name", module.getName()); - String type = module.getModuleType().getId(); - if ("wst.web".equals(type)) { - IStaticWeb staticWeb = (IStaticWeb) module.loadAdapter(IStaticWeb.class, null); - if (staticWeb != null) - mod.putString("context", staticWeb.getContextRoot()); - mod.putString("type", "static"); - } - mod.putString("path", getModulePublishDirectory(module).toPortableString()); - } - try { - memento.saveToFile(getTempDirectory().append("preview.xml").toOSString()); - } catch (IOException e) { - Trace.trace(Trace.SEVERE, "Could not write preview config", e); - throw new CoreException(new Status(IStatus.ERROR, PreviewPlugin.PLUGIN_ID, 0, "Could not write preview configuration", null)); - } - - setServerRestartState(false); - setServerState(IServer.STATE_STARTING); - setMode(launchMode); - - // ping server to check for startup - try { - String url = "http://localhost"; - if (port != 80) - url += ":" + port; - ping = new PingThread(getServer(), url, this); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Can't ping for Tomcat startup."); - } - } - - protected void addProcessListener(final IProcess newProcess) { - if (processListener != null || newProcess == null) - return; - - processListener = new IDebugEventSetListener() { - public void handleDebugEvents(DebugEvent[] events) { - if (events != null) { - for (DebugEvent event : events) { - if (newProcess != null && newProcess.equals(event.getSource()) && event.getKind() == DebugEvent.TERMINATE) { - stop(true); - } - } - } - } - }; - DebugPlugin.getDefault().addDebugEventListener(processListener); - } - - protected void setServerStarted() { - setServerState(IServer.STATE_STARTED); - } - - protected void publishServer(int kind, IProgressMonitor monitor) throws CoreException { - monitor = ProgressUtil.getMonitorFor(monitor); - monitor.done(); - - setServerPublishState(IServer.PUBLISH_STATE_NONE); - } - - /* - * Publishes the given module to the server. - */ - protected void publishModule(int kind, int deltaKind, IModule[] moduleTree, IProgressMonitor monitor) throws CoreException { - IModule module = moduleTree[moduleTree.length - 1]; - if (isSingleRootStructure(module)) - return; - - IPath to = getModulePublishDirectory(module); - - if (kind == IServer.PUBLISH_CLEAN || deltaKind == ServerBehaviourDelegate.REMOVED) { - IStatus[] status = PublishUtil.deleteDirectory(to.toFile(), monitor); - throwException(status); - } - - IModuleResource[] res = getResources(moduleTree); - IStatus[] status = PublishUtil.publishSmart(res, to, monitor); - throwException(status); - - setModulePublishState(moduleTree, IServer.PUBLISH_STATE_NONE); - } - - /** - * Utility method to throw a CoreException based on the contents of a list of - * error and warning status. - * - * @param status a List containing error and warning IStatus - * @throws CoreException - */ - private static void throwException(IStatus[] status) throws CoreException { - if (status == null || status.length == 0) - return; - - if (status.length == 1) - throw new CoreException(status[0]); - - String message = Messages.errorPublish; - MultiStatus status2 = new MultiStatus(PreviewPlugin.PLUGIN_ID, 0, status, message, null); - throw new CoreException(status2); - } - - public void restart(String launchMode) throws CoreException { - setServerState(IServer.STATE_STOPPED); - setServerState(IServer.STATE_STARTED); - } - - /** - * Cleanly shuts down and terminates the server. - * - * @param force <code>true</code> to kill the server - */ - public void stop(boolean force) { - int state = getServer().getServerState(); - if (state == IServer.STATE_STOPPED) - return; - - setServerState(IServer.STATE_STOPPING); - - if (ping != null) { - ping.stop(); - ping = null; - } - - if (processListener != null) { - DebugPlugin.getDefault().removeDebugEventListener(processListener); - processListener = null; - } - - try { - Trace.trace(Trace.FINEST, "Killing the process"); - ILaunch launch = getServer().getLaunch(); - if (launch != null) - launch.terminate(); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Error killing the process", e); - } - - setServerState(IServer.STATE_STOPPED); - } - - protected IPath getTempDirectory() { - return super.getTempDirectory(); - } - - /** - * Returns <code>true</code> if the module in the workspace has a single - * root structure - i.e. matches the spec disk layout - and <code>false</code> - * otherwise. - * - * @return <code>true</code> if the module in the workspace has a single - * root structure - i.e. matches the spec disk layout - and - * <code>false</code> otherwise - */ - protected boolean isSingleRootStructure(IModule module) { - ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null); - if (pm == null) - return false; - - return pm.isSingleRootStructure(); - } - - /** - * Returns the module's publish path. - * - * @param module a module - * @return the publish directory for the module - */ - protected IPath getModulePublishDirectory(IModule module) { - if (isSingleRootStructure(module)) { - IStaticWeb webModule = (IStaticWeb) module.loadAdapter(IStaticWeb.class, null); - if (webModule != null) { - //IContainer[] moduleFolder = webModule.getResourceFolders(); - //if (moduleFolder != null && moduleFolder.length > 0) - // return moduleFolder[0].getLocation(); - } - } - - return getTempDirectory().append(module.getName()); - } - - /** - * Return a string representation of this object. - * - * @return java.lang.String - */ - public String toString() { - return "PreviewServer"; - } - - protected IModuleResourceDelta[] getPublishedResourceDelta(IModule[] module) { - return super.getPublishedResourceDelta(module); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewStartup.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewStartup.java deleted file mode 100644 index e2792b092..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewStartup.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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 - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.IRuntimeType; -import org.eclipse.wst.server.core.IRuntimeWorkingCopy; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.IServerWorkingCopy; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.internal.IStartup; - -public class PreviewStartup implements IStartup { - private static final String ID = "xyz"; - - public void startup() { - // create runtime - IRuntime[] runtimes = ServerCore.getRuntimes(); - IRuntime runtime = null; - - for (IRuntime r : runtimes) { - if (r.getRuntimeType() != null && PreviewRuntime.ID.equals(r.getRuntimeType().getId())) { - if (ID.equals(r.getId())) - runtime = r; - } - } - - if (runtime == null) { - try { - IRuntimeType runtimeType = ServerCore.findRuntimeType(PreviewRuntime.ID); - IRuntimeWorkingCopy wc = runtimeType.createRuntime(ID, null); - wc.setName("My Preview"); - wc.setReadOnly(true); - runtime = wc.save(true, null); - } catch (CoreException ce) { - Trace.trace(Trace.WARNING, "Could not create default preview runtime"); - } - } - - // create server - IServer[] servers = ServerCore.getServers(); - - boolean found = false; - for (IServer s : servers) { - if (s.getServerType() != null && PreviewServer.ID.equals(s.getServerType().getId())) { - if (ID.equals(s.getId())) - found = true; - } - } - - if (!found) { - try { - IServerType serverType = ServerCore.findServerType(PreviewServer.ID); - IServerWorkingCopy wc = serverType.createServer(ID, null, runtime, null); - wc.setName("My preview"); - wc.setHost("localhost"); - wc.setReadOnly(true); - wc.save(true, null); - } catch (CoreException ce) { - Trace.trace(Trace.WARNING, "Could not create default preview server"); - } - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/ProgressUtil.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/ProgressUtil.java deleted file mode 100644 index 7f77bec66..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/ProgressUtil.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import org.eclipse.core.runtime.*; -/** - * Progress Monitor utility. - */ -public class ProgressUtil { - /** - * ProgressUtil constructor comment. - */ - private ProgressUtil() { - super(); - } - - /** - * Return a valid progress monitor. - * - * @param monitor org.eclipse.core.runtime.IProgressMonitor - * @return org.eclipse.core.runtime.IProgressMonitor - */ - public static IProgressMonitor getMonitorFor(IProgressMonitor monitor) { - if (monitor == null) - return new NullProgressMonitor(); - return monitor; - } - - /** - * Return a sub-progress monitor with the given amount on the - * current progress monitor. - * - * @param monitor org.eclipse.core.runtime.IProgressMonitor - * @param ticks int - * @return org.eclipse.core.runtime.IProgressMonitor - */ - public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new SubProgressMonitor(monitor, ticks); - } - - /** - * Return a sub-progress monitor with the given amount on the - * current progress monitor. - * - * @param monitor org.eclipse.core.runtime.IProgressMonitor - * @param ticks a number of ticks - * @param style a style - * @return org.eclipse.core.runtime.IProgressMonitor - */ - public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks, int style) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new SubProgressMonitor(monitor, ticks, style); - } -} diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Trace.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Trace.java deleted file mode 100644 index c1b1f531d..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/Trace.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -/** - * Helper class to route trace output. - */ -public class Trace { - public static byte CONFIG = 0; - public static byte WARNING = 1; - public static byte SEVERE = 2; - public static byte FINEST = 3; - public static byte FINER = 4; - - private static final String[] levelNames = new String[] { "CONFIG ", "WARNING ", - "SEVERE ", "FINER ", "FINEST " }; - - private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm.ss.SSS"); - - /** - * Trace constructor comment. - */ - private Trace() { - super(); - } - - /** - * Trace the given text. - * - * @param level the trace level - * @param s a message - */ - public static void trace(byte level, String s) { - Trace.trace(level, s, null); - } - - /** - * Trace the given message and exception. - * - * @param level the trace level - * @param s a message - * @param t a throwable - */ - public static void trace(byte level, String s, Throwable t) { - if (s == null) - return; - - if (level == SEVERE) - PreviewPlugin.getInstance().getLog().log(new Status(IStatus.ERROR, PreviewPlugin.PLUGIN_ID, s, t)); - - if (!PreviewPlugin.getInstance().isDebugging()) - return; - - StringBuffer sb = new StringBuffer(PreviewPlugin.PLUGIN_ID); - sb.append(" "); - sb.append(levelNames[level]); - sb.append(" "); - sb.append(sdf.format(new Date())); - sb.append(" "); - sb.append(s); - // Platform.getDebugOption(ServerCore.PLUGIN_ID + "/" + "resources"); - - System.out.println(sb.toString()); - if (t != null) - t.printStackTrace(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/XMLMemento.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/XMLMemento.java deleted file mode 100644 index b177e303f..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/XMLMemento.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.core; - -import java.io.*; - -import org.w3c.dom.*; - -import javax.xml.parsers.*; -import javax.xml.transform.*; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -/** - * A Memento is a class independent container for persistence - * info. It is a reflection of 3 storage requirements. - * - * 1) We need the ability to persist an object and restore it. - * 2) The class for an object may be absent. If so we would - * like to skip the object and keep reading. - * 3) The class for an object may change. If so the new class - * should be able to read the old persistence info. - * - * We could ask the objects to serialize themselves into an - * ObjectOutputStream, DataOutputStream, or Hashtable. However - * all of these approaches fail to meet the second requirement. - * - * Memento supports binary persistance with a version ID. - */ -public final class XMLMemento implements IMemento { - private Document factory; - private Element element; - - /** - * Answer a memento for the document and element. For simplicity - * you should use createReadRoot and createWriteRoot to create the initial - * mementos on a document. - */ - private XMLMemento(Document doc, Element el) { - factory = doc; - element = el; - } - - /** - * @see IMemento#createChild(String) - */ - public IMemento createChild(String type) { - Element child = factory.createElement(type); - element.appendChild(child); - return new XMLMemento(factory, child); - } - - /** - * Answer a root memento for writing a document. - * - * @param type a type - * @return a memento - */ - public static XMLMemento createWriteRoot(String type) { - Document document; - try { - document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - Element element = document.createElement(type); - document.appendChild(element); - return new XMLMemento(document, element); - } catch (ParserConfigurationException e) { - throw new Error(e); - } - } - - /* - * @see IMemento - */ - public void putInteger(String key, int n) { - element.setAttribute(key, String.valueOf(n)); - } - - /* - * @see IMemento - */ - public void putString(String key, String value) { - if (value == null) - return; - element.setAttribute(key, value); - } - - /** - * Save this Memento to a Writer. - * - * @param os an output stream - * @throws IOException if anything goes wrong - */ - private void save(OutputStream os) throws IOException { - Result result = new StreamResult(os); - Source source = new DOMSource(factory); - try { - Transformer transformer = TransformerFactory.newInstance().newTransformer(); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); - transformer.transform(source, result); - } catch (Exception e) { - throw (IOException) (new IOException().initCause(e)); - } - } - - /** - * Saves the memento to the given file. - * - * @param filename java.lang.String - * @exception java.io.IOException - */ - public void saveToFile(String filename) throws IOException { - FileOutputStream w = null; - try { - w = new FileOutputStream(filename); - save(w); - } catch (IOException e) { - throw e; - } catch (Exception e) { - throw new IOException(e.getLocalizedMessage()); - } finally { - if (w != null) { - try { - w.close(); - } catch (Exception e) { - // ignore - } - } - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/ui/PreviewLaunchConfigurationTabGroup.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/ui/PreviewLaunchConfigurationTabGroup.java deleted file mode 100644 index 9a4d5083c..000000000 --- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/ui/PreviewLaunchConfigurationTabGroup.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.preview.adapter.internal.ui; - -import org.eclipse.debug.ui.*; - -import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab; -/** - * A debug tab group for launching the preview server. - */ -public class PreviewLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup { - /* - * @see ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String) - */ - public void createTabs(ILaunchConfigurationDialog dialog, String mode) { - ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[2]; - tabs[0] = new ServerLaunchConfigurationTab(new String[] { "org.eclipse.wst.server.preview" }); - tabs[0].setLaunchConfigurationDialog(dialog); - /*tabs[2] = new EnvironmentTab(); - tabs[2].setLaunchConfigurationDialog(dialog);*/ - tabs[1] = new CommonTab(); - tabs[1].setLaunchConfigurationDialog(dialog); - setTabs(tabs); - } -}
\ No newline at end of file |