JXTA

net.jxta.share
Class CMS

java.lang.Object
  |
  +--net.jxta.share.CMS

public class CMS
extends java.lang.Object
implements net.jxta.service.Service

This class implements the Content Management Service. The class is started with one of the startApp methods. The command pipe and persistent directory is passed to the startApp method, else default values are used. A remote client interacts with the service by finding the request PipeAdvertisement and sending it LIST and GET requests. The requests are handled by the ListMessageProcessor and GetMessageProcessor.


Field Summary
static java.lang.String ADVERTISEMENT_COUNT
           
static java.lang.String CHUNK_DATA
           
static java.lang.String CHUNK_OFFSET
           
static java.lang.String CHUNK_SIZE
           
static java.lang.String CONTENT_ADVERTISEMENT
           
static java.lang.String CONTENT_ID
           
static java.lang.String CONTENT_LENGTH
           
static java.lang.String DEFAULT_DIR
           
static net.jxta.document.MimeMediaType encodeAs
           
static java.lang.String GET_REQUEST
           
static java.lang.String GET_RESULT
           
static java.lang.String LIST_REQUEST
           
static java.lang.String LIST_RESULT
           
static java.lang.String MESSAGE_TYPE
           
static java.lang.String PIPE_ADV_FILENAME
           
static java.lang.String PIPE_ADV_NAME
           
static java.lang.String PIPE_ADVERTISEMENT
           
static int pipeTimeout
           
static java.lang.String QUERY_SUBSTRING
           
static java.lang.String REQUEST_ID
           
 
Constructor Summary
CMS()
           
 
Method Summary
 net.jxta.document.Advertisement getAdvertisement()
          Returns the advertisment for the service.
 net.jxta.share.ContentManager getContentManager()
          Returns the Content Manager for this service.
 net.jxta.service.Service getInterface()
          Service objects are not manipulated directly to protect usage of the service.
 net.jxta.pipe.Pipe getPipe()
          Returns the pipe service for this group.
 net.jxta.protocol.PipeAdvertisement getRequestPipeAdvertisement()
          Returns the request pipe advertisment for this service.
 void init(net.jxta.peergroup.PeerGroup group, net.jxta.document.Advertisement adv)
          Initialize the application passing it ist peer group handle.
protected static java.lang.String popString(net.jxta.endpoint.Message message, java.lang.String tag)
          Returns the String contained in the given tag in the given Message.
 int startApp(java.io.File dir)
          Start the service with the given parameters.
 int startApp(java.lang.String[] arg)
          Start the service with the given parameters.
 void stopApp()
          Stops the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DIR

public static final java.lang.String DEFAULT_DIR

PIPE_ADV_FILENAME

public static final java.lang.String PIPE_ADV_FILENAME

PIPE_ADV_NAME

public static final java.lang.String PIPE_ADV_NAME

LIST_REQUEST

public static final java.lang.String LIST_REQUEST

LIST_RESULT

public static final java.lang.String LIST_RESULT

GET_REQUEST

public static final java.lang.String GET_REQUEST

GET_RESULT

public static final java.lang.String GET_RESULT

MESSAGE_TYPE

public static final java.lang.String MESSAGE_TYPE

REQUEST_ID

public static final java.lang.String REQUEST_ID

CONTENT_ID

public static final java.lang.String CONTENT_ID

PIPE_ADVERTISEMENT

public static final java.lang.String PIPE_ADVERTISEMENT

CONTENT_ADVERTISEMENT

public static final java.lang.String CONTENT_ADVERTISEMENT

CONTENT_LENGTH

public static final java.lang.String CONTENT_LENGTH

ADVERTISEMENT_COUNT

public static final java.lang.String ADVERTISEMENT_COUNT

CHUNK_OFFSET

public static final java.lang.String CHUNK_OFFSET

CHUNK_SIZE

public static final java.lang.String CHUNK_SIZE

CHUNK_DATA

public static final java.lang.String CHUNK_DATA

QUERY_SUBSTRING

public static final java.lang.String QUERY_SUBSTRING

pipeTimeout

public static int pipeTimeout

encodeAs

public static net.jxta.document.MimeMediaType encodeAs
Constructor Detail

CMS

public CMS()
Method Detail

init

public void init(net.jxta.peergroup.PeerGroup group,
                 net.jxta.document.Advertisement adv)
          throws net.jxta.exception.PeerGroupException
Initialize the application passing it ist peer group handle.
Parameters:
group - PeerGroup this application is started from
Throws:
net.jxta.exception.PeerGroupException - failure to initialize the peer group application
Since:
JXTA 1.0

startApp

public int startApp(java.lang.String[] arg)
Start the service with the given parameters. The parameters are in the form of name=value pairs. There is one optional parameter, the directory for storing persistent data about the shared content.
Parameters:
arg - String[] of parameters
Returns:
int status indication. 0 if ok, -1 if error

startApp

public int startApp(java.io.File dir)
Start the service with the given parameters.
Parameters:
rPipeAdv - PipeAdvertisement of the request pipe
cmsDir - File pointing to the persistence directory
Returns:
int status indication. 0 if ok, -1 if error.

stopApp

public void stopApp()
Stops the service

getInterface

public net.jxta.service.Service getInterface()
Service objects are not manipulated directly to protect usage of the service. A Service interface is returned to access the service methods.
Specified by:
getInterface in interface net.jxta.service.Service
Returns:
Service public interface of the service
Since:
JXTA 1.0

getAdvertisement

public net.jxta.document.Advertisement getAdvertisement()
Returns the advertisment for the service.
Specified by:
getAdvertisement in interface net.jxta.service.Service
Returns:
Advertisement the advertisement.
Since:
JXTA 1.0

getPipe

public net.jxta.pipe.Pipe getPipe()
Returns the pipe service for this group.
Returns:
Pipe the pipe service.
Since:
JXTA 1.0

getRequestPipeAdvertisement

public net.jxta.protocol.PipeAdvertisement getRequestPipeAdvertisement()
Returns the request pipe advertisment for this service.
Returns:
PipeAdvertisement the request pipe advertisement.
Since:
JXTA 1.0

getContentManager

public net.jxta.share.ContentManager getContentManager()
Returns the Content Manager for this service.
Returns:
ContentManager the Content Manager.
Since:
JXTA 1.0

popString

protected static java.lang.String popString(net.jxta.endpoint.Message message,
                                            java.lang.String tag)
                                     throws java.io.IOException
Returns the String contained in the given tag in the given Message.
Returns:
String from given tag in given message.
Since:
JXTA 1.0

JXTA