|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
Connector | Maintains a collection of iPhrase servers and properties for failover, and
creates Query objects that can execute
themselves against those servers. |
ConnectorFactory | A ConnectorFactory instance is used to create Connector objects. |
Timer | Timing utilities for measuring runtime performance. |
Timer.Deserializer | Thin wrapper around org.apache.axis.encoding.ser.BeanDeserializer that
calls Timer.elapsed(long, java.lang.String) for the element deserialization operation. |
Tools | Static utility methods used throughout the API and available for clients. |
Top-level package for the Java Runtime API - this is where you can start.
Includes classes
ConnectorFactory
and
Connector
for creating and executing queries.
The Tools
class contains static utility methods
used throughout the API and available for clients.
Below is a simplified use case that shows how to initialize and execute a query. There are two caveats that you should be aware of:
///// The following code is one-time initialization ////////////////////////// String[] servers = {"alpha:1111", "bravo:2222", "charly:3333"}; int timeout = 5; // seconds before timing out and trying "next" server int retry = 10; // seconds before retrying a previously "dead" server // obtain initial Connector instance and keep it handy for reuse ConnectorFactory connectorFactory = ConnectorFactory.newInstance(); Connector connector = connectorFactory.getConnector(servers, timeout, retry); ///// The following code is executed for every query ///////////////////////// // In the following we will distinguish between initial and followup queries. // Imagine we are in a servlet, and have put the previous resolved query state // for the main result set in a hidden field called "ip_state". Query query = null; String state = request.getParameter("ip_state"); if (state == null || state.length() == 0) { query = connector.createQuery(); // create a fresh query // set any properties for your initial query here } else { query = connector.createQuery(state); // create a followup query } // set any properties for request variables here QueryResult result = query.execute(); // SOAP request/response // obtain the resolved query state for the main result set ResultSet main = result.getMainResultSet(); String resolvedQueryState = main.getResolvedQueryState(); // Traverse the result & render it to an HTML response. // Put resolvedQueryState into a hidden form field called "ip_state". // Normally, you will want to store the resolved query state for every // result set in a hidden field of the form corresponding to the result set // (for business rule interaction, etc).The OneStepTabbedNavigation.war JSP application handles resolved state properly for all result sets, main as well as business rule. As such, it is considered an example of best practices, and a good point of departure for client deployments.
ConnectorFactory
,
Connector
,
Query
|
© Copyright 2005, 2006. IBM Corporation. All rights reserved. | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |