Skip to Content.
Sympa Menu

notify-dpml - r1436 - in trunk/main/lang/process/src/main/net/dpml/lang: . info

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1436 - in trunk/main/lang/process/src/main/net/dpml/lang: . info
  • Date: Sat, 6 May 2006 21:06:56 +0200

Author: mcconnell
Date: 2006-05-06 21:06:48 +0200 (Sat, 06 May 2006)
New Revision: 1436

Added:
trunk/main/lang/process/src/main/net/dpml/lang/info/

trunk/main/lang/process/src/main/net/dpml/lang/info/AbstractProductDirective.java

trunk/main/lang/process/src/main/net/dpml/lang/info/ConsumptionDirective.java
trunk/main/lang/process/src/main/net/dpml/lang/info/DataDirective.java
trunk/main/lang/process/src/main/net/dpml/lang/info/DirectoryDirective.java
trunk/main/lang/process/src/main/net/dpml/lang/info/FileDirective.java
trunk/main/lang/process/src/main/net/dpml/lang/info/InfoDirective.java
trunk/main/lang/process/src/main/net/dpml/lang/info/InputDirective.java
trunk/main/lang/process/src/main/net/dpml/lang/info/Policy.java
trunk/main/lang/process/src/main/net/dpml/lang/info/ProcessDirective.java
Log:


Added:
trunk/main/lang/process/src/main/net/dpml/lang/info/AbstractProductDirective.java
===================================================================
---
trunk/main/lang/process/src/main/net/dpml/lang/info/AbstractProductDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++
trunk/main/lang/process/src/main/net/dpml/lang/info/AbstractProductDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import net.dpml.lang.AbstractDirective;
+
+/**
+ * The AbstractProductDirective class describes a product instance such as a
file or directory.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public abstract class AbstractProductDirective extends AbstractDirective
+{
+ private final String m_name;
+ private final InfoDirective m_info;
+
+ public AbstractProductDirective( final String name, final InfoDirective
info )
+ {
+ if( null == name )
+ {
+ throw new NullPointerException( "name" );
+ }
+ if( null == info )
+ {
+ throw new NullPointerException( "info" );
+ }
+ m_name = name;
+ m_info = info;
+ }
+
+ /**
+ * Get the product name.
+ * @return the product name.
+ */
+ public String getName()
+ {
+ return m_name;
+ }
+
+
+ /**
+ * Get the product title.
+ * @return the product title.
+ */
+ public String getTitle()
+ {
+ return m_info.getTitle();
+ }
+ /**
+ * Get the product description.
+ * @return the product description.
+ */
+ public String getDescription()
+ {
+ return m_info.getDescription();
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof
AbstractProductDirective ) )
+ {
+ AbstractProductDirective object = (AbstractProductDirective)
other;
+ if( !m_name.equals( object.m_name ) )
+ {
+ return false;
+ }
+ else
+ {
+ return equals( m_info, object.m_info );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Compute the hash value.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= hashValue( m_name );
+ hash ^= hashValue( m_info );
+ return hash;
+ }
+}

Added:
trunk/main/lang/process/src/main/net/dpml/lang/info/ConsumptionDirective.java
===================================================================
---
trunk/main/lang/process/src/main/net/dpml/lang/info/ConsumptionDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++
trunk/main/lang/process/src/main/net/dpml/lang/info/ConsumptionDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+import java.util.Arrays;
+
+import net.dpml.lang.AbstractDirective;
+
+/**
+ * The ConsumptionDirective describes the consumption of a set of products.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class ConsumptionDirective extends AbstractDirective
+{
+ private final InputDirective[] m_input;
+ private final Policy m_policy;
+
+ public ConsumptionDirective( InputDirective[] input, Policy policy )
+ {
+ if( null == input )
+ {
+ throw new NullPointerException( "input" );
+ }
+ if( null == policy )
+ {
+ throw new NullPointerException( "policy" );
+ }
+ m_input = input;
+ m_policy = policy;
+ }
+
+ /**
+ * Get the array of input directives.
+ * @return the input directive array
+ */
+ public InputDirective[] getInputDirectives()
+ {
+ return m_input;
+ }
+
+
+ /**
+ * Get the input hanlding policy.
+ * @return the policy
+ */
+ public Policy getPolicy()
+ {
+ return m_policy;
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof ConsumptionDirective
) )
+ {
+ ConsumptionDirective object = (ConsumptionDirective) other;
+ if( !m_policy.equals( object.m_policy ) )
+ {
+ return false;
+ }
+ else
+ {
+ return Arrays.equals( m_input, object.m_input );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Compute the hash value.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= hashValue( m_policy );
+ hash ^= hashArray( m_input );
+ return hash;
+ }
+}

