org.psepr.jClient
Class PsEPRService

java.lang.Object
  extended by org.psepr.jClient.PsEPRService

public class PsEPRService
extends java.lang.Object

Author:
Robert.Adams@intel.com 2.8

Field Summary
static java.lang.String AppName
           
static java.lang.String EventElement
           
static java.lang.String EventNamespace
           
static java.lang.String PayloadElement
           
static java.lang.String PayloadNamespace
           
 
Constructor Summary
PsEPRService()
           
 
Method Summary
static java.lang.String cleanXMLText(java.lang.String txt)
          Clean the text returned from XmlPullParser.getText().
static java.lang.String extractInstance(java.lang.String addr)
          Exract the instance part of an address.
static boolean getParam(java.lang.String parm, boolean deflt)
          Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.
static int getParam(java.lang.String parm, int deflt)
          Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.
static long getParam(java.lang.String parm, long deflt)
          Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.
static java.lang.String getParam(java.lang.String parm, java.lang.String deflt)
          Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.
static java.lang.String getRegistryInstance()
           
static java.lang.String getRegistryName()
           
static java.lang.String getRegistryPort()
           
static RouterManager getRouterManager()
           
static boolean hasParam(java.lang.String parm)
          return true if this parameter is in the parameter file
static boolean isSubChannel(java.lang.String chan1, java.lang.String chan2)
          Return true if the channel is a subchannel of the other.
static ParamFile params()
           
static java.lang.String randomString(int len)
          Return a string of the specified length made of random alphanumeric characters.
static void setConfigFiles(java.lang.String[] userConfigFiles)
          Set an array of config files to look for parameters in.
static void setRegistryInstance(java.lang.String xx)
           
static void setRegistryName(java.lang.String xx)
           
static void setRegistryPort(java.lang.String xx)
           
static void setRouterManager(RouterManager xx)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EventElement

public static final java.lang.String EventElement
See Also:
Constant Field Values

EventNamespace

public static final java.lang.String EventNamespace
See Also:
Constant Field Values

PayloadElement

public static final java.lang.String PayloadElement
See Also:
Constant Field Values

PayloadNamespace

public static final java.lang.String PayloadNamespace
See Also:
Constant Field Values

AppName

public static final java.lang.String AppName
See Also:
Constant Field Values
Constructor Detail

PsEPRService

public PsEPRService()
Method Detail

getRouterManager

public static RouterManager getRouterManager()

setRouterManager

public static void setRouterManager(RouterManager xx)

getRegistryName

public static java.lang.String getRegistryName()

setRegistryName

public static void setRegistryName(java.lang.String xx)

getRegistryInstance

public static java.lang.String getRegistryInstance()

setRegistryInstance

public static void setRegistryInstance(java.lang.String xx)

getRegistryPort

public static java.lang.String getRegistryPort()

setRegistryPort

public static void setRegistryPort(java.lang.String xx)

params

public static ParamFile params()

setConfigFiles

public static void setConfigFiles(java.lang.String[] userConfigFiles)
Set an array of config files to look for parameters in. This MUST be set before doing anything with the service -- once the parameters are read in, they will not be re-read.

Parameters:
userConfigFile - array of file names

hasParam

public static boolean hasParam(java.lang.String parm)
return true if this parameter is in the parameter file

Parameters:
parm -
Returns:

getParam

public static java.lang.String getParam(java.lang.String parm,
                                        java.lang.String deflt)
Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.

Parameters:
parm -
deflt -
Returns:

getParam

public static int getParam(java.lang.String parm,
                           int deflt)
Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.

Parameters:
parm -
deflt -
Returns:

getParam

public static long getParam(java.lang.String parm,
                            long deflt)
Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.

Parameters:
parm -
deflt -
Returns:

getParam

public static boolean getParam(java.lang.String parm,
                               boolean deflt)
Return the value of the parameter or the default value if the parameter is either not specified or if the value is not specified.

Parameters:
parm -
deflt -
Returns:

randomString

public static java.lang.String randomString(int len)
Return a string of the specified length made of random alphanumeric characters.

Parameters:
len - number of characters in the retruned string
Returns:
string of random alpha-numeric characters

isSubChannel

public static boolean isSubChannel(java.lang.String chan1,
                                   java.lang.String chan2)
Return true if the channel is a subchannel of the other. Used by leases when an event is received since the channel can be any channel that 'below' the channel that was subscribed to.

Parameters:
chan1 - the possible parent channel
chan2 - the possible sub channel
Returns:
true if chan2 is a sub channel of chan1

extractInstance

public static java.lang.String extractInstance(java.lang.String addr)
Exract the instance part of an address. This routine will return "xyz" is passed "person@example.com/xyz".

Parameters:
addr - The complete JID to extract instance from
Returns:
the instance string, could be zero lenght

cleanXMLText

public static java.lang.String cleanXMLText(java.lang.String txt)
Clean the text returned from XmlPullParser.getText(). By the definition of XML, the text between the elements contains all the white space and line separators. Any sane programmer doesn't want them. This routine removes all line separator characters and then any white space at the beginning and the end of the string. This leaves only the juicy middle.

Parameters:
txt - The string to clean up.
Returns:
cleaned string. Could be zero length.