continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r267230 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java...
Date Fri, 02 Sep 2005 16:51:01 GMT
Author: evenisse
Date: Fri Sep  2 09:50:32 2005
New Revision: 267230

URL: http://svn.apache.org/viewcvs?rev=267230&view=rev
Log:
o [CONTINUUM-302] Put back scheduler for build automatically project
o [CONTINUUM-43] Add Schedule screens (list/add/edit/delete)

I need now to add the schedule selection from build definition

Added:
    maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml   (with props)
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
  (with props)
Removed:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/alarmclock/
Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
    maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-web/src/main/resources/templates/navigations/Menu.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Fri Sep  2 09:50:32 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
 
@@ -78,6 +79,9 @@
     void buildProjects( int trigger )
         throws ContinuumException;
 
+    void buildProjects( Schedule schedule )
+        throws ContinuumException;
+
     void buildProject( int projectId )
         throws ContinuumException;
 
@@ -152,5 +156,27 @@
         throws ContinuumException;
 
     void removeBuildDefinition( int projectId, int buildDefinitionId )
+        throws ContinuumException;
+
+    // ----------------------------------------------------------------------
+    // Build Definition
+    // ----------------------------------------------------------------------
+
+    Schedule getSchedule( int id )
+        throws ContinuumException;
+
+    Collection getSchedules()
+        throws ContinuumException;
+
+    void addSchedule( Schedule schedule )
+        throws ContinuumException;
+
+    void updateSchedule( Schedule schedule )
+        throws ContinuumException;
+
+    void updateSchedule( int scheduleId, Map configuration )
+        throws ContinuumException;
+
+    void removeSchedule( int scheduleId )
         throws ContinuumException;
 }

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Fri Sep  2 09:50:32 2005
@@ -75,6 +75,12 @@
 
     Schedule addSchedule( Schedule schedule );
 
+    Schedule getScheduleByName( String name )
+        throws ContinuumStoreException;
+
+    Schedule storeSchedule( Schedule schedule )
+        throws ContinuumStoreException;
+
     List getAllProfilesByName();
 
     Profile addProfile( Profile profile );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Fri Sep  2 09:50:32 2005
@@ -33,6 +33,7 @@
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.project.builder.maven.MavenOneContinuumProjectBuilder;
@@ -257,6 +258,28 @@
         */
     }
 
