Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1932 - in development/laboratory/planet/components: processing processing/api processing/api/src processing/api/src/main processing/api/src/main/net processing/api/src/main/net/dpml processing/api/src/main/net/dpml/processing processing/controller processing/controller/src processing/controller/src/main processing/controller/src/main/net processing/controller/src/main/net/dpml processing/controller/src/main/net/dpml/processing processing/controller/src/main/net/dpml/processing/controller protocol/packetapi/src/main/net/dpml/protocol/packet

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1932 - in development/laboratory/planet/components: processing processing/api processing/api/src processing/api/src/main processing/api/src/main/net processing/api/src/main/net/dpml processing/api/src/main/net/dpml/processing processing/controller processing/controller/src processing/controller/src/main processing/controller/src/main/net processing/controller/src/main/net/dpml processing/controller/src/main/net/dpml/processing processing/controller/src/main/net/dpml/processing/controller protocol/packetapi/src/main/net/dpml/protocol/packet
  • Date: Thu, 03 Mar 2005 09:57:18 +0100

Author: niclas
Date: Thu Mar 3 09:57:18 2005
New Revision: 1932

Added:
development/laboratory/planet/components/processing/
development/laboratory/planet/components/processing/api/
development/laboratory/planet/components/processing/api/build.xml
(contents, props changed)
development/laboratory/planet/components/processing/api/src/
development/laboratory/planet/components/processing/api/src/main/
development/laboratory/planet/components/processing/api/src/main/net/
development/laboratory/planet/components/processing/api/src/main/net/dpml/

development/laboratory/planet/components/processing/api/src/main/net/dpml/processing/

development/laboratory/planet/components/processing/api/src/main/net/dpml/processing/ProcessActivity.java
(contents, props changed)
development/laboratory/planet/components/processing/build.xml (contents,
props changed)
development/laboratory/planet/components/processing/controller/
development/laboratory/planet/components/processing/controller/build.xml
(contents, props changed)
development/laboratory/planet/components/processing/controller/src/
development/laboratory/planet/components/processing/controller/src/main/

development/laboratory/planet/components/processing/controller/src/main/net/

development/laboratory/planet/components/processing/controller/src/main/net/dpml/

development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/

development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/

development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/ExitPoint.java
(contents, props changed)

development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/ExitPoint.properties
(contents, props changed)

development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/NestedController.java
(contents, props changed)

development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/NestedController.properties
(contents, props changed)
development/laboratory/planet/components/processing/index.xml (contents,
props changed)
development/laboratory/planet/components/processing/module.xml
(contents, props changed)
Modified:

development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/BitMappedFlags.java

development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/DefaultPacket.java

development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/EnumeratedString.java

development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/FixedLengthString.java

development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String16bitLengthLead.java

development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String8bitLengthLead.java

development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/StringNullTerminated.java
Log:
Activity Processing system.

Added: development/laboratory/planet/components/processing/api/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/planet/components/processing/api/build.xml Thu
Mar 3 09:57:18 2005
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2005 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="dpml-processing-api" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+>
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+</project>

