wt.wrmf.delivery
Class StandardShippingService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.wrmf.delivery.StandardShippingService
All Implemented Interfaces:
Manager, NetFactor, Serializable, ShippingService

public class StandardShippingService
extends StandardManager
implements ShippingService, Serializable

Use the newStandardShippingService static factory method(s), not the StandardShippingService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
protected static boolean DELETE_DELIVERED_ITEM
           
private  Object lock
           
private  Hashtable outboxes
           
private static String RESOURCE
           
private  boolean servDone
           
private  TrackingNumberGenerator trackingNumGenerator
           
private static String trspOuboxName
           
private static boolean VERBOSE
           
private static String versionID
           
private static boolean waitingDone
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardShippingService()
           
 
Method Summary
private  void addItemsToQueue(DeliveryStatus status)
           
 ActionPullItem createActionPullItem()
          

Supported API: false
 ActionShippingItem createActionShippingItem()
          

Supported API: false
 BLOB_IS createBLOB_IS(LobLocator lobloc)
          

Supported API: false
 ContentIS createContentIS(ObjectReference objRef)
          

Supported API: false
 FileIS createFileIS(String fileName)
          

Supported API: false
 void createOutbox(Class outBoxClass, String name)
          

Supported API: false
 PayloadShippingItem createPayloadShippingItem()
          

Supported API: false
 Receipt createReceipt()
          

Supported API: false
 ShippingLabel createShippingLabel(int deliveryType, String inboxID, String outboxID, String destination, String transportType)
          

Supported API: false
protected  TrackingID createTrackingNumber()
          

Supported API: false
static void deleteDeliveredItem(ConfirmableShippingItem csi)
           
(package private)  void dispatchVetoableEvent(String eventType, ShippingItem obj)
          

Supported API: false
 InputStream get(SiteAddress forAddress)
          

Supported API: false
 String getConceptualClassname()
          Deprecated.  
(package private)  Outbox getOutbox(String outboxName)
           
protected  Hashtable getOutboxes()
          Gets the object for the association that plays role: outboxes.
protected  TrackingNumberGenerator getTrackingNumGenerator()
          Gets the object for the association that plays role: trackingNumGenerator.
private  void handleItemsUponStartup()
           
static void handleStatusUponStartup(ObjectReference objRef)
           
 TrackingID iasPullContent(String iasUrl, String transportType, MethodInvocationDesc localAction, String queryStr, String pullMethod, String outboxName, String inboxName)
          For I2W/W2I project only.
 InputStream iasPullContentImmediate(String iasUrl, String transportType, MethodInvocationDesc localAction, String queryStr, String pullMethod)
          For I2W/W2I project only.
 DeliveryStatus inquireStatus(TrackingID id)
          

Supported API: false
static StandardShippingService newStandardShippingService()
          Default factory for the class.
protected  void performStartupProcess()
          

Supported API: false
private  void registerAsListener()
           
 void registerEvents(ManagerService ms)
          Register events with the passed ManagerService.
 InputStream sendImmediateItem(ShippingItem obj, SiteAddress to, TransportType transportType)
          The return type is defaulted to "INDIRECT" mode, this means the InputStream from the remote site will be executed by the MethodInvocationDesc attached to the ShippingItem.
 InputStream sendImmediateItem(ShippingItem obj, SiteAddress to, TransportType transportType, int returnType)
          Delivery Type: IMMEDIATE is used by default in this invocation, and it is the only method for this delivery type.
 TrackingID sendItem(ShippingItem obj, ShippingLabel toLabel)
          All Delivery Type except IMMEDIATE mode use this invocation.
 TrackingID sendItem(ShippingItem obj, ShippingLabel toLabel, ShippingLabel receiptLabel)
          All Delivery Type except IMMEDIATE mode use this invocation.
protected  void sendToOutbox(ShippingItem obj, SiteAddress to, TransportType transport, DeliveryType deliveryType, String inboxID)
          

Supported API: false
protected  void setOutboxes(Hashtable a_Outboxes)
          Sets the object for the association that plays role: outboxes.
protected  void setTrackingNumGenerator(TrackingNumberGenerator a_TrackingNumGenerator)
          Sets the object for the association that plays role: trackingNumGenerator.
private  void trackingNumGeneratorValidate(TrackingNumberGenerator a_TrackingNumGenerator)
           
private  void waitInitComplete()
           
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

trackingNumGenerator

private TrackingNumberGenerator trackingNumGenerator

outboxes

private Hashtable outboxes

versionID

private static final String versionID
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE

trspOuboxName

private static final String trspOuboxName
See Also:
Constant Field Values

lock

private Object lock

servDone

private boolean servDone

waitingDone

private static boolean waitingDone

DELETE_DELIVERED_ITEM

protected static boolean DELETE_DELIVERED_ITEM
Constructor Detail

StandardShippingService

public StandardShippingService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

getTrackingNumGenerator

protected TrackingNumberGenerator getTrackingNumGenerator()
Gets the object for the association that plays role: trackingNumGenerator.

