« September 2008 | Main | November 2008 »

October 2008 Archives

October 17, 2008

Most useful blogs I look always

Most of ADF examples are covered in Frank,Andre,steve,shay blogs.

http://andrejusb-samples.blogspot.com/
http://frank.thepeninsulasedge.com/
http://radio.weblogs.com/0118231/
http://blogs.oracle.com/shay/

I'll try to add examples into ths blog only the one i don't see in above blogs.

Migrating from Previous Version - Jdev11g Production

JDeveloper 11g supports migration from JDeveloper 10.1.3.4 only. Oracle recommends migrating to JDeveloper 10.1.3.4 from all other earlier versions before migrating to JDeveloper 11.1.1.0.0.

Migrating User Settings
When you start JDeveloper for the first time (and each time after adding a new extension), JDeveloper will prompt to ask whether to migrate your settings from a previous installation. Choose Yes from this dialog to browse to the system directory of your previous installation. This will copy relevant user preferences and settings from the prior release to JDeveloper 11g.

To force JDeveloper to display the migration dialog after the initial start, use the -migrate flag, for example, jdev -migrate


Note - Jdev 11g Production

JDeveloper 11g Production

1. There is no longer a standalone ADF installer for ADF 11g. Installing JDeveloper 11g Studio automatically installs Oracle WebLogic Server and creates a domain that is configured to run ADF; you can also use the JDeveloper 11g installer to configure an existing Oracle WebLogic installation to run ADF applications.

2. Jdev11g Production Supports below list of Application Servers :

Oracle WebLogic Server 10g release 3 (10.3)
Tomcat 6.x
JBoss 4.3
WebLogic 9

3. Jdev11g does not support Oracle Application Server 10g (10.1.3)

4. OJVM

OJVM was Oracle's Java VM implementation written to provide a richer set of features and improved performance for debugging and profiling than was possible with older versions of other VMs. Over time other VMs have introduced better capabilities for debugging and profiling, and Oracle is changing its strategy to integrate with these VMs instead of maintaining our own.

OJVM was deprecated in JDeveloper 10.1.3 (original announcement) and has been removed in JDeveloper 11g. You should use Sun's HotSpot VM (client or server) instead for testing, debugging, and profiling application code. The following JDeveloper features are effected by this change:

Debugger: The ability to Set Next Statement, which was specific to OJVM, has been removed. This feature may be reintroduced in the future if and when such features can be implemented with HotSpot.

