You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ma...@apache.org on 2017/11/08 22:57:10 UTC
[2/4] archiva git commit: Rearranging modules and adding indexer api
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryCredentials.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryCredentials.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryCredentials.java
new file mode 100644
index 0000000..2751bc0
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryCredentials.java
@@ -0,0 +1,31 @@
+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.
+ */
+
+
+/**
+ * Credentials used to login to a remote repository.
+ */
+public interface RepositoryCredentials {
+
+
+}
+
+
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryException.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryException.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryException.java
new file mode 100644
index 0000000..b9dca95
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryException.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.
+ */
+
+/**
+ * RepositoryException
+ *
+ *
+ */
+public class RepositoryException
+ extends Exception
+{
+
+ public RepositoryException()
+ {
+ super();
+ }
+
+ public RepositoryException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public RepositoryException( String message )
+ {
+ super( message );
+ }
+
+ public RepositoryException( Throwable cause )
+ {
+ super( cause );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryNotFoundException.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryNotFoundException.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryNotFoundException.java
new file mode 100644
index 0000000..ad4ad9b
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryNotFoundException.java
@@ -0,0 +1,49 @@
+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.
+ */
+
+/**
+ * RepositoryNotFoundException
+ *
+ *
+ */
+public class RepositoryNotFoundException
+ extends RepositoryException
+{
+
+ public RepositoryNotFoundException()
+ {
+ }
+
+ public RepositoryNotFoundException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public RepositoryNotFoundException( String message )
+ {
+ super( message );
+ }
+
+ public RepositoryNotFoundException( Throwable cause )
+ {
+ super( cause );
+ }
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java
new file mode 100644
index 0000000..a501514
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryProvider.java
@@ -0,0 +1,139 @@
+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.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+
+import java.util.Set;
+
+/**
+ *
+ * This interface must be implemented by the repository implementations. The repository provider knows all
+ * about the repositories and should be the only part that uses the repository specific classes and libraries
+ * (e.g. the maven libraries).
+ *
+ * Newly created instances should always be filled with default values that make sense. null values should
+ * be avoided.
+ *
+ * References like staging repositories must not be set.
+ *
+ *
+ */
+public interface RepositoryProvider
+{
+
+ /**
+ * Returns the types of repositories this provider can handle.
+ *
+ * @return the set of supported repository types
+ */
+ Set<RepositoryType> provides();
+
+ /**
+ * Creates a editable managed repository instance. The provider must not check the uniqueness of the
+ * id parameter and must not track the already created instances. Each call to this method will create
+ * a new instance.
+ *
+ * @param id the repository identifier
+ * @param name the repository name
+ * @return a new created managed repository instance
+ */
+ EditableManagedRepository createManagedInstance(String id, String name);
+
+ /**
+ * Creates a editable remote repository instance. The provider must not check the uniqueness of the
+ * id parameter and must not track the already created instances. Each call to this method will create
+ * a new instance.
+ *
+ * @param id the repository identifier
+ * @param name the repository name
+ * @return a new created remote repository instance
+ */
+ EditableRemoteRepository createRemoteInstance(String id, String name);
+
+ /**
+ * Creates a new managed repository instance from the given configuration. All attributes are filled from the
+ * provided configuration object.
+ *
+ * @param configuration the repository configuration that contains the repository data
+ * @return a new created managed repository instance
+ * @throws RepositoryException if some of the configuration values are not valid
+ */
+ ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration) throws RepositoryException;
+
+ /**
+ * Updates the given managed repository instance from the given configuration. All attributes are filled from the
+ * provided configuration object.
+ *
+ * @param repo the repository instance that should be updated
+ * @param configuration the repository configuration that contains the repository data
+ * @throws RepositoryException if some of the configuration values are not valid
+ */
+ void updateManagedInstance( EditableManagedRepository repo, ManagedRepositoryConfiguration configuration) throws RepositoryException;
+
+ /**
+ * Creates a new managed staging repository instance from the given configuration. All attributes are filled from the
+ * provided configuration object.
+ *
+ * @param baseConfiguration the repository configuration of the base repository that references the staging repository
+ * @return a new created managed staging repository instance
+ * @throws RepositoryException if some of the configuration values are not valid
+ */
+ ManagedRepository createStagingInstance(ManagedRepositoryConfiguration baseConfiguration) throws RepositoryException;
+
+ /**
+ * Creates a new remote repository instance from the given configuration. All attributes are filled from the
+ * provided configuration object.
+ *
+ * @param configuration the repository configuration that contains the repository data
+ * @return a new created remote repository instance
+ * @throws RepositoryException if some of the configuration values are not valid
+ */
+ RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration) throws RepositoryException;
+
+ /**
+ * Updates the given remote repository instance from the given configuration. All attributes are filled from the
+ * provided configuration object.
+ *
+ * @param repo the repository instance that should be updated
+ * @param configuration the repository configuration that contains the repository data
+ * @throws RepositoryException if some of the configuration values are not valid
+ */
+ void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration configuration) throws RepositoryException;
+
+ /**
+ * Returns a configuration object from the given remote repository instance.
+ *
+ * @param remoteRepository the remote repository instance
+ * @return the repository configuration with all the data that is stored in the repository instance
+ * @throws RepositoryException if the data cannot be converted
+ */
+ RemoteRepositoryConfiguration getRemoteConfiguration(RemoteRepository remoteRepository) throws RepositoryException;
+
+ /**
+ * Returns a configuration object from the given managed repository instance.
+ *
+ * @param managedRepository the managed repository instance
+ * @return the repository configuration with all the data that is stored in the repository instance
+ * @throws RepositoryException if the data cannot be converted
+ */
+ ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository) throws RepositoryException;
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryType.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryType.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryType.java
new file mode 100644
index 0000000..f60c657
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryType.java
@@ -0,0 +1,29 @@
+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 repository types that are known to the system.
+ */
+public enum RepositoryType {
+
+ MAVEN, NPM
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/StandardCapabilities.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/StandardCapabilities.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/StandardCapabilities.java
new file mode 100644
index 0000000..0a41c04
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedFeatureException.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedFeatureException.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedFeatureException.java
new file mode 100644
index 0000000..112f307
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedFeatureException.java
@@ -0,0 +1,47 @@
+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.
+ */
+
+/**
+ * This exception is thrown if a given feature is not supported by the repository.
+ * This is a runtime exception.
+ *
+ */
+public class UnsupportedFeatureException extends RuntimeException {
+
+ public UnsupportedFeatureException() {
+ }
+
+ public UnsupportedFeatureException(String message) {
+ super(message);
+ }
+
+ public UnsupportedFeatureException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public UnsupportedFeatureException(Throwable cause) {
+ super(cause);
+ }
+
+ public UnsupportedFeatureException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedRepositoryTypeException.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedRepositoryTypeException.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedRepositoryTypeException.java
new file mode 100644
index 0000000..9bfc02e
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedRepositoryTypeException.java
@@ -0,0 +1,45 @@
+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.
+ */
+
+/**
+ * This is a fatal exception and should not happen. It is thrown if the implementation
+ * does not have certain classes to support this repository type.
+ */
+public class UnsupportedRepositoryTypeException extends RuntimeException {
+
+ private static final String MESSAGE = "The repository type is not supported: ";
+
+ public UnsupportedRepositoryTypeException(RepositoryType type) {
+ super(MESSAGE+type.name());
+ }
+
+ public UnsupportedRepositoryTypeException(RepositoryType type, Throwable cause) {
+ super(MESSAGE+type.name(), cause);
+ }
+
+ public UnsupportedRepositoryTypeException(Throwable cause) {
+ super(cause);
+ }
+
+ protected UnsupportedRepositoryTypeException(RepositoryType type, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(MESSAGE+type.name(), cause, enableSuppression, writableStackTrace);
+ }
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedURIException.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedURIException.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/UnsupportedURIException.java
new file mode 100644
index 0000000..5f7f96f
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/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 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java
new file mode 100644
index 0000000..a4df8a2
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java
@@ -0,0 +1,41 @@
+package org.apache.archiva.repository.features;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * Created by martin on 30.09.17.
+ */
+public interface RepositoryFeature<T extends RepositoryFeature<T>> {
+
+ default String getId() {
+ return this.getClass().getName();
+ }
+
+ default boolean isFeature(String featureId) {
+ return this.getClass().getName().equals(featureId);
+ }
+
+ default <K extends RepositoryFeature<K>> boolean isFeature(Class<K> clazz) {
+ return this.getClass().equals(clazz);
+ }
+
+ T get();
+}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-api/src/main/resources/META-INF/spring-context.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-api/src/main/resources/META-INF/spring-context.xml
new file mode 100644
index 0000000..ce334de
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/resources/META-INF/spring-context.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:task="http://www.springframework.org/schema/task"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd
+ http://www.springframework.org/schema/task
+ http://www.springframework.org/schema/task/spring-task-3.0.xsd"
+ default-lazy-init="false">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.archiva.indexer.search,org.apache.archiva.indexer.merger"/>
+
+
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
index 8f21534..2b03400 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
@@ -43,6 +43,10 @@
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-repository-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
<artifactId>archiva-configuration</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/AbstractRepository.java
----------------------------------------------------------------------
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
index 0ff3cb1..ab1c3fa 100644
--- 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
@@ -23,6 +23,7 @@ import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinition;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.parser.CronParser;
+import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.repository.features.RepositoryFeature;
import java.net.URI;
@@ -237,4 +238,10 @@ public abstract class AbstractRepository implements EditableRepository
protected <T extends RepositoryFeature<T>> void addFeature(RepositoryFeature<T> feature) {
featureMap.put( (Class<? extends RepositoryFeature<?>>) feature.getClass(), feature);
}
+
+ @Override
+ public ArchivaIndexingContext getIndexingContext() {
+ // TODO: Implement
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ContentNotFoundException.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ContentNotFoundException.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ContentNotFoundException.java
deleted file mode 100644
index 7579deb..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ContentNotFoundException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-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.
- */
-
-/**
- * ContentNotFoundException is thrown in response for requests for content that is not the repository.
- *
- *
- */
-public class ContentNotFoundException
- extends RepositoryException
-{
-
- public ContentNotFoundException()
- {
- super();
- }
-
- public ContentNotFoundException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public ContentNotFoundException( String message )
- {
- super( message );
- }
-
- public ContentNotFoundException( Throwable cause )
- {
- super( cause );
- }
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableManagedRepository.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 4596201..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableManagedRepository.java
+++ /dev/null
@@ -1,56 +0,0 @@
-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);
-
- /**
- * Sets the content
- * @param content
- */
- void setContent(ManagedRepositoryContent content);
-
- /**
- * 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();
-
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRemoteRepository.java
----------------------------------------------------------------------
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
deleted file mode 100644
index f8a054f..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRemoteRepository.java
+++ /dev/null
@@ -1,82 +0,0 @@
-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 content.
- * @param content
- */
- void setContent(RemoteRepositoryContent content);
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRepository.java
----------------------------------------------------------------------
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
deleted file mode 100644
index b275492..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/EditableRepository.java
+++ /dev/null
@@ -1,124 +0,0 @@
-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;
-
- /**
- * Sets the base uri for relative location uris.
- *
- * @param baseUri
- */
- void setBaseUri(URI baseUri);
-
- /**
- * 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);
-
- /**
- * Sets the scheduling definition, that defines the times, when the regular repository
- * jobs are started. The <code>cronExpression</code> must be a valid
- * quartz cron definition.
- *
- * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
- *
- * @param cronExpression the cron expression.
- * @throws IllegalArgumentException if the cron expression is not valid.
- */
- void setSchedulingDefinition(String cronExpression) throws IllegalArgumentException;
-
- /**
- * Sets the layout string.
- * @param layout
- */
- void setLayout(String layout);
-
-
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepository.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepository.java
deleted file mode 100644
index b4ab89d..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepository.java
+++ /dev/null
@@ -1,49 +0,0 @@
-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.Set;
-
-/**
- * Represents a managed repository, that is readable and writable.
- */
-public interface ManagedRepository extends Repository {
-
- /**
- * Returns the interface to access the contents of this repository.
- *
- * @return The repository content.
- */
- ManagedRepositoryContent getContent();
-
- /**
- * Returns true, if repeated deployments of the same artifact with the same version throws exceptions.
- * @return
- */
- boolean blocksRedeployments();
-
- /**
- * Returns the release schemes that are active by this repository. E.g. for maven repositories
- * this may either be a release repository, a snapshot repository or a combined repository.
- * @return
- */
- Set<ReleaseScheme> getActiveReleaseSchemes();
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
deleted file mode 100644
index 5baf32f..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
+++ /dev/null
@@ -1,226 +0,0 @@
-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.model.ArchivaArtifact;
-import org.apache.archiva.model.ArtifactReference;
-import org.apache.archiva.model.ProjectReference;
-import org.apache.archiva.model.VersionedReference;
-import org.apache.archiva.repository.layout.LayoutException;
-
-import java.nio.file.Path;
-import java.util.Set;
-
-/**
- * ManagedRepositoryContent interface for interacting with a managed repository in an abstract way,
- * without the need for processing based on filesystem paths, or working with the database.
- */
-public interface ManagedRepositoryContent extends RepositoryContent
-{
-
-
-
- /**
- * Delete from the managed repository all files / directories associated with the
- * provided version reference.
- *
- * @param reference the version reference to delete.
- * @throws ContentNotFoundException
- */
- void deleteVersion( VersionedReference reference )
- throws ContentNotFoundException;
-
- /**
- * delete a specified artifact from the repository
- *
- * @param artifactReference
- * @throws ContentNotFoundException
- */
- void deleteArtifact( ArtifactReference artifactReference )
- throws ContentNotFoundException;
-
- /**
- * @param groupId
- * @throws ContentNotFoundException
- * @since 1.4-M3
- */
- void deleteGroupId( String groupId )
- throws ContentNotFoundException;
-
- /**
- *
- * @param namespace groupId for maven
- * @param projectId artifactId for maven
- * @throws ContentNotFoundException
- */
- void deleteProject( String namespace, String projectId )
- throws RepositoryException;
-
- /**
- * <p>
- * Convenience method to get the repository id.
- * </p>
- * <p>
- * Equivalent to calling <code>.getRepository().getId()</code>
- * </p>
- *
- * @return the repository id.
- */
- String getId();
-
- /**
- * <p>
- * Gather up the list of related artifacts to the ArtifactReference provided.
- * This typically inclues the pom files, and those things with
- * classifiers (such as doc, source code, test libs, etc...)
- * </p>
- * <p>
- * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
- * </p>
- *
- * @param reference the reference to work off of.
- * @return the set of ArtifactReferences for related artifacts.
- * @throws ContentNotFoundException if the initial artifact reference does not exist within the repository.
- */
- Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
- throws ContentNotFoundException;
-
- /**
- * <p>
- * Convenience method to get the repository (on disk) root directory.
- * </p>
- * <p>
- * Equivalent to calling <code>.getRepository().getLocation()</code>
- * </p>
- *
- * @return the repository (on disk) root directory.
- */
- String getRepoRoot();
-
- /**
- * Get the repository configuration associated with this
- * repository content.
- *
- * @return the repository that is associated with this repository content.
- */
- ManagedRepository getRepository();
-
- /**
- * Given a specific {@link ProjectReference}, return the list of available versions for
- * that project reference.
- *
- * @param reference the project reference to work off of.
- * @return the list of versions found for that project reference.
- * @throws ContentNotFoundException if the project reference does nto exist within the repository.
- * @throws LayoutException
- */
- Set<String> getVersions( ProjectReference reference )
- throws ContentNotFoundException, LayoutException;
-
- /**
- * <p>
- * Given a specific {@link VersionedReference}, return the list of available versions for that
- * versioned reference.
- * </p>
- * <p>
- * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
- * </p>
- *
- * @param reference the versioned reference to work off of.
- * @return the set of versions found.
- * @throws ContentNotFoundException if the versioned reference does not exist within the repository.
- */
- Set<String> getVersions( VersionedReference reference )
- throws ContentNotFoundException;
-
- /**
- * Determines if the artifact referenced exists in the repository.
- *
- * @param reference the artifact reference to check for.
- * @return true if the artifact referenced exists.
- */
- boolean hasContent( ArtifactReference reference );
-
- /**
- * Determines if the project referenced exists in the repository.
- *
- * @param reference the project reference to check for.
- * @return true it the project referenced exists.
- */
- boolean hasContent( ProjectReference reference );
-
- /**
- * Determines if the version reference exists in the repository.
- *
- * @param reference the version reference to check for.
- * @return true if the version referenced exists.
- */
- boolean hasContent( VersionedReference reference );
-
- /**
- * Set the repository configuration to associate with this
- * repository content.
- *
- * @param repo the repository to associate with this repository content.
- */
- void setRepository( org.apache.archiva.repository.ManagedRepository repo );
-
- /**
- * Given an {@link ArtifactReference}, return the file reference to the artifact.
- *
- * @param reference the artifact reference to use.
- * @return the relative path to the artifact.
- */
- Path toFile( ArtifactReference reference );
-
- /**
- * Given an {@link ArchivaArtifact}, return the file reference to the artifact.
- *
- * @param reference the archiva artifact to use.
- * @return the relative path to the artifact.
- */
- Path toFile( ArchivaArtifact reference );
-
- /**
- * Given a {@link ProjectReference}, return the path to the metadata for
- * the project.
- *
- * @param reference the reference to use.
- * @return the path to the metadata file, or null if no metadata is appropriate.
- */
- String toMetadataPath( ProjectReference reference );
-
- /**
- * Given a {@link VersionedReference}, return the path to the metadata for
- * the specific version of the project.
- *
- * @param reference the reference to use.
- * @return the path to the metadata file, or null if no metadata is appropriate.
- */
- String toMetadataPath( VersionedReference reference );
-
- /**
- * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
- *
- * @param reference the archiva artifact to use.
- * @return the relative path to the artifact.
- */
- String toPath( ArchivaArtifact reference );
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ReleaseScheme.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ReleaseScheme.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ReleaseScheme.java
deleted file mode 100644
index 0868d35..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/ReleaseScheme.java
+++ /dev/null
@@ -1,27 +0,0 @@
-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.
- */
-
-/**
- * Repository release schemes that change the handling of artifacts
- */
-public enum ReleaseScheme {
- RELEASE,SNAPSHOT
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepository.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 5a7c1e8..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepository.java
+++ /dev/null
@@ -1,73 +0,0 @@
-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;
-
-/**
- * This represents a repository that is not fully managed by archiva. Its some kind of proxy that
- * forwards requests to the remote repository and is able to cache artifacts locally.
- */
-public interface RemoteRepository extends Repository {
-
- /**
- * Returns the interface to access the content of the repository.
- * @return
- */
- RemoteRepositoryContent getContent();
-
- /**
- * Returns the credentials used to login to the remote repository.
- * @return the credentials, null if not set.
- */
- RepositoryCredentials getLoginCredentials();
-
- /**
- * 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();
-
-
- /**
- * Returns additional parameters, that are used for accessing the remote repository.
- * @return A map of key, value pairs.
- */
- Map<String,String> getExtraParameters();
-
-
- /**
- * Returns extra headers that are added to the request to the remote repository.
- * @return
- */
- Map<String,String> getExtraHeaders();
-
- /**
- * 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.
- */
- Duration getTimeout();
-
-
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java
deleted file mode 100644
index 7002d7e..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java
+++ /dev/null
@@ -1,83 +0,0 @@
-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.model.ArtifactReference;
-import org.apache.archiva.model.RepositoryURL;
-import org.apache.archiva.repository.layout.LayoutException;
-
-/**
- * RemoteRepositoryContent interface for interacting with a remote repository in an abstract way,
- * without the need for processing based on URLs, or working with the database.
- *
- *
- */
-public interface RemoteRepositoryContent extends RepositoryContent
-{
- /**
- * <p>
- * Convenience method to get the repository id.
- * </p>
- *
- * <p>
- * Equivalent to calling <code>.getRepository().getId()</code>
- * </p>
- *
- * @return the repository id.
- */
- String getId();
-
- /**
- * Get the repository configuration associated with this
- * repository content.
- *
- * @return the repository that is associated with this repository content.
- */
- RemoteRepository getRepository();
-
- /**
- * <p>
- * Convenience method to get the repository url.
- * </p>
- *
- * <p>
- * Equivalent to calling <code>new RepositoryURL( this.getRepository().getUrl() )</code>
- * </p>
- *
- * @return the repository url.
- */
- RepositoryURL getURL();
-
- /**
- * Set the repository configuration to associate with this
- * repository content.
- *
- * @param repo the repository to associate with this repository content.
- */
- void setRepository( RemoteRepository repo );
-
- /**
- * Given an ArtifactReference, return the url to the artifact.
- *
- * @param reference the artifact reference to use.
- * @return the relative path to the artifact.
- */
- RepositoryURL toURL( ArtifactReference reference );
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/Repository.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/Repository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/Repository.java
deleted file mode 100644
index 68c00d6..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/Repository.java
+++ /dev/null
@@ -1,162 +0,0 @@
-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.List;
-import java.util.Locale;
-import java.util.Set;
-
-/**
- *
- * Base interface for repositories.
- *
- * Created by Martin Stockhammer on 21.09.17.
- */
-public interface Repository {
-
- /**
- * Return the identifier of the repository. Repository identifier should be unique at least
- * for the same type.
- * @return The identifier.
- */
- String getId();
-
- /**
- * This is the display name of the repository. This string is presented in the user interface.
- *
- * @return The display name of the repository
- */
- String getName();
-
- /**
- * Returns the name in the given locale.
- * @param locale
- * @return
- */
- String getName(Locale locale);
-
- /**
- * Returns a description of this repository.
- * @return The description.
- */
- String getDescription();
-
- /**
- * Returns the description for the given locale.
- * @param locale
- * @return
- */
- String getDescription(Locale locale);
-
- /**
- * This identifies the type of repository. Archiva does only support certain types of repositories.
- *
- * @return A unique identifier for the repository type.
- */
- RepositoryType getType();
-
-
- /**
- * Returns the location of this repository. For local repositories this might be a file URI, for
- * remote repositories a http URL or some very repository specific schemes.
- * Each repository has only one unique location.
- *
- * @return The repository location.
- */
- URI getLocation();
-
- /**
- * This returns the absolute location uri of this repository. Some repository locations may be relative to
- * the base repository directory or uri. This returns the absolute path of the repository.
- * If the location is absolute already this method returns the same URI as getLocation().
- *
- * @return the absolute uri of the location.
- */
- URI getAbsoluteLocation();
-
- /**
- * A repository may allow additional locations that can be used, if the primary location is not available.
- * @return
- */
- Set<URI> getFailoverLocations();
-
- /**
- * True, if this repository is scanned regularly.
- */
- boolean isScanned();
-
- /**
- * Returns the definition, when the repository jobs are executed.
- * This must return a valid a cron string.
- *
- * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
- *
- * @return
- */
- String getSchedulingDefinition();
-
- /**
- * Returns true, if this repository has a index available
- * @return
- */
- boolean hasIndex();
-
- /**
- * Returns a layout definition. The returned string may be implementation specific and is not
- * standardized.
- *
- * @return
- */
- String getLayout();
-
-
- /**
- * Returns the capabilities of the repository implementation.
- * @return
- */
- RepositoryCapabilities getCapabilities();
-
-
- /**
- * Extension method that allows to provide different features that are not supported by all
- * repository types.
- *
- * @param clazz The feature class that is requested
- * @param <T> This is the class of the feature
- * @return The feature implementation for this repository instance, if it is supported
- * @throws UnsupportedFeatureException if the feature is not supported by this repository type
- */
- <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException;
-
-
- /**
- * Returns true, if the requested feature is supported by this repository.
- *
- * @param clazz The requested feature class
- * @param <T> The requested feature class
- * @return True, if the feature is supported, otherwise false.
- */
- <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz);
-
-
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryCapabilities.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryCapabilities.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryCapabilities.java
deleted file mode 100644
index 525d521..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryCapabilities.java
+++ /dev/null
@@ -1,99 +0,0 @@
-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.Set;
-
-/**
- * Describe the capabilities a repository implementation supports.
- */
-public interface RepositoryCapabilities {
-
- /**
- * Returns true, if this repository has a mechanism for indexes
- * @return true, if this repository is indexable, otherwise false.
- */
- default boolean isIndexable() {
- return true;
- }
-
- /**
- * Returns true, if this repository type is storing its artifacts on the filesystem.
- * @return true, if this is a file based repository, otherwise false.
- */
- default boolean isFileBased() {
- return true;
- }
-
- /**
- * Returns true, if this repository allows to block redeployments to prevent overriding
- * released artifacts
- * @return true, if this repo can block redeployments, otherwise false.
- */
- default boolean canBlockRedeployments() {
- return true;
- }
-
- /**
- * Returns true, if the artifacts can be scanned for metadata retrieval or maintenance tasks
- * @return true, if this repository can be scanned regularily, otherwise false.
- */
- default boolean isScannable() {
- return true;
- }
-
- /**
- * Returns true, if this repository can use failover repository urls
- * @return true, if there is a failover mechanism for repository access, otherwise false.
- */
- default boolean allowsFailover() {
- return false;
- }
-
- /**
- * Returns the release schemes this repository type can handle
- */
- Set<ReleaseScheme> supportedReleaseSchemes();
-
- /**
- * Returns the layouts this repository type can provide
- * @return The list of layouts supported by this repository.
- */
- Set<String> supportedLayouts();
-
- /**
- * Returns additional capabilities, that this repository type implements.
- * @return A list of custom capabilities.
- */
- Set<String> customCapabilities();
-
- /**
- * Returns the supported features this repository type supports. This method returns
- * string that corresponds to fully qualified class names.
- * We use string representation to allow implementations provide their own feature
- * implementations if necessary and to avoid class errors.
- *
- * @return The list of supported features as string values.
- */
- Set<String> supportedFeatures();
-
-
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContent.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContent.java
deleted file mode 100644
index 2ceedec..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-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.model.ArtifactReference;
-import org.apache.archiva.model.VersionedReference;
-import org.apache.archiva.repository.layout.LayoutException;
-
-
-/**
- * Common aspects of content provider interfaces
- */
-public interface RepositoryContent
-{
-
-
- /**
- * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
- *
- * @param path the path relative to the repository base dir for the artifact.
- * @return the {@link ArtifactReference} representing the path. (or null if path cannot be converted to
- * a {@link ArtifactReference})
- * @throws LayoutException if there was a problem converting the path to an artifact.
- */
- ArtifactReference toArtifactReference( String path )
- throws LayoutException;
-
- /**
- * Given an {@link ArtifactReference}, return the relative path to the artifact.
- *
- * @param reference the artifact reference to use.
- * @return the relative path to the artifact.
- */
- String toPath( ArtifactReference reference );
-}
http://git-wip-us.apache.org/repos/asf/archiva/blob/e2cdbc2b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContentFactory.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContentFactory.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContentFactory.java
deleted file mode 100644
index 65d54e6..0000000
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryContentFactory.java
+++ /dev/null
@@ -1,216 +0,0 @@
-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.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.redback.components.registry.Registry;
-import org.apache.archiva.redback.components.registry.RegistryListener;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * RepositoryContentRequest
- */
-@Service( "repositoryContentFactory#default" )
-public class RepositoryContentFactory
- implements RegistryListener
-{
- /**
- *
- */
- @Inject
- private ArchivaConfiguration archivaConfiguration;
-
- @Inject
- private ApplicationContext applicationContext;
-
- @Inject
- private List<RepositoryContentProvider> repositoryContentProviders;
-
- private final Map<String, ManagedRepositoryContent> managedContentMap;
-
- private final Map<String, RemoteRepositoryContent> remoteContentMap;
-
-
- public RepositoryContentFactory( )
- {
- managedContentMap = new ConcurrentHashMap<String, ManagedRepositoryContent>( );
- remoteContentMap = new ConcurrentHashMap<String, RemoteRepositoryContent>( );
- }
-
- /**
- * Get the ManagedRepositoryContent object for the repository Id specified.
- *
- * @param repoId the repository id to fetch.
- * @return the ManagedRepositoryContent object associated with the repository id.
- * @throws RepositoryNotFoundException if the repository id does not exist within the configuration.
- * @throws RepositoryException the repository content object cannot be loaded due to configuration issue.
- */
- public ManagedRepositoryContent getManagedRepositoryContent( String repoId )
- throws RepositoryException
- {
- ManagedRepositoryContent repo = managedContentMap.get( repoId );
-
- if ( repo != null )
- {
- return repo;
- }
- else
- {
- throw new RepositoryNotFoundException(
- "Unable to find managed repository configuration for id " + repoId );
- }
-
- }
-
- private RepositoryContentProvider getProvider(final String layout, final RepositoryType repoType) throws RepositoryException
- {
- return repositoryContentProviders.stream().filter(p->p.supports( repoType ) && p.supportsLayout( layout )).
- findFirst().orElseThrow( ( ) -> new RepositoryException( "Could not find content provider for repository type "+repoType+" and layout "+layout ) );
- }
-
- public ManagedRepositoryContent getManagedRepositoryContent( org.apache.archiva.repository.ManagedRepository mRepo )
- throws RepositoryException
- {
- final String id = mRepo.getId();
- ManagedRepositoryContent content = managedContentMap.get( id );
-
- if ( content != null && content.getRepository()==mRepo)
- {
- return content;
- }
-
- RepositoryContentProvider contentProvider = getProvider( mRepo.getLayout( ), mRepo.getType( ) );
- content = contentProvider.createManagedContent( mRepo );
- if (content==null) {
- throw new RepositoryException( "Could not create repository content instance for "+mRepo.getId() );
- }
- ManagedRepositoryContent previousContent = managedContentMap.put( id, content );
- if (previousContent!=null) {
- previousContent.setRepository( null );
- }
-
- return content;
- }
-
- public RemoteRepositoryContent getRemoteRepositoryContent( String repoId )
- throws RepositoryException
- {
- RemoteRepositoryContent repo = remoteContentMap.get( repoId );
-
- if ( repo != null )
- {
- return repo;
- }
- else
- {
- throw new RepositoryNotFoundException(
- "Unable to find remote repository configuration for id:" + repoId );
- }
-
- }
-
- public RemoteRepositoryContent getRemoteRepositoryContent( RemoteRepository mRepo )
- throws RepositoryException
- {
- final String id = mRepo.getId();
- RemoteRepositoryContent content = remoteContentMap.get( id );
-
- if ( content != null && content.getRepository()==mRepo)
- {
- return content;
- }
-
- RepositoryContentProvider contentProvider = getProvider( mRepo.getLayout( ), mRepo.getType( ) );
- content = contentProvider.createRemoteContent( mRepo );
- if (content==null) {
- throw new RepositoryException( "Could not create repository content instance for "+mRepo.getId() );
- }
- RemoteRepositoryContent previousContent = remoteContentMap.put( id, content );
- if (previousContent!=null) {
- previousContent.setRepository( null );
- }
- return content;
- }
-
-
- @Override
- public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
- {
- if ( ConfigurationNames.isManagedRepositories( propertyName ) || ConfigurationNames.isRemoteRepositories(
- propertyName ) )
- {
- initMaps( );
- }
- }
-
- @Override
- public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
- {
- /* do nothing */
- }
-
- @PostConstruct
- public void initialize( )
- {
- archivaConfiguration.addChangeListener( this );
- }
-
- private void initMaps( )
- {
- // olamy we use concurent so no need of synchronize
- //synchronized ( managedContentMap )
- //{
- managedContentMap.clear( );
- //}
-
- //synchronized ( remoteContentMap )
- //{
- remoteContentMap.clear( );
- //}
- }
-
- public ArchivaConfiguration getArchivaConfiguration( )
- {
- return archivaConfiguration;
- }
-
- public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
- {
- this.archivaConfiguration = archivaConfiguration;
- }
-
- public void setRepositoryContentProviders(List<RepositoryContentProvider> providers) {
- this.repositoryContentProviders = providers;
- }
-
- public List<RepositoryContentProvider> getRepositoryContentProviders() {
- return repositoryContentProviders;
- }
-}