com.groiss.wfxml
Class WfXML

java.lang.Object
  extended by com.groiss.wfxml.WfXML

public class WfXML
extends java.lang.Object

This is a central class which provides general methods.


Field Summary
static short MODE_ACTIVE
          Operating mode active means that WfXML is fully active.
static short MODE_OFF
          Operating mode off means that WfXML is deactivated.
static short MODE_PASSIVE
          Operating mode passive means that WfXML is activated.
 
Constructor Summary
WfXML()
           
 
Method Summary
static java.lang.String dateToWfXMLDate(java.util.Date date)
          Transforms a date to a WfXML date (like specified in the WfXML specification).
static Partner[] getAllPartners()
          This method returns an array containing all defined partners.
static java.lang.String getContextRoot()
          Use this method to get the context root of the local server.
static OrgUnit getDefaultOrgUnit()
           
static com.dec.avw.core.Server getDefaultServer()
           
static com.dec.avw.core.User getDefaultUser()
           
static java.lang.String getDomainName()
          Returns the fully qualified domain name of the local host, or an empty String if no domain name is available.
static java.lang.String getId()
          This method returns the id of the local enterprise server.
static int getMaxLogSize()
           
static short getOperatingMode()
          Use this method to find out if the local server operates in passive, active, or off mode.
static Partner getPartner(java.lang.String id)
          Use this method to get a Partner object representing a WfXML communication partner that you know (you must know the id with which the partner has been defined).
static int getPort()
          Returns the port on which the local http server is running.
static java.lang.String getURI()
          Returns the complete URI to the Receiver's receive method on the local server.
static java.lang.String getVersion()
          Use this method to find out which version of the WfXML specification is implemented by this implementation.
static boolean isLogEnabled(java.lang.String object)
           
 Page localStatus(javax.servlet.http.HttpServletRequest req)
           
static boolean registerMessageListener(java.lang.Class listener, Partner partner)
          Use this method to register a message listener that will listen for messages from a specific partner or all partners.
 Page requestPartnerStatus(javax.servlet.http.HttpServletRequest req)
          This method requests "live" info from a partner and generates a HTML page containing this information.
static void unregisterMessageListener(java.lang.Class listener, Partner partner)
          Use this method to remove previously registered message listeners.
static java.util.Date wfXMLDateToDate(java.lang.String dateString)
          Transforms a WfXML date to a Java Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_OFF

public static final short MODE_OFF
Operating mode off means that WfXML is deactivated. It means that incoming requests are not handled. Anyway, outgoing requests can still be sent from this server.

See Also:
Constant Field Values

MODE_ACTIVE

public static final short MODE_ACTIVE
Operating mode active means that WfXML is fully active. Incoming requests are handled and outgoing requests are sent.

See Also:
Constant Field Values

MODE_PASSIVE

public static final short MODE_PASSIVE
Operating mode passive means that WfXML is activated. Incoming requests are handled but outgoing messages are not sent actively (they require an active communication partner who will request these messages).

See Also:
Constant Field Values
Constructor Detail

WfXML

public WfXML()
Method Detail

requestPartnerStatus

public Page requestPartnerStatus(javax.servlet.http.HttpServletRequest req)
                          throws java.lang.Exception
This method requests "live" info from a partner and generates a HTML page containing this information. It is called from the Administration.

Parameters:
req - The HTTP request
Returns:
A HTML page containing the information
Throws:
java.lang.Exception

localStatus

public Page localStatus(javax.servlet.http.HttpServletRequest req)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getPartner

public static Partner getPartner(java.lang.String id)
                          throws java.lang.Exception
Use this method to get a Partner object representing a WfXML communication partner that you know (you must know the id with which the partner has been defined). For enterprise servers, this id is the server id.

Parameters:
id - The id with which the partner has been defined in the enterprise configuration of the local server.
Returns:
A reference to the Partner with the given id, or null if no partner with this id exists.
Throws:
java.lang.Exception

getAllPartners

public static Partner[] getAllPartners()
                                throws java.lang.Exception
This method returns an array containing all defined partners.

Returns:
Array with all defined communication partners. If no partners are defined, the returned array will be empty.
Throws:
java.lang.Exception

