com.ibm.mashups.enabler.model.url
Interface ModelUrl
public ModelUrl
Interface representing a model URL. This class should be used by the specific model API's in order to generate a valid model URL. The low level classes like ModelRestServiceRequest expect a request to be made with an implementation of the interface. It also allows an easy way to handle URIs. e.g.
<scheme>:<primaryNode>@<secondaryNode>
scheme-specific part = <primaryNode>@<secondaryNode>
Method Summary |
void |
setNodes(JSONArray nodes)
Sets the nodes of the scheme-specific part. |
void |
setSchemeSpecificPart(String value)
Sets the scheme-specific part of the unerlying URI. |
String |
getSchemeSpecificPart()
Returns the scheme-specific part of the underlying URI. |
void |
addParameter(String name,
String value)
Adds the value of the specified parameter. |
void |
setParameter(String name,
String value)
Sets the value(s) of the specified parameter. |
String |
getParameter(String name)
Returns the value(s) of the specified parameter. |
JSON |
getParameters()
Returns the parameters as an object. |
String |
getAbsoluteURL()
Returns the absolute URL of this object. |
String |
getProxifiedAbsoluteURL()
The same as getAbsoluteURL with the difference that this URL is (if needed) converted to a proxified URL |
String |
getModelURI()
Returns the model URI of this object. |
setNodes
void setNodes(JSONArray nodes)
-
Sets the nodes of the scheme-specific part.
- Parameters:
nodes
-
an array containing the nodes of the scheme-specific part in a JSON notation way.
The ordering of the array elements specifies the position of the node, meaning the array element 0 will become node 1 and so on and so forth.
valid JSON attributes are:
- value
{
String} [mandatory]
- isID
{
boolean} [optional, default: true]
- subModel
{
String} [optional]
example for "nodes":
[
{
value: "100",
isID: false,
subModel: "member"
} ]
setSchemeSpecificPart
void setSchemeSpecificPart(String value)
-
Sets the scheme-specific part of the unerlying URI.
- Parameters:
value
-
the value for the scheme-specifc part. (Must not be null
)
getSchemeSpecificPart
String getSchemeSpecificPart()
-
Returns the scheme-specific part of the underlying URI.
- Returns:
-
the scheme-specific part. If a scheme-specific part was set through
setSchemeSpecificPart
the raw value will be returned. If the SSP was set by using setNodes
, the converted part will be returned. If neither a node nor the raw SSP was set, this method returns null
.
addParameter
void addParameter(String name,
String value)
-
Adds the value of the specified parameter.
- Parameters:
name
-
the name of the parameter; must not be null
.value
-
the value of the parameter. Valid is only a single String. (Must not be null
)
setParameter
void setParameter(String name,
String value)
-
Sets the value(s) of the specified parameter.
- Parameters:
name
-
the name of the parameter; must not be null
.value
-
the value of the parameter. Valid are either a single String or a String array. (Must not be null
)
getParameter
String getParameter(String name)
-
Returns the value(s) of the specified parameter.
- Parameters:
name
-
the name of the parameter; must not be null
.
- Returns:
-
the value(s) of the specified parameter or
null
if the specified parameter wasn't found. In case the parameter has one value the return type is String. For multiple values a String array is returned.
getParameters
JSON getParameters()
-
Returns the parameters as an object. Note: this must be used read-only
- Returns:
-
an object containing all parameters in the format
{
<name>: [<value>, <value>, ... ], ... }
getAbsoluteURL
String getAbsoluteURL()
-
Returns the absolute URL of this object.
- Returns:
-
the absolute URL of this object. e.g.
http: or /contenthandler?uri=acme:id:myid
getProxifiedAbsoluteURL
String getProxifiedAbsoluteURL()
-
The same as
getAbsoluteURL
with the difference that this URL is (if needed) converted to a proxified URL
- Returns:
-
the proxified absolute URL. e.g.
http:
getModelURI
String getModelURI()
-
Returns the model URI of this object. If the complete link is e.g.
/mum/contenthandler?uri=acme:id:myid
, this method will return acme:id:myid
.
- Returns:
-
the URI portion of this Model URL.
Copyright IBM Corp. 2010 All Rights Reserved.