Return-Path: X-Original-To: apmail-archiva-commits-archive@www.apache.org Delivered-To: apmail-archiva-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B004AD4E0 for ; Wed, 29 Aug 2012 15:39:13 +0000 (UTC) Received: (qmail 10952 invoked by uid 500); 29 Aug 2012 15:39:13 -0000 Delivered-To: apmail-archiva-commits-archive@archiva.apache.org Received: (qmail 10924 invoked by uid 500); 29 Aug 2012 15:39:13 -0000 Mailing-List: contact commits-help@archiva.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@archiva.apache.org Delivered-To: mailing list commits@archiva.apache.org Received: (qmail 10917 invoked by uid 99); 29 Aug 2012 15:39:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Aug 2012 15:39:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Aug 2012 15:39:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D7F0A2388C70 for ; Wed, 29 Aug 2012 15:37:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1378611 [23/25] - in /archiva/site-content/redback/components: ./ expression-evaluator/ redback-components/ spring-apacheds/ spring-cache/ spring-jdo2/ spring-quartz/ spring-registry/ spring-taskqueue/ spring-utils/ xref-test/ xref-test/or... Date: Wed, 29 Aug 2012 15:37:11 -0000 To: commits@archiva.apache.org From: olamy@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120829153721.D7F0A2388C70@eris.apache.org> Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/ComponentContainer.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/ComponentContainer.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/ComponentContainer.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/ComponentContainer.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,223 @@ + + + + +ComponentContainer xref + + + +
+
+1   package org.apache.archiva.redback.components.springutils;
+2   
+3   /*
+4    * Licensed to the Apache Software Foundation (ASF) under one
+5    * or more contributor license agreements.  See the NOTICE file
+6    * distributed with this work for additional information
+7    * regarding copyright ownership.  The ASF licenses this file
+8    * to you under the Apache License, Version 2.0 (the
+9    * "License"); you may not use this file except in compliance
+10   * with the License.  You may obtain a copy of the License at
+11   *
+12   *  http://www.apache.org/licenses/LICENSE-2.0
+13   *
+14   * Unless required by applicable law or agreed to in writing,
+15   * software distributed under the License is distributed on an
+16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+17   * KIND, either express or implied.  See the License for the
+18   * specific language governing permissions and limitations
+19   * under the License.
+20   */
+21  
+22  import org.apache.commons.lang.StringUtils;
+23  import org.slf4j.Logger;
+24  import org.slf4j.LoggerFactory;
+25  import org.springframework.context.ApplicationContext;
+26  import org.springframework.stereotype.Service;
+27  
+28  import javax.inject.Inject;
+29  import java.util.Collections;
+30  import java.util.HashMap;
+31  import java.util.Map;
+32  import java.util.concurrent.ConcurrentHashMap;
+33  
+34  /**
+35   * utility class to mimic some behaviour of the plexus container with role#hint
+36   * @author Olivier Lamy
+37   */
+38  @Service( "componentContainer" )
+39  public class ComponentContainer
+40  {
+41  
+42      private Logger log = LoggerFactory.getLogger( getClass() );
+43  
+44      private static final String DEFAULT_ROLE_HINT = "default";
+45  
+46      public static final String BEAN_NAME_ROLEHINTSEPARATOR = "#";
+47  
+48      /**
+49       * To prevent to much use of #buildMapWithRole we store already used values here
+50       *
+51       * @see #buildMapWithRole(Class)
+52       */
+53      private Map<String, Map<String, ?>> classBeansOfType = new ConcurrentHashMap<String, Map<String, ?>>();
+54  
+55      public String getDefaultRoleHint()
+56      {
+57          return DEFAULT_ROLE_HINT;
+58      }
+59  
+60      @Inject
+61      protected ApplicationContext applicationContext;
+62  
+63      /**
+64       * <b>must be used only at startup of container (ie in initialize method as it
+65       * can cause performance issue http://jira.springframework.org/browse/SPR-5360</b><br/>
+66       * Returns bean of type T. <br/>
+67       * <b>It must be unique of not {@link RuntimeException}</b>
+68       *
+69       * @param <T>
+70       * @param clazz
+71       * @return
+72       */
+73      public <T> T getComponent( Class<T> clazz )
+74      {
+75          Map<String, T> beansOfType = applicationContext.getBeansOfType( clazz );
+76          if ( beansOfType == null || beansOfType.isEmpty() )
+77          {
+78              throw new RuntimeException( "no beans of Type " + clazz.getName() );
+79          }
+80          if ( beansOfType.size() > 1 )
+81          {
+82              throw new RuntimeException( "not only one beans of Type " + clazz.getName() );
+83          }
+84          return beansOfType.values().iterator().next();
+85      }
+86  
+87      /**
+88       * <b>must be used only at startup of container (ie in initialize method as it
+89       * can cause performance issue http://jira.springframework.org/browse/SPR-5360</b><br/>
+90       * Returns bean of type T and hint . <br/>
+91       *
+92       * @param <T>
+93       * @param clazz
+94       * @param hint
+95       * @return
+96       */
+97      public <T> T getComponent( Class<T> clazz, String hint )
+98      {
+99          Map<String, T> beansOfType = buildMapWithRole( clazz );
+100         if ( beansOfType == null || beansOfType.isEmpty() )
+101         {
+102             throw new RuntimeException( "no beans of Type " + clazz.getName() );
+103         }
+104         T bean = beansOfType.get( hint );
+105         if ( bean == null )
+106         {
+107             throw new RuntimeException( "no beans of Type " + clazz.getName() + " with hint " + hint );
+108         }
+109         return bean;
+110     }
+111 
+112     /**
+113      * Return true if one and only bean of type T exists.
+114      *
+115      * @param <T>
+116      * @param clazz
+117      * @return
+118      */
+119     public <T> boolean hasComponent( Class<T> clazz )
+120     {
+121         Map<String, T> beansOfType = applicationContext.getBeansOfType( clazz );
+122         if ( beansOfType == null || beansOfType.isEmpty() )
+123         {
+124             return false;
+125         }
+126         return beansOfType.size() == 1;
+127     }
+128 
+129     /**
+130      * Return true if one and only bean of type T and hint exists.
+131      *
+132      * @param <T>
+133      * @param clazz
+134      * @param hint
+135      * @return
+136      */
+137     public <T> boolean hasComponent( Class<T> clazz, String hint )
+138     {
+139         Map<String, T> beansOfType = buildMapWithRole( clazz );
+140         if ( beansOfType == null || beansOfType.isEmpty() )
+141         {
+142             return false;
+143         }
+144         return beansOfType.containsKey( hint );
+145     }
+146 
+147     /**
+148      * <b>must be used only at startup of container (ie in initialize method as it
+149      * can cause performance issue http://jira.springframework.org/browse/SPR-5360</b><br/>
+150      * Produce a map with hint as key and bean as value.<br/>
+151      * An internal map is used to cache call to #buildMapWithRole
+152      *
+153      * @param <T>
+154      * @param clazz
+155      * @return
+156      */
+157     @SuppressWarnings( "unchecked" )
+158     public <T> Map<String, T> buildMapWithRole( Class<T> clazz )
+159     {
+160         try
+161         {
+162             Map<String, T> beansOfType = (Map<String, T>) classBeansOfType.get( clazz.getName() );
+163             if ( beansOfType == null )
+164             {
+165                 Map<String, T> map = this.applicationContext.getBeansOfType( clazz );
+166                 beansOfType = buildMapWithRole( map );
+167                 classBeansOfType.put( clazz.getName(), beansOfType );
+168             }
+169             return beansOfType;
+170         }
+171         catch ( Throwable e )
+172         {
+173             log.error( e.getMessage(), e );
+174             throw new RuntimeException( e.getMessage(), e );
+175         }
+176     }
+177 
+178 
+179     /**
+180      * Mimic of lookupMap from plexus. <br/>
+181      * Ex: if the bean is called "foo#mine" "AvlRqBuilder#1"A
+182      * then the map will contains mine as key with the bean foo#mine as value </b>
+183      * <b>if no # in the bean name then the bean name will be as it's returned</b>.
+184      *
+185      * @param beansOfType
+186      * @return
+187      */
+188     public static <T> Map<String, T> buildMapWithRole( Map<String, T> beansOfType )
+189     {
+190         if ( beansOfType == null || beansOfType.isEmpty() )
+191         {
+192             return Collections.emptyMap();
+193         }
+194         Map<String, T> beansOfHint = new HashMap<String, T>();
+195         for ( Map.Entry<String, T> entry : beansOfType.entrySet() )
+196         {
+197             int separatorIndex = StringUtils.indexOf( entry.getKey(), '#' );
+198             if ( separatorIndex >= 0 )
+199             {
+200                 String hint = entry.getKey().substring( separatorIndex + 1, entry.getKey().length() );
+201                 beansOfHint.put( hint, beansOfType.get( entry.getKey() ) );
+202             }
+203             else
+204             {
+205                 beansOfHint.put( entry.getKey(), beansOfType.get( entry.getKey() ) );
+206             }
+207         }
+208         return beansOfHint;
+209     }
+210 }
+
+
+ Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-frame.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-frame.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-frame.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-frame.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,33 @@ + + + + + + Apache Archiva Redback Components 2.0-SNAPSHOT Reference Package org.apache.archiva.redback.components.springutils + + + + +

