public abstract class OperationCommons extends AttributableSupport implements OperationDescription
Operations and DefaultEventSources within
the JMEDS framework. It contains all common properties for WSDL 1.1 compliant operations. It is
further used to declare an operation's or event's input and output parameters as well as any faults that may occur on
invocation. Overall in this class' documentation, the term "operation" is used
to mean either an actual operation or an event.
Note: According to WSDL 1.1
Specification, an operation's name is not required to be unique within the
scope of its containing port type in order to support overloading. However, when overloading
operations, the combination of each one's name, input
name and output name must be unique in order to avoid name clashes.
| Modifier and Type | Field and Description |
|---|---|
protected Attributable |
inputAttributable |
protected Attributable |
outputAttributable |
protected int |
type |
attributes| Modifier | Constructor and Description |
|---|---|
protected |
OperationCommons(java.lang.String name,
QName portType)
Creates a new instance with the given name and port type.
|
protected |
OperationCommons(WSDLOperation operation) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCustomComplexType(ComplexType type)
This method adds a custom
xsd:ComplexType to the operation. |
void |
addFault(Fault fault)
Adds the given
fault to this operation. |
void |
addInputParameter(java.lang.String parameterName,
Type type)
Adds an input parameter with the given
parameterName and of the specified
type to this operation. |
void |
addOutputParameter(java.lang.String parameterName,
Type type)
Adds an output parameter with the given
parameterName and of the specified
type to this operation. |
void |
clearCustomComplexTypes()
Clears the list of custom types.
|
ParameterValue |
createFaultValue(java.lang.String faultName)
This method creates a
parameter value container for the fault with the
given unique faultName (within the scope of this operation). |
ParameterValue |
createFaultValue(java.lang.String faultName,
Type instanceType)
This method creates a
parameter value container for the fault with the
given unique faultName (within the scope of this operation). |
ParameterValue |
createInputValue()
This is a shorthand method for creating a
parameter value container for
the input of this operation. |
ParameterValue |
createInputValue(Type instanceType)
This is a shorthand method for creating a
ParameterValue container for
the input of this operation. |
ParameterValue |
createOutputValue()
This is a shorthand method for creating a
parameter value container for
the output of this operation. |
ParameterValue |
createOutputValue(Type instanceType)
This is a shorthand method for creating a
parameter value container for
the output of this operation. |
boolean |
equals(java.lang.Object obj) |
Iterator |
getCustomComplexTypes()
Returns an iterator containing
ComplexType. |
Fault |
getFault(java.lang.String faultName)
Returns this operation's fault with the given
faultName, which is considered to be
unique within the operation's scope. |
CustomAttributeValue |
getFaultAttribute(java.lang.String faultName,
QName attributeName)
Returns the value of the fault attribute with the given
name for the fault with
the specified unique faultName or null, either if this attribute is
not available (or if its value is actually explicitly set to null). |
HashMap |
getFaultAttributes(java.lang.String faultName)
Returns all fault attributes explicitly set on this instance for the fault with the given
unique
faultName. |
int |
getFaultCount()
Returns the number of declared faults for this operation.
|
Iterator |
getFaults()
Returns an
Iterator over all faults declared for this operation. |
Element |
getInput()
Returns the input element of this operation.
|
java.lang.String |
getInputAction()
Returns the WS-Addressing [action] property for the input message of this operation.
|
CustomAttributeValue |
getInputAttribute(QName attributeName)
Returns the value of the input attribute with the given
name or null
if this attribute is not available (or if its value is explicitly set to null). |
HashMap |
getInputAttributes()
Returns all input attributes explicitly set on this instance.
|
java.lang.String |
getInputName()
Returns the name of this operation's input.
|
Element |
getInputParameter(java.lang.String parameterName)
Returns the input parameter for the given parameter name.
|
java.lang.String |
getName()
Returns the local name of this operation.
|
java.lang.String |
getNameQuallified() |
Element |
getOutput()
Returns the output element of this operation.
|
java.lang.String |
getOutputAction()
Returns the WS-Addressing [action] property for the output message of this operation.
|
CustomAttributeValue |
getOutputAttribute(QName attributeName)
Returns the value of the output attribute with the given
name or null
, if this attribute is not available (or if its value is actually explicitly set to null
). |
HashMap |
getOutputAttributes()
Returns all output attributes explicitly set on this instance.
|
java.lang.String |
getOutputName()
Returns the name of this operation's output.
|
Element |
getOutputParameter(java.lang.String parameterName)
Return the output parameter for given parameter name.
|
QName |
getPortType()
Returns the port type that this operation belongs to.
|
Service |
getService()
Returns the service to which this operation is associated.
|
abstract int |
getType()
Returns the
transmission type of this operation according to WSDL 1.1 specification. |
boolean |
hasFaultAttributes(java.lang.String faultName)
Returns
true only if this instance has at least one fault attribute set for the
fault with the specified unique faultName. |
int |
hashCode() |
boolean |
hasInputAttributes()
Returns
true only if this instance has at least one input attribute set. |
boolean |
hasOutputAttributes()
Returns
true only if this instance has at least one output attribute set. |
boolean |
isInputActionSet() |
boolean |
isInputNameSet() |
boolean |
isOutputActionSet() |
boolean |
isOutputNameSet() |
void |
removeCustomComplexType(ComplexType type)
Remove a given custom
xsd:ComplexType from the operation. |
void |
removeFault(java.lang.String faultName)
Removes the fault with the given
faultName from this operation. |
void |
setFaultAttribute(java.lang.String faultName,
QName attributeName,
CustomAttributeValue value)
Sets the
value for the fault attribute with the specified name of the
fault with the given unique faultName. |
void |
setFaultAttributes(java.lang.String faultName,
HashMap attributes)
Sets at once all fault attributes of the fault with unique
faultName to those
contained within argument attributes. |
void |
setInput(Element element)
Sets the input of this operation.
|
void |
setInputAction(java.lang.String inputAction)
Sets the WS-Addressing [action] property for this operation's input message
|
void |
setInputAttribute(QName attributeName,
CustomAttributeValue value)
Sets the
value for the input attribute with the specified name. |
void |
setInputAttributes(HashMap attributes)
Sets all input attributes at once to those contained within argument
attributes. |
void |
setInputName(java.lang.String inputName)
Sets the name of this operation's input.
|
void |
setInputNameInternal(java.lang.String inputName)
This method doesn't toggle the inputNameSet flag
|
void |
setOutput(Element element)
Sets the output of this operation.
|
void |
setOutputAction(java.lang.String outputAction)
Sets the WS-Addressing [action] property for this operation's output message.
|
void |
setOutputAttribute(QName attributeName,
CustomAttributeValue value)
Sets the
value of the output attribute with the specified name. |
void |
setOutputAttributes(HashMap attributes)
Sets all output attributes at once to those contained within argument
attributes. |
void |
setOutputName(java.lang.String outputName)
Sets the name of this operation's output.
|
void |
setOutputNameInternal(java.lang.String outputName)
This method doesn't toggle the outputNameSet flag
|
void |
setService(Service service) |
java.lang.String |
toString() |
getAttribute, getAttributes, hasAttributes, serializeAttributes, setAttribute, setAttribute, setAttributesprotected int type
protected Attributable inputAttributable
protected Attributable outputAttributable
protected OperationCommons(java.lang.String name,
QName portType)
name - the name of the operation, must be unique within the scope of its port typeportType - the qualified port typeprotected OperationCommons(WSDLOperation operation)
public java.lang.String toString()
toString in class AttributableSupportpublic final boolean equals(java.lang.Object obj)
equals in class AttributableSupportpublic final int hashCode()
hashCode in class AttributableSupportpublic java.lang.String getName()
note on overloading
operations.getName in interface OperationDescriptionpublic java.lang.String getNameQuallified()
public QName getPortType()
getPortType in interface OperationDescriptionpublic abstract int getType()
transmission type of this operation according to WSDL 1.1 specification. The value returned is one of
WSDLOperation.TYPE_ONE_WAY, WSDLOperation.TYPE_REQUEST_RESPONSE, WSDLOperation.TYPE_NOTIFICATION and WSDLOperation.TYPE_SOLICIT_RESPONSE.getType in interface OperationDescriptionpublic java.lang.String getInputName()
transmission type is WSDLOperation.TYPE_NOTIFICATION, null
is returned. Otherwise, if no input name was previously set, a default input name is generated according to WSDL 1.1 Specification.getInputName in interface OperationDescriptionsetInputName(String)public void setInputName(java.lang.String inputName)
note on overloading
operations.inputName - the new input name to setWS4DIllegalStateException - if this instance is already added to a servicegetInputName()public java.lang.String getInputAction()
null only if this operation's transmission type is
WSDLOperation.TYPE_NOTIFICATION, i.e. the operation doesn't have any input. Otherwise,
if no input action was explicitly set, this method will
generate a default one according to the rules of WS-Addressing 1.0 - WSDL Binding.getInputAction in interface OperationDescriptionsetInputAction(String)public void setInputAction(java.lang.String inputAction)
inputAction - the new [action] to set; must be an absolute URIWS4DIllegalStateException - if this instance is already added to a servicegetInputAction()public java.lang.String getOutputName()
transmission type is WSDLOperation.TYPE_ONE_WAY, null
is returned. Otherwise, if no output name was previously set a default output name is generated according to WSDL 1.1 Specification.getOutputName in interface OperationDescriptionsetOutputName(String)public void setOutputName(java.lang.String outputName)
note on overloading
operations.outputName - the new output name to setWS4DIllegalStateException - if this instance is already added to a servicegetOutputName()public java.lang.String getOutputAction()
null only if this operation's transmission type is
WSDLOperation.TYPE_ONE_WAY, i.e. the operation doesn't have any output. Otherwise, if
no output action is explicitly set, this method will generate a
default one according to the rules of WS-Addressing 1.0 - WSDL Binding.getOutputAction in interface OperationDescriptionsetOutputAction(String)public void setOutputAction(java.lang.String outputAction)
outputAction - the new [action] to set; must be an absolute URIWS4DIllegalStateException - if this instance has already been added to a servicegetOutputAction()public Element getInput()
create a
suitable ParameterValue container for the actual values when sending messages to the
operation.getInput in interface OperationDescriptionsetInput(Element)public void setInput(Element element)
element - the input elementgetInput()public Element getInputParameter(java.lang.String parameterName)
parameterName - public void addInputParameter(java.lang.String parameterName,
Type type)
parameterName and of the specified
type to this operation. This method creates a wrapper element of a complex type with a single top-most container of type ComplexType.CONTAINER_SEQUENCE
and uses this as input of the operation. The wrapper element's name is
equal to this operation's name. This conforms to the document-literal
wrapped style binding for SOAP 1.2. The new parameter is then appended to the end of the
sequence container of the wrapper element.
NOTE: Using this method is only possible when the input element for this
operation was NOT previously set by a call to setInput(Element). Otherwise,
this method will throw a WS4DIllegalStateException.
parameterName - the name of the input parameter to addtype - the type for the new input parameterWS4DIllegalStateException - if an input element was previously set on this operationpublic Element getOutput()
create
a suitable ParameterValue container for the actual values an operation returns.getOutput in interface OperationDescriptionsetOutput(Element)public void setOutput(Element element)
element - the output elementgetOutput()public Element getOutputParameter(java.lang.String parameterName)
parameterName - public void addOutputParameter(java.lang.String parameterName,
Type type)
parameterName and of the specified
type to this operation. This method creates a wrapper element of a complex type with a single top-most container of type ComplexType.CONTAINER_SEQUENCE
and uses this as output of the operation. The wrapper element's name is
equal to this operation's name with a 'Response' suffix appended to it. This
conforms to the document-literal
wrapped style binding for SOAP 1.2. The new parameter is then appended to the end of the
sequence container of the wrapper element.
NOTE: Using this method is only possible when the output element for this
operation was NOT previously set by a call to setOutput(Element). Otherwise,
this method will throw a WS4DIllegalStateException.
parameterName - the name of the output parameter to addtype - the type for the new output parameterWS4DIllegalStateException - if an output element was previously set on this operationpublic Iterator getFaults()
Iterator over all faults declared for this operation.getFaults in interface OperationDescriptionaddFault(Fault)public int getFaultCount()
OperationDescriptiongetFaultCount in interface OperationDescriptionpublic Fault getFault(java.lang.String faultName)
faultName, which is considered to be
unique within the operation's scope.getFault in interface OperationDescriptionfaultName - the requested fault's namenull if there is no fault with that name within this
operationaddFault(Fault),
getFaults()public void addFault(Fault fault)
fault to this operation.
A fault on a web service operation corresponds to a checked declared exception on a Java
method. If an operation's invocation causes a fault,
the invoking client will receive an InvocationException providing additional
information about this fault.
fault - the fault to addjava.lang.NullPointerException - if fault is nulljava.lang.IllegalArgumentException - if a fault with the given name already exists, as fault names must be unique within the scope of an
operationgetFaults(),
getFault(String)public void removeFault(java.lang.String faultName)
faultName from this operation.faultName - the name of the fault to removeaddFault(Fault),
getFault(String)public ParameterValue createOutputValue()
parameter value container for
the output of this operation. It is semantically equivalent to
ParameterValue.createElementValue(getOutput());createOutputValue in interface OperationDescriptiongetOutput(),
ParameterValueManagement.createElementValue(Element)public ParameterValue createOutputValue(Type instanceType)
parameter value container for
the output of this operation. It is semantically equivalent to
ParameterValue.createElementValue(getOutput(), instanceType);
It is intended to be used with instanceType being a subtype of the type defined for output value.
instanceType - type of the ParameterValue returned by this methodgetOutput(),
ParameterValueManagement.createElementValue(Element)public ParameterValue createInputValue()
parameter value container for
the input of this operation. It is semantically equivalent to
ParameterValue.createElementValue(getInput());createInputValue in interface OperationDescriptiongetInput(),
ParameterValueManagement.createElementValue(Element)public ParameterValue createInputValue(Type instanceType)
ParameterValue container for
the input of this operation. It is semantically equivalent to
ParameterValue.createElementValue(getInput(), instanceType);
It is intended to be used with instanceType being a subtype of the type defined for input value.
instanceType - type of the ParameterValue returned by this methodgetInput(),
ParameterValueManagement.createElementValue(Element)public ParameterValue createFaultValue(java.lang.String faultName)
parameter value container for the fault with the
given unique faultName (within the scope of this operation).createFaultValue in interface OperationDescriptionfaultName - the name of the fault to create a parameter container forjava.util.NoSuchElementException - if a fault with the given name is not declared within this operationgetFault(String)public ParameterValue createFaultValue(java.lang.String faultName, Type instanceType)
parameter value container for the fault with the
given unique faultName (within the scope of this operation).
It is intended to be used with instanceType being a subtype of the type defined for the fault value.
faultName - the name of the fault to create a parameter container forinstanceType - type of the ParameterValue returned by this methodjava.util.NoSuchElementException - if a fault with the given name is not declared within this operationgetFault(String)public Service getService()
null, if
this operation has yet not been added to a particular service.getService in interface OperationDescriptionpublic void setService(Service service)
service - the service to setpublic CustomAttributeValue getInputAttribute(QName attributeName)
name or null
if this attribute is not available (or if its value is explicitly set to null).attributeName - the name of the input attribute of which to query the valuenullpublic void setInputAttribute(QName attributeName, CustomAttributeValue value)
value for the input attribute with the specified name.
Throws a java.lang.IllegalArgumentException in case name is
null.attributeName - the name of the input attribute to set, must not be nullvalue - the value to which to set the named input attribute (may be nulljava.lang.IllegalArgumentException - if name is nullpublic HashMap getInputAttributes()
public void setInputAttributes(HashMap attributes)
attributes.
Note that depending on the actual implementation it is possible that the map attributes
points at may be used for the actual internal storage of the input attributes (i.e.
without copying it). This is why, after passing it to this method, modifications to this map
should be made with care . This method throws a java.lang.IllegalArgumentException
in case attributes is null.attributes - the new input attributes to setjava.lang.IllegalArgumentException - if attributes is nullpublic boolean hasInputAttributes()
true only if this instance has at least one input attribute set. Returns
false in any other case.true only if there is at least one input attribute set within this instancepublic CustomAttributeValue getOutputAttribute(QName attributeName)
name or null
, if this attribute is not available (or if its value is actually explicitly set to null
).attributeName - the name of the output attribute to query the value ofnullpublic void setOutputAttribute(QName attributeName, CustomAttributeValue value)
value of the output attribute with the specified name.
Throws a java.lang.IllegalArgumentException in case name is
null.attributeName - the name of the output attribute to set, must not be nullvalue - the value to set the named output attribute to (may be nulljava.lang.IllegalArgumentException - if name is nullpublic HashMap getOutputAttributes()
public void setOutputAttributes(HashMap attributes)
attributes.
Note that depending on the actual implementation it is possible that the map attributes
points at may be used for the actual internal storage of the output attributes (i.e.
without copying it). That is why modifications to this map should be made with care after
passing it to this method. This method throws a java.lang.IllegalArgumentException
in case attributes is null.attributes - the new output attributes to setjava.lang.IllegalArgumentException - if attributes is nullpublic boolean hasOutputAttributes()
true only if this instance has at least one output attribute set. Returns
false in any other case.true only if there is at least one output attribute set within this instancepublic CustomAttributeValue getFaultAttribute(java.lang.String faultName, QName attributeName)
name for the fault with
the specified unique faultName or null, either if this attribute is
not available (or if its value is actually explicitly set to null).
This method throws a java.lang.IllegalArgumentException if a fault with the
given faultName is not found within this instance.
faultName - the unique name of the fault within the scope of this instance, see getFault(String)attributeName - the name of the fault attribute to query the value ofnulljava.lang.IllegalArgumentException - if no fault with the given faultName is foundpublic void setFaultAttribute(java.lang.String faultName,
QName attributeName,
CustomAttributeValue value)
value for the fault attribute with the specified name of the
fault with the given unique faultName. Throws a
java.lang.IllegalArgumentException in case there is no fault with the given
faultName within this instance or if name is null.faultName - the unique name of the fault within the scope of this instance, see getFault(String)attributeName - the name of the fault attribute to set, must not be nullvalue - the value to set the named fault attribute to (may be nulljava.lang.IllegalArgumentException - if there is no fault with the given faultName within this instance or if name
is nullpublic HashMap getFaultAttributes(java.lang.String faultName)
faultName. Note that depending on the actual implementation the returned
reference may point at the 'life map', i .e. the actual storage for the fault attributes. Thus,
modifications to that map should be performed with care and keeping this in mind.
This method throws a java.lang.IllegalArgumentException if a fault with the
given faultName is not found within this instance.
faultName - the unique name of the fault within the scope of this instance, see getFault(String)java.lang.IllegalArgumentException - if no fault with the given faultName is foundpublic void setFaultAttributes(java.lang.String faultName,
HashMap attributes)
faultName to those
contained within argument attributes. Note that depending on the actual
implementation, it is possible that the map attributes points at may be used for
the actual internal storage of the fault attributes (i.e. without copying it). That is why,
after passing it to this method, modifications to this map should be made with care. This
method throws a java.lang.IllegalArgumentException in case attributes
is null.faultName - the unique name of the fault within the scope of this instance, see getFault(String)attributes - the new fault attributes to setjava.lang.IllegalArgumentException - if no fault with the given faultName is found or if attributes is
nullpublic boolean hasFaultAttributes(java.lang.String faultName)
true only if this instance has at least one fault attribute set for the
fault with the specified unique faultName. Returns false in any other
case, including when there is no fault with the given faultName.faultName - the unique name of the fault within the scope of this instance, see getFault(String)true only if there is at least one fault attribute set for the named fault within this
instancepublic void setInputNameInternal(java.lang.String inputName)
inputName - public void setOutputNameInternal(java.lang.String outputName)
outputName - public boolean isInputNameSet()
public boolean isInputActionSet()
public boolean isOutputNameSet()
public boolean isOutputActionSet()
public void addCustomComplexType(ComplexType type)
xsd:ComplexType to the operation. This custom type will
be serialized in the WSDL document.
Do not add custom types with the same name as the types used for input or output definitions. This may overwrite the normal definitions.
The added custom type MUST have a valid name. If no name is set, this
method will throw an RuntimeException.
type - the custom type which should be add to the WSDL document.public void removeCustomComplexType(ComplexType type)
xsd:ComplexType from the operation.type - the custom type which should be removed.addCustomComplexType(ComplexType)public void clearCustomComplexTypes()
addCustomComplexType(ComplexType)public Iterator getCustomComplexTypes()
ComplexType. This list contains the custom types set for
this operation.ComplexType.addCustomComplexType(ComplexType)