Development
A Time/Hour Selector in ADF Faces - Did you know?
I must admit that I wasn't aware of this and I'm guessing that if this is news for me it might be news for other people so I wanted to blog about it. Turns out that the af:inputDate components in...
shay.shmeltzer
http://blogs.oracle.com/shay
Categories: Development
Tricks for the New JSF Visual Editor in JDeveloper 11g PS1
We did a lot of enhancements in the visual editor in the new JDeveloper 11g 11.1.1.2. I recorded this short 3 minute demo to show you a couple of the things that are a bit hidden, but can be useful...
shay.shmeltzer
http://blogs.oracle.com/shay
Categories: Development
New TaskFlow Tutorial on OTN
TaskFlows (or the ADF controller) is one of the more powerful features of ADF - but also one that many people find hard to grasp. We've just published a new tutorial about TaskFlows on OTN that shows some of the...
shay.shmeltzer
http://blogs.oracle.com/shay
Categories: Development
Find and Expand all nodes of an ADF Tree
I want to find and expand all nodes of an ADF Tree and I saw an Oracle Forum post of Kenyatta which gave me a nice solution.
First some usefull methods.
Now find the ADF tree in a region and expand the main and child nodes of this tree
First some usefull methods.
private void expandTreeChildrenNode( RichTree rt
, FacesCtrlHierNodeBinding node
, List<Key> parentRowKey) {
ArrayList children = node.getChildren();
List<Key> rowKey;
if ( children != null ) {
for (int i = 0; i < children.size(); i++) {
rowKey = new ArrayList<Key>();
rowKey.addAll(parentRowKey);
rowKey.add(((FacesCtrlHierNodeBinding)children.get(i)).getRowKey());
rt.getDisclosedRowKeys().add(rowKey);
if (((FacesCtrlHierNodeBinding)(children.get(i))).getChildren() == null)
continue;
expandTreeChildrenNode(rt
,(FacesCtrlHierNodeBinding)(node.getChildren().get(i))
, rowKey);
}
}
}
// find a jsf component
private UIComponent getUIComponent(String name) {
FacesContext facesCtx = FacesContext.getCurrentInstance();
return facesCtx.getViewRoot().findComponent(name) ;
}
private UIComponent getUIComponent(UIComponent component,String name ){
List<UIComponent> items = component.getChildren();
for ( UIComponent item : items ) {
UIComponent found = getUIComponent(item,name);
if ( found != null ) {
return found;
}
if ( item.getId().equalsIgnoreCase(name) ) {
return item;
};
}
return null;
}
Now find the ADF tree in a region and expand the main and child nodes of this tree
// get the dymamic region of the main page
RichRegion region = (RichRegion)getUIComponent("dynam1");
if ( region != null) {
// find tree 2 and expand this tree
RichTree rt = (RichTree)getUIComponent(region,"t2");
if ( rt != null ) {
int rowCount = rt.getRowCount();
List<Key> rowKey;
for (int j = 0; j < rowCount; j++) {
// expand the main nodes
FacesCtrlHierNodeBinding node = (FacesCtrlHierNodeBinding)rt.getRowData(j);
rowKey = new ArrayList<Key>();
rowKey.add(node.getRowKey());
rt.getDisclosedRowKeys().add(rowKey);
rt.setRowKey(rowKey);
// expand the child nodes of the main nodes
expandTreeChildrenNode(rt , node, rowKey);
}
}
}
Categories: Development, Fusion Middleware
Find an UIComponent in an ADF Task Flow Region
When you want to find an UIComponent (like a Tree) inside an ADF Region you can not use findComponent on the ViewRoot because this will only search for the component in the JSF page and not in the JSF page fragments ( Task Flows). And off course you can use a backing bean to make a binding but I want to find the component by first searching for the right Region in the JSF page and then searching the component inside the Region.
First I need to have some common methods.
Now we can find the right Region and then search inside the Region for the ADF Tree
First I need to have some common methods.
// find a jsf component inside the JSF page
private UIComponent getUIComponent(String name) {
FacesContext facesCtx = FacesContext.getCurrentInstance();
return facesCtx.getViewRoot().findComponent(name) ;
}
// find a UIComponent inside a UIComponent
private UIComponent getUIComponent(UIComponent component,String name ){
List items = component.getChildren();
for ( UIComponent item : items ) {
UIComponent found = getUIComponent(item,name);
if ( found != null ) {
return found;
}
if ( item.getId().equalsIgnoreCase(name) ) {
return item;
}
}
return null;
}
Now we can find the right Region and then search inside the Region for the ADF Tree
// get the dymamic region of the main page
RichRegion region = (RichRegion)getUIComponent("dynam1");
if ( region != null) {
// find tree 2
RichTree rt = (RichTree)getUIComponent(region,"t2");
if ( rt != null ) {
// do your thing
}
}
Categories: Development, Fusion Middleware
RSS of APEXBlogs.info
A couple of days ago the RSS feed of APEXBlogs.info started to behave weird. Although you could still read the message, the link at the bottom to redirect to the website suddenly didn't work anymore.I didn't change anything but Feedburner is now under the Google flag and apparently that added statistics to the url.
e.g. &utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+OracleApexBlogAggregator+%28Oracle+APEX+Blog+Aggregator+%28by+AE%29%29
If you took that bit off it worked just fine.
I found the answer in the FeedBurner forum. You can disable all the statistics (not sure why they got enabled suddenly) so the url should become "normal" again, so that is what I did. Let's hope the new posts through RSS are correct again.
I've some new ideas for the website to include also the APEX related twitter messages and do a general update of the site to make it cleaner, but I didn't find the time to finish it yet.
If you have other ideas or recommendations for the site, feel free to add a comment. I'll take it into consideration for the new release.
Categories: Development
What should I do with old hints in my workload?
We promised in an earlier post to cover some of the questions from the Optimizer round table discussion at Oracle Open World. Here's our first in a series of posts that will address these questions.
Q: When moving from 10g to 11g, should hints in existing SQL be removed?
A: I was glad to see this question at the round table, since I think this is something people often overlook when adding hints to an application. Over time, hints can become stale. You may have added a hint to a query because of a weakness in an old version of the optimizer, but the hint might no longer be necessary to get the best plan. Even worse, the hint may force a plan which is suboptimal, for a couple of reasons:
If you find that some of your queries really do still require hints to get an optimal plan, you should consider creating a SQL plan baseline, and allowing SPM to manage the plan for you. If you do this, then you will get the hinted plan for now, but if a better plan comes along later (for one of the reasons mentioned earlier), you will eventually get the benefits of the new plan, using the SPM evolve process. There are two ways that you can create a SQL plan baseline based on your hints that will be applied to the query without hints. The first way requires that a SQL plan baseline already exist for the unhinted query. That's described in an earlier post. Here are the steps to use if you don't already have a SQL plan baseline for the unhinted query.
1. Run the query with hints, and confirm that the plan is what you want:
EXPLAINED SQL STATEMENT:
------------------------
select /*+ leading(t) */ p.prod_name, s.amount_sold, t.calendar_year
from sales s, products p, times t where s.prod_id = p.prod_id and
s.time_id = t.time_id and p.prod_id < :pid
Plan hash value: 2290436051
2. Load SQL plan baseline from cursor cache, and associate it with the unhinted query:
Q: When moving from 10g to 11g, should hints in existing SQL be removed?
A: I was glad to see this question at the round table, since I think this is something people often overlook when adding hints to an application. Over time, hints can become stale. You may have added a hint to a query because of a weakness in an old version of the optimizer, but the hint might no longer be necessary to get the best plan. Even worse, the hint may force a plan which is suboptimal, for a couple of reasons:
- Depending on how your data change over time, the plan choice that the hint enforces might no longer be a good choice. This problem can occur even without a database upgrade. For example, if the distribution of values in a column change over time, an old access path hint may no longer be appropriate.
- The hint might prevent new optimizations from taking place. So after an upgrade, you will be stuck using the old hint-enforced plan, when the optimizer could have chosen something better. For example, you may have hinted a plan for a query with bind variables, to avoid a bad plan choice due to bind peeking in the pre-11g optimizer. In 11g, you will not get the benefits of adaptive cursor sharing because of the hints in the query.
If you find that some of your queries really do still require hints to get an optimal plan, you should consider creating a SQL plan baseline, and allowing SPM to manage the plan for you. If you do this, then you will get the hinted plan for now, but if a better plan comes along later (for one of the reasons mentioned earlier), you will eventually get the benefits of the new plan, using the SPM evolve process. There are two ways that you can create a SQL plan baseline based on your hints that will be applied to the query without hints. The first way requires that a SQL plan baseline already exist for the unhinted query. That's described in an earlier post. Here are the steps to use if you don't already have a SQL plan baseline for the unhinted query.
1. Run the query with hints, and confirm that the plan is what you want:
var pid number
exec :pid := 100;
select /*+ leading(t) */ p.prod_name, s.amount_sold, t.calendar_year
from sales s, products p, times t
where s.prod_id = p.prod_id
and s.time_id = t.time_id
and p.prod_id < :pid;
PROD_NAME AMOUNT_SOLD CALENDAR_YEAR
-------------------------------------------------- ----------- -------------
...
select sql_id from v$sql where sql_text like 'select /*+ leading(t) */ p.prod_name%';
SQL_ID
-------------
2qtu6hy4rf1j9
select * from table(dbms_xplan.display_cursor(sql_id=>'2qtu6hy4rf1j9',
format=>'basic note'));
EXPLAINED SQL STATEMENT:
------------------------
select /*+ leading(t) */ p.prod_name, s.amount_sold, t.calendar_year
from sales s, products p, times t where s.prod_id = p.prod_id and
s.time_id = t.time_id and p.prod_id < :pid
Plan hash value: 2290436051
---------------------------------------------------------------
| Id | Operation | Name |
---------------------------------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | HASH JOIN | |
| 2 | HASH JOIN | |
| 3 | TABLE ACCESS FULL | TIMES |
| 4 | PARTITION RANGE ALL | |
| 5 | TABLE ACCESS BY LOCAL INDEX ROWID| SALES |
| 6 | BITMAP CONVERSION TO ROWIDS | |
| 7 | BITMAP INDEX RANGE SCAN | SALES_PROD_BIX |
| 8 | TABLE ACCESS BY INDEX ROWID | PRODUCTS |
| 9 | INDEX RANGE SCAN | PRODUCTS_PK |
---------------------------------------------------------------
2. Load SQL plan baseline from cursor cache, and associate it with the unhinted query:
var sqltext clob;
begin
:sqltext := 'select p.prod_name, s.amount_sold, t.calendar_year
from sales s, products p, times t
where s.prod_id = p.prod_id
and s.time_id = t.time_id
and p.prod_id > :pid';
end;
/
exec :pls := dbms_spm.load_plans_from_cursor_cache( -
sql_id => '2qtu6hy4rf1j9', -
plan_hash_value => 2290436051, -
sql_text => :sqltext);
3. Run the query without hints, and check that the SQL plan baseline was used.
select p.prod_name, s.amount_sold, t.calendar_year
from sales s, products p, times t
where s.prod_id = p.prod_id
and s.time_id = t.time_id
and p.prod_id < :pid;
PROD_NAME AMOUNT_SOLD CALENDAR_YEAR
-------------------------------------------------- ----------- -------------
...
select * from table(dbms_xplan.display_cursor(sql_id=>'a1ax3265pq8x7',
format=>'basic note'));
EXPLAINED SQL STATEMENT:
------------------------
select p.prod_name, s.amount_sold, t.calendar_year from sales s,
products p, times t where s.prod_id = p.prod_id and s.time_id =
t.time_id and p.prod_id < :pidPlan hash value: 2290436051Note
---------------------------------------------------------------
| Id | Operation | Name |
---------------------------------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | HASH JOIN | |
| 2 | HASH JOIN | |
| 3 | TABLE ACCESS FULL | TIMES |
| 4 | PARTITION RANGE ALL | |
| 5 | TABLE ACCESS BY LOCAL INDEX ROWID| SALES |
| 6 | BITMAP CONVERSION TO ROWIDS | |
| 7 | BITMAP INDEX RANGE SCAN | SALES_PROD_BIX |
| 8 | TABLE ACCESS BY INDEX ROWID | PRODUCTS |
| 9 | INDEX RANGE SCAN | PRODUCTS_PK |
---------------------------------------------------------------
-----
- SQL plan baseline SQL_PLAN_4rw2dhryc2w5h888547d3 used for this statement
Categories: DBA Blogs, Development
Using Shared Object in Soa Suite 11g with MDS
Inspired by Eric Elzinga , who was wondering how MDS can work in Soa Suite 11g , I made some screenshots how you can use a XSD from a central MDS repository in your composite application. Clemens already blogged about re-using common metadata and he made a great ant utility to import or delete MDS files. For 11G R1 PS1 or higher use this instead of the Clemens utility
First I make a local MDS repository. If you install the Soa plugin you already have a seed folder in the integration folder. Under this folder create an new folder called apps. ( this have has to be apps else you will get a permission denied error ) . Under this apps folder we can create our own definitions.
To use my local SOA-MDS repository I create a new MDS File Connection
I want to re-use these common objects in every Soa project so I choose for the resource palette option
select the seed folder in the integration folder