Added:
development/laboratory/planet/components/processing/api/src/main/net/dpml/processing/ProcessActivity.java
==============================================================================
--- (empty file)
+++
development/laboratory/planet/components/processing/api/src/main/net/dpml/processing/ProcessActivity.java
Thu Mar 3 09:57:18 2005
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2005, Niclas Hedhman
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.processing;
+
+import java.util.Locale;
+
+/** The ProcessActivity is the process that is to be handled.
+ * <p>
+ * Each ProcessActivity does something and the result of that operation
+ * results in an outcome. The Metro composition model is used to wire
+ * the outcome with the following ProcessActivity. The pattern for this
+ * wiring is something like the following;
+ * </p>
+ * <code><pre>
+ * &#47;**
+ * &#64;metro.dependency type="net.dpml.processing.ProcessActivity"
key="success"
+ * &#64;metro.dependency type="net.dpml.processing.ProcessActivity"
key="error-energy"
+ * &#64;metro.dependency type="net.dpml.processing.ProcessActivity"
key="error-unpaid"
+ * *&#47;
+ * public void service( ServiceManager man )
+ * throws ServiceException
+ * {
+ * // look up the success activity to follow upon success.
+ * m_success = (ProcessActivity) man.lookup( "success" );
+ * m_outOfEnergy = (ProcessActivity) man.lookup( "error-energy" );
+ * m_unpaidBill = (ProcessActivity) man.lookup( "error-unpaid" );
+ * }
+ *
+ * public Process process()
+ * throws Exception
+ * {
+ * doStuff();
+ * if( m_noMoreEnergy )
+ * return m_outOfEnergy;
+ * if( m_billUnpaid )
+ * return m_unpaidBill;
+ * return m_success;
+ * }
+ * </pre></code>
+ *
+ * <p>
+ * And then the wiring of the three possible outcomes are wired in the
+ * block where this activity is located.
+ * </p>
+ *
+ * @metro.service type="net.dpml.processing.ProcessActivity"
+ */
+public interface ProcessActivity
+{
+ /** Process the activity.
+ * <p>
+ * The ProcessActivity should executed its operations and determine the
+ * outcome of these operations, and return a new activity as the
continuation
+ * of the processing.
+ * </p>
+ * <p>
+ * The API assumes that the Metro composition API is used, which allows
for
+ * Inversion-of-Control (IoC) style wiring of the outcomes to the
components
+ * that implements the processing of activity following the outcome.
+ * </p>
+ * @return the next ProcessActivity which is the resulting
+ * outcome of this activity.
+ * @exception Exception if an uncaught exception is thrown, the
+ * controller should embark on a externally defined
+ * activity path.
+ */
+ ProcessActivity process() throws Exception;
+
+ /** Returns a short but descriptive name of this process activity.
+ * <p>
+ * The name should be both descriptive and unique within the processing
+ * scope and relate to accepted domain nomenclatura. This name may be
used
+ * in generation of process diagrams and other concise outputs for human
+ * consumption. The name is always expressed in english to ensure the
+ * global applicability, and applications are encouraged to use the
+ * <code>getDescription</code> method for more verbose output to users,
+ * especially in non-english speaking regions.
+ * </p>
+ * @return the name in english in a short, yet descriptive form.
+ */
+ String getName();
+
+ /** Returns the Description.
+ * <p>
+ * Returns a longer description of the processing that this
ProcessActivity
+ * performs and the possible outcomes. The returned string should be in
the
+ * language of the provided locale and formatted accordingly. If there is
+ * no translation of the description in the requested locale, english
should
+ * be returned.
+ * </p>
+ * @return A longer description, in a translated, human-readable form, of
+ * the process activity describing the oeprations performed and the
possible
+ * outcomes.
+ */
+ String getDescription( Locale locale );
+}
\ No newline at end of file

Added: development/laboratory/planet/components/processing/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/planet/components/processing/build.xml Thu
Mar 3 09:57:18 2005
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="dpml-processing" default="default" basedir="."
+ xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:import uri="artifact:template:dpml/magic/reactor"/>
+
+</project>

Added:
development/laboratory/planet/components/processing/controller/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/planet/components/processing/controller/build.xml
Thu Mar 3 09:57:18 2005
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2005 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="dpml-processing-controller" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+>
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+</project>