Supported API: false

Returns:
TrackingNumberGenerator

setTrackingNumGenerator

protected void setTrackingNumGenerator(TrackingNumberGenerator a_TrackingNumGenerator)
                                throws WTPropertyVetoException
Sets the object for the association that plays role: trackingNumGenerator.

Supported API: false

Parameters:
a_TrackingNumGenerator -
Throws:
WTPropertyVetoException

trackingNumGeneratorValidate

private void trackingNumGeneratorValidate(TrackingNumberGenerator a_TrackingNumGenerator)
                                   throws WTPropertyVetoException
Parameters:
a_TrackingNumGenerator -
Throws:
WTPropertyVetoException

getOutboxes

protected Hashtable getOutboxes()
Gets the object for the association that plays role: outboxes.

Supported API: false

Returns:
Hashtable

setOutboxes

protected void setOutboxes(Hashtable a_Outboxes)
                    throws WTPropertyVetoException
Sets the object for the association that plays role: outboxes.

Supported API: false

Parameters:
a_Outboxes -
Throws:
WTPropertyVetoException

performStartupProcess

protected void performStartupProcess()
                              throws ManagerException


Supported API: false

Overrides:
performStartupProcess in class StandardManager
Throws:
ManagerException

createTrackingNumber

protected TrackingID createTrackingNumber()


Supported API: false

Returns:
TrackingID

sendToOutbox

protected void sendToOutbox(ShippingItem obj,
                            SiteAddress to,
                            TransportType transport,
                            DeliveryType deliveryType,
                            String inboxID)


Supported API: false

Parameters:
obj -
to -
transport -
deliveryType -
inboxID -

dispatchVetoableEvent

void dispatchVetoableEvent(String eventType,
                           ShippingItem obj)
                     throws WTException


Supported API: false

Parameters:
eventType -
obj -
Throws:
WTException

registerEvents

public void registerEvents(ManagerService ms)
Register events with the passed ManagerService.

Supported API: false

Specified by:
registerEvents in interface Manager
Overrides:
registerEvents in class StandardManager
Parameters:
ms -

newStandardShippingService

public static StandardShippingService newStandardShippingService()
                                                          throws WTException
Default factory for the class.

Supported API: false

Returns:
StandardShippingService
Throws:
WTException

sendItem

public TrackingID sendItem(ShippingItem obj,
                           ShippingLabel toLabel)
                    throws WTDeliveryException
All Delivery Type except IMMEDIATE mode use this invocation. The associated Outbox, which can not be TransparentOutbox, and associated Inbox must be pre-specified in order to initialize inbox and outbox hashtables correctly. ShippingItems will be stored into database.

Supported API: true

Specified by:
sendItem in interface ShippingService
Parameters:
obj -
toLabel -
Returns:
TrackingID
Throws:
WTDeliveryException

sendItem

public TrackingID sendItem(ShippingItem obj,
                           ShippingLabel toLabel,
                           ShippingLabel receiptLabel)
                    throws WTDeliveryException
All Delivery Type except IMMEDIATE mode use this invocation. The associated Outbox, which can not be TransparentOutbox, and associated Inbox must be pre-specified in order to initialize inbox and outbox hashtables correctly. ShippingItems will be stored into database.

Supported API: true

Specified by:
sendItem in interface ShippingService
Parameters:
obj -
toLabel -
receiptLabel -
Returns:
TrackingID
Throws:
WTDeliveryException

sendImmediateItem

public InputStream sendImmediateItem(ShippingItem obj,
                                     SiteAddress to,
                                     TransportType transportType)
                              throws WTDeliveryException
The return type is defaulted to "INDIRECT" mode, this means the InputStream from the remote site will be executed by the MethodInvocationDesc attached to the ShippingItem. A null input stream in this case will be returned (since it is already consumed)

Supported API: true

Specified by:
sendImmediateItem in interface ShippingService
Parameters:
obj -
to -
transportType -
Returns:
InputStream
Throws:
WTDeliveryException

sendImmediateItem

public InputStream sendImmediateItem(ShippingItem obj,
                                     SiteAddress to,
                                     TransportType transportType,
                                     int returnType)
                              throws WTDeliveryException
Delivery Type: IMMEDIATE is used by default in this invocation, and it is the only method for this delivery type. The associated Outbox is TransparentOutbox, and the associated Inbox is TransparentInbox, by default. The returned Object "InputStream" is designed for flexibility for different requirements/preference. Normally this is associated with the setting of the boolean attribute "returnType" in from the attached ShippingLabel object: If it is set to INDIRECT (default case), the received InputStream from remote site will be executed "implicitly" by invoking the method described in MethodInvocationDesc object, which is attached to this ShippingItem. hence this method will return null; otherwise if set to DIRECT, the MethodInvocationDesc object attached will be ignored and the InputStream from the remote site will be returned directly..

Supported API: true

