Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Sunday, April 24, 2011

Creating a robust, scale-out data abstraction layer with Oracle Coherence

Oracle Coherence is an in-memory data grid solution that enables organizations to predictably scale mission-critical applications by providing fast access to frequently used data. Data grid software is middleware that reliably manages data objects in memory across many servers. By automatically and dynamically partitioning data, Oracle Coherence enables continuous data availability and transactional integrity, even in the event of a server failure. Oracle Coherence provides organizations with a robust, scale-out data abstraction layer.

In today post, i will guide you through how to install, configure and run simple Java Coherence Application. Hopefully, it could help people understand the basic concept of Coherence and able to implement it in their real project. Good Luck!

1. Download the latest version of Oracle Coherence for Java here:
http://www.oracle.com/technetwork/middleware/coherence/downloads/coherence-101246.html

2. Download JDeveloper 11.1.1.3 here:
http://www.oracle.com/technetwork/developer-tools/jdev/downloads/soft11-098086.html

3. Unzip and Install Oracle Coherence and JDeveloper.
Ensure that the directory name you install into does not have any spaces.

4. Configure Java Home and Coherence
1. Setup JAVA_HOME for Oracle Coherence
• In the coherence.cmd and cache-server.cmd (located in [COHERENCE_HOME]\coherence\bin) set the JAVA_HOME variable to point to your JSDK 1.6 environment.

SET JAVA_HOME=[JDK PATH]

In Windows explorer change to the [COHERENCE_HOME]\coherence\bin directory.

• In the file coherence.cmd (or coherence.sh), find the line with set storage_enabled and
change the value false to true.

set storage_enabled=true

This option specifies if a process is a “Storage Enabled Member” when joining the cluster. Storage enabled members can store data as part of a Coherence cluster.

• Save the files and exit.

