]> source.dussan.org Git - archiva.git/commitdiff
PR: MRM-36
authorEdwin L. Punzalan <epunzalan@apache.org>
Thu, 2 Mar 2006 09:53:40 +0000 (09:53 +0000)
committerEdwin L. Punzalan <epunzalan@apache.org>
Thu, 2 Mar 2006 09:53:40 +0000 (09:53 +0000)
Submitted by: Maria Odea Ching

Applied patch for discovery and indexing schedule

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@382337 13f79535-47bb-0310-9956-ffa450edef68

maven-repository-webapp/pom.xml
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java [new file with mode: 0644]
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java [new file with mode: 0644]
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java [new file with mode: 0644]
maven-repository-webapp/src/main/resources/xwork.xml
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/generalresults.jsp
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/results.jsp
maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml

index 92cb24fa0b76d16234fc352072d95afaf2d49464..cef65a3b5bee304e8deb727f839864f158b3db75 100644 (file)
@@ -42,7 +42,7 @@
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>maven-jetty6-plugin</artifactId>
         <configuration>
-          <webAppSourceDirectory>${basedir}/target/${artifactId}</webAppSourceDirectory >
+          <webAppSourceDirectory>${basedir}/target/${artifactId}</webAppSourceDirectory>
           <scanIntervalSeconds>10</scanIntervalSeconds>
         </configuration>
       </plugin>
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
new file mode 100644 (file)
index 0000000..eaedb63
--- /dev/null
@@ -0,0 +1,57 @@
+package org.apache.maven.repository.manager.web.action;\r
+\r
+/*\r
+ * Copyright 2005-2006 The Apache Software Foundation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+import com.opensymphony.xwork.Action;\r
+import org.apache.maven.repository.manager.web.job.DiscovererScheduler;\r
+\r
+/**\r
+ * This is the Action class of index.jsp, which is the initial page of the web application.\r
+ * It invokes the DiscovererScheduler to set the DiscoverJob in the scheduler.\r
+ *\r
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="org.apache.maven.repository.manager.web.action.BaseAction"\r
+ */\r
+public class BaseAction\r
+    implements Action\r
+{\r
+\r
+    /**\r
+     * @plexus.requirement\r
+     */\r
+    private DiscovererScheduler discovererScheduler;\r
+\r
+    /**\r
+     * Method that executes the action\r
+     *\r
+     * @return a String that specifies if the action executed was a success or a failure\r
+     */\r
+    public String execute()\r
+    {\r
+        try\r
+        {\r
+            discovererScheduler.setSchedule();\r
+        }\r
+        catch ( Exception e )\r
+        {\r
+            e.printStackTrace();\r
+            return ERROR;\r
+        }\r
+\r
+        return SUCCESS;\r
+    }\r
+\r
+}\r
index 38940d9f983e7b3077129f3c0e703327be6b1b5b..c0fe67f7986567fd3ead92a31bdc67aeb80b4bd6 100644 (file)
@@ -24,7 +24,7 @@ import java.util.Properties;
  */\r
 \r
 /**\r
- *\r
+ * This class contains the configuration values to be used by the scheduler\r
  */\r
 public class Configuration\r
     implements Initializable\r
@@ -32,17 +32,29 @@ public class Configuration
 \r
     private Properties props;\r
 \r
+    /**\r
+     * @throws InitializationException\r
+     */\r
     public void initialize()\r
         throws InitializationException\r
     {\r
-        System.out.println( "Configuration initialized" );\r
     }\r
 \r
+    /**\r
+     * Set the properties object\r
+     *\r
+     * @param properties\r
+     */\r
     public void setProperties( Properties properties )\r
     {\r
         this.props = properties;\r
     }\r
 \r
