Difference between revisions of "IS-Cache"

From Gcube Wiki
Jump to: navigation, search
(Usage)
(Usage)
Line 56: Line 56:
 
* STATEFULL - for the EPRs of the WS resources of a statefull service
 
* STATEFULL - for the EPRs of the WS resources of a statefull service
  
Note that the ISCache periodically harvests the IS, in order to retrieve information for the requested services. Thus, the results of the afforementioned methods are pre-fetched.
+
Note that the ISCache periodically harvests the IS, in order to retrieve information for the requested services. Thus, the results of the afforementioned method are pre-fetched.

Revision as of 12:24, 19 September 2011

The IS-Cache provides simple and flexible methods for retrieving and caching the Endpoint references of gCube web services published in the IS. A component that uses the IS-Cache library, is able to retrieve Endpoint references for:

  • services' Running Instances
  • factory services' Running Instances
  • Web Service statefull resources

Additionally the IS-Cache provides an option for further restricting the final results, by using custom filtering criteria.

Usage

The first step for using the ISCache is to create an instance for a specific scope through the following constructor

        /**
	 * Constructor
	 * @param scope scope
	 */
	public ISCache(GCUBEScope scope);

Then using this instance a component can find the EPRs for services' RIs by using the following method

        /**
	 * Get the running instances (array of URLs) of the specified service
	 * 
	 * @param srvClass
	 *            service class
	 * @param srvName
	 *            service name
	 * @param srvType
	 * 			  service type
	 * @return the running instances (array of URLs) of the specified service
	 * @throws Exception
	 *             in case of error; most probably due to the fact that the
	 *             specified service is not registered.
	 * @see org.gcube.informationsystem.cache.ISCacheMBean#getEPRsFor(String, String,
	 *      String)
	 */
	public EndpointReference[] getEPRsFor(String srvClass, String srvName, String srvType);

For example consider the case where a component needs to find the EPRs of the "SearchSystemService":

EndpointReference[] eprs = isCache.getEPRsFor("Search", "SearchSystemService", "SIMPLE");

There are three options for the "srvType" option:

  • SIMPLE - for all the service's EPRs
  • FACTORY - for the service's endpoints that contain the word "Factory" (this means that we need the factory porttypes of this service)
  • STATEFULL - for the EPRs of the WS resources of a statefull service

Note that the ISCache periodically harvests the IS, in order to retrieve information for the requested services. Thus, the results of the afforementioned method are pre-fetched.