continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1671648 - in /continuum/trunk/continuum-purge: continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/ continuum-purge-core/src/main/java/org/apache/continuum/purge/repository/scanner/ continuum-purge-master/src/main/java/o...
Date Mon, 06 Apr 2015 19:00:04 GMT
Author: batkinson
Date: Mon Apr  6 19:00:03 2015
New Revision: 1671648

URL: http://svn.apache.org/r1671648
Log:
Moved executor factories into core and made them components.

Added:
    continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactory.java
    continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactoryImpl.java
    continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/MultiplexedPurgeExecutor.java
    continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactory.java
    continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactoryImpl.java
    continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/ScanningPurgeExecutor.java
Modified:
    continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/repository/scanner/DefaultRepositoryScanner.java
    continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/DirectoryPurgeController.java
    continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/RepositoryPurgeController.java

Added: continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactory.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactory.java?rev=1671648&view=auto
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactory.java
(added)
+++ continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactory.java
Mon Apr  6 19:00:03 2015
@@ -0,0 +1,25 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+public interface DirectoryPurgeExecutorFactory
+{
+    ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount, String
dirType );
+}

Added: continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactoryImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactoryImpl.java?rev=1671648&view=auto
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactoryImpl.java
(added)
+++ continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/DirectoryPurgeExecutorFactoryImpl.java
Mon Apr  6 19:00:03 2015
@@ -0,0 +1,42 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import org.codehaus.plexus.component.annotations.Component;
+
+@Component( role = DirectoryPurgeExecutorFactory.class )
+public class DirectoryPurgeExecutorFactoryImpl
+    implements DirectoryPurgeExecutorFactory
+{
+    public ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount,
String dirType )
+    {
+        if ( deleteAll )
+        {
+            return new CleanAllPurgeExecutor( dirType );
+        }
+
+        if ( daysOld > 0 )
+        {
+            return new DaysOldDirectoryPurgeExecutor( daysOld, retentionCount, dirType );
+        }
+
+        return new RetentionCountDirectoryPurgeExecutor( retentionCount, dirType );
+    }
+}

Added: continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/MultiplexedPurgeExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/MultiplexedPurgeExecutor.java?rev=1671648&view=auto
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/MultiplexedPurgeExecutor.java
(added)
+++ continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/MultiplexedPurgeExecutor.java
Mon Apr  6 19:00:03 2015
@@ -0,0 +1,43 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiplexedPurgeExecutor
+    implements ContinuumPurgeExecutor
+{
+    private List<ContinuumPurgeExecutor> constituents;
+
+    public MultiplexedPurgeExecutor( ContinuumPurgeExecutor... executors )
+    {
+        constituents = Arrays.asList( executors );
+    }
+
+    public void purge( String path )
+        throws ContinuumPurgeExecutorException
+    {
+        for ( ContinuumPurgeExecutor child : constituents )
+        {
+            child.purge( path );
+        }
+    }
+}

Added: continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactory.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactory.java?rev=1671648&view=auto
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactory.java
(added)
+++ continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactory.java
Mon Apr  6 19:00:03 2015
@@ -0,0 +1,28 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import org.apache.continuum.purge.repository.content.RepositoryManagedContent;
+
+public interface RepositoryPurgeExecutorFactory
+{
+    ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount, boolean
deleteReleasedSnapshots,
+                                   RepositoryManagedContent repoContent );
+}