Here we can see our common application objects.
Open the application resources window and open the adf-config.xml
Here we define a new metadata namespace with apps as path. And use the integration folder as metadata-path value.

We are ready to use these common objects in a mediator.. Here I will use a schema from the local MDS as input parameter for the mediator.

Import a new schema
Select the resource browser and here we can select our schema from the local MDS
I uncheck the Copy to project option, because this XSD already exists in the MDS
Our Project is ready but If we want to deploy this Soa project, we will receive a error, it can't find the schema. So we need to export the local MDS files to the SOA Suite database MDS.
To do this we have 2 options , the first option is to create a MAR deployment ( Application properties ) or do this with Ant.
I stripped the Clemens ant project so this ant build file has only two tasks , add and delete. It uses the adf-config.xml ( config folder) for the location of the target MDS and I use the local MDS as source.
Here is the target adf-config.xml which is located in the config folder
Change the build.properties so it matches your environment
This will import your local MDS object to the remote MDS. After this you can deploy your Soa Suite project.
Here you can download my ant project. Thanks to Clemens.
First I make a local MDS repository. If you install the Soa plugin you already have a seed folder in the integration folder. Under this folder create an new folder called apps. ( this have has to be apps else you will get a permission denied error ) . Under this apps folder we can create our own definitions.
To use my local SOA-MDS repository I create a new MDS File Connection
I want to re-use these common objects in every Soa project so I choose for the resource palette option
select the seed folder in the integration folder
Here we can see our common application objects.
Open the application resources window and open the adf-config.xml
Here we define a new metadata namespace with apps as path. And use the integration folder as metadata-path value.
We are ready to use these common objects in a mediator.. Here I will use a schema from the local MDS as input parameter for the mediator.

