Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config')
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Comment.java50
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/ManInTheMiddle.java72
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfig.java165
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfigReader.java49
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Redirect.java124
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/CommentImpl.java75
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/ManInTheMiddleImpl.java142
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigImpl.java561
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigReaderImpl.java479
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/RedirectImpl.java299
10 files changed, 0 insertions, 2016 deletions
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Comment.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Comment.java
deleted file mode 100644
index bde4ad6fe..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Comment.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.document.DocumentElement;
-
-/**
- * The interface for monitor config Comment element.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public interface Comment extends DocumentElement
-{
- /**
- * Element name.
- */
- public static final String ELEM_NAME = WSIConstants.ELEM_COMMENT;
-
- /**
- * QName.
- */
- public static final QName QNAME =
- new QName(WSIConstants.NS_URI_WSI_MONITOR_CONFIG, ELEM_NAME);
-
- /**
- * Get comment text.
- * @return comment text.
- * @see #setText
- */
- public String getText();
-
- /**
- * Set comment text.
- * @param text the comment text.
- * @see #getText
- */
- public void setText(String text);
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/ManInTheMiddle.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/ManInTheMiddle.java
deleted file mode 100644
index 85c0aa2fb..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/ManInTheMiddle.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config;
-
-import java.util.Vector;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.document.DocumentElement;
-
-/**
- * The interface for the monitor config ManInTheMiddle element.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public interface ManInTheMiddle extends DocumentElement
-{
- /**
- * Element name.
- */
- public static final String ELEM_NAME = WSIConstants.ELEM_MAN_IN_THE_MIDDLE;
-
- /**
- * QName.
- */
- public static final QName QNAME =
- new QName(WSIConstants.NS_URI_WSI_MONITOR_CONFIG, ELEM_NAME);
-
- /**
- * Get comment.
- * @return comment.
- * @see #setComment
- */
- public Comment getComment();
-
- /**
- * Set comment.
- * @param comment the Comment object.
- * @see #getComment
- */
- public void setComment(Comment comment);
-
- /**
- * Get redirects.
- * @return the redirirects.
- * @see #setRedirectList
- */
- public Vector getRedirectList();
-
- /**
- * Add redirect.
- * @param redirect the Redirect object.
- */
- public void addRedirect(Redirect redirect);
-
- /**
- * Set redirects.
- * @param redirectList a list of the redirects.
- * @see #getRedirectList
- */
- public void setRedirectList(Vector redirectList);
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfig.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfig.java
deleted file mode 100644
index 11df1ed52..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfig.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.common.AddStyleSheet;
-import org.eclipse.wst.wsi.internal.core.document.WSIDocument;
-import org.eclipse.wst.wsi.internal.core.util.MessageList;
-
-/**
- * This is the interface for the monitor configuration file.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public interface MonitorConfig extends WSIDocument
-{
- /**
- * Element name.
- */
- public static final String ELEM_NAME = WSIConstants.ELEM_CONFIG;
-
- /**
- * QName.
- */
- public static final QName QNAME =
- new QName(WSIConstants.NS_URI_WSI_MONITOR_CONFIG, ELEM_NAME);
-
- /**
- * Initialize monitor config.
- * @param messageList a lMessageList object.
- */
- public void init(MessageList messageList);
-
- /**
- * Get comment.
- * @return comment.
- * @see #setComment
- */
- public Comment getComment();
-
- /**
- * Set comment.
- * @param comment a Comment object.
- * @see #getComment
- */
- public void setComment(Comment comment);
-
- /**
- * Get log file location.
- * @return log file location.
- * @see #setLogLocation
- */
- public String getLogLocation();
-
- /**
- * Set log file location.
- * @param logURI log file location.
- * @see #getLogLocation
- */
- public void setLogLocation(String logURI);
-
- /**
- * Get replace log.
- * @return replace log.
- * @see #setReplaceLog
- */
- public boolean getReplaceLog();
-
- /**
- * Set replace log.
- * @param replaceLog a replace log.
- * @see #getReplaceLog
- */
- public void setReplaceLog(boolean replaceLog);
-
- /**
- * Get add style sheet.
- * @return add style sheet.
- * @see #setAddStyleSheet
- */
- public AddStyleSheet getAddStyleSheet();
-
- /**
- * Set add style sheet.
- * @param addStyleSheet add style sheet.
- * @see #getAddStyleSheet
- */
- public void setAddStyleSheet(AddStyleSheet addStyleSheet);
-
- /**
- * Get log duration.
- * @return log duration.
- * @see #setLogDuration
- */
- public int getLogDuration();
-
- /**
- * Set log duration.
- * @param logDuration log duration.
- * @see #getLogDuration
- */
- public void setLogDuration(int logDuration);
-
- /**
- * Get timeout.
- * @return timeout.
- * @see #setTimeout
- */
- public int getTimeout();
-
- /**
- * Set timeout.
- * @param timeout timeout.
- * @see #getTimeout
- */
- public void setTimeout(int timeout);
-
- /**
- * Get man-in-the-middle information.
- * @return man-in-the-middle information.
- * @see #setManInTheMiddle
- */
- public ManInTheMiddle getManInTheMiddle();
-
- /**
- * Set man-in-the-middle information.
- * @param manInTheMiddle man-in-the-middle information.
- * @see #getManInTheMiddle
- */
- public void setManInTheMiddle(ManInTheMiddle manInTheMiddle);
-
- /**
- * Get verbose option.
- * @return verbose option.
- * @see #setVerboseOption
- */
- public boolean getVerboseOption();
-
- /**
- * Set verbose option.
- * @param verbose verbose option.
- * @see #getVerboseOption
- */
- public void setVerboseOption(boolean verbose);
-
- /**
- * Parse the command line arguments.
- * @param args the command line arguments.
- * @throws WSIException if problems occur while parsing the
- * command line arguments,
- */
- public void parseArgs(String[] args) throws WSIException;
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfigReader.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfigReader.java
deleted file mode 100644
index 38fbd0753..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/MonitorConfigReader.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config;
-
-import java.io.Reader;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.document.DocumentReader;
-import org.eclipse.wst.wsi.internal.core.util.MessageList;
-
-/**
- * Defines the interface used to read the monitor config documents.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public interface MonitorConfigReader extends DocumentReader
-{
- /**
- * Initialize monitor config.
- * @param messageList a MessageList object.
- */
- public void init(MessageList messageList);
-
- /**
- * Read the monitor config file.
- * @param monitorConfigURI the monitor config file location.
- * @return a MonitorConfig object
- * @throws WSIException if problems occur while reading monitor config file.
- */
- public MonitorConfig readMonitorConfig(String monitorConfigURI)
- throws WSIException;
-
- /**
- * Read the monitor config file.
- * @param reader a Reader object.
- * @return a MonitorConfig object
- * @throws WSIException if problems occur while reading monitor config file.
- */
- public MonitorConfig readMonitorConfig(Reader reader) throws WSIException;
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Redirect.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Redirect.java
deleted file mode 100644
index 6e3082d6d..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/Redirect.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.document.DocumentElement;
-
-/**
- * The interface for monitor config Redirect element.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public interface Redirect extends DocumentElement
-{
- /**
- * Element name.
- */
- public static final String ELEM_NAME = WSIConstants.ELEM_REDIRECT;
-
- /**
- * QName.
- */
- public static final QName QNAME =
- new QName(WSIConstants.NS_URI_WSI_MONITOR_CONFIG, ELEM_NAME);
-
- /**
- * Get comment.
- * @return comment.
- * @see #setComment
- */
- public Comment getComment();
-
- /**
- * Set comment.
- * @param comment a Commentobject.
- * @see #getComment
- */
- public void setComment(Comment comment);
-
- /**
- * Get listen port.
- * @return listen port.
- * @see #setListenPort
- */
- public int getListenPort();
-
- /**
- * Set listen port.
- * @param listenPort listen port.
- * @see #getListenPort
- */
- public void setListenPort(int listenPort);
-
- /**
- * Get host.
- * @return host.
- * @see #setHost
- */
- public String getHost();
-
- /**
- * Set host.
- * @param host host.
- * @see #getHost
- */
- public void setHost(String host);
-
- /**
- * Get send to port.
- * @return send to port.
- */
- public int getToPort();
-
- /**
- * Get send to host.
- * @return send to host.
- */
- public String getToHost();
-
- /**
- * Get send to protocol.
- * @return send to protocol.
- */
- public String getToProtocol();
-
- /**
- * Get maximum connections.
- * @return maximum connections.
- * @see #setMaxConnections
- */
- public int getMaxConnections();
-
- /**
- * Set maximum connections.
- * @param maxConnections maximum connections.
- * @see #getMaxConnections
- */
- public void setMaxConnections(int maxConnections);
-
- /**
- * Get read timeout seconds.
- * @return read timeout seconds.
- * @see #setReadTimeoutSeconds
- */
- public int getReadTimeoutSeconds();
-
- /**
- * Set read timeout seconds.
- * @param readTimeoutSeconds read timeout seconds.
- * @see #getReadTimeoutSeconds
- */
- public void setReadTimeoutSeconds(int readTimeoutSeconds);
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/CommentImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/CommentImpl.java
deleted file mode 100644
index 61c09b5d7..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/CommentImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config.impl;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import org.eclipse.wst.wsi.internal.core.monitor.config.Comment;
-
-/**
- * The implementation for monitor config Comment element.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public class CommentImpl implements Comment
-{
- /**
- * Comment text.
- */
- protected String text = null;
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Comment#getText()
- */
- public String getText()
- {
- return this.text;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Comment#setText(String)
- */
- public void setText(String text)
- {
- this.text = text;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.DocumentElement#toXMLString(String)
- */
- public String toXMLString(String namespaceName)
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- String nsName = namespaceName;
- if ((!nsName.equals("") && (!nsName.endsWith(":"))))
- nsName += ":";
-
- // Config options
- //pw.print(" <" + nsName + ELEM_NAME + " xmlns=\"" + WSIConstants.NS_URI_WSI_MONITOR_CONFIG + "\">");
- pw.print(" <" + nsName + ELEM_NAME + ">");
- pw.print(this.text);
-
- // End element
- pw.println("</" + nsName + ELEM_NAME + ">");
-
- return sw.toString();
- }
-
- public String toString()
- {
- return text;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/ManInTheMiddleImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/ManInTheMiddleImpl.java
deleted file mode 100644
index 858fa632b..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/ManInTheMiddleImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config.impl;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.wst.wsi.internal.core.monitor.config.Comment;
-import org.eclipse.wst.wsi.internal.core.monitor.config.ManInTheMiddle;
-import org.eclipse.wst.wsi.internal.core.monitor.config.Redirect;
-
-/**
- * The implementation for the monitor config ManInTheMiddle element.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public class ManInTheMiddleImpl implements ManInTheMiddle
-{
- /**
- * Comment.
- */
- protected Comment comment;
-
- /**
- * Redirect list.
- */
- protected Vector redirectList = new Vector();
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.ManInTheMiddle#getComment()
- */
- public Comment getComment()
- {
- return this.comment;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.ManInTheMiddle#setComment(Comment)
- */
- public void setComment(Comment comment)
- {
- this.comment = comment;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.ManInTheMiddle#getRedirectList()
- */
- public Vector getRedirectList()
- {
- return redirectList;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.ManInTheMiddle#addRedirect(Redirect)
- */
- public void addRedirect(Redirect redirect)
- {
- redirectList.add(redirect);
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.ManInTheMiddle#setRedirectList(Vector)
- */
- public void setRedirectList(Vector redirectList)
- {
- this.redirectList = redirectList;
- }
-
- /* (non-Javadoc)
- * Get string representation of this object.
- */
- public String toString()
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- pw.println(" man-in-the-middle comment ... " + this.comment);
-
- // Redirect list
- int count = 1;
- Redirect redirect;
- Iterator iterator = redirectList.iterator();
- while (iterator.hasNext())
- {
- // Get next redirect element
- redirect = (Redirect) iterator.next();
- pw.println(" redirect [" + count++ +"]");
- pw.print(redirect.toString());
- }
-
- return sw.toString();
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.DocumentElement#toXMLString(String)
- */
- public String toXMLString(String namespaceName)
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- String nsName = namespaceName;
- if ((!nsName.equals("") && (!nsName.endsWith(":"))))
- nsName += ":";
-
- // Start element
- pw.println(" <" + nsName + ELEM_NAME + ">");
-
- // Comment
- if (this.comment != null)
- {
- pw.println(this.comment.toXMLString(nsName));
- }
-
- // Redirect
- Redirect redirect;
- Iterator iterator = redirectList.iterator();
- while (iterator.hasNext())
- {
- // Get next redirect element
- redirect = (Redirect) iterator.next();
- pw.print(redirect.toXMLString(nsName));
- }
-
- // End element
- pw.println(" </" + nsName + ELEM_NAME + ">");
-
- return sw.toString();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigImpl.java
deleted file mode 100644
index 586966d83..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigImpl.java
+++ /dev/null
@@ -1,561 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config.impl;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.common.AddStyleSheet;
-import org.eclipse.wst.wsi.internal.core.common.impl.AddStyleSheetImpl;
-import org.eclipse.wst.wsi.internal.core.monitor.Monitor;
-import org.eclipse.wst.wsi.internal.core.monitor.config.Comment;
-import org.eclipse.wst.wsi.internal.core.monitor.config.ManInTheMiddle;
-import org.eclipse.wst.wsi.internal.core.monitor.config.MonitorConfig;
-import org.eclipse.wst.wsi.internal.core.monitor.config.MonitorConfigReader;
-import org.eclipse.wst.wsi.internal.core.monitor.config.Redirect;
-import org.eclipse.wst.wsi.internal.core.util.MessageList;
-
-/**
- * This is the implementation for the monitor configuration file.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public class MonitorConfigImpl implements MonitorConfig
-{
- /**
- * Message list reference.
- */
- protected MessageList messageList = null;
-
- /**
- * Monitor configuration file URI.
- */
- protected String documentURI = null;
-
- /**
- * Comment.
- */
- protected Comment comment = null;
-
- /**
- * Log location.
- */
- protected String logURI;
-
- /**
- * Replace log indicator.
- */
- protected boolean replaceLog = false;
-
- /**
- * Style sheet declaration.
- */
- protected AddStyleSheet addStyleSheet;
-
- /**
- * Log duration.
- */
- protected int logDuration = 600;
-
- /**
- * Timeout.
- */
- protected int timeout = 3;
-
- /**
- * Man-in-the-middle settings.
- */
- protected ManInTheMiddle manInTheMiddle = null;
-
- /**
- * Verbose option.
- */
- protected boolean verbose = false;
-
- /**
- * Initialize monitor config.
- */
- public void init(MessageList messageList)
- {
- this.messageList = messageList;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getComment()
- */
- public Comment getComment()
- {
- return this.comment;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setComment(Comment)
- */
- public void setComment(Comment comment)
- {
- this.comment = comment;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getLogLocation()
- */
- public String getLogLocation()
- {
- return this.logURI;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setLogLocation(String)
- */
- public void setLogLocation(String logURI)
- {
- this.logURI = logURI;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getReplaceLog()
- */
- public boolean getReplaceLog()
- {
- return this.replaceLog;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setReplaceLog(boolean)
- */
- public void setReplaceLog(boolean replaceLog)
- {
- this.replaceLog = replaceLog;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getAddStyleSheet()
- */
- public AddStyleSheet getAddStyleSheet()
- {
- return this.addStyleSheet;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setAddStyleSheet(org.wsi.test.common.AddStyleSheet)
- */
- public void setAddStyleSheet(AddStyleSheet addStyleSheet)
- {
- this.addStyleSheet = addStyleSheet;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getLogDuration()
- */
- public int getLogDuration()
- {
- return logDuration;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setLogDuration(int)
- */
- public void setLogDuration(int logDuration)
- {
- this.logDuration = logDuration;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getTimeout()
- */
- public int getTimeout()
- {
- return this.timeout;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setTimeout(int)
- */
- public void setTimeout(int timeout)
- {
- this.timeout = timeout;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getManInTheMiddle()
- */
- public ManInTheMiddle getManInTheMiddle()
- {
- return manInTheMiddle;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setManInTheMiddle(ManInTheMiddle)
- */
- public void setManInTheMiddle(ManInTheMiddle manInTheMiddle)
- {
- this.manInTheMiddle = manInTheMiddle;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.WSIDocument#getLocation()
- */
- public String getLocation()
- {
- return this.documentURI;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.WSIDocument#setLocation(String)
- */
- public void setLocation(String documentURI)
- {
- this.documentURI = documentURI;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#getVerboseOption()
- */
- public boolean getVerboseOption()
- {
- return this.verbose;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfig#setVerboseOption(boolean)
- */
- public void setVerboseOption(boolean verbose)
- {
- this.verbose = verbose;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.DocumentElement#toXMLString(String)
- */
- public String toXMLString(String namespaceName)
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- String nsName = namespaceName;
- if ((!nsName.equals("") && (!nsName.endsWith(":"))))
- nsName += ":";
-
- // Config options
- pw.println(" <" + nsName + ELEM_NAME + ">");
-
- // Comment
- if (this.comment != null)
- {
- pw.print(comment.toXMLString(nsName));
- }
-
- // Log file
- pw.print(" <" + nsName + WSIConstants.ELEM_LOG_FILE + " ");
- pw.print(WSIConstants.ATTR_REPLACE + "=\"" + this.replaceLog + "\" ");
- pw.println(WSIConstants.ATTR_LOCATION + "=\"" + this.logURI + "\">");
- pw.print(getAddStyleSheet().toXMLString(namespaceName));
- pw.println(" </" + nsName + WSIConstants.ELEM_LOG_FILE + ">");
-
- // Log duration
- pw.print(" <" + nsName + WSIConstants.ELEM_LOG_DURATION + ">");
- pw.print(this.logDuration);
- pw.println("</" + nsName + WSIConstants.ELEM_LOG_DURATION + ">");
-
- // Timeout
- pw.print(
- " <" + nsName + WSIConstants.ELEM_CLEANUP_TIMEOUT_SECONDS + ">");
- pw.print(this.timeout);
- pw.println("</" + nsName + WSIConstants.ELEM_CLEANUP_TIMEOUT_SECONDS + ">");
-
- // Man-in-the-middle
- if (this.manInTheMiddle != null)
- {
- pw.print(manInTheMiddle.toXMLString(nsName));
- }
-
- // End element
- pw.println(" </" + nsName + ELEM_NAME + ">");
-
- return sw.toString();
- }
-
- /**
- * Get string representation of this object.
- */
- public String toString()
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- pw.println(" comment ..................... " + this.comment);
- pw.println(" logURI ...................... " + this.logURI);
- pw.println(" replaceLog .................. " + this.replaceLog);
- pw.println(" logDuration ................. " + this.logDuration);
- pw.println(" timeout ..................... " + this.timeout);
-
- // addStyleSheet
- if (this.addStyleSheet != null)
- pw.println(
- " addStyleSheet ............... " + this.addStyleSheet.toString());
-
- // Man-in-the-middle
- if (this.manInTheMiddle != null)
- {
- pw.print(this.manInTheMiddle.toString());
- }
-
- return sw.toString();
- }
-
- /**
- * Set config values from another monitor config object.
- */
- private void setConfig(MonitorConfig monitorConfig)
- {
- // ADD: Should this be a clone operation?
- this.comment = monitorConfig.getComment();
- this.documentURI = monitorConfig.getLocation();
- this.logURI = monitorConfig.getLogLocation();
- this.replaceLog = monitorConfig.getReplaceLog();
- this.logDuration = monitorConfig.getLogDuration();
- this.timeout = monitorConfig.getTimeout();
- this.manInTheMiddle = monitorConfig.getManInTheMiddle();
- this.addStyleSheet = monitorConfig.getAddStyleSheet();
- this.verbose = monitorConfig.getVerboseOption();
- }
-
- /**
- * Verify config options.
- */
- private void verifyConfig() throws WSIException
- {
- // If no redirect statements, then exit
- if ((this.manInTheMiddle == null)
- || (this.manInTheMiddle.getRedirectList() == null)
- || (this.manInTheMiddle.getRedirectList().size() == 0))
- {
- throw new IllegalArgumentException(
- getMessage(
- "config05",
- "Monitor config file did not contain any redirect statements."));
- }
-
- if (this.logURI == null)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config06",
- "Monitor config file did not contain the log file URI."));
- }
- }
-
- /**
- * Parse the command line arguments.
- */
- public void parseArgs(String[] args) throws WSIException
- {
- // Get new config reader
- MonitorConfigReader monitorConfigReader = new MonitorConfigReaderImpl();
-
- // Monitor config object which will be merged after all of the input parms are processed
- MonitorConfig monitorConfigFromArgs = null;
-
- // If no input arguments, then throw exception
- if (args.length == 0)
- {
- // ADD:
- throw new IllegalArgumentException(
- getMessage("usage01", Monitor.USAGE_MESSAGE));
- }
-
- // Parse the command line arguments to locate the config file option (if it was specified)
- for (int argCount = 0; argCount < args.length; argCount++)
- {
- // -configFile
- if ((args[argCount].equalsIgnoreCase("-config"))
- || (args[argCount].equals("-c")))
- {
- argCount++;
- monitorConfigFromArgs =
- monitorConfigReader.readMonitorConfig(args[argCount]);
- }
- }
-
- // If config file was not specified, then create analyzer config object
- if (monitorConfigFromArgs == null)
- {
- monitorConfigFromArgs = new MonitorConfigImpl();
- monitorConfigFromArgs.init(this.messageList);
- }
-
- // Parse all of the command line arguments
- for (int argCount = 0; argCount < args.length; argCount++)
- {
- // -configFile
- if ((args[argCount].equalsIgnoreCase("-config"))
- || (args[argCount].equals("-c")))
- {
- // Skip this option since it was already processed
- argCount++;
- }
-
- // -comment
- else if (
- (args[argCount].equalsIgnoreCase("-comment"))
- || (args[argCount].equals("-C")))
- {
- argCount++;
- Comment comment = new CommentImpl();
- comment.setText(args[argCount]);
- monitorConfigFromArgs.setComment(comment);
- }
-
- // -logFile
- else if (
- (args[argCount].equalsIgnoreCase("-logFile"))
- || (args[argCount].equals("-l")))
- {
- argCount++;
- monitorConfigFromArgs.setLogLocation(args[argCount]);
- }
-
- // -replace
- else if (
- (args[argCount].equalsIgnoreCase("-replace"))
- || (args[argCount].equals("-r")))
- {
- argCount++;
- monitorConfigFromArgs.setReplaceLog(
- Boolean.valueOf(args[argCount]).booleanValue());
- }
-
- // -logDuration
- else if (
- (args[argCount].equalsIgnoreCase("-logDuration"))
- || (args[argCount].equals("-d")))
- {
- argCount++;
- monitorConfigFromArgs.setLogDuration(
- Integer.valueOf(args[argCount]).intValue());
- }
-
- // -timeout
- else if (
- (args[argCount].equalsIgnoreCase("-timeout"))
- || (args[argCount].equals("-t")))
- {
- argCount++;
- monitorConfigFromArgs.setTimeout(
- Integer.valueOf(args[argCount]).intValue());
- }
-
- // -manInTheMiddle
- else if (
- (args[argCount].equalsIgnoreCase("-manInTheMiddle"))
- || (args[argCount].equals("-m")))
- {
- ManInTheMiddle manInTheMiddle = null;
-
- // Increment arg count
- argCount++;
-
- // Get the man-in-the-middle object
- if ((manInTheMiddle = monitorConfigFromArgs.getManInTheMiddle())
- == null)
- manInTheMiddle = new ManInTheMiddleImpl();
-
- // ADD: Check for correct number of remaining args
-
- // Create redirect
- Redirect redirect = new RedirectImpl();
-
- // Get the redirect values
- redirect.setListenPort(Integer.valueOf(args[argCount++]).intValue());
- redirect.setHost(args[argCount++]);
- redirect.setMaxConnections(
- Integer.valueOf(args[argCount++]).intValue());
- redirect.setReadTimeoutSeconds(
- Integer.valueOf(args[argCount++]).intValue());
-
- // Add redirect
- manInTheMiddle.addRedirect(redirect);
-
- // Set the man-in-the-middle
- monitorConfigFromArgs.setManInTheMiddle(manInTheMiddle);
- }
-
- // -verbose
- else if (
- (args[argCount].equalsIgnoreCase("-verbose"))
- || (args[argCount].equals("-v")))
- {
- argCount++;
- //monitorConfigFromArgs.setVerboseOption(Boolean.valueOf(args[argCount]).booleanValue());
- monitorConfigFromArgs.setVerboseOption(true);
- }
-
- // -GUI
- else if (args[argCount].equalsIgnoreCase("-GUI"))
- {
- // Ignore -GUI option
- }
-
- else
- {
- throw new IllegalArgumentException(
- getMessage(
- "config01",
- args[argCount],
- "The specified option is not supported."));
- }
- }
-
- // If addStyleSheet was not specified, then create a comment version of it
- if (monitorConfigFromArgs.getAddStyleSheet() == null)
- {
- AddStyleSheet addStyleSheet = new AddStyleSheetImpl();
- addStyleSheet.setHref(WSIConstants.DEFAULT_LOG_XSL);
- addStyleSheet.setType(WSIConstants.DEFAULT_XSL_TYPE);
- addStyleSheet.setComment(true);
- monitorConfigFromArgs.setAddStyleSheet(addStyleSheet);
- }
-
- // Merge config info into this object
- setConfig(monitorConfigFromArgs);
-
- // Verify config options
- verifyConfig();
- }
-
- /**
- * Get message from resource bundle.
- */
- private String getMessage(String messageID, String defaultMessage)
- {
- return getMessage(messageID, null, defaultMessage);
- }
-
- /**
- * Get message from resource bundle.
- */
- private String getMessage(
- String messageID,
- String messageData,
- String defaultMessage)
- {
- String message = defaultMessage;
- if (messageList != null)
- message = messageList.getMessage(messageID, messageData, defaultMessage);
- else
- message += " " + messageData + ".";
-
- return message;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigReaderImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigReaderImpl.java
deleted file mode 100644
index 004abca8e..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/MonitorConfigReaderImpl.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config.impl;
-
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.Reader;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSIFileNotFoundException;
-import org.eclipse.wst.wsi.internal.core.common.AddStyleSheet;
-import org.eclipse.wst.wsi.internal.core.common.impl.AddStyleSheetImpl;
-import org.eclipse.wst.wsi.internal.core.monitor.config.Comment;
-import org.eclipse.wst.wsi.internal.core.monitor.config.ManInTheMiddle;
-import org.eclipse.wst.wsi.internal.core.monitor.config.MonitorConfig;
-import org.eclipse.wst.wsi.internal.core.monitor.config.MonitorConfigReader;
-import org.eclipse.wst.wsi.internal.core.monitor.config.Redirect;
-import org.eclipse.wst.wsi.internal.core.util.MessageList;
-import org.eclipse.wst.wsi.internal.core.util.TestUtils;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Defines the implementation used to read the monitor config documents.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public class MonitorConfigReaderImpl implements MonitorConfigReader
-{
- /**
- * Message list reference.
- */
- protected MessageList messageList = null;
-
- /**
- * Document location.
- */
- protected String documentURI;
-
- /**
- * Initialize monitor config.
- */
- public void init(MessageList messageList)
- {
- this.messageList = messageList;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfigReader#readMonitorConfig(String)
- */
- public MonitorConfig readMonitorConfig(String monitorConfigURI)
- throws WSIException
- {
- FileReader fileReader = null;
-
- try
- {
- fileReader = new FileReader(monitorConfigURI);
- }
-
- catch (FileNotFoundException fnfe)
- {
- throw new WSIFileNotFoundException(
- getMessage("config02", monitorConfigURI, "Could not find file:"),
- fnfe);
- }
-
- catch (Exception e)
- {
- throw new WSIException(
- getMessage("config03", monitorConfigURI, "Could not read file:"),
- e);
- }
-
- return readMonitorConfig(fileReader);
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.MonitorConfigReader#readMonitorConfig(Reader)
- */
- public MonitorConfig readMonitorConfig(Reader reader) throws WSIException
- {
- MonitorConfig monitorConfig = new MonitorConfigImpl();
-
- // Parse XML
- Document doc = XMLUtils.parseXML(reader);
-
- // Parse elements in the config document
- parseConfigElement(monitorConfig, doc.getDocumentElement());
-
- return monitorConfig;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.DocumentReader#getLocation()
- */
- public String getLocation()
- {
- return this.documentURI;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.DocumentReader#setLocation(String)
- */
- public void setLocation(String documentURI)
- {
- this.documentURI = documentURI;
- }
-
- /**
- * Parse config element.
- */
- private void parseConfigElement(MonitorConfig monitorConfig, Element element)
- throws WSIException
- {
- // ADD: Verify that this is the config element
-
- // Get first child element
- Element nextElement = XMLUtils.getFirstChild(element);
-
- boolean isLogDurationDefine = false;
- boolean isCleanupTimeoutSecondsDefine = false;
-
- // Process each child element
- while (nextElement != null)
- {
- // <logFile>
- if (isElement(nextElement, WSIConstants.ELEM_LOG_FILE))
- {
- // Parse the log element
- parseLogFileElement(monitorConfig, nextElement);
- }
-
- // <logDuration>
- else if (isElement(nextElement, WSIConstants.ELEM_LOG_DURATION))
- {
- monitorConfig.setLogDuration(getIntValue(nextElement));
- if (monitorConfig.getLogDuration() < 0)
- throw new IllegalArgumentException(
- getMessage(
- "config09",
- WSIConstants.ELEM_LOG_DURATION,
- "Parameter value can't be negative. Element name:"));
- isLogDurationDefine = true;
- }
-
- // <cleanupTimeoutSeconds>
- else if (
- isElement(nextElement, WSIConstants.ELEM_CLEANUP_TIMEOUT_SECONDS))
- {
- monitorConfig.setTimeout(getIntValue(nextElement));
- if (monitorConfig.getTimeout() < 0)
- throw new IllegalArgumentException(
- getMessage(
- "config09",
- WSIConstants.ELEM_CLEANUP_TIMEOUT_SECONDS,
- "Parameter value can't be negative. Element name:"));
- isCleanupTimeoutSecondsDefine = true;
- }
-
- // <manInTheMiddle>
- else if (isElement(nextElement, WSIConstants.ELEM_MAN_IN_THE_MIDDLE))
- {
- ManInTheMiddle manInTheMiddle = new ManInTheMiddleImpl();
- monitorConfig.setManInTheMiddle(manInTheMiddle);
- parseManInTheMiddleElement(manInTheMiddle, nextElement);
- }
-
- // <comment>
- else if (isElement(nextElement, WSIConstants.ELEM_COMMENT))
- {
- Comment comment = new CommentImpl();
- comment.setText(XMLUtils.getText(nextElement));
- monitorConfig.setComment(comment);
- }
-
- else
- {
- // ADD: handle invalid elements
- }
-
- // Get next element
- nextElement = XMLUtils.getNextSibling(nextElement);
- }
-
- if (!isLogDurationDefine)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config10",
- WSIConstants.ELEM_LOG_DURATION,
- "Element is missing. Element name:"));
- }
- if (!isCleanupTimeoutSecondsDefine)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config10",
- WSIConstants.ELEM_CLEANUP_TIMEOUT_SECONDS,
- "Element is missing. Element name:"));
- }
- }
-
- /**
- * Parse logFile element.
- */
- private void parseLogFileElement(
- MonitorConfig monitorConfig,
- Element element)
- throws WSIException
- {
- // Get the location attribute
- monitorConfig.setLogLocation(
- XMLUtils.getAttributeValue(element, WSIConstants.ATTR_LOCATION));
-
- // Get the replace attribute
- monitorConfig.setReplaceLog(
- XMLUtils.getBooleanValue(element, WSIConstants.ATTR_REPLACE, false));
-
- // Get first child element
- Element nextElement = XMLUtils.getFirstChild(element);
-
- // Process each child element
- while (nextElement != null)
- {
- // <addStyleSheet>
- if (isElement(nextElement, WSIConstants.ELEM_ADD_STYLE_SHEET))
- {
- AddStyleSheet addStyleSheet = new AddStyleSheetImpl();
-
- // Parse the element
- TestUtils.parseAddStyleSheet(
- nextElement,
- addStyleSheet,
- WSIConstants.DEFAULT_LOG_XSL);
-
- // Set add style sheet
- monitorConfig.setAddStyleSheet(addStyleSheet);
- }
-
- else
- {
- // ADD: handle invalid elements
- }
-
- // Get next element
- nextElement = XMLUtils.getNextSibling(nextElement);
- }
- }
-
- /**
- * Parse manIntheMiddle element.
- */
- private void parseManInTheMiddleElement(
- ManInTheMiddle manInTheMiddle,
- Element element)
- throws WSIException
- {
- // Get first child element
- Element nextElement = XMLUtils.getFirstChild(element);
-
- // Process each child element
- while (nextElement != null)
- {
- // <redirect>
- if (isElement(nextElement, WSIConstants.ELEM_REDIRECT))
- {
- Redirect redirect = new RedirectImpl();
- manInTheMiddle.addRedirect(redirect);
- parseRedirectElement(redirect, nextElement);
- }
-
- // <comment>
- else if (isElement(nextElement, WSIConstants.ELEM_COMMENT))
- {
- Comment comment = new CommentImpl();
- comment.setText(XMLUtils.getText(nextElement));
- manInTheMiddle.setComment(comment);
- }
-
- else
- {
- // ADD: handle invalid elements
- }
-
- // Get next element
- nextElement = XMLUtils.getNextSibling(nextElement);
- }
- }
-
- /**
- * Parse redirect element.
- */
- private void parseRedirectElement(Redirect redirect, Element element)
- throws WSIException
- {
- // Get first child element
- Element nextElement = XMLUtils.getFirstChild(element);
-
- boolean isListenPortDefine = false;
- boolean isSchemeAndHostPortDefine = false;
- boolean isMaxConnectionsDefine = false;
- boolean isReadTimeoutSecondsDefine = false;
-
- // Process each child element
- while (nextElement != null)
- {
- // <listenPort>
- if (isElement(nextElement, WSIConstants.ELEM_LISTEN_PORT))
- {
- redirect.setListenPort(getIntValue(nextElement));
- isListenPortDefine = true;
- }
-
- // <schemeAndHostPort>
- else if (isElement(nextElement, WSIConstants.ELEM_SCHEME_AND_HOSTPORT))
- {
- redirect.setHost(XMLUtils.getText(nextElement));
- isSchemeAndHostPortDefine = true;
- }
-
- // <maxConnections>
- else if (isElement(nextElement, WSIConstants.ELEM_MAX_CONNECTIONS))
- {
- redirect.setMaxConnections(getIntValue(nextElement));
- isMaxConnectionsDefine = true;
- }
-
- // <readTimeoutSeconds>
- else if (isElement(nextElement, WSIConstants.ELEM_READ_TIMEOUT_SECONDS))
- {
- redirect.setReadTimeoutSeconds(getIntValue(nextElement));
- if (redirect.getReadTimeoutSeconds() < 0)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config09",
- WSIConstants.ELEM_READ_TIMEOUT_SECONDS,
- "Parameter value can't be negative. Element name:"));
- }
- isReadTimeoutSecondsDefine = true;
- }
-
- // <comment>
- else if (isElement(nextElement, WSIConstants.ELEM_COMMENT))
- {
- Comment comment = new CommentImpl();
- comment.setText(XMLUtils.getText(nextElement));
- redirect.setComment(comment);
- }
-
- else
- {
- // ADD: handle invalid elements
- }
-
- // Get next element
- nextElement = XMLUtils.getNextSibling(nextElement);
- }
-
- if (!isListenPortDefine)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config10",
- WSIConstants.ELEM_LISTEN_PORT,
- "Element is missing. Element name:"));
- }
- if (!isSchemeAndHostPortDefine)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config10",
- WSIConstants.ELEM_SCHEME_AND_HOSTPORT,
- "Element is missing. Element name:"));
-
- }
- if (!isMaxConnectionsDefine)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config10",
- WSIConstants.ELEM_MAX_CONNECTIONS,
- "Element is missing. Element name:"));
- }
- if (!isReadTimeoutSecondsDefine)
- {
- throw new IllegalArgumentException(
- getMessage(
- "config10",
- WSIConstants.ELEM_READ_TIMEOUT_SECONDS,
- "Element is missing. Element name:"));
- }
- }
-
- /**
- * Determine if this element matches specified local name in the analyzer config namespace.
- */
- private boolean isElement(Element element, String localName)
- {
- return isElement(
- element,
- WSIConstants.NS_URI_WSI_MONITOR_CONFIG,
- localName);
- }
-
- /**
- * Determine if this element matches specified local name in the analyzer config namespace.
- */
- private boolean isElement(
- Element element,
- String namespace,
- String localName)
- {
- return XMLUtils.isElement(element, namespace, localName);
- }
-
- /**
- * Get element text as an int.
- */
- private int getIntValue(Element element) throws WSIException
- {
- int returnValue;
- String intValue = null;
-
- // Get value as a string
- if ((intValue = XMLUtils.getText(element)) == null)
- {
- throw new WSIException(
- getMessage(
- "config04",
- element.getLocalName() + "Element must contain an integer value:"));
- }
-
- else
- {
- returnValue = Integer.valueOf(intValue).intValue();
- }
-
- // Return int
- return returnValue;
- }
-
- /**
- * Get message from resource bundle.
- */
- private String getMessage(String messageID, String defaultMessage)
- {
- return getMessage(messageID, null, defaultMessage);
- }
-
- /**
- * Get message from resource bundle.
- */
- private String getMessage(
- String messageID,
- String messageData,
- String defaultMessage)
- {
- String message = defaultMessage;
- if (messageList != null)
- message = messageList.getMessage(messageID, messageData, defaultMessage);
- else
- message += " " + messageData + ".";
-
- return message;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/RedirectImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/RedirectImpl.java
deleted file mode 100644
index a1d169ca2..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/monitor/config/impl/RedirectImpl.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.monitor.config.impl;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.monitor.config.Comment;
-import org.eclipse.wst.wsi.internal.core.monitor.config.Redirect;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-
-/**
- * The implementation for monitor config Redirect element.
- *
- * @version 1.0.1
- * @author Peter Brittenham (peterbr@us.ibm.com)
- */
-public class RedirectImpl implements Redirect
-{
- /**
- * Comment.
- */
- protected Comment comment;
-
- /**
- * Listen port.
- */
- protected int listenPort;
-
- /**
- * Host.
- */
- protected String host;
-
- /**
- * To protocol.
- */
- protected String toProtocol;
-
- /**
- * To port.
- */
- protected int toPort;
-
- /**
- * To host.
- */
- protected String toHost;
-
- /**
- * Maximum connections.
- */
- protected int maxConnections;
-
- /**
- * Read timeout seconds.
- */
- protected int readTimeoutSeconds;
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#getComment()
- */
- public Comment getComment()
- {
- return this.comment;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#setComment(comment)
- */
- public void setComment(Comment comment)
- {
- this.comment = comment;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#getListenPort()
- */
- public int getListenPort()
- {
- return this.listenPort;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#setListenPort(int)
- */
- public void setListenPort(int listenPort)
- {
- this.listenPort = listenPort;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#getHost()
- */
- public String getHost()
- {
- return this.host;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#setHost(String)
- */
- public void setHost(String host)
- {
- this.host = host;
-
- // Parse location to get protocol, host and port
- URL url;
- try
- {
- url = new URL(host);
- this.toProtocol = url.getProtocol();
- this.toHost = url.getHost();
- this.toPort = url.getPort();
- if (this.toPort == -1)
- {
- if (this.toProtocol.equalsIgnoreCase("http"))
- this.toPort = 80;
- else
- this.toPort = 80;
- }
- }
-
- catch (MalformedURLException mue)
- {
- throw new IllegalArgumentException(
- "The "
- + WSIConstants.ELEM_SCHEME_AND_HOSTPORT
- + " option contains an invalid value: "
- + host);
- }
-
- if ((url.getPath() != null && !url.getPath().equals(""))
- || (url.getQuery() != null && !url.getQuery().equals("")))
- throw new IllegalArgumentException(
- "The "
- + WSIConstants.ELEM_SCHEME_AND_HOSTPORT
- + " option must contain only a scheme, host and port: "
- + host);
- }
-
- /**
- * Get to port.
- * @see org.eclipse.wst.wsi.monitor.config.Redirect#getToPort()
- */
- public int getToPort()
- {
- return this.toPort;
- }
-
- /**
- * Get to host.
- * @see org.eclipse.wst.wsi.monitor.config.Redirect#getToHost()
- */
- public String getToHost()
- {
- return this.toHost;
- }
-
- /**
- * Get to protocol.
- * @see org.eclipse.wst.wsi.monitor.config.Redirect#getToProtocol()
- */
- public String getToProtocol()
- {
- return this.toProtocol;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#getMaxConnections()
- */
- public int getMaxConnections()
- {
- return this.maxConnections;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#setMaxConnections(int)
- */
- public void setMaxConnections(int maxConnections)
- {
- this.maxConnections = maxConnections;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#getReadTimeoutSeconds()
- */
- public int getReadTimeoutSeconds()
- {
- return this.readTimeoutSeconds;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.monitor.config.Redirect#setReadTimeoutSeconds(int)
- */
- public void setReadTimeoutSeconds(int readTimeoutSeconds)
- {
- this.readTimeoutSeconds = readTimeoutSeconds;
- }
-
- /**
- * Get string representation of this object.
- */
- public String toString()
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- pw.println(" comment ................... " + this.comment);
- pw.println(" listenPort ................ " + this.listenPort);
- pw.println(" host ...................... " + cutHost(this.host));
- pw.println(" maxConnections ............ " + this.maxConnections);
- pw.println(" readTimeoutSeconds ........ " + this.readTimeoutSeconds);
-
- return sw.toString();
- }
-
- /**
- * Formats host name according to the specification (path is ommited).
- * @param host
- * @return
- */
- private String cutHost(String host)
- {
- try
- {
- URL url = new URL(host);
- String port = url.getPort() > -1 ? String.valueOf(url.getPort()) : "80";
- // REMOVED: This code only works on 1.4
- // String.valueOf(url.getDefaultPort());
- return url.getProtocol() + "://" + url.getHost() + ":" + port;
- }
- catch (Exception e)
- {
- return host;
- }
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.document.DocumentElement#toXMLString(String)
- */
- public String toXMLString(String namespaceName)
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- String nsName = namespaceName;
- if ((!nsName.equals("") && (!nsName.endsWith(":"))))
- nsName += ":";
-
- // Start element
- pw.println(" <" + nsName + WSIConstants.ELEM_REDIRECT + ">");
-
- // Comment
- if (this.comment != null)
- {
- pw.println(this.comment.toXMLString(nsName));
- }
-
- // listenPort
- pw.print(" <" + nsName + WSIConstants.ELEM_LISTEN_PORT + ">");
- pw.print(getListenPort());
- pw.println("</" + nsName + WSIConstants.ELEM_LISTEN_PORT + ">");
-
- // schemeAndHostPort
- pw.print(
- " <" + nsName + WSIConstants.ELEM_SCHEME_AND_HOSTPORT + ">");
- pw.print(XMLUtils.xmlEscapedString(getHost()));
- pw.println("</" + nsName + WSIConstants.ELEM_SCHEME_AND_HOSTPORT + ">");
-
- // maxConnections
- pw.print(" <" + nsName + WSIConstants.ELEM_MAX_CONNECTIONS + ">");
- pw.print(getMaxConnections());
- pw.println("</" + nsName + WSIConstants.ELEM_MAX_CONNECTIONS + ">");
-
- // readTimeoutSeconds
- pw.print(
- " <" + nsName + WSIConstants.ELEM_READ_TIMEOUT_SECONDS + ">");
- pw.print(getReadTimeoutSeconds());
- pw.println("</" + nsName + WSIConstants.ELEM_READ_TIMEOUT_SECONDS + ">");
-
- // End Element
- pw.println(" </" + nsName + WSIConstants.ELEM_REDIRECT + ">");
-
- return sw.toString();
- }
-
-}

Back to the top