com.ibm.commerce.messaging.outboundservice
Class Messaging

java.lang.Object
  |
  +--com.ibm.commerce.messaging.outboundservice.Messaging
All Implemented Interfaces:
java.io.Serializable

public class Messaging
extends java.lang.Object
implements java.io.Serializable

The object that is responsible to creating the messages and sending the messages using CCF transports based on the specified configuration for the message types.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          IBM copyright notice field.
 
Constructor Summary
Messaging(java.lang.Integer msgty, java.lang.Integer store)
          Deprecated. user Messaging(String, Integer) so the message type Identifier does not need to be hardcode by the application.
Messaging(java.lang.Integer msgty, java.lang.Integer store, java.lang.Integer priority)
          Deprecated. user Messaging(String, Integer, Integer) so the message type Identifier does not need to be hardcode by the application.
Messaging(java.lang.String msgTypeName, java.lang.Integer store)
          Messaging constructor.
Messaging(java.lang.String msgTypeName, java.lang.Integer store, java.lang.Integer priority)
          Messaging constructor.
 
Method Summary
 void addContentPart(byte[] part)
          This method adds a content part to the message content
 void addContentPart(byte[] part, java.lang.String name, java.lang.String type)
          This method adds a content part to the message content
 void addMember(java.lang.Long memb)
          This method sets the internal member vector with the single parameter.
 int addMemberGroup(java.lang.Long mbrgrp)
          This method sets the internal member vector with the member group parameter.
 void addSecureMember(java.lang.Long memb)
          This method sets the internal securemember vector with the single parameter.
 void addStore(java.lang.Integer astore_id)
          Add a store to send the message on behalf of.
 void clearMember()
          Removes all members from our internal recipient list.
 void compose(java.lang.String view, CommandContext comContext, TypedProperty inparms)
          This method will interface with the JSP's for each transport and return the message content to the content field.
 void compose(java.lang.String view, CommandContext comContext, TypedProperty inparms, java.lang.String content_type)
          Deprecated.  
 javax.mail.internet.MimeMessage composeMimeMessage( WCMSRecord input)
          This method will compose the mime message
 java.lang.Integer getArchiveFlag()
          getArchiveFlag() returns the archive flag from the transport info
 java.lang.String getConfigData(java.lang.String name)
          This method will return the first value found for given key.
 java.lang.String getConfigData(java.lang.String name, java.lang.String language)
          This method will return the first NL value found for given key.
 byte[] getContent(java.lang.Integer transport, java.lang.String language)
          This method is used by external users to get the content of a message from a particular transport.
 java.lang.Object getContentObject(java.lang.Integer transport, java.lang.String language)
          This method is used by external users to get the content object of a message from a particular transport.
 java.lang.String getContentType(java.lang.Integer transport, java.lang.String language)
          This method is used by external users to get the content type of a message from a particular transport.
 java.util.Vector getTransports()
          Gets the transports property (java.util.Vector) value.
 java.lang.String getUserData(java.lang.Integer transport, java.lang.String name)
          Returns the User Data attribute of the specified transport and attribute name.
static  Messaging load(byte[] ser)
          This public method can be used by users of the Messaging System to deserialize a serialized Messaging Object
 int remTransport(java.lang.Integer transport)
          Removes the transport so the message will not be using
 int sendImmediate()
          Sends the message immediately.
 byte[] sendReceiveImmediate()
          Sends the message immediately and waits for a response.
 Record sendReceiveRecordImmediate()
          Sends the message immediately and waits for a response.
 long sendTransacted()
          Saves the message to the MSGSTORE table.
 int setConfigData(java.lang.String name, java.lang.String value)
          This method will insert a nvp into the configuration data of ALL transports that have the name as a key in their hashtable.
 int setConfigData(java.lang.String name, java.lang.String language, java.lang.String value)
          This method will insert a nvp into the nl configuration data of ALL transports that have the name as a key in their hashtable.
 int setContent(java.lang.Integer transport, java.lang.String language, byte[] content)
          This method will insert the content of a message directly for a particular transport
 int setContent(java.lang.Integer transport, java.lang.String language, byte[] content, java.lang.String content_type)
          Deprecated.  
 int setContent(java.lang.Integer transport, java.lang.String language, java.lang.Object object)
          Insert the method's description here.
 int setLowPriorityConfigData(java.lang.String name, java.lang.String value)
          This method will insert a nvp into the configuration data of ALL transports that have the name as a key in their hashtable.
 int setLowPriorityConfigData(java.lang.String name, java.lang.String language, java.lang.String value)
          This method will insert a nvp into the nl configuration data of ALL transports that have the name as a key in their hashtable.
 void setNotificationID(java.lang.Long notifyID)
          setNotificationID set the notifcaiton id and replaces any default value using the data in the notification object (from database)
 void setPartialSend(java.lang.Boolean newPartialSend)
          Sets the partial send flag.
 int setUserData(java.lang.Integer transport, java.lang.String name, java.lang.String value)
          Sets the User Data for the specified transport.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright notice field.