Added: trunk/main/lang/process/src/main/net/dpml/lang/info/DataDirective.java
===================================================================
--- trunk/main/lang/process/src/main/net/dpml/lang/info/DataDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++ trunk/main/lang/process/src/main/net/dpml/lang/info/DataDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import net.dpml.lang.AbstractDirective;
+
+/**
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public abstract class DataDirective extends AbstractDirective
+{
+
+}

Added:
trunk/main/lang/process/src/main/net/dpml/lang/info/DirectoryDirective.java
===================================================================
---
trunk/main/lang/process/src/main/net/dpml/lang/info/DirectoryDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++
trunk/main/lang/process/src/main/net/dpml/lang/info/DirectoryDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+/**
+ * The DirectoryProductDirective class describes a working directory.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class DirectoryDirective extends AbstractProductDirective
+{
+ private final String m_path;
+
+ public DirectoryDirective( final String name, final InfoDirective info,
String path )
+ {
+ super( name, info );
+
+ if( null == path )
+ {
+ throw new NullPointerException( "path" );
+ }
+
+ m_path = path;
+ }
+
+ /**
+ * Get the product name.
+ * @return the product name.
+ */
+ public String getPath()
+ {
+ return m_path;
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof DirectoryDirective )
)
+ {
+ DirectoryDirective object = (DirectoryDirective) other;
+ return m_path.equals( object.m_path );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Compute the hash value.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= hashValue( m_path );
+ return hash;
+ }
+}

Added: trunk/main/lang/process/src/main/net/dpml/lang/info/FileDirective.java
===================================================================
--- trunk/main/lang/process/src/main/net/dpml/lang/info/FileDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++ trunk/main/lang/process/src/main/net/dpml/lang/info/FileDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+/**
+ * The FileDirective class describes a deliverable produced by a process.
+ * A file is normally associated with a colocated MD5 and ASC resource.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class FileDirective extends AbstractProductDirective
+{
+ private final String m_type;
+
+ /**
+ * Creation of a new file directive.
+ * @param name the product identifier
+ * @param info supplimentary product info
+ * @param type the artifact type
+ */
+ public FileDirective( final String name, final InfoDirective info,
String type )
+ {
+ super( name, info );
+
+ if( null == type )
+ {
+ throw new NullPointerException( "type" );
+ }
+
+ m_type = type;
+ }
+
+ /**
+ * Get the product type name.
+ * @return the product type.
+ */
+ public String getType()
+ {
+ return m_type;
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof FileDirective ) )
+ {
+ FileDirective object = (FileDirective) other;
+ return m_type.equals( object.m_type );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Compute the hash value.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= hashValue( m_type );
+ return hash;
+ }
+}

Added: trunk/main/lang/process/src/main/net/dpml/lang/info/InfoDirective.java
===================================================================
--- trunk/main/lang/process/src/main/net/dpml/lang/info/InfoDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++ trunk/main/lang/process/src/main/net/dpml/lang/info/InfoDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import net.dpml.lang.AbstractDirective;
+
+/**
+ * The InfoDirective describes a title and general information about an
entiry.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public abstract class InfoDirective extends AbstractDirective
+{
+ private final String m_title;
+ private final String m_description;
+
+ public InfoDirective( final String title, final String description )
+ {
+ if( null == title )
+ {
+ throw new NullPointerException( "title" );
+ }
+ m_title = title;
+ m_description = description;
+ }
+
+ /**
+ * Get the product name.
+ * @return the product name.
+ */
+ public String getTitle()
+ {
+ return m_title;
+ }
+
+ /**
+ * Get the product description.
+ * @return the product description.
+ */
+ public String getDescription()
+ {
+ return m_description;
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof InfoDirective ) )
+ {
+ InfoDirective object = (InfoDirective) other;
+ if( !m_title.equals( object.m_title ) )
+ {
+ return false;
+ }
+ else
+ {
+ return equals( m_description, object.m_description );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Compute the hash value.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= hashValue( m_title );
+ hash ^= hashValue( m_description );
+ return hash;
+ }
+}