Profilers: The JDeveloper profilers in 10.1.3 and previous versions were specific to OJVM. JDeveloper 11g has a functionally equivalent CPU profiler and Memory profiler working on JVMTI (a standard API implemented by Sun's JVM). The event profiler has been removed.

CodeCoach: CodeCoach is no longer part of the JDeveloper product. Many of the results generated by CodeCoach are already reported in real time by the audit and metrics features of JDeveloper. Some CodeCoach results (such as Array usage information) have not been replaced


5. 10g ADF Faces Components

The ADF Faces component libraries supported in ADF 10g have been desupported and replaced by the Apache MyFaces Trinidad Components. When an application built with the 10g components is opened in JDeveloper 11g, all of the ADF Faces components will be automatically migrated to the equivalent Trinidad components. You can also use the Trinidad components to build new applications; or you may wish to use the new ADF Faces Rich Client components.

6. Web Browsers Supported by JDeveloper

IE 7.0
Firefox 2.0
Firefox 3.0
Safari 3.0

7. Know Issues http://www.oracle.com/technology/products/jdev/htdocs/11/knownissues.html

October 23, 2008

How to Use JMS to Send Text Messages B/W 2 Clients - Oracle AQJMS

Sample Peer-to-Peer Oracle AQJMS program to send & receive Text Messages between two Clients.

Ensure you enabled JMS option while installing 11g Database.
JMSProvider is the JMS Demon Services running in Oracle 11g Database.

1. JMS Destination is the Queue created with Oracle11g database using below scripts.
Execute below 3 scripts in your database.

rem ==========================================
rem Create a queue table R_RYSAMPLE_QT
rem ==========================================

DECLARE
BEGIN
dbms_output.put_line ('Creating Queue Table R_RYSAMPLE_QT...');

dbms_aqadm.CREATE_queue_table(
queue_table => 'R_RYSAMPLE_QT',
queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE',
sort_list=> 'ENQ_TIME,PRIORITY',
multiple_consumers => FALSE,
compatible => '8.1.0',
message_grouping=> DBMS_AQADM.NONE,
primary_instance=> '0',
secondary_instance=> '0',
comment => 'Creating Queue Table R_RYSAMPLE_QT');

dbms_output.put_line ('Created Queue Table R_RYSAMPLE_QT.');

exception
when others then
catch_error(SQLCODE, 'Create Queue Table ' || substr(SQLERRM, 1, 256));
END;
/

rem ==========================================
rem Create a queue R_RYSAMPLE_Q
rem ==========================================

DECLARE
BEGIN
dbms_output.put_line ('Creating Queue R_RYSAMPLE_Q...');

dbms_aqadm.CREATE_queue(
queue_name => 'R_RYSAMPLE_Q',
queue_table => 'R_RYSAMPLE_QT',
queue_type=> DBMS_AQADM.NORMAL_QUEUE,
max_retries=> '5',
retry_delay=> '0',
retention_time=> '0',
comment => 'Resource Registration Queue');

dbms_output.put_line ('Created Queue R_RYSAMPLE_Q.');

exception
when others then
catch_error(SQLCODE, 'Create Queue ' || substr(SQLERRM, 1, 256));
END;
/

rem ====================================
rem Start input queue R_RYSAMPLE_Q
rem ====================================

DECLARE
BEGIN
dbms_output.put_line('starting queue R_RYSAMPLE_Q...');

dbms_aqadm.start_queue(
queue_name => 'R_RYSAMPLE_Q');

dbms_output.put_line ('Started Queue R_RYSAMPLE_Q.');

exception
when others then
catch_error(SQLCODE, 'Start Queue ' || substr(SQLERRM, 1, 256));
END;
/

2. JMS Client programs shown below.


JMS Client 1 :


package jms;


import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;

import javax.jms.QueueSender;
import javax.jms.QueueSession;

import javax.jms.Session;

import oracle.jms.*;


public class jmsdemo {
// public QueueConnection qc=null;
public jmsdemo() {
}

public void QSendFunction () {

QueueConnection qc=null;
try {

QueueConnectionFactory qcf = AQjmsFactory.getQueueConnectionFactory("databaseHostName", "SID", port, "thin");
qc = qcf.createQueueConnection("userid", "passwd");

//Message delivery does not begin until you start the connection you created by calling the start method
qc.start();

//session is not transacted
QueueSession m_queueSess = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);


// Destination is Queue created in database
Queue m_queue=((AQjmsSession)m_queueSess).getQueue("rocket", "R_RYSAMPLE_Q");

QueueSender m_sender=m_queueSess.createSender(m_queue);

Message mesg = m_queueSess.createTextMessage("Test Message");

m_sender.send(mesg);

}
catch (JMSException e) {
System.out.println(e.getMessage());
}
finally {
try{
qc.stop();
qc.close();
}catch (JMSException e1) {
}
}
}

public static void main(String[] args) {
jmsdemo jmsdemo = new jmsdemo();
jmsdemo.QSendFunction();
}

}

JMS Client 2 :


package jms;


import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;

import javax.jms.QueueReceiver;
import javax.jms.QueueSender;
import javax.jms.QueueSession;

import javax.jms.Session;

import oracle.jms.*;


public class jmsdemorecv {
// public QueueConnection qc=null;
public jmsdemorecv() {
}

public void QRecvFunction () {
QueueConnection qc=null;
try {

// QueueConnectionFactory is the preconfigured JMS Object set by administrator.
QueueConnectionFactory qcf = AQjmsFactory.getQueueConnectionFactory("databaseHostName", "SID", port, "thin");

// Does not created Destination, there is no look to JNDI that holds QF and Destination by JMS Client (this program)
// we are directly using JMS Client to make JMS Provider
// QueueConnection to JMS Provider ( database with JMS Services demon is the service provider )
// User can create one more connections to QF

qc = qcf.createQueueConnection("userid", "passwd");

// Start the Connection
//Message delivery does not begin until you start the connection you created by calling the start method
qc.start();

//A session is a single-threaded context for producing and consuming messages
//QueueSession m_queueSess = qc.createQueueSession(true, 0);

QueueSession m_queueSess = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue m_queue=((AQjmsSession)m_queueSess).getQueue("rocket", "R_RYSAMPLE_Q");

//Once you have created a message consumer, it becomes active, and you can use it to receive messages
//a session and is used for receiving messages sent to a destination.
//A message consumer allows a JMS client to register interest in a destination with a JMS provider.
//The JMS provider manages the delivery of messages

QueueReceiver m_receiver=m_queueSess.createReceiver(m_queue);

// Synchronous messaging
//A receiver explicitly fetches the message from the destination by calling the receive method.
// The receive method can block until a message arrives or can time out if a message does not arrive within a specified time limit
//if you do not want your program to consume system resources unnecessarily, use a timed synchronous receive ex:- receive(1000) timeout 1000ms

Message mesg = m_receiver.receive(5000);
if(mesg != null)
System.out.println(((AQjmsTextMessage)mesg).getText());


}
catch (JMSException e) {
System.out.println(e.getMessage());
}
finally {
try{
qc.stop();
qc.close();
}catch (JMSException e1) {
}
}
}

public static void main(String[] args) {
jmsdemorecv jmsdemo = new jmsdemorecv();
jmsdemo.QRecvFunction();
}

}