Import a new schema
Select the resource browser and here we can select our schema from the local MDS
I uncheck the Copy to project option, because this XSD already exists in the MDS
Our Project is ready but If we want to deploy this Soa project, we will receive a error, it can't find the schema. So we need to export the local MDS files to the SOA Suite database MDS.To do this we have 2 options , the first option is to create a MAR deployment ( Application properties ) or do this with Ant.
I stripped the Clemens ant project so this ant build file has only two tasks , add and delete. It uses the adf-config.xml ( config folder) for the location of the target MDS and I use the local MDS as source.
Here is the target adf-config.xml which is located in the config folder
Change the build.properties so it matches your environment
This will import your local MDS object to the remote MDS. After this you can deploy your Soa Suite project.Here you can download my ant project. Thanks to Clemens.
Categories: Development, Fusion Middleware
Soa Suite 11g MDS deploy and removal ANT scripts
With the release of Soa Suite 11g R1 Patch Set 1 Oracle improved the standard ant scripts for MDS deployment and removal. Before PS1 we had an ant example of Clemens.
Basically this is how my ANT scripts works. First add your own metadata folders under the apps folder ( do this in jdeveloper\integration\seed\apps ).

My ANT script will do the following steps for every metadata folder under apps
To make this work copy the antcontrib jar to the jdeveloper\ant\lib folder ( because of the foreach and the propertycopy fucntion )
Here is my build.properties
The build.xml
and at last the deployMDS.bat file
Basically this is how my ANT scripts works. First add your own metadata folders under the apps folder ( do this in jdeveloper\integration\seed\apps ).

