aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-consumer-api
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-03-16 22:45:38 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-03-16 22:45:38 +0000
commit3331e0fd83fc47647187c82bdff211248856f670 (patch)
tree29cea9c58332dd1a7c5e7af4192aa7c96aa28e6a /archiva-consumer-api
parentf5da04241399259534e7a02cdabc8bf3c5e7d66d (diff)
downloadarchiva-3331e0fd83fc47647187c82bdff211248856f670.tar.gz
archiva-3331e0fd83fc47647187c82bdff211248856f670.zip
More Work Against Scanner / Layout / Artifact / Database
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@519169 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-consumer-api')
-rw-r--r--archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractConsumer.java3
-rw-r--r--archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/Consumer.java91
-rw-r--r--archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java52
-rw-r--r--archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerFactory.java70
-rw-r--r--archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericArtifactConsumer.java4
-rw-r--r--archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericModelConsumer.java2
-rw-r--r--archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericRepositoryMetadataConsumer.java2
-rw-r--r--archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java2
-rw-r--r--archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java2
-rw-r--r--archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java2
-rw-r--r--archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java3
11 files changed, 15 insertions, 218 deletions
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractConsumer.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractConsumer.java
index 200844a11..1b6915c93 100644
--- a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractConsumer.java
+++ b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractConsumer.java
@@ -19,7 +19,8 @@ package org.apache.maven.archiva.consumers;
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.consumer.Consumer;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.codehaus.plexus.logging.AbstractLogEnabled;
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/Consumer.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/Consumer.java
deleted file mode 100644
index 2ed0f1b72..000000000
--- a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/Consumer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.apache.maven.archiva.consumers;
-
-/*
- * 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.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-
-import java.util.List;
-
-/**
- * DiscovererConsumer
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface Consumer
-{
- public static final String ROLE = Consumer.class.getName();
-
- /**
- * This is the human readable name for the discoverer.
- *
- * @return the human readable discoverer name.
- */
- public String getName();
-
- /**
- * This is used to initialize any internals in the consumer before it is used.
- *
- * This method is called by the internals of archiva and is not meant to be used by other developers.
- * This method is called once per repository.
- *
- * @param repository the repository to initialize the consumer against.
- * @return true if the repository is valid for this consumer. false will result in consumer being disabled
- * for the provided repository.
- */
- public boolean init( ArchivaRepository repository );
-
- /**
- * Get the List of excluded file patterns for this consumer.
- *
- * @return the list of excluded file patterns for this consumer.
- */
- public List getExcludePatterns();
-
- /**
- * Get the List of included file patterns for this consumer.
- *
- * @return the list of included file patterns for this consumer.
- */
- public List getIncludePatterns();
-
- /**
- * Called by archiva framework to indicate that there is a file suitable for consuming,
- * This method will only be called if the {@link #init(ArtifactRepository)} and {@link #getExcludePatterns()}
- * and {@link #getIncludePatterns()} all pass for this consumer.
- *
- * @param file the file to process.
- * @throws ConsumerException if there was a problem processing this file.
- */
- public void processFile( BaseFile file ) throws ConsumerException;
-
- /**
- * Called by archiva framework to indicate that there has been a problem detected
- * on a specific file.
- *
- * NOTE: It is very possible for 1 file to have more than 1 problem associated with it.
- *
- * @param file the file to process.
- * @param message the message describing the problem.
- */
- public void processFileProblem( BaseFile file, String message );
-}
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java
deleted file mode 100644
index 790620b0c..000000000
--- a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.maven.archiva.consumers;
-
-/*
- * 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.maven.archiva.common.ArchivaException;
-import org.apache.maven.archiva.common.utils.BaseFile;
-
-/**
- * ConsumerException - details about the failure of a consumer.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ConsumerException
- extends ArchivaException
-{
- private BaseFile file;
-
- public ConsumerException( BaseFile file, String message, Throwable cause )
- {
- super( message, cause );
- this.file = file;
- }
-
- public ConsumerException( BaseFile file, String message )
- {
- super( message );
- this.file = file;
- }
-
- public BaseFile getFile()
- {
- return file;
- }
-}
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerFactory.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerFactory.java
deleted file mode 100644
index d95bfda0e..000000000
--- a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.apache.maven.archiva.consumers;
-
-/*
- * 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.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.ContextException;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
-
-/**
- * DiscovererConsumerFactory - factory for consumers.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- * @plexus.component role="org.apache.maven.archiva.common.consumers.ConsumerFactory"
- */
-public class ConsumerFactory
- extends AbstractLogEnabled
- implements Contextualizable
-{
- public static final String ROLE = ConsumerFactory.class.getName();
-
- private PlexusContainer container;
-
- public Consumer createConsumer( String name )
- throws ConsumerException
- {
- getLogger().info( "Attempting to create consumer [" + name + "]" );
-
- Consumer consumer;
- try
- {
- consumer = (Consumer) container.lookup( Consumer.ROLE, name, container.getLookupRealm() );
- }
- catch ( Throwable t )
- {
- String emsg = "Unable to create consumer [" + name + "]: " + t.getMessage();
- getLogger().warn( t.getMessage(), t );
- throw new ConsumerException( null, emsg, t );
- }
-
- getLogger().info( "Created consumer [" + name + "|" + consumer.getName() + "]" );
- return consumer;
- }
-
- public void contextualize( Context context )
- throws ContextException
- {
- container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
- }
-}
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericArtifactConsumer.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericArtifactConsumer.java
index 4c6f57bdb..084c38881 100644
--- a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericArtifactConsumer.java
+++ b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericArtifactConsumer.java
@@ -24,7 +24,9 @@ import org.apache.maven.archiva.common.artifact.builder.DefaultLayoutArtifactBui
import org.apache.maven.archiva.common.artifact.builder.LayoutArtifactBuilder;
import org.apache.maven.archiva.common.artifact.builder.LegacyLayoutArtifactBuilder;
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericModelConsumer.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericModelConsumer.java
index 4fe0c429b..f44315d4e 100644
--- a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericModelConsumer.java
+++ b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericModelConsumer.java
@@ -20,6 +20,8 @@ package org.apache.maven.archiva.consumers;
*/
import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.IOUtil;
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericRepositoryMetadataConsumer.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericRepositoryMetadataConsumer.java
index a575f156a..2c0573011 100644
--- a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericRepositoryMetadataConsumer.java
+++ b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericRepositoryMetadataConsumer.java
@@ -21,6 +21,8 @@ package org.apache.maven.archiva.consumers;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java
index dc35fc44d..a6a90e3f3 100644
--- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java
+++ b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.consumers;
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java
index db51092e3..bbb5610bd 100644
--- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java
+++ b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java
@@ -1,5 +1,7 @@
package org.apache.maven.archiva.consumers;
+import org.apache.maven.archiva.repository.consumer.ConsumerFactory;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java
index 35457c4b1..bc96f03ec 100644
--- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java
+++ b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.consumers;
*/
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
import org.codehaus.plexus.util.StringUtils;
import java.util.ArrayList;
diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java
index 27111ac1e..a436cdd94 100644
--- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java
+++ b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java
@@ -21,7 +21,8 @@ package org.apache.maven.archiva.consumers;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
import org.apache.maven.artifact.Artifact;
import java.util.ArrayList;