abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r563712 - in /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server: impl/AbstractServiceContext.java impl/DefaultServiceContext.java servlet/AbderaServlet.java
Date Wed, 08 Aug 2007 00:55:04 GMT
Author: jmsnell
Date: Tue Aug  7 17:55:04 2007
New Revision: 563712

URL: http://svn.apache.org/viewvc?view=rev&rev=563712
Log:
Patch provided by Dan Diephouse in https://issues.apache.org/jira/browse/ABDERA-55
Makes it easier to configure AbderaServlet using Spring.

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceContext.java?view=diff&rev=563712&r1=563711&r2=563712
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceContext.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceContext.java
Tue Aug  7 17:55:04 2007
@@ -59,4 +59,20 @@
     return config.keySet().toArray(new String[config.size()]);
   }
 
+  public void setHandlerManager(ItemManager<RequestHandler> handlerManager) {
+    this.handlerManager = handlerManager;
+  }
+
+  public void setProviderManager(ItemManager<Provider> providerManager) {
+    this.providerManager = providerManager;
+  }
+
+  public void setSubjectResolver(Resolver<Subject> subjectResolver) {
+    this.subjectResolver = subjectResolver;
+  }
+
+  public void setTargetResolver(Resolver<Target> targetResolver) {
+    this.targetResolver = targetResolver;
+  }
+
 }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java?view=diff&rev=563712&r1=563711&r2=563712
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java
Tue Aug  7 17:55:04 2007
@@ -110,4 +110,20 @@
     return defaulttargetresolver;
   }
 
+  public void setDefaultProviderManager(String defaultprovidermanager) {
+    this.defaultprovidermanager = defaultprovidermanager;
+  }
+
+  public void setDefaultRequestHandlerManager(String defaultrequesthandlermanager) {
+    this.defaultrequesthandlermanager = defaultrequesthandlermanager;
+  }
+
+  public void setDefaultSubjectResolver(String defaultsubjectresolver) {
+    this.defaultsubjectresolver = defaultsubjectresolver;
+  }
+
+  public void setDefaultTargetResolver(String defaulttargetresolver) {
+    this.defaulttargetresolver = defaulttargetresolver;
+  }
+
 }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java?view=diff&rev=563712&r1=563711&r2=563712
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java
Tue Aug  7 17:55:04 2007
@@ -28,6 +28,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.protocol.ItemManager;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.RequestHandler;
@@ -54,16 +55,35 @@
   
   public void init() throws ServletException {
     log.debug("Initialing Abdera Servlet");
-    manager = ServiceManager.getInstance();
-    context = 
-      manager.newServiceContext(
-        getProperties(
-          getServletConfig()));
+    manager = createServiceManager();
+    context = createServiceContext();
     if (context == null) {
       log.debug("Cannot create service context");
       throw new ServletException("Cannot create service context");
     }
   }
+
+  public Abdera getAbdera() {
+     return ServiceManager.getAbdera();
+  }
+  
+  public ServiceContext getServiceContext() {
+    return context;
+  }
+
+  public ServiceManager getServiceManager() {
+    return manager;
+  }
+
+  protected ServiceContext createServiceContext() {
+    return manager.newServiceContext(
+        getProperties(
+          getServletConfig()));
+  }
+
+  protected ServiceManager createServiceManager() {
+    return ServiceManager.getInstance();
+  }
   
   @Override
   protected void service(
@@ -98,7 +118,7 @@
     response.sendError(500, message);
   }
   
-  private Map<String,String> getProperties(ServletConfig config) {
+  protected Map<String,String> getProperties(ServletConfig config) {
     Map<String,String> properties = new HashMap<String,String>();
     Enumeration e = config.getInitParameterNames();
     while(e.hasMoreElements()) {



Mime
View raw message