+    public void buildProjects( Schedule schedule )
+        throws ContinuumException
+    {
+        for ( Iterator projectIterator = getProjects().iterator(); projectIterator.hasNext();
)
+        {
+            Project p = (Project) projectIterator.next();
+
+            Project project = getProjectWithAllDetails( p.getId() );
+
+            for ( Iterator bdIterator = project.getBuildDefinitions().iterator(); bdIterator.hasNext();
)
+            {
+                BuildDefinition buildDef = (BuildDefinition) bdIterator.next();
+
+                if ( schedule.getId() == buildDef.getSchedule().getId() )
+                {
+                    //TODO: Fix trigger name
+                    buildProject( project.getId(), ContinuumProjectState.TRIGGER_UNKNOWN
);
+                }
+            }
+        }
+    }
+
     public void buildProject( int projectId )
         throws ContinuumException
     {
@@ -723,6 +746,108 @@
         catch ( ContinuumStoreException ex )
         {
             throw logAndCreateException( "Error while removing build definition.", ex );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Schedule
+    // ----------------------------------------------------------------------
+
+    public Schedule getSchedule( int scheduleId )
+        throws ContinuumException
+    {
+        List schedules = store.getAllSchedulesByName();
+
+        for ( Iterator i = schedules.iterator(); i.hasNext(); )
+        {
+            Schedule schedule = (Schedule) i.next();
+
+            if ( schedule.getId() == scheduleId )
+            {
+                return schedule;
+            }
+        }
+
+        return null;
+    }
+
+    public Collection getSchedules()
+        throws ContinuumException
+    {
+        return store.getAllSchedulesByName();
+    }
+
+    public void addSchedule( Schedule schedule )
+        throws ContinuumException
+    {
+        Schedule s = null;
+
+        try
+        {
+            s = store.getScheduleByName( schedule.getName() );
+        }
+        catch ( ContinuumStoreException e )
+        {
+        }
+
+        if ( s == null )
+        {
+            store.addSchedule( schedule );
+        }
+        else
+        {
+            throw logAndCreateException( "Can't create schedule. A schedule with the same
name already exists.", null );
+        }
+    }
+
+    public void updateSchedule( Schedule schedule )
+        throws ContinuumException
+    {
+        storeSchedule( schedule );
+    }
+
+    public void updateSchedule( int scheduleId, Map configuration )
+        throws ContinuumException
+    {
+        Schedule schedule = getSchedule( scheduleId );
+
+        schedule.setName( (String) configuration.get( "schedule.name" ) );
+
+        schedule.setDescription( (String) configuration.get( "schedule.description" ) );
+
+        schedule.setCronExpression( (String) configuration.get( "schedule.cronExpression"
) );
+
+        schedule.setDelay( new Integer( (String) configuration.get( "schedule.delay" ) ).intValue()
);
+
+        schedule.setActive( new Boolean( (String) configuration.get( "schedule.active" )
).booleanValue() );
+
+        storeSchedule( schedule );
+    }
+
+    public void removeSchedule( int scheduleId )
+        throws ContinuumException
+    {
+        Schedule schedule = getSchedule( scheduleId );
+
+        removeSchedule( schedule );
+    }
+
+    private void removeSchedule( Schedule schedule )
+        throws ContinuumException
+    {
+        store.removeSchedule( schedule );
+    }
+
+    public Schedule storeSchedule( Schedule schedule )
+        throws ContinuumException
+    {
+        try
+        {
+            return store.storeSchedule( schedule );
+        }
+        catch ( ContinuumStoreException ex )
+        {
+            throw logAndCreateException( "Error while storing schedule.", ex );
         }
     }
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
Fri Sep  2 09:50:32 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.scheduler.ContinuumBuildJob;
 import org.apache.maven.continuum.scheduler.ContinuumScheduler;
+import org.apache.maven.continuum.scheduler.ContinuumSchedulerConstants;
 import org.apache.maven.continuum.scheduler.ContinuumSchedulerException;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -88,11 +89,15 @@
 
         dataMap.put( "logger", getLogger() );
 
+        dataMap.put( ContinuumSchedulerConstants.SCHEDULE, schedule );
+
         //the name + group makes the job unique
 
         JobDetail jobDetail = new JobDetail( schedule.getName(), Scheduler.DEFAULT_GROUP,
ContinuumBuildJob.class );
 
         jobDetail.setJobDataMap( dataMap );
+
+        jobDetail.setDescription( schedule.getDescription() );
 
         CronTrigger trigger = new CronTrigger();
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
Fri Sep  2 09:50:32 2005
@@ -16,10 +16,14 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.notification.ContinuumRecipientSource;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -40,6 +44,11 @@
     extends AbstractLogEnabled
     implements MavenOneMetadataHelper
 {
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
     // ----------------------------------------------------------------------
     // MavenOneMetadataHelper Implementation
     // ----------------------------------------------------------------------
@@ -242,9 +251,24 @@
         project.setNotifiers( notifiers );
 
         BuildDefinition bd = new BuildDefinition();
+
         bd.setArguments( "" );
+
         bd.setGoals( "clean:clean jar:install" );
+
         bd.setBuildFile( "project.xml" );
+
+        try
+        {
+            Schedule schedule = store.getScheduleByName( DefaultContinuumInitializer.DEFAULT_SCHEDULE_NAME
);
+
+            bd.setSchedule( schedule );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            getLogger().warn( "Can't get default schedule.", e );
+        }
+
         project.addBuildDefinition( bd );
     }
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
Fri Sep  2 09:50:32 2005
@@ -18,6 +18,7 @@
 
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
 /**
@@ -40,14 +41,16 @@
     public static final String DEFAULT_PROJECT_GROUP_DESCRIPTION = "Default Project Group";
 
     // ----------------------------------------------------------------------
-    // Default values for the default build settings
+    // Default values for the default schedule
     // ----------------------------------------------------------------------
 
-    public static final String DEFAULT_SCHEDULE_NAME = "DEFAULT_BUILD_SETTINGS";
+    //TODO: move this to an other place
+    public static final String DEFAULT_SCHEDULE_NAME = "DEFAULT_SCHEDULE";
+
+    public static final String DEFAULT_SCHEDULE_DESCRIPTION = "Run hourly";
 
     // Cron expression for execution every hour.
-    //public static final String DEFAULT_BUILD_SETTINGS_CRON_EXPRESSION = "0 0 * * * ?";
-    public static final String DEFAULT_SCHEDULE_CRON_EXPRESSION = "0 * * * * ?";
+    public static final String DEFAULT_SCHEDULE_CRON_EXPRESSION = "0 0 * * * ?";
 
     private Schedule defaultSchedule;
 
@@ -69,9 +72,25 @@
     {
         getLogger().info( "Continuum initializer running ..." );
 
-        defaultSchedule = createDefaultSchedule();
-
-        defaultSchedule = store.addSchedule( defaultSchedule );
+        try
+        {
+            Schedule s = store.getScheduleByName( DEFAULT_SCHEDULE_NAME );
+
+            if ( s != null )
+            {
+                defaultSchedule = s;
+            }
+            else
+            {
+                defaultSchedule = createDefaultSchedule();
+
+                defaultSchedule = store.addSchedule( defaultSchedule );
+            }
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumInitializationException( "Can't initialize default schedule.",
e );
+        }
     }
 
     // ----------------------------------------------------------------------
@@ -85,7 +104,11 @@
 
         schedule.setName( DEFAULT_SCHEDULE_NAME );
 
+        schedule.setDescription( DEFAULT_SCHEDULE_DESCRIPTION );
+
         schedule.setCronExpression( DEFAULT_SCHEDULE_CRON_EXPRESSION );
+
+        schedule.setActive( true );
 
         return schedule;
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
Fri Sep  2 09:50:32 2005
@@ -20,12 +20,16 @@
 import org.apache.maven.continuum.execution.maven.m2.MavenBuilderHelperException;
 import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
 import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
 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.project.builder.AbstractContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ContinuumUtils;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.StringUtils;
@@ -54,6 +58,11 @@
     private MavenBuilderHelper builderHelper;
 
     /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
+    /**
      * @plexus.configuration
      */
     private List excludedPackagingTypes;
@@ -118,9 +127,24 @@
             Project continuumProject = new Project();
 
             BuildDefinition bd = new BuildDefinition();
+
             bd.setArguments( "--batch-mode --non-recursive" );
+
             bd.setGoals( "clean:clean install" );
+
             bd.setBuildFile( "pom.xml" );
+
+            try
+            {
+                Schedule schedule = store.getScheduleByName( DefaultContinuumInitializer.DEFAULT_SCHEDULE_NAME
);
+
+                bd.setSchedule( schedule );
+            }
+            catch ( ContinuumStoreException e )
+            {
+                getLogger().warn( "Can't get default schedule.", e );
+            }
+
             continuumProject.addBuildDefinition( bd );
 
             try

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
Fri Sep  2 09:50:32 2005
@@ -16,6 +16,9 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.model.project.Schedule;
 import org.codehaus.plexus.logging.Logger;
 import org.quartz.Job;
 import org.quartz.JobDetail;
@@ -42,7 +45,22 @@
 
         Logger logger = (Logger) jobDetail.getJobDataMap().get( ContinuumSchedulerConstants.LOGGER
);
 
-        logger.info( ">>>>>>>>>>>>>>>>>>>>>
Executing build job ..." );
+        String jobName = jobDetail.getName();
+
+        logger.info( ">>>>>>>>>>>>>>>>>>>>>
Executing build job (" + jobName + ")..." );
+
+        Continuum continuum = (Continuum) jobDetail.getJobDataMap().get( ContinuumSchedulerConstants.CONTINUUM
);
+
+        Schedule schedule = (Schedule) jobDetail.getJobDataMap().get( ContinuumSchedulerConstants.SCHEDULE
);
+
+        try
+        {
+            continuum.buildProjects( schedule );
+        }
+        catch ( ContinuumException e )
+        {
+            logger.error( "Error building projects for job" + jobName + ".", e );
+        }
 
         /*
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
Fri Sep  2 09:50:32 2005
@@ -1,5 +1,21 @@
 package org.apache.maven.continuum.scheduler;
 
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$

Modified: maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
Fri Sep  2 09:50:32 2005
@@ -255,6 +255,11 @@
     <component>
       <role>org.apache.maven.continuum.execution.maven.m1.MavenOneMetadataHelper</role>
       <implementation>org.apache.maven.continuum.execution.maven.m1.DefaultMavenOneMetadataHelper</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
     </component>
 
     <component>
@@ -323,6 +328,9 @@
       <requirements>
         <requirement>
           <role>org.apache.maven.continuum.execution.maven.m2.MavenBuilderHelper</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
         </requirement>
       </requirements>
       <configuration>

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
Fri Sep  2 09:50:32 2005
@@ -16,11 +16,11 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
-import org.codehaus.plexus.PlexusTestCase;
 
 import java.util.Iterator;
 
@@ -29,7 +29,7 @@
  * @version $Id$
  */
 public class MavenOneContinuumProjectBuilderTest
-    extends PlexusTestCase
+    extends AbstractContinuumTest
 {
     public void testBuildingAProjectFromMetadataWithACompleteMaven1Pom()
         throws Exception

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
Fri Sep  2 09:50:32 2005
@@ -16,12 +16,12 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
-import org.codehaus.plexus.PlexusTestCase;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -36,7 +36,7 @@
  * @version $Id$
  */
 public class MavenTwoContinuumProjectBuilderTest
-    extends PlexusTestCase
+    extends AbstractContinuumTest
 {
     public void testGetEmailAddressWhenTypeIsSetToEmail()
         throws Exception

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Fri Sep  2 09:50:32 2005
@@ -517,6 +517,56 @@
         return (Schedule) addObject( schedule );
     }
 
+    public Schedule getScheduleByName( String name )
+        throws ContinuumStoreException
+    {
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            Extent extent = pm.getExtent( Schedule.class, true );
+
+            Query query = pm.newQuery( extent );
+
+            query.declareImports( "import java.lang.String" );
+
+            query.declareParameters( "String name" );
+
+            query.setFilter( "this.name == name" );
+
+            Collection result = (Collection) query.execute( name );
+
+            if ( result.size() == 0 )
+            {
+                tx.commit();
+
+                return null;
+            }
+
+            Object object = pm.detachCopy( result.iterator().next() );
+
+            tx.commit();
+
+            return (Schedule) object;
+        }
+        finally
+        {
+            rollback( tx );
+        }
+    }
+
+    public Schedule storeSchedule( Schedule schedule )
+        throws ContinuumStoreException
+    {
+        updateObject( schedule );
+
+        return schedule;
+    }
+
     public List getAllProfilesByName()
     {
         return getAllObjectsDetached( Profile.class, "name ascending", null );

Added: maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml?rev=267230&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml (added)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml Fri Sep  2
09:50:32 2005
@@ -0,0 +1,95 @@
+<form>
+  <id>schedules</id>
+  <key-expression>id</key-expression>
+  <summary-collection-expression>getSchedules()</summary-collection-expression>
+  <source-role>org.apache.maven.continuum.Continuum</source-role>
+  <target-class>org.apache.maven.continuum.model.project.Schedule</target-class>
+  <lookup-expression>getSchedule(#id)</lookup-expression>
+  <elements>
+    <element>
+      <id>schedule.name</id>
+      <validators>
+        <validator>
+          <id>required</id>
+          <error-message-key>schedule.name.error</error-message-key>
+        </validator>
+      </validators>
+      <type>text</type>
+      <label-key>schedule.name.label</label-key>
+      <message-key>schedule.name.message</message-key>
+      <expression>name</expression>
+    </element>
+    <element>
+      <id>schedule.description</id>
+      <validators>
+        <validator>
+          <id>required</id>
+          <error-message-key>schedule.description.error</error-message-key>
+        </validator>
+      </validators>
+      <type>text</type>
+      <label-key>schedule.description.label</label-key>
+      <message-key>schedule.description.message</message-key>
+      <expression>description</expression>
+    </element>
+    <element>
+      <id>schedule.cronExpression</id>
+      <validators>
+        <validator>
+          <id>required</id>
+          <error-message-key>schedule.cronExpression.error</error-message-key>
+        </validator>
+      </validators>
+      <type>text</type>
+      <label-key>schedule.cronExpression.label</label-key>
+      <message-key>schedule.cronExpression.message</message-key>
+      <expression>cronExpression</expression>
+    </element>
+    <element>
+      <id>schedule.quietPeriod</id>
+      <type>text</type>
+      <label-key>schedule.quietPeriod.label</label-key>
+      <message-key>schedule.quietPeriod.message</message-key>
+      <default-value>0</default-value>
+      <expression>delay</expression>
+    </element>
+    <element>
+      <id>schedule.active</id>
+      <validators>
+      </validators>
+      <type>checkbox</type>
+      <label-key>schedule.active.label</label-key>
+      <message-key>schedule.active.message</message-key>
+      <default-value>true</default-value>
+      <expression>active</expression>
+    </element>
+  </elements>
+
+  <!-- Add -->
+  <add>
+    <title-key>schedule.addTitle</title-key>
+    <action>addEntity</action>
+    <view>Schedules.vm</view>
+    <view-on-failure>Add.vm</view-on-failure>
+    <fid-on-failure>schedules</fid-on-failure>
+    <expression>addSchedule(#entity)</expression>
+  </add>
+
+  <!-- Update -->
+  <update>
+    <title-key>schedule.updateTitle</title-key>
+    <action>updateEntity</action>
+    <view>Schedules.vm</view>
+    <view-on-failure>Edit.vm</view-on-failure>
+    <fid-on-failure>schedules</fid-on-failure>
+    <expression>updateSchedule(#entity)</expression>
+  </update>
+
+  <!-- Delete -->
+  <delete>
+    <title-key>schedule.deleteTitle</title-key>
+    <view>Schedules.vm</view>
+    <action>deleteEntity</action>
+    <expression>removeSchedule(#id)</expression>
+  </delete>
+</form>

Propchange: maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
Fri Sep  2 09:50:32 2005
@@ -216,28 +216,27 @@
 
 schedule.addTitle = Add Schedule
 
-schedule.updateTitle = Update Schedule
+schedule.updateTitle = Edit Schedule
 
 schedule.deleteTitle = Delete Schedule
 schedule.deleteConfirmationMessage = Are you sure you want to delete this schedule?
 
-scheduleName.label = Name
-scheduleName.message = Enter the name of the schedule
-scheduleName.error = You must enter a name for the schedule
-
-scheduleDescription.label = Description
-scheduleDescription.message = Enter a description of the schedule
-scheduleDescription.error = You must enter a description for the schedule
-
-scheduleScmMode.label = Scm Mode
-scheduleScmMode.message = Enter an scm mode
-scheduleScmMode.error = none
-
-scheduleCronExpression.label = Cron Expression
-scheduleCronExpression.message = Enter the cron expression
-xscheduleCronExpression.error = You must enter a cron expression
-
-scheduleActive.label = Active
-scheduleActive.message = Activate or deactivate the schedule
-scheduleActive.error = none
+schedule.name.label = Name
+schedule.name.message = Enter the name of the schedule
+schedule.name.error = You must enter a name for the schedule
+
+schedule.description.label = Description
+schedule.description.message = Enter a description of the schedule
+schedule.description.error = You must enter a description for the schedule
+
+schedule.cronExpression.label = Cron Expression
+schedule.cronExpression.message = Enter the cron expression
+schedule.cronExpression.error = You must enter a cron expression
+
+schedule.quietPeriod.label = Quiet Period (seconds)
+schedule.quietPeriod.message = Enter a description of the schedule
+schedule.quietPeriod.error = You must enter a description for the schedule
+
+schedule.active.label = Enabled
+schedule.active.message = Enabled/Disabled the schedule
 

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/navigations/Menu.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/navigations/Menu.vm?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/navigations/Menu.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/navigations/Menu.vm Fri
Sep  2 09:50:32 2005
@@ -38,4 +38,11 @@
   </div>
   -->
 
+  <div id="projecttools" class="toolgroup">
+   <div class="label">Administration</div>
+   <div class="body">
+     <div><a href="$link.setPage('Schedules.vm').addPathInfo( 'fid', 'schedules')">Schedules</a></div>
+   </div>
+  </div>
+
 </div>

Added: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm?rev=267230&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
(added)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
Fri Sep  2 09:50:32 2005
@@ -0,0 +1,44 @@
+$page.setTitle( "Continuum" )
+
+#set ( $items = $continuum.schedules )
+
+<div class="app">
+  <div id="h3">
+    <h3>Schedules</h3>
+    <table border="1" cellspacing="2" cellpadding="3" width="100%">
+      <tr>
+        <th>Name</th>
+        <th>Description</th>
+        <th>Cron</th>
+        <th>Quiet Period (seconds)</th>
+        <th width="10%">&nbsp;</th>
+      </tr>
+      #foreach ( $schedule in $items )
+        <tr class="b" #if ( !$schedule.active ) style="color: silver;" #end>
+          <td>$schedule.name #if ( !$schedule.active ) (DISABLED) #end</td>
+          <td>
+            #if ( $schedule.description )
+             $schedule.description
+            #end</td>
+          <td>$schedule.cronExpression</td>
+          <td>$schedule.delay</td>
+          <td width="10%">
+            <a href="$link.setPage('Edit.vm').addPathInfo( 'fid', 'schedules').addPathInfo('id',
$schedule.id)">Edit</a>
+            | <a href="$link.setPage('Delete.vm').addPathInfo('fid', "schedules").addPathInfo('id',
$schedule.id)">Delete</a></td>
+        </tr>
+      #end
+    </table>
+    <div class="functnbar3">
+      <table>
+        <tr>
+          <td>
+            <form method="post" action="$link.setPage('Add.vm').addPathInfo( 'fid', 'schedules')">
+              <input type="submit" name="add-build-def" value="Add"/>
+            </form>
+          </td>
+        </tr>
+      </table>
+    </div>
+  </div>
+</div>
+

Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm?rev=267230&r1=267229&r2=267230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm Fri Sep
 2 09:50:32 2005
@@ -76,7 +76,7 @@
           #if ( $buildDefinition.schedule )
             $buildDefinition.schedule.name
           #else
-            DEFAULT
+            NONE
           #end
         </td>
         <td>Project</td>



Mime
View raw message