fix consumer archetype

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-11-04 21:28:51 +00:00
parent 6963879067
commit 1c437a85fb
8 changed files with 182 additions and 12 deletions

View File

@ -7,7 +7,7 @@
<version>${version}</version> <version>${version}</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Simple Archiva Consumer</name> <name>Simple Archiva Consumer</name>
<url>http://maven.apache.org</url> <url>http://archiva.apache.org</url>
<description> <description>
This is a simple consumer component which demonstrates how a This is a simple consumer component which demonstrates how a
component can be plugged in Archiva. component can be plugged in Archiva.
@ -48,12 +48,72 @@
<version>4.9</version> <version>4.9</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-admin-default</artifactId>
<version>${archiva.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-store-jcr</artifactId>
<version>${archiva.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.redback</groupId>
<artifactId>redback-common-test-resources</artifactId>
<scope>test</scope>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.redback</groupId>
<artifactId>redback-rbac-memory</artifactId>
<scope>test</scope>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.redback</groupId>
<artifactId>redback-rbac-cached</artifactId>
<scope>test</scope>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.redback</groupId>
<artifactId>redback-rbac-role-manager</artifactId>
<scope>test</scope>
<version>1.4-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions> <executions>
<execution> <execution>
<id>package</id> <id>package</id>
@ -61,7 +121,7 @@
<configuration> <configuration>
<tasks> <tasks>
<echo> <echo>
Remember to add the the following to the knownconsumers section in ~/.m2/archiva.xml Remember to add the the following to the knownconsumers section in your archiva.xml file
&lt;knownContentConsumer>simple-artifact-consumer&lt;/knownContentConsumer> &lt;knownContentConsumer>simple-artifact-consumer&lt;/knownContentConsumer>
</echo> </echo>
</tasks> </tasks>
@ -75,11 +135,26 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration> <configuration>
<source>1.5</source> <source>1.5</source>
<target>1.5</target> <target>1.5</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<systemPropertyVariables>
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
<test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
<redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
<redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<repositories> <repositories>
@ -93,5 +168,16 @@
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
</repository> </repository>
<repository>
<id>redback.snapshots</id>
<name>Codehaus Redback Snapshots Repository</name>
<url>http://snapshots.repository.codehaus.org/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories> </repositories>
</project> </project>

View File

@ -0,0 +1,32 @@
<?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"
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="$package"/>
</beans>

View File

@ -0,0 +1,36 @@
<?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.
-->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
</layout>
</appender>
<root>
<priority value ="info" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@ -29,6 +29,25 @@
<context:annotation-config/> <context:annotation-config/>
<context:component-scan base-package="$package"/> <context:component-scan base-package="$package"/>
<bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
<constructor-arg value="${appserver.base}/conf/foo.xml"/>
<constructor-arg value="${appserver.base}/data/jcr"/>
</bean>
<bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true">
<constructor-arg ref="jcr-config"/>
</bean>
<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">2</prop>
<prop key="org.quartz.threadPool.threadPriority">4</prop>
<prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
</props>
</property>
</bean>
</beans> </beans>

View File

@ -28,6 +28,7 @@ import org.codehaus.plexus.redback.rbac.RbacObjectNotFoundException;
import org.codehaus.plexus.redback.rbac.Resource; import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.redback.rbac.Role; import org.codehaus.plexus.redback.rbac.Role;
import org.codehaus.plexus.redback.rbac.UserAssignment; import org.codehaus.plexus.redback.rbac.UserAssignment;
import org.codehaus.plexus.redback.rbac.memory.MemoryResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collection; import java.util.Collection;
@ -197,43 +198,41 @@ public class TestRBACManager implements RBACManager
public boolean operationExists( Operation operation ) public boolean operationExists( Operation operation )
{ {
return false; //To change body of implemented methods use File | Settings | File Templates. return false;
} }
public Operation saveOperation( Operation operation ) public Operation saveOperation( Operation operation )
throws RbacObjectInvalidException, RbacManagerException throws RbacObjectInvalidException, RbacManagerException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null;
} }
public Operation getOperation( String operationName ) public Operation getOperation( String operationName )
throws RbacObjectNotFoundException, RbacManagerException throws RbacObjectNotFoundException, RbacManagerException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null;
} }
public List<Operation> getAllOperations() public List<Operation> getAllOperations()
throws RbacManagerException throws RbacManagerException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null;
} }
public void removeOperation( Operation operation ) public void removeOperation( Operation operation )
throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
{ {
//To change body of implemented methods use File | Settings | File Templates.
} }
public void removeOperation( String operationName ) public void removeOperation( String operationName )
throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
{ {
//To change body of implemented methods use File | Settings | File Templates.
} }
public Resource createResource( String identifier ) public Resource createResource( String identifier )
throws RbacManagerException throws RbacManagerException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return new MemoryResource();
} }
public boolean resourceExists( String identifier ) public boolean resourceExists( String identifier )

View File

@ -30,7 +30,6 @@
<name>Archiva Web :: Application</name> <name>Archiva Web :: Application</name>
<properties> <properties>
<jettyVersion>7.4.5.v20110725</jettyVersion>
<archiva.baseRestUrl /> <archiva.baseRestUrl />
<rest.admin.pwd /> <rest.admin.pwd />
</properties> </properties>

View File

@ -37,7 +37,6 @@ public class ArchivaJcrRepositoryConfig
if ( !homeFile.exists( ) ) if ( !homeFile.exists( ) )
{ {
homeFile.mkdirs( ); homeFile.mkdirs( );
} }
File configurationFile = new File( file ); File configurationFile = new File( file );