My ANT script will do the following steps for every metadata folder under apps
- optionally remove the metadata folder from the remote Soa Suite Database MDS repository
- Make a zip file of the metadata files ( Local MDS file repository) .
- Make a new Soa Bundle zip with this metadata zip
- Deploy this soa bundle to the Soa Suite Server, The server will add this to the Database MDS
To make this work copy the antcontrib jar to the jdeveloper\ant\lib folder ( because of the foreach and the propertycopy fucntion )
Here is my build.properties
# global
wn.bea.home=C:/oracle/MiddlewareJdev11gR1PS1
oracle.home=${wn.bea.home}/jdeveloper
java.passed.home=${wn.bea.home}/jdk160_14_R27.6.5-32
wl_home=${wn.bea.home}/wlserver_10.3
# temp
tmp.output.dir=c:/temp
mds.reposistory=C:/oracle/MiddlewareJdev11gR1PS1/jdeveloper/integration/seed/apps/
mds.applications=usarmy
mds.undeploy=true
deployment.plan.environment=dev
# dev deployment server weblogic
dev.serverURL=http://laptopedwin:8001
dev.overwrite=true
dev.user=weblogic
dev.password=weblogic1
dev.forceDefault=true
# acceptance deployment server weblogic
acc.serverURL=http://laptopedwin:8001
acc.overwrite=true
acc.user=weblogic
acc.password=weblogic1
acc.forceDefault=true
The build.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="soaDeployAll" default="deployMDS">
<echo>basedir ${basedir}</echo>
<property environment="env"/>
<echo>current folder ${env.CURRENT_FOLDER}</echo>
<property file="${env.CURRENT_FOLDER}/build.properties"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<import file="${basedir}/ant-sca-deploy.xml"/>
<target name="unDeployMDS">
<echo>undeploy MDS</echo>
<foreach list="${mds.applications}" param="mds.application" target="undeployMDSApplication" inheritall="true" inheritrefs="false"/>
</target>
<target name="deployMDS">
<echo>undeploy and deploy MDS</echo>
<if>
<equals arg1="${mds.undeploy}" arg2="true"/>
<then>
<foreach list="${mds.applications}" param="mds.application" target="undeployMDSApplication" inheritall="true" inheritrefs="false"/>
</then>
</if>
<foreach list="${mds.applications}" param="mds.application" target="deployMDSApplication" inheritall="true" inheritrefs="false"/>
</target>
<target name="deployMDSApplication">
<echo>deploy MDS application ${mds.application}</echo>
<echo>remove and create local MDS temp</echo>
<property name="mds.deploy.dir" value="${tmp.output.dir}/${mds.application}"/>
<delete dir="${mds.deploy.dir}"/>
<mkdir dir="${mds.deploy.dir}"/>
<echo>create zip from file MDS store</echo>
<zip destfile="${mds.deploy.dir}/${mds.application}_mds.jar" compress="false">
<fileset dir="${mds.reposistory}" includes="${mds.application}/**"/>
</zip>
<echo>create zip with MDS jar</echo>
<zip destfile="${mds.deploy.dir}/${mds.application}_mds.zip" compress="false">
<fileset dir="${mds.deploy.dir}" includes="*.jar"/>
</zip>
<propertycopy name="deploy.serverURL" from="${deployment.plan.environment}.serverURL"/>
<propertycopy name="deploy.overwrite" from="${deployment.plan.environment}.overwrite"/>
<propertycopy name="deploy.user" from="${deployment.plan.environment}.user"/>
<propertycopy name="deploy.password" from="${deployment.plan.environment}.password"/>
<propertycopy name="deploy.forceDefault" from="${deployment.plan.environment}.forceDefault"/>
<echo>deploy MDS app</echo>
<echo>deploy on ${deploy.serverURL} with user ${deploy.user}</echo>
<echo>deploy sarFile ${mds.deploy.dir}/${mds.application}_mds.zip</echo>
<antcall target="deploy" inheritall="false">
<param name="wl_home" value="${wl_home}"/>
<param name="oracle.home" value="${oracle.home}"/>
<param name="serverURL" value="${deploy.serverURL}"/>
<param name="user" value="${deploy.user}"/>
<param name="password" value="${deploy.password}"/>
<param name="overwrite" value="${deploy.overwrite}"/>
<param name="forceDefault" value="${deploy.forceDefault}"/>
<param name="sarLocation" value="${mds.deploy.dir}/${mds.application}_mds.zip"/>
</antcall>
</target>
<target name="undeployMDSApplication">
<echo>undeploy MDS application ${mds.application}</echo>
<propertycopy name="deploy.serverURL" from="${deployment.plan.environment}.serverURL"/>
<propertycopy name="deploy.overwrite" from="${deployment.plan.environment}.overwrite"/>
<propertycopy name="deploy.user" from="${deployment.plan.environment}.user"/>
<propertycopy name="deploy.password" from="${deployment.plan.environment}.password"/>
<propertycopy name="deploy.forceDefault" from="${deployment.plan.environment}.forceDefault"/>
<echo>undeploy MDS app folder apps/${mds.application} </echo>
<antcall target="removeSharedData" inheritall="false">
<param name="wl_home" value="${wl_home}"/>
<param name="oracle.home" value="${oracle.home}"/>
<param name="serverURL" value="${deploy.serverURL}"/>
<param name="user" value="${deploy.user}"/>
<param name="password" value="${deploy.password}"/>
<param name="folderName" value="${mds.application}"/>
</antcall>
</target>
</project>
and at last the deployMDS.bat file
set ORACLE_HOME=C:\oracle\MiddlewareJdev11gR1PS1
set ANT_HOME=%ORACLE_HOME%\jdeveloper\ant
set PATH=%ANT_HOME%\bin;%PATH%
set JAVA_HOME=%ORACLE_HOME%\jdk160_14_R27.6.5-32
set CURRENT_FOLDER=%CD%
ant -f build.xml deployMDS -Dbasedir=%ORACLE_HOME%\jdeveloper\bin
Categories: Development, Fusion Middleware
New Feature - Code Template in JSF Editor
The current survey on the OTN forum asked people whether they used the visual editor or code editor when developing their JSF. Well not surprisingly most people answered "Both". So if you are using the code editor while developing JSF...
shay.shmeltzer
http://blogs.oracle.com/shay
Categories: Development
Calling a Soa Suite Direct Binding Service from Java & OSB
I was trying to connect Oracle Soa Suite 11G R1 PS1 with the OSB when I saw this new Direct Binding Service in the Soa Suite 11G. This direct binding make it possible to start this RMI service from OSB or Java. In a previous blog I already called a Soa Service from Java using the ADF binding but this direct binding makes it also possible to call this also from OSB using the SB transport . In this Blog I will call this RMI synchronous service from Java, I can not use this binding in OSB 10.3.1, probably in the next version of the OSB I can.
First we add the Direct Binding Service to exposed Services side of the composite and use the WSDL of one of the other exposed services and add a Wire to the Component.
In the source view of the composite xml you can see that this service uses the direct binding.
To see the WSDL of this service go to http://localhost:8001/soa-infra/ and select your RMI service.

