Update of /cvsroot/openamf/openamf/src/java/org/openamf
In directory sc8-pr-cvs1:/tmp/cvs-serv16187/src/java/org/openamf
Modified Files:
AdvancedGateway.java DefaultGateway.java
Log Message:
1) Initial PageableRecordSet support, still needs testing and cleanup
2) Added HttpServletRequest to ServiceInvoker constructor
3) Added PageableRecordSet config
4) Config is now a singleton and can be accessed from Config.getInstance()
Index: AdvancedGateway.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/AdvancedGateway.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** AdvancedGateway.java 25 May 2003 00:16:18 -0000 1.14
--- AdvancedGateway.java 28 May 2003 15:53:29 -0000 1.15
***************
*** 90,93 ****
--- 90,94 ----
serviceConfig.getServiceInvokerConfig().getClassName(),
request,
+ httpServletRequest,
getServletContext());
***************
*** 226,233 ****
throws IOException, SAXException {
- Config config = getConfig();
-
ServiceConfig serviceConfig =
! config.getServiceConfig(requestBody.getServiceName());
return serviceConfig;
--- 227,232 ----
throws IOException, SAXException {
ServiceConfig serviceConfig =
! Config.getInstance().getServiceConfig(requestBody.getServiceName());
return serviceConfig;
Index: DefaultGateway.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/DefaultGateway.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** DefaultGateway.java 24 May 2003 21:59:40 -0000 1.27
--- DefaultGateway.java 28 May 2003 15:53:29 -0000 1.28
***************
*** 6,9 ****
--- 6,10 ----
import java.io.IOException;
import java.io.InputStream;
+ import java.sql.ResultSet;
import java.util.Iterator;
***************
*** 22,26 ****
import org.openamf.io.AMFDeserializer;
import org.openamf.io.AMFSerializer;
! import org.xml.sax.SAXException;
public class DefaultGateway extends HttpServlet {
--- 23,27 ----
import org.openamf.io.AMFDeserializer;
import org.openamf.io.AMFSerializer;
! import org.openamf.recordset.ASRecordSet;
public class DefaultGateway extends HttpServlet {
***************
*** 30,33 ****
--- 31,38 ----
private static final String OPENAMF_CONFIG = "OPENAMF_CONFIG";
+ public void init() throws ServletException {
+ reloadConfig();
+ }
+
public void service(
HttpServletRequest httpServletRequest,
***************
*** 167,171 ****
--- 172,205 ----
serviceInvoker.getPersistantServiceObject());
}
+
+ serviceResult =
+ processRecordSet(httpServletRequest, serviceInvoker, serviceResult);
+
+ return serviceResult;
+ }
+ private Object processRecordSet(
+ HttpServletRequest httpServletRequest,
+ ServiceInvoker serviceInvoker,
+ Object serviceResult)
+ throws ServiceInvocationException {
+
+ if (serviceResult instanceof ResultSet) {
+ ASRecordSet asRecordSet = new ASRecordSet();
+ try {
+ asRecordSet.populate((ResultSet) serviceResult);
+ serviceResult = asRecordSet;
+ } catch (IOException e) {
+ throw new ServiceInvocationException(serviceInvoker.getRequest(), e);
+ }
+ }
+
+ if (serviceResult instanceof ASRecordSet) {
+ ASRecordSet asRecordSet = (ASRecordSet)serviceResult;
+ if (asRecordSet.getTotalCount() > asRecordSet.getInitialData().size()) {
+ httpServletRequest.getSession().setAttribute(asRecordSet.getId(), asRecordSet);
+ }
+ }
+
return serviceResult;
}
***************
*** 180,184 ****
try {
! for (Iterator i = getConfig().getServiceInvokerConfigs();
i.hasNext();
) {
--- 214,218 ----
try {
! for (Iterator i = Config.getInstance().getServiceInvokerConfigs();
i.hasNext();
) {
***************
*** 196,199 ****
--- 230,234 ----
invokerConfig.getClassName(),
request,
+ httpServletRequest,
getServletContext());
***************
*** 213,237 ****
}
! protected Config getConfig() throws IOException, SAXException {
! Config config =
! (Config) getServletContext().getAttribute(OPENAMF_CONFIG);
! if (config == null) {
! String configLocation =
! getServletConfig().getInitParameter(OPENAMF_CONFIG);
! InputStream inputStream =
! getServletContext().getResourceAsStream(configLocation);
! ConfigDigester configDigester = new ConfigDigester();
! configDigester.setUseContextClassLoader(true);
! config = (Config) configDigester.parse(inputStream);
! getServletContext().setAttribute(OPENAMF_CONFIG, config);
! log.debug("Putting config in Servlet Context");
! if (log.isDebugEnabled()) {
! log.debug(config);
! }
}
--- 248,272 ----
}
! protected Config reloadConfig() {
! Config config = Config.getInstance();
! String configLocation =
! getServletConfig().getInitParameter(OPENAMF_CONFIG);
! InputStream inputStream =
! getServletContext().getResourceAsStream(configLocation);
! ConfigDigester configDigester = new ConfigDigester();
! configDigester.push(config);
! configDigester.setUseContextClassLoader(true);
! try {
! configDigester.parse(inputStream);
! } catch (Exception e) {
! log.error(e);
! }
! if (log.isDebugEnabled()) {
! log.debug(config);
}
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.