See Also:
Constant Field Values
Constructor Detail

Messaging

public Messaging(java.lang.String msgTypeName,
                 java.lang.Integer store)
          throws ECException,
                 java.lang.NullPointerException
Messaging constructor. For the given key parameters, the constructor will access the messaging system tables and retrieve required information (based on the given priority level Information gathered : NVP's for CS, IS, misc , valid transports for key.
Parameters:
store - The store, part of the key used to access Admin information
Throws:
ECException - Raised with message _ERR_ADM_FINDEREXCEPTION whenever a request object is not found Raised with message _ERR_ACCESS_STORE whenever a request object is not found
java.lang.NullPointerException - Raised if the message type is null

Messaging

public Messaging(java.lang.String msgTypeName,
                 java.lang.Integer store,
                 java.lang.Integer priority)
          throws ECException,
                 java.lang.NullPointerException
Messaging constructor. For the given key parameters, the constructor will access the messaging system tables and retrieve required information (based on the given priority level Information gathered : NVP's for CS, IS, misc , valid transports for key.
Parameters:
store - The store, part of the key used to access Admin information
priority - The priority, used to filter table access
Throws:
ECException - Raised with message _ERR_ADM_FINDEREXCEPTION whenever a request object is not found Raised with message _ERR_ACCESS_STORE whenever a request object is not found
java.lang.NullPointerException - Raised if the message type is null

Messaging

public Messaging(java.lang.Integer msgty,
                 java.lang.Integer store)
          throws ECSystemException,
                 java.lang.NullPointerException
Deprecated. user Messaging(String, Integer) so the message type Identifier does not need to be hardcode by the application.
Messaging constructor. For the given key parameters, the constructor will access the messaging system tables and retrieve required information (based on the given priority level Information gathered : NVP's for CS, IS, misc , valid transports for key.
Parameters:
msgty - The message type, part of the key used to access Admin information
store - The store, part of the key used to access Admin information
Throws:
ECException - Raised with message _ERR_ADM_FINDEREXCEPTION whenever a request object is not found Raised with message _ERR_ACCESS_STORE whenever a request object is not found
java.lang.NullPointerException - Raised if the message type is null
ECSystemException

Messaging

public Messaging(java.lang.Integer msgty,
                 java.lang.Integer store,
                 java.lang.Integer priority)
          throws ECSystemException,
                 java.lang.NullPointerException
Deprecated. user Messaging(String, Integer, Integer) so the message type Identifier does not need to be hardcode by the application.
Messaging constructor. For the given key parameters, the constructor will access the messaging system tables and retrieve required information (based on the given priority level Information gathered : NVP's for CS, IS, misc , valid transports for key.
Parameters:
msgty - The message type, part of the key used to access Admin information
store - The store, part of the key used to access Admin information
priority - The priority, used to filter table access
Throws:
ECSystemException - Raised with message _ERR_ADM_FINDEREXCEPTION whenever a request object is not found Raised with message _ERR_ACCESS_STORE whenever a request object is not found
java.lang.NullPointerException - Raised if the message type is null
Method Detail

addContentPart

public void addContentPart(byte[] part)
This method adds a content part to the message content

addContentPart

public void addContentPart(byte[] part,
                           java.lang.String name,
                           java.lang.String type)
This method adds a content part to the message content

addMember

public void addMember(java.lang.Long memb)
               throws ECSystemException
This method sets the internal member vector with the single parameter. It adds to any previous members.
Throws:
ECSystemException - Raised with message _ERR_ACCESS_USER_BEAN whenever a request object is not found

addMemberGroup

public int addMemberGroup(java.lang.Long mbrgrp)
                   throws ECSystemException
This method sets the internal member vector with the member group parameter. Because the members in a member group can be member groups themselves, this method must perform a thorough explosion of the members. It adds to any previous members.
Parameters:
mbrgrp - The member group.
Returns:
int The return code.
Throws:
ECSystemException - Raised with message _ERR_ACCESS_USER_BEAN whenever a request object is not found

addSecureMember

public void addSecureMember(java.lang.Long memb)
                     throws ECSystemException
This method sets the internal securemember vector with the single parameter. It adds to any previous members.
Throws:
ECSystemException - The exception description. Raised with message _ERR_ACCESS_USER_BEAN whenever a request object is not found

addStore

public void addStore(java.lang.Integer astore_id)
              throws ECSystemException
Add a store to send the message on behalf of.
Parameters:
astore_id - The store identifier
Throws:
ECSystemException - The exception description. Raised with message _ERR_ACCESS_USER_BEAN whenever a request object is not found

clearMember

public void clearMember()
Removes all members from our internal recipient list.

compose

public void compose(java.lang.String view,
CommandContext comContext,
TypedProperty inparms)
             throws ECSystemException
This method will interface with the JSP's for each transport and return the message content to the content field. If AddMember*(Long) and AddSecureMember(Long) has not been called, this method requires correct language id set inside the command context object.
Parameters:
view - The view name
Throws:
ECSystemException - The exception description. Raised with message _ERR_EXEC_COMPOSE whenever an error occurs while composing the message Raised with message _ERR_CCF2JM_GENERIC_EXCEPTION whenever a CCF generic exception occurs

compose

public void compose(java.lang.String view,
CommandContext comContext,
TypedProperty inparms,
                    java.lang.String content_type)
             throws ECSystemException
Deprecated.  
This method will interface with the JSP's for each transport and return the message content to the content field. If AddMember*(Long) and AddSecureMember(Long) has not been called, this method requires correct language id set inside the command context object.
Parameters:
view - The view name associated with this message
content_type - The message content type which is used by JavaMail.
Throws:
ECSystemException - Raised with message _ERR_EXEC_COMPOSE whenever an error occurs while composing the message Raised with message _ERR_CCF2JM_GENERIC_EXCEPTION whenever a CCF exception occurs

composeMimeMessage

public javax.mail.internet.MimeMessage composeMimeMessage(WCMSRecord input)
                                                   throws ECSystemException
This method will compose the mime message
Parameters:
input - The input record
Returns:
The MimeMessage object
Throws:
ECSystemException - The exception description.

getConfigData

public java.lang.String getConfigData(java.lang.String name)
                               throws ECSystemException
This method will return the first value found for given key. It searches through the hash tables of all transports. If there is no transport available to be searched, this method returns null.
Parameters:
name - The attribute name.
Returns:
The attribute value
Throws:
ECSystemException - Raised with message _ERR_MSGTRANS_NOT_INIT whenever the hashtable containing the config data is null.

getConfigData

public java.lang.String getConfigData(java.lang.String name,
                                      java.lang.String language)
                               throws ECSystemException
This method will return the first NL value found for given key. It searches through the hash tables of all transports. If there is no transport available to be searched, this method returns null.
Parameters:
name - The attribute name.
language - The language id.
Returns:
The attribute value
Throws:
ECSystemException - Raised with message _ERR_MSGTRANS_NOT_INIT whenever the hashtable containing the config data is null.

getContentType

public java.lang.String getContentType(java.lang.Integer transport,
                                       java.lang.String language)
                                throws ECSystemException
This method is used by external users to get the content type of a message from a particular transport.
Parameters:
transport - The transport identifier
language - The language.
Returns:
String The content type of the message.
Throws:
ECSystemException - The exception description. Raised with ArrayIndexOutOfBoundsException whenever an exception occurs while accessing the transport array

getContent

public byte[] getContent(java.lang.Integer transport,
                         java.lang.String language)
                  throws ECSystemException
This method is used by external users to get the content of a message from a particular transport.
Parameters:
transport - The transport identifier
language - The language.
Returns:
byte[] The content of the message.
Throws:
ECSystemException - The exception description. Raised with ArrayIndexOutOfBoundsException whenever there is an error accesing the transport array

getContentObject

public java.lang.Object getContentObject(java.lang.Integer transport,
                                         java.lang.String language)
                                  throws ECSystemException
This method is used by external users to get the content object of a message from a particular transport.
Parameters:
transport - java.lang.Integer The transport.
language - java.lang.String The language.
Returns:
Object The content object of the message.
Throws:
ECSystemException - The exception description. Raised with ArrayIndexOutOfBoundsException whenever there is an error accesing the tranport array

getTransports

public java.util.Vector getTransports()
Gets the transports property (java.util.Vector) value.
Returns:
The transports property value.
See Also:
#setTransports

getUserData

public java.lang.String getUserData(java.lang.Integer transport,
                                    java.lang.String name)
                             throws ECSystemException
Returns the User Data attribute of the specified transport and attribute name.
Parameters:
transport - The transport.
name - The attribute name.
Returns:
The attribute value.
Throws:
ECSystemException - The exception description. Raised with message _ERR_MSGTRANS_NOT_INIT whenever the message transport is not found

load

public static Messaging load(byte[] ser)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
This public method can be used by users of the Messaging System to deserialize a serialized Messaging Object
Returns:
The messaging object
Throws:
java.io.IOException
java.lang.ClassNotFoundException

remTransport

public int remTransport(java.lang.Integer transport)
Removes the transport so the message will not be using
Parameters:
transport - The transport to remove.
Returns:
int The return code.

sendImmediate

public int sendImmediate()
                  throws ECSystemException
Sends the message immediately.
Returns:
The return code.
Throws:
ECSystemException - Raised with message _ERR_CCF2JM_CDATA_NULLCONTENT whenever the input byte[] parameter is null Raised with message _ERR_MSG_CFG_NOT_INIT whenever the messaging configuration data cannot be initialized Raised with message _ERR_ADM_FINDEREXCEPTION whenever a request object is not found Raised with message _ERR_ADM_NAMINGEXCEPTION whenever a failure to look up the JNDI name occured Raised with message _ERR_ADM_CREATEEXCEPTION whenever a failure to create the EJB occured

sendReceiveImmediate

public byte[] sendReceiveImmediate()
                            throws ECSystemException
Sends the message immediately and waits for a response.
Returns:
byte[] The response in bytes.
Throws:
ECSystemException - Raised with message _ERR_CCF2JM_CDATA_NULLCONTENT whenever the input byte[] parameter is null Raised with message _ERR_MSG_CFG_NOT_INIT whenever the messaging configuration data cannot be initialized Raised with message _ERR_ADM_FINDEREXCEPTION whenever a request object is not found Raised with message _ERR_ADM_NAMINGEXCEPTION whenever a failure to look up the JNDI name occured Raised with message _ERR_ADM_CREATEEXCEPTION whenever a failure to create the EJB occured

sendReceiveRecordImmediate

public Record sendReceiveRecordImmediate()
                                  throws ECSystemException
Sends the message immediately and waits for a response.
Returns:
Record The response in output record.
Throws:
ECSystemException - Raised with message _ERR_MSG_CFG_NOT_INIT whenever the messaging configuration data cannot be initialized Raised with message _ERR_CCF2JM_CDATA_NULLCONTENT whenever the input byte[] parameter is null Raised with message _ERR_UNSUPPORTED_ENCODING whenever an unsupported encoding exception occurs Raised with message _ERROR_JCA_NULL_JNDI whenver the JNDI name is either null or empty Raised with message _ERR_GENERIC whenever a generic error occurs Raised with message _ERROR_MSG_RESOURCE_EXCEPTION whenever a resource exception occurs

sendTransacted

public long sendTransacted()
                    throws ECSystemException
Saves the message to the MSGSTORE table.
Returns:
The number of bytes saved.
Throws:
ECSystemException - The exception description.

setConfigData

public int setConfigData(java.lang.String name,
                         java.lang.String value)
                  throws ECSystemException
This method will insert a nvp into the configuration data of ALL transports that have the name as a key in their hashtable. The name must already exist or an exception will be returned.
Parameters:
name - The attribute name.
value - The attribute value.
Returns:
The return code.
Throws:
ECSystemException - The exception description.

setConfigData

public int setConfigData(java.lang.String name,
                         java.lang.String language,
                         java.lang.String value)
                  throws ECSystemException
This method will insert a nvp into the nl configuration data of ALL transports that have the name as a key in their hashtable. This will only affect the value specified by the language.
Parameters:
name - The attribute name.
language - The language ID
value - The attribute value.
Returns:
int The return code.
Throws:
ECSystemException - Raised with message _ERR_MSG_CFG_NOT_INIT whenever the messaging configuration data cannot be initialized

setLowPriorityConfigData

public int setLowPriorityConfigData(java.lang.String name,
                                    java.lang.String value)
                             throws ECSystemException
This method will insert a nvp into the configuration data of ALL transports that have the name as a key in their hashtable. The name must already exist or an exception will be returned. This configuration data will only be used if there is no site/store administrator defined configuration.
Parameters:
name - The attribute name.
value - The attribute value.
Returns:
The return code.
Throws:
ECSystemException - Raised with message _ERR_MSG_CFG_NOT_INIT whenever the messaging configuration data cannot be initialized

setLowPriorityConfigData

public int setLowPriorityConfigData(java.lang.String name,
                                    java.lang.String language,
                                    java.lang.String value)
                             throws ECSystemException
This method will insert a nvp into the nl configuration data of ALL transports that have the name as a key in their hashtable. The name must already exist or an exception will be returned. This will only affect the value specified by the language. This configuration data will only be used if there is no site/store administrator defined configuration.
Parameters:
name - The attribute name.
value - The attribute value.
Returns:
The return code.
Throws:
ECSystemException - Raised with message _ERR_MSG_CFG_NOT_INIT whenever the messaging configuration data cannot be initialized

setContent

public int setContent(java.lang.Integer transport,
                      java.lang.String language,
                      byte[] content)
This method will insert the content of a message directly for a particular transport
Parameters:
transport - The Transport identifier
language - The language id
content - The content of the message to be set.
Returns:
The return code of the method.

setUserData

public int setUserData(java.lang.Integer transport,
                       java.lang.String name,
                       java.lang.String value)
                throws ECSystemException
Sets the User Data for the specified transport.
Parameters:
transport - The transport.identifier
name - The attribute name.
value - The attribute value.
Returns:
The return code whether the method executed successfully.
Throws:
ECSystemException - Raised with message _ERR_MSG_CFG_NOT_INIT whenever the messaging configuration data cannot be initialized

setContent

public int setContent(java.lang.Integer transport,
                      java.lang.String language,
                      java.lang.Object object)
Insert the method's description here.
Parameters:
transport - The transport identifier
language - The language
object - The MimeMultipart for JavaMail.
Returns:
The return code whether the method executed successfully.

setContent

public int setContent(java.lang.Integer transport,
                      java.lang.String language,
                      byte[] content,
                      java.lang.String content_type)
Deprecated.  
Insert the method's description here.
Parameters:
transport - The transport identifier
language - The language
content - The content of the message to be set
content_type - The content type of the message to be set
Returns:
The return code whether the method executed successfully.

getArchiveFlag

public java.lang.Integer getArchiveFlag()
getArchiveFlag() returns the archive flag from the transport info
Returns:
Integer, this is the archive flag

setNotificationID

public void setNotificationID(java.lang.Long notifyID)
                       throws ECSystemException
setNotificationID set the notifcaiton id and replaces any default value using the data in the notification object (from database)
Throws:
ECSystemException - Raised with message _ERR_ADM_FINDEREXCEPTION whenever a request object is not found Raised with message _ERR_ADM_NAMINGEXCEPTION whenever a failure to look up the JNDI name occured Raised with message _ERR_ADM_CREATEEXCEPTION whenever a failure to create the EJB occured

setPartialSend

public void setPartialSend(java.lang.Boolean newPartialSend)
Sets the partial send flag. The value will be saved into config data.