aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2017-10-03 18:46:16 +0200
committerMartin Stockhammer <martin_s@apache.org>2017-10-03 18:46:16 +0200
commit1b89266820ad17ee6524706c2e15b6b08b432b8e (patch)
tree0e419ca93caf511f036dce76486434cda9608a05 /archiva-modules
parent93af7e9457feea6d64fbd11cea71fee63901ed9f (diff)
downloadarchiva-1b89266820ad17ee6524706c2e15b6b08b432b8e.tar.gz
archiva-1b89266820ad17ee6524706c2e15b6b08b432b8e.zip
Some progress in repository abstraction
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractManagedRepository.java64
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRemoteRepository.java164
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRepository.java290
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableManagedRepository.java32
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRemoteRepository.java91
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRepository.java164
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepository.java57
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/StandardCapabilities.java131
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/UnsupportedURIException.java51
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java81
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java74
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRepositoryProvider.java60
12 files changed, 1202 insertions, 57 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractManagedRepository.java
new file mode 100644
index 000000000..a198b2828
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractManagedRepository.java
@@ -0,0 +1,64 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.Locale;
+
+/**
+ * Simple implementation of a managed repository.
+ */
+public abstract class AbstractManagedRepository extends AbstractRepository implements EditableManagedRepository
+{
+ private boolean blocksRedeployment = false;
+ private ManagedRepositoryContent content;
+
+ public AbstractManagedRepository( RepositoryType type, String id, String name )
+ {
+ super( type, id, name );
+ }
+
+ public AbstractManagedRepository( Locale primaryLocale, RepositoryType type, String id, String name )
+ {
+ super( primaryLocale, type, id, name );
+ }
+
+ @Override
+ public ManagedRepositoryContent getContent( )
+ {
+ return content;
+ }
+
+ protected void setContent(ManagedRepositoryContent content) {
+ this.content = content;
+ }
+
+ @Override
+ public void setBlocksRedeployment( boolean blocksRedeployment )
+ {
+ this.blocksRedeployment = blocksRedeployment;
+ }
+
+ @Override
+ public boolean blocksRedeployments( )
+ {
+ return blocksRedeployment;
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRemoteRepository.java
new file mode 100644
index 000000000..73aeb8ab5
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRemoteRepository.java
@@ -0,0 +1,164 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.time.Duration;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Abstract implementation of a remote repository. Abstract classes must implement the
+ * features and capabilities by themselves.
+ */
+public abstract class AbstractRemoteRepository extends AbstractRepository implements EditableRemoteRepository
+{
+
+ private RepositoryCredentials credentials;
+ private String checkPath;
+ private Map<String,String> extraParameters = new HashMap<>( );
+ private Map<String,String> uExtraParameters = Collections.unmodifiableMap( extraParameters );
+ private Map<String,String> extraHeaders = new HashMap<>( );
+ private Map<String,String> uExtraHeaders = Collections.unmodifiableMap( extraHeaders );
+ private Duration timeout;
+ private Duration downloadTimeout;
+ private String proxyId;
+ private RemoteRepositoryContent content;
+
+ public AbstractRemoteRepository( RepositoryType type, String id, String name )
+ {
+ super( type, id, name );
+ }
+
+ public AbstractRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name )
+ {
+ super( primaryLocale, type, id, name );
+ }
+
+ @Override
+ public void setCredentials( RepositoryCredentials credentials )
+ {
+ this.credentials = credentials;
+ }
+
+ @Override
+ public void setCheckPath( String path )
+ {
+ this.checkPath = path;
+ }
+
+ @Override
+ public void setExtraParameters( Map<String, String> params )
+ {
+ this.extraParameters.clear();
+ this.extraParameters.putAll(params);
+ }
+
+ @Override
+ public void addExtraParameter( String key, String value )
+ {
+ this.extraParameters.put(key, value);
+ }
+
+ @Override
+ public void setExtraHeaders( Map<String, String> headers )
+ {
+ this.extraHeaders.clear();
+ this.extraHeaders.putAll(headers);
+ }
+
+ @Override
+ public void addExtraHeader( String header, String value )
+ {
+ this.extraHeaders.put(header, value);
+ }
+
+ @Override
+ public void setTimeout( Duration duration )
+ {
+ this.timeout = duration;
+ }
+
+ @Override
+ public void setDownloadTimeout( Duration duration )
+ {
+ this.downloadTimeout=duration;
+ }
+
+ @Override
+ public void setProxyId( String proxyId )
+ {
+ this.proxyId = proxyId;
+ }
+
+ @Override
+ public RemoteRepositoryContent getContent( )
+ {
+ return content;
+ }
+
+ protected void setContent(RemoteRepositoryContent content) {
+ this.content = content;
+ }
+
+ @Override
+ public RepositoryCredentials getLoginCredentials( )
+ {
+ return credentials;
+ }
+
+ @Override
+ public String getCheckPath( )
+ {
+ return checkPath;
+ }
+
+ @Override
+ public Map<String, String> getExtraParameters( )
+ {
+ return uExtraParameters;
+ }
+
+ @Override
+ public Map<String, String> getExtraHeaders( )
+ {
+ return uExtraHeaders;
+ }
+
+ @Override
+ public Duration getTimeout( )
+ {
+ return timeout;
+ }
+
+ @Override
+ public Duration getDownloadTimeout( )
+ {
+ return downloadTimeout;
+ }
+
+ @Override
+ public String getProxyId( )
+ {
+ return proxyId;
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRepository.java
new file mode 100644
index 000000000..1b9585e2b
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRepository.java
@@ -0,0 +1,290 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.archiva.repository.features.RepositoryFeature;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Implementation of a repository with the necessary fields for a bare repository.
+ * No features are provided. Capabilities and features must be implemented by concrete classes.
+ *
+ */
+public abstract class AbstractRepository implements EditableRepository
+{
+
+ private final RepositoryType type;
+ private final String id;
+ private Map<Locale, String> names = new HashMap<>( );
+ private Map<Locale, String> descriptions = new HashMap<>( );
+
+ private Locale primaryLocale = new Locale("en_US");
+ private URI location;
+ private Set<URI> failoverLocations = new HashSet<>( );
+ private Set<URI> uFailoverLocations = Collections.unmodifiableSet( failoverLocations );
+ private boolean scanned = true;
+ private List<ScheduleDefinition> schedulingTimes = new ArrayList<>( );
+ private List<ScheduleDefinition> uSchedulingTimes = Collections.unmodifiableList( schedulingTimes );
+ private boolean index;
+ private URI indexPath;
+ private String layout;
+ private Set<ReleaseScheme> activeReleaseSchemes = new HashSet<>( );
+ private Set<ReleaseScheme> uActiveReleaseSchemes = Collections.unmodifiableSet( activeReleaseSchemes );
+
+ public AbstractRepository(RepositoryType type, String id, String name) {
+ this.id = id;
+ this.names.put( primaryLocale, name);
+ this.type = type;
+ }
+
+ public AbstractRepository(Locale primaryLocale, RepositoryType type, String id, String name) {
+ setPrimaryLocale( primaryLocale );
+ this.id = id;
+ this.names.put( primaryLocale, name);
+ this.type = type;
+ }
+
+ protected void setPrimaryLocale(Locale locale) {
+ this.primaryLocale = locale;
+ }
+
+ @Override
+ public String getId( )
+ {
+ return id;
+ }
+
+ @Override
+ public String getName( )
+ {
+ return getName( primaryLocale );
+ }
+
+ @Override
+ public String getName( Locale locale )
+ {
+ return names.get(locale);
+ }
+
+ @Override
+ public String getDescription( )
+ {
+ return getDescription( primaryLocale );
+ }
+
+ @Override
+ public String getDescription( Locale locale )
+ {
+ return descriptions.get(primaryLocale);
+ }
+
+ @Override
+ public RepositoryType getType( )
+ {
+ return type;
+ }
+
+ @Override
+ public URI getLocation( )
+ {
+ return location;
+ }
+
+ @Override
+ public Set<URI> getFailoverLocations( )
+ {
+ return uFailoverLocations;
+ }
+
+ @Override
+ public boolean isScanned( )
+ {
+ return scanned;
+ }
+
+ @Override
+ public List<ScheduleDefinition> getSchedulingTimes( )
+ {
+ return uSchedulingTimes;
+ }
+
+ @Override
+ public boolean hasIndex( )
+ {
+ return index;
+ }
+
+ @Override
+ public URI getIndexPath( )
+ {
+ return indexPath;
+ }
+
+ @Override
+ public String getLayout( )
+ {
+ return layout;
+ }
+
+ @Override
+ public Set<ReleaseScheme> getActiveReleaseSchemes( )
+ {
+ return uActiveReleaseSchemes;
+ }
+
+ @Override
+ public abstract RepositoryCapabilities getCapabilities( );
+
+ @Override
+ public <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature( Class<T> clazz ) throws UnsupportedFeatureException
+ {
+ throw new UnsupportedFeatureException( "Feature "+clazz+" not supported" );
+ }
+
+ @Override
+ public <T extends RepositoryFeature<T>> boolean supportsFeature( Class<T> clazz )
+ {
+ return false;
+ }
+
+ @Override
+ public Locale getPrimaryLocale( )
+ {
+ return primaryLocale;
+ }
+
+ @Override
+ public void setName( Locale locale, String name )
+ {
+ names.put(locale, name);
+ }
+
+ @Override
+ public void setDescription( Locale locale, String description )
+ {
+ descriptions.put(locale, description);
+ }
+
+ @Override
+ public void setLocation( URI location )
+ {
+ this.location = location;
+ }
+
+ @Override
+ public void addFailoverLocation( URI location )
+ {
+ this.failoverLocations.add(location);
+ }
+
+ @Override
+ public void removeFailoverLocation( URI location )
+ {
+ this.failoverLocations.remove( location );
+ }
+
+ @Override
+ public void clearFailoverLocations( )
+ {
+ this.failoverLocations.clear();
+ }
+
+ @Override
+ public void setScanned( boolean scanned )
+ {
+ this.scanned = scanned;
+ }
+
+ @Override
+ public void addSchedulingTime( int index, ScheduleDefinition scheduleDefinition )
+ {
+ this.schedulingTimes.add( index, scheduleDefinition );
+ }
+
+ @Override
+ public void addSchedulingTime( ScheduleDefinition scheduleDefinition )
+ {
+ this.schedulingTimes.add(scheduleDefinition);
+ }
+
+ @Override
+ public void removeSchedulingTime( ScheduleDefinition scheduleDefinition )
+ {
+ this.schedulingTimes.remove(scheduleDefinition);
+ }
+
+ @Override
+ public void removeSchedulingTime(int index) {
+ this.schedulingTimes.remove(index);
+ }
+
+ @Override
+ public void clearSchedulingTimes( )
+ {
+ this.schedulingTimes.clear();
+ }
+
+ @Override
+ public void setIndex( boolean hasIndex )
+ {
+ this.index = hasIndex;
+ }
+
+ @Override
+ public void setIndexPath( URI indexPath )
+ {
+ this.indexPath = indexPath;
+ }
+
+ @Override
+ public void setLayout( String layout )
+ {
+ this.layout = layout;
+ }
+
+ @Override
+ public void addActiveReleaseScheme( ReleaseScheme scheme )
+ {
+ this.activeReleaseSchemes.add(scheme);
+ }
+
+ @Override
+ public void removeActiveReleaseScheme( ReleaseScheme scheme )
+ {
+ this.activeReleaseSchemes.remove(scheme);
+ }
+
+ @Override
+ public void clearActiveReleaseSchemes( )
+ {
+ this.activeReleaseSchemes.clear();
+ }
+
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableManagedRepository.java
new file mode 100644
index 000000000..4d49a21fa
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableManagedRepository.java
@@ -0,0 +1,32 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.
+ */
+
+/**
+ * The editable part of a managed repository.
+ */
+public interface EditableManagedRepository extends EditableRepository, ManagedRepository
+{
+ /**
+ * If true, the repository blocks redeployments of artifacts with the same version.
+ * @param blocksRedeployment The flag for blocking redeployments.
+ */
+ void setBlocksRedeployment(boolean blocksRedeployment);
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRemoteRepository.java
new file mode 100644
index 000000000..0449149d3
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRemoteRepository.java
@@ -0,0 +1,91 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.time.Duration;
+import java.util.Map;
+
+/**
+ * The editable part of a remote repository
+ */
+public interface EditableRemoteRepository extends EditableRepository, RemoteRepository
+{
+
+ /**
+ * Sets the login credentials for login to the remote repository.
+ * @param credentials
+ */
+ void setCredentials(RepositoryCredentials credentials);
+
+ /**
+ * Sets the path relative to the root url of the repository that should be used to check
+ * the availability of the repository.
+ *
+ * @param path The path string.
+ */
+ void setCheckPath(String path);
+
+ /**
+ * Sets additional parameters to be used to access the remote repository.
+ * @param params A map of parameters, may not be null.
+ */
+ void setExtraParameters(Map<String,String> params);
+
+ /**
+ * Adds an additional parameter.
+ * @param key The key of the parameter
+ * @param value The value of the parameter
+ */
+ void addExtraParameter(String key, String value);
+
+ /**
+ * Sets the extra headers, that are added to the requests to the remote repository.
+ */
+ void setExtraHeaders(Map<String,String> headers);
+
+ /**
+ * Adds an extra header.
+ * @param header The header name
+ * @param value The header value
+ */
+ void addExtraHeader(String header, String value);
+
+ /**
+ * Sets the timeout for requests to the remote repository.
+ *
+ * @param duration The amount of time, after that the request is aborted.
+ */
+ void setTimeout(Duration duration);
+
+ /**
+ * Sets the maximum duration for downloads from the remote repository.
+ *
+ * @param duration The amount of time after that a download is aborted.
+ */
+ void setDownloadTimeout(Duration duration);
+
+ /**
+ * Sets the proxy id that is used for requests to the remote repository.
+ *
+ * @param proxyId The id of the proxy.
+ */
+ void setProxyId(String proxyId);
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRepository.java
new file mode 100644
index 000000000..96f610d3e
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRepository.java
@@ -0,0 +1,164 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.net.URI;
+import java.util.Locale;
+
+/**
+ * This is the editable part of a repository.
+ * Normally a repository should also implement this interface but it is not
+ * required.
+ *
+ * Capabilities and features are a integral part of the implementation and not
+ * provided here by the interface.
+ * Feature setting methods are provided by the features itself.
+ *
+ */
+public interface EditableRepository extends Repository
+{
+ /**
+ * Returns the primary locale used for setting the default values for
+ * name and description.
+ *
+ * @return The locale used for name and description when they are not set
+ */
+ Locale getPrimaryLocale();
+
+ /**
+ * Sets the name for the given locale
+ *
+ * @param locale the locale for which the name is set
+ * @param name The name value in the language that matches the locale
+ */
+ void setName( Locale locale, String name);
+
+ /**
+ * Sets the description for the given locale
+ *
+ * @param locale the locale for which the description is set
+ * @param description The description in the language that matches the locale.
+ */
+ void setDescription(Locale locale, String description);
+
+ /**
+ * Sets the location of the repository. May be a URI that is suitable for the
+ * repository implementation. Not all implementations will accept the same URI schemes.
+ * @param location the location URI
+ * @throws UnsupportedURIException if the URI scheme is not supported by the repository type.
+ */
+ void setLocation(URI location) throws UnsupportedURIException;
+
+ /**
+ * Adds a failover location for the repository.
+ *
+ * @param location The location that should be used as failover.
+ * @throws UnsupportedURIException if the URI scheme is not supported by the repository type.
+ */
+ void addFailoverLocation(URI location) throws UnsupportedURIException;
+
+ /**
+ * Removes a failover location from the set.
+ *
+ * @param location the location uri to remove
+ */
+ void removeFailoverLocation(URI location);
+
+ /**
+ * Clears the failover location set.
+ */
+ void clearFailoverLocations();
+
+ /**
+ * Sets the flag for scanning the repository. If true, the repository will be scanned.
+ * You have to set the scheduling times, if you set this to true.
+ *
+ * @param scanned if true, the repository is scanned regulary.
+ */
+ void setScanned(boolean scanned);
+
+ /**
+ * Adds a scheduling time at the given index.
+ * @param index the index where time should be set
+ * @param scheduleDefinition the scheduling definition to add
+ */
+ void addSchedulingTime(int index, ScheduleDefinition scheduleDefinition);
+
+ /**
+ * Adds a scheduling time to the end of the list.
+ * @param scheduleDefinition the scheduling definition to set
+ */
+ void addSchedulingTime(ScheduleDefinition scheduleDefinition);
+
+ /**
+ * Removes the scheduling time definition from the list.
+ * @param scheduleDefinition the scheduling definition to remove.
+ */
+ void removeSchedulingTime(ScheduleDefinition scheduleDefinition);
+
+ /**
+ * Removes the scheduling time definition add the given index.
+ *
+ * @param index the index to remove
+ */
+ void removeSchedulingTime(int index);
+
+ /**
+ * Clears the list of scheduling definitions.
+ */
+ void clearSchedulingTimes();
+
+ /**
+ * Set true, if the repository has indexes stored.
+ * @param hasIndex true, if the repository has indexes, otherwise false.
+ */
+ void setIndex(boolean hasIndex);
+
+ /**
+ * Sets the path to the index directory. May be a relative or absolute URI.
+ * @param indexPath the path
+ */
+ void setIndexPath(URI indexPath);
+
+ /**
+ * Sets the layout string.
+ * @param layout
+ */
+ void setLayout(String layout);
+
+ /**
+ * Adds an active release scheme. Release schemes may be combined.
+ * @param scheme the scheme to add.
+ */
+ void addActiveReleaseScheme(ReleaseScheme scheme);
+
+ /**
+ * Removes an active release scheme from the set.
+ * @param scheme the scheme to remove.
+ */
+ void removeActiveReleaseScheme(ReleaseScheme scheme);
+
+ /**
+ * Clears all active release schemes.
+ */
+ void clearActiveReleaseSchemes();
+
+
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepository.java
index 2727b9115..30c58c059 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepository.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepository.java
@@ -42,25 +42,12 @@ public interface RemoteRepository extends Repository {
RepositoryCredentials getLoginCredentials();
/**
- * Sets the login credentials for login to the remote repository.
- * @param credentials
- */
- void setCredentials(RepositoryCredentials credentials);
-
- /**
* Returns the path relative to the root url of the repository that should be used
* to check the availability of the repository.
* @return The check path, null if not set.
*/
String getCheckPath();
- /**
- * Sets the path relative to the root url of the repository that should be used to check
- * the availability of the repository.
- *
- * @param path The path string.
- */
- void setCheckPath(String path);
/**
* Returns additional parameters, that are used for accessing the remote repository.
@@ -68,18 +55,6 @@ public interface RemoteRepository extends Repository {
*/
Map<String,String> getExtraParameters();
- /**
- * Sets additional parameters to be used to access the remote repository.
- * @param params A map of parameters, may not be null.
- */
- void setExtraParameters(Map<String,String> params);
-
- /**
- * Adds an additional parameter.
- * @param key The key of the parameter
- * @param value The value of the parameter
- */
- void addExtraParameter(String key, String value);
/**
* Returns extra headers that are added to the request to the remote repository.
@@ -88,18 +63,6 @@ public interface RemoteRepository extends Repository {
Map<String,String> getExtraHeaders();
/**
- * Sets the extra headers, that are added to the requests to the remote repository.
- */
- void setExtraHeaders(Map<String,String> headers);
-
- /**
- * Adds an extra header.
- * @param header The header name
- * @param value The header value
- */
- void addExtraHeader(String header, String value);
-
- /**
* Returns the time duration, after that the request is aborted and a error is returned, if the remote repository
* does not respond.
* @return The timeout.
@@ -107,35 +70,15 @@ public interface RemoteRepository extends Repository {
Duration getTimeout();
/**
- * Sets the timeout for requests to the remote repository.
- *
- * @param duration The amount of time, after that the request is aborted.
- */
- void setTimeout(Duration duration);
-
- /**
* Returns the time duration after that downloads from the remote repository are aborted.
* @return
*/
Duration getDownloadTimeout();
/**
- * Sets the maximum duration for downloads from the remote repository.
- *
- * @param duration The amount of time after that a download is aborted.
- */
- void setDownloadTimeout(Duration duration);
-
- /**
* Returns the id of the proxy, that is used for accessing the remote repository.
* @return The proxy id.
*/
String getProxyId();
- /**
- * Sets the proxy id that is used for requests to the remote repository.
- *
- * @param proxyId The id of the proxy.
- */
- void setProxyId(String proxyId);
}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/StandardCapabilities.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/StandardCapabilities.java
new file mode 100644
index 000000000..0a41c0497
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/StandardCapabilities.java
@@ -0,0 +1,131 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Capability implementation.
+ */
+public class StandardCapabilities implements RepositoryCapabilities
+{
+ private final Set<ReleaseScheme> supportedReleaseSchemes;
+ private final Set<ReleaseScheme> uSupportedReleaseSchemes;
+ private final Set<String> supportedLayouts;
+ private final Set<String> uSupportedLayouts;
+ private final Set<String> customCapabilities;
+ private final Set<String> uCustomCapabilities;
+ private final Set<String> supportedFeatures;
+ private final Set<String> uSupportedFeatures;
+ private final boolean indexable;
+ private final boolean fileBased;
+ private final boolean canBlockRedeployments;
+ private final boolean scannable;
+ private final boolean allowsFailover;
+
+
+ public StandardCapabilities( ReleaseScheme[] supportedReleaseSchemes, String[] supportedLayouts,
+ String[] customCapabilities, String[] supportedFeatures,
+ boolean indexable, boolean fileBased,
+ boolean canBlockRedeployments, boolean scannable, boolean allowsFailover )
+ {
+ this.supportedReleaseSchemes = new HashSet();
+ for (ReleaseScheme scheme : supportedReleaseSchemes) {
+ this.supportedReleaseSchemes.add(scheme);
+ }
+ this.uSupportedReleaseSchemes = Collections.unmodifiableSet( this.supportedReleaseSchemes);
+ this.supportedLayouts = new HashSet<>( );
+ for (String layout : supportedLayouts) {
+ this.supportedLayouts.add(layout);
+ }
+ this.uSupportedLayouts = Collections.unmodifiableSet( this.supportedLayouts );
+ this.customCapabilities = new HashSet<>( );
+ for (String cap : customCapabilities) {
+ this.customCapabilities.add(cap);
+ }
+ this.uCustomCapabilities = Collections.unmodifiableSet( this.customCapabilities );
+ this.supportedFeatures = new HashSet<>( );
+ for (String feature : supportedFeatures) {
+ this.supportedFeatures.add(feature);
+ }
+ this.uSupportedFeatures = Collections.unmodifiableSet( this.supportedFeatures );
+ this.indexable = indexable;
+ this.fileBased = fileBased;
+ this.canBlockRedeployments = canBlockRedeployments;
+ this.scannable = scannable;
+ this.allowsFailover = allowsFailover;
+ }
+
+ @Override
+ public Set<ReleaseScheme> supportedReleaseSchemes( )
+ {
+ return uSupportedReleaseSchemes;
+ }
+
+ @Override
+ public Set<String> supportedLayouts( )
+ {
+ return uSupportedLayouts;
+ }
+
+ @Override
+ public Set<String> customCapabilities( )
+ {
+ return uCustomCapabilities;
+ }
+
+ @Override
+ public Set<String> supportedFeatures( )
+ {
+ return uSupportedFeatures;
+ }
+
+ @Override
+ public boolean isIndexable( )
+ {
+ return indexable;
+ }
+
+ @Override
+ public boolean isFileBased( )
+ {
+ return fileBased;
+ }
+
+ @Override
+ public boolean canBlockRedeployments( )
+ {
+ return canBlockRedeployments;
+ }
+
+ @Override
+ public boolean isScannable( )
+ {
+ return scannable;
+ }
+
+ @Override
+ public boolean allowsFailover( )
+ {
+ return allowsFailover;
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/UnsupportedURIException.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/UnsupportedURIException.java
new file mode 100644
index 000000000..5f7f96f8a
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/UnsupportedURIException.java
@@ -0,0 +1,51 @@
+package org.apache.archiva.repository;
+
+/*
+ * 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.
+ */
+
+/**
+ * Exception is thrown, if the URI is syntactically correct, but is not
+ * supported by the underlying repository implementation
+ */
+public class UnsupportedURIException extends Exception
+{
+ public UnsupportedURIException( )
+ {
+ }
+
+ public UnsupportedURIException( String message )
+ {
+ super( message );
+ }
+
+ public UnsupportedURIException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public UnsupportedURIException( Throwable cause )
+ {
+ super( cause );
+ }
+
+ public UnsupportedURIException( String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace )
+ {
+ super( message, cause, enableSuppression, writableStackTrace );
+ }
+}
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java
new file mode 100644
index 000000000..c2a316bd5
--- /dev/null
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java
@@ -0,0 +1,81 @@
+package org.apache.archiva.repository.maven2;
+
+/*
+ * 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.archiva.repository.AbstractManagedRepository;
+import org.apache.archiva.repository.ManagedRepositoryContent;
+import org.apache.archiva.repository.ReleaseScheme;
+import org.apache.archiva.repository.RepositoryCapabilities;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.StandardCapabilities;
+import org.apache.archiva.repository.features.ArtifactCleanupFeature;
+import org.apache.archiva.repository.features.IndexCreationFeature;
+import org.apache.archiva.repository.features.StagingRepositoryFeature;
+
+import java.util.Locale;
+
+/**
+ * Maven2 managed repository implementation.
+ */
+public class MavenManagedRepository extends AbstractManagedRepository
+{
+ public static final String DEFAULT_LAYOUT = "default";
+ public static final String LEGACY_LAYOUT = "legacy";
+ private ManagedRepositoryContent content;
+
+ private static final RepositoryCapabilities CAPABILITIES = new StandardCapabilities(
+ new ReleaseScheme[] { ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT },
+ new String[] { DEFAULT_LAYOUT, LEGACY_LAYOUT},
+ new String[] {},
+ new String[] {ArtifactCleanupFeature.class.getName(), IndexCreationFeature.class.getName(),
+ StagingRepositoryFeature.class.getName()},
+ true,
+ true,
+ true,
+ true,
+ false
+ );
+
+ public MavenManagedRepository( RepositoryType type, String id, String name )
+ {
+ super( type, id, name );
+ }
+
+ public MavenManagedRepository( Locale primaryLocale, RepositoryType type, String id, String name )
+ {
+ super( primaryLocale, type, id, name );
+ }
+
+ protected void setContent(ManagedRepositoryContent content) {
+ this.content = content;
+ }
+
+ @Override
+ public ManagedRepositoryContent getContent( )
+ {
+ return content;
+ }
+
+ @Override
+ public RepositoryCapabilities getCapabilities( )
+ {
+ return CAPABILITIES;
+ }
+}
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java
new file mode 100644
index 000000000..8323cd6fc
--- /dev/null
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java
@@ -0,0 +1,74 @@
+package org.apache.archiva.repository.maven2;
+
+import org.apache.archiva.repository.AbstractRemoteRepository;
+import org.apache.archiva.repository.AbstractRepository;
+import org.apache.archiva.repository.ReleaseScheme;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RemoteRepositoryContent;
+import org.apache.archiva.repository.RepositoryCapabilities;
+import org.apache.archiva.repository.RepositoryCredentials;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.StandardCapabilities;
+import org.apache.archiva.repository.features.ArtifactCleanupFeature;
+import org.apache.archiva.repository.features.IndexCreationFeature;
+import org.apache.archiva.repository.features.RemoteIndexFeature;
+import org.apache.archiva.repository.features.StagingRepositoryFeature;
+
+import java.time.Duration;
+import java.util.Locale;
+import java.util.Map;
+
+/*
+ * 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.
+ */
+
+/**
+ * Maven2 remote repository implementation
+ */
+public class MavenRemoteRepository extends AbstractRemoteRepository
+ implements RemoteRepository
+{
+ private static final RepositoryCapabilities CAPABILITIES = new StandardCapabilities(
+ new ReleaseScheme[] { ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT },
+ new String[] { MavenManagedRepository.DEFAULT_LAYOUT, MavenManagedRepository.LEGACY_LAYOUT},
+ new String[] {},
+ new String[] {ArtifactCleanupFeature.class.getName(), IndexCreationFeature.class.getName(),
+ StagingRepositoryFeature.class.getName(), RemoteIndexFeature.class.getName()},
+ true,
+ true,
+ true,
+ true,
+ false
+ );
+
+ public MavenRemoteRepository( RepositoryType type, String id, String name )
+ {
+ super( type, id, name );
+ }
+
+ public MavenRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name )
+ {
+ super( primaryLocale, type, id, name );
+ }
+
+ @Override
+ public RepositoryCapabilities getCapabilities( )
+ {
+ return CAPABILITIES;
+ }
+}
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRepositoryProvider.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRepositoryProvider.java
new file mode 100644
index 000000000..2cda87368
--- /dev/null
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRepositoryProvider.java
@@ -0,0 +1,60 @@
+package org.apache.archiva.repository.maven2;
+
+/*
+ * 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.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RepositoryProvider;
+import org.apache.archiva.repository.RepositoryType;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Provider for the maven2 repository implementations
+ */
+public class MavenRepositoryProvider implements RepositoryProvider
+{
+ static final Set<RepositoryType> TYPES = new HashSet<>( );
+ static {
+ TYPES.add( RepositoryType.MAVEN);
+ }
+
+ @Override
+ public Set<RepositoryType> provides( )
+ {
+ return TYPES;
+ }
+
+ @Override
+ public ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration )
+ {
+ MavenManagedRepository repo = new MavenManagedRepository( null, null ,null );
+ return null;
+ }
+
+ @Override
+ public RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration )
+ {
+ return null;
+ }
+}