![]() |
|||
| |||
|
SpaceKit for Java, page 8
1 Introduction
2 The Blocks SpaceKit for Java Client
3 Connecting and Channel Creation
4 Client Examples
5 The Blocks SpaceKit for Java Server: SpaceBxxd
6 SpaceBxxd - Responses
7 Localization Class Structure and Utilities
» Reference
this article in RFC-2629 formats Reference
SpaceAuthenticatorSasl constructor SpaceAuthenticatorSasl(String profile)
Valid profiles include:
http://xml.resource.org/profiles/sasl/ANONYMOUS
http://xml.resource.org/profiles/SEP
http://xml.resource.org/profiles/NULL/ECHO
http://xml.resource.org/profiles/NULL/SINK
http://xml.resource.org/profiles/sasl/OTP
String getProfile
()
Get the profile associated with the authenticator.
String getRequest
()
Get the SEP request used to create the channel.
String getResponse(SpaceResponse response)
Get the necessary response to the response returned from getRequest().
String set(String key,String value)
Set a key-value pair used by getRequest() and getResponse().
SpaceChannel void free(SpaceResponse response)
Free a response.
int getChannel
()
Get the channel number.
boolean getError
()
Get if channel error.
int getErrorCode
()
Get the most recent error code.
String getErrorCodeString
()
Get the most recent error code string.
String getErrorString
()
Get the most recent error description.
String getMime
()
Get the MIME type of the last response on the channel.
String getProfile
()
Get the channel profile.
long getSeqno
()
Get the channel seqno.
boolean getStarted
()
Get if the channel has been started.
boolean isError
()
Get if an error has occurred on the channel.
boolean isNotStarted
()
Get if the channel has not been started.
boolean isStarted
()
Get if the channel has been started.
SpaceResponse request(String request) throws SpaceTimeout,SpaceException
SpaceResponse request(String request,boolean wait) throws SpaceTimeout,SpaceException
Send a request with optional wait.
SpaceResponse respond(String request) throws SpaceTimeout,SpaceException
SpaceResponse respond(String request,boolean wait) throws SpaceTimeout,SpaceException
Send a response with optional wait. A "respond" is the same as a "request" without the "<request reqno=’n’>…</request>" tags. It is used to respond to a SASL OTP challenge.
SpaceConfig constructor SpaceConfig
()
String get(String key)
Get the configuration parameter using the supplied key.
String getGreeting
()
Get the greeting response associated with the configuration.
SpaceProfile getProfile(String uri)
Get the profile associated with the supplied uri.
void set(String key,String value)
Set the configuration parameter using the supplied key-value pair.
SpaceException constructor SpaceException
()
constructor SpaceException(String message)
SpaceLog static int error = 0
static int debug1 = 1
static int debug2 = 2
static int debug3 = 3
static int debug4 = 4
static int notify = 5
static int fatal = 6
static int info = 7
static int stats = 8
static int system = 9
static int user = 10
constructor SpaceLog
()
constructor SpaceLog(SpaceConfig config,int port)
void println(String message)
Append a message to the log.
void println(int level,String message)
Append a message to the log.
void println(int level,String message,SpacePacket packet)
Append a message to the log. Note that a SpacePacket is the super-class of both SpaceRequest and SpaceResponse.
SpaceMessage static String get(int errorCode)
Returns the textual version of the specified error code. Known codes are:
421 = "service not available"
450 = "requested action not taken"
451 = "requested action aborted"
454 = "temporary authentication failure"
500 = "general syntax error"
501 = "syntax error in parameters"
504 = "parameter not implemented"
530 = "authentication required"
534 = "authentication mechanism insufficient"
535 = "authentication failure"
537 = "action not authorized for user"
538 = "authentication mechanism requires encryption"
550 = "requested action not taken"
553 = "parameter invalid"
554 = "transaction failed"
SpaceModuleThread void error(int errorCode)
Respond with an error and a standard error code.
void error(int errorCode,String errorString)
Respond with an error and a supplied error code and error string.
void fatal(Exception e)
Respond with a fatal error in a catch clause.
String get(String key)
Get a channel parameter value.
SpaceChannel getChannel
()
Get the requesting channel.
String getFromChannelZero(String key)
Get a channel parameter value from channel zero.
String getFromStartChannel(String key)
Get a channel parameter value from the start channel.
int getSerial
()
Get the requesting serial number.
SpaceConfig getConfig
()
Get the module configuration.
String getUser(String authenticator,String name)
Get the specified user property value.
SpaceUserCache getUserCache
()
Get the module user cache.
boolean isStart
()
See if the request is a start channel request.
void loadUser
()
Load the user properties for the port if not already loaded.
void log(String message)
Log a message with the SpaceLog.info level.
void log(int level,String message)
Log a message with the specified level.
void respond(String payload)
Respond with a normal supplied response.
void run
()
The thread run()
method. Overridden by the module.
void set(String key,String value)
Set a channel parameter value.
void setOnChannelZero(String key,String value)
Set a channel parameter value on channel zero.
void setOnStartChannel(String key,String value)
Set a channel parameter value on the start channel
void start(String payload)
Respond to a start channel request.
SpacePacket constructor SpacePacket(SpaceChannel channel,int serial)
void free
()
Free the packet by marking the content null.
String getChallengeString
()
throws SpaceExceptionGet the challenge text. First check if isChallenge()
== true.
int getChannel
()
Get the channel number from the channel associated with the packet.
boolean getError
()
Get if an error has occurred on the channel associated with the packet.
int getErrorCode
()
Get the most recent error code from the channel associated with the packet.
String getErrorCodeString
()
Get the most recent error code string from the channel associated with the packet.
String getErrorString
()
Get the most recent error description from the channel associated with the packet.
String getFeatures
()
Get the features associated with the connection
int getFrameCount
()
Get the current number of frames making up the packet.
InputStream getInputStream
()
Get the input stream of the current content. Used as input for XML parsers.
String getLocalize
()
Get the localization associated with the connection
String getMime
()
Get the MIME type of the last packet on the channel associated with the packet.
String getNames
()
Get the names from the root level of each block in the packet (must parse()
first).
String getProfile
()
Get the channel profile from the channel associated with the packet.
String
[]
getProfiles()
Get the profiles associated with the connection
long getSeqno
()
Get the channel seqno from the channel associated with the packet.
int getSerial
()
Get the serial associated with the packet.
boolean isChallenge
()
throws SpaceExceptionIs this response an authentication challenge?
boolean isComplete
()
Is this packet complete?
boolean isError
()
Has an error occurred or been found by parsing the response?
boolean isIncomplete
()
Is this response incomplete?
int length
()
Returns the length in bytes of the current packet content.
void parse
()
throws SpaceExceptionParse the current response content for errors and challenges.
String toString
()
Convert the entire packet content to a String.
SpaceProfile static String sep = "http://xml.resource.org/profiles/SEP"
static String tls = "http://xml.resource.org/profiles/TLS"
static String saslAnonymous = "http://xml.resource.org/profiles/sasl/ANONYMOUS"
static String saslOtp = "http://xml.resource.org/profiles/sasl/OTP"
static String saslExternal = "http://xml.resource.org/profiles/sasl/EXTERNAL"
static String nullEcho = "http://xml.resource.org/profiles/NULL/ECHO"
static String nullSink = "http://xml.resource.org/profiles/NULL/SINK"
constructor SpaceProfile(String uriArg)
void set(String key,String value)
Set a profile parameter with the supplied key-value pair.
String get(String key)
Get a profile parameter value with the supplied key.
String getUri
()
Get the URI associated with the profile.
SpaceResponse extends SpacePacket constructor SpaceResponse(SpaceChannel channel,int serial)
SpaceResponseHeader getResponseHeader
()
Get the header associated with the response.
SpaceRequest extends SpacePacket constructor SpaceRequest(SpaceChannel channel,int serial)
SpaceRequestHeader getRequestHeader
()
Get the header associated with the request.
SpaceRequest extends SpaceSep static String fetch(String subtree)
static String fetch(String subtree,String element)
Create a SEP fetch request with the subtree name and optional element.static String lock(String subtree)
Create a SEP lock subtree request.static String release(int prevno)
static String release(int prevno,String action)
Create a SEP release subtree request with prevno and optional action. Valid contents for action are commit (which is the default) and rollback.static String store(String blockname,String action,String serial,String blockcontent)
Create a SEP store request. Valid contents for action are create, update, write or delete.
SpaceServer constructor SpaceServer
()
throws SpaceExceptionvoid close
()
Close the connection. This is best done in a finally clause within the same class as the connection creator.SpaceResponse connect
()
throws SpaceTimeout,SpaceExceptionSpaceResponse connect(boolean wait) throws SpaceTimeout,SpaceException
SpaceResponse connect(String localize) throws SpaceTimeout,SpaceException
SpaceResponse connect(String localize,boolean wait) throws SpaceTimeout,SpaceException
Connect to the server as defined by the class host and port. The default port number is 10288.void free(SpaceResponse response)
Free a response by removing it from the response queue.String getHost
()
Get the host name for the connection.int getPort
()
Get the port number for the connection.SpaceResponse request(SpaceChannel channel,String request) throws SpaceTimeout,SpaceException
SpaceResponse request(SpaceChannel channel,String request,boolean wait) throws SpaceTimeout,SpaceException
Send a request on the specified channel with optional wait.SpaceResponse respond(SpaceChannel channel,String request) throws SpaceTimeout,SpaceException
SpaceResponse respond(SpaceChannel channel,String request,boolean wait) throws SpaceTimeout,SpaceException
Send a response on the specified channel with optional wait. A "respond" is the same as a "request" without the "<request reqno=’n’>…</request>" tags. It is used to respond to a SASL OTP challenge.void setHost(String value)
Set the host name for the connection prior to connect()
.void setPort(int value)
Set the port for the connection prior to connect()
.void setTimeout(int value) throws SpaceException
Set the socket read timeout value in milliseconds prior to connect. Default is 600000 (10 minutes).void setTrace(boolean value)
Set if tracing should be output to System.err.SpaceResponse start(SpaceChannel channel) throws SpaceTimeout,SpaceException
SpaceResponse start(SpaceChannel channel,boolean wait) throws SpaceTimeout,SpaceException
Start a channel on the specified channel with an optional wait.void trace
()
Output a trace frame to System.err.SpaceResponse wait(SpaceResponse response) throws SpaceException
SpaceResponse wait(SpaceResponse response,long timeout) throws SpaceException
Wait for a response to be complete with optional timeout in milliseconds.
SpaceSocket WARNING: The SpaceSocket class is for low-level access to the socket used by SpaceServer. This class should not be called directly when combined with the SpaceServer class. This is a utility class for writing your own driver.
static int defaultTimeout = 600000; //10 minutes
constructor SpaceSocket
()
void close
()
Close the socket.void connect
()
throws SpaceExceptionConnect using the current settings.boolean getDebug
()
Get current debug setting.String getHost
()
Get host name for the socket.int getPort
()
Get the port number for the socket (default is SpaceSocket.defaultTimeout).String read
()
throws SpaceTimeout,SpaceExceptionRead a line from the socket.int read(SpaceResponse response,int size) throws SpaceTimeout,SpaceException
Read a specified number of bytes from the socket into the supplied response.void setDebug(boolean value)
Set the debug setting.void setHost(String value)
Set the host name prior to connect()
.void setPort(int value)
Set the port number prior to connect()
.void setTimeout(int value) throws SpaceException
Set the read timeout value for the socket (default is SpaceSocket.defaultTimeout).void write(String string) throws SpaceException
Write the String to the socket.
SpaceTimeout constructor SpaceTimeout
()
constructor SpaceTimeout(String message)
SpaceUserCache constructor SpaceUserCache
()
String get(String name)
Get an element using the already set authenticator and class.String get(String propertyClass,String name)
Get an element using the already set class.String get(String authenticator,String propertyClass,String name)
Get the specified element.void load(SpaceConfig config,SpaceProfile profile)
Load the user cache as specified by the configuration and profile.void setAuthenticator(String value)
Set the authenticator used by the get()
methods.void setPropertyClass(String value)
Set the property class used by the get()
methods.void store(SpaceConfig config,SpaceProfile profile)
Store the user configuration to the pathname supplied in the configuration.
End - Return to» Introduction.
Copyright © 2000 Invisible Worlds. All Rights Reserved.
![]() |
|||
|