]> source.dussan.org Git - archiva.git/commitdiff
make archiva-webapp-js/ started with tomcat:run
authorOlivier Lamy <olamy@apache.org>
Fri, 9 Dec 2011 00:29:35 +0000 (00:29 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 9 Dec 2011 00:29:35 +0000 (00:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1212197 13f79535-47bb-0310-9956-ffa450edef68

18 files changed:
.gitignore
archiva-modules/archiva-web/archiva-webapp-js/pom.xml
archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/Banner.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml [new file with mode: 0755]
archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/org/apache/archiva/security.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/org/apache/archiva/security_en.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/web.xml
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.jsp [deleted file]
archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/auto-admin-creation.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/log4j.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/tomcat-context-archiva.xml [new file with mode: 0644]
pom.xml

index 12aa07fa01523d1f9633fc100d4793c1f9bea6d7..3f91650c9cb5cf91e65e222d065da3efbb30c00e 100644 (file)
@@ -12,6 +12,9 @@ archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/classes/
 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/redback/
 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/lib/
 archiva-modules/archiva-web/archiva-webapp-test/cargo-installs/
+
+archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/classes/
+
 *.ipr
 *.iws
 .DS_Store
index 01efe76fc50288817cd223a5650665b6582db4ac..7a0e557d5a564ba3c5a49eb9b94ddbe823fe3033 100644 (file)
   ~ See the License for the specific language governing permissions and\r
   ~ limitations under the License.\r
   -->\r
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
   <modelVersion>4.0.0</modelVersion>\r
   <parent>\r
     <groupId>org.apache.archiva</groupId>\r
-    <artifactId>archiva-modules</artifactId>\r
+    <artifactId>archiva-web</artifactId>\r
     <version>1.4-M2-SNAPSHOT</version>\r
   </parent>\r
   <artifactId>archiva-webapp-js</artifactId>\r
 \r
   <name>Archiva Web :: Javascript Application</name>\r
 \r
+  <properties>\r
+    <tomcatContextXml>${basedir}/src/test/tomcat/tomcat-context.xml</tomcatContextXml>\r
+  </properties>\r
+\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>generic-metadata-support</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>npanday-support</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>repository-statistics</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>problem-reports</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>audit</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-scheduler-repository</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-indexer</artifactId>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-repository-admin-api</artifactId>\r
+    </dependency>\r
+\r
+\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-repository-admin-default</artifactId>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>metadata-repository-api</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>metadata-store-jcr</artifactId>\r
+      <scope>runtime</scope>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.jackrabbit</groupId>\r
+      <artifactId>jackrabbit-core</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>commons-logging</groupId>\r
+          <artifactId>commons-logging</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>org.apache.velocity</groupId>\r
+      <artifactId>velocity</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.velocity</groupId>\r
+      <artifactId>velocity-tools</artifactId>\r
+      <version>1.3</version>\r
+      <scope>runtime</scope>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>commons-logging</groupId>\r
+          <artifactId>commons-logging</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>velocity</groupId>\r
+          <artifactId>velocity-dep</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>velocity</groupId>\r
+          <artifactId>velocity</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>struts</groupId>\r
+          <artifactId>struts</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <!--  FIXME: temporary coupling to plugin, should be runtime -->\r
+      <artifactId>maven2-repository</artifactId>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>org.codehaus.plexus</groupId>\r
+      <artifactId>plexus-slf4j-logging</artifactId>\r
+      <scope>runtime</scope>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>org.codehaus.plexus</groupId>\r
+          <artifactId>plexus-component-api</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.codehaus.plexus</groupId>\r
+      <artifactId>plexus-utils</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.maven.indexer</groupId>\r
+      <artifactId>indexer-core</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>org.codehaus.plexus</groupId>\r
+          <artifactId>plexus-container-default</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>classworlds</groupId>\r
+          <artifactId>classworlds</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>commons-logging</groupId>\r
+          <artifactId>commons-logging</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>velocity</groupId>\r
+          <artifactId>velocity-dep</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.maven</groupId>\r
+          <artifactId>maven-plugin-registry</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.maven</groupId>\r
+          <artifactId>maven-settings</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>com.google.code.atinject</groupId>\r
+          <artifactId>atinject</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-proxy</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-repository-layer</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-xml-tools</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>xerces</groupId>\r
+          <artifactId>xercesImpl</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-security</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-core-consumers</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-configuration</artifactId>\r
+      <!-- TODO uncomment when repository admin will be finished\r
+      <scope>runtime</scope>\r
+      -->\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-metadata-consumer</artifactId>\r
+      <scope>runtime</scope>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-lucene-consumers</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>stage-repository-merge</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-signature-consumers</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-applet</artifactId>\r
+      <!-- TODO: actually, just exclude from WAR plugin -->\r
+      <scope>provided</scope>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-rss</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-xmlrpc-api</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-xmlrpc-services</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-xmlrpc-security</artifactId>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>org.codehaus.redback</groupId>\r
+      <artifactId>redback-xmlrpc-services</artifactId>\r
+      <scope>runtime</scope>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.codehaus.redback</groupId>\r
+      <artifactId>redback-xmlrpc-security</artifactId>\r
+      <scope>runtime</scope>\r
+    </dependency>\r
+\r
+    <dependency>\r
+\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-rest-services</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-server</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-continuation</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-http</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-io</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-util</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-security</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>commons-logging</groupId>\r
+          <artifactId>commons-logging</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-servlet_3.0_spec</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-javamail_1.4_spec</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-servlet_2.5_spec</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-rest-api</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-server</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-continuation</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-http</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-io</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-util</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-security</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>commons-logging</groupId>\r
+          <artifactId>commons-logging</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-servlet_3.0_spec</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-javamail_1.4_spec</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-servlet_2.5_spec</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>javax.servlet</groupId>\r
+      <artifactId>servlet-api</artifactId>\r
+      <scope>provided</scope>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>org.apache.archiva</groupId>\r
+      <artifactId>archiva-webdav</artifactId>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>jpox</groupId>\r
+      <artifactId>jpox</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>javax.transaction</groupId>\r
+          <artifactId>jta</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>jpox</groupId>\r
+      <artifactId>jpox-ehcache</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>commons-logging</groupId>\r
+          <artifactId>commons-logging</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>ehcache</groupId>\r
+          <artifactId>ehcache</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+\r
+    <dependency>\r
+      <groupId>org.codehaus.redback</groupId>\r
+      <artifactId>redback-rest-services</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.codehaus.redback</groupId>\r
+      <artifactId>redback-common-integrations</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>stax</groupId>\r
+          <artifactId>stax-api</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.codehaus.redback</groupId>\r
+      <artifactId>redback-integrations-security</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.slf4j</groupId>\r
+      <artifactId>slf4j-log4j12</artifactId>\r
+      <scope>runtime</scope>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.slf4j</groupId>\r
+      <artifactId>jcl-over-slf4j</artifactId>\r
+      <scope>runtime</scope>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.apache.cxf</groupId>\r
+      <artifactId>cxf-bundle-jaxrs</artifactId>\r
+      <exclusions>\r
+        <exclusion>\r
+          <groupId>org.eclipse.jetty</groupId>\r
+          <artifactId>jetty-server</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-servlet_2.5_spec</artifactId>\r
+        </exclusion>\r
+        <exclusion>\r
+          <groupId>org.apache.geronimo.specs</groupId>\r
+          <artifactId>geronimo-javamail_1.4_spec</artifactId>\r
+        </exclusion>\r
+      </exclusions>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.springframework</groupId>\r
+      <artifactId>spring-core</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.springframework</groupId>\r
+      <artifactId>spring-web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>javax.servlet</groupId>\r
+      <artifactId>servlet-api</artifactId>\r
+      <scope>provided</scope>\r
+    </dependency>\r
+  </dependencies>\r
+\r
+  <build>\r
+\r
+    <resources>\r
+      <resource>\r
+        <directory>src/main/resources</directory>\r
+      </resource>\r
+      <resource>\r
+        <directory>src/main/filtered-resources</directory>\r
+        <filtering>true</filtering>\r
+      </resource>\r
+    </resources>\r
+\r
+    <plugins>\r
+\r
+      <plugin>\r
+        <groupId>org.codehaus.mojo</groupId>\r
+        <artifactId>tomcat-maven-plugin</artifactId>\r
+        <configuration>\r
+          <port>9091</port>\r
+          <path>/archiva</path>\r
+          <contextFile>${tomcatContextXml}</contextFile>\r
+          <systemProperties>\r
+            <plexus.home>${project.build.directory}/appserver-base</plexus.home>\r
+            <appserver.base>${project.build.directory}/appserver-base</appserver.base>\r
+            <appserver.home>${project.build.directory}/appserver-home</appserver.home>\r
+            <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>\r
+            <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>\r
+            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>\r
+          </systemProperties>\r
+        </configuration>\r
+        <dependencies>\r
+          <dependency>\r
+            <groupId>org.apache.derby</groupId>\r
+            <artifactId>derby</artifactId>\r
+            <version>${derbyVersion}</version>\r
+          </dependency>\r
+          <dependency>\r
+            <groupId>javax.mail</groupId>\r
+            <artifactId>mail</artifactId>\r
+            <version>${javaxMailVersion}</version>\r
+          </dependency>\r
+        </dependencies>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+\r
+  <profiles>\r
+    <profile>\r
+      <!-- profile for dev an log output in the console -->\r
+      <id>dev</id>\r
+      <build>\r
+        <plugins>\r
+          <plugin>\r
+            <artifactId>maven-antrun-plugin</artifactId>\r
+            <executions>\r
+              <execution>\r
+                <id>override-log4j-with-console-output</id>\r
+                <phase>process-resources</phase>\r
+                <goals>\r
+                  <goal>run</goal>\r
+                </goals>\r
+                <configuration>\r
+                  <tasks>\r
+                    <copy overwrite="true" file="${basedir}/src/test/tomcat/log4j.xml"\r
+                          todir="${basedir}/src/main/webapp/WEB-INF/classes"/>\r
+                    <copy overwrite="true" file="${basedir}/src/test/tomcat/auto-admin-creation.properties"\r
+                          todir="${basedir}/target/"/>\r
+                  </tasks>\r
+                </configuration>\r
+              </execution>\r
+            </executions>\r
+          </plugin>\r
+        </plugins>\r
+      </build>\r
+    </profile>\r
+    <profile>\r
+      <!-- olamy profile to test tomcat plugin dev -->\r
+      <id>tdev</id>\r
+      <build>\r
+        <plugins>\r
+          <plugin>\r
+            <groupId>org.apache.tomcat.maven</groupId>\r
+            <artifactId>tomcat6-maven-plugin</artifactId>\r
+            <configuration>\r
+              <port>9090</port>\r
+              <path>/</path>\r
+              <contextFile>${tomcatContextXml}</contextFile>\r
+              <systemProperties>\r
+                <plexus.home>${project.build.directory}/appserver-base</plexus.home>\r
+                <appserver.base>${project.build.directory}/appserver-base</appserver.base>\r
+                <appserver.home>${project.build.directory}/appserver-home</appserver.home>\r
+                <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>\r
+                <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties\r
+                </redback.admin.creation.file>\r
+                <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>\r
+              </systemProperties>\r
+            </configuration>\r
+            <dependencies>\r
+              <dependency>\r
+                <groupId>org.apache.derby</groupId>\r
+                <artifactId>derby</artifactId>\r
+                <version>${derbyVersion}</version>\r
+              </dependency>\r
+              <dependency>\r
+                <groupId>javax.mail</groupId>\r
+                <artifactId>mail</artifactId>\r
+                <version>1.4</version>\r
+              </dependency>\r
+            </dependencies>\r
+          </plugin>\r
+          <plugin>\r
+            <groupId>org.apache.tomcat.maven</groupId>\r
+            <artifactId>tomcat7-maven-plugin</artifactId>\r
+            <version>2.0-SNAPSHOT</version>\r
+            <configuration>\r
+              <port>9090</port>\r
+              <path>/</path>\r
+              <contextFile>${tomcatContextXml}</contextFile>\r
+              <systemProperties>\r
+                <plexus.home>${project.build.directory}/appserver-base</plexus.home>\r
+                <appserver.base>${project.build.directory}/appserver-base</appserver.base>\r
+                <appserver.home>${project.build.directory}/appserver-home</appserver.home>\r
+                <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>\r
+                <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties\r
+                </redback.admin.creation.file>\r
+                <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>\r
+              </systemProperties>\r
+            </configuration>\r
+            <dependencies>\r
+              <dependency>\r
+                <groupId>org.apache.derby</groupId>\r
+                <artifactId>derby</artifactId>\r
+                <version>${derbyVersion}</version>\r
+              </dependency>\r
+              <dependency>\r
+                <groupId>javax.mail</groupId>\r
+                <artifactId>mail</artifactId>\r
+                <version>1.4</version>\r
+              </dependency>\r
+            </dependencies>\r
+          </plugin>\r
+        </plugins>\r
+      </build>\r
+    </profile>\r
+  </profiles>\r
+\r
 </project>\r
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties b/archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties
new file mode 100644 (file)
index 0000000..12806aa
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+user.agent=Apache Archiva/${project.version}
+archiva.version=${project.version}
+archiva.buildNumber=${buildNumber}
+archiva.timestamp=${timestamp}
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java
new file mode 100644 (file)
index 0000000..5822902
--- /dev/null
@@ -0,0 +1,64 @@
+package org.apache.archiva.web.spring;
+
+/*
+ * 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.events.RepositoryListener;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+import java.util.List;
+
+/**
+ * @todo though we will eventually remove this altogether, an interim cleanup would be to genericise this
+ * and replace the calls in RepositoryContentConsumers with calls to the same thing
+ */
+public class RepositoryListenerFactoryBean
+    implements FactoryBean, ApplicationContextAware
+{
+
+    private ApplicationContext applicationContext;
+
+    public void setApplicationContext( ApplicationContext applicationContext )
+        throws BeansException
+    {
+        this.applicationContext = applicationContext;
+    }
+
+    public Object getObject()
+        throws Exception
+    {
+        return applicationContext.getBeansOfType( RepositoryListener.class ).values();
+    }
+
+    @SuppressWarnings("unchecked")
+    public Class<List> getObjectType()
+    {
+        return List.class;
+    }
+
+    public boolean isSingleton()
+    {
+        return true;
+    }
+
+    
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java
new file mode 100644 (file)
index 0000000..46aca0b
--- /dev/null
@@ -0,0 +1,208 @@
+package org.apache.archiva.web.startup;
+
+/*
+ * 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.ArchivaException;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
+import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
+import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.context.IndexingContext;
+import org.codehaus.plexus.taskqueue.Task;
+import org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor;
+import org.codehaus.redback.components.scheduler.DefaultScheduler;
+import org.quartz.SchedulerException;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.lang.reflect.Field;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * ArchivaStartup - the startup of all archiva features in a deterministic order.
+ *
+ * @version $Id$
+ */
+public class ArchivaStartup
+    implements ServletContextListener
+{
+    private ThreadedTaskQueueExecutor tqeDbScanning;
+
+    private ThreadedTaskQueueExecutor tqeRepoScanning;
+
+    private ThreadedTaskQueueExecutor tqeIndexing;
+
+    private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
+
+    private PlexusSisuBridge plexusSisuBridge;
+
+    private NexusIndexer nexusIndexer;
+
+    public void contextInitialized( ServletContextEvent contextEvent )
+    {
+        WebApplicationContext wac =
+            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );
+
+        SecuritySynchronization securitySync = wac.getBean( SecuritySynchronization.class );
+
+        repositoryTaskScheduler =
+            wac.getBean( "archivaTaskScheduler#repository", RepositoryArchivaTaskScheduler.class );
+
+        Properties archivaRuntimeProperties = wac.getBean( "archivaRuntimeProperties", Properties.class );
+
+        tqeRepoScanning = wac.getBean( "taskQueueExecutor#repository-scanning", ThreadedTaskQueueExecutor.class );
+
+        tqeIndexing = wac.getBean( "taskQueueExecutor#indexing", ThreadedTaskQueueExecutor.class );
+
+        plexusSisuBridge = wac.getBean( PlexusSisuBridge.class );
+
+        try
+        {
+            nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
+        }
+        catch ( PlexusSisuBridgeException e )
+        {
+            throw new RuntimeException( "Unable to get NexusIndexer: " + e.getMessage(), e );
+        }
+        try
+        {
+            securitySync.startup();
+            repositoryTaskScheduler.startup();
+            Banner.display( (String) archivaRuntimeProperties.get( "archiva.version" ) );
+        }
+        catch ( ArchivaException e )
+        {
+            throw new RuntimeException( "Unable to properly startup archiva: " + e.getMessage(), e );
+        }
+    }
+
+    public void contextDestroyed( ServletContextEvent contextEvent )
+    {
+        WebApplicationContext applicationContext =
+            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );
+
+        // TODO check this stop
+
+        /*
+        if ( applicationContext != null && applicationContext instanceof ClassPathXmlApplicationContext )
+        {
+            ( (ClassPathXmlApplicationContext) applicationContext ).close();
+        } */
+
+        if ( applicationContext != null ) //&& applicationContext instanceof PlexusWebApplicationContext )
+        {
+            // stop task queue executors
+            stopTaskQueueExecutor( tqeDbScanning );
+            stopTaskQueueExecutor( tqeRepoScanning );
+            stopTaskQueueExecutor( tqeIndexing );
+
+            // stop the DefaultArchivaTaskScheduler and its scheduler
+            if ( repositoryTaskScheduler != null )
+            {
+                try
+                {
+                    repositoryTaskScheduler.stop();
+                }
+                catch ( SchedulerException e )
+                {
+                    e.printStackTrace();
+                }
+
+                try
+                {
+                    // shutdown the scheduler, otherwise Quartz scheduler and Threads still exists
+                    Field schedulerField = repositoryTaskScheduler.getClass().getDeclaredField( "scheduler" );
+                    schedulerField.setAccessible( true );
+
+                    DefaultScheduler scheduler = (DefaultScheduler) schedulerField.get( repositoryTaskScheduler );
+                    scheduler.stop();
+                }
+                catch ( Exception e )
+                {
+                    e.printStackTrace();
+                }
+            }
+
+            // close the application context
+            //applicationContext.close();
+            // TODO fix close call
+            //applicationContext.
+        }
+
+        // closing correctly indexer to close correctly lock and file
+        for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
+        {
+            try
+            {
+                indexingContext.close( false );
+            }
+            catch ( Exception e )
+            {
+                contextEvent.getServletContext().log( "skip error closing indexingContext " + e.getMessage() );
+            }
+        }
+
+    }
+
+    private void stopTaskQueueExecutor( ThreadedTaskQueueExecutor taskQueueExecutor )
+    {
+        if ( taskQueueExecutor != null )
+        {
+            Task currentTask = taskQueueExecutor.getCurrentTask();
+            if ( currentTask != null )
+            {
+                taskQueueExecutor.cancelTask( currentTask );
+            }
+
+            try
+            {
+                taskQueueExecutor.stop();
+                ExecutorService service = getExecutorServiceForTTQE( taskQueueExecutor );
+                if ( service != null )
+                {
+                    service.shutdown();
+                }
+            }
+            catch ( Exception e )
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private ExecutorService getExecutorServiceForTTQE( ThreadedTaskQueueExecutor ttqe )
+    {
+        ExecutorService service = null;
+        try
+        {
+            Field executorServiceField = ttqe.getClass().getDeclaredField( "executorService" );
+            executorServiceField.setAccessible( true );
+            service = (ExecutorService) executorServiceField.get( ttqe );
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
+        return service;
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/Banner.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/Banner.java
new file mode 100644 (file)
index 0000000..e9272c8
--- /dev/null
@@ -0,0 +1,229 @@
+package org.apache.archiva.web.startup;
+
+/*
+ * 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.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Banner 
+ *
+ * @version $Id$
+ */
+public class Banner
+{
+    private static final String eol = System.getProperty("line.separator");
+
+    public static String encode( String raw )
+    {
+        // Canonicalize line ends to make them easier to process
+        raw = raw.replace("\r\n", "\n").replace("\r", "\n");
+
+        StringBuilder encoded = new StringBuilder();
+        int rawlen = raw.length();
+
+        for ( int i = 0; i < rawlen; i++ )
+        {
+            char c = raw.charAt( i );
+            if ( c == '\\' )
+            {
+                encoded.append( "$." );
+            }
+            else if ( c == '$' )
+            {
+                encoded.append( "$$" );
+            }
+            else if ( c == '\n' )
+            {
+                encoded.append( "$n" );
+            }
+            else if ( Character.isDigit( c ) )
+            {
+                encoded.append( c );
+            }
+            else if ( Character.isLetter( c ) )
+            {
+                encoded.append( rot13( c ) );
+            }
+            else if ( i < raw.length() - 1 )
+            {
+                char nc;
+                boolean done = false;
+                int count = 0;
+                for ( int n = i; !done; n++ )
+                {
+                    if ( n >= rawlen )
+                    {
+                        break;
+                    }
+
+                    nc = raw.charAt( n );
+
+                    if ( nc != c )
+                    {
+                        done = true;
+                    }
+                    else
+                    {
+                        count++;
+                    }
+                }
+                if ( count < 3 )
+                {
+                    encoded.append( c );
+                }
+                else
+                {
+                    encoded.append( "$" ).append( String.valueOf( count ) ).append( c );
+                    i += count - 1;
+                }
+            }
+            else
+            {
+                encoded.append( c );
+            }
+        }
+
+        return encoded.toString();
+    }
+
+    public static String decode( String encoded )
+    {
+        StringBuilder decoded = new StringBuilder();
+        int enlen = encoded.length();
+        for ( int i = 0; i < enlen; i++ )
+        {
+            char c = encoded.charAt( i );
+            if ( c == '$' )
+            {
+                char nc = encoded.charAt( i + 1 );
+                if ( nc == '$' )
+                {
+                    decoded.append( '$' );
+                    i++;
+                }
+                else if ( nc == '.' )
+                {
+                    decoded.append( '\\' );
+                    i++;
+                }
+                else if ( nc == 'n' )
+                {
+                    decoded.append( eol );
+                    i++;
+                }
+                else if ( Character.isDigit( nc ) )
+                {
+                    int count = 0;
+                    int nn = i + 1;
+                    while ( Character.isDigit( nc ) )
+                    {
+                        count = ( count * 10 );
+                        count += ( nc - '0' );
+                        nc = encoded.charAt( ++nn );
+                    }
+                    for ( int d = 0; d < count; d++ )
+                    {
+                        decoded.append( nc );
+                    }
+                    i = nn;
+                }
+            }
+            else if ( Character.isLetter( c ) )
+            {
+                decoded.append( rot13( c ) );
+            }
+            else
+            {
+                decoded.append( c );
+            }
+        }
+
+        return decoded.toString();
+    }
+
+    private static char rot13( char c )
+    {
+        if ( ( c >= 'a' ) && ( c <= 'z' ) )
+        {
+            char dc = c += 13;
+            if ( dc > 'z' )
+            {
+                dc -= 26;
+            }
+            return dc;
+        }
+        else if ( ( c >= 'A' ) && ( c <= 'Z' ) )
+        {
+            char dc = c += 13;
+            if ( dc > 'Z' )
+            {
+                dc -= 26;
+            }
+            return dc;
+        }
+        else
+        {
+            return c;
+        }
+    }
+
+    public static String injectVersion( String text, String version )
+    {
+        Pattern pat = Pattern.compile( "#{2,}" );
+        Matcher mat = pat.matcher( text );
+        StringBuilder ret = new StringBuilder();
+        int off = 0;
+
+        while ( mat.find( off ) )
+        {
+            ret.append( text.substring( off, mat.start() ) );
+            String repl = mat.group();
+            ret.append( StringUtils.center( version, repl.length() ) );
+            off = mat.end();
+        }
+
+        ret.append( text.substring( off ) );
+
+        return ret.toString();
+    }
+
+    public static String getBanner( String version )
+    {
+        String encodedBanner = "$26 $34_$n$15 /$._$7 /$34 $.$n$14 /`/@),$4 |  Ba" +
+                " orunys bs nyy bs gur nycnpnf   |$n$14 |  (~'  __| gbvyvat njnl ba " +
+                "gur Ncnpur Nepuvin |$n$6 _,--.$3_/  |$4 $.$5  cebwrpg grnz, V jbhyq y" +
+                "vxr gb$3 |$n$4 ,' ,$5 ($3 |$5 $.$5     jrypbzr lbh gb Nepuvin$6 |$" +
+                "n$4 |  ($6 $.  /$6 |  $32#  |$n$5 $.  )$._/  ,_/$7 |$36 |$n$5 / /$3 " +
+                "( |/$9 |     uggc://nepuvin.ncnpur.bet/     |$n$4 ( |$4 ( |$10 |     hf" +
+                "ref@nepuvin.ncnpur.bet$7 |$n$5 $.|$5 $.|$11 $.$34_/$n$n";
+
+        return injectVersion( decode( encodedBanner ), version );
+    }
+
+    public static void display( String version )
+    {
+        String banner = getBanner( version );
+       LoggerFactory.getLogger( Banner.class ).info( StringUtils.repeat( "_", 25 ) + eol + banner );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java
new file mode 100644 (file)
index 0000000..a49ea5a
--- /dev/null
@@ -0,0 +1,245 @@
+package org.apache.archiva.web.startup;
+
+/*
+ * 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.security.common.ArchivaRoleConstants;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.archiva.common.ArchivaException;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.ConfigurationNames;
+import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.codehaus.plexus.redback.rbac.RBACManager;
+import org.codehaus.plexus.redback.rbac.RbacManagerException;
+import org.codehaus.plexus.redback.rbac.UserAssignment;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.registry.Registry;
+import org.codehaus.plexus.registry.RegistryListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * ConfigurationSynchronization
+ *
+ * @version $Id$
+ */
+@Service
+public class SecuritySynchronization
+    implements RegistryListener
+{
+    private Logger log = LoggerFactory.getLogger( SecuritySynchronization.class );
+
+    @Inject
+    private RoleManager roleManager;
+
+    @Inject
+    @Named( value = "rBACManager#cached" )
+    private RBACManager rbacManager;
+
+    private Map<String, EnvironmentCheck> checkers;
+
+    @Inject
+    private ArchivaConfiguration archivaConfiguration;
+
+    @Inject
+    private ApplicationContext applicationContext;
+
+    @PostConstruct
+    public void initialize()
+    {
+        checkers = getBeansOfType( EnvironmentCheck.class );
+    }
+
+    protected <T> Map<String, T> getBeansOfType( Class<T> clazz )
+    {
+        //TODO do some caching here !!!
+        // olamy : with plexus we get only roleHint
+        // as per convention we named spring bean role#hint remove role# if exists
+        Map<String, T> springBeans = applicationContext.getBeansOfType( clazz );
+
+        Map<String, T> beans = new HashMap<String, T>( springBeans.size() );
+
+        for ( Entry<String, T> entry : springBeans.entrySet() )
+        {
+            String key = StringUtils.substringAfterLast( entry.getKey(), "#" );
+            beans.put( key, entry.getValue() );
+        }
+        return beans;
+    }
+
+    public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+    {
+        if ( ConfigurationNames.isManagedRepositories( propertyName ) )
+        {
+            synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
+        }
+    }
+
+    public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+    {
+        /* do nothing */
+    }
+
+    private void synchConfiguration( List<ManagedRepositoryConfiguration> repos )
+    {
+        // NOTE: Remote Repositories do not have roles or security placed around them.
+
+        for ( ManagedRepositoryConfiguration repoConfig : repos )
+        {
+            // manage roles for repositories
+            try
+            {
+                if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
+                                                       repoConfig.getId() ) )
+                {
+                    roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
+                                                     repoConfig.getId() );
+                }
+                else
+                {
+                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
+                                                     repoConfig.getId() );
+                }
+
+                if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
+                                                       repoConfig.getId() ) )
+                {
+                    roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
+                                                     repoConfig.getId() );
+                }
+                else
+                {
+                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
+                                                     repoConfig.getId() );
+                }
+            }
+            catch ( RoleManagerException e )
+            {
+                // Log error.
+                log.error( "Unable to create roles for configured repositories: " + e.getMessage(), e );
+            }
+        }
+    }
+
+    public void startup()
+        throws ArchivaException
+    {
+        executeEnvironmentChecks();
+
+        synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
+        archivaConfiguration.addChangeListener( this );
+
+        if ( archivaConfiguration.isDefaulted() )
+        {
+            assignRepositoryObserverToGuestUser( archivaConfiguration.getConfiguration().getManagedRepositories() );
+        }
+    }
+
+    private void executeEnvironmentChecks()
+        throws ArchivaException
+    {
+        if ( ( checkers == null ) || CollectionUtils.isEmpty( checkers.values() ) )
+        {
+            throw new ArchivaException(
+                "Unable to initialize the Redback Security Environment, " + "no Environment Check components found." );
+        }
+
+        List<String> violations = new ArrayList<String>();
+
+        for ( Entry<String, EnvironmentCheck> entry : checkers.entrySet() )
+        {
+            EnvironmentCheck check = entry.getValue();
+            List<String> v = new ArrayList<String>();
+            check.validateEnvironment( v );
+            log.info( "Environment Check: " + entry.getKey() + " -> " + v.size() + " violation(s)" );
+            for ( String s : v )
+            {
+                violations.add( "[" + entry.getKey() + "] " + s );
+            }
+        }
+
+        if ( CollectionUtils.isNotEmpty( violations ) )
+        {
+            StringBuilder msg = new StringBuilder();
+            msg.append( "EnvironmentCheck Failure.\n" );
+            msg.append( "======================================================================\n" );
+            msg.append( " ENVIRONMENT FAILURE !! \n" );
+            msg.append( "\n" );
+
+            for ( String violation : violations )
+            {
+                msg.append( violation ).append( "\n" );
+            }
+
+            msg.append( "\n" );
+            msg.append( "======================================================================" );
+            log.error( msg.toString() );
+
+            throw new ArchivaException( "Unable to initialize Redback Security Environment, [" + violations.size()
+                                            + "] violation(s) encountered, See log for details." );
+        }
+    }
+
+    private void assignRepositoryObserverToGuestUser( List<ManagedRepositoryConfiguration> repos )
+    {
+        for ( ManagedRepositoryConfiguration repoConfig : repos )
+        {
+            String repoId = repoConfig.getId();
+
+            String principal = UserManager.GUEST_USERNAME;
+
+            try
+            {
+                UserAssignment ua;
+
+                if ( rbacManager.userAssignmentExists( principal ) )
+                {
+                    ua = rbacManager.getUserAssignment( principal );
+                }
+                else
+                {
+                    ua = rbacManager.createUserAssignment( principal );
+                }
+
+                ua.addRoleName( ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) );
+                rbacManager.saveUserAssignment( ua );
+            }
+            catch ( RbacManagerException e )
+            {
+                log.warn( "Unable to add role [" + ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) + "] to "
+                              + principal + " user.", e );
+            }
+        }
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml
new file mode 100755 (executable)
index 0000000..fb14d76
--- /dev/null
@@ -0,0 +1,48 @@
+<?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:util="http://www.springframework.org/schema/util"
+       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/util
+           http://www.springframework.org/schema/util/spring-util-3.0.xsd"
+       default-lazy-init="true">
+
+  <context:annotation-config/>
+  <context:component-scan base-package="org.apache.archiva.web"/>
+
+  <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
+
+  <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true">
+    <constructor-arg ref="jcr-config"/>
+  </bean>
+
+  <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
+    <constructor-arg value="${appserver.base}/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/data/jcr"/>
+  </bean>
+
+
+</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/org/apache/archiva/security.properties b/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/org/apache/archiva/security.properties
new file mode 100644 (file)
index 0000000..2074ef0
--- /dev/null
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+# --------------------------------------------------------------------
+# Email Settings
+
+# The subject line for the email message.
+email.validation.subject=Welcome to Archiva
+
+# Feedback page
+email.feedback.path=http://archiva.apache.org/mail-lists.html
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/org/apache/archiva/security_en.properties b/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/org/apache/archiva/security_en.properties
new file mode 100644 (file)
index 0000000..661b0cb
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml
new file mode 100644 (file)
index 0000000..3c04c01
--- /dev/null
@@ -0,0 +1,419 @@
+<?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"
+       xmlns:task="http://www.springframework.org/schema/task"
+       xmlns:util="http://www.springframework.org/schema/util"
+       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
+           http://www.springframework.org/schema/util
+           http://www.springframework.org/schema/util/spring-util-3.0.xsd">
+
+  <context:property-placeholder location="classpath:application.properties"/>
+
+  <bean id="loggerManager" class="org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager"
+        init-method="initialize"/>
+
+  <!-- only here to cleanup temp indexes for groups increase number if use for something else -->
+  <task:executor id="springExecutor" pool-size="2"/>
+  <task:scheduler id="springScheduler" pool-size="2"/>
+  <task:annotation-driven executor="springExecutor" scheduler="springScheduler"/>
+
+  <alias name="repositoryStatisticsManager#default" alias="repositoryStatisticsManager"/>
+  <!-- TODO olamy need to find a more dynamic way if using jcr impl -->
+  <alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
+
+
+  <bean name="xmlRpcUserRepositories" class="org.apache.archiva.web.xmlrpc.security.XmlRpcUserRepositories">
+    <constructor-arg ref="userRepositories"/>
+    <constructor-arg ref="xmlRpcAuthenticator"/>
+  </bean>
+
+  <!--  Web Service : Ping Service -->
+  <bean name="pingService" lazy-init="true" scope="singleton"
+        class="org.apache.archiva.web.xmlrpc.services.PingServiceImpl"/>
+
+
+  <!-- Web Services : Search Service -->
+  <bean name="searchService" lazy-init="true" scope="singleton"
+        class="org.apache.archiva.web.xmlrpc.services.SearchServiceImpl">
+    <constructor-arg ref="xmlRpcUserRepositories"/>
+    <constructor-arg ref="repositorySessionFactory"/>
+    <constructor-arg ref="nexusSearch"/>
+  </bean>
+
+
+
+  <!-- Web Services : Administration Service -->
+  <bean name="administrationService" lazy-init="true" scope="singleton"
+        class="org.apache.archiva.web.xmlrpc.services.AdministrationServiceImpl">
+    <constructor-arg ref="archivaAdministration#default"/>
+    <constructor-arg ref="repositoryContentConsumers"/>
+    <constructor-arg ref="repositoryContentFactory#default"/>
+    <constructor-arg ref="repositorySessionFactory"/>
+    <constructor-arg ref="archivaTaskScheduler#repository"/>
+    <constructor-arg>
+      <bean class="org.apache.archiva.web.spring.RepositoryListenerFactoryBean"/>
+    </constructor-arg>
+    <constructor-arg ref="repositoryStatisticsManager"/>
+    <constructor-arg ref="repositoryMerger#maven2"/>
+    <constructor-arg ref="auditListener#logging"/>
+    <constructor-arg ref="managedRepositoryAdmin#default"/>
+    <constructor-arg ref="remoteRepositoryAdmin#default"/>
+    <constructor-arg ref="proxyConnectorAdmin#default"/>
+    <constructor-arg ref="repositoryGroupAdmin#default"/>
+  </bean>
+
+
+  <!-- Redback Web Services -->
+  <bean name="redbackRoleService" lazy-init="true" scope="singleton"
+        class="org.codehaus.redback.xmlrpc.service.RoleServiceImpl">
+    <constructor-arg ref="rBACManager#cached"/>
+    <constructor-arg ref="roleManager"/>
+  </bean>
+
+  <bean name="redbackOperationService" lazy-init="true" scope="singleton"
+        class="org.codehaus.redback.xmlrpc.service.OperationServiceImpl">
+    <constructor-arg ref="rBACManager#cached"/>
+  </bean>
+
+  <bean name="redbackPermissionService" lazy-init="true" scope="singleton"
+        class="org.codehaus.redback.xmlrpc.service.PermissionServiceImpl">
+    <constructor-arg ref="rBACManager#cached"/>
+  </bean>
+
+  <bean name="redbackResourceService" lazy-init="true" scope="singleton"
+        class="org.codehaus.redback.xmlrpc.service.ResourceServiceImpl">
+    <constructor-arg ref="rBACManager#cached"/>
+  </bean>
+
+  <bean name="redbackUserService" lazy-init="true" scope="singleton"
+        class="org.codehaus.redback.xmlrpc.service.UserServiceImpl">
+    <constructor-arg ref="userManager#cached"/>
+  </bean>
+
+  <bean name="xmlrpcServicesList" lazy-init="true" scope="singleton" class="java.util.ArrayList">
+    <constructor-arg>
+      <list>
+        <ref bean="administrationService"/>
+        <ref bean="searchService"/>
+        <ref bean="pingService"/>
+      </list>
+    </constructor-arg>
+  </bean>
+
+  <bean name="xmlRpcAuthenticator" class="org.apache.archiva.web.xmlrpc.security.XmlRpcAuthenticator">
+    <constructor-arg ref="securitySystem"/>
+    <constructor-arg ref="userRepositories"/>
+  </bean>
+
+  <bean name="redbackXmlrpcServicesList" class="java.util.ArrayList">
+    <constructor-arg>
+      <list>
+        <ref bean="redbackOperationService"/>
+        <ref bean="redbackPermissionService"/>
+        <ref bean="redbackResourceService"/>
+        <ref bean="redbackRoleService"/>
+        <ref bean="redbackUserService"/>
+      </list>
+    </constructor-arg>
+  </bean>
+
+  <bean name="redbackXmlRpcAuthenticator" class="org.codehaus.redback.xmlrpc.security.XmlRpcAuthenticator">
+    <constructor-arg ref="securitySystem"/>
+  </bean>
+
+  <bean id="mailSession" class="org.springframework.jndi.JndiObjectFactoryBean">
+    <property name="jndiName" value="java:comp/env/mail/Session">
+    </property>
+  </bean>
+
+  <bean name="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
+    <property name="session" ref="mailSession"/>
+  </bean>
+
+  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+          <system/>
+          <jndi prefix="java:comp/env" config-optional="true"/>
+          <xml fileName="${user.home}/.m2/archiva.xml" config-optional="true"
+               config-name="org.apache.archiva.user"
+               config-at="org.apache.archiva"/>
+          <xml fileName="${user.home}/.m2/shared.xml" config-optional="true"
+               config-name="org.apache.maven.shared.app.user" config-at="org.apache.maven.shared.app"
+               config-forceCreate="true"/>
+          <properties fileName="${user.home}/.m2/security.properties" config-optional="true"
+                      config-at="org.codehaus.plexus.redback"/>
+          <properties fileName="${user.home}/.m2/archiva.properties" config-optional="true"
+                      config-at="org.codehaus.plexus.redback"/>
+          <xml fileName="${appserver.base}/conf/archiva.xml" config-optional="true"
+               config-name="org.apache.archiva.base"
+               config-at="org.apache.archiva"/>
+          <xml fileName="${appserver.base}/conf/shared.xml" config-optional="true"
+               config-name="org.apache.maven.shared.app.base" config-at="org.apache.maven.shared.app"/>
+          <xml fileName="${appserver.base}/conf/common.xml" config-optional="true"/>
+          <properties fileName="${appserver.base}/conf/security.properties" config-optional="true"
+                      config-at="org.codehaus.plexus.redback"/>
+          <xml fileName="${appserver.home}/conf/archiva.xml" config-optional="true"
+               config-at="org.apache.archiva"/>
+          <xml fileName="${appserver.home}/conf/shared.xml" config-optional="true"
+               config-at="org.apache.maven.shared.app"/>
+          <xml fileName="${appserver.home}/conf/common.xml" config-optional="true"/>
+          <properties fileName="${appserver.home}/conf/security.properties" config-optional="true"
+                      config-at="org.codehaus.plexus.redback"/>
+          <properties fileName="org/apache/archiva/security.properties" config-at="org.codehaus.plexus.redback"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>    
+  </bean>
+  
+  <bean name="jdoFactory#users" class="org.codehaus.plexus.jdo.DataSourceConfigurableJdoFactory">
+    <property name="connectionFactoryName" value="java:comp/env/jdbc/users"/>
+    <property name="shutdownConnectionFactoryName" value="java:comp/env/jdbc/usersShutdown"/>
+    <property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
+    <property name="otherProperties">
+      <props>
+        <prop key="org.jpox.autoCreateSchema">true</prop>
+        <prop key="org.jpox.validateTables">false</prop>
+        <prop key="org.jpox.validateConstraints">false</prop>
+        <prop key="org.jpox.validateColumns">false</prop>
+        <prop key="org.jpox.autoStartMechanism">None</prop>
+        <prop key="org.jpox.transactionIsolation">READ_COMMITTED</prop>
+        <prop key="org.jpox.poid.transactionIsolation">READ_COMMITTED</prop>
+        <prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
+        <!-- NEEDED FOR MYSQL UTF-8 Databases -->
+        <prop key="org.jpox.rdbms.stringDefaultLength">255</prop>
+
+        <!-- NEEDED FOR POSTGRES, But causes problems in other JDBC implementations.
+        <prop key="org.jpox.identifier.case">PreserveCase</prop>
+        -->
+
+        <!-- cache activation -->
+        <prop key="org.jpox.cache.level2">true</prop>
+        <prop key="org.jpox.cache.level2.type">ehcacheclassbased</prop>
+        <prop key="org.jpox.cache.level2.cacheName">defaultJpox</prop>
+        <prop key="org.jpox.cache.level2.configurationFile">/ehcache.xml</prop>
+      </props>
+    </property>
+  </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>
+  
+
+    
+    <!-- <component>
+      <role>org.apache.archiva.webdav.util.MimeTypes</role>
+      <implementation>org.apache.archiva.webdav.util.MimeTypes</implementation>
+      <description>MimeTypes</description>
+      <configuration>
+        <resource>archiva-mime-types.txt</resource>
+      </configuration>
+    </component> -->
+
+
+    <!--
+    olamy TODO check if necessary !!
+   PLXREDBACK-81 bad role hint, redefining here until redback alpha-2 is released.
+
+    <component>
+      <role>org.codehaus.plexus.redback.system.check.EnvironmentCheck</role>
+      <role-hint>locked-admin-check</role-hint>
+      <implementation>org.codehaus.redback.integration.checks.security.LockedAdminEnvironmentCheck</implementation>
+      <description>LockedAdminEnvironmentCheck: checks if accounts marked as system administrator are locked
+        and unlocks them on startup.
+      </description>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.redback.users.UserManager</role>
+          <role-hint>cached</role-hint>
+          <field-name>userManager</field-name>
+        </requirement>
+        <requirement>
+          <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
+          <role-hint>cached</role-hint>
+          <field-name>rbacManager</field-name>
+        </requirement>
+      </requirements>
+    </component>
+    -->
+
+  <!-- TODO move to spring sample and test it -->
+    <!-- START SNIPPET: ldap -->
+    <!-- 
+       Ldap Authentication can be enabled by setting enabling these components and setting the following configuration options in your security.properties file
+
+       ============================================================
+       user.manager.impl=ldap
+       ldap.bind.authenticator.enabled=true
+       redback.default.admin=admin
+       security.policy.password.expiration.enabled=false
+
+       ldap.config.hostname=ldap.hostname
+       ldap.config.port=389
+       ldap.config.base.dn=o=com
+       ldap.config.context.factory=com.sun.jndi.ldap.LdapCtxFactory
+       ldap.config.bind.dn=uid=myusername,o=com
+       ldap.config.password=s3cr3t
+       #ldap.config.authentication.method=
+       ============================================================
+
+       * ldap.config.hostname - The hostname of the ldap server
+       * ldap.config.port - The port of the ldap server
+       * ldap.config.base.dn - The baseDn of the ldap system
+       * ldap.config.context.factory - context factory for ldap connections
+       * ldap.config.bind.dn - the core user used for authentication the ldap server, must be able to perform the necessary searches, etc.
+       * ldap.config.password - password for the bindDn for the root ldap connection
+
+       until this process is better documented, the following is the document for configuration ldap with redback
+      
+       http://redback.codehaus.org/integration/ldap.html
+    -->
+
+    <!--
+    
+    this component manages the connection to the ldap server
+     -->
+
+    <!--
+    <bean name="ldapConnectionFactory" class="org.codehaus.plexus.redback.common.ldap.connection.ConfigurableLdapConnectionFactory">
+      <property name="userConf" ref="userConfiguration"/>
+    </bean>
+    -->
+
+    
+    <!-- 
+    
+    this component manages the mapping of attributes in ldap to user information in redback. To configure the mapping, you can add the following properties in your security.properties
+
+       ============================================================
+       ldap.config.mapper.attribute.email=mail
+       ldap.config.mapper.attribute.fullname=givenName
+       ldap.config.mapper.attribute.password=userPassword
+       ldap.config.mapper.attribute.user.id=cn
+       ldap.config.mapper.attribute.user.base.dn=
+       ldap.config.mapper.attribute.user.object.class=inetOrgPerson
+       ldap.config.mapper.attribute.user.filter=(attributeName=value)
+       ============================================================
+
+
+     * email-attribute - The name of the attribute on a user that contains the email address
+     * full-name-attribute - The name of the attribute on a user that contains the users fullName
+     * password-attribute - The name of the attribute containing the users password, used for the authentiction using the user manager and not the ldap bind authenticator
+     * user-id-attribute - The name of the attribute containing the users userId, most commonly cn or sn.
+     * user-base-dn - The base dn that will be subtree searched for users.
+     * user-object-class - the objectClass used in the ldap server for indentifying users, most commonly inetOrgPerson.
+     -->
+    
+    <!--
+    <bean name="ldapUserMapper" class="org.codehaus.plexus.redback.common.ldap.LdapUserMapper">
+      <property name="emailAttribute" value="email"/>
+      <property name="fullNameAttribute" value="givenName"/>
+      <property name="passwordAttribute" value="userPassword"/>
+      <property name="userIdAttribute" value="cn"/>
+      <property name="userBaseDn" value="o=com"/>
+      <property name="userObjectClass" value="inetOrgPerson"/>
+      <property name="userConf" ref="userConfiguration"/>
+    </bean>     
+    -->
+  
+
+    
+    <!--
+     
+    If caching is desired to improve performance then make uncomment this and make sure the following configuration parameter is in the security.properties
+     
+    user.manager.impl=cached
+    -->
+     
+    <!--
+    <bean name="userManager#cached" class="org.codehaus.plexus.redback.users.cached.CachedUserManager">
+      <property name="userImpl" ref="userMapper#ldap"/>
+      <property name="usersCache" ref="cache#users"/>
+    </bean>     
+    -->
+  
+
+    
+    <!-- 
+    
+    if using the user manager authenticator to authenticate the user and not the ldap bind authenticator make sure
+    this definition has the correct password encoder
+    
+    Note: you should probably just use the ldap bind authenticator which is enabled by putting
+    
+    ldap.bind.authenticator.enabled=true
+    
+    in the security.properties
+    -->
+    <!--
+    <bean name="userSecurityPolicy" class="org.codehaus.plexus.redback.policy.DefaultUserSecurityPolicy">
+      <property name="config" ref="userConfiguration"/>
+      <property name="passwordEncoder" ref="passwordEncoder#sha1"/>
+      <property name="userValidationSettings" ref="userValidationSettings"/>
+      <property name="rememberMeCookieSettings" ref="cookieSettings#rememberMe"/>
+      <property name="signonCookieSettings" ref="cookieSettings#signon"/>
+      <property name="rules">
+        add the rules you want to applied
+        <list>
+          <ref bean="passwordRule#alpha-count"/>
+          <ref bean="passwordRule#alpha-numeric"/>
+          <ref bean="passwordRule#character-length"/>
+          <ref bean="passwordRule#must-have"/>
+          <ref bean="passwordRule#no-whitespaces"/>
+          <ref bean="passwordRule#numerical-count"/>
+        </list>
+      </property>
+    </bean>
+    -->
+    <!-- END SNIPPET: ldap -->
+
+
+
+  <!-- override jcr repository location -->
+  <!-- START SNIPPET: jcr-location -->
+  <!--
+  <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
+    <constructor-arg value="${appserver.base}/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/data/jcr"/>
+  </bean>
+  -->
+  <!-- END SNIPPET: jcr-location -->
+
+</beans>
index 9f88c1f9632445500e3b3688fe477b860f77d8f2..c607265e83a4bc097a109be590be39f9a58ba201 100644 (file)
@@ -1,7 +1,180 @@
-<!DOCTYPE web-app PUBLIC
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd" >
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+  -->
+
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+  <display-name>Apache Archiva</display-name>
+
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>
+        classpath*:META-INF/spring-context.xml,
+        /WEB-INF/applicationContext.xml
+    </param-value>
+  </context-param>
+
+  <filter>
+    <filter-name>encodingFilter</filter-name>
+    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+    <init-param>
+      <param-name>encoding</param-name>
+      <param-value>UTF-8</param-value>
+    </init-param>
+    <init-param>
+      <param-name>forceEncoding</param-name>
+      <param-value>true</param-value>
+    </init-param>
+  </filter>
+
+       <filter-mapping>
+               <filter-name>encodingFilter</filter-name>
+               <url-pattern>/*</url-pattern>
+       </filter-mapping>
+
+  <listener>
+               <listener-class>
+                       org.springframework.web.context.ContextLoaderListener
+               </listener-class>
+       </listener>
+       <listener>
+               <!-- TODO: some Spring technique for this? -->
+               <listener-class>
+       org.apache.archiva.web.startup.ArchivaStartup
+     </listener-class>
+       </listener>
+
+   <listener>
+     <listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class>
+   </listener>
+
+   <!-- to cleanup temporary group index created during a session -->
+   <listener>
+     <listener-class>org.apache.archiva.webdav.util.TemporaryGroupIndexSessionCleaner</listener-class>
+   </listener>
+
+  <servlet>
+               <servlet-name>RepositoryServlet</servlet-name>
+               <servlet-class>
+        org.apache.archiva.webdav.RepositoryServlet
+      </servlet-class>
+               <!-- Loading this on startup so as to take advantage of configuration listeners -->
+               <load-on-startup>1</load-on-startup>
+       </servlet>
+
+       <servlet>
+               <servlet-name>XmlRpcServlet</servlet-name>
+               <servlet-class>
+                       com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet
+               </servlet-class>
+               <init-param>
+                       <param-name>serviceListBeanName</param-name>
+                       <param-value>xmlrpcServicesList</param-value>
+               </init-param>
+               <init-param>
+                       <param-name>authHandlerBeanName</param-name>
+                       <param-value>xmlRpcAuthenticator</param-value>
+               </init-param>
+               <init-param>
+                 <param-name>enabledForExtensions</param-name>
+                 <param-value>true</param-value>
+               </init-param>
+               <load-on-startup>2</load-on-startup>
+       </servlet>
+
+    <servlet>
+      <servlet-name>RedbackXmlRpcServlet</servlet-name>
+      <servlet-class>com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet</servlet-class>
+      <init-param>
+        <param-name>serviceListBeanName</param-name>
+        <param-value>redbackXmlrpcServicesList</param-value>
+      </init-param>
+      <init-param>
+        <param-name>authHandlerBeanName</param-name>
+        <param-value>redbackXmlRpcAuthenticator</param-value>
+      </init-param>
+      <init-param>
+        <param-name>enabledForExtensions</param-name>
+        <param-value>true</param-value>
+      </init-param>
+    </servlet>
+
+       <servlet>
+               <servlet-name>RssFeedServlet</servlet-name>
+               <servlet-class>
+        org.apache.archiva.web.rss.RssFeedServlet
+      </servlet-class>
+       </servlet>
+
+       <servlet-mapping>
+               <servlet-name>RssFeedServlet</servlet-name>
+               <url-pattern>/feeds/*</url-pattern>
+       </servlet-mapping>
+
+       <servlet-mapping>
+               <servlet-name>RepositoryServlet</servlet-name>
+               <url-pattern>/repository/*</url-pattern>
+       </servlet-mapping>
+
+       <servlet-mapping>
+               <servlet-name>XmlRpcServlet</servlet-name>
+               <url-pattern>/xmlrpc</url-pattern>
+       </servlet-mapping>
+
+    <servlet-mapping>
+      <servlet-name>RedbackXmlRpcServlet</servlet-name>
+      <url-pattern>/redback-xmlrpc</url-pattern>
+    </servlet-mapping>
+
+       <resource-ref>
+               <res-ref-name>jdbc/users</res-ref-name>
+               <res-type>javax.sql.DataSource</res-type>
+               <res-auth>Container</res-auth>
+               <res-sharing-scope>Shareable</res-sharing-scope>
+       </resource-ref>
+       <resource-ref>
+               <res-ref-name>mail/Session</res-ref-name>
+               <res-type>javax.mail.Session</res-type>
+               <res-auth>Container</res-auth>
+               <res-sharing-scope>Shareable</res-sharing-scope>
+       </resource-ref>
+
+
+  <servlet>
+    <servlet-name>CXFServlet</servlet-name>
+    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>CXFServlet</servlet-name>
+    <url-pattern>/restServices/*</url-pattern>
+  </servlet-mapping>
+  
+  <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+  </welcome-file-list>
+
+  <session-config>
+    <!-- 30 minutes session timeout -->
+    <session-timeout>30</session-timeout>
+  </session-config>
 
-<web-app>
-  <display-name>Archetype Created Web Application</display-name>
 </web-app>
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
new file mode 100644 (file)
index 0000000..ba9f358
--- /dev/null
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <link rel="stylesheet" href="css/aristo.css"/>
+    <link rel="stylesheet" href="css/bootstrap.min.1.4.0.css">
+
+  <script type="text/javascript" src="js/jquery-1.7.js"></script>
+
+  <script type="text/javascript" src="js/lab.js"></script>
+  <script type="text/javascript" src="js/require.1.0.1.js"></script>
+
+</head>
+
+<body style="padding-top: 40px;">
+
+<div id="topbar-menu-container"></div>
+
+<div class="container-fluid">
+  <div class="sidebar" id="sidebar-content"></div>
+
+  <div class="content">
+    <div class="row" id="user-messages"></div>
+
+    <div class="row" id="main-content"></div>
+  </div>
+</div>
+
+
+
+
+<div id="html-fragments" class="hide"></div>
+
+</body>
+
+<div id="dialog-confirm" title="" style="display: none">
+</div>
+
+<script type="text/javascript">
+    require.config({
+        baseUrl: "js/"
+      });
+    $LAB.setGlobalDefaults({AlwaysPreserveOrder:true,BasePath:"js/",explicit_preloading:false});
+    $LAB
+       .script("utils.js").wait()
+       .script("jquery.tmpl.js").wait()
+       .script("jquery.cookie.1.0.0.js").wait()
+       .script("knockout-debug.js").wait()
+       .script("jquery-ui-1.8.16.custom.min.js").wait()
+       .script("redback/register.js").wait()
+       .script("jquery.i18n.properties-1.0.9.js").wait()
+       .script("redback/i18nload.js").wait()
+       .script("jquery.validate.js").wait()
+       .script("jquery.json-2.3.min.js").wait()
+       .script("redback/operation.js").wait()
+       .script("main-tmpl.js").wait()
+       .script("redback/redback-tmpl.js").wait()
+       .script("bootstrap-modal.js").wait()
+       .script("bootstrap-alerts.js").wait()
+       .script("bootstrap-dropdown.js").wait()
+       .script("knockout.simpleGrid.js").wait()
+       .script("redback/user.js").wait()
+       .script("redback/users.js").wait()
+       .script("main.js");
+
+</script>
+
+</html>
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.jsp b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.jsp
deleted file mode 100644 (file)
index c38169b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-<h2>Hello World!</h2>
-</body>
-</html>
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/auto-admin-creation.properties b/archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/auto-admin-creation.properties
new file mode 100644 (file)
index 0000000..7c8c581
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+redback.admin.fullname=Archiva Admin
+redback.admin.email=admin@toto.com
+redback.admin.password=admin123
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/log4j.xml b/archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/log4j.xml
new file mode 100644 (file)
index 0000000..934409d
--- /dev/null
@@ -0,0 +1,80 @@
+<?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>
+
+  <logger name="org.apache.archiva.indexer.search.NexusRepositorySearch">
+    <level value="debug"/>
+  </logger>
+  <logger name="org.apache.archiva.common.plexusbridge.MavenIndexerUtils">
+    <level value="debug"/>
+  </logger>
+  <logger name="JPOX">
+    <level value="error"/>
+  </logger>
+
+  <logger name="org.apache.commons.configuration.DefaultConfigurationBuilder">
+    <level value="error"/>
+  </logger>
+
+  <logger name="org.apache.archiva.admin.repository.managed">
+    <level value="debug"/>
+  </logger>
+
+
+
+  <logger name="org.springframework">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.codehaus.redback">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.apache.cxf">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.quartz">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.apache.archiva.indexer.merger">
+    <level value="debug"/>
+  </logger>
+
+  <root>
+    <priority value ="info" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/tomcat-context-archiva.xml b/archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/tomcat-context-archiva.xml
new file mode 100644 (file)
index 0000000..fda8f82
--- /dev/null
@@ -0,0 +1,31 @@
+<?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.
+  -->
+<Context path="/archiva">
+  <Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"
+            username="sa"
+            password=""
+            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
+            url="jdbc:derby:${catalina.base}/target/database/users;create=true"
+  />
+  <Resource name="mail/Session" auth="Container"
+          type="javax.mail.Session"
+          mail.smtp.host="localhost"/>
+                
+</Context>
diff --git a/pom.xml b/pom.xml
index b031079ac6fab7d0db8284091fc9f4886fb8a665..b8be55173562c5847e0f9ebdb480175f083ad051 100644 (file)
--- a/pom.xml
+++ b/pom.xml
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-integrations-security</artifactId>
+        <version>${redback.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
       <dependency>
         <groupId>org.apache.velocity</groupId>
         <artifactId>velocity</artifactId>