|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--one.world.core.Tuple
|
+--one.world.io.SioResource
Implementation of a descriptor for a structured I/O
resource. Structured I/O resources can be specified in two ways,
(1) through a descriptor as implemented by this class and (2)
through a structured I/O URL. For convenience, this class
implements a constructor that takes a structured I/O URL and
generates the corresponding descriptor. It also implements a
toString() method that returns a structured I/O URL
corresponding to the structured I/O descriptor represented by an
instance of this class.
Structured I/O URLs describe either tuple storage or the
end-point of a communication channel. With the exception of
relative paths for tuple storage, all structured I/O URLs start
with the "sio:" protocol identifier, followed by
"//". Relative paths start with the name of the first
path segment.
Communication Channels
Structured I/O URLs for communication channels specify either a client or server end-point for a communication channel over TCP or an input-only, output-only, duplex, or multicast end-point for a communication channel over UDP. Structured I/O URLs for communication channels have the following form:
sio://host[:port][?type=<client|server|input|output|
duplex|multicast>
[&local=host[:port]]
[&closure=text]
[&duration=number]]
The type attribute distinguishes between the six
types of communication channel end-points. It may be omitted for
client channels.
The host (and optional port number) for a communication channel
specifies the local host (and port) for server and input channels
and the remote host (and port) for client, output, duplex, and
multicast channels. The local host (and port) for client and output
channels can optionally be specified using the local
attribute. The local host (and port) for duplex channels must be
specified using the local attribute.
If the local host is "localhost" for a server, input, or duplex
channel, the channel will accept connections to any local IP address.
To accept connections at the loopback interface, use "127.0.0.1" for the
local host.
The closure and duration attributes
specify the closure and initial lease duration for communication
channels accepted on a server end-point. The value of the
closure attribute is a string (even though the
descriptor accepts arbitrary objects) and is encoded in the
"x-www-form-urlencoded" MIME format. Both attributes
are optional.
Omitted ports for communication channels are treated as the
default port.
Storage
Structured I/O URLs for storage specify environments. Structured I/O URLs for storage can either be absolute, ID relative, or relative. Absolute and ID relative URLs have the following structure:
sio://[host[:port]]/[path][?type=storage]
Relative URLs have the following structure:
path
Paths are composed of one or more path segments, where each path
segment is the name of an environment, the ID of an environment,
"." for the current environment, or ".."
for the parent environment, followed by a "/". When
parsing structured I/O URLs for storage, path segments that
represent an ID are treated as an ID while all other names (besides
"." and "..") are treated as environment
names.
Paths can be normalized by removing embedded "."
path segments, collapsing "name/.." compound segments,
and removing all segments leading to an ID. The normalized path for
an absolute URL must not contain ".",
"..", or an ID. The normalized path for an ID relative
URL must start with an ID, followed by zero or more
".." path segments, followed by zero or more
environment names. The normalized path for a relative URL either is
"." or consists of zero or more ".." path
segments followed by zero or more environment names.
The type attribute can generally be omitted, though
it must be present for structured I/O URLs of the form
sio://host[:port], because such URLs are otherwise
interpreted as URLs describing client end-points for communication
channels.
Binding Requests and Responses
When using a structured I/O resource descriptor in a binding request, the corresponding binding response returns an event handler for the
structured I/O resource. The types of structured I/O requests
accepted by the returned event handler depend on the type of
structured I/O resource. They are as following:
simple input requests and simple output requests.input requests, output requests, and delete requests.
| Field Summary | |
static int |
CLIENT
The type code for a client end-point of a structured I/O communication channel over TCP. |
Object |
closure
The closure for server end-points. |
static int |
DUPLEX
The type code for a duplex end-point of a structured I/O communication channel over UDP. |
long |
duration
The default lease duration for communication channels accepted on a server end-point. |
Guid |
ident
The environment ID for tuple storage. |
static int |
INPUT
The type code for an input-only end-point of a structured I/O communication channel over UDP. |
String |
localHost
The local host. |
int |
localPort
The local port. |
static int |
MULTICAST
The type code for a multicast end-point of a structured I/O communication channel over UDP. |
static int |
OUTPUT
The type code for an output-only end-point of a structured I/O communication channel over UDP. |
String[] |
path
The path for tuple storage, broken up into individual path segments. |
String |
remoteHost
The remote host. |
int |
remotePort
The remote port. |
static int |
SERVER
The type code for a server end-point of a structured I/O communication channel over TCP. |
static int |
STORAGE
The type code for tuple storage as provided by an environment. |
int |
type
The type of structured I/O resource described by this structured I/O resource descriptor. |
| Fields inherited from class one.world.core.Tuple |
CLOSURE, id, ID, META_DATA, metaData, SOURCE |
| Constructor Summary | |
SioResource()
Create a new, empty structured I/O resource descriptor. |
|
SioResource(String url)
Create a new structured I/O resource descriptor from the specified string specification. |
|
| Method Summary | |
boolean |
isAbsolute()
Determine whether this structured I/O resource descriptor represents an absolute path to tuple storage. |
boolean |
isIdRelative()
Determine whether this structured I/O resource descriptor represents an ID relative path to tuple storage. |
boolean |
isRelative()
Determine whether this structured I/O resource descriptor represents a relative path to tuple storage. |
String |
toString()
Get a structured I/O URL corresponding to this descriptor for a structured I/O resource. |
void |
validate()
Validate this structured I/O resource descriptor. |
static void |
validateHost(String host)
Validate the specified host name. |
static void |
validatePort(int port)
Validate the specified port number. |
| Methods inherited from class one.world.core.Tuple |
clone, containsNonSymbolicHandler, equals, fields, get, getMetaData, getType, hasField, hashCode, hasMetaData, remove, set, setMetaData, wrap |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int STORAGE
public static final int CLIENT
public static final int SERVER
public static final int INPUT
public static final int OUTPUT
public static final int DUPLEX
public static final int MULTICAST
public int type
public Guid ident
public String[] path
/".public String localHost
public int localPort
public String remoteHost
public int remotePort
public Object closure
public long duration
| Constructor Detail |
public SioResource()
public SioResource(String url)
url - The structured I/O URL for the new structured
I/O resource descriptor.IllegalArgumentException - Signals a malformed structured I/O URL.| Method Detail |
public boolean isAbsolute()
true if this structured I/O resource
descriptor represents an absolute path to tuple
storage.public boolean isRelative()
true if this structured I/O resource
descriptor represents a relative path to tuple
storage.public boolean isIdRelative()
true if this structured I/O resource
descriptor represents an ID relative path to
tuple storage.
public void validate()
throws TupleException
validate in class Tupleone.world.core.TupleTupleException - Signals that the tuple is either malformed
(i.e., does not conform to the tuple
specification) or invalid (i.e., does not
conform to the semantic constraints of its
type).MalformedTupleException,
InvalidTupleException,
Type.validate(Class)
public static void validateHost(String host)
throws InvalidTupleException
host - The host.InvalidTupleException - Signals that the specified host is null or
contains an invalid character.
public static void validatePort(int port)
throws InvalidTupleException
port - The port number.InvalidTupleException - Signals that the specified port number is invalid.public String toString()
toString in class Tupleone.world.core.Tuple
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||