[jboss-svn-commits] JBL Code SVN: r14822 - in labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn: service and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 3 05:39:15 EDT 2007


Author: adamw
Date: 2007-09-03 05:39:14 -0400 (Mon, 03 Sep 2007)
New Revision: 14822

Added:
   labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnCacheItemDataSource.java
Modified:
   labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java
   labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java
Log:
Init values; removing administrated services.

Modified: labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java
===================================================================
--- labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java	2007-09-03 09:36:48 UTC (rev 14821)
+++ labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java	2007-09-03 09:39:14 UTC (rev 14822)
@@ -23,7 +23,6 @@
 
 import org.apache.commons.configuration.Configuration;
 import org.jboss.shotoku.svn.service.delayed.DelayedOperation;
-import org.jboss.shotoku.service.AdministratedService;
 
 import java.util.Set;
 
@@ -31,7 +30,7 @@
  * @author Adam Warski (adamw at aster.pl)
  * @author Damon Sicore (damon at sicore.com)
  */
-public interface SvnService extends AdministratedService {
+public interface SvnService {
     /**
      * Registers a repository in the service. Has an effect only if the
      * repository wasn't earlier registered.
@@ -155,20 +154,6 @@
     public boolean isDeleted(String id, String fullPath);
 
     /**
-     * Gets the interval of the service timer.
-     *
-     * @return Interval of the service timer.
-     */
-    public long getTimerInterval();
-
-    /**
-     * Sets the interval of the service timer.
-     *
-     * @param timerInterval New interval of the service timer.
-     */
-    public void setTimerInterval(long timerInterval);
-
-    /**
      * Sets the first update property - if a repository should be updated
      * on registration.
      *
@@ -198,4 +183,13 @@
      * @param paths Changed paths to update.
      */
     public void addPathsToUpdate(String id, long revision, Set<String> paths);
+    
+    public String getServiceInfo();
+    
+    public void update();
+    
+    public void create() throws Exception;
+    public void start() throws Exception;
+    public void stop();
+    public void destroy();
 }

Added: labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnCacheItemDataSource.java
===================================================================
--- labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnCacheItemDataSource.java	                        (rev 0)
+++ labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnCacheItemDataSource.java	2007-09-03 09:39:14 UTC (rev 14822)
@@ -0,0 +1,29 @@
+package org.jboss.shotoku.svn.service;
+
+import org.jboss.shotoku.cache.CacheItemDataSource;
+import org.jboss.shotoku.cache.ValueChange;
+import org.jboss.shotoku.cache.ValueInit;
+import org.jboss.shotoku.svn.SvnService;
+
+public class SvnCacheItemDataSource implements CacheItemDataSource<Object, Object> {
+	private SvnService service;
+	
+	public SvnCacheItemDataSource(SvnService service) {
+		super();
+		this.service = service;
+	}
+
+	public String getInfo() {
+		return service.getServiceInfo();
+	}
+
+	public ValueInit<? extends Object> init(Object key) {
+		return ValueInit.realValue(null);
+	}
+
+	public ValueChange<? extends Object> update(Object key, Object currentObject) {
+		service.update();
+		return ValueChange.noChange();
+	}
+
+}

Modified: labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java
===================================================================
--- labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java	2007-09-03 09:36:48 UTC (rev 14821)
+++ labs/shotoku/trunk/shotoku-svn/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java	2007-09-03 09:39:14 UTC (rev 14822)
@@ -32,13 +32,13 @@
 import org.jboss.annotation.ejb.Management;
 import org.jboss.annotation.ejb.Service;
 import org.jboss.annotation.ejb.Depends;
+import org.jboss.shotoku.cache.CacheItem;
+import org.jboss.shotoku.cache.CacheItemUser;
 import org.jboss.shotoku.svn.SvnService;
 import org.jboss.shotoku.svn.SvnTools;
 import org.jboss.shotoku.svn.SvnContentManager;
 import org.jboss.shotoku.svn.service.delayed.DelayedOperation;
 import org.jboss.shotoku.tools.Constants;
-import org.jboss.shotoku.service.AdministratedServiceImpl;
-import org.jboss.shotoku.service.AdministratedService;
 import org.jboss.shotoku.ContentManager;
 import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
 import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
@@ -51,21 +51,20 @@
 @Local(SvnServiceLocal.class)
 @Management(SvnService.class)
 @Depends(Constants.SHOTOKU_SERVICE_NAME)
-public class SvnServiceImpl extends AdministratedServiceImpl
-        implements SvnService, SvnServiceLocal {
-    private static final Logger log = Logger.getLogger(AdministratedService.class);
+public class SvnServiceImpl implements SvnService, SvnServiceLocal {
+    private static final Logger log = Logger.getLogger(SvnService.class);
 
     private ConcurrentMap<String, SvnRepository> repositories;
 
     private boolean firstUpdate;
 
+    private CacheItemUser<Object, Object> svnCacheItem;
+    
     /*
      * Service lifecycle management.
      */
 
     public void create() throws Exception {
-        super.create();
-
         // Set up connection protocols support:
         // for DAV (over http and https)
         DAVRepositoryFactory.setup();
@@ -77,23 +76,23 @@
 
         repositories = new ConcurrentHashMap<String, SvnRepository>();
 
-        setTimerInterval(ContentManager.getProperty(
+        svnCacheItem = CacheItem.create(new SvnCacheItemDataSource(this));
+        svnCacheItem.get(null);
+        svnCacheItem.setInterval(ContentManager.getProperty(
                 SvnTools.PROPERTY_INTERVAL, SvnTools.DEFAULT_TIMER_INTERVAL));
         setFirstUpdate(ContentManager.getProperty(
                 SvnTools.FIRST_UPDATE, 1) != 0);
 
         ContentManager.initializeContentManager(SvnContentManager.class.getName());
-
-        super.afterCreate();
     }
 
     public void start() throws Exception {
-        super.start();
-
-        startUpdateThread();
-
-        log.info("Subversion Service started with update interval: "+ getTimerInterval());
+        log.info("Subversion Service started.");
     }
+    
+    public void stop() {
+    	
+    }
 
     public void destroy() {
     }
@@ -102,10 +101,6 @@
       * Timer-handling functions.
       */
 
-    public AdministratedService getServiceInstance() {
-        return SvnTools.getService();
-    }
-
     public void update() {
         for (SvnRepository repo : repositories.values()) {
             try {
@@ -117,15 +112,7 @@
         }
     }
 
-    public String getServiceId() {
-        return "ShotokuSvnService";
-    }
-
-    public String getServiceName() {
-        return "SVN service";
-    }
-
-    public String getServiceDescription() {
+    public String getServiceInfo() {
         StringBuffer sb = new StringBuffer("These repositories are currently handled: ");
         for (String id : repositories.keySet()) {
             sb.append(id).append(" (").




More information about the jboss-svn-commits mailing list