Added:
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/ExitPoint.java
==============================================================================
--- (empty file)
+++
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/ExitPoint.java
Thu Mar 3 09:57:18 2005
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2005, Niclas Hedhman
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.processing.controller;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import net.dpml.processing.ProcessActivity;
+
+/** A marker class for exiting a nested controller.
+ * <p>
+ * The ExitPoint is included into the block, and wired to the outcome
+ * of the nested activities that triggers the exit from the controller.
+ *
+ * <code><pre>
+ * &lt;x:component name="exit"
class="net.dpml.processing.controller.ExitPoint" /&gt;
+ *
+ * &lt;x:component name="select"
class="my.company.print.SelectionActivity" &gt;
+ * &lt;x:dependencies&gt;
+ * &lt;x:dependency key="outcome-print" source="printing" /&gt;
+ * &lt;x:dependency key="outcome-cancel" source="exit" /&gt;
+ * &lt;/x:dependencies&gt;
+ * &lt;/x:component&gt;
+ * &lt;x:component name="printing"
class="my.company.print.PrintingActivity" &gt;
+ * &lt;x:dependencies&gt;
+ * &lt;x:dependency key="outcome-done" source="exit" /&gt;
+ * &lt;/x:dependencies&gt;
+ * &lt;/x:component&gt;
+ * </pre></code>
+ * </p>
+ * @metro.component name="exit-point" lifestyle="singleton"
+ * @metro.service type="net.dpml.processing.ProcessActivity"
+ */
+public final class ExitPoint
+ implements ProcessActivity
+{
+ /** Process the activity.
+ * <p>
+ * The ProcessActivity should executed its operations and determine the
+ * outcome of these operations, and return a new activity as the
continuation
+ * of the processing.
+ * </p>
+ * <p>
+ * The API assumes that the Metro composition API is used, which allows
for
+ * Inversion-of-Control (IoC) style wiring of the outcomes to the
components
+ * that implements the processing of activity following the outcome.
+ * </p>
+ * @return the next ProcessActivity which is the resulting
+ * outcome of this activity.
+ * @exception Exception if an uncaught exception is thrown, the
+ * controller should embark on a externally defined
+ * activity path.
+ */
+ public ProcessActivity process()
+ throws Exception
+ {
+ return null; // never used.
+ }
+
+ /** Returns a short but descriptive name of this process activity.
+ * <p>
+ * The name should be both descriptive and unique within the processing
+ * scope and relate to accepted domain nomenclatura. This name may be
used
+ * in generation of process diagrams and other concise outputs for human
+ * consumption. The name is always expressed in english to ensure the
+ * global applicability, and applications are encouraged to use the
+ * <code>getDescription</code> method for more verbose output to users,
+ * especially in non-english speaking regions.
+ * </p>
+ * @return the name in english in a short, yet descriptive form.
+ */
+ public String getName()
+ {
+ return "Exit";
+ }
+
+ /** Returns the Description.
+ * <p>
+ * Returns a longer description of the processing that this
ProcessActivity
+ * performs and the possible outcomes. The returned string should be in
the
+ * language of the provided locale and formatted accordingly. If there is
+ * no translation of the description in the requested locale, english
should
+ * be returned.
+ * </p>
+ * @return A longer description, in a translated, human-readable form, of
+ * the process activity describing the oeprations performed and the
possible
+ * outcomes.
+ */
+ public String getDescription( Locale locale )
+ {
+ String base = getClass().getName();
+ ClassLoader classloader = getClass().getClassLoader();
+ ResourceBundle bundle = ResourceBundle.getBundle( base, locale,
classloader );
+ return bundle.getString( "description" );
+ }
+
+}

Added:
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/ExitPoint.properties
==============================================================================
--- (empty file)
+++
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/ExitPoint.properties
Thu Mar 3 09:57:18 2005
@@ -0,0 +1,2 @@
+description=An activity that instructs the NestedController class to exit
the \
+controlling activity and return to its containing controller.