Specified by:
sendImmediateItem in interface ShippingService
Parameters:
obj -
to -
transportType -
returnType -
Returns:
InputStream
Throws:
WTDeliveryException

get

public InputStream get(SiteAddress forAddress)


Supported API: false

Specified by:
get in interface ShippingService
Parameters:
forAddress -
Returns:
InputStream

inquireStatus

public DeliveryStatus inquireStatus(TrackingID id)
                             throws WTDeliveryException


Supported API: false

Specified by:
inquireStatus in interface ShippingService
Parameters:
id -
Returns:
DeliveryStatus
Throws:
WTDeliveryException

createShippingLabel

public ShippingLabel createShippingLabel(int deliveryType,
                                         String inboxID,
                                         String outboxID,
                                         String destination,
                                         String transportType)
                                  throws WTPropertyVetoException


Supported API: false

Specified by:
createShippingLabel in interface ShippingService
Parameters:
deliveryType -
inboxID -
outboxID -
destination -
transportType -
Returns:
ShippingLabel
Throws:
WTPropertyVetoException

createActionShippingItem

public ActionShippingItem createActionShippingItem()


Supported API: false

Specified by:
createActionShippingItem in interface ShippingService
Returns:
ActionShippingItem

createPayloadShippingItem

public PayloadShippingItem createPayloadShippingItem()


Supported API: false

Specified by:
createPayloadShippingItem in interface ShippingService
Returns:
PayloadShippingItem

createReceipt

public Receipt createReceipt()


Supported API: false

Specified by:
createReceipt in interface ShippingService
Returns:
Receipt

createContentIS

public ContentIS createContentIS(ObjectReference objRef)


Supported API: false

Specified by:
createContentIS in interface ShippingService
Parameters:
objRef -
Returns:
ContentIS

createFileIS

public FileIS createFileIS(String fileName)


Supported API: false

Specified by:
createFileIS in interface ShippingService
Parameters:
fileName -
Returns:
FileIS

createBLOB_IS

public BLOB_IS createBLOB_IS(LobLocator lobloc)


Supported API: false

Specified by:
createBLOB_IS in interface ShippingService
Parameters:
lobloc -
Returns:
BLOB_IS

createOutbox

public void createOutbox(Class outBoxClass,
                         String name)
                  throws WTDeliveryException


Supported API: false

Specified by:
createOutbox in interface ShippingService
Parameters:
outBoxClass -
name -
Throws:
WTDeliveryException

createActionPullItem

public ActionPullItem createActionPullItem()


Supported API: false

Specified by:
createActionPullItem in interface ShippingService
Returns:
ActionPullItem

iasPullContentImmediate

public InputStream iasPullContentImmediate(String iasUrl,
                                           String transportType,
                                           MethodInvocationDesc localAction,
                                           String queryStr,
                                           String pullMethod)
                                    throws WTDeliveryException
For I2W/W2I project only. This is an alternative but more convenient method of sendItemImmediate().

Supported API: true

Specified by:
iasPullContentImmediate in interface ShippingService
Parameters:
iasUrl - The site address of the IAS servlet
transportType - By default this is "GZIPHttpPipe" which can be overwrite by system configuration
localAction - To specify how to handle the input stream downloaded
queryStr - Query information to locate the source stream at remote site
pullMethod - The method how to retrieve the stream. By default the signatures are HttpServletRequest and HttpServletResponse, otherwise the signature types and values must be included in the "queryStr"
Returns:
InputStream
Throws:
WTDeliveryException

iasPullContent

public TrackingID iasPullContent(String iasUrl,
                                 String transportType,
                                 MethodInvocationDesc localAction,
                                 String queryStr,
                                 String pullMethod,
                                 String outboxName,
                                 String inboxName)
                          throws WTDeliveryException
For I2W/W2I project only. This is an alternative but more convenient method of sendItemImmediate().

Supported API: true

Specified by:
iasPullContent in interface ShippingService
Parameters:
iasUrl - The site address of the IAS servlet
transportType - By default this is "GZIPHttpPipe" which can be overwrite by system configuration
localAction - To specify how to handle the input stream downloaded
queryStr - Query information to locate the source stream at remote site
pullMethod - The method how to retrieve the stream. By default the Signatures are HttpServletRequest and HttpServletResponse, otherwise the signature types and values must be included in the "queryStr"
outboxName - Name of the OutBox. Should be unique for all IAS delivery requests
inboxName - Name of the InBox. Should be unique for all IAS delivery requests
Returns:
TrackingID
Throws:
WTDeliveryException

getOutbox

Outbox getOutbox(String outboxName)

waitInitComplete

private void waitInitComplete()

handleItemsUponStartup

private void handleItemsUponStartup()

addItemsToQueue

private void addItemsToQueue(DeliveryStatus status)

handleStatusUponStartup

public static void handleStatusUponStartup(ObjectReference objRef)

deleteDeliveredItem

public static void deleteDeliveredItem(ConfirmableShippingItem csi)

registerAsListener

private void registerAsListener()
                         throws ManagerException
Throws:
ManagerException