aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-proxy-common/src/main
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2011-06-15 09:36:05 +0000
committerMaria Odea B. Ching <oching@apache.org>2011-06-15 09:36:05 +0000
commitdab1e929905186a20423260d0f1ce275eef4add2 (patch)
treec5d077042334c5db89c6492d22f68908ae534579 /archiva-modules/archiva-base/archiva-proxy-common/src/main
parent90df2242acd0eb69d7fcc31e0513cef0e42b1a25 (diff)
downloadarchiva-dab1e929905186a20423260d0f1ce275eef4add2.tar.gz
archiva-dab1e929905186a20423260d0f1ce275eef4add2.zip
[MRM-1411] project information is missing if a POM could not be read correctly
o proxy parent POM if not found in the repo when building the effective POM when creating metadata (also applied the same in dependency tree builder) o added unit tests o moved out wagonfactory classes into separate module so it can be used by maven2-repository w/o depending on archiva-proxy module (as it inroduces cyclic dependency) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135978 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy-common/src/main')
-rwxr-xr-xarchiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java62
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactory.java38
-rwxr-xr-xarchiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryException.java33
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml34
4 files changed, 167 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java
new file mode 100755
index 000000000..f2631c051
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java
@@ -0,0 +1,62 @@
+package org.apache.archiva.proxy.common;
+
+/*
+ * 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.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.wagon.Wagon;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Service( "wagonFactory" )
+public class DefaultWagonFactory
+ implements WagonFactory
+{
+
+ private PlexusSisuBridge plexusSisuBridge;
+
+ @Inject
+ public DefaultWagonFactory( PlexusSisuBridge plexusSisuBridge )
+ {
+ this.plexusSisuBridge = plexusSisuBridge;
+ }
+
+ public Wagon getWagon( String protocol )
+ throws WagonFactoryException
+ {
+ try
+ {
+ // with sisu inject bridge hint is file or http
+ // so remove wagon#
+ protocol = StringUtils.remove( protocol, "wagon#" );
+ return plexusSisuBridge.lookup( Wagon.class, protocol );
+ }
+ catch ( PlexusSisuBridgeException e )
+ {
+ throw new WagonFactoryException( e.getMessage(), e );
+ }
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactory.java b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactory.java
new file mode 100644
index 000000000..3768f8e3b
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactory.java
@@ -0,0 +1,38 @@
+package org.apache.archiva.proxy.common;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.wagon.Wagon;
+
+/**
+ * Create a Wagon instance for the given protocol.
+ */
+public interface WagonFactory
+{
+ /**
+ * Create a new Wagon instance for the given protocol.
+ *
+ * @param protocol the protocol to find the Wagon for, which must be prefixed with <code>wagon#</code>, for example
+ * <code>wagon#http</code>.
+ * @return the Wagon instance
+ */
+ Wagon getWagon( String protocol )
+ throws WagonFactoryException;
+}
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryException.java b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryException.java
new file mode 100755
index 000000000..aba311cf5
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryException.java
@@ -0,0 +1,33 @@
+package org.apache.archiva.proxy.common;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class WagonFactoryException
+ extends Exception
+{
+ public WagonFactoryException( String message, Throwable e )
+ {
+ super( message, e );
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
new file mode 100644
index 000000000..eaf7b4146
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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"
+ 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"
+ default-lazy-init="true">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.archiva.proxy.common"/>
+
+
+</beans> \ No newline at end of file