Difference between revisions of "ResultSet Framework"
Gpapanikos (Talk | contribs) (→From a writer) |
Gpapanikos (Talk | contribs) (→From a writer) |
||
Line 66: | Line 66: | ||
==== Retrieving a locator ==== | ==== Retrieving a locator ==== | ||
===== From a writer ===== | ===== From a writer ===== | ||
+ | <tt> | ||
<span style="color:green">/*This method retrieves an instance of an RSLocator capable of identifying a ResultSet authored</span> | <span style="color:green">/*This method retrieves an instance of an RSLocator capable of identifying a ResultSet authored</span> | ||
<span style="color:green">by the provided RSXMLWriter. Depending on the type of resource requested, this identifier can either</span> | <span style="color:green">by the provided RSXMLWriter. Depending on the type of resource requested, this identifier can either</span> | ||
Line 74: | Line 75: | ||
:RSLocator locator=null; | :RSLocator locator=null; | ||
:<span style="color:green">/*Retrieves a locator identifying the RS in the local node*/</span> | :<span style="color:green">/*Retrieves a locator identifying the RS in the local node*/</span> | ||
− | :<span style="color:green">locator=writer.getRSLocator(new RSResourceLocalType());</span> | + | :<span style="color:green">//locator=writer.getRSLocator(new RSResourceLocalType());</span> |
:<span style="color:green">/*Retrieves a locator identifying the RS through WS-Resource pattern accesible from any node. The</span> | :<span style="color:green">/*Retrieves a locator identifying the RS through WS-Resource pattern accesible from any node. The</span> | ||
:<span style="color:green">The service pointed to must be in the localhost. This method can be used when manipulating the RSXMLWriter</span> | :<span style="color:green">The service pointed to must be in the localhost. This method can be used when manipulating the RSXMLWriter</span> | ||
:<span style="color:green">outside container context. Otherwise the following method can be used*/</span> | :<span style="color:green">outside container context. Otherwise the following method can be used*/</span> | ||
− | :<span style="color:green">locator=writer.getRSLocator(new RSResourceWSRFType("http://localhost:8080/wsrf/services/diligentproject/searchservice/ResultSetService"));</span> | + | :<span style="color:green">//locator=writer.getRSLocator(new RSResourceWSRFType("http://localhost:8080/wsrf/services/diligentproject/searchservice/ResultSetService"));</span> |
:<span style="color:green">/*Retrieves a locator identifying the RS through WS-Resource pattern accesible from any node. The</span> | :<span style="color:green">/*Retrieves a locator identifying the RS through WS-Resource pattern accesible from any node. The</span> | ||
:<span style="color:green">default constructor utilizes the container context (which must be available) to compose the localy hosted</span> | :<span style="color:green">default constructor utilizes the container context (which must be available) to compose the localy hosted</span> | ||
Line 85: | Line 86: | ||
:return locator; | :return locator; | ||
} | } | ||
+ | </tt> | ||
===== From a reader ===== | ===== From a reader ===== |
Revision as of 11:18, 7 February 2007
Contents
ResultSet Framework
Introduction
The ResultSet Framework provides the enabling mechanism to pass by reference data between components and / or services that can be hosted in the same or remote nodes. It utilizes the WSRF Framework for keeping state and offers value adding opeartions for encapsulating remote and local calls, paging of content, data movement, remote processing and much more fun stuf which you can discover your self instead of me having to right them down you lazy bum (J).......
Implementation Overview
The framework consists of 4 sub components :
- the ResultSet library
- the ResultSet Service
- the ResultSet Client
- the ResultSet Garbage Collector
- The ResultSet is the enabling element that creates a linked list of pages holding the records that are part of the specific result set. It can iterate over the created parts and perform various operations on the structure of the list and the contents themselves. Its operations are mosty part specific bu they can also affect the entire result chain. Once a page of content has been created and the next in line has been initialized the part cannot be altered. Once it has been declared that the authoring of a result set has finished, the entire chain of it is immutible.
- The ResultSet Service is merely a WS front-end to the ResultSet library. It creates and manages WS-Resources holding rferences to instances of the ResultSet components. These instances are responsible to hold state regarding the iteration over the chain of pages and for accessing / modifying / querying the data held.
- The ResultSet Client is a library giving access to both high and low level operations that can be performed on a specific ResultSet component instance and its underlying data. It enables handling of ResultSets that are both wrapped through a WS front-end and that are locally manipulated though direct java invocations (within JVM).
- The ResultSet Garbage Collector is a deamon-like program that can be initialized to clear up resources used by the ResultSet Framework (removing filesystem resources and destroying created WS-Resources)
Dependencies
- ResultSetLibrary
- jdk 1.5
- WS-Core
- ResultSetService
- jdk 1.5
- WS-Core
- ResultSetLibrary
- ResultSetClient
- jdk 1.5
- WS-Core
- ResultSetLibrary
- ResultSetService
- ResultSetGarbageCollector
- jdk 1.5
- WS-Core
- ResultSetLibrary
- ResultSetService stubs
Usage Example
The ResultSets that can be created are content independent but depending on the content inserted different operations can be performed. So different readers and writers have been implemented to offer different levels of versatility depending on the content. Here he will mainly focus on the XML authoring and retrieving
Creating an RS
/*A method that creates a new RSXMLWriter and populates it with some results*/
public static RSXMLWriter createRSWriter() throws Exception{
- /*Create a new writer with the default parametrizable values*/
- RSXMLWriter writer=RSXMLWriter.getRSXMLWriter();
- /*Create a new writer which should have as a condition for paging inserted results either having
- 30 records per page or having a total size surpasing 1024 bytes */
- //writer=RSXMLWriter.getRSXMLWriter(30,1024);
- /*Create a new writer and set a lifetime property of 1000 millisecs. Also set that the paging
- condition will be having 10 records per page or a total size surpasing teh default value*/
- //writer=RSXMLWriter.getRSXMLWriter(new PropertyElementBase[]{new PropertyElementLifeSpanGC(1000)});
- //writer.setRecsPerPart(10);
- /*Add a new result with the given id, collection, rank and payload*/
- writer.addResults(new ResultElementGeneric("id1","collection1","rank1","payload"));
- /*Add a new result with the given id, collection, rank and payload*/
- writer.addResults(new ResultElementGeneric("id2","collection1","rank2","payload"));
- /*Add an array of results with the given id, collection, rank and payload*/
- writer.addResults(new ResultElementBase[]{new ResultElementGeneric("id3","collection1","rank3","payload"),
- new ResultElementGeneric("id4","collection1","rank4","payload")});
- /*Give back the writer*/
- return writer;
}
Retrieving a locator
From a writer
/*This method retrieves an instance of an RSLocator capable of identifying a ResultSet authored by the provided RSXMLWriter. Depending on the type of resource requested, this identifier can either be an identifier pointing to the local node (filesystem) or an idenitfier capable of pinpointing the RS through a web service using the WS-Resource pattern. One can create many locators (of the same or different) type for the same authored RS*/ public static RSLocator getLocator(RSXMLWriter writer) throws Exception{
- RSLocator locator=null;
- /*Retrieves a locator identifying the RS in the local node*/
- //locator=writer.getRSLocator(new RSResourceLocalType());
- /*Retrieves a locator identifying the RS through WS-Resource pattern accesible from any node. The
- The service pointed to must be in the localhost. This method can be used when manipulating the RSXMLWriter
- outside container context. Otherwise the following method can be used*/
- //locator=writer.getRSLocator(new RSResourceWSRFType("http://localhost:8080/wsrf/services/diligentproject/searchservice/ResultSetService"));
- /*Retrieves a locator identifying the RS through WS-Resource pattern accesible from any node. The
- default constructor utilizes the container context (which must be available) to compose the localy hosted
- ResultSetService that must be deployed*/
- locator=writer.getRSLocator(new RSResourceWSRFType());
- return locator;
}