+    /**\r
+     * Returns the properties object\r
+     *\r
+     * @return a Properties object that contains the configuration values\r
+     */\r
     public Properties getProperties()\r
     {\r
         return props;\r
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java
new file mode 100644 (file)
index 0000000..fd05700
--- /dev/null
@@ -0,0 +1,260 @@
+package org.apache.maven.repository.manager.web.job;\r
+\r
+/*\r
+ * Copyright 2005-2006 The Apache Software Foundation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+import org.apache.maven.artifact.Artifact;\r
+import org.apache.maven.artifact.repository.ArtifactRepository;\r
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;\r
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;\r
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;\r
+import org.apache.maven.model.Model;\r
+import org.apache.maven.repository.discovery.ArtifactDiscoverer;\r
+import org.apache.maven.repository.discovery.DefaultArtifactDiscoverer;\r
+import org.apache.maven.repository.discovery.DefaultMetadataDiscoverer;\r
+import org.apache.maven.repository.discovery.LegacyArtifactDiscoverer;\r
+import org.apache.maven.repository.discovery.MetadataDiscoverer;\r
+import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;\r
+import org.apache.maven.repository.indexing.MetadataRepositoryIndex;\r
+import org.apache.maven.repository.indexing.PomRepositoryIndex;\r
+import org.apache.maven.repository.indexing.RepositoryIndexException;\r
+import org.apache.maven.repository.indexing.RepositoryIndexingFactory;\r
+import org.codehaus.plexus.scheduler.AbstractJob;\r
+import org.quartz.JobDataMap;\r
+import org.quartz.JobExecutionContext;\r
+import org.quartz.JobExecutionException;\r
+\r
+import java.io.File;\r
+import java.net.MalformedURLException;\r
+import java.util.Iterator;\r
+import java.util.List;\r
+\r
+/**\r
+ * This class executes the discoverer and the indexer.\r
+ *\r
+ * @plexus.component role="org.apache.maven.repository.manager.web.job.DiscovererJob"\r
+ */\r
+public class DiscovererJob\r
+    extends AbstractJob\r
+{\r
+    public static final String ROLE = DiscovererJob.class.getName();\r
+\r
+    private ArtifactDiscoverer defaultArtifactDiscoverer;\r
+\r
+    private ArtifactDiscoverer legacyArtifactDiscoverer;\r
+\r
+    private MetadataDiscoverer defaultMetadataDiscoverer;\r
+\r
+    private RepositoryIndexingFactory indexFactory;\r
+\r
+    private ArtifactRepositoryLayout layout;\r
+\r
+    private ArtifactRepositoryFactory repoFactory;\r
+\r
+    public static String MAP_INDEXPATH = "INDEXPATH";\r
+\r
+    public static String MAP_LAYOUT = "LAYOUT";\r
+\r
+    public static String MAP_DEFAULT_REPOSITORY = "DEFAULT_REPOSITORY";\r
+\r
+    public static String MAP_BLACKLIST = "BLACKLISTED_PATTERNS";\r
+\r
+    public static String MAP_SNAPSHOTS = "INCLUDE_SNAPSHOTS";\r
+\r
+    public static String MAP_CONVERT = "CONVERT_SNAPSHOTS";\r
+\r
+    public static String MAP_DEF_ARTIFACT_DISCOVERER = "DEFAULT_ARTIFACT_DISCOVERER";\r
+\r
+    public static String MAP_LEG_ARTIFACT_DISCOVERER = "LEGACY_ARTIFACT_DISCOVERER";\r
+\r
+    public static String MAP_DEF_METADATA_DISCOVERER = "DEFAULT_METADATA_DISCOVERER";\r
+\r
+    public static String MAP_IDX_FACTORY = "INDEX_FACTORY";\r
+\r
+    public static String MAP_REPO_LAYOUT = "REPOSITORY_LAYOUT";\r
+\r
+    public static String MAP_REPO_FACTORY = "REPOSITORY_FACTORY";\r
+\r
+    /**\r
+     * Execute the discoverer and the indexer.\r
+     *\r
+     * @param context\r
+     * @throws org.quartz.JobExecutionException\r
+     *\r
+     */\r
+    public void execute( JobExecutionContext context )\r
+        throws JobExecutionException\r
+    {\r
+        System.out.println( "Start execution of DiscovererJob.." );\r
+        JobDataMap dataMap = context.getJobDetail().getJobDataMap();\r
+\r
+        //configuration values specified in properties file\r
+        String indexPath = (String) dataMap.get( MAP_INDEXPATH );\r
+        ArtifactRepository defaultRepository = (ArtifactRepository) dataMap.get( MAP_DEFAULT_REPOSITORY );\r
+        String blacklistedPatterns = (String) dataMap.get( MAP_BLACKLIST );\r
+        boolean includeSnapshots = ( (Boolean) dataMap.get( MAP_SNAPSHOTS ) ).booleanValue();\r
+        boolean convertSnapshots = ( (Boolean) dataMap.get( MAP_CONVERT ) ).booleanValue();\r
+\r
+        //plexus components created in BaseAction\r
+        defaultArtifactDiscoverer = (DefaultArtifactDiscoverer) dataMap.get( MAP_DEF_ARTIFACT_DISCOVERER );\r
+        legacyArtifactDiscoverer = (LegacyArtifactDiscoverer) dataMap.get( MAP_LEG_ARTIFACT_DISCOVERER );\r
+        defaultMetadataDiscoverer = (DefaultMetadataDiscoverer) dataMap.get( MAP_DEF_METADATA_DISCOVERER );\r
+        indexFactory = (RepositoryIndexingFactory) dataMap.get( MAP_IDX_FACTORY );\r
+        layout = (ArtifactRepositoryLayout) dataMap.get( MAP_REPO_LAYOUT );\r
+        repoFactory = (ArtifactRepositoryFactory) dataMap.get( MAP_REPO_FACTORY );\r
+\r
+        try\r
+        {\r
+            List artifacts;\r
+            if ( dataMap.get( MAP_LAYOUT ).equals( "default" ) )\r
+            {\r
+                artifacts = defaultArtifactDiscoverer.discoverArtifacts( defaultRepository, blacklistedPatterns,\r
+                                                                         includeSnapshots );\r
+                indexArtifact( artifacts, indexPath, defaultRepository );\r
+\r
+                List models = defaultArtifactDiscoverer.discoverStandalonePoms( defaultRepository, blacklistedPatterns,\r
+                                                                                convertSnapshots );\r
+                indexPom( models, indexPath, defaultRepository );\r
+\r
+                List metadataList = defaultMetadataDiscoverer.discoverMetadata(\r
+                    new File( defaultRepository.getBasedir() ), blacklistedPatterns );\r
+                indexMetadata( metadataList, indexPath, new File( defaultRepository.getBasedir() ) );\r
+            }\r
+            else if ( dataMap.get( MAP_LAYOUT ).equals( "legacy" ) )\r
+            {\r
+                artifacts = legacyArtifactDiscoverer.discoverArtifacts( defaultRepository, blacklistedPatterns,\r
+                                                                        includeSnapshots );\r
+                indexArtifact( artifacts, indexPath, defaultRepository );\r
+            }\r
+        }\r
+        catch ( RepositoryIndexException e )\r
+        {\r
+            e.printStackTrace();\r
+        }\r
+        catch ( MalformedURLException me )\r
+        {\r
+            me.printStackTrace();\r
+        }\r
+\r
+        System.out.println( "[DiscovererJob] DiscovererJob has finished executing." );\r
+    }\r
+\r
+    /**\r
+     * Index the artifacts in the list\r
+     *\r
+     * @param artifacts  the artifacts to be indexed\r
+     * @param indexPath  the path to the index file\r
+     * @param repository the repository where the artifacts are located\r
+     */\r
+    private void indexArtifact( List artifacts, String indexPath, ArtifactRepository repository )\r
+        throws RepositoryIndexException\r
+    {\r
+        ArtifactRepositoryIndex artifactIndex = indexFactory.createArtifactRepositoryIndex( indexPath, repository );\r
+        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )\r
+        {\r
+            Artifact artifact = (Artifact) iter.next();\r
+            try\r
+            {\r
+                artifactIndex.indexArtifact( artifact );\r
+            }\r
+            catch ( Exception e )\r
+            {\r
+                if ( e instanceof RepositoryIndexException )\r
+                {\r
+                    throw (RepositoryIndexException) e;\r
+                }\r
+            }\r
+\r
+            if ( artifactIndex.isOpen() )\r
+            {\r
+                artifactIndex.optimize();\r
+                artifactIndex.close();\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Index the metadata in the list\r
+     *\r
+     * @param metadataList   the metadata to be indexed\r
+     * @param indexPath      the path to the index file\r
+     * @param repositoryBase the repository where the metadata are located\r
+     */\r
+    private void indexMetadata( List metadataList, String indexPath, File repositoryBase )\r
+        throws RepositoryIndexException, MalformedURLException\r
+    {\r
+        String repoDir = repositoryBase.toURL().toString();\r
+        ArtifactRepository repository =\r
+            repoFactory.createArtifactRepository( "repository", repoDir, layout, null, null );\r
+\r
+        MetadataRepositoryIndex metadataIndex = indexFactory.createMetadataRepositoryIndex( indexPath, repository );\r
+        for ( Iterator iter = metadataList.iterator(); iter.hasNext(); )\r
+        {\r
+            RepositoryMetadata repoMetadata = (RepositoryMetadata) iter.next();\r
+            try\r
+            {\r
+                metadataIndex.index( repoMetadata );\r
+            }\r
+            catch ( Exception e )\r
+            {\r
+                if ( e instanceof RepositoryIndexException )\r
+                {\r
+                    throw (RepositoryIndexException) e;\r
+                }\r
+            }\r
+            if ( metadataIndex.isOpen() )\r
+            {\r
+                metadataIndex.optimize();\r
+                metadataIndex.close();\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Index the poms in the list\r
+     *\r
+     * @param models     list of poms that will be indexed\r
+     * @param indexPath  the path to the index\r
+     * @param repository the artifact repository where the poms were discovered\r
+     */\r
+    private void indexPom( List models, String indexPath, ArtifactRepository repository )\r
+        throws RepositoryIndexException\r
+    {\r
+        PomRepositoryIndex pomIndex = indexFactory.createPomRepositoryIndex( indexPath, repository );\r
+        for ( Iterator iter = models.iterator(); iter.hasNext(); )\r
+        {\r
+            Model model = (Model) iter.next();\r
+            try\r
+            {\r
+                pomIndex.indexPom( model );\r
+            }\r
+            catch ( Exception e )\r
+            {\r
+                if ( e instanceof RepositoryIndexException )\r
+                {\r
+                    throw (RepositoryIndexException) e;\r
+                }\r
+            }\r
+\r
+            if ( pomIndex.isOpen() )\r
+            {\r
+                pomIndex.optimize();\r
+                pomIndex.close();\r
+            }\r
+        }\r
+    }\r
+\r
+}\r
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java
new file mode 100644 (file)
index 0000000..202c867
--- /dev/null
@@ -0,0 +1,149 @@
+package org.apache.maven.repository.manager.web.job;\r
+\r
+/*\r
+ * Copyright 2005-2006 The Apache Software Foundation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+import org.apache.maven.artifact.repository.ArtifactRepository;\r
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;\r
+import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;\r
+import org.apache.maven.repository.discovery.ArtifactDiscoverer;\r
+import org.apache.maven.repository.discovery.MetadataDiscoverer;\r
+import org.apache.maven.repository.indexing.RepositoryIndexingFactory;\r
+import org.codehaus.plexus.scheduler.Scheduler;\r
+import org.quartz.CronTrigger;\r
+import org.quartz.JobDataMap;\r
+import org.quartz.JobDetail;\r
+import org.quartz.SchedulerException;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.net.MalformedURLException;\r
+import java.text.ParseException;\r
+import java.util.Properties;\r
+\r
+/**\r
+ * This class sets the job to be executed in the plexus-quartz scheduler\r
+ *\r
+ * @plexus.component role="org.apache.maven.repository.manager.web.job.DiscovererScheduler"\r
+ */\r
+public class DiscovererScheduler\r
+{\r
+    /**\r
+     * @plexus.requirement\r
+     */\r
+    private Configuration config;\r
+\r
+    /**\r
+     * @plexus.requirement\r
+     */\r
+    private Scheduler scheduler;\r
+\r
+    /**\r
+     * @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="org.apache.maven.repository.discovery.DefaultArtifactDiscoverer"\r
+     */\r
+    private ArtifactDiscoverer defaultArtifactDiscoverer;\r
+\r
+    /**\r
+     * @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="org.apache.maven.repository.discovery.LegacyArtifactDiscoverer"\r
+     */\r
+    private ArtifactDiscoverer legacyArtifactDiscoverer;\r
+\r
+    /**\r
+     * @plexus.requirement role="org.apache.maven.repository.discovery.MetadataDiscoverer" role-hint="org.apache.maven.repository.discovery.DefaultMetadataDiscoverer"\r
+     */\r
+    private MetadataDiscoverer defaultMetadataDiscoverer;\r
+\r
+    /**\r
+     * @plexus.requirement\r
+     */\r
+    private RepositoryIndexingFactory indexFactory;\r
+\r
+    /**\r
+     * @plexus.requirement\r
+     */\r
+    private ArtifactRepositoryFactory repoFactory;\r
+\r
+    private Properties props;\r
+\r
+    /**\r
+     * Method that sets the schedule in the plexus-quartz scheduler\r
+     *\r
+     * @throws IOException\r
+     * @throws ParseException\r
+     * @throws SchedulerException\r
+     */\r
+    public void setSchedule()\r
+        throws IOException, ParseException, SchedulerException\r
+    {\r
+        props = config.getProperties();\r
+        JobDetail jobDetail = new JobDetail( "discovererJob", "DISCOVERER", DiscovererJob.class );\r
+        JobDataMap dataMap = new JobDataMap();\r
+        dataMap.put( DiscovererJob.MAP_INDEXPATH, props.getProperty( "index.path" ) );\r
+        dataMap.put( DiscovererJob.MAP_BLACKLIST, props.getProperty( "blacklist.patterns" ) );\r
+        dataMap.put( DiscovererJob.MAP_DEFAULT_REPOSITORY, getDefaultRepository() );\r
+        dataMap.put( DiscovererJob.MAP_LAYOUT, props.getProperty( "layout" ) );\r
+        dataMap.put( DiscovererJob.MAP_SNAPSHOTS, new Boolean( props.getProperty( "include.snapshots" ) ) );\r
+        dataMap.put( DiscovererJob.MAP_CONVERT, new Boolean( props.getProperty( "convert.snapshots" ) ) );\r
+        dataMap.put( DiscovererJob.MAP_DEF_ARTIFACT_DISCOVERER, defaultArtifactDiscoverer );\r
+        dataMap.put( DiscovererJob.MAP_LEG_ARTIFACT_DISCOVERER, legacyArtifactDiscoverer );\r
+        dataMap.put( DiscovererJob.MAP_DEF_METADATA_DISCOVERER, defaultMetadataDiscoverer );\r
+        dataMap.put( DiscovererJob.MAP_IDX_FACTORY, indexFactory );\r
+        dataMap.put( DiscovererJob.MAP_REPO_LAYOUT, config.getLayout() );\r
+        dataMap.put( DiscovererJob.MAP_REPO_FACTORY, repoFactory );\r
+        jobDetail.setJobDataMap( dataMap );\r
+\r
+        CronTrigger trigger =\r
+            new CronTrigger( "DiscovererTrigger", "DISCOVERER", props.getProperty( "cron.expression" ) );\r
+        scheduler.scheduleJob( jobDetail, trigger );\r
+    }\r
+\r
+    /**\r
+     * Method that creates the artifact repository\r
+     *\r
+     * @return an ArtifactRepository instance\r
+     * @throws java.net.MalformedURLException\r
+     */\r
+    private ArtifactRepository getDefaultRepository()\r
+        throws MalformedURLException\r
+    {\r
+        File repositoryDirectory = new File( config.getRepositoryDirectory() );\r
+        String repoDir = repositoryDirectory.toURL().toString();\r
+        ArtifactRepositoryFactory repoFactory = new DefaultArtifactRepositoryFactory();\r
+\r
+        return repoFactory.createArtifactRepository( "test", repoDir, config.getLayout(), null, null );\r
+    }\r
+\r
+    /**\r
+     * Method that sets the configuration object\r
+     *\r
+     * @param config\r
+     */\r
+    public void setConfiguration( Configuration config )\r
+    {\r
+        this.config = config;\r
+    }\r
+\r
+    /**\r
+     * Returns the cofiguration\r
+     *\r
+     * @return a Configuration object that contains the configuration values\r
+     */\r
+    public Configuration getConfiguration()\r
+    {\r
+        return config;\r
+    }\r
+\r
+}\r
index 5c399c792fa6918de525949c1efc0109c5fe13b5..7e65ca10e8eb03f0370ac632be7d80dd1a04ebad 100644 (file)
@@ -27,8 +27,9 @@
     <default-interceptor-ref name="defaultStack"/>
 
     <!-- Action: Front page -->
-    <action name="index" class="com.opensymphony.xwork.ActionSupport">
+    <action name="index" class="org.apache.maven.repository.manager.web.action.BaseAction">
       <result name="success" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
+      <result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
     </action>
 
     <action name="searchg" class="org.apache.maven.repository.manager.web.action.GeneralSearchAction">
index af45233749f1946b95b6ec142e6cca64f1204714..bf950fd658fde90cfc775faf5a31e42a935b6805 100644 (file)
@@ -1,26 +1,28 @@
 <%@ taglib uri="webwork" prefix="ww" %>\r
-<%@page import="java.util.*"%>\r
+\r
 <html>\r
 <head>\r
-<title>Repository Browser</title>\r
+  <title>Repository Browser</title>\r
 </head>\r
+\r
 <body>\r
 <h3><a href="<ww:url value="browse!edit.action"><ww:param name="idx" value="0"/></ww:url>">basedir</a> /\r
-<ww:set name="previousFolder" value="''"/>\r
-<ww:set name="counter" value="0"/>\r
-<ww:if test="folder != ''">\r
-  <ww:set name="folderHeader" value="folder.split('/')"/>\r
-  <ww:iterator value="#folderHeader">\r
-    <ww:set name="counter" value="#counter + 1"/>\r
-    <ww:if test="#previousFolder == ''">\r
-      <ww:set name="previousFolder" value="top"/>\r
-    </ww:if>\r
-    <ww:else>\r
-      <ww:set name="previousFolder" value="#previousFolder + '/' + top"/>\r
-    </ww:else>\r
-    <ww:if test="idx > (#counter + 1)"><a href="<ww:url value="browse!edit.action"><ww:param name="idx"><ww:property value="#counter"/></ww:param><ww:param name="folder"></ww:param></ww:url>"></ww:if><ww:property/></a> /\r
-  </ww:iterator>\r
-</ww:if>\r
+  <ww:set name="previousFolder" value="''"/>\r
+  <ww:set name="counter" value="0"/>\r
+  <ww:if test="folder != ''">\r
+    <ww:set name="folderHeader" value="folder.split('/')"/>\r
+    <ww:iterator value="#folderHeader">\r
+      <ww:set name="counter" value="#counter + 1"/>\r
+      <ww:if test="#previousFolder == ''">\r
+        <ww:set name="previousFolder" value="top"/>\r
+      </ww:if>\r
+      <ww:else>\r
+        <ww:set name="previousFolder" value="#previousFolder + '/' + top"/>\r
+      </ww:else>\r
+      <ww:if test="idx > (#counter + 1)"><a href="<ww:url value="browse!edit.action"><ww:param name="idx"><ww:property\r
+          value="#counter"/></ww:param><ww:param name="folder"></ww:param></ww:url>"></ww:if><ww:property/></a> /\r
+    </ww:iterator>\r
+  </ww:if>\r
 </h3>\r
 <br/>\r
 \r
 <ww:iterator value="artifactMap.keySet().iterator()">\r
   <ww:set name="groupName" value="top"/>\r
 <ww:if test="idx == 1 || (folder != '' and  #groupName.startsWith(folder))">\r
-<%\r
-int ctr = 1;\r
-%>\r
+  <%\r
+\r
+  int ctr = 1;\r
+\r
+  %>\r
   <ww:set name="groupFolder" value="#groupName.split('/')"/>\r
-    <ww:iterator value="#groupFolder">\r
-<%\r
-if (ctr == ((Integer)pageContext.getAttribute("in")).intValue()) {%>\r
-      <ww:if test="top != #previousFolder">\r
-        <ww:set name="previousFolder" value="top"/>\r
-        <a href="<ww:url value="browse!edit.action"><ww:param name="folder"><ww:property value="folder"/><ww:if test="folder != ''">/</ww:if><ww:property/></ww:param><ww:param name="idx" value="idx"/></ww:url>"">\r
-        <ww:property/>/\r
-        </a><br>\r
-      </ww:if>\r
-<%\r
-}\r
-ctr++;\r
-%>\r
-    </ww:iterator>\r
-</ww:if>\r
-</ww:iterator>\r
+<ww:iterator value="#groupFolder">\r
+  <%\r
 \r
-<ww:if test="folder != ''">\r
-  <ww:set name="previousFolder" value="''"/>\r
-  <ww:set name="artifactList" value="artifactMap.get(folder)"/>\r
-  <ww:iterator value="#artifactList">\r
-<table border="1">\r
-          <tr align="left">\r
-            <th>Group ID</th>\r
-            <td><ww:property value="groupId"/></td>\r
-          </tr>\r
-          <tr align="left">\r
-            <th>Artifact ID</th>\r
-            <td><ww:property value="artifactId"/></td>\r
-          </tr>\r
-          <tr align="left">\r
-            <th>Version</th>\r
-            <td><ww:property value="version"/></td>\r
-          </tr>\r
-          <tr align="left">\r
-            <th>Derivatives</th>\r
-            <td><ww:property value="groupId"/></td>\r
-          </tr>\r
-          <tr align="left">\r
-            <th>Parent</th>\r
-            <td><ww:property value="folder"/></td>\r
-          </tr>\r
-</table><br/>\r
+if (ctr == ((Integer)pageContext.getAttribute("in")).intValue()) {\r
+  %>\r
+<ww:if test="top != #previousFolder">\r
+  <ww:set name="previousFolder" value="top"/>\r
+<a href="<ww:url value="browse!edit.action"><ww:param name="folder"><ww:property value="folder"/><ww:if test="folder != ''">/</ww:if><ww:property/></ww:param><ww:param name="idx" value="idx"/></ww:url>"">\r
+  <ww:property/>/\r
+    </ a><br>\r
+  </ww:if>\r
+  <%\r
+    }\r
+    ctr++;\r
+  %>\r
+  </ww:iterator>\r
+  </ww:if>\r
   </ww:iterator>\r
-</ww:if>\r
+\r
+  <ww:if test="folder != ''">\r
+    <ww:set name="previousFolder" value="''"/>\r
+    <ww:set name="artifactList" value="artifactMap.get(folder)"/>\r
+    <ww:iterator value="#artifactList">\r
+      <table border="1">\r
+        <tr align="left">\r
+          <th>Group ID</th>\r
+          <td><ww:property value="groupId"/></td>\r
+        </tr>\r
+        <tr align="left">\r
+          <th>Artifact ID</th>\r
+          <td><ww:property value="artifactId"/></td>\r
+        </tr>\r
+        <tr align="left">\r
+          <th>Version</th>\r
+          <td><ww:property value="version"/></td>\r
+        </tr>\r
+        <tr align="left">\r
+          <th>Derivatives</th>\r
+          <td><ww:property value="groupId"/></td>\r
+        </tr>\r
+        <tr align="left">\r
+          <th>Parent</th>\r
+          <td><ww:property value="folder"/></td>\r
+        </tr>\r
+      </table>\r
+      <br/>\r
+    </ww:iterator>\r
+  </ww:if>\r
 </body>\r
 </html>\r
index 4c9229e5c8b1201da6338a29afb30434b7c97443..93a134e5d5ec4c31fbddc7e24d658b1e6c9b45c3 100644 (file)
 <!--"CONVERTED_APPLET"-->
 <!-- HTML CONVERTER -->
 <script language="JavaScript" type="text/javascript"><!--
-    var _info = navigator.userAgent;
-    var _ns = false;
-    var _ns6 = false;
-    var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+var _info = navigator.userAgent;
+var _ns = false;
+var _ns6 = false;
+var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
 //--></script>
 
 <comment>
   <script language="JavaScript" type="text/javascript"><!--
-        var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
-        var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
-//--></script>
+  var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 &&
+                                                             java.lang.System.getProperty("os.version").indexOf("3.5") <
+                                                             0) || (_info.indexOf("Sun") > 0) ||
+                                                            (_info.indexOf("Linux") > 0) ||
+                                                            (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) ||
+                                                            (_info.indexOf("IRIX") > 0)));
+  var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
+  //--></script>
 </comment>
 
 <script language="JavaScript" type="text/javascript"><!--
-    if (_ie == true) document.writeln('<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "400" HEIGHT = "20" NAME = "ChecksumApplet"  codebase="http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=5,0,0,5"><noembed><xmp>');
-    else if (_ns == true && _ns6 == false) document.writeln('<embed ' +
-           'type="application/x-java-applet;version=1.5" \
+if ( _ie ==
+     true ) document.writeln('<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "400" HEIGHT = "20" NAME = "ChecksumApplet"  codebase="http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=5,0,0,5"><noembed><xmp>');
+else if ( _ns == true && _ns6 == false ) document.writeln('<embed ' + 'type="application/x-java-applet;version=1.5" \
             CODE = "org/apache/maven/repository/applet/ChecksumApplet.class" \
             ARCHIVE = "maven-repository-artifact-applet.jar" \
             NAME = "ChecksumApplet" \
             WIDTH = "400" \
-            HEIGHT = "20" ' +
-           'scriptable=false ' +
-           'pluginspage="http://java.sun.com/products/plugin/index.html#download"><noembed><xmp>');
+            HEIGHT = "20" ' + 'scriptable=false ' + 'pluginspage="http://java.sun.com/products/plugin/index.html#download"><noembed><xmp>');
 //--></script>
 <applet CODE="org/apache/maven/repository/applet/ChecksumApplet.class" ARCHIVE="maven-repository-artifact-applet.jar"
         WIDTH="400" HEIGHT="20" NAME="ChecksumApplet"></xmp>
index 53217d37346243592dcddc3d5bb25625a04334e7..bd9b1246b4af6a987024a49aaa37dda93e51d747 100644 (file)
@@ -24,7 +24,7 @@
 \r
 <h1>Maven Repository Manager</h1>\r
 \r
-<%@include file="form.jspf"%>\r
+<%@ include file="form.jspf" %>\r
 \r
 <table border="1px" cellspacing="0">\r
   <tr>\r
@@ -50,8 +50,8 @@
             <tr>\r
               <td valign="top" width="15%" align="right"><ww:property value="Key"/></td>\r
               <td valign="top">\r
-                <ww:iterator value="Value" id="test" status="" >\r
-                  <ww:property />\r
+                <ww:iterator value="Value" id="test" status="">\r
+                  <ww:property/>\r
                 </ww:iterator>\r
                 <br/>\r
               </td>\r
index f644419a4afa4f6739e9dafbe50997913bbfab8e..bf9fb65e6406f3573aaacc393db759cdb7cbb551 100644 (file)
@@ -24,7 +24,7 @@
 
 <h1>Maven Repository Manager</h1>
 
-<%@include file="form.jspf"%>
+<%@ include file="form.jspf" %>
 
 <table>
   <tr>
index 1e13278ebc68a7545200ef5879351c1d2a8081bf..d34d3cd0d30aab5d232d248d3e21c8e0fff653a0 100644 (file)
@@ -40,7 +40,7 @@
       <role>com.opensymphony.xwork.ObjectFactory</role>
       <implementation>org.codehaus.plexus.xwork.PlexusObjectFactory</implementation>
     </component>
-                             
+
     <component>
       <role>org.apache.maven.repository.manager.web.job.Configuration</role>
       <implementation>org.apache.maven.repository.manager.web.job.Configuration</implementation>
@@ -52,7 +52,7 @@
           </property>
           <property>
             <name>default.repository.dir</name>
-            <value>C:/TEST_REPOS/repository</value>
+            <value>C:/TEST_REPOS/.m2/repository/</value>
           </property>
           <property>
             <name>legacy.repository.dir</name>
       </configuration>
     </component>
 
-
-    <!--
-    <component>
-      <role>org.apache.maven.repository.manager.web.job.DiscovererJob</role>
-    </component>
-
-     -->
-
     <!--
      | Logger manager
      -->