You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/08/12 17:23:08 UTC
svn commit: r232310 [62/92] - in /beehive/trunk/controls/test: common/
infra/gtlf/ infra/gtlf/xsl/ infra/mantis/ infra/tch/ infra/tch/messages/
infra/tch/runtime/ infra/tch/schema/ perf/ perf/bin/ perf/cases/
perf/ctlsrc/org/apache/beehive/controls/per...
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskException.java Fri Aug 12 08:12:28 2005
@@ -1,22 +1,22 @@
-package org.apache.beehive.test.tools.tch.core.remote;
-
-import org.apache.beehive.test.tools.tch.util.NestedException;
-
-public class UnknownExecTaskException
- extends NestedException
-{
- public UnknownExecTaskException(String message)
- {
- super(message);
- }
-
- public UnknownExecTaskException(Exception ex)
- {
- super(ex);
- }
-
- public UnknownExecTaskException(Exception ex, String message)
- {
- super(ex, message);
- }
-}
+package org.apache.beehive.test.tools.tch.core.remote;
+
+import org.apache.beehive.test.tools.tch.util.NestedException;
+
+public class UnknownExecTaskException
+ extends NestedException
+{
+ public UnknownExecTaskException(String message)
+ {
+ super(message);
+ }
+
+ public UnknownExecTaskException(Exception ex)
+ {
+ super(ex);
+ }
+
+ public UnknownExecTaskException(Exception ex, String message)
+ {
+ super(ex, message);
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskRuntimeException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskRuntimeException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskRuntimeException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskRuntimeException.java Fri Aug 12 08:12:28 2005
@@ -1,22 +1,22 @@
-package org.apache.beehive.test.tools.tch.core.remote;
-
-import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
-
-public class UnknownExecTaskRuntimeException
- extends NestedRuntimeException
-{
- public UnknownExecTaskRuntimeException(String message)
- {
- super(message);
- }
-
- public UnknownExecTaskRuntimeException(Exception ex)
- {
- super(ex);
- }
-
- public UnknownExecTaskRuntimeException(Exception ex, String message)
- {
- super(ex, message);
- }
-}
+package org.apache.beehive.test.tools.tch.core.remote;
+
+import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
+
+public class UnknownExecTaskRuntimeException
+ extends NestedRuntimeException
+{
+ public UnknownExecTaskRuntimeException(String message)
+ {
+ super(message);
+ }
+
+ public UnknownExecTaskRuntimeException(Exception ex)
+ {
+ super(ex);
+ }
+
+ public UnknownExecTaskRuntimeException(Exception ex, String message)
+ {
+ super(ex, message);
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/UnknownExecTaskRuntimeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/RemoteVMTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/RemoteVMTest.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/RemoteVMTest.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/RemoteVMTest.java Fri Aug 12 08:12:28 2005
@@ -1,31 +1,31 @@
-package org.apache.beehive.test.tools.tch.core.remote.test;
-
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-
-import org.apache.beehive.test.tools.tch.core.remote.RemoteTaskRunnerImpl;
-
-public class RemoteVMTest
-{
- private static final String
- BIND_NAME = "TaskRunnerContainer",
- BIND_HOST = "ecker";
- private static final int
- BIND_PORT = 1234;
-
-
- // testing
- public static void main(String[] inArgs)
- throws Exception
- {
- org.apache.beehive.test.tools.tch.util.DebugLogger.log("I am something like a remote listener");
- Registry reg = LocateRegistry.createRegistry(BIND_PORT);
- reg.rebind(BIND_NAME, new RemoteTaskRunnerImpl());
- org.apache.beehive.test.tools.tch.util.DebugLogger.log("Bound RemoteTaskRunner, to lookup, use url: " +
- "rmi://" + BIND_HOST + ":" + BIND_PORT + "/" +
- BIND_NAME + "\n");
- }
-}
-
-
-
+package org.apache.beehive.test.tools.tch.core.remote.test;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+import org.apache.beehive.test.tools.tch.core.remote.RemoteTaskRunnerImpl;
+
+public class RemoteVMTest
+{
+ private static final String
+ BIND_NAME = "TaskRunnerContainer",
+ BIND_HOST = "ecker";
+ private static final int
+ BIND_PORT = 1234;
+
+
+ // testing
+ public static void main(String[] inArgs)
+ throws Exception
+ {
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log("I am something like a remote listener");
+ Registry reg = LocateRegistry.createRegistry(BIND_PORT);
+ reg.rebind(BIND_NAME, new RemoteTaskRunnerImpl());
+ org.apache.beehive.test.tools.tch.util.DebugLogger.log("Bound RemoteTaskRunner, to lookup, use url: " +
+ "rmi://" + BIND_HOST + ":" + BIND_PORT + "/" +
+ BIND_NAME + "\n");
+ }
+}
+
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/RemoteVMTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/SendCmd.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/SendCmd.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/SendCmd.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/SendCmd.java Fri Aug 12 08:12:28 2005
@@ -1,35 +1,35 @@
-package org.apache.beehive.test.tools.tch.core.remote.test;
-
-import java.rmi.Naming;
-
-import org.apache.beehive.test.tools.tch.core.remote.ExecTask;
-import org.apache.beehive.test.tools.tch.core.remote.RemoteExecTaskRunner;
-import org.apache.beehive.test.tools.tch.util.TchUtils;
-
-public class SendCmd
-{
- private static final String URL = "rmi://ecker:6666/RemoteListener";
-
- // testing
- public static void main(String[] inArgs)
- throws Exception
- {
- System.out.println("");
- ExecTask execTask =
- new ExecTask("foo-process",
- "java org.apache.beehive.test.tools.tch.core.remote.test.HangingProcess",
- false);
- ExecTask execTask2 =
- new ExecTask("foo-process2",
- "java org.apache.beehive.test.tools.tch.core.remote.test.HangingProcess",
- false);
- RemoteExecTaskRunner runner = (RemoteExecTaskRunner)Naming.lookup(URL);
- TchUtils.log("Going to run ExecTask: " + execTask.toString());
- System.out.println("");
- runner.runExecTask(execTask);
- runner.runExecTask(execTask2);
- }
-}
-
-
-
+package org.apache.beehive.test.tools.tch.core.remote.test;
+
+import java.rmi.Naming;
+
+import org.apache.beehive.test.tools.tch.core.remote.ExecTask;
+import org.apache.beehive.test.tools.tch.core.remote.RemoteExecTaskRunner;
+import org.apache.beehive.test.tools.tch.util.TchUtils;
+
+public class SendCmd
+{
+ private static final String URL = "rmi://ecker:6666/RemoteListener";
+
+ // testing
+ public static void main(String[] inArgs)
+ throws Exception
+ {
+ System.out.println("");
+ ExecTask execTask =
+ new ExecTask("foo-process",
+ "java org.apache.beehive.test.tools.tch.core.remote.test.HangingProcess",
+ false);
+ ExecTask execTask2 =
+ new ExecTask("foo-process2",
+ "java org.apache.beehive.test.tools.tch.core.remote.test.HangingProcess",
+ false);
+ RemoteExecTaskRunner runner = (RemoteExecTaskRunner)Naming.lookup(URL);
+ TchUtils.log("Going to run ExecTask: " + execTask.toString());
+ System.out.println("");
+ runner.runExecTask(execTask);
+ runner.runExecTask(execTask2);
+ }
+}
+
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/SendCmd.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/StreamWriteTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/StreamWriteTest.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/StreamWriteTest.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/StreamWriteTest.java Fri Aug 12 08:12:28 2005
@@ -1,24 +1,24 @@
-package org.apache.beehive.test.tools.tch.core.remote.test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- */
-public class StreamWriteTest
-{
- public static void main(String[] args) throws Exception
- {
- System.out.println("1");
- System.err.println("2");
- System.out.println("3");
- System.err.println("4");
- System.out.println("5");
- System.err.println("6");
- Map m = new HashMap();
- for (int i = 0; i< 1000; i++)
- {
- m.put(new StringBuffer(1000), new StringBuffer(1000));
- }
- }
-}
+package org.apache.beehive.test.tools.tch.core.remote.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ */
+public class StreamWriteTest
+{
+ public static void main(String[] args) throws Exception
+ {
+ System.out.println("1");
+ System.err.println("2");
+ System.out.println("3");
+ System.err.println("4");
+ System.out.println("5");
+ System.err.println("6");
+ Map m = new HashMap();
+ for (int i = 0; i< 1000; i++)
+ {
+ m.put(new StringBuffer(1000), new StringBuffer(1000));
+ }
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/remote/test/StreamWriteTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/AbstractPropertyHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/AbstractPropertyHandler.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/AbstractPropertyHandler.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/AbstractPropertyHandler.java Fri Aug 12 08:12:28 2005
@@ -1,62 +1,62 @@
-package org.apache.beehive.test.tools.tch.core.stl;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.w3c.dom.Node;
-
-import org.apache.beehive.test.tools.tch.core.PropertyNames;
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.util.ValueHandler;
-import org.apache.beehive.test.tools.tch.util.xml.NamedNodeTypeRegistry;
-
-abstract class AbstractPropertyHandler
-{
- private File processConfigFile = null;
- private NamedNodeTypeRegistry nodeReg = NamedNodeTypeRegistry.getInstance();
- private ValueHandler valueHandler = null;
-
- public AbstractPropertyHandler(Map inProperties)
- {
- valueHandler = new ValueHandler(inProperties);
- }
-
- String handleValue(String inValue, Node sourceNode)
- throws NonfatalValidationException
- {
- String value = valueHandler.handleValue(inValue);
- handleUnresolvedProperties(sourceNode);
- return value;
- }
-
- protected void handleUnresolvedProperties(Node sourceNode)
- throws NonfatalValidationException
- {
- if (valueHandler.hasUnresolvedProps())
- {
- for (Iterator iter = valueHandler.getUnresolvedPropsAndClear().iterator();
- iter.hasNext();
- )
- {
- NonfatalValidationException ex =
- ProcessConfigValidationManager.getCannotResolvePropException(
- (String)iter.next(),
- getNodeReg().getSource(sourceNode));
- ex.fillInStackTrace();
- throw ex;
- }
- }
- }
-
- protected ValueHandler getValueHandler()
- {
- return valueHandler;
- }
-
- protected NamedNodeTypeRegistry getNodeReg()
- {
- return nodeReg;
- }
-}
+package org.apache.beehive.test.tools.tch.core.stl;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.w3c.dom.Node;
+
+import org.apache.beehive.test.tools.tch.core.PropertyNames;
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.util.ValueHandler;
+import org.apache.beehive.test.tools.tch.util.xml.NamedNodeTypeRegistry;
+
+abstract class AbstractPropertyHandler
+{
+ private File processConfigFile = null;
+ private NamedNodeTypeRegistry nodeReg = NamedNodeTypeRegistry.getInstance();
+ private ValueHandler valueHandler = null;
+
+ public AbstractPropertyHandler(Map inProperties)
+ {
+ valueHandler = new ValueHandler(inProperties);
+ }
+
+ String handleValue(String inValue, Node sourceNode)
+ throws NonfatalValidationException
+ {
+ String value = valueHandler.handleValue(inValue);
+ handleUnresolvedProperties(sourceNode);
+ return value;
+ }
+
+ protected void handleUnresolvedProperties(Node sourceNode)
+ throws NonfatalValidationException
+ {
+ if (valueHandler.hasUnresolvedProps())
+ {
+ for (Iterator iter = valueHandler.getUnresolvedPropsAndClear().iterator();
+ iter.hasNext();
+ )
+ {
+ NonfatalValidationException ex =
+ ProcessConfigValidationManager.getCannotResolvePropException(
+ (String)iter.next(),
+ getNodeReg().getSource(sourceNode));
+ ex.fillInStackTrace();
+ throw ex;
+ }
+ }
+ }
+
+ protected ValueHandler getValueHandler()
+ {
+ return valueHandler;
+ }
+
+ protected NamedNodeTypeRegistry getNodeReg()
+ {
+ return nodeReg;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/AbstractPropertyHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ErrorMessageConstants.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ErrorMessageConstants.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ErrorMessageConstants.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ErrorMessageConstants.java Fri Aug 12 08:12:28 2005
@@ -1,34 +1,34 @@
-package org.apache.beehive.test.tools.tch.core.stl;
-
-interface ErrorMessageConstants
-{
- static final int REFERENCED_NAMED_TYPE_NOT_FOUND = 340;
- static final String REF_TYPE = "reftype",
- REF_NAME = "refname",
- NAME = "name",
- TYPE = "type",
- DUMP = "dump";
-
- static final int CIRCULAR_INHERITANCE = 341;
- static final String INHERITANCE_PATH = "inheritance-path";
-
- static final int MISSING_CONFIGURATION = 342;
-
- static final int CANNOT_RESOLVE_PROP = 343;
- static final String PROP_NANE = "propname",
- PROCESS_CONFIG_FILE = "process-config-file",
- PREFIX = "prefix";
-
- static final int MORE_THAN_ONE_IMPLICIT_PROCESS_ERROR = 345;
-
- static final int UNKNOWN_NESTED_PROCESS_ERROR = 346;
- static final String NESTED_PROCESS_NAME = "nested-process-name",
- PROCESS_NAME = "process-name";
-
- static final int DUP_ELEMENT_ERROR = 347;
- static final String DUP_ELEMENT_NAME = "dup-element-name";
-
- static final int VALIDATION_ERROR = 350;
- static final String FILE = "file", ERROR_MESSAGE = "error-message";
-
-}
+package org.apache.beehive.test.tools.tch.core.stl;
+
+interface ErrorMessageConstants
+{
+ static final int REFERENCED_NAMED_TYPE_NOT_FOUND = 340;
+ static final String REF_TYPE = "reftype",
+ REF_NAME = "refname",
+ NAME = "name",
+ TYPE = "type",
+ DUMP = "dump";
+
+ static final int CIRCULAR_INHERITANCE = 341;
+ static final String INHERITANCE_PATH = "inheritance-path";
+
+ static final int MISSING_CONFIGURATION = 342;
+
+ static final int CANNOT_RESOLVE_PROP = 343;
+ static final String PROP_NANE = "propname",
+ PROCESS_CONFIG_FILE = "process-config-file",
+ PREFIX = "prefix";
+
+ static final int MORE_THAN_ONE_IMPLICIT_PROCESS_ERROR = 345;
+
+ static final int UNKNOWN_NESTED_PROCESS_ERROR = 346;
+ static final String NESTED_PROCESS_NAME = "nested-process-name",
+ PROCESS_NAME = "process-name";
+
+ static final int DUP_ELEMENT_ERROR = 347;
+ static final String DUP_ELEMENT_NAME = "dup-element-name";
+
+ static final int VALIDATION_ERROR = 350;
+ static final String FILE = "file", ERROR_MESSAGE = "error-message";
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ErrorMessageConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigBuilder.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigBuilder.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigBuilder.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigBuilder.java Fri Aug 12 08:12:28 2005
@@ -1,591 +1,591 @@
-package org.apache.beehive.test.tools.tch.core.stl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-import org.apache.beehive.test.tools.tch.core.configuration.ElementConstants;
-import org.apache.beehive.test.tools.tch.core.configuration.InvalidationManager;
-import org.apache.beehive.test.tools.tch.core.configuration.MinimalConfigurationInfo;
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.core.configuration.ProcessManagementConfigurationRuntimeException;
-import org.apache.beehive.test.tools.tch.core.configuration.ProcessManagementValidationException;
-import org.apache.beehive.test.tools.tch.core.configuration.XMLHandler;
-import org.apache.beehive.test.tools.tch.core.process.ConfiguredProcessType;
-import org.apache.beehive.test.tools.tch.core.process.Env;
-import org.apache.beehive.test.tools.tch.core.process.Machine;
-import org.apache.beehive.test.tools.tch.core.process.Process;
-import org.apache.beehive.test.tools.tch.core.process.ProcessHandler;
-import org.apache.beehive.test.tools.tch.core.process.ProcessObjectRegistry;
-import org.apache.beehive.test.tools.tch.core.process.ProcessRegistry;
-import org.apache.beehive.test.tools.tch.core.process.ProcessType;
-import org.apache.beehive.test.tools.tch.util.xml.*;
-import org.apache.beehive.test.tools.tch.util.xml.CircularInheritanceException;
-import org.apache.beehive.test.tools.tch.util.xml.DomUtils;
-import org.apache.beehive.test.tools.tch.util.xml.NamedNodeTypeRegistry;
-import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundException;
-import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundExceptionContainer;
-
-/**
- * */
-class ProcessConfigBuilder extends AbstractPropertyHandler
-{
- private ProcessRegistry processRegistry = ProcessRegistry.getRegistry();
-
- private ProcessConfigValidationManager globalInvalidationManager = null;
-
- public ProcessConfigBuilder(
- ProcessConfigValidationManager inValMgr,
- Map inProperties)
- {
- super(inProperties);
- globalInvalidationManager = inValMgr;
- }
-
- public void build()
- {
- // find all processes, go from there
- Collection processes = null;
- try
- {
- processes = getNodeReg().getNodesByType(ProcessConfigNames.PROCESS_NAME);
- }
- catch (ParentNotFoundExceptionContainer ex)
- {
- // ok to use global here, prop references are not allowed for inheritance references
- globalInvalidationManager.addInvalidations(ex);
- return;
- }
- catch (CircularInheritanceException ex)
- {
- // ok to use global here, prop references are not allowed for inheritance references
-
- // might want to fix this, here we don't aggregate the exceptions, but give up
- // when we first encouter a CircularInheritanceException
- globalInvalidationManager.addInvalidation(ex);
- return;
- }
-
- Collection processObjects = new ArrayList();
- for (Iterator iter = processes.iterator(); iter.hasNext();)
- {
- Node processNode = (Node)iter.next();
- Process process = null;
- try
- {
- resolveProps(processNode);
- process = buildProcessObject(processNode);
- }
- catch (NonfatalValidationException ex)
- {
- // here don't use the global one
- InvalidationManager invalMan = new InvalidationManager();
- invalMan.addLocalInvalidation(ex);
- // create dummy process, mark as implicit if original one has implicit set
- String processName =
- DomUtils.getAttributeValue(processNode, ProcessConfigNames.NAME_NAME);
- String s =
- DomUtils.getAttributeValue(
- processNode,
- ElementConstants.PROCESS_IMPLICIT_ATTR,
- "false");
- process = new Process(processName, new Boolean(s), invalMan);
- }
- finally
- {
- processObjects.add(process);
- }
- }
-
- try
- {
- if (processObjects.size() == 1)
- {
- registerProcess((Process)processObjects.iterator().next(), true);
- }
- else
- {
- for (Iterator iter = processObjects.iterator(); iter.hasNext();)
- {
- registerProcess((Process)iter.next(), false);
- }
- }
- }
- catch (NonfatalValidationException ex)
- {
- // have to use global one to deal with "more-than-one-implicit-process" error
- globalInvalidationManager.addInvalidation(ex);
- }
- addNestedProcessHandlers();
- }
-
- private void resolveProps(Node in) throws NonfatalValidationException
- {
- DynamicPropNodeVisitor visitor =
- new DynamicPropNodeVisitor(getValueHandler());
- DomUtils.visitDom(in, visitor);
- handleUnresolvedProperties(in);
- }
-
- private void registerProcess(Process process, boolean makeImplicit)
- throws NonfatalValidationException
- {
- if (process.isMarkedAsImplicit() || makeImplicit)
- {
- // check we don't have an implicit process already
- if (processRegistry.getImplicitProcessEntry() == null)
- {
- processRegistry.setImplicitProcessEntry(process);
- }
- else
- {
- throw new NonfatalValidationException(
- ErrorMessageConstants.MORE_THAN_ONE_IMPLICIT_PROCESS_ERROR);
- }
- }
- else
- {
- processRegistry.addProcessEntry(process, process.getConfiguredProcess());
- }
- }
-
- private void addNestedProcessHandlers()
- {
- for (Iterator iter = processRegistry.getEntryIterator(); iter.hasNext();)
- {
- ProcessRegistry.Entry entry = (ProcessRegistry.Entry)iter.next();
- Process process = entry.getProcess();
- for (Iterator namesIter = process.getNestedProcessNames().iterator();
- namesIter.hasNext();
- )
- {
- String nestedProcessName = (String)namesIter.next();
- try
- {
- ProcessHandler nestedProcessHandler =
- processRegistry
- .getProcessEntry(nestedProcessName)
- .getProcessHandler();
- process.addNestedProcessHandler(nestedProcessHandler);
- }
- catch (NonfatalValidationException ex)
- {
- process.getInvalidationManager().addLocalInvalidation(
- ErrorMessageConstants.UNKNOWN_NESTED_PROCESS_ERROR,
- new String[] {
- ErrorMessageConstants.NESTED_PROCESS_NAME,
- nestedProcessName,
- ErrorMessageConstants.PROCESS_NAME,
- process.getName()});
- }
- }
- }
- }
-
- private Process buildProcessObject(Node processNode)
- throws NonfatalValidationException
- {
- Node configuredProcessTypeNode = getConfiguredProcessTypeNode(processNode);
- Node processTypeNode = getProcessTypeNode(configuredProcessTypeNode);
- String processConfigurationType =
- DomUtils.getAttributeValue(
- processTypeNode,
- ProcessConfigNames.ROOT_CONFIG_TAGNAME);
-
- //System.out.println("Process-config type " + processConfigurationType);
- //System.out.println("Looking at ");
- //DomUtils.writeDom(configuredProcessTypeNode);
-
- Node processConfiguration =
- getReferencedNode(
- configuredProcessTypeNode,
- ProcessConfigNames.CONFIGURATION_NAME,
- processConfigurationType);
-
- //System.out.println("<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>");
- //System.out.println("Process");
- //DomUtils.writeDom(processNode);
- //System.out.println("Machine");
- //DomUtils.writeDom(machineNode);
- //System.out.println("conf-proc-type");
- //DomUtils.writeDom(configuredProcessTypeNode);
- //System.out.println("proc-type");
- //DomUtils.writeDom(processTypeNode);
- //System.out.println("proc-conf");
- //DomUtils.writeDom(processConfiguration);
-
- MinimalConfigurationInfo minimalConfigInfo =
- buildMinConfInfoObject(processConfiguration, processTypeNode);
- ConfiguredProcessType confProcType =
- buildConfProcTypeObject(
- processTypeNode,
- configuredProcessTypeNode,
- minimalConfigInfo);
-
- Node machineNode = getMachineNode(processNode);
- Machine machine = getMachineObject(machineNode);
-
- Process process = new Process(confProcType, machine, processNode);
-
- //System.out.println(
- // "=================== Process Object: " + process.getName());
- //System.out.println(process.dump());
- //System.out.println("===================================");
-
- return process;
- }
-
- private ConfiguredProcessType buildConfProcTypeObject(
- Node processTypeNode,
- Node confProcTypeNode,
- MinimalConfigurationInfo minConfInf)
- throws NonfatalValidationException
- {
- String name = DomUtils.getNameAttributeValue(confProcTypeNode);
- ProcessType processType = getProcessTypeObject(processTypeNode);
- // just create empty env, since we don't ever really use it
- Env env = new Env("default");
- ConfiguredProcessType configProcType =
- new ConfiguredProcessType(name, processType, env, minConfInf);
- return configProcType;
- }
-
- private MinimalConfigurationInfo buildMinConfInfoObject(
- Node processConfigurationNode,
- Node processTypeNode)
- throws NonfatalValidationException
- {
- ProcessType processType = getProcessTypeObject(processTypeNode);
- XMLHandler XMLHandler = processType.getXMLHandler();
- // why the XMLHandler takes a Document, not a Node???
- Document confDocument = null;
- try
- {
- confDocument = DomUtils.instantiateDom();
- }
- catch (ParserConfigurationException ex)
- {
- throw new ProcessManagementConfigurationRuntimeException(ex);
- }
- try
- {
- // substitute any prop references, later this should move into the respective
- // MinInfo class so it can be controlled dynamically at run time
- resolveProps(processConfigurationNode);
- Node importedNode =
- confDocument.importNode(processConfigurationNode, true);
- confDocument.appendChild(importedNode);
-
- return XMLHandler.getMinimalConfigurationInfo(confDocument);
- }
- catch (ProcessManagementValidationException ex)
- {
- // FIXME - make validation error
- throw new ProcessManagementConfigurationRuntimeException(ex);
- }
- }
-
- private ProcessType getProcessTypeObject(Node processTypeNode)
- throws NonfatalValidationException
- {
- // check if we have this process type in registry, else
- // build a new one and register it
- String name = DomUtils.getNameAttributeValue(processTypeNode);
- ProcessType processType = null;
- if (getProcessObjectReg().hasProcessTypeEntry(name))
- {
- processType = getProcessObjectReg().getProcessTypeEntry(name);
- }
- else
- {
- processType = new ProcessType(processTypeNode);
- getProcessObjectReg().registerProcessType(name, processType);
- }
- return processType;
- }
-
- private Machine getMachineObject(Node machineNode)
- {
- // check if we have this machine in registry, else
- // build a new one and register it
-
- String machineName = null;
- boolean isDefaultMachine = false;
- // if machine node is null, default to "localhost", and mark
- // that machine as "default"
- if (machineNode == null)
- {
- machineName = ProcessConfigNames.DEFAULT_MACHINE;
- isDefaultMachine = true;
- }
- else
- machineName = DomUtils.getNameAttributeValue(machineNode);
-
- Machine machine = null;
- if (getProcessObjectReg().hasMachine(machineName))
- machine = getProcessObjectReg().getMachine(machineName);
-
- else
- {
- if (isDefaultMachine)
- machine =
- new Machine(
- machineName,
- ProcessConfigNames.DEFAULT_MACHINE_HOST,
- true);
- else
- machine = new Machine(machineNode);
- getProcessObjectReg().registerMachine(machineName, machine);
- }
- return machine;
- }
-
- private Node getMachineNode(Node processNode)
- throws NonfatalValidationException
- {
- NamedNodeMap attrs = processNode.getAttributes();
- Attr machineAttr =
- (Attr)attrs.getNamedItem(ProcessConfigNames.MACHINE_NAME);
- if (machineAttr != null)
- {
- Node machineNode =
- getReferencedNode(processNode, ProcessConfigNames.MACHINE_NAME);
- resolveProps(machineNode);
- return machineNode;
- }
- return null;
- }
-
- private Node getProcessTypeNode(Node confProcNode)
- throws NonfatalValidationException
- {
- return getReferencedNode(
- confProcNode,
- ProcessConfigNames.PROCESS_TYPE_NAME);
- }
-
- private Node getConfiguredProcessTypeNode(Node processNode)
- throws NonfatalValidationException
- {
- // if this references a configured-process-type node, get that.
- // else look for "configuration" and "process-type" attributes,
- // and build a configured process type from that
- // If "configuration" is set, and "process-type" is not,
- // assume ProcessConfigNames.DEFAULT_PROCESS_TYPE
- // this default should be made configurable.
-
- if (DomUtils
- .getAttributeValue(
- processNode,
- ProcessConfigNames.CONFIGURED_PROCESS_TYPE_NAME)
- != null)
- {
- return getReferencedNode(
- processNode,
- ProcessConfigNames.CONFIGURED_PROCESS_TYPE_NAME);
- }
- else
- {
- String configuration =
- DomUtils.getAttributeValue(
- processNode,
- ProcessConfigNames.CONFIGURATION_NAME);
-
- if (configuration == null)
- {
- StringBuffer XMLDump = new StringBuffer();
- DomUtils.writeDom(processNode, XMLDump);
- throw new NonfatalValidationException(
- ErrorMessageConstants.MISSING_CONFIGURATION,
- ErrorMessageConstants.DUMP,
- XMLDump.toString());
- }
-
- String processType =
- DomUtils.getAttributeValue(
- processNode,
- ProcessConfigNames.PROCESS_TYPE_NAME);
- if (processType == null)
- {
- // FIXME - make configurable somewhere
- processType = ProcessConfigNames.DEFAULT_PROCESS_TYPE;
- }
- return makeConfiguredProcessNode(processNode, processType, configuration);
- }
- }
-
- private Node makeConfiguredProcessNode(
- Node processNode,
- String processType,
- String configuration)
- throws NonfatalValidationException
- {
- // check if we can actually find the process-type, and the configuration
- // else invalidate
- try
- {
- Node processTypeNode =
- getNodeReg().getNode(processType, ProcessConfigNames.PROCESS_TYPE_NAME);
-
- if (processTypeNode == null)
- {
- // validation error
- StringBuffer XMLDump = new StringBuffer();
- DomUtils.writeDom(processNode, XMLDump);
- Map tokens =
- ProcessConfigValidationManager.getTokenMap(
- ProcessConfigNames.PROCESS_TYPE_NAME,
- processType,
- ProcessConfigNames.PROCESS_NAME,
- DomUtils.getNameAttributeValue(processNode),
- XMLDump.toString());
- throw new NonfatalValidationException(
- ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
- tokens);
- }
-
- String configurationProcessType =
- DomUtils.getAttributeValue(
- processTypeNode,
- ProcessConfigNames.ROOT_CONFIG_TAGNAME);
- Node configurationNode =
- getNodeReg().getNode(configuration, configurationProcessType);
-
- if (configurationNode == null)
- {
- // validation error
- StringBuffer XMLDump = new StringBuffer();
- DomUtils.writeDom(processNode, XMLDump);
- Map tokens =
- ProcessConfigValidationManager.getTokenMap(
- configurationProcessType,
- configuration,
- ProcessConfigNames.PROCESS_NAME,
- DomUtils.getNameAttributeValue(processNode),
- XMLDump.toString());
-
- throw new NonfatalValidationException(
- ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
- tokens);
- }
- }
- catch (CircularInheritanceException ex)
- {
- // ignore, we'll handle this one later
- }
- catch (ParentNotFoundException ex)
- {
- // ignore, we'll handle this one later
- }
-
- Document doc = processNode.getOwnerDocument();
- Element confProcTypeNode =
- doc.createElement(ProcessConfigNames.CONFIGURED_PROCESS_TYPE_NAME);
- // name attribute
- // this does not need to be set, but setting it to something
- // meaningful in case we ever pring this node
- Attr nameAttr = doc.createAttribute(ProcessConfigNames.NAME_NAME);
- nameAttr.setNodeValue(
- "[generated node, check "
- + DomUtils.getNameAttributeValue(processNode)
- + " "
- + ProcessConfigNames.PROCESS_NAME
- + " element]");
- confProcTypeNode.setAttributeNode(nameAttr);
-
- // process-type attribute
- Attr processTypeAttr =
- doc.createAttribute(ProcessConfigNames.PROCESS_TYPE_NAME);
- processTypeAttr.setNodeValue(processType);
- confProcTypeNode.setAttributeNode(processTypeAttr);
- // configuration attribute
- Attr confAttr = doc.createAttribute(ProcessConfigNames.CONFIGURATION_NAME);
- confAttr.setNodeValue(configuration);
- confProcTypeNode.setAttributeNode(confAttr);
-
- return confProcTypeNode;
- }
-
- private Node getReferencedNode(Node referenceNode, String nodeType)
- throws NonfatalValidationException
- {
- // assume ref att name is same as node type we're looking for
- return getReferencedNode(referenceNode, nodeType, nodeType);
- }
-
- private Node getReferencedNode(
- Node referenceNode,
- String referenceAttributeName,
- String nodeType)
- throws NonfatalValidationException
- {
- String referencedTypeLogicalName =
- handleValue(
- DomUtils.getAttributeValue(referenceNode, referenceAttributeName),
- referenceNode);
- //System.out.println(
- // "Looking for " + nodeType + " with name " + referencedTypeLogicalName);
-
- Node referencedNode = null;
- if (referencedTypeLogicalName != null)
- {
- try
- {
- referencedNode =
- getNodeReg().getNode(referencedTypeLogicalName, nodeType);
- }
- catch (ParentNotFoundException ex)
- {
- Map tokens = ProcessConfigValidationManager.getTokenMap(ex);
- throw new NonfatalValidationException(
- ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
- tokens);
- }
- catch (CircularInheritanceException ex)
- {
- Map tokens = ProcessConfigValidationManager.getTokenMap(ex);
- throw new NonfatalValidationException(
- ErrorMessageConstants.CIRCULAR_INHERITANCE,
- tokens);
- }
- }
-
- if (referencedNode == null)
- {
- StringBuffer XMLDump = new StringBuffer();
- DomUtils.writeDom(referenceNode, XMLDump);
- Map tokens =
- ProcessConfigValidationManager.getTokenMap(
- nodeType,
- referencedTypeLogicalName,
- referenceNode.getNodeName(),
- DomUtils.getNameAttributeValue(referenceNode),
- XMLDump.toString());
- throw new NonfatalValidationException(
- ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
- tokens);
- }
- else
- {
- //System.out.println("Found " + nodeType);
- //DomUtils.writeDom(referencedNode);
- }
-
- return referencedNode;
- }
-
- private ProcessObjectRegistry getProcessObjectReg()
- {
- return ProcessObjectRegistry.getInstance();
- }
-
-}
+package org.apache.beehive.test.tools.tch.core.stl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import org.apache.beehive.test.tools.tch.core.configuration.ElementConstants;
+import org.apache.beehive.test.tools.tch.core.configuration.InvalidationManager;
+import org.apache.beehive.test.tools.tch.core.configuration.MinimalConfigurationInfo;
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.core.configuration.ProcessManagementConfigurationRuntimeException;
+import org.apache.beehive.test.tools.tch.core.configuration.ProcessManagementValidationException;
+import org.apache.beehive.test.tools.tch.core.configuration.XMLHandler;
+import org.apache.beehive.test.tools.tch.core.process.ConfiguredProcessType;
+import org.apache.beehive.test.tools.tch.core.process.Env;
+import org.apache.beehive.test.tools.tch.core.process.Machine;
+import org.apache.beehive.test.tools.tch.core.process.Process;
+import org.apache.beehive.test.tools.tch.core.process.ProcessHandler;
+import org.apache.beehive.test.tools.tch.core.process.ProcessObjectRegistry;
+import org.apache.beehive.test.tools.tch.core.process.ProcessRegistry;
+import org.apache.beehive.test.tools.tch.core.process.ProcessType;
+import org.apache.beehive.test.tools.tch.util.xml.*;
+import org.apache.beehive.test.tools.tch.util.xml.CircularInheritanceException;
+import org.apache.beehive.test.tools.tch.util.xml.DomUtils;
+import org.apache.beehive.test.tools.tch.util.xml.NamedNodeTypeRegistry;
+import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundException;
+import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundExceptionContainer;
+
+/**
+ * */
+class ProcessConfigBuilder extends AbstractPropertyHandler
+{
+ private ProcessRegistry processRegistry = ProcessRegistry.getRegistry();
+
+ private ProcessConfigValidationManager globalInvalidationManager = null;
+
+ public ProcessConfigBuilder(
+ ProcessConfigValidationManager inValMgr,
+ Map inProperties)
+ {
+ super(inProperties);
+ globalInvalidationManager = inValMgr;
+ }
+
+ public void build()
+ {
+ // find all processes, go from there
+ Collection processes = null;
+ try
+ {
+ processes = getNodeReg().getNodesByType(ProcessConfigNames.PROCESS_NAME);
+ }
+ catch (ParentNotFoundExceptionContainer ex)
+ {
+ // ok to use global here, prop references are not allowed for inheritance references
+ globalInvalidationManager.addInvalidations(ex);
+ return;
+ }
+ catch (CircularInheritanceException ex)
+ {
+ // ok to use global here, prop references are not allowed for inheritance references
+
+ // might want to fix this, here we don't aggregate the exceptions, but give up
+ // when we first encouter a CircularInheritanceException
+ globalInvalidationManager.addInvalidation(ex);
+ return;
+ }
+
+ Collection processObjects = new ArrayList();
+ for (Iterator iter = processes.iterator(); iter.hasNext();)
+ {
+ Node processNode = (Node)iter.next();
+ Process process = null;
+ try
+ {
+ resolveProps(processNode);
+ process = buildProcessObject(processNode);
+ }
+ catch (NonfatalValidationException ex)
+ {
+ // here don't use the global one
+ InvalidationManager invalMan = new InvalidationManager();
+ invalMan.addLocalInvalidation(ex);
+ // create dummy process, mark as implicit if original one has implicit set
+ String processName =
+ DomUtils.getAttributeValue(processNode, ProcessConfigNames.NAME_NAME);
+ String s =
+ DomUtils.getAttributeValue(
+ processNode,
+ ElementConstants.PROCESS_IMPLICIT_ATTR,
+ "false");
+ process = new Process(processName, new Boolean(s), invalMan);
+ }
+ finally
+ {
+ processObjects.add(process);
+ }
+ }
+
+ try
+ {
+ if (processObjects.size() == 1)
+ {
+ registerProcess((Process)processObjects.iterator().next(), true);
+ }
+ else
+ {
+ for (Iterator iter = processObjects.iterator(); iter.hasNext();)
+ {
+ registerProcess((Process)iter.next(), false);
+ }
+ }
+ }
+ catch (NonfatalValidationException ex)
+ {
+ // have to use global one to deal with "more-than-one-implicit-process" error
+ globalInvalidationManager.addInvalidation(ex);
+ }
+ addNestedProcessHandlers();
+ }
+
+ private void resolveProps(Node in) throws NonfatalValidationException
+ {
+ DynamicPropNodeVisitor visitor =
+ new DynamicPropNodeVisitor(getValueHandler());
+ DomUtils.visitDom(in, visitor);
+ handleUnresolvedProperties(in);
+ }
+
+ private void registerProcess(Process process, boolean makeImplicit)
+ throws NonfatalValidationException
+ {
+ if (process.isMarkedAsImplicit() || makeImplicit)
+ {
+ // check we don't have an implicit process already
+ if (processRegistry.getImplicitProcessEntry() == null)
+ {
+ processRegistry.setImplicitProcessEntry(process);
+ }
+ else
+ {
+ throw new NonfatalValidationException(
+ ErrorMessageConstants.MORE_THAN_ONE_IMPLICIT_PROCESS_ERROR);
+ }
+ }
+ else
+ {
+ processRegistry.addProcessEntry(process, process.getConfiguredProcess());
+ }
+ }
+
+ private void addNestedProcessHandlers()
+ {
+ for (Iterator iter = processRegistry.getEntryIterator(); iter.hasNext();)
+ {
+ ProcessRegistry.Entry entry = (ProcessRegistry.Entry)iter.next();
+ Process process = entry.getProcess();
+ for (Iterator namesIter = process.getNestedProcessNames().iterator();
+ namesIter.hasNext();
+ )
+ {
+ String nestedProcessName = (String)namesIter.next();
+ try
+ {
+ ProcessHandler nestedProcessHandler =
+ processRegistry
+ .getProcessEntry(nestedProcessName)
+ .getProcessHandler();
+ process.addNestedProcessHandler(nestedProcessHandler);
+ }
+ catch (NonfatalValidationException ex)
+ {
+ process.getInvalidationManager().addLocalInvalidation(
+ ErrorMessageConstants.UNKNOWN_NESTED_PROCESS_ERROR,
+ new String[] {
+ ErrorMessageConstants.NESTED_PROCESS_NAME,
+ nestedProcessName,
+ ErrorMessageConstants.PROCESS_NAME,
+ process.getName()});
+ }
+ }
+ }
+ }
+
+ private Process buildProcessObject(Node processNode)
+ throws NonfatalValidationException
+ {
+ Node configuredProcessTypeNode = getConfiguredProcessTypeNode(processNode);
+ Node processTypeNode = getProcessTypeNode(configuredProcessTypeNode);
+ String processConfigurationType =
+ DomUtils.getAttributeValue(
+ processTypeNode,
+ ProcessConfigNames.ROOT_CONFIG_TAGNAME);
+
+ //System.out.println("Process-config type " + processConfigurationType);
+ //System.out.println("Looking at ");
+ //DomUtils.writeDom(configuredProcessTypeNode);
+
+ Node processConfiguration =
+ getReferencedNode(
+ configuredProcessTypeNode,
+ ProcessConfigNames.CONFIGURATION_NAME,
+ processConfigurationType);
+
+ //System.out.println("<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>");
+ //System.out.println("Process");
+ //DomUtils.writeDom(processNode);
+ //System.out.println("Machine");
+ //DomUtils.writeDom(machineNode);
+ //System.out.println("conf-proc-type");
+ //DomUtils.writeDom(configuredProcessTypeNode);
+ //System.out.println("proc-type");
+ //DomUtils.writeDom(processTypeNode);
+ //System.out.println("proc-conf");
+ //DomUtils.writeDom(processConfiguration);
+
+ MinimalConfigurationInfo minimalConfigInfo =
+ buildMinConfInfoObject(processConfiguration, processTypeNode);
+ ConfiguredProcessType confProcType =
+ buildConfProcTypeObject(
+ processTypeNode,
+ configuredProcessTypeNode,
+ minimalConfigInfo);
+
+ Node machineNode = getMachineNode(processNode);
+ Machine machine = getMachineObject(machineNode);
+
+ Process process = new Process(confProcType, machine, processNode);
+
+ //System.out.println(
+ // "=================== Process Object: " + process.getName());
+ //System.out.println(process.dump());
+ //System.out.println("===================================");
+
+ return process;
+ }
+
+ private ConfiguredProcessType buildConfProcTypeObject(
+ Node processTypeNode,
+ Node confProcTypeNode,
+ MinimalConfigurationInfo minConfInf)
+ throws NonfatalValidationException
+ {
+ String name = DomUtils.getNameAttributeValue(confProcTypeNode);
+ ProcessType processType = getProcessTypeObject(processTypeNode);
+ // just create empty env, since we don't ever really use it
+ Env env = new Env("default");
+ ConfiguredProcessType configProcType =
+ new ConfiguredProcessType(name, processType, env, minConfInf);
+ return configProcType;
+ }
+
+ private MinimalConfigurationInfo buildMinConfInfoObject(
+ Node processConfigurationNode,
+ Node processTypeNode)
+ throws NonfatalValidationException
+ {
+ ProcessType processType = getProcessTypeObject(processTypeNode);
+ XMLHandler XMLHandler = processType.getXMLHandler();
+ // why the XMLHandler takes a Document, not a Node???
+ Document confDocument = null;
+ try
+ {
+ confDocument = DomUtils.instantiateDom();
+ }
+ catch (ParserConfigurationException ex)
+ {
+ throw new ProcessManagementConfigurationRuntimeException(ex);
+ }
+ try
+ {
+ // substitute any prop references, later this should move into the respective
+ // MinInfo class so it can be controlled dynamically at run time
+ resolveProps(processConfigurationNode);
+ Node importedNode =
+ confDocument.importNode(processConfigurationNode, true);
+ confDocument.appendChild(importedNode);
+
+ return XMLHandler.getMinimalConfigurationInfo(confDocument);
+ }
+ catch (ProcessManagementValidationException ex)
+ {
+ // FIXME - make validation error
+ throw new ProcessManagementConfigurationRuntimeException(ex);
+ }
+ }
+
+ private ProcessType getProcessTypeObject(Node processTypeNode)
+ throws NonfatalValidationException
+ {
+ // check if we have this process type in registry, else
+ // build a new one and register it
+ String name = DomUtils.getNameAttributeValue(processTypeNode);
+ ProcessType processType = null;
+ if (getProcessObjectReg().hasProcessTypeEntry(name))
+ {
+ processType = getProcessObjectReg().getProcessTypeEntry(name);
+ }
+ else
+ {
+ processType = new ProcessType(processTypeNode);
+ getProcessObjectReg().registerProcessType(name, processType);
+ }
+ return processType;
+ }
+
+ private Machine getMachineObject(Node machineNode)
+ {
+ // check if we have this machine in registry, else
+ // build a new one and register it
+
+ String machineName = null;
+ boolean isDefaultMachine = false;
+ // if machine node is null, default to "localhost", and mark
+ // that machine as "default"
+ if (machineNode == null)
+ {
+ machineName = ProcessConfigNames.DEFAULT_MACHINE;
+ isDefaultMachine = true;
+ }
+ else
+ machineName = DomUtils.getNameAttributeValue(machineNode);
+
+ Machine machine = null;
+ if (getProcessObjectReg().hasMachine(machineName))
+ machine = getProcessObjectReg().getMachine(machineName);
+
+ else
+ {
+ if (isDefaultMachine)
+ machine =
+ new Machine(
+ machineName,
+ ProcessConfigNames.DEFAULT_MACHINE_HOST,
+ true);
+ else
+ machine = new Machine(machineNode);
+ getProcessObjectReg().registerMachine(machineName, machine);
+ }
+ return machine;
+ }
+
+ private Node getMachineNode(Node processNode)
+ throws NonfatalValidationException
+ {
+ NamedNodeMap attrs = processNode.getAttributes();
+ Attr machineAttr =
+ (Attr)attrs.getNamedItem(ProcessConfigNames.MACHINE_NAME);
+ if (machineAttr != null)
+ {
+ Node machineNode =
+ getReferencedNode(processNode, ProcessConfigNames.MACHINE_NAME);
+ resolveProps(machineNode);
+ return machineNode;
+ }
+ return null;
+ }
+
+ private Node getProcessTypeNode(Node confProcNode)
+ throws NonfatalValidationException
+ {
+ return getReferencedNode(
+ confProcNode,
+ ProcessConfigNames.PROCESS_TYPE_NAME);
+ }
+
+ private Node getConfiguredProcessTypeNode(Node processNode)
+ throws NonfatalValidationException
+ {
+ // if this references a configured-process-type node, get that.
+ // else look for "configuration" and "process-type" attributes,
+ // and build a configured process type from that
+ // If "configuration" is set, and "process-type" is not,
+ // assume ProcessConfigNames.DEFAULT_PROCESS_TYPE
+ // this default should be made configurable.
+
+ if (DomUtils
+ .getAttributeValue(
+ processNode,
+ ProcessConfigNames.CONFIGURED_PROCESS_TYPE_NAME)
+ != null)
+ {
+ return getReferencedNode(
+ processNode,
+ ProcessConfigNames.CONFIGURED_PROCESS_TYPE_NAME);
+ }
+ else
+ {
+ String configuration =
+ DomUtils.getAttributeValue(
+ processNode,
+ ProcessConfigNames.CONFIGURATION_NAME);
+
+ if (configuration == null)
+ {
+ StringBuffer XMLDump = new StringBuffer();
+ DomUtils.writeDom(processNode, XMLDump);
+ throw new NonfatalValidationException(
+ ErrorMessageConstants.MISSING_CONFIGURATION,
+ ErrorMessageConstants.DUMP,
+ XMLDump.toString());
+ }
+
+ String processType =
+ DomUtils.getAttributeValue(
+ processNode,
+ ProcessConfigNames.PROCESS_TYPE_NAME);
+ if (processType == null)
+ {
+ // FIXME - make configurable somewhere
+ processType = ProcessConfigNames.DEFAULT_PROCESS_TYPE;
+ }
+ return makeConfiguredProcessNode(processNode, processType, configuration);
+ }
+ }
+
+ private Node makeConfiguredProcessNode(
+ Node processNode,
+ String processType,
+ String configuration)
+ throws NonfatalValidationException
+ {
+ // check if we can actually find the process-type, and the configuration
+ // else invalidate
+ try
+ {
+ Node processTypeNode =
+ getNodeReg().getNode(processType, ProcessConfigNames.PROCESS_TYPE_NAME);
+
+ if (processTypeNode == null)
+ {
+ // validation error
+ StringBuffer XMLDump = new StringBuffer();
+ DomUtils.writeDom(processNode, XMLDump);
+ Map tokens =
+ ProcessConfigValidationManager.getTokenMap(
+ ProcessConfigNames.PROCESS_TYPE_NAME,
+ processType,
+ ProcessConfigNames.PROCESS_NAME,
+ DomUtils.getNameAttributeValue(processNode),
+ XMLDump.toString());
+ throw new NonfatalValidationException(
+ ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
+ tokens);
+ }
+
+ String configurationProcessType =
+ DomUtils.getAttributeValue(
+ processTypeNode,
+ ProcessConfigNames.ROOT_CONFIG_TAGNAME);
+ Node configurationNode =
+ getNodeReg().getNode(configuration, configurationProcessType);
+
+ if (configurationNode == null)
+ {
+ // validation error
+ StringBuffer XMLDump = new StringBuffer();
+ DomUtils.writeDom(processNode, XMLDump);
+ Map tokens =
+ ProcessConfigValidationManager.getTokenMap(
+ configurationProcessType,
+ configuration,
+ ProcessConfigNames.PROCESS_NAME,
+ DomUtils.getNameAttributeValue(processNode),
+ XMLDump.toString());
+
+ throw new NonfatalValidationException(
+ ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
+ tokens);
+ }
+ }
+ catch (CircularInheritanceException ex)
+ {
+ // ignore, we'll handle this one later
+ }
+ catch (ParentNotFoundException ex)
+ {
+ // ignore, we'll handle this one later
+ }
+
+ Document doc = processNode.getOwnerDocument();
+ Element confProcTypeNode =
+ doc.createElement(ProcessConfigNames.CONFIGURED_PROCESS_TYPE_NAME);
+ // name attribute
+ // this does not need to be set, but setting it to something
+ // meaningful in case we ever pring this node
+ Attr nameAttr = doc.createAttribute(ProcessConfigNames.NAME_NAME);
+ nameAttr.setNodeValue(
+ "[generated node, check "
+ + DomUtils.getNameAttributeValue(processNode)
+ + " "
+ + ProcessConfigNames.PROCESS_NAME
+ + " element]");
+ confProcTypeNode.setAttributeNode(nameAttr);
+
+ // process-type attribute
+ Attr processTypeAttr =
+ doc.createAttribute(ProcessConfigNames.PROCESS_TYPE_NAME);
+ processTypeAttr.setNodeValue(processType);
+ confProcTypeNode.setAttributeNode(processTypeAttr);
+ // configuration attribute
+ Attr confAttr = doc.createAttribute(ProcessConfigNames.CONFIGURATION_NAME);
+ confAttr.setNodeValue(configuration);
+ confProcTypeNode.setAttributeNode(confAttr);
+
+ return confProcTypeNode;
+ }
+
+ private Node getReferencedNode(Node referenceNode, String nodeType)
+ throws NonfatalValidationException
+ {
+ // assume ref att name is same as node type we're looking for
+ return getReferencedNode(referenceNode, nodeType, nodeType);
+ }
+
+ private Node getReferencedNode(
+ Node referenceNode,
+ String referenceAttributeName,
+ String nodeType)
+ throws NonfatalValidationException
+ {
+ String referencedTypeLogicalName =
+ handleValue(
+ DomUtils.getAttributeValue(referenceNode, referenceAttributeName),
+ referenceNode);
+ //System.out.println(
+ // "Looking for " + nodeType + " with name " + referencedTypeLogicalName);
+
+ Node referencedNode = null;
+ if (referencedTypeLogicalName != null)
+ {
+ try
+ {
+ referencedNode =
+ getNodeReg().getNode(referencedTypeLogicalName, nodeType);
+ }
+ catch (ParentNotFoundException ex)
+ {
+ Map tokens = ProcessConfigValidationManager.getTokenMap(ex);
+ throw new NonfatalValidationException(
+ ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
+ tokens);
+ }
+ catch (CircularInheritanceException ex)
+ {
+ Map tokens = ProcessConfigValidationManager.getTokenMap(ex);
+ throw new NonfatalValidationException(
+ ErrorMessageConstants.CIRCULAR_INHERITANCE,
+ tokens);
+ }
+ }
+
+ if (referencedNode == null)
+ {
+ StringBuffer XMLDump = new StringBuffer();
+ DomUtils.writeDom(referenceNode, XMLDump);
+ Map tokens =
+ ProcessConfigValidationManager.getTokenMap(
+ nodeType,
+ referencedTypeLogicalName,
+ referenceNode.getNodeName(),
+ DomUtils.getNameAttributeValue(referenceNode),
+ XMLDump.toString());
+ throw new NonfatalValidationException(
+ ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
+ tokens);
+ }
+ else
+ {
+ //System.out.println("Found " + nodeType);
+ //DomUtils.writeDom(referencedNode);
+ }
+
+ return referencedNode;
+ }
+
+ private ProcessObjectRegistry getProcessObjectReg()
+ {
+ return ProcessObjectRegistry.getInstance();
+ }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigNames.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigNames.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigNames.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigNames.java Fri Aug 12 08:12:28 2005
@@ -1,36 +1,36 @@
-package org.apache.beehive.test.tools.tch.core.stl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- */
-class ProcessConfigNames
-{
- static final String
- NAME_NAME = "name",
- PROCESS_NAME = "process",
- MACHINE_NAME = "machine",
- DEFAULT_MACHINE = "localhost-default-machine",
- DEFAULT_MACHINE_HOST = "localhost",
- PROCESS_TYPE_NAME = "process-type",
- DEFAULT_PROCESS_TYPE = "wls-process-type",
- CONFIGURED_PROCESS_TYPE_NAME = "configured-process-type",
- ROOT_CONFIG_TAGNAME = "root-config-tagname",
- CONFIGURATION_NAME = "configuration";
-
- private static Collection topLevelEntities = new ArrayList(4);
- static
- {
- topLevelEntities.add(MACHINE_NAME);
- topLevelEntities.add(PROCESS_NAME);
- topLevelEntities.add(PROCESS_TYPE_NAME);
- topLevelEntities.add(CONFIGURED_PROCESS_TYPE_NAME);
- }
-
- static final Collection getXMLListOfTopLevelEntities()
- {
- return Collections.unmodifiableCollection(topLevelEntities);
- }
-}
+package org.apache.beehive.test.tools.tch.core.stl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ */
+class ProcessConfigNames
+{
+ static final String
+ NAME_NAME = "name",
+ PROCESS_NAME = "process",
+ MACHINE_NAME = "machine",
+ DEFAULT_MACHINE = "localhost-default-machine",
+ DEFAULT_MACHINE_HOST = "localhost",
+ PROCESS_TYPE_NAME = "process-type",
+ DEFAULT_PROCESS_TYPE = "wls-process-type",
+ CONFIGURED_PROCESS_TYPE_NAME = "configured-process-type",
+ ROOT_CONFIG_TAGNAME = "root-config-tagname",
+ CONFIGURATION_NAME = "configuration";
+
+ private static Collection topLevelEntities = new ArrayList(4);
+ static
+ {
+ topLevelEntities.add(MACHINE_NAME);
+ topLevelEntities.add(PROCESS_NAME);
+ topLevelEntities.add(PROCESS_TYPE_NAME);
+ topLevelEntities.add(CONFIGURED_PROCESS_TYPE_NAME);
+ }
+
+ static final Collection getXMLListOfTopLevelEntities()
+ {
+ return Collections.unmodifiableCollection(topLevelEntities);
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigNames.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigValidationManager.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigValidationManager.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigValidationManager.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigValidationManager.java Fri Aug 12 08:12:28 2005
@@ -1,96 +1,96 @@
-package org.apache.beehive.test.tools.tch.core.stl;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.beehive.test.tools.tch.core.PropertyNames;
-import org.apache.beehive.test.tools.tch.core.configuration.InvalidationManager;
-import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
-import org.apache.beehive.test.tools.tch.util.xml.CircularInheritanceException;
-import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundException;
-import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundExceptionContainer;
-
-/**
- * Keeps track of validation errors related to process-config parsing.
- *
- */
-class ProcessConfigValidationManager extends InvalidationManager
-{
- void addInvalidations(ParentNotFoundExceptionContainer ex)
- {
- Collection parentNotFoundExceptions = ex.getParentNotFoundExceptions();
- for (Iterator iter = parentNotFoundExceptions.iterator(); iter.hasNext();)
- {
- addInvalidation((ParentNotFoundException)iter.next());
- }
- }
-
- static NonfatalValidationException getCannotResolvePropException(
- String propName,
- String source)
- {
- Map tokens = new HashMap(3);
- tokens.put(ErrorMessageConstants.PROP_NANE, propName);
- tokens.put(ErrorMessageConstants.PROCESS_CONFIG_FILE, source);
- tokens.put(
- ErrorMessageConstants.PREFIX,
- PropertyNames.TCH_PREFIX
- + PropertyNames.TCH_DYNAMIC_PROCESS_CONFIG);
-
- return new NonfatalValidationException(
- ErrorMessageConstants.CANNOT_RESOLVE_PROP,
- tokens);
- }
-
- void addInvalidation(ParentNotFoundException ex)
- {
- Map tokens = getTokenMap(ex);
- addInvalidation(
- ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
- tokens);
- }
-
- void addInvalidation(CircularInheritanceException ex)
- {
- addInvalidation(
- ErrorMessageConstants.CIRCULAR_INHERITANCE,
- getTokenMap(ex));
- }
-
- static Map getTokenMap(CircularInheritanceException ex)
- {
- Map tokens = new HashMap();
- tokens.put(ErrorMessageConstants.TYPE, ex.getElementType());
- tokens.put(ErrorMessageConstants.INHERITANCE_PATH, ex.getInheritancePath());
- return tokens;
- }
-
- static Map getTokenMap(ParentNotFoundException ex)
- {
- // referencer node type is same as refenced node tpye
- return getTokenMap(
- ex.getReferencerNodeType(),
- ex.getReferencedNodeName(),
- ex.getReferencerNodeType(),
- ex.getReferencerNodeName(),
- ex.getReferencerNodeXMLDump());
- }
-
- static Map getTokenMap(
- String referencedTypeName,
- String referencedLogicalName,
- String referencerType,
- String referencerName,
- String XMLDump)
- {
- Map tokens = new HashMap();
- tokens.put(ErrorMessageConstants.REF_NAME, referencedLogicalName);
- tokens.put(ErrorMessageConstants.REF_TYPE, referencedTypeName);
- tokens.put(ErrorMessageConstants.NAME, referencerName);
- tokens.put(ErrorMessageConstants.TYPE, referencerType);
- tokens.put(ErrorMessageConstants.DUMP, XMLDump);
- return tokens;
- }
-}
+package org.apache.beehive.test.tools.tch.core.stl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.beehive.test.tools.tch.core.PropertyNames;
+import org.apache.beehive.test.tools.tch.core.configuration.InvalidationManager;
+import org.apache.beehive.test.tools.tch.core.configuration.NonfatalValidationException;
+import org.apache.beehive.test.tools.tch.util.xml.CircularInheritanceException;
+import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundException;
+import org.apache.beehive.test.tools.tch.util.xml.ParentNotFoundExceptionContainer;
+
+/**
+ * Keeps track of validation errors related to process-config parsing.
+ *
+ */
+class ProcessConfigValidationManager extends InvalidationManager
+{
+ void addInvalidations(ParentNotFoundExceptionContainer ex)
+ {
+ Collection parentNotFoundExceptions = ex.getParentNotFoundExceptions();
+ for (Iterator iter = parentNotFoundExceptions.iterator(); iter.hasNext();)
+ {
+ addInvalidation((ParentNotFoundException)iter.next());
+ }
+ }
+
+ static NonfatalValidationException getCannotResolvePropException(
+ String propName,
+ String source)
+ {
+ Map tokens = new HashMap(3);
+ tokens.put(ErrorMessageConstants.PROP_NANE, propName);
+ tokens.put(ErrorMessageConstants.PROCESS_CONFIG_FILE, source);
+ tokens.put(
+ ErrorMessageConstants.PREFIX,
+ PropertyNames.TCH_PREFIX
+ + PropertyNames.TCH_DYNAMIC_PROCESS_CONFIG);
+
+ return new NonfatalValidationException(
+ ErrorMessageConstants.CANNOT_RESOLVE_PROP,
+ tokens);
+ }
+
+ void addInvalidation(ParentNotFoundException ex)
+ {
+ Map tokens = getTokenMap(ex);
+ addInvalidation(
+ ErrorMessageConstants.REFERENCED_NAMED_TYPE_NOT_FOUND,
+ tokens);
+ }
+
+ void addInvalidation(CircularInheritanceException ex)
+ {
+ addInvalidation(
+ ErrorMessageConstants.CIRCULAR_INHERITANCE,
+ getTokenMap(ex));
+ }
+
+ static Map getTokenMap(CircularInheritanceException ex)
+ {
+ Map tokens = new HashMap();
+ tokens.put(ErrorMessageConstants.TYPE, ex.getElementType());
+ tokens.put(ErrorMessageConstants.INHERITANCE_PATH, ex.getInheritancePath());
+ return tokens;
+ }
+
+ static Map getTokenMap(ParentNotFoundException ex)
+ {
+ // referencer node type is same as refenced node tpye
+ return getTokenMap(
+ ex.getReferencerNodeType(),
+ ex.getReferencedNodeName(),
+ ex.getReferencerNodeType(),
+ ex.getReferencerNodeName(),
+ ex.getReferencerNodeXMLDump());
+ }
+
+ static Map getTokenMap(
+ String referencedTypeName,
+ String referencedLogicalName,
+ String referencerType,
+ String referencerName,
+ String XMLDump)
+ {
+ Map tokens = new HashMap();
+ tokens.put(ErrorMessageConstants.REF_NAME, referencedLogicalName);
+ tokens.put(ErrorMessageConstants.REF_TYPE, referencedTypeName);
+ tokens.put(ErrorMessageConstants.NAME, referencerName);
+ tokens.put(ErrorMessageConstants.TYPE, referencerType);
+ tokens.put(ErrorMessageConstants.DUMP, XMLDump);
+ return tokens;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/core/stl/ProcessConfigValidationManager.java
------------------------------------------------------------------------------
svn:eol-style = native