+ org.apache.archiva.redback.components.springutils +

+ +

Classes

+ + + + + \ No newline at end of file Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-summary.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-summary.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-summary.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/package-summary.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,82 @@ + + + + + + Apache Archiva Redback Components 2.0-SNAPSHOT Reference Package org.apache.archiva.redback.components.springutils + + + +
+ +
+
+ +
+ +

Package org.apache.archiva.redback.components.springutils

+ + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ CachingByTypeBeanFactory +
+ CachingWebApplicationContext +
+ ComponentContainer +
+ TypeKey +
+ +
+ +
+
+ +
+
+ Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/PlexusShimComponent.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/PlexusShimComponent.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/PlexusShimComponent.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/PlexusShimComponent.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,105 @@ + + + + +PlexusShimComponent xref + + + +
+
+1   package org.apache.archiva.redback.components.springutils.plexusshim;
+2   
+3   /*
+4    * Licensed to the Apache Software Foundation (ASF) under one
+5    * or more contributor license agreements.  See the NOTICE file
+6    * distributed with this work for additional information
+7    * regarding copyright ownership.  The ASF licenses this file
+8    * to you under the Apache License, Version 2.0 (the
+9    * "License"); you may not use this file except in compliance
+10   * with the License.  You may obtain a copy of the License at
+11   *
+12   *  http://www.apache.org/licenses/LICENSE-2.0
+13   *
+14   * Unless required by applicable law or agreed to in writing,
+15   * software distributed under the License is distributed on an
+16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+17   * KIND, either express or implied.  See the License for the
+18   * specific language governing permissions and limitations
+19   * under the License.
+20   */
+21  
+22  import org.codehaus.plexus.DefaultContainerConfiguration;
+23  import org.codehaus.plexus.DefaultPlexusContainer;
+24  import org.codehaus.plexus.PlexusConstants;
+25  import org.codehaus.plexus.PlexusContainerException;
+26  import org.codehaus.plexus.classworlds.ClassWorld;
+27  import org.codehaus.plexus.classworlds.realm.ClassRealm;
+28  import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+29  
+30  import java.net.URL;
+31  import java.util.List;
+32  
+33  /**
+34   * Simple component which will initiate the plexus shim component
+35   * to see plexus components inside a guice container.<br/>
+36   * So move all of this here to be able to change quickly if needed.
+37   *
+38   * @author Olivier Lamy
+39   */
+40  public class PlexusShimComponent
+41  {
+42  
+43      private boolean containerAutoWiring = false;
+44  
+45      private String containerClassPathScanning = PlexusConstants.SCANNING_OFF;
+46  
+47      private String containerComponentVisibility = PlexusConstants.REALM_VISIBILITY;
+48  
+49      private URL overridingComponentsXml;
+50  
+51      private DefaultPlexusContainer plexusContainer;
+52  
+53  
+54      public void initialize()
+55          throws PlexusContainerException
+56      {
+57          DefaultContainerConfiguration conf = new DefaultContainerConfiguration();
+58  
+59          conf.setAutoWiring( containerAutoWiring );
+60          conf.setClassPathScanning( containerClassPathScanning );
+61          conf.setComponentVisibility( containerComponentVisibility );
+62  
+63          conf.setContainerConfigurationURL( overridingComponentsXml );
+64  
+65          ClassWorld classWorld = new ClassWorld();
+66  
+67          ClassRealm classRealm = new ClassRealm( classWorld, "maven", Thread.currentThread().getContextClassLoader() );
+68          conf.setRealm( classRealm );
+69  
+70          conf.setClassWorld( classWorld );
+71  
+72          plexusContainer = new DefaultPlexusContainer( conf );
+73      }
+74  
+75      public <T> T lookup( Class<T> clazz )
+76          throws ComponentLookupException
+77      {
+78          return plexusContainer.lookup( clazz );
+79      }
+80  
+81      public <T> T lookup( Class<T> clazz, String hint )
+82          throws ComponentLookupException
+83      {
+84          return plexusContainer.lookup( clazz, hint );
+85      }
+86  
+87      public <T> List<T> lookupList( Class<T> clazz )
+88          throws ComponentLookupException
+89      {
+90          return plexusContainer.lookupList( clazz );
+91      }
+92  }
+
+
+ Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-frame.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-frame.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-frame.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-frame.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,24 @@ + + + + + + Apache Archiva Redback Components 2.0-SNAPSHOT Reference Package org.apache.archiva.redback.components.springutils.plexusshim + + + + +

