01: package com.sun.portal.rproxy.rewriter.services.idsame;
02:
03: import com.sun.portal.rewriter.RewriterModule;
04: import com.sun.portal.log.common.PortalLogger;
05: import com.sun.portal.rewriter.rom.RuleSetManager;
06: import com.sun.portal.rewriter.services.DataServiceException;
07: import com.sun.portal.rewriter.util.Debug;
08: import com.sun.portal.rproxy.configservlet.Request;
09: import com.sun.portal.rproxy.configservlet.Response;
10: import com.sun.portal.rproxy.configservlet.ServiceHandler;
11: import com.sun.portal.rproxy.rewriter.services.SRAPDataServiceAdapter;
12:
13: import java.rmi.RemoteException;
14: import java.util.Observable;
15:
16: public class IDSAMEDataServiceSkeleton extends SRAPDataServiceAdapter
17: implements ServiceHandler {
18: public Response handleRequest(Request request)
19: throws RemoteException {
20: String requestType = request.getRequestType();
21:
22: try {
23: if (RETRIEVE_XML.equals(requestType)) {
24: Object[] arguments = request.getArguments();
25: String key = (String) arguments[0];
26: String returnedObject = retrieveXML(key);
27: return new Response(request.getServiceName(), request
28: .getRequestType(), returnedObject);
29: }
30: } catch (DataServiceException de) {
31: Debug.error("HTTPDataService Skeleton:" + de);
32:
33: return new Response(request.getServiceName(), request
34: .getRequestType(), de);
35: }
36:
37: return new Response(request.getServiceName(), request
38: .getRequestType(), new RemoteException(
39: "Not able to find the method to execute"));
40: }//handleRequest()
41:
42: public String retrieveXML(String aKey) throws DataServiceException {
43: String result = RuleSetManager.getDefault().retrieve(aKey);
44: return result;
45: }
46:
47: public Observable getChangeNotifier() {
48: doTask();
49: return null;
50: }//getChangeNotifier()
51:
52: static {
53: //Bug#4894677. If RuleSetManager.getDefault() is null this class can't
54: // work. RewriterModule.initIDSAME() will initialize it
55: if (RuleSetManager.getDefault() == null)
56: RewriterModule.initIDSAME();
57: }
58: }//class IDSAMEDataServiceSkeleton
|