First we add the Direct Binding Service to exposed Services side of the composite and use the WSDL of one of the other exposed services and add a Wire to the Component.
In the source view of the composite xml you can see that this service uses the direct binding.
<service name="RMIService" ui:wsdlLocation="BPELProcess1.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/HelloWorld/Helloworld/BPELProcess1#wsdl.interface(BPELProcess1)"/>
<binding.direct/>
</service>
To see the WSDL of this service go to http://localhost:8001/soa-infra/ and select your RMI service.

package nl.whitehorses.soa.client;
import java.io.StringWriter;
import java.io.StringReader;
import java.util.Hashtable;
import java.util.Map;
import java.util.HashMap;
import javax.naming.Context;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import oracle.soa.api.PayloadFactory;
import oracle.soa.api.XMLMessageFactory;
import oracle.soa.api.invocation.DirectConnection;
import oracle.soa.api.message.Message;
import oracle.soa.api.message.Payload;
import oracle.soa.management.CompositeDN;
import oracle.soa.management.facade.Locator;
import oracle.soa.management.facade.LocatorFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Document;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.xml.sax.InputSource;
public class StartRMIProcess {
public StartRMIProcess() {
super();
Hashtable jndiProps = new Hashtable();
jndiProps.put(Context.PROVIDER_URL, "t3://localhost:8001/soa-infra");
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
jndiProps.put(Context.SECURITY_CREDENTIALS, "weblogic1");
jndiProps.put("dedicated.connection", "true");
Locator locator = null;
try {
// connect to the soa server
locator = LocatorFactory.createLocator(jndiProps);
// find composite default domain, Helloworld Composite, version 1.0
CompositeDN compositedn = new CompositeDN("default", "Helloworld", "1.0");
// call the direct binding of the Helloworld composite
DirectConnection conn = locator.createDirectConnection(compositedn,"RMIService");
String inputPayload =
"<client:process xmlns:client=\"http://xmlns.oracle.com/HelloWorld/Helloworld/BPELProcess1\">\n" +
" <client:input>hello</client:input>\n" +
"</client:process>\n" ;
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(inputPayload)));
Element root = doc.getDocumentElement();
//<wsdl:message name="BPELProcess1RequestMessage">
// <wsdl:part name="payload" element="client:process"/>
//</wsdl:message>
Map<String, Element> partData = new HashMap<String,Element>();
// have to use payload see BPELProcess1RequestMessage
partData.put("payload", root);
Payload<Element> payload = PayloadFactory.createXMLPayload(partData);
//Messages are created using the MessageFactory
Message<Element> request = XMLMessageFactory.getInstance().createMessage();
request.setPayload(payload);
//<wsdl:portType name="BPELProcess1">
// <wsdl:operation name="process">
// <wsdl:input message="client:BPELProcess1RequestMessage" />
// <wsdl:output message="client:BPELProcess1ResponseMessage"/>
// </wsdl:operation>
//</wsdl:portType>
// this is a request-reply service so we need to use conn.request else use conn.post
// need to provide operation name so we need to use process
Message<Element> response = conn.request("process", request);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty("indent", "yes");
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
//<wsdl:message name="BPELProcess1ResponseMessage">
// <wsdl:part name="payload" element="client:processResponse"/>
//</wsdl:message>
// need to use payload again
DOMSource source = new DOMSource((Node)response.getPayload().getData().get("payload"));
transformer.transform(source, result);
System.out.println("Result\n"+sw.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
StartRMIProcess startRMIProcess = new StartRMIProcess();
}
}
Categories: Development, Fusion Middleware
Oracle 11g DB on Windows 7 – Success
Short Version
Tried to install Oracle Database 11.1.0.7 32-bit on Windows 7 32-bit. Failed at Network Configuration section. I found that in my case, the issue was that I installed in a path with spaces in it (c:\program files\oracle\….). Un-installed. Reinstalled in c:\oracle\product\11.1.0.7. Success!!!
Longer Version
OK, I admit it, I’ve been running Windows [...]
Categories: DBA Blogs, Development
New features of the EJB Datatcontrol, Query panel and Range size
With Patch Set 1 of JDeveloper 11G R1 Oracle improved the ADF EJB Datacontrol with two important features. We can now use this EJB Datacontrol in a Querypanel, this makes searching with EJB's a lot easier and the second big improvement is the range size option, so you don't get all the rows in one time, this can improve the performance of your ADF application and will generate less network traffic.
With JDeveloper you can generate an EJB datacontol on an EJB session bean and this Datacontol can be used in ADF. In this blog entry I will show you what the new features are and how you can do it yourself.
First we start with an entity, this is a normal entity on the country table in the HR schema ( I use the eclipselink persistence implementation, which supported very well in JDeveloper )

Next step is to create a Session Bean where we add some Facade Methods.
Here you can see that JDeveloper adds a queryByRange Facade method which we be used by ADF for the range size option.
Here you can see the Session Bean code with the queryByRange method
Generate a Datacontrol on this Session Bean,