Added: continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactoryImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactoryImpl.java?rev=1671648&view=auto
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactoryImpl.java
(added)
+++ continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/RepositoryPurgeExecutorFactoryImpl.java
Mon Apr  6 19:00:03 2015
@@ -0,0 +1,61 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import org.apache.continuum.purge.ContinuumPurgeConstants;
+import org.apache.continuum.purge.repository.content.RepositoryManagedContent;
+import org.apache.continuum.purge.repository.scanner.RepositoryScanner;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+@Component( role = RepositoryPurgeExecutorFactory.class )
+public class RepositoryPurgeExecutorFactoryImpl
+    implements RepositoryPurgeExecutorFactory
+{
+    @Requirement( hint = "purge" )
+    private RepositoryScanner scanner;
+
+    public ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount,
+                                          boolean deleteReleasedSnapshots, RepositoryManagedContent
repoContent )
+    {
+        if ( deleteAll )
+        {
+            return new CleanAllPurgeExecutor( ContinuumPurgeConstants.PURGE_REPOSITORY );
+        }
+
+        ContinuumPurgeExecutor executor;
+        if ( daysOld > 0 )
+        {
+            executor = new DaysOldRepositoryPurgeExecutor( repoContent, daysOld, retentionCount
);
+        }
+        else
+        {
+            executor = new RetentionCountRepositoryPurgeExecutor( repoContent, retentionCount
);
+        }
+
+        if ( deleteReleasedSnapshots )
+        {
+            ContinuumPurgeExecutor snapshots = new ReleasedSnapshotsRepositoryPurgeExecutor(
repoContent );
+            executor = new MultiplexedPurgeExecutor( snapshots, executor );
+        }
+
+        return new ScanningPurgeExecutor( scanner, executor );
+    }
+}

Added: continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/ScanningPurgeExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/ScanningPurgeExecutor.java?rev=1671648&view=auto
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/ScanningPurgeExecutor.java
(added)
+++ continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/executor/ScanningPurgeExecutor.java
Mon Apr  6 19:00:03 2015
@@ -0,0 +1,61 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import org.apache.continuum.purge.repository.scanner.RepositoryScanner;
+import org.apache.continuum.purge.repository.scanner.ScannerHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+
+public class ScanningPurgeExecutor
+    implements ContinuumPurgeExecutor, ScannerHandler
+{
+    private static final Logger log = LoggerFactory.getLogger( ScanningPurgeExecutor.class
);
+
+    private RepositoryScanner scanner;
+
+    private ContinuumPurgeExecutor executor;
+
+    public ScanningPurgeExecutor( RepositoryScanner scanner, ContinuumPurgeExecutor executor
)
+    {
+        this.scanner = scanner;
+        this.executor = executor;
+    }
+
+    public void purge( String path )
+        throws ContinuumPurgeExecutorException
+    {
+        scanner.scan( new File( path ), this );
+    }
+
+    public void handle( String path )
+    {
+        try
+        {
+            executor.purge( path );
+        }
+        catch ( ContinuumPurgeExecutorException e )
+        {
+            log.error( String.format( "handling failed %s: %s", path, e.getMessage() ), e
);
+        }
+    }
+}

Modified: continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/repository/scanner/DefaultRepositoryScanner.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/repository/scanner/DefaultRepositoryScanner.java?rev=1671648&r1=1671647&r2=1671648&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/repository/scanner/DefaultRepositoryScanner.java
(original)
+++ continuum/trunk/continuum-purge/continuum-purge-core/src/main/java/org/apache/continuum/purge/repository/scanner/DefaultRepositoryScanner.java
Mon Apr  6 19:00:03 2015
@@ -33,7 +33,7 @@ import java.util.List;
 /**
  * Codes were taken from Archiva and made some changes.
  */