Added: trunk/main/lang/process/src/main/net/dpml/lang/info/InputDirective.java
===================================================================
--- trunk/main/lang/process/src/main/net/dpml/lang/info/InputDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++ trunk/main/lang/process/src/main/net/dpml/lang/info/InputDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import net.dpml.lang.AbstractDirective;
+
+/**
+ * The InputDirective describes the consumption of a product by a process.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class InputDirective extends AbstractDirective
+{
+ private final Policy m_policy;
+ private final String m_id;
+ private final String[] m_includes;
+ private final String[] m_excludes;
+ private final boolean m_filtering;
+
+ public InputDirective(
+ final String id, final Policy policy )
+ {
+ this( id, policy, false, new String[0], new String[0] );
+ }
+
+ public InputDirective(
+ final String id, final Policy policy, boolean filtering,
+ final String[] includes, final String[] excludes )
+ {
+ if( null == id )
+ {
+ throw new NullPointerException( "id" );
+ }
+ if( null == includes )
+ {
+ throw new NullPointerException( "includes" );
+ }
+ if( null == excludes )
+ {
+ throw new NullPointerException( "excludes" );
+ }
+
+ m_id = id;
+ if( null == policy )
+ {
+ m_policy = Policy.OPTIONAL;
+ }
+ else
+ {
+ m_policy = policy;
+ }
+ m_filtering = filtering;
+ m_includes = includes;
+ m_excludes = excludes;
+ }
+
+ /**
+ * Get the id of the consumed product.
+ * @return the product id
+ */
+ public String getID()
+ {
+ return m_id;
+ }
+
+ /**
+ * Get the policy associated within the consumption input.
+ * @return the input policy
+ */
+ public Policy getPolicy()
+ {
+ return m_policy;
+ }
+
+ /**
+ * Get the filtering policy.
+ * @return the filtering policy
+ */
+ public boolean isFiltering()
+ {
+ return m_filtering;
+ }
+
+ /**
+ * Get the array of includes.
+ * @return the include array
+ */
+ public String[] getIncludes()
+ {
+ return m_includes;
+ }
+
+ /**
+ * Get the array of excludes.
+ * @return the exclude array
+ */
+ public String[] getExcludes()
+ {
+ return m_excludes;
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof InputDirective ) )
+ {
+ InputDirective object = (InputDirective) other;
+ if( !m_id.equals( object.m_id ) )
+ {
+ return false;
+ }
+ else if( !m_policy.equals( object.m_policy ) )
+ {
+ return false;
+ }
+ else if( m_filtering != object.m_filtering )
+ {
+ return false;
+ }
+ else if( !equals( m_includes, object.m_includes ) )
+ {
+ return false;
+ }
+ else
+ {
+ return Arrays.equals( m_excludes, object.m_excludes );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Compute the hash value.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= hashValue( m_id );
+ if( m_filtering )
+ {
+ hash ^= 27;
+ }
+ hash ^= hashValue( m_policy );
+ hash ^= hashArray( m_includes );
+ hash ^= hashArray( m_excludes );
+ return hash;
+ }
+}

Added: trunk/main/lang/process/src/main/net/dpml/lang/info/Policy.java
===================================================================
--- trunk/main/lang/process/src/main/net/dpml/lang/info/Policy.java
2006-05-06 18:55:21 UTC (rev 1435)
+++ trunk/main/lang/process/src/main/net/dpml/lang/info/Policy.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2005 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.
+ */
+
+package net.dpml.lang.info;
+
+import net.dpml.lang.Enum;
+
+/**
+ * Product consumption policy enumeration.
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class Policy extends Enum
+{
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Optional policy.
+ */
+ public static final Policy OPTIONAL = new Policy( "optional" );
+
+ /**
+ * Optional policy.
+ */
+ public static final Policy CONDITIONAL = new Policy( "conditional" );
+
+ /**
+ * Array of scope enumeration values.
+ */
+ private static final Policy[] ENUM_VALUES =
+ new Policy[]
+ {
+ OPTIONAL,
+ CONDITIONAL
+ };
+
+ /**
+ * Returns an array of activation enum values.
+ * @return the activation policies array
+ */
+ public static Policy[] values()
+ {
+ return ENUM_VALUES;
+ }
+
+ /**
+ * Internal constructor.
+ * @param label the enumeration label.
+ */
+ private Policy( String label )
+ {
+ super( label );
+ }
+
+ /**
+ * Return a string representation of the category.
+ * @return the category name in uppercase
+ */
+ public String toString()
+ {
+ return getName().toUpperCase();
+ }
+
+ /**
+ * Create a category by parsing the supplied name.
+ * @param value the category name
+ * @return the corresponding category
+ * @exception IllegalArgumentException if the value is not recognized
+ */
+ public static Policy parse( String value ) throws
IllegalArgumentException
+ {
+ if( null == value )
+ {
+ return OPTIONAL;
+ }
+ else
+ {
+ if( value.equalsIgnoreCase( "optional" ) )
+ {
+ return OPTIONAL;
+ }
+ else if( value.equalsIgnoreCase( "conditional" ) )
+ {
+ return CONDITIONAL;
+ }
+ else
+ {
+ final String error =
+ "Unrecognized policy argument [" + value + "]";
+ throw new IllegalArgumentException( error );
+ }
+ }
+ }
+}
+