+ org.apache.archiva.redback.components.springutils.plexusshim +

+ +

Classes

+ + + + + \ No newline at end of file Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-summary.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-summary.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-summary.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/springutils/plexusshim/package-summary.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,67 @@ + + + + + + Apache Archiva Redback Components 2.0-SNAPSHOT Reference Package org.apache.archiva.redback.components.springutils.plexusshim + + + +
+ +
+
+ +
+ +

Package org.apache.archiva.redback.components.springutils.plexusshim

+ + + + + + + + + + + + +
Class Summary
+ PlexusShimComponent +
+ +
+ +
+
+ +
+
+ Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/DefaultTaskQueue.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/DefaultTaskQueue.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/DefaultTaskQueue.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/DefaultTaskQueue.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,229 @@ + + + + +DefaultTaskQueue xref + + + +
+
+1   package org.apache.archiva.redback.components.taskqueue;
+2   
+3   /*
+4    * Licensed to the Apache Software Foundation (ASF) under one
+5    * or more contributor license agreements.  See the NOTICE file
+6    * distributed with this work for additional information
+7    * regarding copyright ownership.  The ASF licenses this file
+8    * to you under the Apache License, Version 2.0 (the
+9    * "License"); you may not use this file except in compliance
+10   * with the License.  You may obtain a copy of the License at
+11   *
+12   *  http://www.apache.org/licenses/LICENSE-2.0
+13   *
+14   * Unless required by applicable law or agreed to in writing,
+15   * software distributed under the License is distributed on an
+16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+17   * KIND, either express or implied.  See the License for the
+18   * specific language governing permissions and limitations
+19   * under the License.
+20   */
+21  
+22  import org.slf4j.Logger;
+23  import org.slf4j.LoggerFactory;
+24  
+25  import java.util.ArrayList;
+26  import java.util.Collection;
+27  import java.util.Collections;
+28  import java.util.Iterator;
+29  import java.util.List;
+30  import java.util.concurrent.BlockingQueue;
+31  import java.util.concurrent.LinkedBlockingQueue;
+32  import java.util.concurrent.TimeUnit;
+33  
+34  
+35  /**
+36   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+37   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+38   *
+39   */
+40  public class DefaultTaskQueue
+41      implements TaskQueue
+42  {
+43  
+44      private Logger logger = LoggerFactory.getLogger( getClass() );
+45  
+46      private List<TaskEntryEvaluator> taskEntryEvaluators = new ArrayList<TaskEntryEvaluator>();
+47  
+48      private List<TaskExitEvaluator> taskExitEvaluators = new ArrayList<TaskExitEvaluator>();
+49  
+50      private List<TaskViabilityEvaluator> taskViabilityEvaluators = new ArrayList<TaskViabilityEvaluator>();
+51  
+52      private BlockingQueue<Task> queue = new LinkedBlockingQueue<Task>();
+53  
+54      // ----------------------------------------------------------------------
+55      // Component Lifecycle
+56      // ----------------------------------------------------------------------
+57  
+58      // ----------------------------------------------------------------------
+59      // TaskQueue Implementation
+60      // ----------------------------------------------------------------------
+61  
+62      // ----------------------------------------------------------------------
+63      // Queue operations
+64      // ----------------------------------------------------------------------
+65  
+66      public boolean put( Task task )
+67          throws TaskQueueException
+68      {
+69          // ----------------------------------------------------------------------
+70          // Check that all the task entry evaluators accepts the task
+71          // ----------------------------------------------------------------------
+72  
+73          for ( TaskEntryEvaluator taskEntryEvaluator : taskEntryEvaluators )
+74          {
+75              boolean result = taskEntryEvaluator.evaluate( task );
+76  
+77              if ( !result )
+78              {
+79                  return false;
+80              }
+81          }
+82  
+83          // ----------------------------------------------------------------------
+84          // The task was accepted, enqueue it
+85          // ----------------------------------------------------------------------
+86  
+87          enqueue( task );
+88  
+89          // ----------------------------------------------------------------------
+90          // Check that all the task viability evaluators accepts the task
+91          // ----------------------------------------------------------------------
+92  
+93          for ( TaskViabilityEvaluator taskViabilityEvaluator : taskViabilityEvaluators )
+94          {
+95              Collection<Task> toBeRemoved =
+96                  taskViabilityEvaluator.evaluate( Collections.unmodifiableCollection( queue ) );
+97  
+98              for ( Iterator<Task> it2 = toBeRemoved.iterator(); it2.hasNext(); )
+99              {
+100                 Task t = it2.next();
+101 
+102                 queue.remove( t );
+103             }
+104         }
+105 
+106         return true;
+107     }
+108 
+109     public Task take()
+110         throws TaskQueueException
+111     {
+112         logger.debug( "take" );
+113         while ( true )
+114         {
+115             Task task = dequeue();
+116 
+117             if ( task == null )
+118             {
+119                 return null;
+120             }
+121 
+122             for ( TaskExitEvaluator taskExitEvaluator : taskExitEvaluators )
+123             {
+124                 boolean result = taskExitEvaluator.evaluate( task );
+125 
+126                 if ( !result )
+127                 {
+128                     // the task wasn't accepted; drop it.
+129                     task = null;
+130 
+131                     break;
+132                 }
+133             }
+134 
+135             if ( task != null )
+136             {
+137                 return task;
+138             }
+139         }
+140     }
+141 
+142     public Task poll( int timeout, TimeUnit timeUnit )
+143         throws InterruptedException
+144     {
+145         logger.debug( "pool" );
+146         return queue.poll( timeout, timeUnit );
+147     }
+148 
+149     public boolean remove( Task task )
+150         throws ClassCastException, NullPointerException
+151     {
+152         return queue.remove( task );
+153     }
+154 
+155     public boolean removeAll( List tasks )
+156         throws ClassCastException, NullPointerException
+157     {
+158         return queue.removeAll( tasks );
+159     }
+160 
+161     // ----------------------------------------------------------------------
+162     // Queue Inspection
+163     // ----------------------------------------------------------------------
+164 
+165     public List<Task> getQueueSnapshot()
+166         throws TaskQueueException
+167     {
+168         return Collections.unmodifiableList( new ArrayList( queue ) );
+169     }
+170 
+171     // ----------------------------------------------------------------------
+172     // Queue Management
+173     // ----------------------------------------------------------------------
+174 
+175     private void enqueue( Task task )
+176     {
+177         boolean success = queue.add( task );
+178         logger.debug( "enqueue success {}", success );
+179     }
+180 
+181     private Task dequeue()
+182     {
+183         logger.debug( "dequeue" );
+184         return queue.poll();
+185     }
+186 
+187     public List<TaskEntryEvaluator> getTaskEntryEvaluators()
+188     {
+189         return taskEntryEvaluators;
+190     }
+191 
+192     public void setTaskEntryEvaluators( List<TaskEntryEvaluator> taskEntryEvaluators )
+193     {
+194         this.taskEntryEvaluators = taskEntryEvaluators;
+195     }
+196 
+197     public List<TaskExitEvaluator> getTaskExitEvaluators()
+198     {
+199         return taskExitEvaluators;
+200     }
+201 
+202     public void setTaskExitEvaluators( List<TaskExitEvaluator> taskExitEvaluators )
+203     {
+204         this.taskExitEvaluators = taskExitEvaluators;
+205     }
+206 
+207     public List<TaskViabilityEvaluator> getTaskViabilityEvaluators()
+208     {
+209         return taskViabilityEvaluators;
+210     }
+211 
+212     public void setTaskViabilityEvaluators( List<TaskViabilityEvaluator> taskViabilityEvaluators )
+213     {
+214         this.taskViabilityEvaluators = taskViabilityEvaluators;
+215     }
+216 }
+
+
+ Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/Task.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/Task.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/Task.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/Task.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,46 @@ + + + + +Task xref + + + +
+
+1   package org.apache.archiva.redback.components.taskqueue;
+2   
+3   /*
+4    * Licensed to the Apache Software Foundation (ASF) under one
+5    * or more contributor license agreements.  See the NOTICE file
+6    * distributed with this work for additional information
+7    * regarding copyright ownership.  The ASF licenses this file
+8    * to you under the Apache License, Version 2.0 (the
+9    * "License"); you may not use this file except in compliance
+10   * with the License.  You may obtain a copy of the License at
+11   *
+12   *  http://www.apache.org/licenses/LICENSE-2.0
+13   *
+14   * Unless required by applicable law or agreed to in writing,
+15   * software distributed under the License is distributed on an
+16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+17   * KIND, either express or implied.  See the License for the
+18   * specific language governing permissions and limitations
+19   * under the License.
+20   */
+21  
+22  /**
+23   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+24   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+25   *
+26   */
+27  public interface Task
+28  {
+29      /**
+30       * @return the maximum time in milliseconds this task may run before it's cancelled.
+31       */
+32      long getMaxExecutionTime();
+33  }
+
+
+ Added: archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/TaskEntryEvaluator.html URL: http://svn.apache.org/viewvc/archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/TaskEntryEvaluator.html?rev=1378611&view=auto ============================================================================== --- archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/TaskEntryEvaluator.html (added) +++ archiva/site-content/redback/components/xref/org/apache/archiva/redback/components/taskqueue/TaskEntryEvaluator.html Wed Aug 29 15:37:03 2012 @@ -0,0 +1,44 @@ + + + + +TaskEntryEvaluator xref + + + +
+
+1   package org.apache.archiva.redback.components.taskqueue;
+2   
+3   /*
+4    * Licensed to the Apache Software Foundation (ASF) under one
+5    * or more contributor license agreements.  See the NOTICE file
+6    * distributed with this work for additional information
+7    * regarding copyright ownership.  The ASF licenses this file
+8    * to you under the Apache License, Version 2.0 (the
+9    * "License"); you may not use this file except in compliance
+10   * with the License.  You may obtain a copy of the License at
+11   *
+12   *  http://www.apache.org/licenses/LICENSE-2.0
+13   *
+14   * Unless required by applicable law or agreed to in writing,
+15   * software distributed under the License is distributed on an
+16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+17   * KIND, either express or implied.  See the License for the
+18   * specific language governing permissions and limitations
+19   * under the License.
+20   */
+21  
+22  /**
+23   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+24   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+25   *
+26   */
+27  public interface TaskEntryEvaluator
+28  {
+29      boolean evaluate( Task task )
+30          throws TaskQueueException;
+31  }
+
+
+