diff options
Diffstat (limited to 'bundles/org.eclipse.wst.command.env.core/src/org/eclipse')
69 files changed, 0 insertions, 5831 deletions
diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/Command.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/Command.java deleted file mode 100644 index 6fbda350d..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/Command.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core; - -import org.eclipse.wst.command.env.core.common.Environment; -import org.eclipse.wst.command.env.core.common.Status; - -/** - * Commands are executable, undoable, redoable objects. - * Every Command has a name and a description. - */ -public interface Command -{ - /** - * Returns the name of the Command, a short translatable string - * indicating what the Command does. Can be null. - * @return The name of the Command. Can be null. - */ - public String getName (); - - /** - * Returns the description of the Command. Can be null. - * @return The description of the Command. Can be null. - */ - public String getDescription (); - - /** - * Executes the Command. - * @param environment The environment. - * Must not be null. - * @return A <code>Status</code> object indicating the degree - * to which the <code>execute</code> method was successful. - * A valud of <code>null</code>, or a Status with a severity - * of less than <code>Status.ERROR</code> signifies success. - */ - public Status execute ( Environment environment ); - - /** - * Returns <code>true</code> if, and only if, the Command's - * <code>undo</code> method is supported. - * @return True if the Command supports being undone. - */ - public boolean isUndoable (); - - /** - * Undoes the Command. - * @param environment The environment. - * Must not be null. - * @return A <code>Status</code> object indicating the degree - * to which the <code>undo</code> method was successful. - * A valud of <code>null</code>, or a Status with a severity - * of less than <code>Status.ERROR</code> signifies success. - */ - public Status undo ( Environment environment ); - - /** - * Returns <code>true</code> if, and only if, the Command's - * <code>redo</code> method is supported. - * @return True if the Command supports being redone. - */ - public boolean isRedoable (); - - /** - * Re-executes the Command. - * @param environment The environment. - * Must not be null. - * @return A <code>Status</code> object indicating the degree - * to which the <code>redo</code> method was successful. - * A value of <code>null</code>, or a Status with a severity - * of less then <code>Status.ERROR</code> signifies success. - */ - public Status redo ( Environment environment ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/CommandFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/CommandFactory.java deleted file mode 100644 index 9f8df6190..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/CommandFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core; - -/** - * This interface is used to create Command objects. - * - */ -public interface CommandFactory -{ - /** - * - * @return returns a created Command object. - */ - public Command create(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/CommandManager.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/CommandManager.java deleted file mode 100644 index 66b479e86..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/CommandManager.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core; - -import org.eclipse.wst.command.env.core.data.DataMappingRegistry; - -/** - * CommandManagers help manage the lifecycle of Commands. - */ -public interface CommandManager -{ - /** - * Returns true if this CommandManager is capable of undoing - * Commands. Some CommandManagers and Environments may be of - * a sort that will never undo() Commands. Command.execute() - * methods should take advantage of this method to optimize - * out any caching logic whenever this method returns false. - */ - public boolean isUndoEnabled (); - - // There's probably more, like factory methods for creating - // Undo/Redo stacks and stuff like that. - - public DataMappingRegistry getMappingRegistry(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/MultiCommand.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/MultiCommand.java deleted file mode 100644 index 5dab5feea..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/MultiCommand.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.wst.command.env.core.common.Environment; -import org.eclipse.wst.command.env.core.common.Status; - - -/** - * This command can be used to group multiple Commands together - * into a single sequence list of commands to execute. - * - * - */ -public class MultiCommand extends SimpleCommand -{ - - protected String name = null; - protected String description = null; - - private List commands_ = new LinkedList(); - private Command[] commandsArray_ = null; - - /** - * Creates a MultiCommand with no name, description, or list of commands. - * - */ - public MultiCommand () - { - } - - /** - * Creates a MutilCommands with an empty list of commands. - * @param name The name of the command. - * @param description A description of the command. - */ - public MultiCommand ( String name, String description ) - { - this.name = name; - this.description = description; - } - - /** - * Creates a MultiCommand - * @param name the name of the command. - * @param description a description of the command. - * @param commands an initial list of the commands to execute. - */ - public MultiCommand ( String name, String description, Command[] commands ) - { - this.name = name; - this.description = description; - commands_.addAll(Arrays.asList(commands)); - } - - /** - * Adds a command to the list of commands to execute. - * @param command the command to add. - */ - public void add ( Command command ) - { - commandsArray_ = null; - commands_.add(command); - } - - /** - * - * @see org.eclipse.wst.command.env.core.Command#getName() - */ - public String getName () - { - return name != null ? name : (commands_.size() > 0 ? ((Command)commands_.get(0)).getName() : null); - } - - /** - * - * @see org.eclipse.wst.command.env.core.Command#getDescription() - */ - public String getDescription () - { - return description != null ? description : (commands_.size() > 0 ? ((Command)commands_.get(0)).getDescription() : null); - } - - /** - * Executes the list of commands in the MultiCommand. - */ - public Status execute ( Environment environment ) - { - Status status = null; - Command[] commands = commandsArray(); - for (int i=0; i<commands.length; i++) - { - status = commands[i].execute(environment); - - if (status != null && status.matches(Status.ERROR)) - { - for (i--; i>=0; i--) - { - commands[i].undo(environment); - } - return status; - } - } - return status; - } - - /** - * Indicates if this command is undoable. If one of the commands - * in the list is undoable the entire list is considered to be - * undoable. - */ - public boolean isUndoable () - { - ListIterator i = commands_.listIterator(); - while (i.hasPrevious()) - { - if (!((Command)i.previous()).isUndoable()) - { - return false; - } - } - return true; - } - - /** - * Undos this command if it can. - */ - public Status undo ( Environment environment ) - { - Status status = null; - ListIterator i = commands_.listIterator(); - while (i.hasPrevious()) - { - status = ((Command)i.previous()).undo(environment); - } - return status; - } - - /** - * Returns whether this command is redoable or not. - */ - public boolean isRedoable () - { - ListIterator i = commands_.listIterator(); - while (i.hasNext()) - { - if (!((Command)i.next()).isRedoable()) - { - return false; - } - } - return true; - } - - /** - * Reexecutes this command. - */ - public Status redo ( Environment environment ) - { - Status status = null; - Command[] commands = commandsArray(); - for (int i=0; i<commands.length; i++) - { - status = commands[i].redo(environment); - if (status != null && status.matches(Status.ERROR)) - { - for (i--; i>=0; i--) - { - commands[i].undo(environment); - } - return status; - } - } - return status; - } - - private Command[] commandsArray () - { - if (commandsArray_ == null) - { - commandsArray_ = (Command[])commands_.toArray(new Command[0]); - } - return commandsArray_; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/SimpleCommand.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/SimpleCommand.java deleted file mode 100644 index 5f30ca7fd..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/SimpleCommand.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core; - -import org.eclipse.wst.command.env.core.common.Environment; -import org.eclipse.wst.command.env.core.common.SimpleStatus; -import org.eclipse.wst.command.env.core.common.Status; - -/** - * This is a simple implementation of the Command interface that subclass - * can extend. - * - */ -public class SimpleCommand implements Command -{ - private String name_; - private String description_; - - public SimpleCommand( String name, String description ) - { - name_ = name; - description_ = description; - } - - public SimpleCommand() - { - name_ = ""; - description_ = ""; - } - - /** - * Sets the name of the command. - * @param name the name. - */ - public void setName( String name ) - { - name_ = name; - } - - /** - * Sets the description of the command. - * @param description the description. - */ - public void setDescription( String description ) - { - description_ = description; - } - - /** - * @see org.eclipse.env.command.Command#execute(org.eclipse.env.common.Environment) - */ - public Status execute(Environment environment) - { - return new SimpleStatus( "" ); - } - - /** - * @see org.eclipse.env.command.Command#getDescription() - */ - public String getDescription() - { - return description_; - } - - /**) - * @see org.eclipse.env.command.Command#getName() - */ - public String getName() - { - return name_; - } - - /**) - * @see org.eclipse.env.command.Command#isRedoable() - */ - public boolean isRedoable() - { - return false; - } - - /** - * @see org.eclipse.env.command.Command#isUndoable() - */ - public boolean isUndoable() - { - return false; - } - - /** - * @see org.eclipse.env.command.Command#redo(org.eclipse.env.common.Environment) - */ - public Status redo(Environment environment) - { - return new SimpleStatus( "" ); - } - - /** - * @see org.eclipse.env.command.Command#undo(org.eclipse.env.common.Environment) - */ - public Status undo(Environment environment) - { - return new SimpleStatus( "" ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Choice.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Choice.java deleted file mode 100644 index 23cc9b9ce..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Choice.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -public class Choice { - - protected char shortcut = ' '; - protected String label = null; - protected String description = null; - - /** - * Constructor for Choice. - */ - public Choice() { - } - - /** - * Constructor for Choice. - * @param shortcut - * @param label - */ - public Choice(char shortcut, String label) { - this.shortcut = shortcut; - this.label = label; - } - - /** - * Constructor for Choice. - * @param shortcut - * @param label - * @param description - */ - public Choice(char shortcut, String label, String description) { - this.shortcut = shortcut; - this.label = label; - this.description = description; - } - - /** - * Gets the label. - * @return Returns a String - */ - public String getLabel() { - return label; - } - - /** - * Sets the label. - * @param label The label to set - */ - public void setLabel(String label) { - this.label = label; - } - - /** - * Gets the description. - * @return Returns a String - */ - public String getDescription() { - return description; - } - - /** - * Sets the description. - * @param description The description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the shortcut. - * @return Returns a char - */ - public char getShortcut() { - return shortcut; - } - - /** - * Sets the shortcut. - * @param shortcut The shortcut to set - */ - public void setShortcut(char shortcut) { - this.shortcut = shortcut; - } - -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Condition.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Condition.java deleted file mode 100644 index 9a2fea1d7..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Condition.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -/** - * This interface defines a boolean condition that can be evaluated for any object. - */ -public interface Condition -{ - /** - * This returns whether the given object passes this condition. - */ - public boolean evaluate(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Environment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Environment.java deleted file mode 100644 index 9bd423334..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Environment.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -import org.eclipse.wst.command.env.core.CommandManager; -import org.eclipse.wst.command.env.core.uri.URIFactory; - - -/** - * An Environment provides the means for a - * <ol> - * <li>A log for writing messages to a logging facility,</li> - * <li>A progress monitor for receiving progress information,</li> - * <li>A status handler for receiving and processing status reports,</li> - * <li>A factory for the handling of URIs (resources).</li> - * </ol> - */ -public interface Environment -{ - /** - * Returns a logging facility. - */ - public Log getLog (); - - /** - * Returns a progress monitor. - */ - public ProgressMonitor getProgressMonitor (); - - /** - * Returns a status handler. - */ - public StatusHandler getStatusHandler (); - - /** - * Returns a URI factory. - * Hint: Implementers should insure that the Factory they return - * has a reference to this Environment so that URI objects can - * report progress and announce status. - */ - public URIFactory getURIFactory (); - - /** - * Returns a compiler appropriate to the environment. - */ - public JavaCompiler getJavaCompiler (); - - /** - * Returns an object that helps manage execution/undoing of Commands. - */ - public CommandManager getCommandManager (); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/EnvironmentException.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/EnvironmentException.java deleted file mode 100644 index b315b6184..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/EnvironmentException.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -/** - * This is the exception class for conditions raised by the Environment. - */ -public class EnvironmentException extends Exception -{ - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3978983275899402036L; - - protected Status status = null; - - /** - * Creates a new EnvironmentException. - */ - public EnvironmentException () - { - super(); - } - - /** - * Creates a new EnvironmentException. - */ - public EnvironmentException ( Status status ) - { - super(status == null ? null : status.getMessage()); - this.status = status; - } - - /** - * Returns the Status object. - */ - public Status getStatus() - { - return status; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Evaluate.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Evaluate.java deleted file mode 100644 index a78591fe1..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Evaluate.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -/** - * This interface can be used when a conditional object needs to be returned. -**/ -public interface Evaluate -{ - /** - * @return returns an object based on some evaluated condition. - **/ - public Object evaluate(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/JavaCompiler.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/JavaCompiler.java deleted file mode 100644 index 7710d60f3..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/JavaCompiler.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -import org.eclipse.wst.command.env.core.uri.URI; - -/** - * This is the interface for an object that does Java compilation - * of a resource. - */ -public interface JavaCompiler -{ - /** - * Compiles the given Java file to the given class file, - * using context information on classpaths, options, etc. - */ - public void compile ( URI javaUri, URI classUri, JavaCompilerContext context ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/JavaCompilerContext.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/JavaCompilerContext.java deleted file mode 100644 index cbc975853..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/JavaCompilerContext.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -/** - * This is the interface for an object that contains data - * required by JavaCompiler.compile(). - */ -public interface JavaCompilerContext -{ - // TBD... -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Log.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Log.java deleted file mode 100644 index a018c803d..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Log.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -/** - * Log objects provide a means for logging information for FFDC etc. - */ -public interface Log -{ - public static final int OK = 0; - public static final int INFO = 1; - public static final int WARNING = 2; - public static final int ERROR = 4; - - /** - * Returns true if logging is enabled. - * There is no requirement to call this method before attempting - * a call to one of the <code>log</code> methods, as they will - * quietly do nothing if logging is disabled. This method can be - * useful, however, anywhere the cost of building up the parameters - * to a log method might be high and best avoided except when logging - * is enabled. - * @return True if logging is enabled, and false otherwise. - */ - public boolean isEnabled (); - - /** - * Returns true if the the debug option is set to true. - */ - public boolean isEnabled (String option); - - /** - * Logs a <code>Throwable</code>. - * @param severity The severity of the logging entry. - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param throwable The Throwable to log. - */ - public void log ( int severity, int messageNum, Object caller, String method, Throwable throwable ); - - /** - * Logs a <code>Throwable</code>. - * @param severity The severity of the logging entry. - * @param debug option - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param throwable The Throwable to log. - */ - public void log ( int severity, String option, int messageNum, Object caller, String method, Throwable throwable ); - - /** - * Logs a <code>Status</code>. - * @param severity The severity of the logging entry. - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param status The Status to log. - */ - public void log ( int severity, int messageNum, Object caller, String method, Status status ); - - /** - * Logs a <code>Status</code>. - * @param severity The severity of the logging entry. - * @param debug option - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param status The Status to log. - */ - public void log ( int severity, String option, int messageNum, Object caller, String method, Status status ); - - /** - * Logs an <code>Object</code>. - * @param severity The severity of the logging entry. - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param object The Object to log. - */ - public void log ( int severity, int messageNum, Object caller, String method, Object object ); - - /** - * Logs an <code>Object</code>. - * @param severity The severity of the logging entry. - * @param debug option - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param object The Object to log. - */ - public void log ( int severity, String option, int messageNum, Object caller, String method, Object object ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/MessageUtils.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/MessageUtils.java deleted file mode 100644 index 916e609d6..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/MessageUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -import java.text.MessageFormat; -import java.util.Hashtable; -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * This class provides a convienent way to access resource bundles and - * retieve translated strings. - * - * - */ -public class MessageUtils -{ - private ResourceBundle resource_; - - private static Hashtable bundles_ = new Hashtable(); - - /** - * - * @param bundleId the resource bundle ID. - * @param object the class loader for this object will be used to retrieve - * the resource bundle. - */ - public MessageUtils( String bundleId, Object object ) - { - this( bundleId, object.getClass().getClassLoader() ); - } - - /** - * - * @param bundleId the resource bundle ID. - * @param loader the class loader that will be used to retrieve - * the resource bundle. - */ - public MessageUtils( String bundleId, ClassLoader loader ) - { - resource_ = (ResourceBundle)bundles_.get( bundleId ); - - if( resource_ == null ) - { - resource_ = ResourceBundle.getBundle( bundleId, Locale.getDefault(), loader ); - bundles_.put( bundleId, resource_ ); - } - } - - /** - * - * @param key the key for the string to retrieve. - * @return returns the translated string. - */ - public String getMessage ( String key ) - { - String value = key; - - try - { - value = resource_.getString( key ); - } - catch( Throwable exc ) - { - } - - return value; - } - - /** - * - * @param key the key for the string to retrieve. - * @param args These arguments will be substituted into the translated string. - * @return returns the translated string with any substitutions. - */ - public String getMessage ( String key, Object[] args ) - { - return MessageFormat.format( getMessage(key),args ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/NullProgressMonitor.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/NullProgressMonitor.java deleted file mode 100644 index c9ed3a99e..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/NullProgressMonitor.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -/** - * A ProgressMonitor that does nothing. - */ -public class NullProgressMonitor implements ProgressMonitor -{ - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.common.ProgressMonitor#getChildProgressMonitor() - */ - public ProgressMonitor getChildProgressMonitor() - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.common.ProgressMonitor#isCancelRequested() - */ - public boolean isCancelRequested() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.common.ProgressMonitor#report(java.lang.String) - */ - public void report(String progress) - { - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/NullStatusHandler.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/NullStatusHandler.java deleted file mode 100644 index 0c24c436a..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/NullStatusHandler.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -public class NullStatusHandler implements StatusHandler -{ - - /** - * @see org.eclipse.env.common.StatusHandler#report(org.eclipse.env.common.Status, org.eclipse.env.common.Choice[]) - */ - public Choice report(Status status, Choice[] choices) - { - Choice result = null; - - // Always take the first choice if available. - if( choices != null && choices.length > 0 ) - { - result = choices[0]; - } - - return result; - } - - /** - * @see org.eclipse.env.common.StatusHandler#report(org.eclipse.env.common.Status) - */ - public void report(Status status) throws StatusException - { - } - - /* - * Report a warning. - */ - private boolean reportWarning(Status status) - { - return true; - } - - /* - * Report and error. - */ - private boolean reportErrorStatus(Status status) - { - return false; - } - - /** - * @see org.eclipse.wst.command.env.core.common.StatusHandler#reportError(org.eclipse.wst.command.env.core.common.Status) - */ - public void reportError(Status status) - { - reportErrorStatus( status ); - } - - /** - * @see org.eclipse.wst.command.env.core.common.StatusHandler#reportInfo(org.eclipse.wst.command.env.core.common.Status) - */ - public void reportInfo(Status status) - { - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/ProgressMonitor.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/ProgressMonitor.java deleted file mode 100644 index c63153e7a..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/ProgressMonitor.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -public interface ProgressMonitor -{ - /** - * Reports progress. - */ - public void report ( String progress ); - - /** - * Returns a new progress monitor that will record progress - * messages as "children" of the message most recently reported - * thru the parent monitor. - */ - public ProgressMonitor getChildProgressMonitor (); - - /** - * Returns true if the environment has requested cancellation - * of the operation in progress. It is entirely up to a Command - * to decide if, and when, to consult this method. - */ - public boolean isCancelRequested (); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Range.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Range.java deleted file mode 100644 index b30b4aec0..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Range.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -import org.eclipse.wst.command.env.core.uri.URI; - -/** - * Carries position information within a resource. - */ -public interface Range -{ - public static final int UNKNOWN = -1; - - /** - * Returns the identifier of the resource the range applies to. - */ - public URI getURI (); - - /** - * Returns the index, zero-indexed, of the first line - * of the range. - */ - public int getStartingLineNumber (); - - /** - * Returns the index, zero-indexed, of the first character - * of the range relative to the beginning of the line. - */ - public int getStartingCharNumberInLine (); - - /** - * Returns the index, zero-indexed, of the first character - * of the range relative to the beginning of the file. - */ - public int getStartingCharNumberInURI (); - - /** - * Returns the index, zero-indexed, of the last line - * of the range. - */ - public int getEndingLineNumber (); - - /** - * Returns the offset, zero-indexed, of the last character - * of the range relative to the beginning of the line. - */ - public int getEndingCharNumberInLine (); - - /** - * Returns the index, zero-indexed, of the last character - * of the range relative to the beginning of the file. - */ - public int getEndingCharNumberInURI (); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/RangeVector.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/RangeVector.java deleted file mode 100644 index c20868590..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/RangeVector.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -import java.util.Vector; - -/** - * This Vector makes the protected method removeRange public. - * - */ -public class RangeVector extends Vector -{ - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 4048793476659230773L; - - public void removeRange( int start, int end ) - { - super.removeRange( start, end ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/SimpleStatus.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/SimpleStatus.java deleted file mode 100644 index 51b3689f7..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/SimpleStatus.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -import java.util.List; -import java.util.LinkedList; -import java.util.Iterator; - -/** - * A usually sufficient implementation of Status. - */ -public class SimpleStatus implements Status -{ - - private List children_ = new LinkedList(); - private String id_; - private String message_; - private int severity_; - private Throwable throwable_; - - /** - * Method SimpleStatus. - * @param id - */ - public SimpleStatus ( String id ) - { - this(id,"",OK,null); - } - - /** - * Method SimpleStatus. - * @param id - * @param message - * @param severity - */ - public SimpleStatus ( String id, String message, int severity ) - { - this(id,message,severity,null); - } - - /** - * Method SimpleStatus. - * @param id - * @param message - * @param children - */ - public SimpleStatus ( String id, String message, Status[] children ) - { - this(id,message,OK,null); - for (int i=0; i<children.length; i++) - { - children_.add(children[i]); - } - } - - /** - * Method SimpleStatus. - * @param id - * @param message - * @param severity - * @param throwable - */ - public SimpleStatus ( String id, String message, int severity, Throwable throwable ) - { - id_ = id; - message_ = message; - severity_ = severity; - throwable_ = throwable; - } - - /** - * @see Status#getId() - */ - public String getId () - { - return id_; - } - - /** - * @see Status#getMessage() - */ - public String getMessage () - { - return message_; - } - - /** - * @see Status#getSeverity() - */ - public int getSeverity () - { - int severity = severity_; - if (children_.size() > 0) - { - Iterator i = children_.iterator(); - while (i.hasNext()) - { - Status status = (Status)i.next(); - int childSeverity = status.getSeverity(); - if (childSeverity > severity) - { - severity = childSeverity; - } - } - } - return severity; - } - - /** - * @see Status#getThrowable() - */ - public Throwable getThrowable () - { - return throwable_; - } - - /** - * @see Status#hasChildren() - */ - public boolean hasChildren () - { - return children_.size() > 0; - } - - /** - * @see Status#getChildren() - */ - public Status[] getChildren () - { - return (Status[])children_.toArray(new Status[0]); - } - - /** - * @see Status#matches(int) - */ - public boolean matches ( int mask ) - { - return (getSeverity() | mask) != 0; - } - - /** - * Method addChild. - * @param status - */ - public void addChild ( Status status ) - { - children_.add(status); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Status.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Status.java deleted file mode 100644 index 38e8ae3b4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/Status.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -/** - * Carries status information. - */ -public interface Status -{ - /** - * Status: Everything is fine, and there are no messages or details. - */ - public static final int OK = 0; - - /** - * Status: Everything is fine, but there is information to report. - */ - public static final int INFO = 1; - - /** - * Status: Things are working, but possibly not as expected. - */ - public static final int WARNING = 2; - - /** - * Status: Blammo. - */ - public static final int ERROR = 4; - - /** - * Returns a non-translated application specific identifier. - * May return null. - */ - public String getId (); - - /** - * Returns a translated (locale-sensitive) message. - * May return null. - */ - public String getMessage (); - - /** - * Returns the severity. - */ - public int getSeverity (); - - /** - * Returns an exception (throwable) behind the status, if any. - * May return null. - */ - public Throwable getThrowable (); - - /** - * Returns true if this status object has child status objects. - */ - public boolean hasChildren (); - - /** - * Returns the immediate child Status objects of this object. - * Never returns null, but may return a zero-length array. - */ - public Status[] getChildren (); - - /** - * Returns true if this status' severity matches the severity - * mask passed in. Strictly speaking: - * this.matches(that) == (this.getSeverity() | that != 0) - */ - public boolean matches ( int mask ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/StatusException.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/StatusException.java deleted file mode 100644 index 825bc6666..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/StatusException.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.common; - -/** - * This is the exception class used by StatusHandlers to tell their - * callers that processing should stop. - */ -public class StatusException extends EnvironmentException -{ - /** - * Comment for <code>serialVersionUID</code> - * */ - private static final long serialVersionUID = 3618141160322119992L; - - /** - * The Choice that lead to the exception being thrown, - * if any (ie. may be null). - */ - protected Choice choice; - - /** - * Creates a new StatusException with the given Status. - */ - public StatusException( Status status ) - { - super( status ); - } - - /** - * Creates a new StatusException with the given Choice. - * The Choice may be null. - */ - public StatusException ( Choice choice ) - { - super(); - this.choice = choice; - } - - /** - * Creates a new StatusException with the given Choice - * and status object. The Choice may be null. - */ - public StatusException ( Status status, Choice choice ) - { - super(status); - this.choice = choice; - } - - /** - * Returns the Choice object inside this exception. - */ - public Choice getChoice () - { - return choice; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/StatusHandler.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/StatusHandler.java deleted file mode 100644 index be4b312db..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/common/StatusHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.common; - -/** - * Processes status events raised by the caller and returns an - * indication of choices made by the recipient of the status and - * may raise an exception against the caller to have them abort - * procesing. - */ -public interface StatusHandler -{ - /** - * Reports the given Status and set of possible responses. - * Returns the choice made by the handler. - */ - public Choice report ( Status status, Choice[] choices ); - - /** - * Reports the given Status with implied options to either - * continue or abort. - * Throws an exception if the handler decides the caller - * should stop processing. - */ - public void report ( Status status ) throws StatusException; - - /** - * Report the given Error Status. No user feedback is provided. - * @param status - */ - public void reportError( Status status ); - - /** - * Report the given Info Status. No user feedback is provided. - * @param status - */ - public void reportInfo( Status status ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/Context.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/Context.java deleted file mode 100644 index 9f1c9ada1..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/Context.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.context; - -/** - * This interface provides a way to get and set preference information. - * - */ -public interface Context -{ - /** - * Loads the preference data into this Context object. - * - */ - public void load(); - - /** - * Sets the default for a boolean preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, boolean value); - - /** - * Sets the default for a string preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, String value); - - /** - * Sets the default for a int preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, int value); - - /** - * Sets the value for a string preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, String value); - - /** - * Sets the value for a boolean preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, boolean value); - - /** - * Sets the value for a int preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, int value); - - /** - * Gets the value for a string preference. - * @param name the preference name. - * @return the preference value. - */ - public String getValueAsString ( String name); - - /** - * Gets the value for a boolean preference. - * @param name the preference name. - * @return the preference value. - */ - public boolean getValueAsBoolean ( String name); - - /** - * Gets the value for a int preference. - * @param name the preference name. - * @return the preference value. - */ - public int getValueAsInt ( String name); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/ResourceContext.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/ResourceContext.java deleted file mode 100644 index a20d7b504..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/ResourceContext.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.context; - -public interface ResourceContext -{ - /** - * This constant string is used to lookup the overwrite files general preference from - * the plugins local preferences store. - **/ - public static final String PREFERENCE_OVERWRITE = "filesOverwrite"; - - /** - * This constant string is used to lookup the create folders general preference from - * the plugins local preferences store. - **/ - public static final String PREFERENCE_CREATE_FOLDERS = "createFolders"; - - /** - * This constant string is used to lookup the checkout files general preference from - * the plugins local preferences store. - **/ - public static final String PREFERENCE_CHECKOUT = "filesCheckout"; - - /** - * - * @param enable set whether overwriting of files is enabled. - */ - public void setOverwriteFilesEnabled ( boolean enable); - - /** - * - * @return returns whether overwriting of files is enabled. - */ - public boolean isOverwriteFilesEnabled(); - - /** - * - * @param enable set whether creation of folders is enabled. - */ - public void setCreateFoldersEnabled( boolean enable); - - /** - * - * @return returns whether creation of folders is enabled. - */ - public boolean isCreateFoldersEnabled(); - - /** - * - * @param enable sets whether automatic checkout of files is enabled. - */ - public void setCheckoutFilesEnabled( boolean enable); - - /** - * - * @return returns whether automatic checkout of files is enabled. - */ - public boolean isCheckoutFilesEnabled(); - - /** - * - * @return returns a copy of this ResourceContext. - */ - public ResourceContext copy(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/ResourceDefaults.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/ResourceDefaults.java deleted file mode 100644 index 92c84b3e9..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/ResourceDefaults.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.context; - -public class ResourceDefaults -{ - private static final boolean PREFERENCE_OVERWRITE_DEFAULT = false; - private static final boolean PREFERENCE_CREATE_FOLDERS_DEFAULT = true; - private static final boolean PREFERENCE_CHECKOUT_DEFAULT = false; - - /** - * - * @return returns the default setting for overwriting files. - */ - public static boolean getOverwriteFilesDefault () - { - return PREFERENCE_OVERWRITE_DEFAULT; - } - - /** - * - * @return returns the default setting ofr creating folders. - */ - public static boolean getCreateFoldersDefault () - { - return PREFERENCE_CREATE_FOLDERS_DEFAULT; - } - - /** - * - * @return returns the default setting for checking out files. - */ - public static boolean getCheckoutFilesDefault() - { - return PREFERENCE_CHECKOUT_DEFAULT; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/TransientResourceContext.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/TransientResourceContext.java deleted file mode 100644 index a845b4125..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/context/TransientResourceContext.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.command.env.core.context; - -/** - * This class implements a ResourceContext interface where the state - * of the context data is transient. - * - */ -public class TransientResourceContext implements ResourceContext -{ - private boolean overWriteFiles; - private boolean createFolders; - private boolean checkOutFiles; - - public TransientResourceContext() { - setOverwriteFilesEnabled(ResourceDefaults.getOverwriteFilesDefault()); - setCreateFoldersEnabled(ResourceDefaults.getCreateFoldersDefault()); - setCheckoutFilesEnabled(ResourceDefaults.getCheckoutFilesDefault()); - } - - /** - * @see org.eclipse.wst.command.env.core.context.ResourceContext#setOverwriteFilesEnabled(boolean) - */ - public void setOverwriteFilesEnabled(boolean enable) { - overWriteFiles = enable; - } - - /** - * @see org.eclipse.wst.command.env.core.context.ResourceContext#isOverwriteFilesEnabled() - */ - public boolean isOverwriteFilesEnabled() { - return overWriteFiles; - } - - /** - * @see org.eclipse.wst.command.env.core.context.ResourceContext#setCreateFoldersEnabled(boolean) - */ - public void setCreateFoldersEnabled(boolean enable) { - createFolders = enable; - } - - /** - * @see org.eclipse.wst.command.env.core.context.ResourceContext#isCreateFoldersEnabled() - */ - public boolean isCreateFoldersEnabled() { - return createFolders; - } - - /** - * @see org.eclipse.wst.command.env.core.context.ResourceContext#setCheckoutFilesEnabled(boolean) - */ - public void setCheckoutFilesEnabled(boolean enable) { - checkOutFiles = enable; - } - - /** - * @see org.eclipse.wst.command.env.core.context.ResourceContext#isCheckoutFilesEnabled() - */ - public boolean isCheckoutFilesEnabled() { - return checkOutFiles; - } - - /** - * @see org.eclipse.wst.command.env.core.context.ResourceContext#copy() - */ - public ResourceContext copy() { - ResourceContext cc = new TransientResourceContext(); - cc.setOverwriteFilesEnabled(isOverwriteFilesEnabled()); - cc.setCreateFoldersEnabled(isCreateFoldersEnabled()); - cc.setCheckoutFilesEnabled(isCheckoutFilesEnabled()); - return cc; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/data/DataMappingRegistry.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/data/DataMappingRegistry.java deleted file mode 100644 index ecf42ca36..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/data/DataMappingRegistry.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.data; - -public interface DataMappingRegistry -{ - /** - * This method adds a data mapping from a source object to a target - * object. When the sourceObject is encountered by the framework the - * sourceProperty will be called and the data will be passed to the - * targetProperty in the targetObject. If a transformer object is - * specified the sourceObject is transformed before being passed to - * the target object. - * - * @param sourceType The source object. - * @param sourceProperty The source property. - * @param targetType The target object. - * @param targetProperty The target property. - * @param transformer The transformer object that transforms the - * the source object. - */ - public void addMapping( Class sourceType, - String sourceProperty, - Class targetType, - String targetProperty, - Transformer transformer ); - - /** - * This method is equivalent to the above with targetProperty the same - * as the sourceProperty and with the transformer set to null. - * - * @param sourceType The source object. - * @param sourceProperty The source property. - * @param targetType The target object. - */ - public void addMapping( Class sourceType, - String sourceProperty, - Class targetType ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/data/Transformer.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/data/Transformer.java deleted file mode 100644 index 0a80f0c14..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/data/Transformer.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.data; - -/** - * This interface is used to transform an object from one class to another. - * - */ -public interface Transformer -{ - /* - * @return returns a transformed object based on the input value. - */ - public Object transform( Object value ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/environment.properties b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/environment.properties deleted file mode 100644 index b1d7769a6..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/environment.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 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 -############################################################################### - -# -# Messages for SimpleURIFactory -# -MSG_NULL_ARG_SPECIFIED=Null specified as argument to {0}. -MSG_SCHEME_NOT_FOUND=Scheme not found for URI {0}. -MSG_ABSOLUTE_PATH_WITHOUT_SCHEME=Absolute path specified without a scheme for URI {0}. - -# -# Common Messages -# -MSG_URI_NOT_RELATIVE=URL: {0} is not relative. -MSG_ERROR_UNEXPECTED_ERROR=IWAB0014E Unexpected exception occured. - diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/AbstractCommandFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/AbstractCommandFragment.java deleted file mode 100644 index 7a3e42c98..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/AbstractCommandFragment.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import org.eclipse.wst.command.env.core.CommandFactory; -import org.eclipse.wst.command.env.core.data.DataMappingRegistry; - - -/** - * This class is used as the base class for other standard fragment classes. - * -**/ -public abstract class AbstractCommandFragment implements CommandFragment -{ - private CommandFactory commandFactory_; - private String id_; - private boolean doNotRunInTransaction_ = false; - - /** - * Copy constructor. - * @param fragment - */ - protected AbstractCommandFragment( AbstractCommandFragment fragment ) - { - commandFactory_ = fragment.commandFactory_; - id_ = fragment.id_; - } - - /** - * Creates a new AbstractCommandFragment. - * - * @param command the executable command for this fragment. - **/ - public AbstractCommandFragment( CommandFactory commandFactory, String id ) - { - commandFactory_ = commandFactory; - id_ = id; - } - - public String getId() - { - return id_; - } - - public void setId( String id ) - { - id_ = id; - } - - /** - * Gets executable command associated with this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFactory getCommandFactory() - { - return commandFactory_; - } - - /** - * This method is called retrieve the data mappings for this command fragment. - */ - public void registerDataMappings( DataMappingRegistry registry ) - { - // The default behaviour is not to add any entries to the registry. - } - - /** - * - * @return If the commands for this fragment should not be run within a transaction then - * this method should return true. If the fragment does not care if it is run in a transaction - * or not it should return false. - */ - public boolean doNotRunInTransaction() - { - return doNotRunInTransaction_; - } - - /** - * Sets the run in transaction property. - * @param doNotRunInTransaction - */ - public void setDoNotRunInTransaction( boolean doNotRunInTransaction ) - { - doNotRunInTransaction_ = doNotRunInTransaction; - } - - /** - * All fragments need to be cloneable. - **/ - abstract public Object clone(); - -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/BooleanFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/BooleanFragment.java deleted file mode 100644 index ebbda8036..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/BooleanFragment.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import org.eclipse.wst.command.env.core.CommandFactory; -import org.eclipse.wst.command.env.core.common.Condition; - - -/** - * This class returns either the true fragment or the false fragment - * based on the response from the condition object. -**/ -public class BooleanFragment extends AbstractCommandFragment -{ - private CommandFragment trueFragment_; - private CommandFragment falseFragment_; - private Condition condition_; - - /** - * Create a BooleanFragment with default values. - * - */ - public BooleanFragment() - { - this( null, null, new Condition() - { - public boolean evaluate() - { - return true; - } - }, - null, "" ); - } - - /** - * - * @param trueFragment The fragment chosen if the condition is true. - * @param falseFragment The fragment chosen if the condition is false. - * @param condition The condition. - */ - public BooleanFragment( CommandFragment trueFragment, - CommandFragment falseFragment, - Condition condition ) - { - this( trueFragment, falseFragment, condition, null, "" ); - } - - /** - * Creates a new BooleanFragment. - * - * @param trueFragment returned if condition is true. - * @param falseFragment returned if condition is false. - * @param condition the condition for this fragment. - * @param state the state passed to the condition. - * @param command the exectable command for this fragment. - **/ - public BooleanFragment( CommandFragment trueFragment, - CommandFragment falseFragment, - Condition condition, - CommandFactory commandFactory, - String id ) - { - super( commandFactory, id ); - - trueFragment_ = trueFragment; - falseFragment_ = falseFragment; - condition_ = condition; - } - - /** - * Copy constructor. - * @param frag - */ - protected BooleanFragment( BooleanFragment frag ) - { - this( null, - null, - frag.condition_, - frag.getCommandFactory(), - frag.getId() ); - - // Now we have to clone in the true and false - // fragments. - trueFragment_ = (CommandFragment)trueFragment_.clone(); - falseFragment_ = (CommandFragment)falseFragment_.clone(); - } - - /** - * Makes a copy of the CommandFragment. - * - * @return returns a copy of this fragment. - **/ - public Object clone() - { - return new BooleanFragment( this ); - } - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment() - { - return condition_.evaluate() ? trueFragment_ : falseFragment_; - } - - /** - * Gets the next child fragment for this fragment. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment( CommandFragment fragment ) - { - return null; - } - - /** - * Sets the condition. - * @param condition - */ - public void setCondition( Condition condition ) - { - condition_ = condition; - } - - /** - * Sets the true fragment. - * @param fragment - */ - public void setTrueFragment( CommandFragment fragment ) - { - trueFragment_ = fragment; - } - - /** - * Sets the false fragment. - * @param fragment - */ - public void setFalseFragment( CommandFragment fragment ) - { - falseFragment_ = fragment; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/ChoiceFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/ChoiceFragment.java deleted file mode 100644 index 35f80f897..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/ChoiceFragment.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import java.util.Enumeration; -import java.util.Hashtable; - -import org.eclipse.wst.command.env.core.CommandFactory; -import org.eclipse.wst.command.env.core.common.Evaluate; - - -/** - * This class returns a fragment from a list of fragments based - * on the object returned from the Evaluate object. -**/ -public class ChoiceFragment extends AbstractCommandFragment -{ - private Hashtable fragmentTable_; - private Evaluate evaluate_; - - /** - * Create a clone with new a new hashtable. - **/ - protected ChoiceFragment( ChoiceFragment frag ) - { - super( frag.getCommandFactory(), frag.getId() ); - - evaluate_ = frag.evaluate_; - fragmentTable_ = new Hashtable(); - - Enumeration keys = frag.fragmentTable_.keys(); - - // Clone the fragments in the table. - while( keys.hasMoreElements() ) - { - Object key = keys.nextElement(); - fragmentTable_.put( key, ((CommandFragment)frag.fragmentTable_.get(key)).clone() ); - } - } - - public ChoiceFragment( Object[] keys, - CommandFragment[] fragments ) - { - this( keys, fragments, null, null, "" ); - } - - public ChoiceFragment( Object[] keys, - CommandFragment[] fragments, - Evaluate evaluate ) - { - this( keys, fragments, evaluate, null, "" ); - } - - public void setEvaluate( Evaluate evaluate ) - { - evaluate_ = evaluate; - } - - /** - * Constructs a choice fragment. The key at index X is mapped to - * to the fragment at index X. - * - * @param keys these keys must be unique as determined by the equals method. - * They are used to identify which fragment to return. - * @param fragments these are the fragments to be returned. Null is not allowed - * as an entry in the array. - * @param evaluate the object returned by this evaluate object is used - * as the key to locate a fragment. - * @param state the state passed to evaluate. - **/ - public ChoiceFragment( Object[] keys, - CommandFragment[] fragments, - Evaluate evaluate, - CommandFactory commandFactory, - String id ) - { - super( commandFactory, id ); - - evaluate_ = evaluate; - fragmentTable_ = new Hashtable(); - - if( keys == null || fragments == null || keys.length != fragments.length ) - { - throw new IllegalArgumentException( "Bad keys or fragments." ); - } - else - { - // Create the fragment table. - for( int index = 0; index < keys.length; index++ ) - { - fragmentTable_.put( keys[index], fragments[index] ); - } - } - } - - /** - * Makes a copy of the CommandFragment. - * - * @return returns a copy of this fragment. - **/ - public Object clone() - { - return new ChoiceFragment( this ); - } - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment() - { - Object key = evaluate_.evaluate(); - CommandFragment fragment = (CommandFragment)fragmentTable_.get(key); - - if( fragment == null ) - { - throw new IllegalArgumentException( "Key not found in table. Key=" + key ); - } - - return fragment; - } - - /** - * Gets the next child fragment for this fragment. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment( CommandFragment fragment ) - { - return null; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFactoryFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFactoryFragment.java deleted file mode 100644 index 777bf2721..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFactoryFragment.java +++ /dev/null @@ -1,160 +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 - *******************************************************************************/ - -package org.eclipse.wst.command.env.core.fragment; - -import java.util.Vector; - -import org.eclipse.wst.command.env.core.Command; -import org.eclipse.wst.command.env.core.CommandFactory; -import org.eclipse.wst.command.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.provisional.ICommandFactory; - -public abstract class CommandFactoryFragment implements CommandFragment -{ - private Vector commands_; - - /** - * Subclasses should override this method and return - * an CommandFactory. - * @return - */ - public abstract ICommandFactory getICommandFactory(); - - /** - * All wizard fragments need to be cloneable. - **/ - public abstract Object clone(); - - protected CommandFactoryFragment( CommandFactoryFragment frag ) - { - commands_ = frag.commands_; - } - - public CommandFactoryFragment() - { - } - - /** - * - * @return Returns a unique identifier for this fragment. - */ - public String getId() - { - return ""; - } - - /** - * Gets executable command associated with this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFactory getCommandFactory() - { - return null; - } - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment() - { - CommandFragment result = null; - - commands_ = createCommands(); - - if( commands_.size() > 0 ) - { - result = (ChildFragment)commands_.elementAt(0); - } - - return result; - } - - /** - * Gets the next child fragment for this fragment. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment( CommandFragment fragment ) - { - CommandFragment result = null; - - if( commands_ != null && fragment instanceof ChildFragment ) - { - ChildFragment child = (ChildFragment)fragment; - - int index = child.index_; - - if( index != -1 ) - { - index++; - - if( index < commands_.size() ) - { - result = (CommandFragment)commands_.elementAt( index ); - } - } - } - - return result; - } - - /* - * This method is called to retrieve the data mappings for this command fragment. - */ - public void registerDataMappings( DataMappingRegistry registry ) - { - } - - /** - * - * @return If the commands for this fragment should not be run within a transaction then - * this method should return true. If the fragment does not care if it is run in a transaction - * or not it should return false. - */ - public boolean doNotRunInTransaction() - { - return false; - } - - private Vector createCommands() - { - Vector commands = new Vector(); - ICommandFactory factory = getICommandFactory(); - int index = 0; - - while( factory != null && factory.hasNext() ) - { - Command command = (Command)factory.getNextCommand(); - - commands.add( new ChildFragment( command, index++ ) ); - } - - return commands; - } - - private class ChildFragment extends SimpleFragment - { - int index_; - - public ChildFragment( Command command, int index ) - { - super( command, command.getClass().getName() ); - index_ = index; - } - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragment.java deleted file mode 100644 index e4fe06f85..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragment.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import org.eclipse.wst.command.env.core.CommandFactory; -import org.eclipse.wst.command.env.core.data.DataMappingRegistry; - - -/** - * This interface describes a list of interruptable commands. The - * order of this list of commands is defined by the getFirstSubFragment and - * getNextSubFragment methods. -**/ -public interface CommandFragment extends Cloneable -{ - /** - * - * @return Returns a unique identifier for this fragment. - */ - public String getId(); - - /** - * Gets executable command associated with this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFactory getCommandFactory(); - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment(); - - /** - * Gets the next child fragment for this fragment. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment( CommandFragment fragment ); - - /* - * This method is called to retrieve the data mappings for this command fragment. - */ - public void registerDataMappings( DataMappingRegistry registry ); - - /** - * - * @return If the commands for this fragment should not be run within a transaction then - * this method should return true. If the fragment does not care if it is run in a transaction - * or not it should return false. - */ - public boolean doNotRunInTransaction(); - - /** - * All wizard fragments need to be cloneable. - **/ - public Object clone(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentEngine.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentEngine.java deleted file mode 100644 index 56d0f72ae..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentEngine.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import java.util.Stack; - -import org.eclipse.wst.command.env.core.Command; -import org.eclipse.wst.command.env.core.CommandFactory; -import org.eclipse.wst.command.env.core.CommandManager; -import org.eclipse.wst.command.env.core.common.Environment; -import org.eclipse.wst.command.env.core.common.Log; -import org.eclipse.wst.command.env.core.common.MessageUtils; -import org.eclipse.wst.command.env.core.common.SimpleStatus; -import org.eclipse.wst.command.env.core.common.Status; -import org.eclipse.wst.command.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.env.core.data.DataFlowManager; - - - -/** - * The CommandFragmentEngine provides a convienent way to traverse CommandFragments - * and possiblity execute its associate Command. - */ -public class CommandFragmentEngine implements CommandManager -{ - private Stack commandStack_; - private FragmentListener undoFragmentListener_; - private FragmentListener nextFragmentListener_; - private FragmentListener peekFragmentListener_; - private DataFlowManager dataManager_; - private Environment environment_; - private Status lastStatus_; - - /** - * Creates a CommandFragmentEngine. - * - * @param startFragment the root fragment where traversal will begin. - * @param dataManager the data manager containing all of the data mappings. - * @param environment the environment. - */ - public CommandFragmentEngine( CommandFragment startFragment, DataFlowManager dataManager, Environment environment ) - { - SequenceFragment root = new SequenceFragment(); - root.add( startFragment ); - - commandStack_ = new Stack(); - - addToStack( root, -1 ); - addToStack( startFragment, 0 ); - - dataManager_ = dataManager; - environment_ = environment; - } - - /** - * @return returns the Data mapping registry. - */ - public DataMappingRegistry getMappingRegistry() - { - return dataManager_.getMappingRegistry(); - } - - /** - * - * @return the Status from the last Command executed. - */ - public Status getLastStatus() - { - return lastStatus_; - } - - /** - */ - public boolean isUndoEnabled() - { - return true; - } - - /** - * Sets the next fragment listener for this engine. This listener will be - * called for each fragment that is traversed in moveForwardToNextStop operation. - * - * @param listener the fragment listener. - */ - public void setNextFragmentListener( FragmentListener listener ) - { - nextFragmentListener_ = listener; - } - - /** - * Sets the next fragment listener for this engine. This listener will be - * called for each fragment that is traversed in peekForwardToNextStop operation. - * - * @param listener the fragment listener. - */ - public void setPeekFragmentListener( FragmentListener listener ) - { - peekFragmentListener_ = listener; - } - - /** - * Sets the peek fragment listener for this engine. This listener will be - * called for each fragment that is traversed in undoToLastStop operation. - * - * @param listener the fragment listener. - */ - public void setUndoFragmentListener( FragmentListener listener ) - { - undoFragmentListener_ = listener; - } - - /** - * Traverse the CommandFragments starting with the CommandFragment on the - * top of the command fragment stack. The operation does NOT change the - * command fragment stack and does not execute any command associated with - * a CommandFragment. - */ - public void peekForwardToNextStop() - { - CommandListEntry topEntry = (CommandListEntry)commandStack_.lastElement(); - int parentIndex = topEntry.parentIndex_; - CommandFragment childFragment = topEntry.fragment_; - boolean continueLoop = navigateChildFragments( childFragment, false ); - - while( parentIndex != -1 && continueLoop ) - { - CommandListEntry parentEntry = (CommandListEntry)commandStack_.elementAt( parentIndex ); - CommandFragment parentFragment = parentEntry.fragment_; - CommandFragment nextFragment = parentFragment.getNextSubFragment( childFragment ); - - if( nextFragment == null ) - { - // There are no more sibling fragments to navigate so we will pop up to the parent - // an continue navigation there. - parentIndex = parentEntry.parentIndex_; - childFragment = parentFragment; - } - else - { - if( navigateChildFragments( nextFragment, true ) ) - { - // We are continuing to navigate. This time we want to traverse the sibling - // of nextFragment. - childFragment = nextFragment; - } - else - { - // We are stopping our navigation. - continueLoop = false; - } - } - } - } - - - /** - * Traverse the CommandFragments starting with the CommandFragment on the - * top of the command fragment stack. This operation does change the - * command fragment stack and does execute any command associated with - * a CommandFragment. - */ - public void moveForwardToNextStop() - { - CommandListEntry topEntry = (CommandListEntry)commandStack_.lastElement(); - int parentIndex = topEntry.parentIndex_; - CommandFragment currentFragment = topEntry.fragment_; - boolean continueExecute = visitTop(); - CommandFragment childFragment = currentFragment.getFirstSubFragment(); - - // If the current fragment has child fragments we need to traverse these children. - while( childFragment != null && continueExecute ) - { - parentIndex = commandStack_.size() - 1; - addToStack( childFragment, parentIndex ); - continueExecute = visitTop(); - currentFragment = childFragment; - childFragment = currentFragment.getFirstSubFragment(); - } - - // The previous while loop has guaranteed that currentFragment has no - // child fragments. This while loop assumes this to be the case. - while( parentIndex != -1 && continueExecute ) - { - CommandListEntry parentEntry = (CommandListEntry)commandStack_.elementAt( parentIndex ); - CommandFragment parentFragment = parentEntry.fragment_; - CommandFragment nextFragment = null; - - if( currentFragment == null ) - { - nextFragment = parentFragment.getFirstSubFragment(); - } - else - { - nextFragment = parentFragment.getNextSubFragment( currentFragment ); - } - - if( nextFragment == null ) - { - // There are no more sibling fragments to navigate so we will pop up to the parent - // and continue navigation there. - parentIndex = parentEntry.parentIndex_; - currentFragment = parentFragment; - } - else - { - // We have a new fragment that we need to add to the top of the stack. - addToStack( nextFragment, parentIndex ); - parentIndex = commandStack_.size() - 1; - continueExecute = visitTop(); - currentFragment = null; - } - } - } - - /** - * - * @return returns true if the there is not longer any elements on the stack. Note: - * that last two entries are always left on the stack. - */ - public boolean undoToLastStop() - { - CommandListEntry topEntry = (CommandListEntry)commandStack_.lastElement(); - - // Always undo the top element. - performUndo( topEntry ); - - while( topEntry.parentIndex_ != 0 ) - { - commandStack_.pop(); - topEntry = (CommandListEntry)commandStack_.lastElement(); - - performUndo( topEntry ); - - if( topEntry.fragmentStopped_ ) - { - break; - } - } - - return topEntry.parentIndex_ == 0; - } - - private void performUndo( CommandListEntry entry ) - { - if( entry.parentIndex_ == 0 ) return; - - Command cmd = entry.command_; - - if( cmd != null && cmd.isUndoable() && !entry.beforeExecute_ ) - { - cmd.undo( environment_ ); - entry.beforeExecute_ = true; - } - - undoFragmentListener_.notify( entry.fragment_ ); - } - - private boolean navigateChildFragments( CommandFragment fragment, boolean visitCurrent ) - { - boolean continueNavigate = true; - CommandFragment childFrag = null; - - if( visitCurrent ) - { - continueNavigate = peekFragmentListener_.notify( fragment ); - dataManager_.process( fragment ); - } - - childFrag = fragment.getFirstSubFragment(); - - while( childFrag != null && continueNavigate ) - { - continueNavigate = navigateChildFragments( childFrag, true ); - childFrag = fragment.getNextSubFragment( childFrag ); - } - - return continueNavigate; - } - - private boolean visitTop() - { - CommandListEntry entry = (CommandListEntry)commandStack_.lastElement(); - boolean continueNavigate = nextFragmentListener_.notify( entry.fragment_ ); - - if( continueNavigate ) - { - // Call the setters for this fragment. - dataManager_.process( entry.fragment_ ); - - // Add any rules to the mapping registry before we execute the command. - entry.fragment_.registerDataMappings( dataManager_.getMappingRegistry() ); - - lastStatus_ = runCommand( entry ); - - if( lastStatus_.getSeverity() == Status.ERROR ) continueNavigate = false; - } - - if( !continueNavigate ) entry.fragmentStopped_ = true; - - return continueNavigate; - } - - private void addToStack( CommandFragment fragment, int parentIndex ) - { - CommandListEntry entry = new CommandListEntry( fragment, parentIndex ); - commandStack_.push( entry ); - } - - private Status runCommand( CommandListEntry entry ) - { - CommandFactory factory = entry.fragment_.getCommandFactory(); - Status status = new SimpleStatus( "" ); - - if( factory != null ) - { - Command cmd = factory.create(); - entry.command_ = cmd; - - if( cmd != null ) - { - dataManager_.process( cmd ); - - try - { - environment_.getLog().log(Log.INFO, "command", 5001, this, "runCommand", "Executing: " + cmd.getClass().getName()); - - status = cmd.execute( environment_ ); - entry.beforeExecute_ = false; - } - catch( Throwable exc ) - { - MessageUtils utils = new MessageUtils( "org.eclipse.wst.command.env.core.environment", this ); - SimpleStatus unexpectedError = new SimpleStatus("id", exc.getMessage(), Status.ERROR, exc ); - status = new SimpleStatus( "", utils.getMessage( "MSG_ERROR_UNEXPECTED_ERROR" ), new Status[]{unexpectedError} ); - environment_.getStatusHandler().reportError( status ); - } - finally - { - String message = "Ok"; - - if( status.getSeverity() == Status.ERROR ) - { - message = "Error: " + status.getMessage(); - } - - environment_.getLog().log(Log.INFO, "command", 5001, this, "runCommand", "Execution status: " + message ); - } - } - } - - return status; - } - - private class CommandListEntry - { - public CommandListEntry( CommandFragment fragment, int parentIndex ) - { - fragment_ = fragment; - parentIndex_ = parentIndex; - fragmentStopped_ = false; - beforeExecute_ = true; - } - - public Command command_; - public CommandFragment fragment_; - public int parentIndex_; - public boolean fragmentStopped_; - public boolean beforeExecute_; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentFactory.java deleted file mode 100644 index 6ccc47f99..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -/** - * This interface provides a way to create CommandFragments. - * - */ -public interface CommandFragmentFactory -{ - /** - * - * @return returns a created CommandFragment object. - */ - public CommandFragment create(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentFactoryFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentFactoryFactory.java deleted file mode 100644 index 48076ae56..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/CommandFragmentFactoryFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -public interface CommandFragmentFactoryFactory -{ - /** - * The framework calls this method to get the CommandFragmentFactory - * for a particular extension. - * - * @return Creates a CommandFragmentFactory. - */ - public CommandFragmentFactory create(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/ExtensionFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/ExtensionFragment.java deleted file mode 100644 index 2cde3a57c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/ExtensionFragment.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import java.util.Hashtable; - -import org.eclipse.wst.command.env.core.registry.CommandRegistry; - - -public class ExtensionFragment extends AbstractCommandFragment -{ - private String[] ids_;; - private CommandRegistry extensionRegistry_; - private Hashtable fragments_; - - /** - * The default constructor - * - */ - public ExtensionFragment() - { - super( null, "" ); - fragments_ = new Hashtable(); - } - - /** - * Copy constructor. - * @param Fragment the fragment to copy - */ - protected ExtensionFragment( ExtensionFragment fragment ) - { - super( fragment ); - - ids_ = fragment.ids_; - extensionRegistry_ = fragment.extensionRegistry_; - fragments_ = fragment.fragments_; - } - - /** - * - * @param ids Sets the IDs for this extension fragment. - */ - public void setExtensionIds( String[] ids ) - { - ids_ = ids; - } - - /** - * - * @param registry Sets the registry for this extension fragment. - */ - public void setExtensionRegistry( CommandRegistry registry ) - { - extensionRegistry_ = registry; - } - - /** - * @see org.eclipse.wst.command.env.core.fragment.CommandFragment#getFirstSubFragment() - */ - public CommandFragment getFirstSubFragment() - { - CommandFragmentFactoryFactory factory = extensionRegistry_.getFactoryFactory( ids_ ); - - if( factory == null ) return null; - - CommandFragment fragment = (CommandFragment)fragments_.get( factory ); - - if( fragment == null ) - { - fragment = factory.create().create(); - fragments_.put( factory, fragment ); - } - - return fragment; - } - - /** - * @see org.eclipse.wst.command.env.core.fragment.CommandFragment#getNextSubFragment(org.eclipse.wst.command.env.core.fragment.CommandFragment) - */ - public CommandFragment getNextSubFragment(CommandFragment fragment) - { - return null; - } - - /** - * @see java.lang.Object#clone() - */ - public Object clone() - { - return new ExtensionFragment( this ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/FragmentListener.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/FragmentListener.java deleted file mode 100644 index a762c6f29..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/FragmentListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -/** - * This interface should be implement for code that needs to listen to fragments - * that are being traverse by the CommandFragmentEngine. - * - */ -public interface FragmentListener -{ - /* - * Notifies this listener that a commandFragment is being visited during - * a traversal. - */ - public boolean notify( CommandFragment commandFragment ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/LoopCondition.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/LoopCondition.java deleted file mode 100644 index aa780bb34..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/LoopCondition.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -/** - * This interface can be used when a conditional object needs to be returned. -**/ -public interface LoopCondition -{ - /** - * Evaluates a loop condition. - * - * @param loop the loop fragment that is being evaluated. - * @param fragment the child fragment of the loop - * under evaluation. Note: fragment can be null. - * @return returns an object based on some evaluated condition. - **/ - public boolean evaluate( LoopFragment loop, CommandFragment fragment ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/LoopFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/LoopFragment.java deleted file mode 100644 index d2183540d..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/LoopFragment.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import org.eclipse.wst.command.env.core.CommandFactory; -import org.eclipse.wst.command.env.core.common.RangeVector; - - -/** - * This class returns a dynamically determined number of - * fragments. This loop will return the fragment parameter - * as long as the stopCondition evaluates to false. Otherwise, - * null is returned. -**/ -public class LoopFragment extends AbstractCommandFragment -{ - private LoopCondition stopCondition_; - private CommandFragment fragment_; - private RangeVector fragmentHistory_; - - /** - * Copy contructor for this fragment. - **/ - protected LoopFragment( LoopFragment fragment ) - { - this( fragment.fragment_, - fragment.stopCondition_, - fragment.getCommandFactory(), - fragment.getId() ); - } - - public LoopFragment( CommandFragment fragment, - LoopCondition stopCondition ) - { - this( fragment, stopCondition, null, "" ); - } - - /** - * @param fragment the fragment that will be returned by the loop. - * @param stopCondition when false the fragment will be returned, - * otherwise null is returned. - * @param state the state passed to the condition. - * @param command the executable command for this fragment. - **/ - public LoopFragment( CommandFragment fragment, - LoopCondition stopCondition, - CommandFactory commandFactory, - String id ) - { - super( commandFactory, id ); - - fragment_ = fragment; - stopCondition_ = stopCondition; - fragmentHistory_ = new RangeVector(); - } - - /** - * Makes a copy of the CommandFragment. - * - * @return returns a copy of this fragment. - **/ - public Object clone() - { - return new LoopFragment( this ); - } - - /** - * Returns the index of the fragment - * - * @param fragment the fragment to search. - * @return the index of this fragment. - **/ - public int indexOf( CommandFragment fragment ) - { - return fragmentHistory_.indexOf( fragment ); - } - - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment() - { - return getNextSubFragment( null ); - } - - /** - * Gets the next child fragment for this fragment. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment( CommandFragment frag ) - { - CommandFragment nextFrag = null; - - if( stopCondition_.evaluate( this, frag ) ) - { - // The stop condition has been met. - // Do nothing. - } - else - { - int fragIndex = indexOf( frag ); - - // Note: when fragment == null the fragIndex - // should be -1. Therefore, if there - // is already a first fragment in - // fragmentHistory that will be returned. - if( fragIndex + 1 < fragmentHistory_.size() ) - { - // We have a copy of the fragment already. - nextFrag = (CommandFragment)(fragmentHistory_.elementAt( fragIndex + 1 )); - } - else - { - nextFrag = (CommandFragment)(fragment_.clone()); - fragmentHistory_.add( nextFrag ); - } - } - - return nextFrag; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/SequenceFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/SequenceFragment.java deleted file mode 100644 index a2dcfedc7..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/SequenceFragment.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import java.util.Arrays; -import java.util.List; -import java.util.Vector; - -import org.eclipse.wst.command.env.core.CommandFactory; - - -/** - * This class implements a sequence of CommandFragments. -**/ -public class SequenceFragment extends AbstractCommandFragment -{ - private List fragmentList_; - - protected SequenceFragment( SequenceFragment frag ) - { - super( frag.getCommandFactory(), frag.getId() ); - - fragmentList_ = new Vector(); - - for( int index = 0; index < frag.fragmentList_.size(); index++ ) - { - Object newFrag = ((CommandFragment)frag.fragmentList_.get(index)).clone(); - fragmentList_.add( newFrag ); - } - } - - public SequenceFragment( CommandFragment[] fragments, - CommandFactory commandFactory, - String id ) - { - super( commandFactory, id ); - - if( fragments != null ) - { - fragmentList_ = Arrays.asList( fragments ); - } - else - { - fragmentList_ = new Vector(); - } - } - - public SequenceFragment() - { - super( null, "" ); - - fragmentList_ = new Vector(); - } - - /** - * Appends a fragment to the sequence. - **/ - public void add( CommandFragment fragment ) - { - fragmentList_.add( fragment ); - } - - /** - * Makes a copy of the CommandFragment. - * - * @return returns a copy of this fragment. - **/ - public Object clone() - { - return new SequenceFragment( this ); - } - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment() - { - CommandFragment fragment = null; - - if( fragmentList_ == null || fragmentList_.size() == 0 ) - { - fragment = null; - } - else - { - fragment = (CommandFragment)( fragmentList_.get(0) ); - } - - return fragment; - } - - /** - * Gets the next child fragment for this fragment. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment( CommandFragment fragment ) - { - int index = fragmentList_.indexOf( fragment ); - - if( index == -1 ) - { - throw new IllegalArgumentException( "Fragment not found in sequence."); - } - else - { - index++; - - if( index >= fragmentList_.size() ) - { - // There is nothing following this fragment so return null; - return null; - } - else - { - // Return the next fragment. - return (CommandFragment)(fragmentList_.get( index )); - } - } - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/SimpleFragment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/SimpleFragment.java deleted file mode 100644 index 6235900d4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/fragment/SimpleFragment.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.fragment; - -import org.eclipse.wst.command.env.core.*; - -/** - * This class implements an empty of WizardFragment. -**/ -public class SimpleFragment extends AbstractCommandFragment -{ - public SimpleFragment() - { - this( (CommandFactory)null, "" ); - } - - public SimpleFragment( String id ) - { - this( (CommandFactory)null, id ); - } - - public SimpleFragment( final Command command, String id ) - { - super( new CommandFactory() - { - public Command create() - { - return command; - } - }, id ); - } - - public SimpleFragment( CommandFactory commandFactory, String id ) - { - super( commandFactory, id ); - } - - /** - * Copy constructor for fragment. - **/ - protected SimpleFragment( SimpleFragment fragment ) - { - super( fragment.getCommandFactory(), fragment.getId() ); - } - - /** - * All wizard fragments need to be cloneable. - **/ - public Object clone() - { - return new SimpleFragment( this ); - } - - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment(){ return null; } - - /** - * Gets the next child fragment for this fragment. - * Since this is a simple fragment, there is no next fragment - * so we will always return null. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment( CommandFragment fragment ){ return null; } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/registry/CommandRegistry.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/registry/CommandRegistry.java deleted file mode 100644 index cb4a9ae10..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/registry/CommandRegistry.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.registry; - -import org.eclipse.wst.command.env.core.fragment.CommandFragmentFactoryFactory; - -/** - * This interface provides a way to create a CommandFragmentFactoryFactory - * from an array of ids. - * - */ -public interface CommandRegistry -{ - /** - * Creates a CommandFragmentFactoryFactory from an array of ids. - * - * @param ids the ids. - * @return the CommandFragmentFactoryFactory object. - */ - public CommandFragmentFactoryFactory getFactoryFactory( String[] ids ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/BooleanSelection.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/BooleanSelection.java deleted file mode 100644 index 3df7ea879..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/BooleanSelection.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - *******************************************************************************/ -/** - * This class combines a string with a boolean value. This is - * useful for storing the state data for a boolean selection list. - */ -package org.eclipse.wst.command.env.core.selection; - -public class BooleanSelection -{ - private String value_; - private boolean selected_; - - public BooleanSelection( String value, boolean selected ) - { - value_ = value; - selected_ = selected; - } - - /** - * - * @return Get the string value. - */ - public String getValue() - { - return value_; - } - - /** - * - * @return Get the boolean value for this string. - */ - public boolean isSelected() - { - return selected_; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/ChoicesToString.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/ChoicesToString.java deleted file mode 100644 index 51ceab0e4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/ChoicesToString.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.selection; - -import org.eclipse.wst.command.env.core.data.Transformer; - -/** - * This transformer class selects a string at a particular level - * in a SelectionListChoices class. - */ -public class ChoicesToString implements Transformer -{ - private int level_; - - public ChoicesToString( int level ) - { - level_ = level; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.data.Transformer#transform(java.lang.Object) - */ - public Object transform( Object value ) - { - SelectionListChoices choices = (SelectionListChoices)value; - - for( int index = 0; index < level_; index++ ) - { - choices = choices.getChoice(); - } - - return choices.getList().getSelection(); - } - - public SelectionList transform( SelectionListChoices choices ) - { - return (SelectionList)transform( (Object)choices ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/DynamicList.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/DynamicList.java deleted file mode 100644 index 5ef90436d..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/DynamicList.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.selection; - -import java.util.Vector; - -/** - * This is a Dynamic version of the SelectionListChoices class. - */ -public class DynamicList -{ - private Vector stringList_ = new Vector(); - private Vector dynamicListVectorList_ = new Vector(); - - /** - * Adds an entry into the dynamic list. - * - * @param values the string values that lead to the target. - * @param target the target. - */ - public void add( String[] values, Object target ) - { - DynamicList currentList = this; - - for( int index = 0; index < values.length; index++ ) - { - String value = values[index]; - int length = currentList.stringList_.size(); - int foundIndex = -1; - - // Find the string in the current list. - for( int searchIndex = 0; searchIndex < length; searchIndex++ ) - { - String string = (String)currentList.stringList_.elementAt( searchIndex ); - - if( string.equals( value ) ) - { - foundIndex = searchIndex; - break; - } - } - - if( foundIndex == -1 ) - { - // We have a new string so add it to the list. - currentList.stringList_.add( value ); - currentList.dynamicListVectorList_.add( new DynamicList() ); - foundIndex = length; - } - - currentList = (DynamicList)currentList.dynamicListVectorList_.elementAt( foundIndex ); - } - - currentList.dynamicListVectorList_.add( target ); - } - - /** - * - * @return returns a SelectionListChoices object from this DynamicList - * object. - */ - public SelectionListChoices toListChoices() - { - SelectionList list = new SelectionList( (String[])stringList_.toArray( new String[0] ), 0); - int length = dynamicListVectorList_.size(); - Vector vector = new Vector(); - - for( int index = 0; index < length; index++ ) - { - Object obj = dynamicListVectorList_.elementAt(index); - - if( obj instanceof DynamicList ) - { - vector.add( ((DynamicList)obj).toListChoices() ); - } - else - { - vector.add( obj ); - } - } - - return new SelectionListChoices( list, vector ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/SelectionList.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/SelectionList.java deleted file mode 100644 index 07dad307e..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/SelectionList.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.selection; - -/** - * This class stores a list strings along with a selectionIndex which - * stores the current string that selected. There is also a selection - * value. If this value is one of the strings in the the string list - * then selectionIndex will contain the index of this string. If it - * is not in the list then the selectionValue string will contain this - * value and selectionIndex will be set to -1. This class can be - * used to store the state data for a Combo box. - */ -public class SelectionList -{ - private int selectionIndex_; - private String[] list_; - private String selectionValue_; - - public SelectionList( String[] list, int selectionIndex ) - { - list_ = list; - selectionIndex_ = selectionIndex; - } - - /** - * Sets the selection value for this object. - * - * @param value the value. - */ - public void setSelectionValue( String value ) - { - selectionValue_ = value; - selectionIndex_ = -1; - - for( int index = 0; index < list_.length; index++ ) - { - if( value.equals( list_[index] ) ) - { - selectionIndex_ = index; - break; - } - } - } - - /* - * @return returns the string list. - */ - public String[] getList() - { - return list_; - } - - /* - * Sets the currently selected string in the list. - */ - public void setIndex( int index ) - { - selectionIndex_ = index; - selectionValue_ = null; - } - - /* - * @return returns the index of the current string. The value - * will be -1 if the selection value is not in the string list. - */ - public int getIndex() - { - return selectionIndex_; - } - - /* - * @return returns the current string selection for this object. - */ - public String getSelection() - { - if( selectionValue_ != null ) return selectionValue_; - - if( selectionIndex_ == -1 || selectionIndex_ > list_.length-1 ) - { - return ""; - } - else - { - return list_[ selectionIndex_ ]; - } - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/SelectionListChoices.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/SelectionListChoices.java deleted file mode 100644 index 7b462489d..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/selection/SelectionListChoices.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.selection; - -import java.util.Vector; - -/* - * This class can be used to store a hierarchy of SelectionList - * objects. - */ -public class SelectionListChoices -{ - private SelectionList selectionList_; - private Vector choices_; - private SelectionList newValueSelectionList_; - - /** - * - * @param list The selection list. - * @param choices This is a vector of SelectionListChoies and can be - * null if there are no choices. This index of list - * is used to index into choices. If index is -1 then - * the newValueSelectionList is used. - */ - public SelectionListChoices( SelectionList list, Vector choices ) - { - selectionList_ = list; - choices_ = choices; - - newValueSelectionList_ = new SelectionList( new String[0], -1 ); - } - - public SelectionListChoices( SelectionList list, Vector choices, SelectionList newList ) - { - this( list, choices ); - newValueSelectionList_ = newList; - } - - /** - * @return returns the current Selection list. - */ - public SelectionList getList() - { - return selectionList_; - } - - /** - * - * @return returns the choices for this object. - */ - public Vector getChoices() - { - return choices_; - } - - /** - * - * @param level the level in the hierarchy where we want to get the choices. - * @return returns a vector of SelectionListChoices. - */ - public Vector getChoicesAtLevel( int level ) - { - SelectionListChoices choices = this; - - for( int index = 0; index < level; index++ ) - { - choices = choices.getChoice(); - } - - return choices.getChoices(); - } - - /** - * - * @return returns the current SelectionListChoice - */ - public SelectionListChoices getChoice() - { - int selectionIndex = selectionList_.getIndex(); - SelectionListChoices result = null; - - if( selectionIndex == -1 ) - { - result = new SelectionListChoices( newValueSelectionList_, null ); - } - else if( choices_ != null && choices_.size() != 0 ) - { - result = (SelectionListChoices)choices_.elementAt( selectionIndex ); - } - - return result; - } - - /** - * - * @param index the index of the choice we want. - * @return returns the SelectionListChoice at the index specified. - */ - public SelectionListChoices getChoice(int index) - { - SelectionListChoices result = null; - if (index < 0 || index >= getList().getList().length) - { - result = new SelectionListChoices( newValueSelectionList_, null ); - } - else - { - result = (SelectionListChoices)choices_.elementAt( index ); - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/NativeFileCommand.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/NativeFileCommand.java deleted file mode 100644 index d3a8b705f..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/NativeFileCommand.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import java.io.File; -import java.util.List; -import java.util.LinkedList; - -import org.eclipse.wst.command.env.core.Command; -import org.eclipse.wst.command.env.core.common.Environment; -import org.eclipse.wst.command.env.core.common.Status; -import org.eclipse.wst.command.env.core.uri.URI; -import org.eclipse.wst.command.env.core.uri.URIException; - -public abstract class NativeFileCommand implements Command -{ - protected String name; - - protected String description; - - protected URI[] urisToRead; - - protected URI[] urisToWrite; - - protected NativeFileCommand () - { - this(null,null); - } - - protected NativeFileCommand ( String name, String description ) - { - this.name = name; - this.description = description; - } - - public String getName () - { - return name; - } - - public String getDescription () - { - return description; - } - - public void setURIsToRead ( URI[] urisToRead ) - { - this.urisToRead = urisToRead; - } - - public URI[] getURIsToRead () - { - return urisToRead; - } - - public void setURIsToWrite ( URI[] urisToWrite ) - { - this.urisToWrite = urisToWrite; - } - - public URI[] getURIsToWrite () - { - return urisToWrite; - } - - public Status execute ( Environment environment ) - { - File[] filesToRead = getFiles(urisToRead); - File[] filesToWrite = getFiles(urisToWrite); - preProcess(filesToRead,filesToWrite); - Status status = execute(environment,filesToRead,filesToWrite); - postProcess(filesToRead,filesToWrite); - return status; - } - - public abstract Status execute ( Environment environment, File[] filesToRead, File[] filesToWrite ); - - public boolean isUndoable () - { - return false; - } - - public Status undo ( Environment environment ) - { - return null; - } - - public boolean isRedoable () - { - return false; - } - - public Status redo ( Environment environment ) - { - return null; - } - - private void preProcess ( File[] filesToRead, File[] filesToWrite ) - { - // TBD. - } - - private void postProcess ( File[] filesToRead, File[] filesToWrite ) - { - // TBD. - } - - private File[] getFiles ( URI[] uris ) - { - List list = new LinkedList(); - if (uris != null) - { - for (int i=0; i<uris.length; i++) - { - if (uris[i].isAvailableAsFile()) - { - try - { - list.add(uris[i].asFile()); - } - catch (URIException e) - { - } - } - } - } - return (File[])list.toArray(new File[0]); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/RelativeScheme.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/RelativeScheme.java deleted file mode 100644 index 207f959d4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/RelativeScheme.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import java.net.URL; - -import org.eclipse.wst.command.env.core.common.SimpleStatus; -import org.eclipse.wst.command.env.core.common.Status; - - -public class RelativeScheme implements URIScheme -{ - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#isHierarchical() - */ - public boolean isHierarchical() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#isValid(org.eclipse.env.uri.URI) - */ - public boolean isValid(URI uri) - { - return !uri.toString().startsWith( "/" ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(java.lang.String) - */ - public URI newURI(String uri) - { - return new RelativeURI( uri ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(org.eclipse.env.uri.URI) - */ - public URI newURI(URI uri) - { - return new RelativeURI( uri.toString() ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(java.net.URL) - */ - public URI newURI(URL url) - { - return new RelativeURI( url.toString() ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#validate(org.eclipse.env.uri.URI) - */ - public Status validate(URI uri) - { - Status result = null; - - if( isValid( uri ) ) - { - result = new SimpleStatus( "", "", Status.OK ); - } - else - { - result = new SimpleStatus( "", "", Status.ERROR ); - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/RelativeURI.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/RelativeURI.java deleted file mode 100644 index 2d177fc61..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/RelativeURI.java +++ /dev/null @@ -1,286 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.wst.command.env.core.common.MessageUtils; -import org.eclipse.wst.command.env.core.common.SimpleStatus; -import org.eclipse.wst.command.env.core.common.Status; - - -public class RelativeURI implements URI -{ - protected String uri_; - - public RelativeURI( String uri ) - { - uri_ = uri; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#append(org.eclipse.env.uri.URI) - */ - public URI append(URI relativeURI) throws URIException - { - if( !relativeURI.isRelative()) - { - MessageUtils msg = new MessageUtils( "org.eclipse.wst.command.env.core.environment", new Dummy() ); - - throw new URIException( - new SimpleStatus( "RelativeURI", - msg.getMessage( "MSG_URI_NOT_RELATIVE", new Object[]{ relativeURI.toString() }), - Status.ERROR )); - } - - String newURI = uri_ + "/" + relativeURI.toString(); - - return getURIScheme().newURI( newURI ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#asFile() - */ - public File asFile() - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#asString() - */ - public String asString() - { - return uri_; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#toString() - */ - public String toString() - { - return uri_; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#asURL() - */ - public URL asURL() throws URIException - { - URL url = null; - - try - { - url = new URL( uri_ ); - } - catch( MalformedURLException exc ) - { - throw new URIException( - new SimpleStatus( "RelativeURI", exc.getMessage(), Status.ERROR ), - this ); - } - - return url; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#erase() - */ - public void erase() throws URIException - { - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getInputStream() - */ - public InputStream getInputStream() throws URIException - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getOutputStream() - */ - public OutputStream getOutputStream() throws URIException - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getURIScheme() - */ - public URIScheme getURIScheme() - { - return new RelativeScheme(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isAvailableAsFile() - */ - public boolean isAvailableAsFile() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isAvailableAsURL() - */ - public boolean isAvailableAsURL() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isHierarchical() - */ - public boolean isHierarchical() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isLeaf() - */ - public boolean isLeaf() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isPresent() - */ - public boolean isPresent() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isReadable() - */ - public boolean isReadable() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isRelative() - */ - public boolean isRelative() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isWritable() - */ - public boolean isWritable() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#list() - */ - public URI[] list() throws URIException - { - return new URI[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#list(org.eclipse.env.uri.URIFilter) - */ - public URI[] list(URIFilter uriFilter) throws URIException - { - return new URI[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#parent() - */ - public URI parent() throws URIException - { - int lastSlash = uri_.lastIndexOf( '/' ); - int firstSlash = uri_.indexOf( '/' ); - - // If there is a parent, then it must start with a slash - // and end with a slash. - if( lastSlash == -1 || firstSlash == -1 ) return null; - - return getURIScheme().newURI( uri_.substring(0, lastSlash ) ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#rename(org.eclipse.env.uri.URI) - */ - public void rename(URI newURI) throws URIException - { - uri_ = newURI.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#touchFolder() - */ - public void touchFolder() throws URIException - { - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#touchLeaf() - */ - public void touchLeaf() throws URIException - { - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#visit(org.eclipse.env.uri.URIVisitor, org.eclipse.env.uri.URIFilter) - */ - public void visit(URIVisitor uriVisitor, URIFilter uriFilter) - throws URIException - { - boolean continueVisit = true; - - // If the filter accepts this we will visit it. - if( uriFilter.accepts( this ) ) - { - continueVisit = uriVisitor.visit( this ); - } - - URI[] children = list(); - - for( int index = 0; index < children.length && continueVisit; index++ ) - { - children[index].visit( uriVisitor, uriFilter ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#visit(org.eclipse.env.uri.URIVisitor) - */ - public void visit(URIVisitor uriVisitor) throws URIException - { - boolean continueVisit = uriVisitor.visit( this ); - - URI[] children = list(); - - for( int index = 0; index < children.length && continueVisit; index++ ) - { - children[index].visit( uriVisitor ); - } - } - - private class Dummy - { - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/SimpleURIFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/SimpleURIFactory.java deleted file mode 100644 index dcaaf11e5..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/SimpleURIFactory.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import java.net.URL; -import java.util.Hashtable; - -import org.eclipse.wst.command.env.core.common.MessageUtils; -import org.eclipse.wst.command.env.core.common.SimpleStatus; -import org.eclipse.wst.command.env.core.common.Status; - - -public class SimpleURIFactory implements URIFactory -{ - private Hashtable schemes_ = new Hashtable(); - private MessageUtils msg_ = new MessageUtils( "org.eclipse.wst.command.env.core.environment", this ); - - - /* (non-Javadoc) - */ - public URI newURI(String uri) throws URIException - { - URIScheme scheme = newURIScheme( uri ); - - return scheme.newURI( uri ); - } - - /* (non-Javadoc) - */ - public URI newURI(URL url) throws URIException - { - URIScheme scheme = newURIScheme( url.toString() ); - - return scheme.newURI( url ); - } - - /* (non-Javadoc) - */ - public URIScheme newURIScheme(String schemeOrURI) throws URIException - { - URIScheme newScheme = null; - - if( schemeOrURI == null ) - { - throw new URIException( - new SimpleStatus( "SimpleURIFactory", - msg_.getMessage( "MSG_NULL_ARG_SPECIFIED", new Object[]{"newURIScheme"}), - Status.ERROR ) ); - } - - int colon = schemeOrURI.indexOf(':'); - int slash = schemeOrURI.indexOf('/'); - - // A protocol was specified. Note: a colon appearing after a path is not - // considered part of the protocol for this URI. - if( (colon != -1 && slash == -1) || ( colon != -1 && colon < slash ) ) - { - String protocol = schemeOrURI.substring(0, colon ); - newScheme = (URIScheme)schemes_.get( protocol ); - - if( newScheme == null ) - { - throw new URIException( - new SimpleStatus( "SimpleURIFactory", - msg_.getMessage( "MSG_SCHEME_NOT_FOUND", new Object[]{ schemeOrURI }), - Status.ERROR ) ); - } - } - else if( schemeOrURI.startsWith( "/") ) - { - throw new URIException( - new SimpleStatus( "SimpleURIFactory", - msg_.getMessage( "MSG_ABSOLUTE_PATH_WITHOUT_SCHEME", new Object[]{ schemeOrURI }), - Status.ERROR ) ); - - } - else - { - newScheme = new RelativeScheme(); - } - - return newScheme; - } - - public void registerScheme( String protocol, URIScheme scheme ) - { - schemes_.put( protocol, scheme ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URI.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URI.java deleted file mode 100644 index 93f12772f..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URI.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; - -/** - * A URI represents a Univeral Resource Identifer. - */ -public interface URI -{ - /** - * Returns the string form of the URI. - * The resource need not exist. - */ - public String toString (); - - /** - * Returns the URIScheme for the scheme of this URI. - * The resource need not exist. - */ - public URIScheme getURIScheme (); - - /** - * Returns true iff the resource identified by this URI exists. - */ - public boolean isPresent (); - - /** - * Returns true iff the resource identified by this URI exists - * and is a leaf. Returns true always for non-hierarchical schemes. - */ - public boolean isLeaf (); - - /** - * Returns true iff the resource identified by this URI exists - * and is readable. A readable leaf resource indicates that an - * input stream can be opened on the resource. A readable folder - * resource indicates that the children of the folder, if any, - * can be determined via the list() or visit() methods. - */ - public boolean isReadable (); - - /** - * Returns true iff the resource identified by this URI exists - * and is writable. A writable leaf resource indicates that an - * output stream can be opened on the resource. A writable folder - * resource indicates that new resources can be created in the folder. - */ - public boolean isWritable (); - - /** - * Returns true iff this URI belongs to a hierarchical scheme. - * The resource need not exist. - * this.isHierarchical() == this.getURIScheme().isHierarchical(). - */ - public boolean isHierarchical (); - - /** - * Returns true iff this URI is a relative URI. - * The resource need not exist. - */ - public boolean isRelative (); - - /** - * Returns the URI of the folder containing this URI. - * The resource need not exist. - */ - public URI parent () throws URIException; - - /** - * Returns a new, normalized URI formed by appending the given - * relative URI to this URI. Both URIs must be hierarchical. - * The resulting URI will always be hierarchical. The given - * URI must be relative. This URI can be relative or absolute. - * the resulting URI will be equivalently relative or absolute. - */ - public URI append ( URI relativeURI ) throws URIException; - - /** - * Gets an InputStream for reading from the resource - * identified by this leaf or non-hierarchical URI. - */ - public InputStream getInputStream () throws URIException; - - /** - * Gets an OutputStream for writing to the resource - * identified by this leaf or non-hierarchical URI. - */ - public OutputStream getOutputStream () throws URIException; - - /** - * Creates a new, empty resource at the location identified by - * the URI. On completion, this.isLeaf() == true. If a leaf - * resource already exists, this method does nothing. If a - * non-leaf resource already exists under this URI, creation - * will fail and an exception will be thrown. - */ - public void touchLeaf () throws URIException; - - /** - * Creates a new folder resource at the location identified by - * the URI. The scheme of the URI must be hierarchical. - * On completion, this.isLeaf() == false. If a folder resource - * already exists, this method does nothing. If a leaf resource - * already exists under this URI, creation will fail and an - * exception will be thrown. - */ - public void touchFolder () throws URIException; - - /** - * Erases the resource identified by this URI. - */ - public void erase () throws URIException; - - /** - * Renames or moves the resource identified by this URI - * to the new URI. - */ - public void rename ( URI newURI ) throws URIException; - - /** - * Visits this resource and its decendants in pre-order fashion. - * For each resource, whether a folder or a leaf, the given - * URIVisitor's visit() method is called with the URI of the - * resource. If URIVisitor.visit() returns false, the visiting - * algorithm will "prune" the decendants of the resource and - * carry on visiting the rest of the tree. If URIVisitor.visit() - * returns true, the visiting algorithm will continue its walk - * down the resource's descendants. - */ - public void visit ( URIVisitor uriVisitor ) throws URIException; - - /** - * As for visit(URIVisitor), except only resource URIs that are - * accepted by the given filter are visited. If a folder resource - * fails to be accepted by the filter, this will not prevent the - * visiting algorithm from walking the resource's descendants. - * It remains the job of the visitor to choose whether or not to - * prune a branch by returning false or true. - */ - public void visit ( URIVisitor uriVisitor, URIFilter uriFilter ) throws URIException; - - /** - * Returns a list of URIs for the immediate children of the given - * hierarchical, non-leaf URI. This method never returns null, - * though it may return a zero length array. - */ - public URI[] list () throws URIException; - - /** - * As for list(), except only URIs that are accepted by the given - * filter are returned in the array. This method never returns null, - * though it may return a zero length array. - */ - public URI[] list ( URIFilter uriFilter ) throws URIException; - - /** - * Returns true if the asURL() method is fair game, - * in other words, if this URI can be converted into a URL. - */ - public boolean isAvailableAsURL (); - - /** - * Returns a URL object for the resource under this URI. - * There are many URIs and URISchemes for which this method - * will fail and throw an exception. It should be used only - * in cases where URIs are known to be representable as URLs. - */ - public URL asURL () throws URIException; - - /** - * Returns true if the asFile() method is fair game, - * in other words, if this URI can be converted into a File. - */ - public boolean isAvailableAsFile (); - - /** - * Returns a File object for the resource under this URI. - * There are many URIs and URISchemes for which this method - * will fail and throw an exception. It should be used only - * in cases where URIs are known to be backed by physical files. - */ - public File asFile () throws URIException; - - /** - * Returns the URI as a string. - * Equivalent to toString(). - */ - public String asString (); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIException.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIException.java deleted file mode 100644 index 1226212d4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIException.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import org.eclipse.wst.command.env.core.common.Status; - -/** - * This is the base class for most exceptions thrown by URI classes. - * Every URIException carries a URI and a Status, each of which may - * be null. The getMessage() method as inherited from Exception will - * return the message from the URIExceptin's Status object, if any. - */ -public class URIException extends Exception -{ - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3258130271424756018L; - - /** - * A Status object containing details about the exception, - * if applicable. - */ - protected Status status; - - /** - * The URI for which the exception occured, - * if applicable. - */ - protected URI uri; - - /** - * Creates a new URIException with the given Status. - * The status may be null. - */ - public URIException ( Status status ) - { - super(); - this.status = status; - } - - /** - * Creates a new URIException for the given Status and URI, - * each of which may be null. - */ - public URIException ( Status status, URI uri ) - { - super(status != null ? status.getMessage() : null); - this.status = status; - this.uri = uri; - } - - /** - * Returns the Status object inside this exception. - */ - public Status getStatus () - { - return status; - } - - /** - * Returns the URI inside this exception. - */ - public URI getURI () - { - return uri; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIFactory.java deleted file mode 100644 index 6d7b8f002..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import java.net.URL; - -/** - * This is a factory for creating new URI and URIScheme objects. - */ -public interface URIFactory -{ - /** - * Creates and returns a new URI for the given string. - */ - public URI newURI ( String uri ) throws URIException; - - /** - * Creates and returns a new URI for the given URL. - */ - public URI newURI ( URL url ) throws URIException; - - /** - * Creates and returns a new URIScheme for the given scheme string. - * If the string contains no colons, the entire string is interpretted - * as the name of the scheme. If the string contains a colon, then the - * substring up to but excluding the first colon is interpretted as the - * name of the scheme, meaning the caller can pass in any URI string in - * order to get a URIScheme object. - */ - public URIScheme newURIScheme ( String schemeOrURI ) throws URIException; -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIFilter.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIFilter.java deleted file mode 100644 index bfeab9db4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -/** - * This interface is implemented by classes that visit or list URIs. - * Refer to {@link URI#getChildren}. - */ -public interface URIFilter -{ - /** - * Filters the given URI. - * @param uri The resource to filter. - * @return True if the resource matches the filter, - * false if it does not. - * @throws URIException If the filter fails to analyze the resource. - */ - public boolean accepts ( URI uri ) throws URIException; -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIScheme.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIScheme.java deleted file mode 100644 index df77e09e4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIScheme.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -import java.net.URL; - -import org.eclipse.wst.command.env.core.common.Status; - -/** - * A URIScheme represents a single scheme for some a family of - * Univeral Resource Identifiers. Examples include "file", "http" - * and "platform" (Eclipse). - */ -public interface URIScheme -{ - /** - * Returns a new URI. - */ - public URI newURI ( String uri ) throws URIException; - - /** - * Returns a new URI. - */ - public URI newURI ( URL url ) throws URIException; - - /** - * Returns a new URI. - */ - public URI newURI ( URI uri ) throws URIException; - - /** - * Returns the proper name of the scheme. - */ - public String toString (); - - /** - * Returns true if and only if this is a hierarchical scheme. - */ - public boolean isHierarchical (); - - /** - * Returns true if and only if the given URI satisfies the - * grammatical requirements of the scheme. Absolute URIs must - * begin with "<scheme>:". Relative URIs must either not contain - * a colon, ":", or it must begin with "./". - */ - public boolean isValid ( URI uri ); - - /** - * Returns a Status object indicating whether or not the given - * URI is valid. The severity and message of the Status object - * will describe this. - */ - public Status validate ( URI uri ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIUtils.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIUtils.java deleted file mode 100644 index bb9b3169a..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIUtils.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -/** - * This class contains several static utility methods for - * working with URIs. - */ -public class URIUtils -{ - /** - * Copies all bytes from the old URI to the new URI. - */ - public static void copy ( URI oldUri, URI newUri ) throws URIException - { - } - - /** - * Moves one URI to another. - */ - public static void move ( URI oldUri, URI newUri ) throws URIException - { - } - - /** - * Constructs a new, temporary leaf URI. - * The scheme of the URI may be, but is not guaranteed to be, "file:". - */ - public static URI getTemporaryLeafURI () throws URIException - { - return null; - } - - /** - * Constructs a new, temporary folder URI. - * The scheme of the URI may be, but is not guaranteed to be, "file:". - */ - public static URI getTemporaryFolderURI () throws URIException - { - return null; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIVisitor.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIVisitor.java deleted file mode 100644 index 1a15bf7bb..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/URIVisitor.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri; - -/** - * This interface is implemented by classes that visit URIs. - * Refer to {@link URI#visit}. - */ -public interface URIVisitor -{ - /** - * Visits the given URI. - * @param uri The resource to visit. - * @return True if the resource's descendants should be visited, - * or false if they should not be visited. - * @throws URIException If the visit method fails. - */ - public boolean visit ( URI uri ) throws URIException; -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/file/FileScheme.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/file/FileScheme.java deleted file mode 100644 index 28572f66f..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/file/FileScheme.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri.file; - -import java.net.URL; - -import org.eclipse.wst.command.env.core.uri.RelativeScheme; -import org.eclipse.wst.command.env.core.uri.RelativeURI; -import org.eclipse.wst.command.env.core.uri.URI; - - -public class FileScheme extends RelativeScheme -{ - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#isValid(org.eclipse.env.uri.URI) - */ - public boolean isValid(URI uri) - { - return uri.toString().startsWith( "file:" ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(java.lang.String) - */ - public URI newURI(String uri) - { - String newURI = null; - - if( uri.startsWith( "file:") ) - { - // The file protocol has been specified so keep it as is. - newURI = uri; - } - else if( uri.startsWith( "/") ) - { - // The file scheme has not been specified so we will add it. - newURI = "file:" + uri; - } - - if( newURI == null ) - { - return new RelativeURI( uri ); - } - else - { - return new FileURI( newURI ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(org.eclipse.env.uri.URI) - */ - public URI newURI(URI uri) - { - return new FileURI( uri.toString() ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(java.net.URL) - */ - public URI newURI(URL url) - { - return new FileURI( url.toString() ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/file/FileURI.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/file/FileURI.java deleted file mode 100644 index e6916700b..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/env/core/uri/file/FileURI.java +++ /dev/null @@ -1,271 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.env.core.uri.file; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Vector; - -import org.eclipse.wst.command.env.core.common.SimpleStatus; -import org.eclipse.wst.command.env.core.common.Status; -import org.eclipse.wst.command.env.core.uri.RelativeURI; -import org.eclipse.wst.command.env.core.uri.URI; -import org.eclipse.wst.command.env.core.uri.URIException; -import org.eclipse.wst.command.env.core.uri.URIFilter; -import org.eclipse.wst.command.env.core.uri.URIScheme; - - -public class FileURI extends RelativeURI -{ - private File file_ = null; - - public FileURI( String uri ) - { - super( uri ); - - if( getURIScheme().isValid( this ) ) - { - file_ = new File( uri.substring( 5, uri.length() ) ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#asFile() - */ - public File asFile() - { - return file_; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#erase() - */ - public void erase() throws URIException - { - deleteFile( file_ ); - } - - private void deleteFile( File file ) - { - if( file.isDirectory() ) - { - File[] children = file.listFiles(); - - for( int index = 0; index < children.length; index++ ) - { - File child = children[index]; - - if( child.isDirectory() ) - { - deleteFile( child ); - } - else - { - child.delete(); - } - } - } - - file.delete(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getInputStream() - */ - public InputStream getInputStream() throws URIException - { - FileInputStream stream = null; - - try - { - File parent = file_.getParentFile(); - parent.mkdirs(); - - stream = new FileInputStream( file_ ); - } - catch( IOException exc ) - { - Status status = new SimpleStatus( "", exc.getMessage(), Status.ERROR, exc ); - throw new URIException( status, this ); - } - - return stream; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getOutputStream() - */ - public OutputStream getOutputStream() throws URIException - { - FileOutputStream stream = null; - - try - { - File parent = file_.getParentFile(); - parent.mkdirs(); - - stream = new FileOutputStream( file_ ); - } - catch( IOException exc ) - { - Status status = new SimpleStatus( "", exc.getMessage(), Status.ERROR, exc ); - throw new URIException( status, this ); - } - - return stream; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getURIScheme() - */ - public URIScheme getURIScheme() - { - return new FileScheme(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isAvailableAsFile() - */ - public boolean isAvailableAsFile() - { - return file_ != null; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isAvailableAsURL() - */ - public boolean isAvailableAsURL() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isLeaf() - */ - public boolean isLeaf() - { - return file_.isFile(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isPresent() - */ - public boolean isPresent() - { - return file_.exists(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isReadable() - */ - public boolean isReadable() - { - return file_.canRead(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isWritable() - */ - public boolean isWritable() - { - return file_.canWrite(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#list() - */ - public URI[] list() throws URIException - { - File[] children = file_.listFiles(); - URI[] URIs = new URI[0]; - - if( children != null ) - { - int length = children.length; - - URIs = new URI[length]; - - for( int index = 0; index < length; index++ ) - { - URIs[index] = new FileURI( "file:" + children[index].getAbsolutePath() ); - } - } - - return URIs; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#list(org.eclipse.env.uri.URIFilter) - */ - public URI[] list(URIFilter uriFilter) throws URIException - { - File[] children = file_.listFiles(); - int length = children == null ? 0 : children.length; - Vector URIs = new Vector(); - - for( int index = 0; index < length; index++ ) - { - URI newURI = new FileURI( "file:" + children[index].getAbsolutePath() ); - - if( uriFilter.accepts( newURI) ) - { - URIs.add( newURI ); - } - } - - return (URI[])URIs.toArray( new URI[0] ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#rename(org.eclipse.env.uri.URI) - */ - public void rename(URI newURI) throws URIException - { - uri_ = newURI.toString(); - file_.renameTo( new File( uri_ ) ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#touchFolder() - */ - public void touchFolder() throws URIException - { - file_.mkdirs(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#touchLeaf() - */ - public void touchLeaf() throws URIException - { - try - { - // Ensure that the parent folders are created. - File parent = file_.getParentFile(); - parent.mkdirs(); - - file_.createNewFile(); - } - catch( IOException exc ) - { - Status status = new SimpleStatus( "", exc.getMessage(), Status.ERROR, exc ); - throw new URIException( status, this ); - } - } - - private class Dummy - { - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/ClassEntry.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/ClassEntry.java deleted file mode 100644 index 0d08d1017..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/ClassEntry.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.internal.env.core.data; - -import java.util.Vector; - -public class ClassEntry -{ - public Object lastObject_; - public Vector getterList_; - public Vector setterList_; - public int order_; -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/DataFlowManager.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/DataFlowManager.java deleted file mode 100644 index 62ac9168a..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/DataFlowManager.java +++ /dev/null @@ -1,275 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.internal.env.core.data; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Hashtable; -import java.util.Vector; - -import org.eclipse.wst.command.env.core.common.Environment; -import org.eclipse.wst.command.env.core.common.Log; -import org.eclipse.wst.command.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.env.core.data.Transformer; - - -public class DataFlowManager -{ - private DataMappingRegistryImpl registry_; - private Hashtable classTable_; - private int order_; - private Environment environment_; - - public DataFlowManager( DataMappingRegistryImpl registry, Environment environment ) - { - registry_ = registry; - classTable_ = new Hashtable(); - order_ = 0; - environment_ = environment; - } - - public DataMappingRegistry getMappingRegistry() - { - return registry_; - } - - public void process( Object object ) - { - // Add this object to the classTable_ if required. - String objectType = object.getClass().getName(); - ClassEntry classEntry = (ClassEntry)classTable_.get( objectType ); - - environment_.getLog().log(Log.INFO, "data", 5004, this, "process", "Processing: " + objectType ); - - if( classEntry == null ) - { - classEntry = new ClassEntry(); - classTable_.put( objectType, classEntry ); - } - - classEntry.lastObject_ = object; - classEntry.order_ = order_++; - - // Now process the setters for this object - Vector ruleEntries = registry_.getRuleEntries( objectType ); - - if( ruleEntries != null ) - { - if( classEntry.setterList_ == null ) - { - classEntry.setterList_ = getSetterList( object ); - } - - // For each setter in this object try to find a rule. - for( int setterIndex = 0; setterIndex < classEntry.setterList_.size(); setterIndex++ ) - { - ObjectMethod currentObjectMethod = new ObjectMethod(); - Method setterMethod = (Method)classEntry.setterList_.elementAt( setterIndex ); - RuleEntry currentRuleEntry = null; - - currentObjectMethod.order = -1; - - // Find rules that match this setter. Note: there can be more than one rule - // that matches this setter. In this case we use the most recent, which is - // defined by the order field. - for( int index = 0; index < ruleEntries.size(); index++ ) - { - RuleEntry ruleEntry = (RuleEntry)ruleEntries.elementAt( index ); - - if( setterMethod.getName().equals( "set" + ruleEntry.targetProperty_ ) ) - { - // We found a setter for this rule. Now find the getter method. - // Note: getGetterMethod always returns a value, but if there is no - // getters available it will set the order to -1. - ObjectMethod getter = getGetterMethod( ruleEntry.sourceType_, ruleEntry.sourceProperty_ ); - - if( getter.order == -1 ) - { - environment_.getLog().log(Log.INFO , "data", 5005, this, "process", " >>No getter found for property: " + setterMethod.getName()); - } - - if( currentObjectMethod.order < getter.order ) - { - // We found a more recent getter. - currentObjectMethod = getter; - currentRuleEntry = ruleEntry; - } - } - } - - if( currentObjectMethod.order != -1 ) - { - invokeMethod( currentObjectMethod.object, - currentObjectMethod.method, - object, - setterMethod, - currentRuleEntry.transformer_ ); - } - else - { - environment_.getLog().log(Log.INFO, "data", 5006, this, "process", " >>No rule found for setter: " + setterMethod.getName() ); - } - } - } - } - - /** - * Find all the setters for this object and return a vector of them. - * - * @param object - * @return - */ - private Vector getSetterList( Object object ) - { - Vector result = new Vector(); - - Method[] methods = object.getClass().getMethods(); - - for( int index = 0; index < methods.length; index++ ) - { - Method method = methods[index]; - boolean isPublic = Modifier.isPublic( method.getModifiers() ); - Class returnType = method.getReturnType(); - - if( isPublic && - returnType == Void.TYPE && - method.getParameterTypes().length == 1 && - method.getName().startsWith( "set" )) - { - method.setAccessible( true ); - result.add( method ); - } - } - - return result; - } - - private ObjectMethod getGetterMethod( String sourceType, String sourceProperty ) - { - ClassEntry classEntry = (ClassEntry)classTable_.get( sourceType ); - ObjectMethod getterFound = new ObjectMethod(); - - // Indicate that there is no getter yet. - getterFound.order = -1; - - if( classEntry != null ) - { - if( classEntry.getterList_ == null ) - { - // Build the getter list. - classEntry.getterList_ = getGetterList( classEntry.lastObject_ ); - } - - for( int index = 0; index < classEntry.getterList_.size(); index++ ) - { - Method getter = (Method)classEntry.getterList_.elementAt( index ); - - if( getter.getName().equals( "get" + sourceProperty )) - { - getterFound.order = classEntry.order_; - getterFound.method = getter; - getterFound.object = classEntry.lastObject_; - break; - } - } - } - - return getterFound; - } - - private Vector getGetterList( Object object ) - { - Vector result = new Vector(); - - Method[] methods = object.getClass().getMethods(); - - for( int index = 0; index < methods.length; index++ ) - { - Method method = methods[index]; - boolean isPublic = Modifier.isPublic( method.getModifiers() ); - Class returnType = method.getReturnType(); - - if( isPublic && - returnType != Void.TYPE && - method.getParameterTypes().length == 0 && - method.getName().startsWith( "get" )) - { - method.setAccessible( true ); - result.add( method ); - } - } - - return result; - } - - private void invokeMethod( Object sourceObject, - Method sourceMethod , - Object clientObject, - Method clientMethod, - Transformer transformer) - { - Object data = null; - - try - { - data = sourceMethod.invoke( sourceObject, new Object[0] ); - } - catch( InvocationTargetException exc ) - { - exc.printStackTrace(); - // pgm Need to externalize this string. - throw new IllegalArgumentException( "Provider \"" + sourceObject.getClass().getName() + - "\" threw an exception." ); - } - catch( IllegalAccessException exc ) - { - exc.printStackTrace(); - // pgm Need to externalize this string. - throw new IllegalArgumentException( "Provider \"" + sourceObject.getClass().getName() + - "\" threw an exception." ); - } - - environment_.getLog().log(Log.INFO, "data", 5007, this, "invokeMethod "," Setting prop: " + clientMethod.getName() + " data=" + data + " from: " + sourceObject.getClass().getName() ); - - - if( transformer != null ) - { - data = transformer.transform( data ); - } - - try - { - clientMethod.invoke( clientObject, new Object[]{ data } ); - } - catch( InvocationTargetException exc ) - { - exc.printStackTrace(); - // pgm Need to externalize this string. - throw new IllegalArgumentException( "Client \"" + clientObject.getClass().getName() + - "\" threw an exception." ); - } - catch( IllegalAccessException exc ) - { - exc.printStackTrace(); - // pgm Need to externalize this string. - throw new IllegalArgumentException( "Client \"" + clientObject.getClass().getName() + - "\" threw an exception." ); - } - } - - private class ObjectMethod - { - public Object object; - public Method method; - public int order; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/DataMappingRegistryImpl.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/DataMappingRegistryImpl.java deleted file mode 100644 index 132a09dfe..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/DataMappingRegistryImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.internal.env.core.data; - -import java.util.Hashtable; -import java.util.Vector; - -import org.eclipse.wst.command.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.env.core.data.Transformer; - - -public class DataMappingRegistryImpl implements DataMappingRegistry -{ - private Hashtable rulesTable_ = new Hashtable(); - - public Vector getRuleEntries( String targetType ) - { - return (Vector)rulesTable_.get( targetType ); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.data.DataMappingRegistry#addMapping(java.lang.Class, java.lang.String, java.lang.Class, java.lang.String, org.eclipse.wst.command.env.core.data.Transformer) - */ - public void addMapping( Class sourceType, String sourceProperty, - Class targetType, String targetProperty, - Transformer transformer) - { - Vector ruleEntries = (Vector)rulesTable_.get( targetType.getName() ); - RuleEntry ruleEntry = null; - - if( ruleEntries == null ) - { - ruleEntries = new Vector(); - rulesTable_.put( targetType.getName(), ruleEntries ); - } - - // Find the rule entry - for( int index = 0; index < ruleEntries.size(); index++ ) - { - RuleEntry newEntry = (RuleEntry)ruleEntries.elementAt( index ); - - if( sourceProperty.equals( newEntry.sourceProperty_ ) && - sourceType.equals( newEntry.sourceType_ ) && - targetProperty.equals( newEntry.targetProperty_ ) ) - { - // The entry already exists - ruleEntry = newEntry; - break; - } - } - - if( ruleEntry == null ) - { - // The rule didn't exist already so we will create a new one. - ruleEntry = new RuleEntry(sourceType.getName(), sourceProperty, targetProperty, transformer ); - ruleEntries.add( ruleEntry ); - } - else - { - // Just update the transformer. - ruleEntry.transformer_ = transformer; - } - } - - //ruleEntries_. -// String sourceClass = sourceType.getName(); -// String targetClass = targetType.getName(); -// Vector entries = (Vector)ruleEntries_.get( sourceClass ); -// RuleEntry ruleEntry = null; -// -// if( entries != null ) -// { -// // Check to see if this mapping already exists. -// for( int index = 0; index < entries.size(); index++ ) -// { -// RuleEntry foundEntry = (RuleEntry)entries.elementAt( index ); -// -// if( sourceProperty.equals( foundEntry.sourceProperty_ ) && -// targetType.equals( foundEntry.targetType_ ) && -// targetProperty.equals( foundEntry.targetProperty_ ) ) -// { -// ruleEntry = foundEntry; -// ruleEntry.transformer_ = transformer; -// } -// } -// -// // There is an existing vector for this sourceClass, but it didn't -// // contain this new rule so we will add it in. -// if( ruleEntry == null ) -// { -// ruleEntry = new RuleEntry( sourceProperty, targetClass, targetProperty, transformer ); -// entries.add( ruleEntry ); -// } -// } -// else -// { -// // We need to create a new vector for this sourceClass. -// entries = new Vector(); -// ruleEntry = new RuleEntry( sourceProperty, targetClass, targetProperty, transformer ); -// entries.add( ruleEntry ); -// ruleEntries_.put( sourceClass, entries ); -// } -// } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.data.DataMappingRegistry#addMapping(java.lang.Class, java.lang.String, java.lang.Class) - */ - public void addMapping(Class sourceType, String sourceProperty, Class targetType) - { - addMapping( sourceType, sourceProperty, targetType, sourceProperty, null ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/RuleEntry.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/RuleEntry.java deleted file mode 100644 index c039735d0..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/RuleEntry.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.internal.env.core.data; - -import org.eclipse.wst.command.env.core.data.Transformer; - -public class RuleEntry -{ - public String sourceType_; - public String sourceProperty_; - public String targetProperty_; - public Transformer transformer_; - - - public RuleEntry( String sourceType, - String sourceProperty, - String targetProperty, - Transformer transformer ) - { - sourceType_ = sourceType; - sourceProperty_ = sourceProperty; - targetProperty_ = targetProperty; - transformer_ = transformer; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/ICommandFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/ICommandFactory.java deleted file mode 100644 index 1af158683..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/ICommandFactory.java +++ /dev/null @@ -1,30 +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 - *******************************************************************************/ - -package org.eclipse.wst.command.internal.provisional; - -import java.util.Iterator; - -import org.eclipse.wst.command.env.core.Command; - -/** - * - * This class is used to return a sequence of Commands. - * - */ -public interface ICommandFactory extends Iterator -{ - /** - * - * @return returns the next Command in the sequence. - */ - public Command getNextCommand(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/SimpleCommandFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/SimpleCommandFactory.java deleted file mode 100644 index a32a17d45..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/SimpleCommandFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.wst.command.internal.provisional; - -import java.util.Vector; - -import org.eclipse.wst.command.env.core.Command; - -public class SimpleCommandFactory implements ICommandFactory -{ - private Vector commands_; - private int index_; - - public SimpleCommandFactory( Vector commands ) - { - commands_ = commands; - index_ = 0; - } - - public Command getNextCommand() - { - return (Command)next(); - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - - public boolean hasNext() - { - return index_ < commands_.size(); - } - - public Object next() - { - return commands_.elementAt(index_++); - } - -} |