If we now go the viewcontroller project we can use this Country EJB datacontrol ( add the EJB model project to the viewcontroller project dependency or add the EJB ADF library to the project) . In the Data Controls window you can see the Named Criteria folder in the countriesFindAll method. Drag the All Queriable Attributes on the JSF page and select the Query Panel option.
With this as result, a customizable search panel and when you configure MDS you can even save the user queries in the MDS repository.
The last feature of the EJB Datacontrol is the Range Set option. Default the ADF iterator get the data in set of 25 records ( this is a pagedef option on the iterator ). When the ADF table on the JSF view is full with rows then it won't get the rest of the rows unles you use the scrollbar or use the Next Set Operation. The Next and Previous Set are new options for the EJB Datacontrol.
Use the scrollbar or the next / previous Set button to get all the rows.

Here some eclipselink logging to let you see that is really works.
[EL Fine]: 2009-11-12 14:03:47.375--ServerSession(22965561)--SELECT COUNT(COUNTRY_ID) FROM COUNTRIES
[EL Fine]: 2009-11-12 14:03:47.39 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [5, 0]
[EL Fine]: 2009-11-12 14:03:49.953 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [10, 5]
[EL Fine]: 2009-11-12 14:04:39.281 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [15, 10]
With JDeveloper you can generate an EJB datacontol on an EJB session bean and this Datacontol can be used in ADF. In this blog entry I will show you what the new features are and how you can do it yourself.
First we start with an entity, this is a normal entity on the country table in the HR schema ( I use the eclipselink persistence implementation, which supported very well in JDeveloper )

Next step is to create a Session Bean where we add some Facade Methods.
Here you can see that JDeveloper adds a queryByRange Facade method which we be used by ADF for the range size option.
Here you can see the Session Bean code with the queryByRange method
Generate a Datacontrol on this Session Bean,
If we now go the viewcontroller project we can use this Country EJB datacontrol ( add the EJB model project to the viewcontroller project dependency or add the EJB ADF library to the project) . In the Data Controls window you can see the Named Criteria folder in the countriesFindAll method. Drag the All Queriable Attributes on the JSF page and select the Query Panel option.
With this as result, a customizable search panel and when you configure MDS you can even save the user queries in the MDS repository.
The last feature of the EJB Datacontrol is the Range Set option. Default the ADF iterator get the data in set of 25 records ( this is a pagedef option on the iterator ). When the ADF table on the JSF view is full with rows then it won't get the rest of the rows unles you use the scrollbar or use the Next Set Operation. The Next and Previous Set are new options for the EJB Datacontrol.
Use the scrollbar or the next / previous Set button to get all the rows.
Here some eclipselink logging to let you see that is really works.
[EL Fine]: 2009-11-12 14:03:47.375--ServerSession(22965561)--SELECT COUNT(COUNTRY_ID) FROM COUNTRIES
[EL Fine]: 2009-11-12 14:03:47.39 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [5, 0]
[EL Fine]: 2009-11-12 14:03:49.953 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [10, 5]
[EL Fine]: 2009-11-12 14:04:39.281 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [15, 10]
Categories: Development, Fusion Middleware
ADF Contextual Events in 11G R1 PS1
In a previous blog I already talked about ADF events and how you can use it in the Task Flow interaction communication. With the new JDeveloper 11g Patch Set 1, Oracle really improved this event mechanism and the JDeveloper IDE support for these events.
In this blog entry I will show you the new features and give you examples of a tree and table selection Event and inputtext change Event.
First we start by adding events to the ADF application. The first way we can do it, is by selecting an af:inputtext, af:tree or af:table component . Here an example of how you can add an event to an inputtext. Contextual Events is now part of the component property window.
The second big difference is that you can change the payload of the event. You can return now what you want, for example an binding or a backing bean method. In the previous release the payload was fixed ( return of the MethodAction or the new value of an attribute). If you don't specify a payload then this is the default.
And you can restrict the events by adding a condition to the event. In this case it only fires when the value is hello
The events are registered in the pagedef of the page or fragment. This is how it can looks like.
In this case the attributeValue got a restricted event and in the bottom the default payload is changed for this event.
The pagedef editor got a Contextual Events tab, where we can add producers or subscription to an event.
Lets subscribe to this attribute event. First we need to add an MethodAction to a page or fragment. We can call this method and pass on the attribute payload. I made a java class with this method and generate a DataControl on this class.
Open the page definition and go the Subscribers tab where we add a new one subscription. We need to select the event and the publisher ( or use any ) and the handler, this is the ADF MethodAction which has 3 parameters. And we need to provide the required values for these parameters.

That's all for the Inputtext. The value is now passed on to a other page fragment.
ADF Table selection Event
We can do the same with the ADF Table component, just select the table and go to the Contextual Events part of the property window. You can now select a class and in my case is that the Department class.
To do something usefull with this Table selection event I add a method to the Java datacontrol and add this as a MethodAction to a pagedef of a page or fragment
Now we can add a subscription to this event and we call the above method as handler of this event.

ADF Tree Selection Event
This is almost the same as an ADF Table but now we can define more events because a tree can have different levels , In my case I made a department / employee example so I can have a department and employee event and do different things with this. For example show a department or employee Task Flow.
Here you see two events in the property window of the ADF tree. One for the department selection and one for the employees

This is how it looks like in the page defintion with an event on every level of the tree.

