Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Tuesday, November 20, 2007

Helper for Purging Oracle Bpel Instances.

I had written a piece of code during my free time, which I thought would share with some Bpel enthusiasts. There had always been questions regarding purging of Bpel instances, if it's faulted or completed abnormally..

The following code removed all the bpel instances which are:


  • Closed Faulted
  • Stale
  • Cancelled



import com.oracle.bpel.client.IActivityConstants;
import com.oracle.bpel.client.IInstanceHandle;
import com.oracle.bpel.client.Locator;

public class PurgeHelper {

    
public static void purgeInstances(String aDomainId, String aPassword, String aIPAddress) throws Exception {
        
        // initialize the instance handler
        IInstanceHandle instances[] = null;
        try {
            //check if parameters are invalid
            if(aDomainId ==null || aPassword == null )//|| aIPAddress ==null)
                throw new  Exception(" Invalid Parameter");
            // get the instances
            instances = new Locator(aDomainId, aPassword).listInstances(1, -1);
            // check for null
            if (instances == null) {
                throw new Exception("No Instances Retrieved");
            }

            // get the instance length
            int instancesLength = instances.length;
            // iterate
            for (int j = 0; j <=instancesLength;++j)
                // get the instance
                IInstanceHandle tempInstance = instances[j];
                // check for null
                if (tempInstance == null)
                    continue;
                
                //check  the state
                if(tempInstance.getState()!= IActivityConstants.STATE_CLOSED_FAULTED ||
                        tempInstance.getState()!= IActivityConstants.STATE_CLOSED_STALE ||
                        tempInstance.getState()!= IActivityConstants.STATE_CLOSED_CANCELLED)||
                        ){
                    // remove the instance from the Dehydration Store
                    tempInstance.delete();
                }

            }

        } catch (Exception err) {
            // handle exception
        }

    }

/* Some usefull Bpel instance status */

// IActivityConstants.STATE_CLOSED_FAULTED);
     // IActivityConstants.STATE_CLOSED_ABORTED);
     // IActivityConstants.STATE_CLOSED_COMPLETED);
     // IActivityConstants.STATE_CLOSED_CANCELLED);
     // IActivityConstants.STATE_CLOSED_COMPENSATED);
     // IActivityConstants.STATE_CLOSED_FINALIZED);
     // IActivityConstants.STATE_CLOSED_PENDING_CANCEL);
     // IActivityConstants.STATE_CLOSED_STALE);

   

}

Note. You need to add orabpel.jar for compilation.

Wednesday, May 31, 2006

Oracle & Open Source

Oracle is in sync with the Open Source community. InnoDB followed by ADF Faces, which was contributed to Apache, by Oracle and others like BPEL Process manger Plug in for Eclipse, to name a few.

A couple of months before, I passed through an article in OTN, Oracle Technology website, regarding the acquisitions of Innobase, the company which makes a very powerful DB engine called InnoDB. To make things clearer, let me just talk about InnoDB for a while.

I am not sure of the version, when MySQL made InnoDB the default engine. But earlier in MySQL versions of 3.x, it was a pain working with MYSQL and the basic MyISAM engine, where there was not foreign key constrains available, and the performance was snail. The INODB, which comes with the MYSQL, has a bunch of excellent features, which made MySQL the best open source database. To name a few, they are:

Transaction-safe

Oracle-styles, non-locking read

Multi-user concurrency

Constraint support-foreign keys

Maximum performance, with large volumes of data

Moreover, fully integrated with MySQL Server, the InnoDB storage engine maintains its own buffer pool for caching data and indexes in main memory. InnoDB stores its tables and indexes in a tablespace, which may consist of several files (or raw disk partitions). This is different from, for example, MyISAM tables where each table is stored using separate files. InnoDB tables can be of any size even on operating systems where file size is limited to 2GB.

J, Not Sure of what will be the fate of MYSQL. But I feel this is one of the intelligent acquisitions Oracle has made. Literally speaking MYSQL, is/was definitely a competitor for Oracle Database, for customers who look for both Economy and a bit of performance. The Oracle policy: “BUY IT IF YOU CANT BEAT IT” is slowly and consistently making waves.

Well, one more thing to add, MYSQL is not free, for people who think that way:

http://www.mysql.com/company/legal/licensing/faq.html