Oracle9i Supplied Java Packages Reference Release 2 (9.2) Part Number A96609-01 |
|
This chapter describes package oracle.AQ.xml, which contains the classes for Oracle9i Advanced Queuing (AQ) XML Servlet. This servlet is used to access Oracle9i AQ via open protocols like HTTP and SMTP using the Internet Data Access Presentation (iDAP).
The sections in this chapter are as follows:
Package oracle.AQ.xml contains classes required by the Oracle9i Advanced Queuing (AQ) XML Servlet.
Oracle9i Application Developer's Guide - Advanced Queuing describes how to develop Java applications for Oracle9i Advanced Queuing.
The common interfaces and classes are based on current PL/SQL interfaces.
AQ
.AQOracle
.You use the AQ XML servlet to access Oracle9i AQ using open protocols like HTTP and SMTP and using an XML message format called Internet Data Access Presentation (iDAP).
Using the AQ servlet, a client can perform these actions:
Because the servlet uses JDBC OCI drivers to connect to the Oracle9i database server, the 9i Oracle Client libraries must be installed on the machine that hosts the servlet. The LD_LIBRARY_PATH must contain $ORACLE_HOME/lib.
The servlet can be created by defining a JavaTM class that extends the oracle.AQ.xml.AQxmlServlet or oracle.AQ.xml.AQxmlServlet20 class. These classes in turn extend the javax.servlet.http.HttpServlet class.
The servlet can be deployed in any Web server or Servlet Runner that implements JavaTM Servlet 2.0, JavaTM Servlet 2.2, or JavaTM Servlet 2.3 interfaces as follows:
$ORACLE_HOME/jdbc/lib/classes13.zip $ORACLE_HOME/jdbc/lib/jta.zip $ORACLE_HOME/jdbc/lib/nls_charset13.zip $ORACLE_HOME/jdbc/lib/jndi.zip $ORACLE_HOME/lib/lclasses13.zip $ORACLE_HOME/lib/xmlparserv2.jar $ORACLE_HOME/lib/xschema.jar $ORACLE_HOME/rdbms/jlib/aqapi.jar $ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqxml.jar $ORACLE_HOME/rdbms/jlib/xsu13.jar $ORACLE_HOME/jis/lib/servlet.jar
$ORACLE_HOME/jdbc/lib/classes12.zip $ORACLE_HOME/jdbc/lib/jta.zip $ORACLE_HOME/jdbc/lib/nls_charset12.zip $ORACLE_HOME/jdbc/lib/jndi.zip $ORACLE_HOME/lib/lclasses12.zip $ORACLE_HOME/lib/xmlparserv2.jar $ORACLE_HOME/lib/xschema.jar $ORACLE_HOME/rdbms/jlib/aqapi.jar $ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqxml.jar $ORACLE_HOME/rdbms/jlib/xsu12.jar $ORACLE_HOME/jis/lib/servlet.jar
$ORACLE_HOME/jdbc/lib/classes111.zip $ORACLE_HOME/jdbc/lib/jta.zip $ORACLE_HOME/jdbc/lib/nls_charset11.zip $ORACLE_HOME/jdbc/lib/jndi.zip $ORACLE_HOME/lib/lclasses11.zip $ORACLE_HOME/lib/xmlparserv2.jar $ORACLE_HOME/lib/xschema.jar $ORACLE HOME/rdbms/jlib/aqapi11.jar $ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqxml.jar $ORACLE_HOME/rdbms/jlib/xsu111.jar $ORACLE_HOME/jis/lib/servlet.jar
Since the servlet uses JDBC OCI drivers to connect to the Oracle9i server, it is required that Oracle9i Client libraries be installed on the machine that hosts the servlet. The LD_LIBRARY_PATH must contain $ORACLE_HOME/lib.
For more information on Internet access to AQ, refer to Oracle9i Application Developer's Guide - Advanced Queuing.
A summary of package oracle.AQ.xml is provided here.
public interface AQxmlCallback
This interface is used to define callbacks to be invoked before/after the servlet performs AQ operations. The callback must be defined in the init method of the servlet by using the setUserCallback method The callback methods get the servlet request stream, the servlet response and the callback context. The CallbackContext has methods to retrieve the parsed XML document, get a JDBC connection to the AQ database, and override the response stream sent by the servlet
Member Summary | Description |
---|---|
Methods |
- |
afterAQOperation(HttpServletRequest, HttpServletResponse, AQxmlCallbackContext) |
Callback invoked after any AQ operations are performed by the servlet |
beforeAQOperation(HttpServletRequest, HttpServletResponse, AQxmlCallbackContext) |
Callback invoked before any AQ operations are performed by the servlet |
public void afterAQOperation(oracle.AQ.xml.HttpServletRequest request, oracle.AQ.xml.HttpServletResponse response, AQxmlCallbackContext ctx)
Callback invoked after any AQ operations are performed by the servlet
request
- servlet request
response
- servlet response
ctx
- Callback context
public void beforeAQOperation(oracle.AQ.xml.HttpServletRequest request, oracle.AQ.xml.HttpServletResponse response, AQxmlCallbackContext ctx)
Callback invoked before any AQ operations are performed by the servlet
request
- servlet request
response
- servlet response
ctx
- Callback context
public class AQxmlDataSource extends java.lang.Object java.lang.Object | +--oracle.AQ.xml.AQxmlDataSource
The AQ data source is used the specify the backend database to which the servlet connects to perform AQ operations. It contains the database SID, host name, listener port and the username/password of the AQ servlet super-user. The AQ servlet uses the JDBC-OCI driver to connect to the database. It creates a connection cache - the default size of the connection pool is 5.
Inherited Member Summary |
---|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public AQxmlDataSource(OracleOCIConnectionPool pool_ds)
Creates an AQ data source given an OCI connection pool
pool_ds
- OCI connection pool
AQxmlException - if fails to create a data source
public AQxmlDataSource(java.lang.String user, java.lang.String password, java.lang.String sid, java.lang.String host, java.lang.String port)
Creates an AQ data source
user
- username
password
- user password
sid
- database SID
port
- listener port
AQxmlException - if fails to create a data source
public int getCacheSize()
Get the size of the connection cache
public java.lang.String getDBDrv()
Get the JDBC driver used by the data source
public java.lang.String getHost()
Get the host name
public java.lang.String getPort()
Get the listener port
public java.lang.String getSid()
Get the database SID
public void setCacheSize(int csize)
Set the size of the connection cache
csize
- cache size
public class AQxmlCallbackContext extends java.lang.Object java.lang.Object | +--oracle.AQ.xml.AQxmlCallbackContext
This is the context passed to the user before/after callback functions This CallbackContext has methods to retrieve the parsed XML document, get a JDBC connection to the AQ database, override the response stream sent by the servlet and set the xml style sheet for the response
Inherited Member Summary |
---|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public java.sql.Connection getDBConnection()
Get the JDBC connection that is used to perform this request Users can perform SQL operations using this database connection. The operations performed will be part of the same transaction as the AQ operations. They will be committed or aborted when the AQ operation in the IDAP message is committed or aborted. Users cannot call commit/rollback on these connections. Commit/Rollback has to be done by sending an IDAP message to the servlet.
public boolean getOverrideAQResponseFlag() Get flag to override the response that will be sent back by the AQ servlet.
public AQxmlDocument getServerResponseDoc()
Get the AQxmlDocument representing the response that will be sent back from the servlet. This is available only in the afterAQOperation callback
public java.lang.String getStyleSheetProcessingInstr()
Get the stylesheet processing instruction for the XML response
public oracle.AQ.xml.Document parseRequestStream()
Parse the XML document in the servlet request
public void setOverrideAQResponseFlag(boolean value)
Set flag to override the response sent back by the AQ servlet. The AQ servlet sends back an IDAP response to the requestor. User callbacks can set this flag if they want to write their own response instead of the one sent back by AQ
public void setStyleSheet(java.lang.String type, java.lang.String href)
Set StyleSheet for the XML response. This can be used to set a xml-stylesheet processing instruction for the XML responses that will be sent fo this request
type
- stylesheet type (Example: "text/xml")
href
- stylesheet href (Example: "http://www.aq.com/AQ/xslt.html" )
AQxmlException - if invalid parameters specified
public void setStyleSheetProcessingInstr(java.lang.String proc_instr)
Set StyleSheet processing instruction for the XML response. This can be used to set a xml-stylesheet processing instruction for the XML responses that will be sent fo this request
proc_instr
- stylesheet processing instruction
(Example: "type=\"text/xsl\" href=\"http://www.oa.com/AQ/xslt23.html\"" )
public class AQxmlServlet implements java.lang.Runnable oracle.AQ.xml.AQxmlServlet
java.lang.Runnable
AQxmlServlet - this is the AQ xml servlet which handles HTTP POST requests from clients. This servlet can be deployed in any servlet engine that implements Javasoft's Servlet2.2 standard. Users are required to extend this servlet and define a AQ data source (to connect to the database instance) before deploying it
protected void doGet(oracle.AQ.xml.HttpServletRequest request, oracle.AQ.xml.HttpServletResponse response)
This method handles HTTP GET requests. This is just used to test whether the servlet has been deployed successfully. In general all AQ operations must be sent as HTTP POST requests.
protected void doPost(oracle.AQ.xml.HttpServletRequest request, oracle.AQ.xml.HttpServletResponse response)
This method handles HTTP POST requests. This is the main entry point for the AQ xml servlet. This routine expects the incoming stream to be of type text/xml which contains an XML message conforming to he IDAP schema
request
- the http post request
response
- the response object. The output is written to this stream
ServletException,
- IOException
public synchronized AQxmlDataSource getAQDataSource()
get the AQ data source that will be used by this servlet to the database
public java.lang.String getEmailServerAddr()
Get the IP address of the email server
public java.lang.String getEmailServerHost()
Get the email server host name
public final AQxmlCallback getUserCallback()
get the callback registered by the user
public final synchronized void setAQDataSource(AQxmlDataSource data_source)
Subclasses must call this method in the init method of the servlet to specify the database connect parameters (username/password, sid, portno etc)
data_source
- the AQ data source
public synchronized void setAQSchemaLocation(java.lang.String schema_location)
setAQxmlSchemaLocation - set the location of the AQ IDAP schema. By default we pick up the schema from the envelope.xsd, aqxml.xsd file in the aqxml.jar file
public synchronized void setEmailServerAddr(java.lang.String ip_address)
Set the IP address of the Email server.
ip_address
- IP address of email server
public final synchronized void setLdapContext(oracle.AQ.xml.DirContext ctx)
Set the LDAP context for the servlet. This context must be set in the init method of the servlet, if the IDAP messages may contain queue/topic aliases that are to be looked up in an LDAP server.
ctx
- LDAP directory context
protected synchronized void setSessionMaxInactiveTime(int secs)
Set the maximum time a session can remain inactive. If the session remains inactive for more than this time, the session is destroyed and all operations that have not been committed are rolled back. By default this is set to 120 seconds
secs
- time in seconds. This value cannot be set to less than 30secs
public synchronized void setStyleSheet(java.lang.String type, java.lang.String href)
Set StyleSheet for responses. This can be called in the init method of the servlet to set a xml-stylesheet processing instruction for all XML responses sent by the servlet
type
- stylesheet type (e.g: "text/xml")
href
- stylesheet href (e.g: "http://www.aq.com/AQ/xslt.html" )
AQxmlException - if invalid parameters specified
public void setStyleSheetProcessingInstr(java.lang.String proc_instr)
Set StyleSheet processing instruction for responses. This can be called in the init method of the servlet to set a xml-stylesheet processing instruction for all XML responses sent by the servlet
proc_instr
- stylesheet processing instruction (e.g: "type=\"text/xsl\" href=\"http://www.oa.com/AQ/xslt23.html\"" )
public final void setUserCallback(AQxmlCallback callback)
setUserCallback - set the user callback. The callback methods are invoked before and after AQ operations
callback
- user callback
public class AQxmlServlet20 implements java.lang.Runnable oracle.AQ.xml.AQxmlServlet20
java.lang.Runnable
AQxmlServlet - this is the AQ xml servlet which handles HTTP POST requests from clients. This servlet can be deployed in any servlet engine that implements Javasoft's Servlet2.0 standard. Users are required to extend this servlet and define a AQ data source (to connect to the database instance) before deploying it.
protected void doGet(oracle.AQ.xml.HttpServletRequest request, oracle.AQ.xml.HttpServletResponse response)
This method handles HTTP GET requests. This is just used to test whether the servlet has been deployed successfully. In general all AQ operations must be sent as HTTP POST requests.
protected void doPost(oracle.AQ.xml.HttpServletRequest request, oracle.AQ.xml.HttpServletResponse response)
This method handles HTTP POST requests. This is the main entry point for the AQ xml servlet. This routine expects the incoming stream to be of type text/xml which contains an XML message conforming to he IDAP schema
request
- the http post request
response
- the response object. The output is written to this stream
ServletException,
- IOException
public synchronized AQxmlDataSource getAQDataSource()
get the AQ data source that will be used by this servlet to the database
public java.lang.String getEmailServerAddr()
Get the IP address of the email server
public java.lang.String getEmailServerHost()
Get the email server host name
public final AQxmlCallback getUserCallback()
get the callback registered by the user
public final synchronized void setAQDataSource(AQxmlDataSource data_source)
Subclasses must call this method in the init method of the servlet to specify the database connect parameters (username/password, sid, portno etc)
data_source
- the AQ data source
public synchronized void setAQSchemaLocation(java.lang.String schema_location)
setAQxmlSchemaLocation - set the location of the AQ IDAP schema. By default we pick up the schema from the envelope.xsd
, aqxml.xsd
file in the aqxml.jar
file.
public synchronized void setEmailServerAddr(java.lang.String ip_address)
Set the IP address of the Email server.
ip_address
- IP address of email server
public final synchronized void setLdapContext(oracle.AQ.xml.DirContext ctx)
Set the LDAP context for the servlet. This context must be set in the init method of the servlet, if the IDAP messages may contain queue/topic aliases that are to be looked up in an LDAP server.
ctx
- LDAP directory context
protected synchronized void setManualInvalidation(boolean flag)
Set flag to turn on/off manual session invalidation For Servlet2.0 implementations we start a thread to automatically invalidate sessions that have stayed inactive beyond the max inactive time. If your servlet runner does its own invalidation of sessions, you may set this flag to false.
flag
- true => indicates manual session invalidation is turned on false => indicates manual session invalidation is turned off
protected synchronized void setSessionMaxInactiveTime(int secs)
Set the maximum time a session can remain inactive. If the session remains inactive for more than this time, the session is destroyed and all operations that have not been committed are rolled back. By default this is set to 120 seconds
secs
- time in seconds. This value cannot be set to less than 30secs
public synchronized void setStyleSheet(java.lang.String type, java.lang.String href)
Set StyleSheet for responses. This can be called in the init method of the servlet to set a xml-stylesheet processing instruction for all XML responses sent by the servlet
type
- stylesheet type (e.g: "text/xml")
href
- stylesheet href (e.g: "http://www.aq.com/AQ/xslt.html" )
AQxmlException - if invalid parameters specified
public void setStyleSheetProcessingInstr(java.lang.String proc_instr)
Set StyleSheet processing instruction for responses. This can be called in the init
method of the servlet to set a xml-stylesheet processing instruction for all XML responses sent by the servlet
proc_instr
- stylesheet processing instruction (e.g: "type=\"text/xsl\" href=\"http://www.oa.com/AQ/xslt23.html\"" )
public final void setUserCallback(AQxmlCallback callback)
setUserCallback - set the user callback. The callback methods are invoked before and after AQ operations
callback
- user callback
public class AQxmlDebug extends java.lang.Object java.lang.Object | +--oracle.AQ.xml.AQxmlDebug
This class has static methods to set trace levels for the AQ Servlet. Do not use unless instructed by Oracle Support
Inherited Member Summary |
---|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public static java.io.OutputStream getLogStream()
Get log stream to which trace information is written
public static java.io.PrintWriter getPrintWriter()
Get print stream
public static int getTraceLevel()
Get trace level
public static void setDebug(boolean val)
Set debug flag
public static void setLogStream(java.io.OutputStream output_stream)
Set log stream to which trace information is written
output
- log stream
public static void setTraceLevel(int level)
Set trace level
0 - no tracing (default)
1 - fatal errors
2 - other errors, imp messages
3 - exception trace, other trace info
4 - method entry/exit
5 - print stack traces, variables
public class AQxmlException extends java.lang.Exception java.lang.Object | +--java.lang.Throwable | +--java.lang.Exception | +--oracle.AQ.xml.AQxmlException
java.io.Serializable
AQ XML Exception
Member Summary | Description |
---|---|
Methods |
- |
Get the Oracle Error code for the exception |
|
Get the exception linked to this one. |
|
Set the linked exception |
public int getErrorCode()
Get the Oracle Error code for the exception
public java.lang.Exception getNextException()
Get the exception linked to this one.
protected void setNextException(java.lang.Exception exc)
Set the linked exception
exc
- linked exception
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|