|
Invoking / Calling Procedure (within Database Package) from JCAPS |
|
Sometime packaging all the sql into a procedure helps us to get rid of the usual Oracle/SQL OTD bugs. The smartest way is to collect all the information which we require in a jcd and then trying to write an optimized query which fetches the results as per out requirement.
Doing such tasks with the help of Oracle/SQL OTD Wizard looks easy initially but can be painful and tedious in case change-requests drops to your email after completion of the first phase of your project :)
Following example illustrates how we can call a procedure from JCD:
Writing and executing sql queries/ procedure calls in Collaboration in core java gains a lot of flexibity in terms of changes later on. Also we can create dynamic queries which i feel is not possible to create with the help of Oracle/SQL OTD.
Labels: best practises, Calling procedure from jcaps, connection, Interview Questions on SUN JCAPS(submitted by Manesh Koovappillil), jcaps procdure, oracle, package procedure, procedure, sql |
 |
|
|
Log4j in JCAPS |
|
Following is the Steps to implementation the log4j in JCAPS
Step 1:
Import the log4j jar file in to your Project by
Right click on the project select - > import then -> file we chose the
-> jar file (log4j) and select import.
Step 2:
Then import the jar file into your JCD where you want to implement the
log4j is by
Click on Import JAR file on JCD console -> Add ->and select the jar
file that had been imported into you project.
Step 3:
Then code import command statement in the JCD.
import org.apache.log4j.*;
Step 4:
Declare the object for the logger before the main method, as below.
static Category logger = Category.getInstance( "" );
Step 5:
In the Main method code specific path and the log4j properties file, as bel
ow.
PropertyConfigurator.configure( "" );
Step 6:
See that you had configured the log4j property file; your log4j should
look like this
log4j.category.jcdManesh=INFO,dest1
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.File=C:/Properties/InstJava.log
log4j.appender.dest1.MaxFileSize=10MB
log4j.appender.dest1.MaxBackupIndex=1
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
Sample implementation of the log4j JCD looks like this
Code:
package Project1;
import org.apache.log4j.*;
public class jcdManesh
{
static Category logger = Category.getInstance( "jcdManesh" );
public com.stc.codegen.util.CollaborationContext collabContext;
public com.stc.codegen.util.TypeConverter typeConverter;
public void receive( com.stc.connector.appconn.file.FileTextMessage inp
ut )
throws Throwable
{
PropertyConfigurator.configure(
"C:/JavaCAPS513/logicalhost/log4j.properties" );
logger.info( ">>>>>> START <<<<<<" ); logger.info( ">>>>>> END <<<<<<" ); } }
Sample log4j.properties for the above JCD looks like this
Code:
log4j.category.jcdManesh=INFO,dest1
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.File=C:/Properties/InstJava.log
log4j.appender.dest1.MaxFileSize=10MB
log4j.appender.dest1.MaxBackupIndex=1
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
Note: You can download the Log4J from the following website:
http://logging.apache.org/log4j/1.2/download.htmlLabels: java caps, Log4J, Log4j in JCAPS, Logging, Monitoring |
 |
|
|
BatchInbound File Name Pattern - Working with JCAPS regular expression |
|
Sometimes providing a pattern to any of the Batch Adapter in JCAPS can be a pain and involves a lot of Googling for an regex which actually would work for us. It may look simple intially but writing a wrong file regex pattern can cause dangling exception at runtime.
In case you are looking for file pattern which has to read any file with a particular extension like .cntl, you can use :
.*\.cntl
or may you need to read any file from a particular directory do use:
.*\.*$
The above file patterns have worked for JCAPS 5.1.X and JCAPS 6.
Incase you are looking for a specific pattern as per your requirement do write to me at manesh@jcapsmentor.com
Also, following are some sites which can help you to check the regex which you have thought about to implement in the Batch Adapter as patterns:
http://www.myregextester.com/
http://www.fileformat.info/tool/regex.htm
Regards,
MakLabels: advantages jcaps 6, File Pattern, Inbound File Name Pattern, JCAPS regular expressions, patterns |
 |
|
|
|
Manesh Abhimanyu |
Manesh is a Sr. EAI Consultant, at present working in Singapore (Little Red Dot).
His focus is in the areas of SOA, ESB and Enterprise Architecture Management.
Contact him via email (mak2powerATyahoo.co.in)
|
Menu |
|
Archives |
|
Links |
|
Website developed & maintained by |
Manesh
Abhimanyu K. (Mak)
Click here to contact Manesh
 |
|