Added:
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/NestedController.java
==============================================================================
--- (empty file)
+++
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/NestedController.java
Thu Mar 3 09:57:18 2005
@@ -0,0 +1,275 @@
+/*
+ * Copyright 2005, Niclas Hedhman
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.processing.controller;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import net.dpml.parameters.Parameters;
+
+import net.dpml.processing.ProcessActivity;
+
+import net.dpml.service.ServiceException;
+import net.dpml.service.ServiceManager;
+
+/**
+ * This ProcessActivity is also a controller for <coed>ProcessActivity</code>
+ * instances.
+ * <p>
+ * This controller defines a set of outcomes that need to be provided by
+ * the deployer.
+ * </p>
+ * <table>
+ * <tr>
+ * <th>Outcome name</th>
+ * <th>Required</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>initial-activity</td>
+ * <td>yes</td>
+ * <td>The activity that the controller starts the sequence with.</td>
+ * </tr>
+ * <tr>
+ * <td>continue-activity</td>
+ * <td>yes</td>
+ * <td>
+ * The activity that the outer controller should continue with when
this
+ * controller/activity exits.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>exception-path</td>
+ * <td>no</td>
+ * <td>
+ * The activity that should be processed if there is an exception in
+ * any of the other <code>ProcessActivity</code> instances.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>recover-point</td>
+ * <td>if <code>exception-path</code> declared.</td>
+ * <td>
+ * The <code>ProcessActivity</code> to return to after the sequence
+ * of activities in the exception path has been processed.
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * <h2>Normal Processing</h2>
+ * <p>
+ * The Metro composition model is used to assemble a set of processing
+ * activities that are sequenced by this controller. Each <code>
+ * ProcessActivity</code> will define its own
<strong><i>outcomes</i></strong>
+ * which are wired through dependency resolution to continuing <code>
+ * ProcessActivity</code> components in the Metro model.
+ *
+ * </p>
+ * <h2>Startup</h2>
+ * <p>
+ * The controller will start processing the ProcessActivity that has been
+ * declared for the <code>initial-activity</code> dependency in the block.
+ * </p>
+ * <h2>Exit</h2>
+ * Whenever an outcome is defined to continue with the
+ * <code>net.dpml.processing.controller.ExitPoint</code> activity, this
+ * controller will exit. The controller will return to its parent controller
+ * with the exit <code>ProcessActivity</code> defined in the
+ * <code>continue-activity</code> dependency resolution.
+ *
+ * <h2>Exception Processing</h2>
+ * <p>
+ * If any ProcessActivity throws an exception in the <code>process</code>
+ * method, and the <code>exception-path</code> dependency has been resolved,
+ * the controller will enter exception processing in the same manner.
+ * If the <code>exception-path</code> has not been resolved, the controller
+ * forwards the exception to the parent controller.
+ * The exception processing will continue until a <code>ExitPoint</code>
+ * activity is reach, upon which the processing will re-enter the normal
+ * processing at the activity defined by the <code>recover-point</code>
+ * outcome.
+ * </p>
+ * <h2>Example</h2>
+ * <code><pre>
+ * &lt;x:service type="net.dpml.processing.ProcessActivity" /&gt;
+ * &lt;x:component name="controller"
class="net.dpml.processing.controller.NestedController" &gt;
+ * &lt;x:dependencies&gt;
+ * &lt;x:dependency key="initial-activity" source="select" /&gt;
+ * &lt;x:dependency key="continue-activity" source="../nested-done"
/&gt;
+ * &lt;x:dependency key="exception-path" source="check-paper-jam" /&gt;
+ * &lt;x:dependency key="recover-point" source="select" /&gt;
+ * &lt;/x:dependencies&gt;
+ * &lt;/x:component&gt;
+ *
+ * &lt;x:component name="exit"
class="net.dpml.processing.controller.ExitPoint" /&gt;
+ *
+ * &lt;x:component name="select" class="my.company.print.Selecting" &gt;
+ * &lt;x:dependencies&gt;
+ * &lt;x:dependency key="outcome-print" source="printing" /&gt;
+ * &lt;x:dependency key="outcome-cancel" source="exit" /&gt;
+ * &lt;/x:dependencies&gt;
+ * &lt;/x:component&gt;
+ *
+ * &lt;x:component name="printing" class="my.company.print.Printing" &gt;
+ * &lt;x:dependencies&gt;
+ * &lt;x:dependency key="outcome-done" source="exit" /&gt;
+ * &lt;/x:dependencies&gt;
+ * &lt;/x:component&gt;
+ *
+ * &lt;x:component name="check-paper-jam"
class="my.company.print.CheckingPaperJam" &gt;
+ * &lt;x:dependencies&gt;
+ * &lt;x:dependency key="outcome-jammed" source="paper-jam" /&gt;
+ * &lt;/x:dependencies&gt;
+ * &lt;/x:component&gt;
+ *
+ * &lt;x:component name="paper-jam" class="my.company.print.InformingUser"
&gt;
+ * &lt;x:dependencies&gt;
+ * &lt;x:dependency key="outcome-done" source="exit" /&gt;
+ * &lt;/x:dependencies&gt;
+ * &lt;x:parameters&gt;
+ * &lt;x:parameter name="info-key" value="Paper jammed." /&gt;
+ * &lt;/x:parameters&gt;
+ * &lt;/x:component&gt;
+ * </pre></code>
+ * @metro.component name="nested-controller" lifestyle="singleton"
+ * @metro.service type="net.dpml.processing.ProcessActivity"
+ */
+public class NestedController
+ implements ProcessActivity
+{
+ private ProcessActivity m_initialActivity;
+ private ProcessActivity m_exceptionPath;
+ private ProcessActivity m_recoverPoint;
+ private ProcessActivity m_continueActivity;
+ private String m_name;
+
+ /**
+ * @metro.dependency type="net.dpml.processing.ProcessActivity"
key="initial-activity"
+ * @metro.dependency type="net.dpml.processing.ProcessActivity"
key="continue-activity"
+ * @metro.dependency type="net.dpml.processing.ProcessActivity"
+ * key="exception-path" optional="true"
+ * @metro.dependency type="net.dpml.processing.ProcessActivity"
+ * key="recover-point" optional="true"
+ */
+ public NestedController( ServiceManager man, Parameters params )
+ throws ServiceException
+ {
+ m_name = params.getParameter( "name", "Nested Controller" );
+ if( man.hasService( "exception-path" ) )
+ {
+ m_exceptionPath = (ProcessActivity) man.lookup( "exception-path"
);
+ m_recoverPoint = (ProcessActivity) man.lookup( "recover-point" );
+ }
+ m_recoverPoint = (ProcessActivity) man.lookup( "continue-activity" );
+ m_initialActivity = (ProcessActivity) man.lookup( "initial-activity"
);
+ }
+
+ /** Process the activity.
+ * <p>
+ * The ProcessActivity should executed its operations and determine the
+ * outcome of these operations, and return a new activity as the
continuation
+ * of the processing.
+ * </p>
+ * <p>
+ * The API assumes that the Metro composition API is used, which allows
for
+ * Inversion-of-Control (IoC) style wiring of the outcomes to the
components
+ * that implements the processing of activity following the outcome.
+ * </p>
+ * @return the next ProcessActivity which is the resulting
+ * outcome of this activity.
+ * @exception Exception if an uncaught exception is thrown, the
+ * controller should embark on a externally defined
+ * activity path.
+ */
+ public ProcessActivity process()
+ throws Exception
+ {
+ ProcessActivity next = m_initialActivity;
+ while( true )
+ {
+ try
+ {
+ next = next.process();
+ if( next instanceof ExitPoint )
+ return m_continueActivity;
+
+ } catch( Exception e )
+ {
+ if( m_exceptionPath != null )
+ next = processExceptionPath();
+ else
+ throw e;
+ }
+ }
+
+ }
+
+ private ProcessActivity processExceptionPath()
+ throws Exception
+ {
+ ProcessActivity next = m_exceptionPath;
+ while( true )
+ {
+ next = next.process();
+ if( next instanceof ExitPoint )
+ return m_recoverPoint;
+ }
+ }
+
+ /** Returns a short but descriptive name of this process activity.
+ * <p>
+ * The name should be both descriptive and unique within the processing
+ * scope and relate to accepted domain nomenclatura. This name may be
used
+ * in generation of process diagrams and other concise outputs for human
+ * consumption. The name is always expressed in english to ensure the
+ * global applicability, and applications are encouraged to use the
+ * <code>getDescription</code> method for more verbose output to users,
+ * especially in non-english speaking regions.
+ * </p>
+ * <p>
+ * The name can be declared in a <code>name</code> Metro parameter. If
not
+ * declared the name <i>Nested Controller</i> is returned.
+ * </p>
+ * @return the name in english in a short, yet descriptive form.
+ */
+ public String getName()
+ {
+ return m_name;
+ }
+
+ /** Returns the Description.
+ * <p>
+ * Returns a longer description of the processing that this
ProcessActivity
+ * performs and the possible outcomes. The returned string should be in
the
+ * language of the provided locale and formatted accordingly. If there is
+ * no translation of the description in the requested locale, english
should
+ * be returned.
+ * </p>
+ * @return A longer description, in a translated, human-readable form, of
+ * the process activity describing the oeprations performed and the
possible
+ * outcomes.
+ */
+ public String getDescription( Locale locale )
+ {
+ String base = getClass().getName();
+ ClassLoader classloader = getClass().getClassLoader();
+ ResourceBundle bundle = ResourceBundle.getBundle( base, locale,
classloader );
+ return bundle.getString( "description" );
+ }
+}
\ No newline at end of file

