Thursday, April 25, 2013

Examples of Date and Time Formatting

Example: Gregorian Calendar
The following examples show a selection of dates and times and the way they might be formatted. These examples assume the use of the Gregorian calendar as the default calendar.

Required Output
Expression
2002-12-31
format-date($d, "[Y0001]-[M01]-[D01]")
12-31-2002
format-date($d, "[M]-[D]-[Y]")
31-12-2002
format-date($d, "[D]-[M]-[Y]")
31 XII 2002
format-date($d, "[D1] [MI] [Y]")
31st December, 2002
format-date($d, "[D1o] [MNn], [Y]", "en", (), ())
31 DEC 2002
format-date($d, "[D01] [MN,*-3] [Y0001]", "en", (), ())
December 31, 2002
format-date($d, "[MNn] [D], [Y]", "en", (), ())
31 Dezember, 2002
format-date($d, "[D] [MNn], [Y]", "de", (), ())
Tisdag 31 December 2002
format-date($d, "[FNn] [D] [MNn] [Y]", "sv", (), ())
[2002-12-31]
format-date($d, "[[[Y0001]-[M01]-[D01]]]")
Two Thousand and Three
format-date($d, "[YWw]", "en", (), ())
einunddreißigste Dezember
format-date($d, "[Dwo] [MNn]", "de", (), ())
3:58 PM
format-time($t, "[h]:[m01] [PN]", "en", (), ())
3:58:45 pm
format-time($t, "[h]:[m01]:[s01] [Pn]", "en", (), ())
3:58:45 PM PDT
format-time($t, "[h]:[m01]:[s01] [PN] [ZN,*-3]", "en", (), ())
3:58:45 o'clock PM PDT
format-time($t, "[h]:[m01]:[s01] o'clock [PN] [ZN,*-3]", "en")
15:58
format-time($t,"[H01]:[m01]")
15:58:45.762
format-time($t,"[H01]:[m01]:[s01].[f001]")
15:58:45 GMT+02:00
format-time($t,"[H01]:[m01]:[s01] [z]", "en", (), ())
15.58 Uhr GMT+02:00
format-time($t,"[H01]:[m01] Uhr [z]", "de", (), ())
3.58pm on Tuesday, 31st December
format-dateTime($dt, "[h].[m01][Pn] on [FNn], [D1o] [MNn]")
12/31/2002 at 15:58:45
format-dateTime($dt, "[M01]/[D01]/[Y0001] at [H01]:[m01]:[s01]")

Example: Non-Gregorian Calendars
The following examples use calendars other than the Gregorian calendar.
These examples use non-Latin characters which might not display correctly in all browsers, depending on the system configuration.
Description
Request
Result
Islamic
format-date($d, "[D١] [Mn] [Y١]", "Islamic", "ar", "AH", ())
٢٦ ﺸﻭّﺍﻝ ١٤٢٣
Jewish (with Western numbering)
format-date($d, "[D] [Mn] [Y]", "he", "AM", ())
‏26 טבת 5763
Jewish (with traditional numbering)
format-date($d, "[Dאt] [Mn] [Yאt]", "he", "AM", ())
כ״ו טבת תשס״ג
Julian (Old Style)
format-date($d, "[D] [MNn] [Y]", "en", "OS", ())
18 December 2002
Thai
format-date($d, "[D๑] [Mn] [Y๑]", "th", "BE", ())
๓๑ ธันวาคม ๒๕๔๕

########

Oracle Fusion Middleware Adapters




Application Adapters
Legacy Adapters
Changed Data Capture (CDC) Adapters
B2B Adapters
Technology Adapters
SAP
CICS
VSAM Batch
RosettaNet
File
PeopleSoft
IMS DB
Adabas
EDI
FTP
Siebel
IMS TM
DB2/390
Healthcare
JMS
Oracle Applications
VSAM
Microsoft SQL Server 2005
ebXML
Database
J. D. Edwards
Tuxedo
Microsoft SQL Server 2000
Advanced Queueing
IMS/DB
MQ Series
VSAM CICS
Socket



Technology adapters are included in the Oracle Internet Application Server and WebLogic Suite license upon which the Oracle SOA Suite has a licensing dependency. Other adapter types are licensed separately.
Financial Service adapters, along with Financial Message Designer, are separately licensed standalone products which inter operate with Oracle Service Bus. They are not JCA adapters like the other integration adapters. They include:
    SWIFT Adapter for Oracle Service Bus
    FIX Adapter for Oracle Service Bus
    Payments Adapter for Oracle Service Bus
    Derivatives Adapter for Oracle Service Bus