Transacted and Non Transacted Sessions - Oracle AQJMS

Oracle AQJMS Transacted & Not Transacted Session Example.

A session provides a transactional context with which to group a set of sends and receives into an atomic unit of work.

1. Remove Non Transacted statement shown below in JMSClient1 and JMSClient2 classes from Example1

QueueSession m_queueSess = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE)

2. Add Transacted statement shown below in JMSClient1 and JMSClient2 classes in the Example1

QueueSession m_queueSess = qc.createQueueSession(true, 0);


3. Create MultipleText Messages in JMSClient1

Message mesg1 = m_queueSess.createTextMessage("Test1 Message");
Message mesg2 = m_queueSess.createTextMessage("Test2 Message");

4. send Above messages to Q.

m_sender.send(mesg1);
m_sender.send(mesg2);

5. The Above Messages gets Queued only if you call Session Commit statement after sending message to Q else Messages are rollback.

m_queueSess.Commit();

6. Receive Above messages from Q in JMSClient2.

m_sender.receive(mesg);
m_sender.receive(mesg);

5. The Above Messages removed from Queue only if you call Session Commit statement after receiving message from Q else Messages are remain in Q after maximum
retry is reached
.

m_queueSess.Commit();

October 24, 2008

Message Persistence - Oracle AQJMS

The PERSISTENT delivery mode, which is the default, instructs the JMS provider to take extra care to ensure that a message is not lost in transit in case of a JMS provider failure. A message sent with this delivery mode is logged to stable storage when it is sent.

Change the message send statement as shown below

m_sender.send(mesg, 1, 2, 3000); - Use below statement to set priority level to individual messages

Expire the message sent after 3 seconds and priority level set to 2

m_sender.setPriority(2) - Use this statement to set priorty 2 to all messages sent.

.
m_sender.setTimeToLive (3000) - Use this statement to set Expiration time to all messages sent.

priority levels : 0 (lowest) - 9 (highest)
default : 4

Message with highest priority send first.

The NON_PERSISTENT delivery mode does not require the JMS provider to store the message or otherwise guarantee that it is not lost if the provider fails.
Using the NON_PERSISTENT delivery mode may improve performance and reduce storage overhead, but you should use it only if your application can afford to miss messages

TemporaryQueue m_queue=m_queueSess.createTemporaryQueue();
QueueSender m_sender=m_queueSess.createSender(m_queue);

October 29, 2008

SetActionListener settings when Dialog used in Action - ADF 10.1.3.3

Use sessionScope or ApplicationScope in 10g or pageFlowScope in 11g if Dialog is used in action as shown below.

id="commandMenuItem4"
icon="../../image/result.gif"
action="dialog:GlobalRegressionComponentSummary"
actionListener="#{Back_RegressionComponentTopLevelSummary.setPageNameProp}"
useWindow="true" windowHeight="500"
windowWidth="300">
to="#{requestScope.currentTargetLabel}"/ don't use this option>
to="#{sessionScope.currentTargetLabel}"/>

October 31, 2008

How to Consume selected messages - Oracle AQJMS

Set Correlation ID in JMS Client1 code using below statement .

Message mesg = m_queueSess.createTextMessage("Test Message");
mesg.setJMSCorrelationID("Fusion");


Use condition as "JMSCorrelationID LIKE 'Fus%'" as second argument in createReceiver API in JMS Client2 code.

QueueReceiver m_receiver=m_queueSess.createReceiver(m_queue, "JMSCorrelationID LIKE 'Fus%'");

createReceiver function creates receiver object only if it matches the condition given.

About October 2008

This page contains all entries posted to Raghu Yadav's Weblog in October 2008. They are listed from oldest to newest.

September 2008 is the previous archive.

November 2008 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle