continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r490663 - in /maven/continuum/branches/key-based-refactor/continuum-store/src: main/java/org/apache/maven/continuum/store/ test/java/org/apache/maven/continuum/store/
Date Thu, 28 Dec 2006 06:21:37 GMT
Author: rinku
Date: Wed Dec 27 22:21:37 2006
New Revision: 490663

URL: http://svn.apache.org/viewvc?view=rev&rev=490663
Log:
o  moved around methods to respective separate store impls.
o  adjustment to JDO store hierarchy.

Added:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractJdoStore.java
  (with props)
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectGroupStore.java
  (with props)
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectStore.java
      - copied, changed from r490562, maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoSystemStore.java
  (with props)
Removed:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java
Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractJdoStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractJdoStore.java?view=auto&rev=490663
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractJdoStore.java
(added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractJdoStore.java
Wed Dec 27 22:21:37 2006
@@ -0,0 +1,147 @@
+/**
+ * 
+ */
+package org.apache.maven.continuum.store;
+
+import org.codehaus.plexus.jdo.PlexusJdoUtils;
+import org.codehaus.plexus.jdo.PlexusObjectNotFoundException;
+import org.codehaus.plexus.jdo.PlexusStoreException;
+
+import javax.jdo.FetchPlan;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Transaction;
+
+/**
+ * Covenience base class that consolidates some common methods used by
+ * extensions.
+ * 
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ * @version $Id$
+ * @since 1.1
+ */
+public class AbstractJdoStore
+{
+
+    /**
+     * Provides hook to obtainig a {@link PersistenceManager} instance for
+     * invoking operations on the underlying store.
+     */
+    private PersistenceManagerFactory continuumPmf;
+
+    /**
+     * Lookup and return an Object instance from the underlying store.
+     * 
+     * @param clazz Expected {@link Class} of the Entity being looked up.
+     * @param id object identifier in the underlying store.
+     * @param fetchGroup TODO: Document!
+     * @return matching Object.
+     * @throws ContinuumStoreException
+     * @throws ContinuumObjectNotFoundException if not matching Object could be
+     *             found.
+     */
+    protected Object getObjectById( Class clazz, long id, String fetchGroup )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException
+    {
+        try
+        {
+            return PlexusJdoUtils.getObjectById( getPersistenceManager(), clazz, id, fetchGroup
);
+        }
+        catch ( PlexusObjectNotFoundException e )
+        {
+            throw new ContinuumObjectNotFoundException( e.getMessage() );
+        }
+        catch ( PlexusStoreException e )
+        {
+            throw new ContinuumStoreException( e.getMessage(), e );
+        }
+    }
+
+    /**
+     * Looks up and returns an Entity instance from the underlying store given
+     * the String key and the field name to match it against.
+     * 
+     * @param clazz Expected {@link Class} of the entity being looked up.
+     * @param idField Column identifier/name for the field in the underlying
+     *            store to match the String identifier against.
+     * @param id Identifier value to match in the Id field.
+     * @param fetchGroup TODO: Document! What is a fetchGroup?
+     * @return Entity instance that matches the lookup criteria as specified by
+     *         the passed in Id.
+     * @throws ContinuumStoreException
+     * @throws ContinuumObjectNotFoundException if there was no instance that
+     *             matched the criteria in the underlying store.
+     */
+    protected Object getObjectFromQuery( Class clazz, String idField, String id, String fetchGroup
)
+        throws ContinuumStoreException, ContinuumObjectNotFoundException
+    {
+        try
+        {
+            return PlexusJdoUtils.getObjectFromQuery( getPersistenceManager(), clazz, idField,
id, fetchGroup );
+        }
+        catch ( PlexusObjectNotFoundException e )
+        {
+            throw new ContinuumObjectNotFoundException( e.getMessage() );
+        }
+        catch ( PlexusStoreException e )
+        {
+            throw new ContinuumStoreException( e.getMessage(), e );
+        }
+    }
+
+    /**
+     * Returns the {@link PersistenceManager} instance that allows interaction
+     * with the underlying store.
+     * 
+     * @return {@link PersistenceManager} instance.
+     */
+    protected PersistenceManager getPersistenceManager()
+    {
+        PersistenceManager pm = continuumPmf.getPersistenceManager();
+
+        pm.getFetchPlan().setMaxFetchDepth( -1 );
+        pm.getFetchPlan().setDetachmentOptions( FetchPlan.DETACH_LOAD_FIELDS );
+
+        return pm;
+    }
+
+    /**
+     * Deletes the specified Object instance from the underlying store.
+     * 
+     * @param o Object instance to be deleted.
+     */
+    protected void removeObject( Object o )
+    {
+        PlexusJdoUtils.removeObject( getPersistenceManager(), o );
+    }
+
+    /**
+     * Rolls back the passed in uncommitted transaction.
+     * 
+     * @param tx {@link Transaction} to rollback.
+     */
+    protected void rollback( Transaction tx )
+    {
+        PlexusJdoUtils.rollbackIfActive( tx );
+    }
+
+    /**
+     * Updates the specified object's properties in the underlying store.
+     * 
+     * @param object Object instance to be updated.
+     * @throws ContinuumStoreException wraps up any error encountered while
+     *             updating the specified object in the store.
+     */
+    protected void updateObject( Object object ) throws ContinuumStoreException
+    {
+        try
+        {
+            PlexusJdoUtils.updateObject( getPersistenceManager(), object );
+        }
+        catch ( PlexusStoreException e )
+        {
+            throw new ContinuumStoreException( e.getMessage(), e );
+        }
+    }
+
+}

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractJdoStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractJdoStore.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectGroupStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectGroupStore.java?view=auto&rev=490663
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectGroupStore.java
(added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectGroupStore.java
Wed Dec 27 22:21:37 2006
@@ -0,0 +1,50 @@
+/**
+ * 
+ */
+package org.apache.maven.continuum.store;
+
+import org.apache.maven.continuum.key.GroupProjectKey;
+import org.apache.maven.continuum.model.project.ProjectGroup;
+
+/**
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ * 
+ */
+public class JdoProjectGroupStore extends AbstractJdoStore implements ProjectGroupStore
+{
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectGroupStore#deleteProjectGroup(org.apache.maven.continuum.model.project.ProjectGroup)
+     */
+    public void deleteProjectGroup( ProjectGroup group ) throws ContinuumStoreException
+    {
+        // TODO: Any checks before Group should be deleted?
+        removeObject( group );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectGroupStore#lookupProjectGroup(org.apache.maven.continuum.key.GroupProjectKey)
+     */
+    public ProjectGroup lookupProjectGroup( GroupProjectKey key )
+        throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (ProjectGroup) getObjectFromQuery( ProjectGroup.class, "key", key.getProjectKey(),
null );
+
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectGroupStore#saveProjectGroup(org.apache.maven.continuum.model.project.ProjectGroup)
+     */
+    public ProjectGroup saveProjectGroup( ProjectGroup group ) throws ContinuumStoreException
+    {
+        updateObject( group );
+        return group;
+    }
+
+}

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectGroupStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectGroupStore.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Copied: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectStore.java
(from r490562, maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java)
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectStore.java?view=diff&rev=490663&p1=maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java&r1=490562&p2=maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectStore.java&r2=490663
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoProjectStore.java
Wed Dec 27 22:21:37 2006
@@ -18,20 +18,10 @@
 
 import org.apache.maven.continuum.key.GroupProjectKey;
 import org.apache.maven.continuum.model.project.BuildResult;
-import org.apache.maven.continuum.model.project.Profile;
 import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.model.project.ProjectGroup;
-import org.apache.maven.continuum.model.project.Schedule;
-import org.apache.maven.continuum.model.system.Installation;
-import org.apache.maven.continuum.model.system.SystemConfiguration;
-import org.codehaus.plexus.jdo.PlexusJdoUtils;
-import org.codehaus.plexus.jdo.PlexusObjectNotFoundException;
-import org.codehaus.plexus.jdo.PlexusStoreException;
 
 import javax.jdo.Extent;
-import javax.jdo.FetchPlan;
 import javax.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.Query;
 import javax.jdo.Transaction;
 
@@ -41,25 +31,18 @@
  * Store implementation that interacts with the underlying JDO-based store.
  * 
  * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
- * @version $Id: JdoRefactoredContinuumStore.java 490386 2006-12-26 22:05:15Z
- *          rinku $
+ * @version $Id$
  * @since 1.1
  * @plexus.component role="org.apache.maven.continuum.store.RefactoredContinuumStore"
  *                   role-hint="jdo"
  */
-public class JdoRefactoredContinuumStore implements RefactoredContinuumStore
+public class JdoProjectStore extends AbstractJdoStore implements ProjectStore
 {
 
     /**
-     * Provides hook to obtainig a {@link PersistenceManager} instance for
-     * invoking operations on the underlying store.
-     */
-    private PersistenceManagerFactory continuumPmf;
-
-    /**
      * {@inheritDoc}
      * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteProject(org.apache.maven.continuum.model.project.Project)
+     * @see org.apache.maven.continuum.store.ProjectStore#deleteProject(org.apache.maven.continuum.model.project.Project)
      */
     public void deleteProject( Project project ) throws ContinuumStoreException
     {
@@ -70,18 +53,7 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteProjectGroup(org.apache.maven.continuum.model.project.ProjectGroup)
-     */
-    public void deleteProjectGroup( ProjectGroup group ) throws ContinuumStoreException
-    {
-        // TODO: Any checks before Group should be deleted?
-        removeObject( group );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupProject(org.apache.maven.continuum.key.GroupProjectKey)
+     * @see org.apache.maven.continuum.store.ProjectStore#lookupProject(org.apache.maven.continuum.key.GroupProjectKey)
      */
     public Project lookupProject( GroupProjectKey key )
         throws ContinuumObjectNotFoundException, ContinuumStoreException
@@ -126,250 +98,11 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupProjectGroup(org.apache.maven.continuum.key.GroupProjectKey)
-     */
-    public ProjectGroup lookupProjectGroup( GroupProjectKey key )
-        throws ContinuumObjectNotFoundException, ContinuumStoreException
-    {
-        return (ProjectGroup) getObjectFromQuery( ProjectGroup.class, "key", key.getProjectKey(),
null );
-
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveProject(org.apache.maven.continuum.model.project.Project)
+     * @see org.apache.maven.continuum.store.ProjectStore#saveProject(org.apache.maven.continuum.model.project.Project)
      */
     public Project saveProject( Project project ) throws ContinuumStoreException
     {
         updateObject( project );
         return project;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveProjectGroup(org.apache.maven.continuum.model.project.ProjectGroup)
-     */
-    public ProjectGroup saveProjectGroup( ProjectGroup group ) throws ContinuumStoreException
-    {
-        updateObject( group );
-        return group;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteInstallation(org.apache.maven.continuum.model.system.Installation)
-     */
-    public void deleteInstallation( Installation installation ) throws ContinuumStoreException
-    {
-        // TODO: Any checks before installation should be deleted?
-        removeObject( installation );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteProfile(org.apache.maven.continuum.model.project.Profile)
-     */
-    public void deleteProfile( Profile profile ) throws ContinuumStoreException
-    {
-        // TODO: Any checks before profile should be deleted?
-        removeObject( profile );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteSchedule(org.apache.maven.continuum.model.project.Schedule)
-     */
-    public void deleteSchedule( Schedule schedule ) throws ContinuumStoreException
-    {
-        // TODO: Any checks before schedule should be deleted?
-        removeObject( schedule );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteSystemConfiguration(org.apache.maven.continuum.model.system.SystemConfiguration)
-     */
-    public void deleteSystemConfiguration( SystemConfiguration systemConfiguration ) throws
ContinuumStoreException
-    {
-        // TODO: Any checks before systemConfiguration should be deleted?
-        removeObject( systemConfiguration );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupInstallation(long)
-     */
-    public Installation lookupInstallation( long id ) throws ContinuumObjectNotFoundException,
ContinuumStoreException
-    {
-        return (Installation) getObjectById( Installation.class, id, null );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupProfile(long)
-     */
-    public Profile lookupProfile( long id ) throws ContinuumObjectNotFoundException, ContinuumStoreException
-    {
-        return (Profile) getObjectById( Profile.class, id, null );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupSchedule(long)
-     */
-    public Schedule lookupSchedule( long id ) throws ContinuumObjectNotFoundException, ContinuumStoreException
-    {
-        return (Schedule) getObjectById( Schedule.class, id, null );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupSystemConfiguration(long)
-     */
-    public SystemConfiguration lookupSystemConfiguration( long id )
-        throws ContinuumObjectNotFoundException, ContinuumStoreException
-    {
-        return (SystemConfiguration) getObjectById( SystemConfiguration.class, id, null );
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveInstallation(org.apache.maven.continuum.model.system.Installation)
-     */
-    public Installation saveInstallation( Installation installation ) throws ContinuumStoreException
-    {
-        updateObject( installation );
-        return installation;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveProfile(org.apache.maven.continuum.model.project.Profile)
-     */
-    public Profile saveProfile( Profile profile ) throws ContinuumStoreException
-    {
-        updateObject( profile );
-        return profile;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveSchedule(org.apache.maven.continuum.model.project.Schedule)
-     */
-    public Schedule saveSchedule( Schedule schedule ) throws ContinuumStoreException
-    {
-        updateObject( schedule );
-        return schedule;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveSystemConfiguration(org.apache.maven.continuum.model.system.SystemConfiguration)
-     */
-    public SystemConfiguration saveSystemConfiguration( SystemConfiguration systemConfiguration
)
-        throws ContinuumStoreException
-    {
-        updateObject( systemConfiguration );
-        return systemConfiguration;
-    }
-
-    // ------------------------------------------------------------------------
-    // Service Methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Looks up and returns an Entity instance from the underlying store given
-     * the String key and the field name to match it against.
-     * 
-     * @param clazz Expected {@link Class} of the entity being looked up.
-     * @param idField Column identifier/name for the field in the underlying
-     *            store to match the String identifier against.
-     * @param id Identifier value to match in the Id field.
-     * @param fetchGroup TODO: Document! What is a fetchGroup?
-     * @return Entity instance that matches the lookup criteria as specified by
-     *         the passed in Id.
-     * @throws ContinuumStoreException
-     * @throws ContinuumObjectNotFoundException if there was no instance that
-     *             matched the criteria in the underlying store.
-     */
-    private Object getObjectFromQuery( Class clazz, String idField, String id, String fetchGroup
)
-        throws ContinuumStoreException, ContinuumObjectNotFoundException
-    {
-        try
-        {
-            return PlexusJdoUtils.getObjectFromQuery( getPersistenceManager(), clazz, idField,
id, fetchGroup );
-        }
-        catch ( PlexusObjectNotFoundException e )
-        {
-            throw new ContinuumObjectNotFoundException( e.getMessage() );
-        }
-        catch ( PlexusStoreException e )
-        {
-            throw new ContinuumStoreException( e.getMessage(), e );
-        }
-    }
-
-    private Object getObjectById( Class clazz, long id, String fetchGroup )
-        throws ContinuumStoreException, ContinuumObjectNotFoundException
-    {
-        try
-        {
-            // TODO: Add method to PlexusJdoUtils to use long
-            return PlexusJdoUtils.getObjectById( getPersistenceManager(), clazz, (int) id,
fetchGroup );
-        }
-        catch ( PlexusObjectNotFoundException e )
-        {
-            throw new ContinuumObjectNotFoundException( e.getMessage() );
-        }
-        catch ( PlexusStoreException e )
-        {
-            throw new ContinuumStoreException( e.getMessage(), e );
-        }
-    }
-
-    private PersistenceManager getPersistenceManager()
-    {
-        PersistenceManager pm = continuumPmf.getPersistenceManager();
-
-        pm.getFetchPlan().setMaxFetchDepth( -1 );
-        pm.getFetchPlan().setDetachmentOptions( FetchPlan.DETACH_LOAD_FIELDS );
-
-        return pm;
-    }
-
-    private void removeObject( Object o )
-    {
-        PlexusJdoUtils.removeObject( getPersistenceManager(), o );
-    }
-
-    private void rollback( Transaction tx )
-    {
-        PlexusJdoUtils.rollbackIfActive( tx );
-    }
-
-    private void updateObject( Object object ) throws ContinuumStoreException
-    {
-        try
-        {
-            PlexusJdoUtils.updateObject( getPersistenceManager(), object );
-        }
-        catch ( PlexusStoreException e )
-        {
-            throw new ContinuumStoreException( e.getMessage(), e );
-        }
     }
 }

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoSystemStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoSystemStore.java?view=auto&rev=490663
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoSystemStore.java
(added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoSystemStore.java
Wed Dec 27 22:21:37 2006
@@ -0,0 +1,148 @@
+/**
+ * 
+ */
+package org.apache.maven.continuum.store;
+
+import org.apache.maven.continuum.model.project.Profile;
+import org.apache.maven.continuum.model.project.Schedule;
+import org.apache.maven.continuum.model.system.Installation;
+import org.apache.maven.continuum.model.system.SystemConfiguration;
+
+/**
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ * 
+ */
+public class JdoSystemStore extends AbstractJdoStore implements SystemStore
+{
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#deleteInstallation(org.apache.maven.continuum.model.system.Installation)
+     */
+    public void deleteInstallation( Installation installation ) throws ContinuumStoreException
+    {
+        // TODO: Any checks before installation should be deleted?
+        removeObject( installation );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#deleteProfile(org.apache.maven.continuum.model.project.Profile)
+     */
+    public void deleteProfile( Profile profile ) throws ContinuumStoreException
+    {
+        // TODO: Any checks before profile should be deleted?
+        removeObject( profile );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#deleteSchedule(org.apache.maven.continuum.model.project.Schedule)
+     */
+    public void deleteSchedule( Schedule schedule ) throws ContinuumStoreException
+    {
+        // TODO: Any checks before schedule should be deleted?
+        removeObject( schedule );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#deleteSystemConfiguration(org.apache.maven.continuum.model.system.SystemConfiguration)
+     */
+    public void deleteSystemConfiguration( SystemConfiguration systemConfiguration ) throws
ContinuumStoreException
+    {
+        // TODO: Any checks before systemConfiguration should be deleted?
+        removeObject( systemConfiguration );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#lookupInstallation(long)
+     */
+    public Installation lookupInstallation( long id ) throws ContinuumObjectNotFoundException,
ContinuumStoreException
+    {
+        return (Installation) getObjectById( Installation.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#lookupProfile(long)
+     */
+    public Profile lookupProfile( long id ) throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (Profile) getObjectById( Profile.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#lookupSchedule(long)
+     */
+    public Schedule lookupSchedule( long id ) throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (Schedule) getObjectById( Schedule.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#lookupSystemConfiguration(long)
+     */
+    public SystemConfiguration lookupSystemConfiguration( long id )
+        throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (SystemConfiguration) getObjectById( SystemConfiguration.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#saveInstallation(org.apache.maven.continuum.model.system.Installation)
+     */
+    public Installation saveInstallation( Installation installation ) throws ContinuumStoreException
+    {
+        updateObject( installation );
+        return installation;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#saveProfile(org.apache.maven.continuum.model.project.Profile)
+     */
+    public Profile saveProfile( Profile profile ) throws ContinuumStoreException
+    {
+        updateObject( profile );
+        return profile;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#saveSchedule(org.apache.maven.continuum.model.project.Schedule)
+     */
+    public Schedule saveSchedule( Schedule schedule ) throws ContinuumStoreException
+    {
+        updateObject( schedule );
+        return schedule;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.ProjectStore#saveSystemConfiguration(org.apache.maven.continuum.model.system.SystemConfiguration)
+     */
+    public SystemConfiguration saveSystemConfiguration( SystemConfiguration systemConfiguration
)
+        throws ContinuumStoreException
+    {
+        updateObject( systemConfiguration );
+        return systemConfiguration;
+    }
+
+}

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoSystemStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoSystemStore.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java?view=diff&rev=490663&r1=490662&r2=490663
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
Wed Dec 27 22:21:37 2006
@@ -26,7 +26,7 @@
  */
 public class AbstractRefactoredContinuumStoreTestCase extends PlexusTestCase
 {
-    protected RefactoredContinuumStore store;
+    protected ProjectStore store;
 
     /**
      * DDL for Database creation.
@@ -43,7 +43,7 @@
      * 
      * @todo push down to a Jdo specific test
      */
-    protected RefactoredContinuumStore createStore() throws Exception
+    protected ProjectStore createStore() throws Exception
     {
         DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup(
JdoFactory.ROLE );
 
@@ -55,7 +55,7 @@
 
         jdoFactory.setPassword( "" );
 
-        return (RefactoredContinuumStore) lookup( RefactoredContinuumStore.ROLE );
+        return (ProjectStore) lookup( ProjectStore.ROLE );
     }
 
     protected void createBuildDatabase() throws Exception



Mime
View raw message