-@Component( role = org.apache.continuum.purge.repository.scanner.RepositoryScanner.class,
hint = "repository-scanner" )
+@Component( role = RepositoryScanner.class, hint = "purge" )
 public class DefaultRepositoryScanner
     implements RepositoryScanner
 {

Modified: continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/DirectoryPurgeController.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/DirectoryPurgeController.java?rev=1671648&r1=1671647&r2=1671648&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/DirectoryPurgeController.java
(original)
+++ continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/DirectoryPurgeController.java
Mon Apr  6 19:00:03 2015
@@ -21,12 +21,11 @@ package org.apache.continuum.purge.contr
 
 import org.apache.continuum.model.repository.AbstractPurgeConfiguration;
 import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
-import org.apache.continuum.purge.executor.CleanAllPurgeExecutor;
 import org.apache.continuum.purge.executor.ContinuumPurgeExecutor;
 import org.apache.continuum.purge.executor.ContinuumPurgeExecutorException;
-import org.apache.continuum.purge.executor.DaysOldDirectoryPurgeExecutor;
-import org.apache.continuum.purge.executor.RetentionCountDirectoryPurgeExecutor;
+import org.apache.continuum.purge.executor.DirectoryPurgeExecutorFactory;
 import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,7 +40,8 @@ public class DirectoryPurgeController
 {
     private static final Logger log = LoggerFactory.getLogger( DirectoryPurgeController.class
);
 
-    private DirectoryPurgeExecutorFactory executorFactory = new DirectoryPurgeExecutorFactoryImpl();
+    @Requirement
+    private DirectoryPurgeExecutorFactory executorFactory;
 
     public void purge( AbstractPurgeConfiguration purgeConfig )
     {
@@ -63,26 +63,3 @@ public class DirectoryPurgeController
     }
 }
 
-interface DirectoryPurgeExecutorFactory
-{
-    ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount, String
dirType );
-}
-
-class DirectoryPurgeExecutorFactoryImpl
-    implements DirectoryPurgeExecutorFactory
-{
-    public ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount,
String dirType )
-    {
-        if ( deleteAll )
-        {
-            return new CleanAllPurgeExecutor( dirType );
-        }
-
-        if ( daysOld > 0 )
-        {
-            return new DaysOldDirectoryPurgeExecutor( daysOld, retentionCount, dirType );
-        }
-
-        return new RetentionCountDirectoryPurgeExecutor( retentionCount, dirType );
-    }
-}

Modified: continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/RepositoryPurgeController.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/RepositoryPurgeController.java?rev=1671648&r1=1671647&r2=1671648&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/RepositoryPurgeController.java
(original)
+++ continuum/trunk/continuum-purge/continuum-purge-master/src/main/java/org/apache/continuum/purge/controller/RepositoryPurgeController.java
Mon Apr  6 19:00:03 2015
@@ -21,27 +21,17 @@ package org.apache.continuum.purge.contr
 
 import org.apache.continuum.model.repository.AbstractPurgeConfiguration;
 import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
-import org.apache.continuum.purge.ContinuumPurgeConstants;
 import org.apache.continuum.purge.PurgeConfigurationService;
 import org.apache.continuum.purge.PurgeConfigurationServiceException;
-import org.apache.continuum.purge.executor.CleanAllPurgeExecutor;
 import org.apache.continuum.purge.executor.ContinuumPurgeExecutor;
 import org.apache.continuum.purge.executor.ContinuumPurgeExecutorException;
-import org.apache.continuum.purge.executor.DaysOldRepositoryPurgeExecutor;
-import org.apache.continuum.purge.executor.ReleasedSnapshotsRepositoryPurgeExecutor;
-import org.apache.continuum.purge.executor.RetentionCountRepositoryPurgeExecutor;
+import org.apache.continuum.purge.executor.RepositoryPurgeExecutorFactory;
 import org.apache.continuum.purge.repository.content.RepositoryManagedContent;