5. Run Coherence Cache Server
• From the [COHERENCE_HOME\coherence\bin directory run the following file: cache-server.cmd
• This will start up a storage enabled member in the cluster. When you start the first cache-server up you will notice a slight delay as the cache server looks for an existing cluster. Once it determines there are no clusters to join, it will start one.

Note: by default Coherence uses multicast to search for cluster members only. Multicast is not used for data transfer. If you cannot use or do not want to use multicast then this can be configured.

• You should see a number of messages displayed and at the bottom of your console, you should see below message:

Started DefaultCacheServer...

6. Run coherence console and test the Cache Server
  • Run coherence.cmd (windows) or coherence.sh (unix/linux)
  • You should now see the following prompt:
    Map (?):
  • This application shows you the basic distributed cache functionality build within
    Coherence
  • Type in the following to create a new named cache called test.
    cache test
  • Each named cache can be thought of as a table. A cluster can have many named caches. Each named cache holds one type of object. It can be a simple object such as a String, or a complex object that you define
  • Type in the command help to see the list of commands available. The following
    commands are the ones you will use most:
    • put – puts a name value pair (key and value) into the cache. Always returns the last
    value that the key had; get – retrieves the value for the given key from the named cache;
    • list – shows the contents of the named cache;
    • remove – removes a key value from the cache
  • Use the commands above and put and get some values. For ex. put name John [enter], get name [enter]
7. Create Java Application and connect to Cache Server
Since you're going to use Coherence API. You must configure coherence java libraries (under your [COHERENCE_HOME]/coherence/lib) before writing and compiling the applications.


Below is the code that you can use to put and get some value from Cache Server:

import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;

public class MyFirstSample {
public MyFirstSample() {
}

public static void main(String[] args) {

// ensure we are in a cluser
CacheFactory.ensureCluster();

// create or get a named cache called mycache
NamedCache myCache = CacheFactory.getCache("mycache");

// put key, value pair into the cache.
myCache.put("Name","John");

System.out.println("Value in cache is " + myCache.get("Name"));

}
}

That's it. Congratulations! you have successfully created your first robust, scale-out java application using Oracle Coherence Data Cache Solution. With this simple example, you could have different data sources i.e. Oracle Database, SAP, Siebel, etc. and put them onto the Cache Server that a variety of clients can connect, get some valuable information from it.


Tuesday, April 19, 2011

Oracle has two approaches for BPM:
1. Using BPMN and BPEL along side by side, and run them with single runtime engine (BPM Suite + SOA Suite)
2. Using BPMN and generate or merge it into BPEL, and run them with BPEL engine (BPA Suite + BPM Suite + SOA Suite)

How does it transform business process into a BPEL process?

The business process models are abstract and have to be implemented before they can be realized. Once business decides that a specific version of the process model is ready for implementation, the model is marked for IT implementation and saved in the Business Process Repository. The blueprint can now be used to create a BPEL process in Oracle JDeveloper.
BPEL transformation generates Process Blueprint and associated skeletal BPEL code. The IT developer needs to add implementation details to the BPEL code to convert it into an executable process that can be deployed on the run-time engine (BPEL Process Manager).

The transformation a business process into a BPEL process comprises the following:
■ Notification Services are transformed into a Business Scope upon BPEL transformation. The corresponding Notification service as well as the BPEL artifacts for invoking the Notification service are created within the business scope.
■ Human tasks are converted to a human workflow business scope upon BPEL transformation. The Task Service gets automatically generated as well as the BPELartifacts for invoking the Task service also gets generated. The Notification/Reminder notes get translated to business annotations.
■ Automated activities are converted to a business scope upon BPEL transformation.
■ Business Service is converted to a Partner Link upon BPEL transformation. If the Business Service is associated with a concrete WSDL, it is converted to a concrete Partner Link. Otherwise, it is converted into an abstract Partner Link. If Represented by is set to "invoke", an invoke activity is created inside the business scope and is linked to the Partner Link. If Represented by is set to "receive", a receive activity is created inside the business scope and is linked to the Partner Link. The Sensor definition is converted in to a business annotation.
■ XOR, AND and OR gateways are converted to switch and case statements upon BPEL transformation.
■ All Business Data in the Business Process Diagram are converted to Variables upon BPEL transformation. If the Business Data is associated with an XSD, the XSD is exported and the Variable in the BPEL skeletal process generated is then set to the XSD type. Otherwise, the Variables are set to String type.
■ Business Rules are converted into a Decision Service. The free text in the Rules field is converted into business annotation.

BPA View




BPEL View in JDeveloper



Cool..you can switch BPEL view and BPA view.

BPM Studio documentation stated somewhere that we can convert bpmn process to bpel which i can't find it. Because when you create SOA project from JDeveloper and connect it to BPA Repository, it will only convert it.

Sunday, April 17, 2011

Securing your Enterprise Web Services using Oracle Enterprise Gateway 11g


Oracle Enterprise Gateway is positioned for First Line of Defense in your company's DMZ.


Here are the list of some features you could get from Oracle Enterprise Gateway:


1. XML Firewall



  • Checking for XML well-formedness

  • XML document size

  • XPath and XQuery injection

  • SQL injection

  • XML encapsulation

  • XML viruses

  • Scanning outgoing messages for sensitive content based on metadata or regular expression patterns

  • Detecting XML bombs and XML clogging

  • Scanning WSDL files

2. Accelerated XML Processing



  • Frees up resources on application servers

  • Enables applications to run faster

  • Patented acceleration engine

  • Faster XML validation

  • Faster processing of XML queries and transformations

Oracle Enterprise Gateway could be used together with Oracle Service Bus for Web Services Virtualization and Last-Mile Security (as shown in above picture).

Monday, September 20, 2010

Oracle Enterprise Manager 10g Application Diagnostics for Java

Oracle AD4J is a lightweight Java application monitoring and diagnostics tool that enables administrators to diagnose performance problems in production.

There are two installations, one is AD4J Agent and the other is AD4J Console.
AD4J Agent is a j2ee application need to be deployed in target OC4J (which you need to diagnose).
AD4J Console is a web based application which you can use to monitor the application in target OC4J (which you have installed AD4J Agent).

Installation steps:
1. Download and install AD4J Console on any server
2. Login to AD4J Console, and download AD4J Agent
3. Deploy AD4J Agent to target J2EE Server
4. You can check in target J2EE Server log to verify AD4J is running (For OC4J it will be in OC4J OPMN log)

For more information on how to install AD4J Agent and Console, please follow below link:

Thursday, August 19, 2010

Install Oracle JDeveloper 11g on Mac

To install Oracle JDeveloper 11g (11.1.1.3) on Mac Snow Leopard is pretty straightforward.
Make sure you have updated Java to version 1.6 and set it as default in Java Preferences.

After that, execute below commands in terminal:

$ cd /System/Library/Frameworks/JavaVM.framework/Versions/
$ sudo rm CurrentJDK
$ sudo ln -s 1.6.0 CurrentJDK

Tuesday, April 29, 2008

Like '%' and ROWNUM

I've found many of developers using like with '%' and allowing application user to fetch all rows in table. For example consider query like this:

select * from ms_account where customer_name like '%'||:p_1||'%'

When the users submit the query using a,b or % only, the database will query all the records and could cause very high consumption server resources (Memory, I/O, CPU)

Using rownum could help.

select * from ms_account where customer_name like '%'||:P_1||'%' and rownum <= 10. This will fetch the query with maximum 10 records.

Learn more about rownum : http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html

You should limit your query (espesially the one with LIKE)

Thursday, January 3, 2008

Oracle Forms vs Oracle ADF

I've been using Oracle Forms/Reports for about 5 years,with all of its pros and cons. About 2 years ago, i have opportunity to implement my j2ee skill using Oracle ADF Swing,JSP and ADF Business components. It was a great learning experience. Right now, with EJB 3.0 released, i research more into ADF Toplink and ADF Faces to accelerate my skill set.

My opinion is:
1.Use Oracle Forms wisely. You have to understand the network requirement that could impact your application performance and the architecture flexibility. We can not configure cluster for Oracle Forms. You have to buy Load Balancer, either hardware or software to achieve high availability.

2.Use Oracle ADF to gain more flexibility in designing your application. With this framework, you have a lot of flexibility from choosing persistence technology to the client type. Oracle ADF has excellent data binding features. You can use different persistence technology ie. Toplink,ADF BC, Flat files, XML, etc. and display it using the same client code or reversely you can used your persistence component to different client type ie. web apps, swing, mobile.

Use the tools wisely and carefully...... "flexibility comes with complexity" :)