public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
throws ConsumerException
- {
+ {
this.repository = repository;
managedRepository = new File( repository.getLocation() );
File indexDirectory = new File( managedRepository, ".indexer" );
throws ConsumerException
{
File artifactFile = new File( managedRepository, path );
-
+
ArtifactContext artifactContext = artifactContextProducer.getArtifactContext( context, artifactFile );
if ( artifactContext != null )
{
try
{
- indexer.artifactDiscovered( artifactContext, context );
-
+ //indexer.artifactDiscovered( artifactContext, context );
+
indexerEngine.index( context, artifactContext );
}
catch ( IOException e )
}
public void completeScan()
- {
+ {
final File indexLocation = new File( managedRepository, ".index" );
try
{
- indexPacker.packIndex( context, indexLocation );
indexerEngine.endIndexing( context );
+
+ indexPacker.packIndex( context, indexLocation );
}
catch ( IOException e )
{
ArtifactInfo artifactInfo = (ArtifactInfo) results.iterator().next();
assertEquals( "org.apache.archiva", artifactInfo.groupId );
assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId );
- assertEquals( "test-repo", artifactInfo.repository );
+ assertEquals( "test-repo", artifactInfo.repository );
+ }
+
+ public void testIndexerArtifactAlreadyIndexed()
+ throws Exception
+ {
+
}
/*public void testIndexerIndexPom()
--- /dev/null
+package org.apache.archiva.repository.scanner.functors;
+
+/*
+ * 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.commons.collections.Closure;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * TriggerScanCompletedClosure
+ */
+public class TriggerScanCompletedClosure
+ implements Closure
+{
+ private Logger log = LoggerFactory.getLogger( TriggerScanCompletedClosure.class );
+
+ private final ManagedRepositoryConfiguration repository;
+
+ public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository )
+ {
+ this.repository = repository;
+ }
+
+ public void execute( Object input )
+ {
+ if ( input instanceof RepositoryContentConsumer )
+ {
+ RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
+ consumer.completeScan();
+ log.info( "Consumer [" + consumer.getId() + "] completed for repository [" + repository.getId() + "]" );
+ }
+ }
+}
import java.util.List;
import java.util.Map;
+import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
import org.apache.commons.collections.Closure;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.functors.IfClosure;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerWantsFilePredicate;
import org.apache.maven.archiva.repository.scanner.functors.TriggerBeginScanClosure;
-import org.apache.maven.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import java.util.Date;
import java.util.List;
+import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
import org.apache.commons.collections.Closure;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.functors.IfClosure;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerWantsFilePredicate;
import org.apache.maven.archiva.repository.scanner.functors.TriggerBeginScanClosure;
-import org.apache.maven.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
import org.codehaus.plexus.util.DirectoryWalkListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
{
consumerWantsFile.setCaseSensitive( false );
}
-
- TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure(repository);
-
- CollectionUtils.forAllDo(knownConsumers, scanCompletedClosure);
- CollectionUtils.forAllDo(invalidConsumerList, scanCompletedClosure);
}
public RepositoryScannerInstance( ManagedRepositoryConfiguration repository,
public void directoryWalkFinished()
{
+ TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure(repository);
+
+ CollectionUtils.forAllDo( knownConsumers, scanCompletedClosure );
+ CollectionUtils.forAllDo( invalidConsumers, scanCompletedClosure );
+
log.info( "Walk Finished: [" + this.repository.getId() + "] " + this.repository.getLocation() );
stats.triggerFinished();
}
+++ /dev/null
-/*
- * Copyright 2008 jdumay.
- *
- * 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.
- * under the License.
- */
-
-package org.apache.maven.archiva.repository.scanner.functors;
-
-import org.apache.commons.collections.Closure;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TriggerScanCompletedClosure implements Closure
-{
- private Logger log = LoggerFactory.getLogger( TriggerScanCompletedClosure.class );
-
- private final ManagedRepositoryConfiguration repository;
-
- public TriggerScanCompletedClosure(ManagedRepositoryConfiguration repository)
- {
- this.repository = repository;
- }
-
- public void execute(Object input)
- {
- if ( input instanceof RepositoryContentConsumer )
- {
- RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
- consumer.completeScan();
- log.info( "Consumer [" + consumer.getId() + "] completed for repository [" + repository.getId() + "]");
- }
- }
-}