-import org.apache.continuum.purge.repository.scanner.RepositoryScanner;
-import org.apache.continuum.purge.repository.scanner.ScannerHandler;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-
 /**
  * DefaultPurgeController
  *
@@ -56,8 +46,8 @@ public class RepositoryPurgeController
     @Requirement
     private PurgeConfigurationService purgeConfigurationService;
 
-    @Requirement( hint = "repository-scanner" )
-    private RepositoryScanner scanner;
+    @Requirement
+    private RepositoryPurgeExecutorFactory executorFactory;
 
     public void purge( AbstractPurgeConfiguration purgeConfig )
     {
@@ -66,9 +56,10 @@ public class RepositoryPurgeController
         {
             String path = config.getRepository().getLocation();
             RepositoryManagedContent repositoryContent = getManagedContent( config.getRepository().getId()
);
-            ContinuumPurgeExecutor executor = new RepositoryPurgeExecutorFactoryImpl( scanner
)
-                .create( config.isDeleteAll(), config.getDaysOlder(), config.getRetentionCount(),
-                         config.isDeleteReleasedSnapshots(), repositoryContent );
+            ContinuumPurgeExecutor executor = executorFactory.create( config.isDeleteAll(),
config.getDaysOlder(),
+                                                                      config.getRetentionCount(),
+                                                                      config.isDeleteReleasedSnapshots(),
+                                                                      repositoryContent );
             log.info( "purging repository '{}'", path );
             executor.purge( path );
             log.info( "purge complete '{}'", path );
@@ -93,100 +84,3 @@ public class RepositoryPurgeController
     }
 }
 
-interface RepositoryPurgeExecutorFactory
-{
-    ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount, boolean
deleteReleasedSnapshots,
-                                   RepositoryManagedContent repoContent );
-}
-
-class MultiplexedPurgeExecutor
-    implements ContinuumPurgeExecutor
-{
-    List<ContinuumPurgeExecutor> constituents;
-
-    public MultiplexedPurgeExecutor( ContinuumPurgeExecutor... executors )
-    {
-        constituents = Arrays.asList( executors );
-    }
-
-    public void purge( String path )
-        throws ContinuumPurgeExecutorException
-    {
-        for ( ContinuumPurgeExecutor child : constituents )
-        {
-            child.purge( path );
-        }
-    }
-}
-
-class ScanningPurgeExecutor
-    implements ContinuumPurgeExecutor, ScannerHandler
-{
-    private static final Logger log = LoggerFactory.getLogger( ScanningPurgeExecutor.class
);
-
-    RepositoryScanner scanner;
-
-    ContinuumPurgeExecutor executor;
-
-    public ScanningPurgeExecutor( RepositoryScanner scanner, ContinuumPurgeExecutor executor
)
-    {
-        this.scanner = scanner;
-        this.executor = executor;
-    }
-
-    public void purge( String path )
-        throws ContinuumPurgeExecutorException
-    {
-        scanner.scan( new File( path ), this );
-    }
-
-    public void handle( String path )
-    {
-        try
-        {
-            executor.purge( path );
-        }
-        catch ( ContinuumPurgeExecutorException e )
-        {
-            log.error( String.format( "handling failed %s: %s", path, e.getMessage() ), e
);
-        }
-    }
-}
-
-class RepositoryPurgeExecutorFactoryImpl
-    implements RepositoryPurgeExecutorFactory
-{
-    RepositoryScanner scanner;
-
-    public RepositoryPurgeExecutorFactoryImpl( RepositoryScanner scanner )
-    {
-        this.scanner = scanner;
-    }
-
-    public ContinuumPurgeExecutor create( boolean deleteAll, int daysOld, int retentionCount,
-                                          boolean deleteReleasedSnapshots, RepositoryManagedContent
repoContent )
-    {
-        if ( deleteAll )
-        {
-            return new CleanAllPurgeExecutor( ContinuumPurgeConstants.PURGE_REPOSITORY );
-        }
-
-        ContinuumPurgeExecutor executor;
-        if ( daysOld > 0 )
-        {
-            executor = new DaysOldRepositoryPurgeExecutor( repoContent, daysOld, retentionCount
);
-        }
-        else
-        {
-            executor = new RetentionCountRepositoryPurgeExecutor( repoContent, retentionCount
);
-        }
-
-        if ( deleteReleasedSnapshots )
-        {
-            ContinuumPurgeExecutor snapshots = new ReleasedSnapshotsRepositoryPurgeExecutor(
repoContent );
-            executor = new MultiplexedPurgeExecutor( snapshots, executor );
-        }
-
-        return new ScanningPurgeExecutor( scanner, executor );
-    }
-}
\ No newline at end of file



Mime
View raw message