An additional separately licensed adapter, Enterprise Link for Business Activity Monitoring, is offered as an extension of the Oracle BAM product for customers who are looking to leverage Oracle BAM's embedded extract, transform and load (ETL) tooling. Enterprise Link is only one of five major ways to source data into Oracle BAM and is not required in all customer implementations. Customers who do not need Enterprise Link are any customers connecting to Oracle BAM only through BPEL PM Sensors or the Web Services API for Oracle BAM's Active Data Cache. Enterprise Link is required for all customers connecting to Oracle BAM through JMS queues or though query-based ETL updates. This includes customers who want to listen to JMS messages in existing integration environments, transfer large data sets into BAM, or archive data out of the BAM Active Data Cache on a scheduled basis.

########

Creating report based on External Data Source (Database table) – Oracle BAM


In Oracle BAM the reports can be created based on the external database table.This post will explain the steps required to build a simple report based on the external database table.
Create the External Database:
  • Login to Oracle BAM Start page and click on Architect button.


  • Select External Data Sources from the drop down list and click on the create button in the next page.

  • Provide the External Datasource Name and the database details and click on the Test button to test the External Data Source.

  • Click on Create Button and click on Continue.


Creating the Data object based on the External Data Source:
  • Select Data Objects from the drop down list and Click on Create Data Object
  • Enter the Data Object name and provide the folder in which the data object needs to be stored.
  • Select External Data Object check box and select the external data source created in the previous step and the database table from which the report needs to be created.
  • Click on Add field for all the fields that needs to be added into the data object (the fields that required for the report) from the table.


  • Click on Create Data Object and click on continue.
  • Click on Contents to see the data.


  • Click on the Layout to see the data object definition


Creating the report:
  • Login to Active Studio from the start page and click on Create New Report.
  • Select Single Tiled Report and select the report type as Streaming List
  • Select the ExternalDSDO and click on next


  • Select the required fields that need to be shown in the report and click on next.


  • Click on Change view properties and change the View Title as required and click on OK.

  • Click on the Save button to save the report.

########

Creating the reports based on the data from weblogic JMS queue – Oracle BAM


Oracle BAM supports the reporting based on the data from External Messaging Sources.
This post explains the steps to create a report based on the data from the weblogic Queue.
Create the data object:
Create a data object with required fields to populate the data from the JMS Queue (Refer the previous post for the steps to create the Data Object).Here I am creating the Employee data object with three fields.
 

Configure the External Messaging Source:
These steps configure the JMS queue and map the JMS data to the data object (Employee) created in the previous step.
  • Click on Architect button from the Start up page.
  • Select External Message Source from the drop down list.
  • Enter the name for the message source and also the JNDI Service provider URL, Queue connection factory name and Queue name.
  • Select the JMS Message Type as TextMessage.
  • Select the Data object name as Employee created in the previous step and also select the operation as Insert.

XML Formatting – Pre-Processing can be used to process the incoming xml message with XSLT (For this scenario I am not using any XSLT processing).
  • Enter the Message Element name as the parent element of the message.For my case the Message Element Name is EMPLOYEEDETAILS.
<?xml version="1.0" encoding="UTF-8"?>
<EMPLOYEEDETAILS xmlns="http://bamems.sample.com">
   <EMPNAME>Albin</EMPNAME>
   <EMPNO>24</EMPNO>
   <EMPAGE>27</EMPAGE>
</EMPLOYEEDETAILS> 
  •  Select Namespace Qualified checkbox and enter the name space value if the message is qualified with the name space. My case the name space is http://bamems.sample.com.
  • Select the Column value as Element Tag.
  • Select the data object the field name enter the corresponding XML tag name.

  • Click on save.
  • Post the sample data to the JMS queue and same can be verified in the Employee data object.
<?xml version="1.0" encoding="UTF-8"?>
<EMPLOYEEDETAILS xmlns="http://bamems.sample.com">
   <EMPNAME>Albin</EMPNAME>
   <EMPNO>24</EMPNO>
   <EMPAGE>27</EMPAGE>
</EMPLOYEEDETAILS>

Create the Report:
  • Create a report based on the Employee data object.

########

Send the reports to external email ids through Alerts - Oracle BAM server.


