com.dynalivery.saffron.client
Class SaffronEJBClient

java.lang.Object
  extended bycom.dynalivery.saffron.client.SaffronClient
      extended bycom.dynalivery.saffron.client.SaffronEJBClient
Direct Known Subclasses:
SaffronJBossEJBClient

public abstract class SaffronEJBClient
extends SaffronClient

This is an implementation of Saffron client based on Enterprise Java Beans. This will contain code common to all EJB implementations. Variations between EJB servers will be encapsulated as much as possible in classes extending this class such as SaffronJBossEJBClient


Field Summary
protected  com.dynalivery.saffron.ejb.Saffron saffron
          This is the reference to the Saffron EJB session bean used to perform all server operations.
 
Fields inherited from class com.dynalivery.saffron.client.SaffronClient
appServerVendor, logService, password, properties, PROPERTY_APPSERVER_VENDOR, PROPERTY_SAFFRON_COMMAND_LINE, PROPERTY_SERVER_NAME, PROPERTY_SERVER_PORT, serverName, serverPortInt, serverPortString, serverType, snoaVersionDesired, userName
 
Constructor Summary
SaffronEJBClient(java.util.Properties properties, java.lang.String appServerVendor)
          construct an EJB-based Saffron server
 
Method Summary
 void abortJob()
          Abort the active job if possible
 boolean canAbortJob()
          Returns true if we can abort an active job
 void disconnect()
          Disconnect from Saffron EJB server.
protected  void ensureSessionReference()
          Ensure session bean reference is still valid.
protected  byte[] export(FormatOptions formatOptions, SaffronEJBSource[] ejbSources)
          Export one or more files to a byte array
protected  void export(FormatOptions formatOptions, SaffronEJBSource[] ejbSources, DestinationOptions destinationOptions)
          Export one or more files
 void export(FormatOptions formatOptions, SaffronInputSource[] inputSources, DestinationOptions destinationOptions)
          Export one or more documents
 com.dynalivery.common.IdentifierPair[] getDestinationList(int fid)
          getDestinationList returns the List of Destinations Supported by this Formatter.
 com.dynalivery.common.IdentifierPair[] getFormatList()
          getFormatList returns the List of OutputFormats Supported
protected abstract  com.dynalivery.saffron.ejb.Saffron getSessionReference(java.lang.String serverName, java.lang.String userName, java.lang.String password)
           
 boolean isConnected()
          Returns true if we are connected to Saffron
protected static java.lang.String stripStackTrace(java.lang.String message)
          Strip server stack trace Exceptions thrown on the server side may include a stacktrace in the message.
protected static void throwNewInvalidParameterException(InvalidParameterException exception)
          Throw new InvalidParameterException Exceptions thrown on the server side may include a stacktrace in the message.
protected static void throwNewSaffronSecurityException(SaffronSecurityException exception)
          Throw new SaffronSecurityException Exceptions thrown on the server side may include a stacktrace in the message.
 
Methods inherited from class com.dynalivery.saffron.client.SaffronClient
connect, createSaffronClient, createSaffronCORBAClient, createSaffronEJBClient, createSaffronEmbeddedClient, getAppServerVendor, getPrintersByName, getServerName, getServerPortString, getServerType, getUserName, log, log, setClientLogService, validateServerName, validateServerPort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

saffron

protected com.dynalivery.saffron.ejb.Saffron saffron
This is the reference to the Saffron EJB session bean used to perform all server operations.

Constructor Detail

SaffronEJBClient

public SaffronEJBClient(java.util.Properties properties,
                        java.lang.String appServerVendor)
                 throws SaffronClientException
construct an EJB-based Saffron server

Method Detail

disconnect

public void disconnect()
Disconnect from Saffron EJB server. May only be needed if GUI tools want to support re-logging in under a different username/password.

Specified by:
disconnect in class SaffronClient

isConnected

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

Specified by:
isConnected in class SaffronClient
Returns:
true if we are connected to Saffron

canAbortJob

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

Specified by:
canAbortJob in class SaffronClient
Returns:
true if we can abort an active job

abortJob

public void abortJob()
Abort the active job if possible

Specified by:
abortJob in class SaffronClient

export

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

Specified by:
export in class SaffronClient
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 com.dynalivery.common.IdentifierPair[] getFormatList()
                                                     throws SaffronClientException
getFormatList returns the List of OutputFormats Supported

Specified by:
getFormatList in class SaffronClient
Returns:
IdentifierPair[]
Throws:
SaffronClientException

getDestinationList

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

Specified by:
getDestinationList in class SaffronClient
Parameters:
fid - the format Id for which we need the list of destinations.
Returns:
IdentifierPair[]
Throws:
SaffronClientException

export

protected void export(FormatOptions formatOptions,
                      SaffronEJBSource[] ejbSources,
                      DestinationOptions destinationOptions)
Export one or more files

Parameters:
formatOptions - the FormatOptions for this export
ejbSources - an array of SaffronEJBSource objects
destinationOptions - the DestinationOptions for this export

export

protected byte[] export(FormatOptions formatOptions,
                        SaffronEJBSource[] ejbSources)
Export one or more files to a byte array

Parameters:
formatOptions - the FormatOptions for this export
ejbSources - an array of SaffronEJBSource objects
Returns:
the resulting byte array

getSessionReference

protected abstract com.dynalivery.saffron.ejb.Saffron getSessionReference(java.lang.String serverName,
                                                                          java.lang.String userName,
                                                                          java.lang.String password)
                                                                   throws AuthenticationException,
                                                                          java.rmi.RemoteException,
                                                                          javax.ejb.CreateException,
                                                                          javax.naming.NamingException,
                                                                          InvalidParameterException,
                                                                          SaffronServerUnavailableException,
                                                                          javax.security.auth.login.LoginException
Throws:
AuthenticationException
java.rmi.RemoteException
javax.ejb.CreateException
javax.naming.NamingException
InvalidParameterException
SaffronServerUnavailableException
javax.security.auth.login.LoginException

ensureSessionReference

protected void ensureSessionReference()
Ensure session bean reference is still valid.


stripStackTrace

protected static java.lang.String stripStackTrace(java.lang.String message)
Strip server stack trace Exceptions thrown on the server side may include a stacktrace in the message. This method can be used to strip those stacktraces

Parameters:
message - the message String to be modified
Returns:
message string with stack trace stripped

throwNewSaffronSecurityException

protected static void throwNewSaffronSecurityException(SaffronSecurityException exception)
                                                throws SaffronSecurityException
Throw new SaffronSecurityException Exceptions thrown on the server side may include a stacktrace in the message. This method can be used to strip those stacktraces and rethrow the exception.

Parameters:
exception - the exception being thrown
Throws:
SaffronSecurityException

throwNewInvalidParameterException

protected static void throwNewInvalidParameterException(InvalidParameterException exception)
                                                 throws InvalidParameterException
Throw new InvalidParameterException Exceptions thrown on the server side may include a stacktrace in the message. This method can be used to strip those stacktraces and rethrow the exception.

Parameters:
exception - the exception being thrown
Throws:
InvalidParameterException