Added:
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/NestedController.properties
==============================================================================
--- (empty file)
+++
development/laboratory/planet/components/processing/controller/src/main/net/dpml/processing/controller/NestedController.properties
Thu Mar 3 09:57:18 2005
@@ -0,0 +1,2 @@
+description=A process activity controller which itself is a ProcessActivity,
to \
+allow for nested activity processing.

Added: development/laboratory/planet/components/processing/index.xml
==============================================================================
--- (empty file)
+++ development/laboratory/planet/components/processing/index.xml Thu
Mar 3 09:57:18 2005
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2005 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<index key="dpml-processing" >
+ <import uri="artifact:module:dpml/metro/dpml-metro#SNAPSHOT" />
+
+ <project file="module.xml">
+ <info>
+ <group>dpml/processing</group>
+ <name>dpml-processing</name>
+ <version>1.0.0</version>
+ <status>SNAPSHOT</status>
+ <type>module</type>
+ </info>
+ <dependencies>
+ <include key="dpml-util"/>
+ <include key="dpml-transit"/>
+ <include key="dpml-metro"/>
+ </dependencies>
+ </project>
+
+ <project basedir="api" >
+ <info>
+ <name>dpml-processing-api</name>
+ <group>dpml/processing/api</group>
+ <version>1.0</version>
+ </info>
+ <plugins>
+ <include key="dpml-meta-tools" />
+ </plugins>
+ </project>
+
+ <project basedir="controller" >
+ <info>
+ <name>dpml-processing-controller</name>
+ <group>dpml/processing/controller</group>
+ <version>1.0.0</version>
+ </info>
+ <dependencies>
+ <include key="dpml-processing-api"/>
+ <include key="dpml-parameters-api" />
+ <include key="dpml-service-api" />
+ </dependencies>
+ <plugins>
+ <include key="dpml-meta-tools" />
+ </plugins>
+ </project>
+</index>