Added:
trunk/main/lang/process/src/main/net/dpml/lang/info/ProcessDirective.java
===================================================================
--- trunk/main/lang/process/src/main/net/dpml/lang/info/ProcessDirective.java
2006-05-06 18:55:21 UTC (rev 1435)
+++ trunk/main/lang/process/src/main/net/dpml/lang/info/ProcessDirective.java
2006-05-06 19:06:48 UTC (rev 1436)
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2006 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.
+ */
+
+package net.dpml.lang.info;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import net.dpml.lang.AbstractDirective;
+
+/**
+ * The ProcessDirective describes a process in terms of dependent processes,
+ * consumed products, post-execution validation processes, execution
parameters,
+ * the process implmentation class, the process name, it's implicit
execution
+ * status, and an optional output product identifier.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class ProcessDirective extends AbstractDirective
+{
+ private final String m_name;
+ private final String m_classname;
+ private final boolean m_implicit;
+ private final String m_production;
+ private final String[] m_dependencies;
+ private final InputDirective[] m_inputs;
+ private final String[] m_validators;
+ private final DataDirective m_data;
+
+ public ProcessDirective(
+ final String name, final String classname, boolean implicit, String
production,
+ final String[] dependencies, InputDirective[] inputs, String[]
validators,
+ DataDirective data )
+ {
+ if( null == name )
+ {
+ throw new NullPointerException( "name" );
+ }
+ if( null == classname )
+ {
+ throw new NullPointerException( "classname" );
+ }
+ if( null == dependencies )
+ {
+ throw new NullPointerException( "dependencies" );
+ }
+ if( null == inputs )
+ {
+ throw new NullPointerException( "inputs" );
+ }
+ if( null == validators )
+ {
+ throw new NullPointerException( "validators" );
+ }
+ m_name = name;
+ m_classname = classname;
+ m_implicit = implicit;
+ m_production = production;
+ m_dependencies = dependencies;
+ m_inputs = inputs;
+ m_validators = validators;
+ m_data = data;
+ }
+
+ /**
+ * Get the product name.
+ * @return the product name
+ */
+ public String getName()
+ {
+ return m_name;
+ }
+
+
+ /**
+ * Get the processor classname.
+ * @return the classname
+ */
+ public String getClassname()
+ {
+ return m_classname;
+ }
+
+ /**
+ * Get the value of the implicit flag.
+ * @return the implicit status
+ */
+ public boolean isImplicit()
+ {
+ return m_implicit;
+ }
+
+ /**
+ * Get the id of the prioduced product (possibly null).
+ * @return the produced product id
+ */
+ public String getProductionID()
+ {
+ return m_production;
+ }
+
+ /**
+ * Get the array of dependent process names.
+ * @return the dependent process names
+ */
+ public String[] getDependencies()
+ {
+ return m_dependencies;
+ }
+
+ /**
+ * Get the array of input descriptors.
+ * @return the input descriptor array
+ */
+ public InputDirective[] getInputDirectives()
+ {
+ return m_inputs;
+ }
+
+ /**
+ * Get the array of validation process names.
+ * @return the validation process names
+ */
+ public String[] getValidators()
+ {
+ return m_validators;
+ }
+
+ /**
+ * Get the default data for the process.
+ * @return the default data directive
+ */
+ public DataDirective getDataDirective()
+ {
+ return m_data;
+ }
+
+ /**
+ * Compare this object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof ProcessDirective ) )
+ {
+ ProcessDirective object = (ProcessDirective) other;
+ if( !m_name.equals( object.m_name ) )
+ {
+ return false;
+ }
+ else if( !m_classname.equals( object.m_classname ) )
+ {
+ return false;
+ }
+ else if( m_implicit != object.m_implicit )
+ {
+ return false;
+ }
+ else if( !equals( m_production, object.m_production ) )
+ {
+ return false;
+ }
+ else if( !Arrays.equals( m_dependencies, object.m_dependencies )
)
+ {
+ return false;
+ }
+ else if( !Arrays.equals( m_inputs, object.m_inputs ) )
+ {
+ return false;
+ }
+ else if( !Arrays.equals( m_validators, object.m_validators ) )
+ {
+ return false;
+ }
+ else
+ {
+ return equals( m_data, object.m_data );
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Compute the hash value.
+ * @return the hashcode value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= hashValue( m_name );
+ hash ^= hashValue( m_classname );
+ if( m_implicit )
+ {
+ hash ^= 35;
+ }
+ hash ^= hashValue( m_production );
+ hash ^= hashArray( m_dependencies );
+ hash ^= hashArray( m_inputs );
+ hash ^= hashArray( m_validators );
+ hash ^= hashValue( m_data );
+ return hash;
+ }
+}




  • r1436 - in trunk/main/lang/process/src/main/net/dpml/lang: . info, mcconnell at BerliOS, 05/06/2006

Archive powered by MHonArc 2.6.24.

Top of Page