001: package org.enhydra.shark.api.internal.toolagent;
002:
003: import java.io.Serializable;
004:
005: /**
006: * This class represents the parameter passed to tool agent application.
007: * It holds all neccessary information about shark's activity variable.
008: * It differs from original WfMC spec in the following:
009: * <ul>
010: * <li> it defines two fields for parameter name (instead of one as it is in spec):
011: * the actual one, and the formal one
012: * <li> it defines additional field which determines the mode of parameter
013: * (it can be input, output or input and output parameter).
014: * <li> it defined additional field which determines the Java class
015: * for the parameter
016: * </ul>
017: */
018: public final class AppParameter implements Serializable {
019:
020: /**
021: * The name of the actual parameter (shark variable). This is the Id of
022: * the FormalParameter or DataField from XPDL definition, if mode of
023: * corresponding FormalParameter from XPDL Application Definition is OUT or
024: * IN_OUT, otherwise it is the expression which is evaluated to get the
025: * value contained in this object.
026: */
027: public String the_actual_name = null;
028:
029: /**
030: * The name of the formal parameter of XPDL application definition
031: * that corresponds to this AppParameter instance.
032: */
033: public String the_formal_name = null;
034:
035: /**
036: * The mode of the formal parameter, as defined in its XPDL application
037: * definition. It can be:
038: * <ul>
039: * <li> "IN" - then shark doesn't take into account the value of this
040: * parameter after execution of tool agent.
041: * <li> "OUT" - then shark takes into account the value of this parameter
042: * after execution, but tool agent application should not care about
043: * this parameter value when it gets it.
044: * <li> "INOUT" - then both, shark and tool agent application take into
045: * account the value of this parameter.
046: * </ul>
047: */
048: public String the_mode = null;
049:
050: /**
051: * The value of the parameter - this is a value of a shark variable
052: * if mode of corresponding FormalParameter from XPDL Application Definition
053: * is OUT or IN_OUT, otherwise it is the value of evaluated expression for
054: * the actual parameter in XPDL.
055: */
056: public Object the_value = null;
057:
058: /**
059: * The java class of parameter.
060: */
061: public Class the_class = null;
062:
063: /**
064: * The length of parameter value. This is not used in standard shark kernel
065: * implementation, and it is defined only to stay as close as possible
066: * to WfMC spec.
067: */
068: public long the_length = -1;
069:
070: /**
071: * The type of parameter. This is not used in standard shark kernel
072: * implementation, and it is defined only to stay as close as possible
073: * to WfMC spec.
074: */
075: public long the_type = -1;
076:
077: /**
078: * Creates instance with all object fields initialized to null possible
079: * and primitive type fields to -1.
080: */
081: public AppParameter() {
082: }
083:
084: /**
085: * Creates an instance with fields set to the given parameter values
086: * (the_length and the_type fields are initialize to -1).
087: */
088: public AppParameter(String _the_actual_name,
089: String _the_formal_name, String _the_mode,
090: Object _the_value, Class _the_class) {
091:
092: the_actual_name = _the_actual_name;
093: the_formal_name = _the_formal_name;
094: the_mode = _the_mode;
095: the_value = _the_value;
096: the_class = _the_class;
097: } // ctor
098:
099: /**
100: * Creates an instance with fields set to the given parameter values.
101: */
102: public AppParameter(String _the_actual_name,
103: String _the_formal_name, String _the_mode,
104: Object _the_value, Class _the_class, long _the_length_,
105: long _the_type_) {
106: the_actual_name = _the_actual_name;
107: the_formal_name = _the_formal_name;
108: the_mode = _the_mode;
109: the_value = _the_value;
110: the_class = _the_class;
111: the_length = _the_length_;
112: the_type = _the_type_;
113: } // ctor
114:
115: public String toString() {
116: return "[APN=" + the_actual_name + ", FPN=" + the_formal_name
117: + ", MODE=" + the_mode + ", VAL=" + the_value
118: + ", CLS=" + the_class + ", LNG=" + the_length
119: + ", TYP=" + the_type + "]";
120: }
121: }
|