diff options
author | Olivier Lamy <olamy@apache.org> | 2011-05-27 17:30:30 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-05-27 17:30:30 +0000 |
commit | 9c81940d213d321e38f0cb6129abcf121a3ba732 (patch) | |
tree | 64aa0f9f437dbd828f2a0d8879a53d429bf95206 /archiva-modules/archiva-base | |
parent | 789083836c3afe55278a7382b70262e279afa623 (diff) | |
download | archiva-9c81940d213d321e38f0cb6129abcf121a3ba732.tar.gz archiva-9c81940d213d321e38f0cb6129abcf121a3ba732.zip |
oups missed to add files
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1128406 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
3 files changed, 105 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultWagonFactory.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultWagonFactory.java new file mode 100755 index 000000000..c977f434d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultWagonFactory.java @@ -0,0 +1,43 @@ +package org.apache.maven.archiva.proxy; + +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/src/main/java/org/apache/maven/archiva/proxy/WagonFactoryException.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/WagonFactoryException.java new file mode 100755 index 000000000..dca2a35ce --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/WagonFactoryException.java @@ -0,0 +1,14 @@ +package org.apache.maven.archiva.proxy; + +/** + * @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/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml new file mode 100755 index 000000000..84f08847d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml @@ -0,0 +1,48 @@ +<?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.metadata.repository"/> + + <alias name="archivaConfiguration#mock" alias="archivaConfiguration#default"/> + <alias name="archivaConfiguration#mock" alias="archivaConfiguration"/> + + <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler"> + <property name="properties"> + <props> + <prop key="org.quartz.scheduler.instanceName">scheduler1</prop> + <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop> + <prop key="org.quartz.threadPool.threadCount">1</prop> + <prop key="org.quartz.threadPool.threadPriority">4</prop> + <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop> + </props> + </property> + </bean> + +</beans>
\ No newline at end of file |