Here is my example workspace with Task Flows who produces these different event and the index page who pass the events on to the output Task Flow.
In this blog entry I will show you the new features and give you examples of a tree and table selection Event and inputtext change Event.
First we start by adding events to the ADF application. The first way we can do it, is by selecting an af:inputtext, af:tree or af:table component . Here an example of how you can add an event to an inputtext. Contextual Events is now part of the component property window.
The second big difference is that you can change the payload of the event. You can return now what you want, for example an binding or a backing bean method. In the previous release the payload was fixed ( return of the MethodAction or the new value of an attribute). If you don't specify a payload then this is the default.And you can restrict the events by adding a condition to the event. In this case it only fires when the value is hello
The events are registered in the pagedef of the page or fragment. This is how it can looks like.In this case the attributeValue got a restricted event and in the bottom the default payload is changed for this event.
The pagedef editor got a Contextual Events tab, where we can add producers or subscription to an event.
Lets subscribe to this attribute event. First we need to add an MethodAction to a page or fragment. We can call this method and pass on the attribute payload. I made a java class with this method and generate a DataControl on this class.
Open the page definition and go the Subscribers tab where we add a new one subscription. We need to select the event and the publisher ( or use any ) and the handler, this is the ADF MethodAction which has 3 parameters. And we need to provide the required values for these parameters.
That's all for the Inputtext. The value is now passed on to a other page fragment.
ADF Table selection Event
We can do the same with the ADF Table component, just select the table and go to the Contextual Events part of the property window. You can now select a class and in my case is that the Department class.
To do something usefull with this Table selection event I add a method to the Java datacontrol and add this as a MethodAction to a pagedef of a page or fragment
public String tableEvent( Object payload) {
if ( payload != null) {
System.out.println("handle tableEvent");
DCBindingContainerCurrencyChangeEvent event = (DCBindingContainerCurrencyChangeEvent)payload;
DCDataRow row = (DCDataRow)event.getRow();
if ( row.getDataProvider() instanceof Department ) {
// do department stuff like displaying the department task flow
Department dept = (Context.Department)row.getDataProvider();
return "handle tableEvent for Department "+dept.getName();
}
} else {
return "empty payload tableEvent";
}
return null;
}
Now we can add a subscription to this event and we call the above method as handler of this event.

ADF Tree Selection Event
This is almost the same as an ADF Table but now we can define more events because a tree can have different levels , In my case I made a department / employee example so I can have a department and employee event and do different things with this. For example show a department or employee Task Flow.
Here you see two events in the property window of the ADF tree. One for the department selection and one for the employees

This is how it looks like in the page defintion with an event on every level of the tree.

