CSF Usage Guide
CSF Usage Guide
Note: 1. Be sure to use “/” instead of the regular “\” for path.
2. No environment variable should contain “/u”, it will cause failure at reading property.
Note: Developers should NOT rely solely on the basic data set. Developers should acquire a full
understanding of the data structure and customize the data according to the business
requirements. (See section 3).
2.3.1 Windows
1. Move the batch file, bindingCreate.bat, from install/script to the common service dir, eg.
D:/CommonService
2. Edit the batch file, example:
set JAVA_PATH=D:\JavaCAPS51\edesigner\jdk\bin
set
CLASSPATH=.\lib\activation.jar;.\lib\classes12.jar;.\lib\com.stc.jms.stcjms.jar;.\lib\egate
.jar;.\lib\fscontext.jar;.\lib\jms.jar;.\lib\mail.jar;.\lib\xdb.jar
set FILE_CONTEXT=.
set SOURCE=archdb
set SID=orcl
set HOST=localhost
set PORT=1521
set USER_NAME=admin
set PASSWORD=admin
3. Execute the batch file. A .bindings file is created under the common service folder. The
.bindings file looks like the following and you should find information in the highlighted area:
#This file is used by the JNDI FSContext.
#Tue Aug 07 15:43:02 EDT 2007
user/archdb/RefAddr/2/Encoding=String
user/archdb/RefAddr/0/Type=Source
jdbc/archdb/RefAddr/4/Content=1521
jdbc/archdb/RefAddr/3/Encoding=String
jdbc/archdb/RefAddr/2/Content=orcl
jdbc/archdb/ClassName=oracle.jdbc.pool.OracleConnectionPoolDataSource
user/archdb/RefAddr/1/Type=UserName
jdbc/archdb/RefAddr/0/Type=driverType
jdbc/archdb/RefAddr/1/Content=localhost
user/archdb/RefAddr/0/Encoding=String
user/archdb/RefAddr/2/Type=Password
jdbc/archdb/RefAddr/1/Encoding=String
jdbc/archdb/RefAddr/1/Type=serverName
user/archdb/ClassName=com.accenture.eai.cs.DataAccess.DataAccessUser
jdbc/archdb/RefAddr/2/Type=databaseName
jdbc/archdb/FactoryName=oracle.jdbc.pool.OracleDataSourceFactory
user/archdb/RefAddr/2/Content=05EFBAC0269A <- encrypted password*
jdbc/archdb/RefAddr/4/Encoding=String
jdbc/archdb/RefAddr/3/Type=networkProtocol
jdbc/archdb/RefAddr/3/Content=tcp
user/archdb/RefAddr/1/Encoding=String
jdbc/archdb/RefAddr/0/Content=thin
jdbc/archdb/RefAddr/4/Type=portNumber
jdbc/archdb/RefAddr/2/Encoding=String
jdbc/archdb/RefAddr/0/Encoding=String
user/archdb/FactoryName=com.accenture.eai.cs.DataAccess.DataAccessUserFactory
user/archdb/RefAddr/1/Content=admin
MH_MSG_TOKEN=$
LOGGING_FLAG_FILE
MH_RECEIVER_TIMEOUT=10
NOTIF_RECEIVER_TIMEOUT=10
# Message code
MH_MSGCODE_TABLE=mh_msgcode_table
MH_MSGCODE_MSGCODE_COLUMN=mh_msgcode_msgcode
MH_MSG_COLUMN=mh_msg
# Message severity
MH_SEVERITY_CODE_TABLE=mh_severity_code_table
MH_SEVERITY_SEVCODE_COLUMN=mh_severity_sevcode
MH_SEVERITY_SEVERITY_COLUMN=mh_severity_severity
#####################################################################
# Notification Framework Properties
#####################################################################
# CHANGE THE FOLLOWING PROPERTY BASED ON YOUR ENVIRONMENT SETTING
NOTIF_HOST_NAME=localhost
NOTIF_PORT_NUMBER=18007
NOTIF_QUEUE_NAME=NotifQueue
NOTIF_ERROR_LOG_FILE=D:/Mammoth Visteon Assets/Common Service Framework/log/Notification/notification.log
NOTIF_BACKUP_FILENAME=D:/Mammoth Visteon Assets/Common Service
Framework/log/Notification/notificationQueueLog
# SMTP Server
mail.smtp.host=vistsmtp.visteon.com
# Default email contact when notification faiures
NOTIF_EMAIL_DEF_FROM_ADDRESS=support@visteon.com
NOTIF_EMAIL_DEF_SUBJECT=Notification Failure
NOTIF_EMAIL_DEF_TO_ADDRESS1=dwang2@visteon.com
NOTIF_EMAIL_DEF_TO_NAME1=David Wang
NOTIF_EMAIL_DEF_TO_ADDRESS2
NOTIF_EMAIL_DEF_TO_NAME2
NOTIF_DISTR_MATRIX_TABLE=notif_distr_matrix
NOTIF_MATRIX_TRANS_COLUMN=char_trans_code
NOTIF_MATRIX_DISTR_COLUMN=char_distr_code
NOTIF_MATRIX_DESTINATION=notif_destination
NOTIF_DATABASES_TABLE=notif_databases
NOTIF_DB_DESTINATION=notif_destination
NOTIF_DB_NAME=db_name
NOTIF_DB_TABLE=db_table
NOTIF_DB_COLUMN=db_column
NOTIF_EMAIL_INFO_TABLE=notif_email_group_info
NOTIF_EMAIL_INFO_GROUP_NAME=group_name
NOTIF_EMAIL_INFO_FROM_ADDRESS=from_address
NOTIF_EMAIL_INFO_FROM_NAME=from_name
NOTIF_EMAIL_INFO_SUBJECT=subject
NOTIF_EMAIL_TABLE=notif_email_groups
NOTIF_EMAIL_GROUP_NAME=group_name
NOTIF_EMAIL_TO_ADDRESS=to_address
NOTIF_EMAIL_TO_NAME=to_name
NOTIF_DB_TRANS_CODE=DB
NOTIF_FF_TRANS_CODE=FF
NOTIF_EM_TRANS_CODE=EM
NOTIF_PG_TRANS_CODE=PG
NOTIF_SNMP_TRANS_CODE=SNMP
NOTIF_ARCH_EXCEPTIONID=exceptionid
NOTIF_ARCH_MESSAGECODE=msg_code
NOTIF_ARCH_TIMELOGGED=timelogged
NOTIF_ARCH_SEVERITY=severity
NOTIF_ARCH_CLASSTYPE=classtype
NOTIF_ARCH_PROJECTPATH=projectpath
NOTIF_ARCH_COLLABORATION=collaboration
NOTIF_ARCH_DESCRIPTION=description
NOTIF_ARCH_PAYLOAD=payload
NOTIF_ARCH_RESUB_STATUS=resubstatus
NOTIF_ARCH_LAST_MODIFIED_BY=lastmodifiedby
NOTIF_ARCH_LAST_MODIFIED_DATE=lastmodifieddate
NOTIF_PROPERTY_TABLE=message_property
NOTIF_PROPERTY_EXCEPTIONID=exceptionid
NOTIF_PROPERTY_KEY=key
NOTIF_PROPERTY_VALUE=value
NOTIF_PROPERTY_TABLE=message_property
NOTIF_PROPERTY_EXCEPTIONID=exceptionid
NOTIF_PROPERTY_KEY=key
NOTIF_PROPERTY_VALUE=value
#####################################################################
# Resubmit Framework Properties
#####################################################################
RESUB_MES_TABLE=resubmit_message
RESUB_MES_MESSAGECODE=msg_code
RESUB_MES_COLLABORATION=collaboration
RESUB_MES_DESTINATION=destination_id
RESUB_MES_TYPE=resub_type
RESUB_DEST_TABLE=resubmit_destinations
RESUB_DEST_ID=destination_id
RESUB_DEST_NAME=destination_name
RESUB_DEST_HOST=hostname
RESUB_DEST_PORT=port
RESUB_DEST_TYPE=destination_type
#####################################################################
# Parametization Properties
#####################################################################
PARAM_DATABASE_NAME=archdb
Note:
1) Make sure the directory exists before using the service.
2) All log files is set to rollover when reaches 10MB.
4 Invoking the Service
This section shows some essential examples on how to invoke the common services APIs.
• Scenario 3: When user will send the payload and message property along with other parameters to
messgaHandling framework:
[0] import com.accenture.eai.cs.MessageHandling.*;
…
[1] MessageHandling mh = MessageHandling.getInstance();
[2] int msgCode = 0004;
10/15/2008 PRIVATE/PROPRIETARY Page 9
Contains Private and/or Proprietary information.
May not be disclosed outside of Accenture except by a written agreement.
Copyright © 2007 Accenture
int severity = 4;
int classType = 1;
String eventType = “testEvent”;
String collabName = collabContext.getCollaborationName();
String projectPath = collabContext.getProjectPath();
String payload = message.getTextMessage();
String[] msgParameter = {"TestDriver","testMessage","testStackTrace", payload};
HashMap hm = new HashMap();
hm.put(“UserProperty”, input.retrieveUserProperty(UserProperty));
[3] if (!mh.isInitialize()) {
if (!mh.initialize()) {
logger.error( "Failed to initialize message handler" );
} else {
logger.info( "Messagehandler is initialized successfully" );
}
}
[4] mh.messageHandler(msgCode,severity,classType, collabName, projectPath, msgParameter, hm);
4.3 Parameterization:
1. Import project Mammoth_JARS project to your Java CAPS.
2. Import all the jars under the project to the JCDs that will use common services.
3. Using the service:
[0] import com.accenture.eai.cs.Parameterization.*;
String key = otdBatchServiceInterface.getBatchServiceHeader().getKey();
[1] Parameterization pm = Parameterization.getInstance();
[2] String paramTable = “PARAM_PUBLISH_TABLE”;
if (!pm.isInitialize( paramTable )) {
if (!pm.initialize( paramTable )) {
logger.error( "Failed to initialize parmeterization table: " + paramTable );
10/15/2008 PRIVATE/PROPRIETARY Page 11
Contains Private and/or Proprietary information.
May not be disclosed outside of Accenture except by a written agreement.
Copyright © 2007 Accenture
} else {
logger.info( "Parameteriztaion Table : " + paramTable + " is initialized successfully" );
}
}
[3] HashMap pb = pm.getParam(paramTable,key);
[4] String hostname = pb.get(“HOSTNAME”).toString();
String username = pb.get(”USERNAME”).toString();
....
5 Best Practices
It is recommended that user access MessageHandling and Notification by using the only public method from
MessageHandling class: MessageHandler. First, user should get the instance of the class by invoking the static
method, getInstance ():
MessageHandling mh = MessageHandling.getInstance ();
User now can perform all required message handling by using messageHandler method and provide the
appropriate parameters. The signature of messageHandler is:
public boolean messageHandler (int msgCode, int msgSeverity, int clsType, String localCollabRuleName,
String projectPath, String[] msgParameters)
Example of Usage:
For Notification:
1. NOTIF_ERROR_LOG_FILE=D:/CommonService/log/Notification/notification.log*
2. NOTIF_BACKUP_FILENAME= D:/CommonService/log/Notification/notificationLog*
3. NOTIF_DEF_FILE=D:/CommonService/log/Notification/notificationDeliverError.log*