Added: development/laboratory/planet/components/processing/module.xml
==============================================================================
--- (empty file)
+++ development/laboratory/planet/components/processing/module.xml Thu
Mar 3 09:57:18 2005
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="dpml-processing" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="plugin:dpml/magic/dpml-magic-core">
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+ <target name="build" depends="standard.build">
+ <x:module index="index.xml">
+ <header>
+ <svn
href="http://paris.dpml.net/svn/development/laboratory/planet/components/processing"/>
+ <home href="http://www.dpml.net/products/planet"/>
+ </header>
+ </x:module>
+ </target>
+
+ <target name="install" depends="standard.install,checkstyle,junit-report">
+ <x:javadoc>
+ <link href="http://java.sun.com/j2se/1.4/docs/api"/>
+ <group title="Activity Processing API">
+ <package name="net.dpml.processing"/>
+ </group>
+ <group title="Activity Processing Nested Controller">
+ <package name="net.dpml.processing.controller"/>
+ </group>
+ </x:javadoc>
+ </target>
+
+ <target name="junit-report" depends="test">
+ <mkdir dir="target/reports/junit"/>
+ <junitreport todir="target/reports/junit">
+ <fileset dir=".">
+ <include name="**/target/test-reports/TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="target/reports/junit"/>
+ </junitreport>
+ </target>
+
+</project>

Modified:
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/BitMappedFlags.java
==============================================================================
---
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/BitMappedFlags.java
(original)
+++
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/BitMappedFlags.java
Thu Mar 3 09:57:18 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.protocol.packet.impl;
+package net.dpml.protocol.packet;

import java.util.HashMap;
import java.util.Locale;
@@ -25,9 +25,6 @@
import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;

-import net.dpml.protocol.packet.FieldType;
-import net.dpml.protocol.packet.IllegalPacketFormatException;
-
/** Handles translation of "flags" into 8, 16 or 32 bit integer bit maps.
* The flag list is provided via the parameters or the
* add/removeFlag. For each Parameter the name attribute is the

Modified:
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/DefaultPacket.java
==============================================================================
---
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/DefaultPacket.java
(original)
+++
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/DefaultPacket.java
Thu Mar 3 09:57:18 2005
@@ -16,13 +16,11 @@
* limitations under the License.
*/