By default we can’t send the reports to an external email id’s from a BAM server, the reports only can be send to a users configured with Oracle BAM servers(through weblogic console).This post will explain how to enable the BAM server to send the reports to the external email ids.
Before following this post the email drivers details should be configured in UMS (through em console).
By default AlertActionAllowExternalEmail property in the BAMCommonConfig.xml file is set as false.
Change the value of AlertActionAllowExternalEmail property to true in the BAMCommonConfig.xml file to enable the external email feature. The BAMCommonConfig.xml file can be located in the following location BAM_DOMAIN_HOME/BAMDomain/config/fmwconfig/servers/BAMManagedServer/applications/oracle-bam_11.1.1/config.
 

Create an Alert to send the report to the External Email:

  • Login to the Architect window; select the Alert from the drop down list and click on Create New Alert.

  •  Click on Create New Rule

  •  Select the option as shown below (Change the action according to your requirement)
  • Click on select data field and select the data object field when that get changed the report needs to be send to the external email id.
  • Click on next and select the Action as shown below.
  • Click on the select report link and select the report that need to be send to the external email when the alert is fired.
  • Click on select user and enter the external email ids separated with semicolon as shown below
  • Update/insert the EMPNAME into the Employee data object from architect view.
          The below is the email sent the external email is.





 

########

Migrating the BAM objects across environments with the ANT script – Oracle BAM 11g

This post explains how to use the ANT script to migrate the BAM objects across the environments.The script can be run remotely from the client machine or from the server machine.
  • Create a folder BAMConfig and create two sub folders BAMObjects and config inside the BAMConfig folder
  • Copy the BAMICommandConfig.xml from $ORACLE_HOME/bam/config folder of the server to the config folder created in the above step.
  • Add the default user name and the password to the BAMICommandConfig.xml file
           <ICommand_Default_User_Name>weblogic</ICommand_Default_User_Name>
           <ICommand_Default_Password>hiyEbs0vwXPQrKh8yE7z3f7JVNhmLLEe+cR3bansiPc=</ICommand_Default_Password>

         Also verify the ADCServerPort - the BAM Server http listening port and   ADCServerName -  BAM Server host name properties.

Content of the configuration file:

<?xml version="1.0" encoding="UTF-8"?><BAMICommand>
<ADCServerPort>9001</ADCServerPort>
<ADCServerName>BAM Server hostname</ADCServerName>
<ICommand_Default_User_Name>weblogic</ICommand_Default_User_Name>
<ICommand_Default_Password>hiyEbs0vwXPQrKh8yE7z3f7JVNhmLLEe+cR3bansiPc=</ICommand_Default_Password>
<Communication_Protocol>t3</Communication_Protocol>
<SensorFactory>oracle.bam.common.statistics.noop.SensorFactoryImpl</SensorFactory>
<GenericSatelliteChannelName>invm:topic/oracle.bam.messaging.systemobjectnotification</GenericSatelliteChannelName>
</BAMICommand>

Default password should be encrypted else you will be receiving “ICommandEngine.MissingCredentials” error.

To encrypt the password configure the BAMICommandConfig.xml file in the $ORACLE_HOME/bam/config folder with the plain text password and run any standard icommand from the server (e.g $ORACLE_HOME/bam/bin/icommand -cmd export -type dataobject -name SampleDO -file C:\temp\SampleDO.xml) that will encrypt the password.
  • Create Export_BAM_Objects.xml file with the BAM export commands and place the same in BAMConfig folder created in the above step, the contents of the file look like below
<OracleBAMCommands>
   <!--import dataobjects-->
    <Export name="/Albin/BAMWebservice" type="dataobject" file="$BAM_PROJ_HOME$/BAMWebservice.xml"/>
    <Export name="/SampleDO" type="dataobject" file="$BAM_PROJ_HOME$/SampleDO.xml"/>
</OracleBAMCommands>
Configure the required export commands (exporting different type of objects) into this file.
  • Create Import_BAM_Objects.xml file with the BAM import commands and place the same in BAMConfig folder created in the above step, the contents of the file look like below
<OracleBAMCommands>
   <!--import dataobjects-->
   <Import file="$BAM_PROJ_HOME$/BAMWebservice.xml"/>
</OracleBAMCommands>
Configure the required import commands into this file.
  • Create the BAMBuild.xml file with the following contents and place the same in the BAMConfig folder created in the above step.