getOperatingMode

public static short getOperatingMode()
Use this method to find out if the local server operates in passive, active, or off mode.

Returns:
A short value representing the operating mode of the local server. This can be one of the constants of this class, e.g., MODE_ACTIVE.

getDomainName

public static java.lang.String getDomainName()
Returns the fully qualified domain name of the local host, or an empty String if no domain name is available.

Returns:
The domain name or an empty String if no domain name is available.

getPort

public static int getPort()
Returns the port on which the local http server is running. As WfXML messages are sent using the HTTP protocol, also WfXML messages will be received through this port.

Returns:
Port where the local http server is listening for incoming requests.

getContextRoot

public static java.lang.String getContextRoot()
Use this method to get the context root of the local server. The default value for the context root is wf.

Returns:
The context root of the local server.

getId

public static java.lang.String getId()
This method returns the id of the local enterprise server. This id is used to identify this server. If you want to add this server to the WfXML configuration of an other enterprise server, you must use this id as id.

Returns:
The id of the local server.

getURI

public static java.lang.String getURI()
Returns the complete URI to the Receiver's receive method on the local server. The returned value may look similar to:
http://iquitos:8000/wf/servlet.method/com.groiss.wfxml.impl.Receiver.receive/

Returns:
The complete URI to the local WfXML Receiver's receive method.

getVersion

public static java.lang.String getVersion()
Use this method to find out which version of the WfXML specification is implemented by this implementation.

Returns:
A String representation of the version.

registerMessageListener

public static boolean registerMessageListener(java.lang.Class listener,
                                              Partner partner)
                                       throws java.lang.Exception
Use this method to register a message listener that will listen for messages from a specific partner or all partners. If the listener has already been registered for messages from the given partner, nothing will be done and this method returns false indicating that the listener already exists. Otherwise the listener will be registered and true is returned.

Parameters:
listener - The message listener that you want to register.
partner - The listener will be called for all incoming messages of this partner. If you don't provide a partner here (null) the listener will be registered for incoming messages of all partners.
Returns:
true if the listener didn't exist and was inserted now, or false if the listener already existed and nothing was done.
Throws:
java.lang.Exception - if registering the listener failed because of database problems.

unregisterMessageListener

public static void unregisterMessageListener(java.lang.Class listener,
                                             Partner partner)
                                      throws java.lang.Exception
Use this method to remove previously registered message listeners. The following parameter combinations will work:

Parameters:
listener - The listener that you want to remove (see text above for more details).
partner - The partner for which you want to remove registered listeners (also see the text above for more details).
Throws:
java.lang.Exception - if there are database problems and removing the listener does not work.

dateToWfXMLDate

public static java.lang.String dateToWfXMLDate(java.util.Date date)
Transforms a date to a WfXML date (like specified in the WfXML specification). WfXML dates are in the form YYYY-MM-DDThh:mm:ssZ and always in GMT (Greenwich Mean Time). So this method transforms the given date to this requirements.
For transformations in the other direction, use the wfXMLDateToDate method.

Parameters:
date - A Date object containing a date/time which you want to tranform to WfXML representation
Returns:
a String containing the WfXML representation of the Date object.

wfXMLDateToDate

public static java.util.Date wfXMLDateToDate(java.lang.String dateString)
                                      throws WfXMLMessageException
Transforms a WfXML date to a Java Date object. The WfXML date must be in the specified format YYYY-MM-DDThh:mm:ssZ and in GMT (Greenwich Mean Time). The returned date object will represent the time in the current timezone, depending on where the computer is located. For transformations in the other direction, use the dateToWfXMLDate method.

Parameters:
dateString - A String object containing the WfXML representation of a date/time.
Returns:
A Date object containing the date and time.
Throws:
WfXMLMessageException - if the String dateString is not formatted according to the above mentioned format.

getDefaultOrgUnit

public static OrgUnit getDefaultOrgUnit()

getDefaultUser

public static com.dec.avw.core.User getDefaultUser()

getDefaultServer

public static com.dec.avw.core.Server getDefaultServer()

getMaxLogSize

public static int getMaxLogSize()

isLogEnabled

public static boolean isLogEnabled(java.lang.String object)


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.