ch.epfl.lsr.apex
Class APEXProfile

java.lang.Object
  extended bych.epfl.lsr.apex.APEXProfile
All Implemented Interfaces:
Profile, RequestHandler, StartChannelListener

public class APEXProfile
extends Object
implements Profile, StartChannelListener, RequestHandler

The PCApexProfile handles incoming messages from the underlying BEEP protocol.
It is responsible for channel creation as well as channel listening.

Author:
Marc Stoecklin

Field Summary
static String URI
          Profile URI of APEX: http://iana.org/beep/APEX
 
Constructor Summary
APEXProfile(APEXManager manager, Object channelID)
          Instantiates a APEXProfile with an associated APEXManager for call backs and a channel identifier for later message association.
 
Method Summary
 boolean advertiseProfile(Session session)
           
 void closeChannel(Channel channel)
           
static String getURI()
          Returns the URI of the APEX profile
 StartChannelListener init(String uri, ProfileConfiguration profileConfig)
           
static Hashtable[] parseServiceConfigFile(APEXManager manager, String configConfigurationFile)
          Parses the service configuration file an creates ab array of Hashtables (2 elements) to store the service handlers and the service priorities.
 void receiveMSG(MessageMSG message)
           Is called on incoming messages: parses the MessageMSG to an APEXMessage calls the manager's handleIncomingMessage method On a processing error, a error reply APEX.STATUS_GENERAL_SYNTAX_ERROR is sent to the originator of the incoming message.
 void startChannel(Channel channel, String encoding, String data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URI

public static final String URI
Profile URI of APEX: http://iana.org/beep/APEX

See Also:
Constant Field Values
Constructor Detail

APEXProfile

public APEXProfile(APEXManager manager,
                   Object channelID)
Instantiates a APEXProfile with an associated APEXManager for call backs and a channel identifier for later message association.

Parameters:
manager - The APEXManager
channelID - A channel identifier
Method Detail

init

public StartChannelListener init(String uri,
                                 ProfileConfiguration profileConfig)
                          throws BEEPException
Specified by:
init in interface Profile
Throws:
BEEPException
See Also:
Profile.init(java.lang.String, org.beepcore.beep.profile.ProfileConfiguration)

receiveMSG

public void receiveMSG(MessageMSG message)

Is called on incoming messages:

  1. parses the MessageMSG to an APEXMessage
  2. calls the manager's handleIncomingMessage method
    1. On a processing error, a error reply APEX.STATUS_GENERAL_SYNTAX_ERROR is sent to the originator of the incoming message.

      Specified by:
      receiveMSG in interface RequestHandler

advertiseProfile

public boolean advertiseProfile(Session session)
Specified by:
advertiseProfile in interface StartChannelListener
See Also:
StartChannelListener.advertiseProfile(org.beepcore.beep.core.Session)

closeChannel

public void closeChannel(Channel channel)
                  throws CloseChannelException
Specified by:
closeChannel in interface StartChannelListener
Throws:
CloseChannelException
See Also:
StartChannelListener.closeChannel(org.beepcore.beep.core.Channel)

startChannel

public void startChannel(Channel channel,
                         String encoding,
                         String data)
                  throws StartChannelException
Specified by:
startChannel in interface StartChannelListener
Throws:
StartChannelException
See Also:
StartChannelListener.startChannel(org.beepcore.beep.core.Channel, java.lang.String, java.lang.String)

getURI

public static String getURI()
Returns the URI of the APEX profile

Returns:
The URI

parseServiceConfigFile

public static Hashtable[] parseServiceConfigFile(APEXManager manager,
                                                 String configConfigurationFile)
Parses the service configuration file an creates ab array of Hashtables (2 elements) to store the service handlers and the service priorities.

Parameters:
manager - The calling manager
configConfigurationFile - The configuration file
Returns:
A service hashtable (@see APEXManager)