<project name="BAMMigrationProject" basedir="." default="config">
   <!--import the property file-->
   <property environment="env"/>
   <property name="src.dir" value="."/>
   <property name="proj.home" value="${env.BAM_PROJ_HOME}"/>
   <property name="oracle.home" value="${env.ORACLE_HOME}"/>
   <property name="oracle.common.home" value="${env.ORACLE_COMMON_HOME}"/>
   <property name="bam.core.lib.dir" value="${env.ORACLE_HOME}/bam/modules/oracle.bam_11.1.1"/>
   <property name="bam.tp.lib.dir" value="${env.ORACLE_HOME}/bam/modules/oracle.bam.thirdparty_11.1.1"/>
   <property name="dms.lib.dir" value="${env.ORACLE_COMMON_HOME}/modules/oracle.dms_11.1.1"/>
   <!--BAM Classpath required by icommand application-->
   <path id="bamClasspath">
      <fileset file="${bam.core.lib.dir}/oracle-bam-icommand.jar"/>
      <fileset file="${bam.core.lib.dir}/oracle-bam-common.jar"/>
      <fileset file="${bam.core.lib.dir}/oracle-bam-adc-ejb.jar"/>
      <fileset file="${dms.lib.dir}/dms.jar"/>
      <fileset file="${bam.tp.lib.dir}/jgroups-core.jar"/>
      <fileset file="${bam.tp.lib.dir}/xstream-1.3.1.jar"/>
      <fileset file="${bam.tp.lib.dir}/commons-codec-1.3.jar"/>
      <fileset file="${oracle.home}/../wlserver_10.3/server/lib/weblogic.jar"/>
      <fileset file="${oracle.common.home}/modules/org.jaxen_1.1.1.jar"/>
   </path>
   <!--export BAM DOs through icommand-->
   <target name="export" description="Export BAM dataobjects and reports" depends="config">
    <delete dir="${basedir}/BAMObjects" includeemptydirs="true" includes="*/**"></delete>
      <java classname="oracle.bam.icommand.Application" fork="true" dir="${src.dir}" classpathref="bamClasspath">
         <sysproperty key="oracle.bam.debug" value="true"/>
         <arg value="-CmdFile"/>
         <arg value="${basedir}/Export_BAM_Objects.xml"/>
      </java>
   </target>
   <!--import BAM DOs through icommand-->
   <target name="import" description="Import BAM dataobjects and reports" depends="config">
      <java classname="oracle.bam.icommand.Application" fork="true" dir="${src.dir}" classpathref="bamClasspath">
         <sysproperty key="oracle.bam.debug" value="true"/>
         <arg value="-CmdFile"/>
         <arg value="${basedir}/Import_BAM_Objects.xml"/>
      </java>
   </target>
   <!--Modify bam icommand files-->
   <target name="config">
       <!--replace $project.home$ with the actual project directory inside the command file-->
      <replace file="Export_BAM_Objects.xml" token="$BAM_PROJ_HOME$" value="${basedir}/BAMObjects"/>
      <replace file="Import_BAM_Objects.xml" token="$BAM_PROJ_HOME$" value="${basedir}/BAMObjects"/>
   </target>
</project>
  • To run the scripts from the server copy the BAMConfig folder with all the contents to the server.Set the environment variables ORACLE_HOME and ORACLE_COMMON_HOME(e.gORACLE_HOME=/oracle/Middleware/Oracle_SOA1;export ORACLE_HOME;ORACLE_COMMON_HOME=oracle/Middleware/oracle_common;export ORACLE_COMMON_HOME) and also set the PATH to ANT(e.g export PATH=$PATH:$ORACLE_HOME/../modules/org.apache.ant_1.7.1/bin)
         Execute the ant scripts
          ant –f BAMBuild.xml export

        The objects will be exported based on the commands in the Export_BAM_Objects.xml as an xml file   to the BAMObjects folder
         ant –f BAMBuild.xml import

           The xml file contents will be imported to BAM based on the commands in the Import_BAM_Objects.xml
  • To run the script from the client machine the JDeveloper with the same version as the BAM server should be installed.Set the ORACLE_HOME (e.g C:\EnvSetup\MiddlewareBlog\jdeveloper) and ORACLE_COMMON_HOME(e.g C:\EnvSetup\MiddlewareBlog\oracle_common) environment variables and also set the PATH to ANT
        Copy the commons-codec-1.3.jar file from the server location   ${env.ORACLE_HOME}/bam/modules/oracle.bam.thirdparty_11.1.1 to the <JDEV_HOME>\ jdeveloper\bam\modules\oracle.bam.thirdparty_11.1.1