Here is my example workspace with Task Flows who produces these different event and the index page who pass the events on to the output Task Flow.
Categories: Development, Fusion Middleware
New and Improved ADF Faces Components Demo
Along with the new JDeveloper release we also put out a new version of the ADF Faces components demo. This is a stand alone WAR file that you can download and run on your own machine (or watch the hosted...
shay.shmeltzer
http://blogs.oracle.com/shay
Categories: Development
JDeveloper or NetBeans - What are the numbers telling us?
There has been a lot of noise in the blogsphere lately about JDeveloper vs. NetBeans over the last week - especially after the last update to Oracle's Sun FAQ that added a paragraph about Netbeans. As an Oracle Employee I...
shay.shmeltzer
http://blogs.oracle.com/shay
Categories: Development
JDeveloper 11.1.1.2 is out
A new version of JDeveloper is out on OTN - looking at the version number you might think this is just a patch release with some bug fixes, but in reality it is quite a major release for us. The...
shay.shmeltzer
http://blogs.oracle.com/shay
Categories: Development
APEX Meetup @ UKOUG
As on every Oracle conference, also this time we organize an APEX Meetup.
Last year we went for a pizza and some drinks and it was great fun!
For this year, I propose we come together on Monday 30th November at the Community Focus Pubs - 20.00 - 21.30. There should be an APEX table as well. We can already have some drinks there and then leave for another place and see what the night brings us...
Time is flying... See you in 2,5 weeks!
Last year we went for a pizza and some drinks and it was great fun!
For this year, I propose we come together on Monday 30th November at the Community Focus Pubs - 20.00 - 21.30. There should be an APEX table as well. We can already have some drinks there and then leave for another place and see what the night brings us...
Time is flying... See you in 2,5 weeks!
Categories: Development
Installing Soa Suite 10.1.3.5.1 on Weblogic
Yesterday Oracle released Soa Suite 10.1.3.5.1, the version which you can install on Weblogic 10.3.1 ( FMW11g version ). This is a full version so you don't early versions or extra patches to makes this work.
We need to download Weblogic 10.3.1 and Soa Suite 10.1.3.5.1
first step is to install Weblogic 10.3.1, I use C:\oracle\Soa10gWls as my wls middleware home folder
Now we can go to the Soa suite part, first we need to create a bpel, esb and wsm repository.
Extract the soa suite install zip and go to the rca folder located in ias_windows_x86_101351\Disk1\install\soa_schemas\irca
We need to set a database home for the jdbc driver.
set ORACLE_HOME=C:\oracle\product\11.1.0\db_1
We can use the jdk of the new weblogic install
set JAVA_HOME=C:\oracle\Soa10gWls\jdk160_11
Now we can start irca.bat
After a succesfull install of the repository we can start the soa suite installer in this folder ias_windows_x86_101351\Disk1
Very important the destination path must be in a folder of the just created wls middleware home so I use C:\oracle\Soa10gWls\soa10g

As weblogic home location use C:\oracle\Soa10gWls\wlserver_10.3
We are ready with the install
Now we to start script for wsm go to the C:\oracle\Soa10gWls\soa10g\config\ folder and start
configureSOA.bat
Last step is to create a Soa domain just like Soa Suite 11g and select the Soa Suite 10.1.3.5.1 option

Provide the orabpel and oraesb schema passwords.
Start the admin server and go to http://localhost:7001/console where we can take a look at the server. The soa suite server is called soa10g_server1

When we want to start the soa server we need to go the soa domain bin folder
C:\oracle\Soa10gWls\user_projects\domains\soa1013_domain\bin
and use "startManagedWebLogic.cmd soa10g_server1" to start the server.
This are the default installation url's of the Soa Suite applications
http://localhost:9700/esb
http://localhost:9700/BPELConsole
http://localhost:9700/ccore
And we need to use soaadmin as username to log in and use weblogic1 as password.
The issues that I had and luckily also solved.
Asynchronous routing fails with this error oracle.tip.esb.server.common.exceptions.BusinessEventRetriableException: Failed to enqueue deferred event "oracle.tip.esb.server.dispatch.QueueHandlerException: Publisher not exist for system "{0}"
Thanks to Juan Pablo
change the ESB_PARAMETER table on ORAESB schema the following parameters:
PROP_NAME_CONTROL_TCF_JNDI OracleASjms/ControlTCF
PROP_NAME_MONITOR_TCF_JNDI OracleASjms/MonitorTCF
PROP_NAME_ERROR_TCF_JNDI OracleASjms/ErrorTCF
PROP_NAME_ERROR_RETRY_TCF_JNDI OracleASjms/ErrorRetryTCF
PROP_NAME_DEFERRED_TCF_JNDI OracleASjms/DeferredTCF
PROP_NAME_ERROR_XATCF_JNDI OracleASjms/ErrorTCF
PROP_NAME_DEFERRED_XATCF_JNDI OracleASjms/DeferredTCF
to
PROP_NAME_CONTROL_TCF_JNDI ESB_CONTROL
PROP_NAME_MONITOR_TCF_JNDI ESB_MONITOR
PROP_NAME_ERROR_TCF_JNDI ESB_ERROR
PROP_NAME_ERROR_RETRY_TCF_JNDI ESB_ERROR_RETRY
PROP_NAME_DEFERRED_TCF_JNDI ESB_JAVA_DEFERRED
PROP_NAME_ERROR_XATCF_JNDI ESB_ERROR
PROP_NAME_DEFERRED_XATCF_JNDI ESB_JAVA_DEFERRED
and in the ESB console change the Property of Topic Location of every system to ESB_JAVA_DEFERRED
and see the comments for more fixes
We need to download Weblogic 10.3.1 and Soa Suite 10.1.3.5.1
first step is to install Weblogic 10.3.1, I use C:\oracle\Soa10gWls as my wls middleware home folder
Now we can go to the Soa suite part, first we need to create a bpel, esb and wsm repository.
Extract the soa suite install zip and go to the rca folder located in ias_windows_x86_101351\Disk1\install\soa_schemas\irca
We need to set a database home for the jdbc driver.
set ORACLE_HOME=C:\oracle\product\11.1.0\db_1
We can use the jdk of the new weblogic install
set JAVA_HOME=C:\oracle\Soa10gWls\jdk160_11
Now we can start irca.bat
After a succesfull install of the repository we can start the soa suite installer in this folder ias_windows_x86_101351\Disk1
Very important the destination path must be in a folder of the just created wls middleware home so I use C:\oracle\Soa10gWls\soa10g

As weblogic home location use C:\oracle\Soa10gWls\wlserver_10.3
We are ready with the install
Now we to start script for wsm go to the C:\oracle\Soa10gWls\soa10g\config\ folder and startconfigureSOA.bat
Last step is to create a Soa domain just like Soa Suite 11g and select the Soa Suite 10.1.3.5.1 option

Provide the orabpel and oraesb schema passwords.
Start the admin server and go to http://localhost:7001/console where we can take a look at the server. The soa suite server is called soa10g_server1
When we want to start the soa server we need to go the soa domain bin folder
C:\oracle\Soa10gWls\user_projects\domains\soa1013_domain\bin
and use "startManagedWebLogic.cmd soa10g_server1" to start the server.
This are the default installation url's of the Soa Suite applications
http://localhost:9700/esb
http://localhost:9700/BPELConsole
http://localhost:9700/ccore
And we need to use soaadmin as username to log in and use weblogic1 as password.
The issues that I had and luckily also solved.
Asynchronous routing fails with this error oracle.tip.esb.server.common.exceptions.BusinessEventRetriableException: Failed to enqueue deferred event "oracle.tip.esb.server.dispatch.QueueHandlerException: Publisher not exist for system "{0}"
Thanks to Juan Pablo
change the ESB_PARAMETER table on ORAESB schema the following parameters:
PROP_NAME_CONTROL_TCF_JNDI OracleASjms/ControlTCF
PROP_NAME_MONITOR_TCF_JNDI OracleASjms/MonitorTCF
PROP_NAME_ERROR_TCF_JNDI OracleASjms/ErrorTCF
PROP_NAME_ERROR_RETRY_TCF_JNDI OracleASjms/ErrorRetryTCF
PROP_NAME_DEFERRED_TCF_JNDI OracleASjms/DeferredTCF
PROP_NAME_ERROR_XATCF_JNDI OracleASjms/ErrorTCF
PROP_NAME_DEFERRED_XATCF_JNDI OracleASjms/DeferredTCF
to
PROP_NAME_CONTROL_TCF_JNDI ESB_CONTROL
PROP_NAME_MONITOR_TCF_JNDI ESB_MONITOR
PROP_NAME_ERROR_TCF_JNDI ESB_ERROR
PROP_NAME_ERROR_RETRY_TCF_JNDI ESB_ERROR_RETRY
PROP_NAME_DEFERRED_TCF_JNDI ESB_JAVA_DEFERRED
PROP_NAME_ERROR_XATCF_JNDI ESB_ERROR
PROP_NAME_DEFERRED_XATCF_JNDI ESB_JAVA_DEFERRED
and in the ESB console change the Property of Topic Location of every system to ESB_JAVA_DEFERRED
and see the comments for more fixes
Categories: Development, Fusion Middleware
APEX Kurs März 2010
Dietmar und ich werden einen weiteren Kurs im März 2010 organisieren. In Kürze werden wir die Informationen darüber auf unserer Seite veröffentlichen.
border-style: solid;">
border-style: solid;">

Categories: Development


