com.dynalivery.saffron.client
Class SaffronClient

java.lang.Object
  extended bycom.dynalivery.saffron.client.SaffronClient
Direct Known Subclasses:
SaffronCORBAClient, SaffronEJBClient, SaffronEmbeddedClient

public abstract class SaffronClient
extends java.lang.Object

This abstract class provides methods for accessing Saffron running as an embedded server, a CORBA server or and EJB server


Field Summary
protected  java.lang.String appServerVendor
          This is the EJB appserver vendor, if any
protected static com.dynalivery.output.log.LogService logService
          This is the client log service, if any
protected  java.lang.String password
          This is the current password
protected  java.util.Properties properties
          the Saffron client properties
static java.lang.String PROPERTY_APPSERVER_VENDOR
          key string for EJB appserver vendor (e.g.
static java.lang.String PROPERTY_SAFFRON_COMMAND_LINE
          key string for Saffron command line This command line is used to start the Saffron CORBA server if necessary.
static java.lang.String PROPERTY_SERVER_NAME
          key string for server hostname
static java.lang.String PROPERTY_SERVER_PORT
          key string for server port number
protected  java.lang.String serverName
          This is the server hostname
protected  int serverPortInt
          This is the server port Integer
protected  java.lang.String serverPortString
          This is the server port String
protected  int serverType
          the Saffron server type (e.g.
static java.lang.String snoaVersionDesired
          the SNOA version we require for this client
protected  java.lang.String userName
          This is the current user name
 
Constructor Summary
protected SaffronClient(java.util.Properties properties)
          Construct a Saffron client with the specified properties.
 
Method Summary
abstract  void abortJob()
          Abort the active job if possible
abstract  boolean canAbortJob()
          Returns true if we can abort an active job
abstract  void connect(java.lang.String userName, java.lang.String password)
          Connect to Saffron
static SaffronClient createSaffronClient(int serverType, java.util.Properties properties)
          Create a Saffron client for specified server type
static SaffronCORBAClient createSaffronCORBAClient(java.util.Properties properties)
          Create a Saffron client using CORBA
static SaffronEJBClient createSaffronEJBClient(java.util.Properties properties)
          Create a Saffron client for the specified EJB server vendor.
static SaffronEmbeddedClient createSaffronEmbeddedClient(java.util.Properties properties)
          Create a Saffron client for embedded server
abstract  void disconnect()
          Disconnect from Saffron
abstract  void export(FormatOptions formatOptions, SaffronInputSource[] inputSources, DestinationOptions destinationOptions)
          Export one or more documents
 java.lang.String getAppServerVendor()
          Returns the appserver vendor, if any
abstract  com.dynalivery.common.IdentifierPair[] getDestinationList(int fid)
          getDestinationList returns the List of Destinations Supported by this Formatter.
abstract  com.dynalivery.common.IdentifierPair[] getFormatList()
          getFormatList returns the List of OutputFormats Supported
 java.lang.String getServerName()
          Returns the server name
 java.lang.String getServerPortString()
          Returns the server port
 int getServerType()
          Returns the Saffron server type e.g.
 java.lang.String getUserName()
          Returns the current logged in userName, if any
abstract  boolean isConnected()
          Returns true if we are connected to Saffron
static void log(int logLevel, java.lang.String msg)
          Client side logging method
static void log(int logLevel, java.lang.String message, java.lang.String verboseMessage)
          Client side logging method
static void setClientLogService(com.dynalivery.output.log.LogService _logService)
          Set the client log service
protected static void validateServerName(java.lang.String servername)
          Validates the login host/server name
protected static int validateServerPort(java.lang.String portString)
          Validates the port String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

snoaVersionDesired

public static final java.lang.String snoaVersionDesired
the SNOA version we require for this client

See Also:
Constant Field Values

PROPERTY_APPSERVER_VENDOR

public static final java.lang.String PROPERTY_APPSERVER_VENDOR
key string for EJB appserver vendor (e.g. "JBoss")

See Also:
Constant Field Values

PROPERTY_SERVER_NAME

public static final java.lang.String PROPERTY_SERVER_NAME
key string for server hostname

See Also:
Constant Field Values

PROPERTY_SERVER_PORT

public static final java.lang.String PROPERTY_SERVER_PORT
key string for server port number

See Also:
Constant Field Values

PROPERTY_SAFFRON_COMMAND_LINE

public static final java.lang.String PROPERTY_SAFFRON_COMMAND_LINE
key string for Saffron command line This command line is used to start the Saffron CORBA server if necessary.

See Also:
Constant Field Values

logService

protected static com.dynalivery.output.log.LogService logService
This is the client log service, if any


appServerVendor

protected java.lang.String appServerVendor
This is the EJB appserver vendor, if any


serverName

protected java.lang.String serverName
This is the server hostname


serverPortString

protected java.lang.String serverPortString
This is the server port String


serverPortInt

protected int serverPortInt
This is the server port Integer


userName

protected java.lang.String userName
This is the current user name


password

protected java.lang.String password
This is the current password


properties

protected java.util.Properties properties
the Saffron client properties


serverType

protected int serverType
the Saffron server type (e.g. ServerType.EMBEDDED)

Constructor Detail

SaffronClient

protected SaffronClient(java.util.Properties properties)
Construct a Saffron client with the specified properties. Used by subclasses.

Parameters:
properties - the properties for this Saffron client (e.g. PROPERTY_SERVER_NAME)
Method Detail

createSaffronClient

public static SaffronClient createSaffronClient(int serverType,
                                                java.util.Properties properties)
                                         throws SaffronClientException
Create a Saffron client for specified server type

Parameters:
serverType - the integer Saffron server type (e.g. ServerType.EMBEDDED)
properties - the Saffron client properties
Returns:
reference to SaffronClient that was created
Throws:
SaffronClientException

createSaffronEmbeddedClient

public static SaffronEmbeddedClient createSaffronEmbeddedClient(java.util.Properties properties)
                                                         throws SaffronClientException
Create a Saffron client for embedded server

Parameters:
properties - the Saffron client properties
Returns:
reference to SaffronClient that was created
Throws:
SaffronClientException

createSaffronCORBAClient

public static SaffronCORBAClient createSaffronCORBAClient(java.util.Properties properties)
                                                   throws SaffronClientException
Create a Saffron client using CORBA

Parameters:
properties - the Saffron client properties
Returns:
reference to SaffronClient that was created
Throws:
SaffronClientException

createSaffronEJBClient

public static SaffronEJBClient createSaffronEJBClient(java.util.Properties properties)
                                               throws SaffronClientException
Create a Saffron client for the specified EJB server vendor. To handle differences between J2EE server vendors, we create a vendor specific class to handle all interaction with the Saffron EJB.

Parameters:
properties - the Saffron client properties
Returns:
reference to SaffronClient that was created
Throws:
SaffronClientException

connect

public abstract void connect(java.lang.String userName,
                             java.lang.String password)
                      throws SaffronClientException
Connect to Saffron

Parameters:
userName - the user name string for the current user
password - the password string for the current user in clear text
Throws:
AuthenticationException - thrown if username/password is invalid
ServerUnavailableException - thrown if server is not available
SaffronSecurityException - thrown if the specified user is not granted access to the Saffron
InvalidParameterException - thrown if any of the parameters to this method are invalid
SaffronClientException

disconnect

public abstract void disconnect()
Disconnect from Saffron


isConnected

public abstract boolean isConnected()
Returns true if we are connected to Saffron

Returns:
true if we are connected to Saffron

canAbortJob

public abstract boolean canAbortJob()
Returns true if we can abort an active job

Returns:
true if we can abort an active job

abortJob

public abstract void abortJob()
Abort the active job if possible


export

public abstract void export(FormatOptions formatOptions,
                            SaffronInputSource[] inputSources,
                            DestinationOptions destinationOptions)
                     throws SaffronClientException
Export one or more documents

Parameters:
formatOptions - the FormatOptions for this export
inputSources - a SaffronInputSource array defining the documents to be exported
destinationOptions - the DestinationOptions for this export
Throws:
SaffronClientException

getFormatList

public abstract com.dynalivery.common.IdentifierPair[] getFormatList()
                                                              throws SaffronClientException
getFormatList returns the List of OutputFormats Supported

Returns:
IdentifierPair[]
Throws:
SaffronClientException

getDestinationList

public abstract com.dynalivery.common.IdentifierPair[] getDestinationList(int fid)
                                                                   throws SaffronClientException
getDestinationList returns the List of Destinations Supported by this Formatter.

Parameters:
fid - the format Id for which we need the list of destinations.
Returns:
IdentifierPair[]
Throws:
SaffronClientException

setClientLogService

public static void setClientLogService(com.dynalivery.output.log.LogService _logService)
Set the client log service

Parameters:
_logService - the LogService to be used to log client messages

getUserName

public java.lang.String getUserName()
Returns the current logged in userName, if any

Returns:
the current user name String

getAppServerVendor

public java.lang.String getAppServerVendor()
Returns the appserver vendor, if any

Returns:
the appserver vendor String

getServerName

public java.lang.String getServerName()
Returns the server name

Returns:
the server name

getServerPortString

public java.lang.String getServerPortString()
Returns the server port

Returns:
the server port

getServerType

public int getServerType()
Returns the Saffron server type e.g. ServerType.EMBEDDED

Returns:
the Saffron server type

validateServerName

protected static void validateServerName(java.lang.String servername)
                                  throws InvalidParameterException
Validates the login host/server name

Parameters:
servername - the hostname string of the Saffron EJB server
Throws:
InvalidParameterException - thrown if any of the parameters to this method are invalid

validateServerPort

protected static int validateServerPort(java.lang.String portString)
                                 throws InvalidParameterException
Validates the port String

Parameters:
portString - the specified port String to be validated
Throws:
InvalidParameterException - thrown if any of the parameters to this method are invalid

log

public static void log(int logLevel,
                       java.lang.String msg)
Client side logging method

Parameters:
logLevel - integer log level of this message, e.g. LogService.LOG_WARNING
msg - the message String to write to the client side log

log

public static void log(int logLevel,
                       java.lang.String message,
                       java.lang.String verboseMessage)
Client side logging method

Parameters:
logLevel - integer log level of this message, e.g. LogService.LOG_WARNING
message - the short log message String
verboseMessage - the verbose log message String