Thursday, July 19, 2012

call https service from osb...

The below is copied from: https://forums.oracle.com/forums/thread.jspa?threadID=1120159







Below note gives the high level steps to be performed for implementing different security requirements with OSB

OSB - Proxy Service HTTPS one way
Configure Identity & Trust Keystore

OSB - Proxy Service HTTPS 2 way
Configure Identity Assertion Provider to support X509
Configure user mapper class for default identity assertion provider
Change 2 way Client Cert behaviour from default
('Client Certificate Not requested”) to “Client Certificate requested but not enforced”

OSB - Business Service HTTPS one way
Add root & intermediate CA certificates of the server to the trust keystore

*OSB - Business Service HTTPS 2 way *
Add root & intermediate CA certificates of the server to the trust keystore
Configure PKI Credential Provider containing the client certificate
Configure a Service Key provider with SSL Client Authentication key
Associate the service key provider to the proxy service which invokes the business service

OSB - Proxy Service WS-Security User Name Token
Configure Auth.xml or custom username token WS-Security Policy

OSB - Proxy Service WS-Security X509 Token
Configure Auth.xml and Sign.xml Policy
Change UseX509ForIdentity attribute in domain → WS Security → Inbound Mbean Token handlers Page to true
Ensure Certificate passed by client is present in certificate registry or the root CA in trust keystore depending upon weblogic certification path provider configuration
Configure Identity Assertion Provider and Username mapper class.

OSB - Business Service WS-Security User Name Token
Configure Auth or custom username token WS-Security Policy
Configure Service account for username provider

OSB - Business Service WS-Security X509 Token
Configure Sign.xml and Auth.xml policy ( or custom signing and username token policies) in the business service
Configure a PKI credential provider and service key provider containing the certificate to be used for signing and authentication
Associate the service key provider to the proxy service which invokes the business service.

OSB - Proxy Service Digital Signature [ Request Only]
Configure Sign.xml or a custom signing policy to the proxy service
Ensure Certificate passed by client is present in certificate registry or the root CA in trust keystore depending upon weblogic certification path provider configuration
OSB – Business Service Digital Signature [ Request Only]
Configure Sign.xml policy ( or custom signing policy) in the business service
Configure a PKI credential provider and service key provider containing the certificate to be used for signing
Associate the service key provider to the proxy service which invokes the business service.

Wednesday, June 27, 2012

Oracle SOA Suite - Information Websites and Blogs

Here I will be sharing a lot of links which have a lot of useful information about Oracle SOA Suite.

SOA:
http://javaoraclesoa.blogspot.nl
http://erpschools.com
http://blog.ipnweb.com/p/index-of-articles.html
http://javaoraclesoa.blogspot.com/
http://moshe-soa.blogspot.com
http://georgie-soablog.blogspot.com
http://weblogic-wonders.com/weblogic/2009/10/12/configuring-two-way-ssl-between-client-and-weblogic-server-with-apache-proxying-the-request/
http://middlewaremagic.com/weblogic/?p=1938
http://albinoraclesoa.blogspot.com
http://abhishek-soablog.blogspot.com
http://neeraj-soa-tips.blogspot.com
http://abhishek-oracleaia-bpel-esb.blogspot.com
http://www.nagazuka.nl/
http://orasoa.blogspot.com
http://soa-java.blogspot.com
http://www.albinsblog.com
http://niallcblogs.blogspot.com
https://blogs.oracle.com/reynolds/entry/more_on_batch_processing_in_bp
http://cohfu.wordpress.com/2010/01/06/bulk-loading-a-coherence-cache-from-an-oracle-database/
https://blogs.oracle.com/knutvatsendvik/entry/throttling_in_osb
http://www.javamonamour.org
https://blogs.oracle.com/reynolds
http://georgie-soablog.blogspot.com
http://shrikworld.blogspot.com

http://www.oracle.com/technetwork/middleware/soasuite/learnmore/soascheduler-186798.pdf

SOA and OWSM:
http://soabpel.wordpress.com
http://tech-learnings.blogspot.com/2010/04/using-xsl-parameters-in-soa-11g.html
http://oraclefusionfacts.blogspot.com/

OSB:
http://blog.xebia.com
http://prabodh-mitra.blogspot.com/
https://svgonugu.wordpress.com/tag/service-callout/
http://victor-jan.blogspot.com
http://soawork.blogspot.in
OSB Routing Options in Proxy Service: http://blog.ipnweb.com/2012/05/true-dynamic-routing-with-osb-11g.html

Ant Script for deployment, uniqueMessageSeparator :
http://sharatverma.blogspot.com
http://puchaanirudh.blogspot.in/


Web Logic Patch Update: Smart Update Directory
http://docs.oracle.com/cd/E14759_01/doc.32/e14143.pdf

Oracle Application Server:
Oracle AS 10g: (10.1.3.5.1)
http://docs.oracle.com/cd/E14101_01/doc.1013/e15342/toc.htm


Will keep updating this post.. 

Wednesday, November 9, 2011

Scheduling and Concurrency with Spring

Here, I am trying to aggregate some of the information I got on Threading, Concurrency and Scheduling concepts using Spring with my example.

I will be using ThreadPoolTaskExecutor, Callable interface, Future Object from java.util.Concurrent package, task scheduled tag from Spring

My Requirement:
I need to have a scheduled processor which fetches huge data from database, on which I need to do a large processing and need to update the database with the process start and completion time. Processing the data can be done in parallel.


Solution:


For scheduling a task in Spring:

I wrote a simple POJO as follows:

@Service("myScheduler")
public class MyScheduler {

public void startProcess(){

}
}

Then in my spring configuration file (for starters, this is the applicationContext file)
< beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd">

< util:properties id="myProperties" location="file:/C:/cron.properties" />
< task:scheduled-tasks>
myScheduler" method="startProcess"
cron="#{myProperties['scheduler.cron']}" />
< /task:scheduled-tasks>
< / beans>

Here I am getting the scheduling time as a cron expression from a properties file, cron.properties, which is located on the file system under C:\ drive.
So cron.properties will have entry as,
scheduler.cron=0 * * * * *


That's it for scheduling. The startProcess method runs according to your cron expression.


Now for Concurrency:

Now I have huge data (either from database or file reads) in startProcess() and I need to start processing that data in parallel. Also I have the req to get the process completion date, which means, I need to wait in my main thread for the completion of all threads.

First I write a Worker class which implements a Callable interface.

public class Worker implements Callable {
/**
*Callable interface implementation
*/
public Object call() throws Exception {
//Process your data here ..
boolean isCompleted = true;
return isCompleted;
}
}


Then in my spring application context, I mentioned as

worker" keep-alive="300" pool-size="10" queue-capacity="15" rejection-policy="CALLER_RUNS"/>

This indicates to Spring, that a ThreadPoolTaskExecutor needs to be created who will have a pool size of 10, and a queue-capacity of 15. (Here, an initial pool of 10 threads will be created. First 10 requests will be given to 10 threads and their processing starts. The requests 11 - 15 will be set in a queue and as soon as any of the 10 threads are free , one of the queued requests will be assigned to that thread. When all the queue is full, the because we mentioned CALLER_RUNS, the next request runs in the main thread itself.

And in the MyScheduler (Which will be the main thread)


@Service("myScheduler")
public class MyScheduler {

@Autowired
@Qualifier("worker")
private ThreadPoolTaskExecutor worker;
public void startProcess(){
Date startTime = new Date();
Set futureSet = new HashSet();
for (int i = 0; i < 25; i++) {
Worker del = new Worker();
//Set any data to be sent to this worker thread..
futureSet .add(worker.submit(del));
}
for(Future temp: futureSet ){
if(temp.get() instanceof boolean){
boolean isCompleted = (Boolean)temp.get(); //This will wait till the thread completes it //task...
System.out.println("Complete Status :" + successMessage.get("CompletedStatus"));
}
}
Date completedTime = new Date();
}
}




Wednesday, November 2, 2011

Decorator/Wrapper Pattern

Decorator Pattern is a very simple pattern in which a decorator object is wrapped around an object, so that new behaviour/responsibility is added to the original object without changing the original object.

Two simple and good sources for decorator pattern are:


In Liferay, we use the concept of hooks for liferay extensions. We can extend liferay services using hooks with the help of decorator pattern.

Thursday, October 20, 2011

Hibernate - No primary key Table

In Hibernate mapping, It is not possible to create a table without a primary key. If you are using annotations, you definitely need to use @Id in your class. But what happens if there is no primary key in your database table.

There is a workaround for this if your table is having some sort of unique relationship to any other table.

Consider two classes. Parent and a Child.
Parent has a primary key property but Child do not.

@Entity
@Table(name = "ParentTableName")
class Parent{

protected Integer id;
@Id
@Column(name = "PrimaryKeyColumnName", nullable = false)
public Integer getId() {
return id;
}
}



@Entity
@Table(name = "ChildTableName")
class Child{
private Parent parent;

@Id
@OneToOne @JoinColumn(name = "FKColumnNameInChildTable", nullable = false)
public Parent getParent() { return parent; }

public void setParent(Parent parent) { this.parent = parent;
}
}


Here even though, no primary key is specified in the database table, we are informing Hibernate to treat the Foreign Key as the primary key.


But what if you we have a unique relation on multiple columns in the child table?
In that case we can specify @Id annotation to all the relations and specify those relations with @Embeddable annotation.



Thursday, April 28, 2011

Eclipse - Eclipse is running in a JRE, but a JDK is required

Eclipse by default runs on a JRE. But, there may be times you want a full JDK to run it. One example is using Maven Plug-in.

Change the eclipse.ini (Located in the same folder as in your eclipse.exe file) file with a vm argument pointing to your jdk.

The important things are :
1. Enter a new argument "vm" pointing to the java jdk's javaw.exe file
-vm
C:/Program Files/Java/jdk1.6.0_20/bin/javaw.exe
2. vm and the path should be in a separate line. So if you have
-vm C:/Program Files/Java/jdk1.6.0_20/bin/javaw.exe
in a single line, Eclipse can not identify it.
3. "vm" argument should be before "-vmargs" and after" --launcher.XXMaxPermSize"
-vm
C:/Program Files/Java/jdk1.6.0_20/bin/javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx768m
-XX:MaxPermSize=256m


You can point to the java/bin folder also, for the vm argument. Some people got an exception because of a space in the file path location of java, so you might try installing Java into a non-space file path like C:/Java/jdk1.6.0_20.


This also works the same way for the Spring Source Tool Suite and you can see this concerned thread, http://forum.springsource.org/showthread.php?t=86906.