########

Recovering the BPEL instances from Java For all faulted invoke

Written By Archit Bhardwaj

There are three types of Recoverable messages in BPEL Recovery console
  • 1.       Invoke
  • 2.       Callback
  • 3.       Activity
There are five message states for each type
1.       Undelivered
2.       Resolved
3.       Delivered
4.       Cancelled
5.       Exhausted

The Classes mentioned below are used only to recover messages in Undelivered Message state.

·         FaultRecoveryForInvoke.java- It recovers undelivered recoverable Invoke instances based on Composite Name.
·         FaultRecoveryForInvokeAll.java- It recovers all the Undelivered recoverable Invoke instances.
·         FaultRecoveryForCallback.java- It recovers undelivered recoverable Callback instances based on Composite Name.
·         FaultRecoveryForCallbackAll.java- It recovers all the Undelivered recoverable Callback instances.
The state set for undelivered instances is 0 in the code.

  
 For recovering messages from other states ,the filter.setState(x) can be changed to :-
0 for Undelivered
1 for Resolved
2 for delivered
3 for Cancelled
4 for exhausted
The jar files used for the code are :-
 
Code For Fault Recovery For Invoke
***************************************************************************

package Recovery.client;

import java.util.Hashtable;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;
import javax.naming.Context;
import oracle.soa.management.facade.Locator;
import oracle.soa.management.facade.LocatorFactory;
import oracle.soa.management.facade.bpel.BPELServiceEngine;
import oracle.soa.management.facade.bpm.BPMInvokeMessage;
import oracle.soa.management.util.MessageFilter;

public class FaultRecoveryForInvokeAll{
    private Locator locator = null;
    private BPELServiceEngine mBPELServiceEngine;
     
   
    public FaultRecoveryForInvokeAll(){
        System.out.println("Inside Constructor");
        locator = this.getLocator();
   
            try{
                System.out.println("Try Block of Constructor");
                mBPELServiceEngine=(BPELServiceEngine)locator.getServiceEngine(Locator.SE_BPEL);
            }
            catch (Exception e){
                e.printStackTrace();
            }
    }
   
   
      // Setting up connection properties
     
    public Hashtable getJndiProps(){
      System.out.println("Inside getJndiProps");
        Hashtable jndiProps = new Hashtable();
        jndiProps.put(Context.PROVIDER_URL,"t3://manish:7501/soa-infra");
        jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
        jndiProps.put(Context.SECURITY_PRINCIPAL, "manish");
        jndiProps.put(Context.SECURITY_CREDENTIALS, "********");
           jndiProps.put("dedicated.connection", "true");
      System.out.println("Connection Successfull");
        return jndiProps;
    }
     
      //Creating the locator to set up the connection to the server
     
    public Locator getLocator(){
      System.out.println("Inside  getLocator"); 
      try{
            System.out.println("Try Block of getLocator");
            return LocatorFactory.createLocator(getJndiProps());
        }
      catch(Exception e){
            e.printStackTrace();
      }
        return null;
    }
     
      // Reovering all recoverable faults listed under invoke and having the state Undelivered as on BPEL Recovery Console
     
    public void recoverFaults(){
      System.out.println("Inside  recoverFaults");
      try{
            int i=1;
            System.out.println("Try Block of recoverFaults");
            MessageFilter filter=new MessageFilter();
                 
          
            //filters can be set according to desired criteria
          
            filter.setState(0); 
                             
            //Getting all recoverable messages
            System.out.println("Getting Recoverable messages");
            List<BPMInvokeMessage> recoverable=mBPELServiceEngine.getInvokeMessages(filter);
            ListIterator it=recoverable.listIterator();
            while(it.hasNext()){
                  System.out.println("Record number----->>>"+i+"\t"+it.next());
                  i++;
            }
            System.out.println("total number of records-------->>>>>"+recoverable.size());
           
            //Recovering all recoverable messages
            mBPELServiceEngine.recoverInvokeMessages(recoverable);
            System.out.println("Messages Retried in one chance");
        }
      
        catch (Exception e){
            e.printStackTrace();
      }
    }
    public static void main(String[] args){
      // calling the method recoverFaults
       FaultRecoveryForInvokeAll faultRecovery = new FaultRecoveryForInvokeAll();
       faultRecovery.recoverFaults();
    }
}
************************************************************************


########