-package net.dpml.protocol.packet.impl;
+package net.dpml.protocol.packet;

import java.io.IOException;
import java.io.OutputStream;

-import net.dpml.protocol.packet.Packet;
-
/** This Packet implementation is a pure content holder of bytes that
* gets written into it, and can be later extracted either as a byte array
* or written to an output stream.

Modified:
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/EnumeratedString.java
==============================================================================
---
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/EnumeratedString.java
(original)
+++
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/EnumeratedString.java
Thu Mar 3 09:57:18 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.protocol.packet.impl;
+package net.dpml.protocol.packet;

import java.util.HashMap;
import java.util.Locale;
@@ -24,9 +24,6 @@
import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;

-import net.dpml.protocol.packet.FieldType;
-import net.dpml.protocol.packet.IllegalPacketFormatException;
-
/** Handles translation of strings into 8 bit number sequences.
* The enumeration list is provided via the parameters or the
* add/removeEnumeration. For each Parameter the name attribute is the

Modified:
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/FixedLengthString.java
==============================================================================
---
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/FixedLengthString.java
(original)
+++
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/FixedLengthString.java
Thu Mar 3 09:57:18 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.protocol.packet.impl;
+package net.dpml.protocol.packet;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
@@ -26,9 +26,6 @@
import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;

-import net.dpml.protocol.packet.FieldType;
-import net.dpml.protocol.packet.IllegalPacketFormatException;
-
/** Handles translation of strings into a fixed length character sequence.
*
* @metro.component name="fixed-length-string" lifestyle="singleton"

Modified:
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String16bitLengthLead.java
==============================================================================
---
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String16bitLengthLead.java
(original)
+++
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String16bitLengthLead.java
Thu Mar 3 09:57:18 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.protocol.packet.impl;
+package net.dpml.protocol.packet;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
@@ -26,9 +26,6 @@
import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;

-import net.dpml.protocol.packet.FieldType;
-import net.dpml.protocol.packet.IllegalPacketFormatException;
-
/** Handles strings that are characters stored in a sequence, prefixed
* with the first two bytes being the length of the string with low-byte
* followed by the high-byte of the length.

Modified:
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String8bitLengthLead.java
==============================================================================
---
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String8bitLengthLead.java
(original)
+++
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/String8bitLengthLead.java
Thu Mar 3 09:57:18 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.protocol.packet.impl;
+package net.dpml.protocol.packet;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
@@ -26,9 +26,6 @@
import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;

-import net.dpml.protocol.packet.FieldType;
-import net.dpml.protocol.packet.IllegalPacketFormatException;
-
/** Handles strings that are 8-bit characters stored in a sequence, prefixed
* with the first byte being the length of the string, in the range of
* 0 to 255.

Modified:
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/StringNullTerminated.java
==============================================================================
---
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/StringNullTerminated.java
(original)
+++
development/laboratory/planet/components/protocol/packetapi/src/main/net/dpml/protocol/packet/StringNullTerminated.java
Thu Mar 3 09:57:18 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.protocol.packet.impl;
+package net.dpml.protocol.packet;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
@@ -26,9 +26,6 @@
import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;

-import net.dpml.protocol.packet.FieldType;
-import net.dpml.protocol.packet.IllegalPacketFormatException;
-
/** Handles strings that are 8-bit characters stored in a sequence, end
* terminated by a so called NUL character, i.e. 0x00.
* The encoding to use for the byte sequence is defined in the parameter



  • svn commit: r1932 - in development/laboratory/planet/components: processing processing/api processing/api/src processing/api/src/main processing/api/src/main/net processing/api/src/main/net/dpml processing/api/src/main/net/dpml/processing processing/controller processing/controller/src processing/controller/src/main processing/controller/src/main/net processing/controller/src/main/net/dpml processing/controller/src/main/net/dpml/processing processing/controller/src/main/net/dpml/processing/controller protocol/packetapi/src/main/net/dpml/protocol/packet, niclas, 03/03/2005

Archive powered by MHonArc 2.6.24.

Top of Page