]> source.dussan.org Git - archiva.git/commitdiff
rename package
authorBrett Porter <brett@apache.org>
Sat, 26 Aug 2006 07:36:27 +0000 (07:36 +0000)
committerBrett Porter <brett@apache.org>
Sat, 26 Aug 2006 07:36:27 +0000 (07:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@437116 13f79535-47bb-0310-9956-ffa450edef68

47 files changed:
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/BrowseAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/ProxyAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/SearchAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/ShowArtifactAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/AbstractConfigureRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/AbstractDeleteRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureProxiedRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteProxiedRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteSyncedRepositoryAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/RunIndexerAction.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/interceptor/ConfigurationInterceptor.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/mapper/RepositoryActionMapper.java [deleted file]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ProxyAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractConfigureRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractDeleteRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureProxiedRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteSyncedRepositoryAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/SearchAction-checksumSearch-validation.xml [deleted file]
archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/SearchAction-quickSearch-validation.xml [deleted file]
archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureAction-validation.xml [deleted file]
archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureProxiedRepositoryAction-validation.xml [deleted file]
archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureRepositoryAction-validation.xml [deleted file]
archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction-addSelectedSyncedRepository-validation.xml [deleted file]
archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction-validation.xml [deleted file]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/SearchAction-checksumSearch-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/SearchAction-quickSearch-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAction-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureProxiedRepositoryAction-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction-addSelectedSyncedRepository-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/webwork.properties

diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/BrowseAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/BrowseAction.java
deleted file mode 100644 (file)
index eb5b7af..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-package org.apache.maven.archiva.manager.web.action;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionSupport;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.TermQuery;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ConfigurationStore;
-import org.apache.maven.archiva.configuration.ConfigurationStoreException;
-import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
-import org.apache.maven.archiva.indexing.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexing.RepositoryArtifactIndexFactory;
-import org.apache.maven.archiva.indexing.RepositoryIndexException;
-import org.apache.maven.archiva.indexing.RepositoryIndexSearchException;
-import org.apache.maven.archiva.indexing.lucene.LuceneQuery;
-import org.apache.maven.archiva.indexing.record.StandardArtifactIndexRecord;
-import org.apache.maven.archiva.indexing.record.StandardIndexRecordFields;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-/**
- * Browse the repository.
- *
- * @todo the tree part probably belongs in a browsing component, and the indexer could optimize how it retrieves the terms rather than querying everything
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="browseAction"
- */
-public class BrowseAction
-    extends ActionSupport
-{
-    /**
-     * @plexus.requirement
-     */
-    private RepositoryArtifactIndexFactory factory;
-
-    /**
-     * @plexus.requirement
-     */
-    private ConfiguredRepositoryFactory repositoryFactory;
-
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationStore configurationStore;
-
-    private List groups;
-
-    private String groupId;
-
-    private static final String GROUP_SEPARATOR = ".";
-
-    private List artifactIds;
-
-    private String artifactId;
-
-    private List versions;
-
-    public String browse()
-        throws ConfigurationStoreException, RepositoryIndexException, IOException, RepositoryIndexSearchException
-    {
-        RepositoryArtifactIndex index = getIndex();
-
-        if ( !index.exists() )
-        {
-            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
-            return ERROR;
-        }
-
-        GroupTreeNode rootNode = buildGroupTree( index );
-
-        this.groups = collateGroups( rootNode );
-
-        return SUCCESS;
-    }
-
-    public String browseGroup()
-        throws ConfigurationStoreException, RepositoryIndexException, IOException, RepositoryIndexSearchException
-    {
-        RepositoryArtifactIndex index = getIndex();
-
-        if ( !index.exists() )
-        {
-            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
-            return ERROR;
-        }
-
-        GroupTreeNode rootNode = buildGroupTree( index );
-
-        if ( StringUtils.isEmpty( groupId ) )
-        {
-            // TODO: i18n
-            addActionError( "You must specify a group ID to browse" );
-            return ERROR;
-        }
-
-        StringTokenizer tok = new StringTokenizer( groupId, GROUP_SEPARATOR );
-        while ( tok.hasMoreTokens() )
-        {
-            String part = tok.nextToken();
-
-            if ( !rootNode.getChildren().containsKey( part ) )
-            {
-                // TODO: i18n
-                addActionError( "The group specified was not found" );
-                return ERROR;
-            }
-            else
-            {
-                rootNode = (GroupTreeNode) rootNode.getChildren().get( part );
-            }
-        }
-
-        this.groups = collateGroups( rootNode );
-
-        List records = index.search(
-            new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.GROUPID_EXACT, groupId ) ) ) );
-
-        Set artifactIds = new HashSet();
-        for ( Iterator i = records.iterator(); i.hasNext(); )
-        {
-            StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next();
-            artifactIds.add( record.getArtifactId() );
-        }
-        this.artifactIds = new ArrayList( artifactIds );
-        Collections.sort( this.artifactIds );
-
-        return SUCCESS;
-    }
-
-    public String browseArtifact()
-        throws ConfigurationStoreException, RepositoryIndexException, IOException, RepositoryIndexSearchException
-    {
-        RepositoryArtifactIndex index = getIndex();
-
-        if ( StringUtils.isEmpty( groupId ) )
-        {
-            // TODO: i18n
-            addActionError( "You must specify a group ID to browse" );
-            return ERROR;
-        }
-
-        if ( StringUtils.isEmpty( artifactId ) )
-        {
-            // TODO: i18n
-            addActionError( "You must specify a artifact ID to browse" );
-            return ERROR;
-        }
-
-        BooleanQuery query = new BooleanQuery();
-        query.add( new TermQuery( new Term( StandardIndexRecordFields.GROUPID_EXACT, groupId ) ),
-                   BooleanClause.Occur.MUST );
-        query.add( new TermQuery( new Term( StandardIndexRecordFields.ARTIFACTID_EXACT, artifactId ) ),
-                   BooleanClause.Occur.MUST );
-
-        List records = index.search( new LuceneQuery( query ) );
-
-        if ( records.isEmpty() )
-        {
-            // TODO: i18n
-            addActionError( "Could not find any artifacts with the given group and artifact ID" );
-            return ERROR;
-        }
-
-        Set versions = new HashSet();
-        for ( Iterator i = records.iterator(); i.hasNext(); )
-        {
-            StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next();
-            versions.add( record.getVersion() );
-        }
-
-        this.versions = new ArrayList( versions );
-        Collections.sort( this.versions );
-
-        return SUCCESS;
-    }
-
-    private GroupTreeNode buildGroupTree( RepositoryArtifactIndex index )
-        throws IOException, RepositoryIndexSearchException
-    {
-        // TODO: give action message if indexing is in progress
-
-        // TODO: this will be inefficient over a very large number of artifacts, should be cached
-
-        List records = index.search( new LuceneQuery( new MatchAllDocsQuery() ) );
-
-        Set groups = new TreeSet();
-        for ( Iterator i = records.iterator(); i.hasNext(); )
-        {
-            StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next();
-            groups.add( record.getGroupId() );
-        }
-
-        GroupTreeNode rootNode = new GroupTreeNode();
-
-        // build a tree structure
-        for ( Iterator i = groups.iterator(); i.hasNext(); )
-        {
-            String groupId = (String) i.next();
-
-            StringTokenizer tok = new StringTokenizer( groupId, GROUP_SEPARATOR );
-
-            GroupTreeNode node = rootNode;
-
-            while ( tok.hasMoreTokens() )
-            {
-                String part = tok.nextToken();
-
-                if ( !node.getChildren().containsKey( part ) )
-                {
-                    GroupTreeNode newNode = new GroupTreeNode( part, node );
-                    node.addChild( newNode );
-                    node = newNode;
-                }
-                else
-                {
-                    node = (GroupTreeNode) node.getChildren().get( part );
-                }
-            }
-        }
-        return rootNode;
-    }
-
-    private List collateGroups( GroupTreeNode rootNode )
-    {
-        List groups = new ArrayList();
-        for ( Iterator i = rootNode.getChildren().values().iterator(); i.hasNext(); )
-        {
-            GroupTreeNode node = (GroupTreeNode) i.next();
-
-            while ( node.getChildren().size() == 1 )
-            {
-                node = (GroupTreeNode) node.getChildren().values().iterator().next();
-            }
-
-            groups.add( node.getFullName() );
-        }
-        return groups;
-    }
-
-    private RepositoryArtifactIndex getIndex()
-        throws ConfigurationStoreException, RepositoryIndexException
-    {
-        Configuration configuration = configurationStore.getConfigurationFromStore();
-        File indexPath = new File( configuration.getIndexPath() );
-
-        return factory.createStandardIndex( indexPath );
-    }
-
-    public List getGroups()
-    {
-        return groups;
-    }
-
-    public List getArtifactIds()
-    {
-        return artifactIds;
-    }
-
-    public String getGroupId()
-    {
-        return groupId;
-    }
-
-    public void setGroupId( String groupId )
-    {
-        this.groupId = groupId;
-    }
-
-    public String getArtifactId()
-    {
-        return artifactId;
-    }
-
-    public void setArtifactId( String artifactId )
-    {
-        this.artifactId = artifactId;
-    }
-
-    public List getVersions()
-    {
-        return versions;
-    }
-
-    private static class GroupTreeNode
-    {
-        private final String name;
-
-        private final String fullName;
-
-        private final Map children = new TreeMap();
-
-        GroupTreeNode()
-        {
-            name = null;
-            fullName = null;
-        }
-
-        GroupTreeNode( String name, GroupTreeNode parent )
-        {
-            this.name = name;
-            this.fullName = parent.fullName != null ? parent.fullName + GROUP_SEPARATOR + name : name;
-        }
-
-        public String getName()
-        {
-            return name;
-        }
-
-        public String getFullName()
-        {
-            return fullName;
-        }
-
-        public Map getChildren()
-        {
-            return children;
-        }
-
-        public void addChild( GroupTreeNode newNode )
-        {
-            children.put( newNode.name, newNode );
-        }
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/ProxyAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/ProxyAction.java
deleted file mode 100644 (file)
index 761e9e7..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.apache.maven.archiva.manager.web.action;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionSupport;
-import org.apache.maven.archiva.proxy.ProxyException;
-import org.apache.maven.archiva.proxy.ProxyManager;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-/**
- * Proxy functionality.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="proxyAction"
- */
-public class ProxyAction
-    extends ActionSupport
-{
-    /**
-     * @plexus.requirement
-     */
-    private ProxyManager proxyManager;
-
-    private String path;
-
-    private String filename;
-
-    private String contentType;
-
-    private static final String NOT_FOUND = "notFound";
-
-    private InputStream artifactStream;
-
-    public String execute()
-        throws ProxyException
-    {
-        try
-        {
-            File file = proxyManager.get( path );
-
-            artifactStream = new FileInputStream( file );
-
-            // TODO: could be better
-            contentType = "application/octet-stream";
-
-            filename = file.getName();
-        }
-        catch ( ResourceDoesNotExistException e )
-        {
-            // TODO: set message?
-            return NOT_FOUND;
-        }
-        catch ( FileNotFoundException e )
-        {
-            // TODO: set message?
-            return NOT_FOUND;
-        }
-
-        return SUCCESS;
-    }
-
-    public String getPath()
-    {
-        return path;
-    }
-
-    public void setPath( String path )
-    {
-        this.path = path;
-    }
-
-    public String getFilename()
-    {
-        return filename;
-    }
-
-    public String getContentType()
-    {
-        return contentType;
-    }
-
-    public InputStream getArtifactStream()
-    {
-        return artifactStream;
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/SearchAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/SearchAction.java
deleted file mode 100644 (file)
index dac179a..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.apache.maven.archiva.manager.web.action;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionSupport;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.MultiFieldQueryParser;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.TermQuery;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ConfigurationStore;
-import org.apache.maven.archiva.configuration.ConfigurationStoreException;
-import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
-import org.apache.maven.archiva.indexing.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexing.RepositoryArtifactIndexFactory;
-import org.apache.maven.archiva.indexing.RepositoryIndexException;
-import org.apache.maven.archiva.indexing.RepositoryIndexSearchException;
-import org.apache.maven.archiva.indexing.lucene.LuceneQuery;
-import org.apache.maven.archiva.indexing.record.StandardIndexRecordFields;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.List;
-
-/**
- * Search all indexed fields by the given criteria.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="searchAction"
- */
-public class SearchAction
-    extends ActionSupport
-{
-    /**
-     * Query string.
-     */
-    private String q;
-
-    /**
-     * The MD5 to search by.
-     */
-    private String md5;
-
-    /**
-     * Search results.
-     */
-    private List searchResults;
-
-    /**
-     * @plexus.requirement
-     */
-    private RepositoryArtifactIndexFactory factory;
-
-    /**
-     * @plexus.requirement
-     */
-    private ConfiguredRepositoryFactory repositoryFactory;
-
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationStore configurationStore;
-
-    private static final String NO_RESULTS = "noResults";
-
-    private static final String RESULTS = "results";
-
-    private static final String ARTIFACT = "artifact";
-
-    public String quickSearch()
-        throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException,
-        ConfigurationStoreException, ParseException
-    {
-        // TODO: give action message if indexing is in progress
-
-        assert q != null && q.length() != 0;
-
-        RepositoryArtifactIndex index = getIndex();
-
-        if ( !index.exists() )
-        {
-            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
-            return ERROR;
-        }
-
-        // TODO! this is correct, but ugly
-        MultiFieldQueryParser parser = new MultiFieldQueryParser( new String[]{StandardIndexRecordFields.GROUPID,
-            StandardIndexRecordFields.ARTIFACTID, StandardIndexRecordFields.BASE_VERSION,
-            StandardIndexRecordFields.CLASSIFIER, StandardIndexRecordFields.CLASSES, StandardIndexRecordFields.FILES,
-            StandardIndexRecordFields.TYPE, StandardIndexRecordFields.PROJECT_NAME,
-            StandardIndexRecordFields.PROJECT_DESCRIPTION}, new StandardAnalyzer() );
-        searchResults = index.search( new LuceneQuery( parser.parse( q ) ) );
-
-        return SUCCESS;
-    }
-
-    public String findArtifact()
-        throws Exception
-    {
-        // TODO: give action message if indexing is in progress
-
-        assert md5 != null && md5.length() != 0;
-
-        RepositoryArtifactIndex index = getIndex();
-
-        if ( !index.exists() )
-        {
-            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
-            return ERROR;
-        }
-
-        searchResults = index.search(
-            new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.MD5, md5.toLowerCase() ) ) ) );
-
-        if ( searchResults.isEmpty() )
-        {
-            return NO_RESULTS;
-        }
-        if ( searchResults.size() == 1 )
-        {
-            return ARTIFACT;
-        }
-        else
-        {
-            return RESULTS;
-        }
-    }
-
-    private RepositoryArtifactIndex getIndex()
-        throws ConfigurationStoreException, RepositoryIndexException
-    {
-        Configuration configuration = configurationStore.getConfigurationFromStore();
-        File indexPath = new File( configuration.getIndexPath() );
-
-        return factory.createStandardIndex( indexPath );
-    }
-
-    public String doInput()
-    {
-        return INPUT;
-    }
-
-    public String getQ()
-    {
-        return q;
-    }
-
-    public void setQ( String q )
-    {
-        this.q = q;
-    }
-
-    public String getMd5()
-    {
-        return md5;
-    }
-
-    public void setMd5( String md5 )
-    {
-        this.md5 = md5;
-    }
-
-    public List getSearchResults()
-    {
-        return searchResults;
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/ShowArtifactAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/ShowArtifactAction.java
deleted file mode 100644 (file)
index 43a83c4..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.apache.maven.archiva.manager.web.action;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionSupport;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ConfigurationStore;
-import org.apache.maven.archiva.configuration.ConfigurationStoreException;
-import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.ProjectBuildingException;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Browse the repository.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="showArtifactAction"
- */
-public class ShowArtifactAction
-    extends ActionSupport
-{
-    /**
-     * @plexus.requirement
-     */
-    private ArtifactFactory artifactFactory;
-
-    /**
-     * @plexus.requirement
-     */
-    private ConfiguredRepositoryFactory repositoryFactory;
-
-    /**
-     * @plexus.requirement
-     */
-    private MavenProjectBuilder projectBuilder;
-
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationStore configurationStore;
-
-    private String groupId;
-
-    private String artifactId;
-
-    private String version;
-
-    private Model model;
-
-    public String execute()
-        throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException
-    {
-        if ( StringUtils.isEmpty( groupId ) )
-        {
-            // TODO: i18n
-            addActionError( "You must specify a group ID to browse" );
-            return ERROR;
-        }
-
-        if ( StringUtils.isEmpty( artifactId ) )
-        {
-            // TODO: i18n
-            addActionError( "You must specify a artifact ID to browse" );
-            return ERROR;
-        }
-
-        if ( StringUtils.isEmpty( version ) )
-        {
-            // TODO: i18n
-            addActionError( "You must specify a version to browse" );
-            return ERROR;
-        }
-
-        Configuration configuration = configurationStore.getConfigurationFromStore();
-        List repositories = repositoryFactory.createRepositories( configuration );
-
-        Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
-        // TODO: maybe we can decouple the assembly parts of the project builder from the repository handling to get rid of the temp repo
-        ArtifactRepository localRepository = repositoryFactory.createLocalRepository( configuration );
-        MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, localRepository );
-
-        model = project.getModel();
-
-        return SUCCESS;
-    }
-
-    public Model getModel()
-    {
-        return model;
-    }
-
-    public String getGroupId()
-    {
-        return groupId;
-    }
-
-    public void setGroupId( String groupId )
-    {
-        this.groupId = groupId;
-    }
-
-    public String getArtifactId()
-    {
-        return artifactId;
-    }
-
-    public void setArtifactId( String artifactId )
-    {
-        this.artifactId = artifactId;
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( String version )
-    {
-        this.version = version;
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/AbstractConfigureRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/AbstractConfigureRepositoryAction.java
deleted file mode 100644 (file)
index 0df9a3c..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionSupport;
-import com.opensymphony.xwork.ModelDriven;
-import com.opensymphony.xwork.Preparable;
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ConfigurationChangeException;
-import org.apache.maven.archiva.configuration.ConfigurationStore;
-import org.apache.maven.archiva.configuration.ConfigurationStoreException;
-import org.apache.maven.archiva.configuration.InvalidConfigurationException;
-
-import java.io.IOException;
-
-/**
- * Base action for repository configuration actions.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public abstract class AbstractConfigureRepositoryAction
-    extends ActionSupport
-    implements ModelDriven, Preparable
-{
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationStore configurationStore;
-
-    /**
-     * The repository.
-     */
-    private AbstractRepositoryConfiguration repository;
-
-    /**
-     * The repository ID to lookup when editing a repository.
-     */
-    private String repoId;
-
-    /**
-     * The previously read configuration.
-     */
-    protected Configuration configuration;
-
-    public String add()
-        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
-    {
-        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
-
-        AbstractRepositoryConfiguration existingRepository = getRepository( repository.getId() );
-        if ( existingRepository != null )
-        {
-            addFieldError( "id", "A repository with that id already exists" );
-            return INPUT;
-        }
-
-        return saveConfiguration();
-    }
-
-    public String edit()
-        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
-    {
-        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
-
-        AbstractRepositoryConfiguration existingRepository = getRepository( repository.getId() );
-        removeRepository( existingRepository );
-
-        return saveConfiguration();
-    }
-
-    protected abstract void removeRepository( AbstractRepositoryConfiguration existingRepository );
-
-    protected abstract AbstractRepositoryConfiguration getRepository( String id );
-
-    private String saveConfiguration()
-        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
-    {
-        addRepository();
-
-        configurationStore.storeConfiguration( configuration );
-
-        // TODO: do we need to check if indexing is needed?
-
-        addActionMessage( "Successfully saved configuration" );
-
-        return SUCCESS;
-    }
-
-    protected abstract void addRepository()
-        throws IOException;
-
-    public String input()
-    {
-        return INPUT;
-    }
-
-    public Object getModel()
-    {
-        return repository;
-    }
-
-    protected abstract AbstractRepositoryConfiguration createRepository();
-
-    public void prepare()
-        throws ConfigurationStoreException
-    {
-        configuration = configurationStore.getConfigurationFromStore();
-
-        if ( repository == null )
-        {
-            repository = getRepository( repoId );
-        }
-        if ( repository == null )
-        {
-            repository = createRepository();
-        }
-    }
-
-    public String getRepoId()
-    {
-        return repoId;
-    }
-
-    public void setRepoId( String repoId )
-    {
-        this.repoId = repoId;
-    }
-
-    protected AbstractRepositoryConfiguration getRepository()
-    {
-        return repository;
-    }
-
-    public Configuration getConfiguration()
-    {
-        return configuration;
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/AbstractDeleteRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/AbstractDeleteRepositoryAction.java
deleted file mode 100644 (file)
index 134cf51..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ConfigurationChangeException;
-import org.apache.maven.archiva.configuration.ConfigurationStore;
-import org.apache.maven.archiva.configuration.ConfigurationStoreException;
-import org.apache.maven.archiva.configuration.InvalidConfigurationException;
-import org.codehaus.plexus.xwork.action.PlexusActionSupport;
-
-import java.io.IOException;
-
-/**
- * Base action for repository removal actions.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public abstract class AbstractDeleteRepositoryAction
-    extends PlexusActionSupport
-{
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationStore configurationStore;
-
-    /**
-     * The repository ID to lookup when editing a repository.
-     */
-    protected String repoId;
-
-    /**
-     * Which operation to select.
-     */
-    private String operation = "unmodified";
-
-    public String execute()
-        throws ConfigurationStoreException, IOException, InvalidConfigurationException, ConfigurationChangeException
-    {
-        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
-
-        if ( "delete-entry".equals( operation ) || "delete-contents".equals( operation ) )
-        {
-            Configuration configuration = configurationStore.getConfigurationFromStore();
-
-            AbstractRepositoryConfiguration existingRepository = getRepository( configuration );
-            if ( existingRepository == null )
-            {
-                addActionError( "A repository with that id does not exist" );
-                return ERROR;
-            }
-
-            // TODO: remove from index too!
-
-            removeRepository( configuration, existingRepository );
-
-            configurationStore.storeConfiguration( configuration );
-
-            if ( "delete-contents".equals( operation ) )
-            {
-                removeContents( existingRepository );
-            }
-        }
-
-        return SUCCESS;
-    }
-
-    protected abstract void removeContents( AbstractRepositoryConfiguration existingRepository )
-        throws IOException;
-
-    protected abstract AbstractRepositoryConfiguration getRepository( Configuration configuration );
-
-    protected abstract void removeRepository( Configuration configuration,
-                                              AbstractRepositoryConfiguration existingRepository );
-
-    public String input()
-    {
-        return INPUT;
-    }
-
-    public String getRepoId()
-    {
-        return repoId;
-    }
-
-    public void setRepoId( String repoId )
-    {
-        this.repoId = repoId;
-    }
-
-    public String getOperation()
-    {
-        return operation;
-    }
-
-    public void setOperation( String operation )
-    {
-        this.operation = operation;
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureAction.java
deleted file mode 100644 (file)
index b6688a9..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionSupport;
-import com.opensymphony.xwork.ModelDriven;
-import com.opensymphony.xwork.Preparable;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ConfigurationChangeException;
-import org.apache.maven.archiva.configuration.ConfigurationStore;
-import org.apache.maven.archiva.configuration.ConfigurationStoreException;
-import org.apache.maven.archiva.configuration.InvalidConfigurationException;
-import org.apache.maven.archiva.indexing.RepositoryIndexException;
-import org.apache.maven.archiva.indexing.RepositoryIndexSearchException;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Configures the application.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureAction"
- */
-public class ConfigureAction
-    extends ActionSupport
-    implements ModelDriven, Preparable
-{
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationStore configurationStore;
-
-    /**
-     * The configuration.
-     */
-    private Configuration configuration;
-
-    public String execute()
-        throws IOException, RepositoryIndexException, RepositoryIndexSearchException, ConfigurationStoreException,
-        InvalidConfigurationException, ConfigurationChangeException
-    {
-        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
-        // TODO: if this is changed, do we move the index or recreate it?
-
-        // Normalize the path
-        File file = new File( configuration.getIndexPath() );
-        configuration.setIndexPath( file.getCanonicalPath() );
-        if ( !file.exists() )
-        {
-            file.mkdirs();
-            // TODO: error handling when this fails, or is not a directory
-        }
-
-        // Just double checking that our validation routines line up with what is expected in the configuration
-        assert configuration.isValid();
-
-        configurationStore.storeConfiguration( configuration );
-
-        // TODO: if the repository has changed, we need to check if indexing is needed
-
-        addActionMessage( "Successfully saved configuration" );
-
-        return SUCCESS;
-    }
-
-    public String input()
-    {
-        return INPUT;
-    }
-
-    public Object getModel()
-    {
-        return configuration;
-    }
-
-    public void prepare()
-        throws ConfigurationStoreException
-    {
-        configuration = configurationStore.getConfigurationFromStore();
-    }
-}
\ No newline at end of file
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureProxiedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureProxiedRepositoryAction.java
deleted file mode 100644 (file)
index f9798ad..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.ProxiedRepositoryConfiguration;
-
-import java.io.IOException;
-
-/**
- * Configures the application repositories.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureProxiedRepositoryAction"
- */
-public class ConfigureProxiedRepositoryAction
-    extends AbstractConfigureRepositoryAction
-{
-    protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
-    {
-        configuration.removeProxiedRepository( (ProxiedRepositoryConfiguration) existingRepository );
-    }
-
-    protected AbstractRepositoryConfiguration getRepository( String id )
-    {
-        return configuration.getProxiedRepositoryById( id );
-    }
-
-    protected void addRepository()
-        throws IOException
-    {
-        ProxiedRepositoryConfiguration repository = (ProxiedRepositoryConfiguration) getRepository();
-
-        configuration.addProxiedRepository( repository );
-    }
-
-    protected AbstractRepositoryConfiguration createRepository()
-    {
-        return new ProxiedRepositoryConfiguration();
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureRepositoryAction.java
deleted file mode 100644 (file)
index 43fed55..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Configures the application repositories.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryAction"
- */
-public class ConfigureRepositoryAction
-    extends AbstractConfigureRepositoryAction
-{
-    protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
-    {
-        configuration.removeRepository( (RepositoryConfiguration) existingRepository );
-    }
-
-    protected AbstractRepositoryConfiguration getRepository( String id )
-    {
-        return configuration.getRepositoryById( id );
-    }
-
-    protected void addRepository()
-        throws IOException
-    {
-        RepositoryConfiguration repository = (RepositoryConfiguration) getRepository();
-
-        // Normalize the path
-        File file = new File( repository.getDirectory() );
-        repository.setDirectory( file.getCanonicalPath() );
-        if ( !file.exists() )
-        {
-            file.mkdirs();
-            // TODO: error handling when this fails, or is not a directory
-        }
-
-        configuration.addRepository( repository );
-    }
-
-    protected AbstractRepositoryConfiguration createRepository()
-    {
-        RepositoryConfiguration repository = new RepositoryConfiguration();
-        repository.setIndexed( false );
-        return repository;
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction.java
deleted file mode 100644 (file)
index 863412f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.SyncedRepositoryConfiguration;
-
-import java.io.IOException;
-
-/**
- * Configures the application repositories.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureSyncedRepositoryAction"
- */
-public class ConfigureSyncedRepositoryAction
-    extends AbstractConfigureRepositoryAction
-{
-    protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
-    {
-        configuration.removeSyncedRepository( (SyncedRepositoryConfiguration) existingRepository );
-    }
-
-    protected AbstractRepositoryConfiguration getRepository( String id )
-    {
-        return configuration.getSyncedRepositoryById( id );
-    }
-
-    protected void addRepository()
-        throws IOException
-    {
-        SyncedRepositoryConfiguration repository = (SyncedRepositoryConfiguration) getRepository();
-
-        configuration.addSyncedRepository( repository );
-    }
-
-    protected AbstractRepositoryConfiguration createRepository()
-    {
-        return new SyncedRepositoryConfiguration();
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteProxiedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteProxiedRepositoryAction.java
deleted file mode 100644 (file)
index d6faf05..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ProxiedRepositoryConfiguration;
-
-import java.io.IOException;
-
-/**
- * Configures the application repositories.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteProxiedRepositoryAction"
- */
-public class DeleteProxiedRepositoryAction
-    extends AbstractDeleteRepositoryAction
-{
-    protected AbstractRepositoryConfiguration getRepository( Configuration configuration )
-    {
-        return configuration.getProxiedRepositoryById( repoId );
-    }
-
-    protected void removeRepository( Configuration configuration, AbstractRepositoryConfiguration existingRepository )
-    {
-        configuration.removeProxiedRepository( (ProxiedRepositoryConfiguration) existingRepository );
-    }
-
-    protected void removeContents( AbstractRepositoryConfiguration existingRepository )
-        throws IOException
-    {
-        // TODO!
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteRepositoryAction.java
deleted file mode 100644 (file)
index 127bc64..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.codehaus.plexus.util.FileUtils;
-
-import java.io.IOException;
-
-/**
- * Configures the application repositories.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteRepositoryAction"
- */
-public class DeleteRepositoryAction
-    extends AbstractDeleteRepositoryAction
-{
-    protected AbstractRepositoryConfiguration getRepository( Configuration configuration )
-    {
-        return configuration.getRepositoryById( repoId );
-    }
-
-    protected void removeRepository( Configuration configuration, AbstractRepositoryConfiguration existingRepository )
-    {
-        configuration.removeRepository( (RepositoryConfiguration) existingRepository );
-    }
-
-    protected void removeContents( AbstractRepositoryConfiguration existingRepository )
-        throws IOException
-    {
-        RepositoryConfiguration repository = (RepositoryConfiguration) existingRepository;
-        getLogger().info( "Removing " + repository.getDirectory() );
-        FileUtils.deleteDirectory( repository.getDirectory() );
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteSyncedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/DeleteSyncedRepositoryAction.java
deleted file mode 100644 (file)
index c22ca23..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.SyncedRepositoryConfiguration;
-
-import java.io.IOException;
-
-/**
- * Configures the application repositories.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteSyncedRepositoryAction"
- */
-public class DeleteSyncedRepositoryAction
-    extends AbstractDeleteRepositoryAction
-{
-    protected AbstractRepositoryConfiguration getRepository( Configuration configuration )
-    {
-        return configuration.getSyncedRepositoryById( repoId );
-    }
-
-    protected void removeRepository( Configuration configuration, AbstractRepositoryConfiguration existingRepository )
-    {
-        configuration.removeSyncedRepository( (SyncedRepositoryConfiguration) existingRepository );
-    }
-
-    protected void removeContents( AbstractRepositoryConfiguration existingRepository )
-        throws IOException
-    {
-        // TODO!
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/RunIndexerAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/action/admin/RunIndexerAction.java
deleted file mode 100644 (file)
index 955e1e2..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.apache.maven.archiva.manager.web.action.admin;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionSupport;
-import org.apache.maven.archiva.scheduler.RepositoryTaskScheduler;
-import org.apache.maven.archiva.scheduler.TaskExecutionException;
-
-/**
- * Configures the application.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="runIndexerAction"
- */
-public class RunIndexerAction
-    extends ActionSupport
-{
-    /**
-     * @plexus.requirement
-     */
-    private RepositoryTaskScheduler taskScheduler;
-
-    public String execute()
-        throws TaskExecutionException
-    {
-        taskScheduler.runIndexer();
-
-        return SUCCESS;
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/interceptor/ConfigurationInterceptor.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/interceptor/ConfigurationInterceptor.java
deleted file mode 100644 (file)
index 0542c1a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.apache.maven.archiva.manager.web.interceptor;
-
-/*
- * 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.
- */
-
-import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.Interceptor;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ConfigurationStore;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-
-/**
- * An interceptor that makes the application configuration available
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @todo might be a generally useful thing in plexus-xwork-integration
- * @plexus.component role="com.opensymphony.xwork.interceptor.Interceptor" role-hint="configurationInterceptor"
- */
-public class ConfigurationInterceptor
-    extends AbstractLogEnabled
-    implements Interceptor
-{
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationStore configurationStore;
-
-    public String intercept( ActionInvocation actionInvocation )
-        throws Exception
-    {
-        Configuration configuration = configurationStore.getConfigurationFromStore();
-
-        if ( !configuration.isValid() )
-        {
-            if ( configuration.getRepositories().isEmpty() )
-            {
-                getLogger().info( "No repositories were configured - forwarding to repository configuration page" );
-                return "config-repository-needed";
-            }
-            else
-            {
-                getLogger().info( "Configuration is incomplete - forwarding to configuration page" );
-                return "config-needed";
-            }
-        }
-        else
-        {
-            return actionInvocation.invoke();
-        }
-    }
-
-    public void destroy()
-    {
-        // This space left intentionally blank
-    }
-
-    public void init()
-    {
-        // This space left intentionally blank
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/mapper/RepositoryActionMapper.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/manager/web/mapper/RepositoryActionMapper.java
deleted file mode 100644 (file)
index 29ba96e..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.apache.maven.archiva.manager.web.mapper;
-
-/*
- * 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.
- */
-
-import com.opensymphony.webwork.dispatcher.mapper.ActionMapping;
-import com.opensymphony.webwork.dispatcher.mapper.DefaultActionMapper;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Map alternate URLs to specific actions. Used for the repository browser and the proxy.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class RepositoryActionMapper
-    extends DefaultActionMapper
-{
-    private static final String BROWSE_PREFIX = "/browse/";
-
-    private static final String PROXY_PREFIX = "/proxy/";
-
-    public String getUriFromActionMapping( ActionMapping actionMapping )
-    {
-        Map params = actionMapping.getParams();
-        if ( "browseGroup".equals( actionMapping.getName() ) )
-        {
-            return BROWSE_PREFIX + params.remove( "groupId" );
-        }
-        else if ( "browseArtifact".equals( actionMapping.getName() ) )
-        {
-            return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" );
-        }
-        else if ( "showArtifact".equals( actionMapping.getName() ) )
-        {
-            return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" ) + "/" +
-                params.remove( "version" );
-        }
-        else if ( "proxy".equals( actionMapping.getName() ) )
-        {
-            return PROXY_PREFIX + params.remove( "path" );
-        }
-
-        return super.getUriFromActionMapping( actionMapping );
-    }
-
-    public ActionMapping getMapping( HttpServletRequest httpServletRequest )
-    {
-        String path = httpServletRequest.getServletPath();
-        if ( path.startsWith( BROWSE_PREFIX ) )
-        {
-            path = path.substring( BROWSE_PREFIX.length() );
-            if ( path.length() == 0 )
-            {
-                return new ActionMapping( "browse", "/", "", null );
-            }
-            else
-            {
-                String[] parts = path.split( "/" );
-                if ( parts.length == 1 )
-                {
-                    Map params = new HashMap();
-                    params.put( "groupId", parts[0] );
-                    return new ActionMapping( "browseGroup", "/", "", params );
-                }
-                else if ( parts.length == 2 )
-                {
-                    Map params = new HashMap();
-                    params.put( "groupId", parts[0] );
-                    params.put( "artifactId", parts[1] );
-                    return new ActionMapping( "browseArtifact", "/", "", params );
-                }
-                else if ( parts.length == 3 )
-                {
-                    Map params = new HashMap();
-                    params.put( "groupId", parts[0] );
-                    params.put( "artifactId", parts[1] );
-                    params.put( "version", parts[2] );
-                    return new ActionMapping( "showArtifact", "/", "", params );
-                }
-            }
-        }
-        else if ( path.startsWith( PROXY_PREFIX ) )
-        {
-            // retain the leading /
-            path = path.substring( PROXY_PREFIX.length() - 1 );
-
-            Map params = new HashMap();
-            params.put( "path", path );
-            return new ActionMapping( "proxy", "/", "", params );
-        }
-
-        return super.getMapping( httpServletRequest );
-    }
-}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
new file mode 100644 (file)
index 0000000..29953ce
--- /dev/null
@@ -0,0 +1,353 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.TermQuery;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
+import org.apache.maven.archiva.indexing.RepositoryArtifactIndex;
+import org.apache.maven.archiva.indexing.RepositoryArtifactIndexFactory;
+import org.apache.maven.archiva.indexing.RepositoryIndexException;
+import org.apache.maven.archiva.indexing.RepositoryIndexSearchException;
+import org.apache.maven.archiva.indexing.lucene.LuceneQuery;
+import org.apache.maven.archiva.indexing.record.StandardArtifactIndexRecord;
+import org.apache.maven.archiva.indexing.record.StandardIndexRecordFields;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ * Browse the repository.
+ *
+ * @todo the tree part probably belongs in a browsing component, and the indexer could optimize how it retrieves the terms rather than querying everything
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="browseAction"
+ */
+public class BrowseAction
+    extends ActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private RepositoryArtifactIndexFactory factory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfiguredRepositoryFactory repositoryFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    private List groups;
+
+    private String groupId;
+
+    private static final String GROUP_SEPARATOR = ".";
+
+    private List artifactIds;
+
+    private String artifactId;
+
+    private List versions;
+
+    public String browse()
+        throws ConfigurationStoreException, RepositoryIndexException, IOException, RepositoryIndexSearchException
+    {
+        RepositoryArtifactIndex index = getIndex();
+
+        if ( !index.exists() )
+        {
+            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
+            return ERROR;
+        }
+
+        GroupTreeNode rootNode = buildGroupTree( index );
+
+        this.groups = collateGroups( rootNode );
+
+        return SUCCESS;
+    }
+
+    public String browseGroup()
+        throws ConfigurationStoreException, RepositoryIndexException, IOException, RepositoryIndexSearchException
+    {
+        RepositoryArtifactIndex index = getIndex();
+
+        if ( !index.exists() )
+        {
+            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
+            return ERROR;
+        }
+
+        GroupTreeNode rootNode = buildGroupTree( index );
+
+        if ( StringUtils.isEmpty( groupId ) )
+        {
+            // TODO: i18n
+            addActionError( "You must specify a group ID to browse" );
+            return ERROR;
+        }
+
+        StringTokenizer tok = new StringTokenizer( groupId, GROUP_SEPARATOR );
+        while ( tok.hasMoreTokens() )
+        {
+            String part = tok.nextToken();
+
+            if ( !rootNode.getChildren().containsKey( part ) )
+            {
+                // TODO: i18n
+                addActionError( "The group specified was not found" );
+                return ERROR;
+            }
+            else
+            {
+                rootNode = (GroupTreeNode) rootNode.getChildren().get( part );
+            }
+        }
+
+        this.groups = collateGroups( rootNode );
+
+        List records = index.search(
+            new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.GROUPID_EXACT, groupId ) ) ) );
+
+        Set artifactIds = new HashSet();
+        for ( Iterator i = records.iterator(); i.hasNext(); )
+        {
+            StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next();
+            artifactIds.add( record.getArtifactId() );
+        }
+        this.artifactIds = new ArrayList( artifactIds );
+        Collections.sort( this.artifactIds );
+
+        return SUCCESS;
+    }
+
+    public String browseArtifact()
+        throws ConfigurationStoreException, RepositoryIndexException, IOException, RepositoryIndexSearchException
+    {
+        RepositoryArtifactIndex index = getIndex();
+
+        if ( StringUtils.isEmpty( groupId ) )
+        {
+            // TODO: i18n
+            addActionError( "You must specify a group ID to browse" );
+            return ERROR;
+        }
+
+        if ( StringUtils.isEmpty( artifactId ) )
+        {
+            // TODO: i18n
+            addActionError( "You must specify a artifact ID to browse" );
+            return ERROR;
+        }
+
+        BooleanQuery query = new BooleanQuery();
+        query.add( new TermQuery( new Term( StandardIndexRecordFields.GROUPID_EXACT, groupId ) ),
+                   BooleanClause.Occur.MUST );
+        query.add( new TermQuery( new Term( StandardIndexRecordFields.ARTIFACTID_EXACT, artifactId ) ),
+                   BooleanClause.Occur.MUST );
+
+        List records = index.search( new LuceneQuery( query ) );
+
+        if ( records.isEmpty() )
+        {
+            // TODO: i18n
+            addActionError( "Could not find any artifacts with the given group and artifact ID" );
+            return ERROR;
+        }
+
+        Set versions = new HashSet();
+        for ( Iterator i = records.iterator(); i.hasNext(); )
+        {
+            StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next();
+            versions.add( record.getVersion() );
+        }
+
+        this.versions = new ArrayList( versions );
+        Collections.sort( this.versions );
+
+        return SUCCESS;
+    }
+
+    private GroupTreeNode buildGroupTree( RepositoryArtifactIndex index )
+        throws IOException, RepositoryIndexSearchException
+    {
+        // TODO: give action message if indexing is in progress
+
+        // TODO: this will be inefficient over a very large number of artifacts, should be cached
+
+        List records = index.search( new LuceneQuery( new MatchAllDocsQuery() ) );
+
+        Set groups = new TreeSet();
+        for ( Iterator i = records.iterator(); i.hasNext(); )
+        {
+            StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next();
+            groups.add( record.getGroupId() );
+        }
+
+        GroupTreeNode rootNode = new GroupTreeNode();
+
+        // build a tree structure
+        for ( Iterator i = groups.iterator(); i.hasNext(); )
+        {
+            String groupId = (String) i.next();
+
+            StringTokenizer tok = new StringTokenizer( groupId, GROUP_SEPARATOR );
+
+            GroupTreeNode node = rootNode;
+
+            while ( tok.hasMoreTokens() )
+            {
+                String part = tok.nextToken();
+
+                if ( !node.getChildren().containsKey( part ) )
+                {
+                    GroupTreeNode newNode = new GroupTreeNode( part, node );
+                    node.addChild( newNode );
+                    node = newNode;
+                }
+                else
+                {
+                    node = (GroupTreeNode) node.getChildren().get( part );
+                }
+            }
+        }
+        return rootNode;
+    }
+
+    private List collateGroups( GroupTreeNode rootNode )
+    {
+        List groups = new ArrayList();
+        for ( Iterator i = rootNode.getChildren().values().iterator(); i.hasNext(); )
+        {
+            GroupTreeNode node = (GroupTreeNode) i.next();
+
+            while ( node.getChildren().size() == 1 )
+            {
+                node = (GroupTreeNode) node.getChildren().values().iterator().next();
+            }
+
+            groups.add( node.getFullName() );
+        }
+        return groups;
+    }
+
+    private RepositoryArtifactIndex getIndex()
+        throws ConfigurationStoreException, RepositoryIndexException
+    {
+        Configuration configuration = configurationStore.getConfigurationFromStore();
+        File indexPath = new File( configuration.getIndexPath() );
+
+        return factory.createStandardIndex( indexPath );
+    }
+
+    public List getGroups()
+    {
+        return groups;
+    }
+
+    public List getArtifactIds()
+    {
+        return artifactIds;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public List getVersions()
+    {
+        return versions;
+    }
+
+    private static class GroupTreeNode
+    {
+        private final String name;
+
+        private final String fullName;
+
+        private final Map children = new TreeMap();
+
+        GroupTreeNode()
+        {
+            name = null;
+            fullName = null;
+        }
+
+        GroupTreeNode( String name, GroupTreeNode parent )
+        {
+            this.name = name;
+            this.fullName = parent.fullName != null ? parent.fullName + GROUP_SEPARATOR + name : name;
+        }
+
+        public String getName()
+        {
+            return name;
+        }
+
+        public String getFullName()
+        {
+            return fullName;
+        }
+
+        public Map getChildren()
+        {
+            return children;
+        }
+
+        public void addChild( GroupTreeNode newNode )
+        {
+            children.put( newNode.name, newNode );
+        }
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ProxyAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ProxyAction.java
new file mode 100644 (file)
index 0000000..616f3f1
--- /dev/null
@@ -0,0 +1,104 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import org.apache.maven.archiva.proxy.ProxyException;
+import org.apache.maven.archiva.proxy.ProxyManager;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+/**
+ * Proxy functionality.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="proxyAction"
+ */
+public class ProxyAction
+    extends ActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private ProxyManager proxyManager;
+
+    private String path;
+
+    private String filename;
+
+    private String contentType;
+
+    private static final String NOT_FOUND = "notFound";
+
+    private InputStream artifactStream;
+
+    public String execute()
+        throws ProxyException
+    {
+        try
+        {
+            File file = proxyManager.get( path );
+
+            artifactStream = new FileInputStream( file );
+
+            // TODO: could be better
+            contentType = "application/octet-stream";
+
+            filename = file.getName();
+        }
+        catch ( ResourceDoesNotExistException e )
+        {
+            // TODO: set message?
+            return NOT_FOUND;
+        }
+        catch ( FileNotFoundException e )
+        {
+            // TODO: set message?
+            return NOT_FOUND;
+        }
+
+        return SUCCESS;
+    }
+
+    public String getPath()
+    {
+        return path;
+    }
+
+    public void setPath( String path )
+    {
+        this.path = path;
+    }
+
+    public String getFilename()
+    {
+        return filename;
+    }
+
+    public String getContentType()
+    {
+        return contentType;
+    }
+
+    public InputStream getArtifactStream()
+    {
+        return artifactStream;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
new file mode 100644 (file)
index 0000000..b4d5091
--- /dev/null
@@ -0,0 +1,181 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.queryParser.MultiFieldQueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.search.TermQuery;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
+import org.apache.maven.archiva.indexing.RepositoryArtifactIndex;
+import org.apache.maven.archiva.indexing.RepositoryArtifactIndexFactory;
+import org.apache.maven.archiva.indexing.RepositoryIndexException;
+import org.apache.maven.archiva.indexing.RepositoryIndexSearchException;
+import org.apache.maven.archiva.indexing.lucene.LuceneQuery;
+import org.apache.maven.archiva.indexing.record.StandardIndexRecordFields;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.List;
+
+/**
+ * Search all indexed fields by the given criteria.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="searchAction"
+ */
+public class SearchAction
+    extends ActionSupport
+{
+    /**
+     * Query string.
+     */
+    private String q;
+
+    /**
+     * The MD5 to search by.
+     */
+    private String md5;
+
+    /**
+     * Search results.
+     */
+    private List searchResults;
+
+    /**
+     * @plexus.requirement
+     */
+    private RepositoryArtifactIndexFactory factory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfiguredRepositoryFactory repositoryFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    private static final String NO_RESULTS = "noResults";
+
+    private static final String RESULTS = "results";
+
+    private static final String ARTIFACT = "artifact";
+
+    public String quickSearch()
+        throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException,
+        ConfigurationStoreException, ParseException
+    {
+        // TODO: give action message if indexing is in progress
+
+        assert q != null && q.length() != 0;
+
+        RepositoryArtifactIndex index = getIndex();
+
+        if ( !index.exists() )
+        {
+            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
+            return ERROR;
+        }
+
+        // TODO! this is correct, but ugly
+        MultiFieldQueryParser parser = new MultiFieldQueryParser( new String[]{StandardIndexRecordFields.GROUPID,
+            StandardIndexRecordFields.ARTIFACTID, StandardIndexRecordFields.BASE_VERSION,
+            StandardIndexRecordFields.CLASSIFIER, StandardIndexRecordFields.CLASSES, StandardIndexRecordFields.FILES,
+            StandardIndexRecordFields.TYPE, StandardIndexRecordFields.PROJECT_NAME,
+            StandardIndexRecordFields.PROJECT_DESCRIPTION}, new StandardAnalyzer() );
+        searchResults = index.search( new LuceneQuery( parser.parse( q ) ) );
+
+        return SUCCESS;
+    }
+
+    public String findArtifact()
+        throws Exception
+    {
+        // TODO: give action message if indexing is in progress
+
+        assert md5 != null && md5.length() != 0;
+
+        RepositoryArtifactIndex index = getIndex();
+
+        if ( !index.exists() )
+        {
+            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
+            return ERROR;
+        }
+
+        searchResults = index.search(
+            new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.MD5, md5.toLowerCase() ) ) ) );
+
+        if ( searchResults.isEmpty() )
+        {
+            return NO_RESULTS;
+        }
+        if ( searchResults.size() == 1 )
+        {
+            return ARTIFACT;
+        }
+        else
+        {
+            return RESULTS;
+        }
+    }
+
+    private RepositoryArtifactIndex getIndex()
+        throws ConfigurationStoreException, RepositoryIndexException
+    {
+        Configuration configuration = configurationStore.getConfigurationFromStore();
+        File indexPath = new File( configuration.getIndexPath() );
+
+        return factory.createStandardIndex( indexPath );
+    }
+
+    public String doInput()
+    {
+        return INPUT;
+    }
+
+    public String getQ()
+    {
+        return q;
+    }
+
+    public void setQ( String q )
+    {
+        this.q = q;
+    }
+
+    public String getMd5()
+    {
+        return md5;
+    }
+
+    public void setMd5( String md5 )
+    {
+        this.md5 = md5;
+    }
+
+    public List getSearchResults()
+    {
+        return searchResults;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
new file mode 100644 (file)
index 0000000..31ab2cc
--- /dev/null
@@ -0,0 +1,144 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Browse the repository.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="showArtifactAction"
+ */
+public class ShowArtifactAction
+    extends ActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private ArtifactFactory artifactFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfiguredRepositoryFactory repositoryFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private MavenProjectBuilder projectBuilder;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private Model model;
+
+    public String execute()
+        throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException
+    {
+        if ( StringUtils.isEmpty( groupId ) )
+        {
+            // TODO: i18n
+            addActionError( "You must specify a group ID to browse" );
+            return ERROR;
+        }
+
+        if ( StringUtils.isEmpty( artifactId ) )
+        {
+            // TODO: i18n
+            addActionError( "You must specify a artifact ID to browse" );
+            return ERROR;
+        }
+
+        if ( StringUtils.isEmpty( version ) )
+        {
+            // TODO: i18n
+            addActionError( "You must specify a version to browse" );
+            return ERROR;
+        }
+
+        Configuration configuration = configurationStore.getConfigurationFromStore();
+        List repositories = repositoryFactory.createRepositories( configuration );
+
+        Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
+        // TODO: maybe we can decouple the assembly parts of the project builder from the repository handling to get rid of the temp repo
+        ArtifactRepository localRepository = repositoryFactory.createLocalRepository( configuration );
+        MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, localRepository );
+
+        model = project.getModel();
+
+        return SUCCESS;
+    }
+
+    public Model getModel()
+    {
+        return model;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractConfigureRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractConfigureRepositoryAction.java
new file mode 100644 (file)
index 0000000..e901d5b
--- /dev/null
@@ -0,0 +1,153 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationChangeException;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+
+import java.io.IOException;
+
+/**
+ * Base action for repository configuration actions.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public abstract class AbstractConfigureRepositoryAction
+    extends ActionSupport
+    implements ModelDriven, Preparable
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    /**
+     * The repository.
+     */
+    private AbstractRepositoryConfiguration repository;
+
+    /**
+     * The repository ID to lookup when editing a repository.
+     */
+    private String repoId;
+
+    /**
+     * The previously read configuration.
+     */
+    protected Configuration configuration;
+
+    public String add()
+        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
+    {
+        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+
+        AbstractRepositoryConfiguration existingRepository = getRepository( repository.getId() );
+        if ( existingRepository != null )
+        {
+            addFieldError( "id", "A repository with that id already exists" );
+            return INPUT;
+        }
+
+        return saveConfiguration();
+    }
+
+    public String edit()
+        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
+    {
+        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+
+        AbstractRepositoryConfiguration existingRepository = getRepository( repository.getId() );
+        removeRepository( existingRepository );
+
+        return saveConfiguration();
+    }
+
+    protected abstract void removeRepository( AbstractRepositoryConfiguration existingRepository );
+
+    protected abstract AbstractRepositoryConfiguration getRepository( String id );
+
+    private String saveConfiguration()
+        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
+    {
+        addRepository();
+
+        configurationStore.storeConfiguration( configuration );
+
+        // TODO: do we need to check if indexing is needed?
+
+        addActionMessage( "Successfully saved configuration" );
+
+        return SUCCESS;
+    }
+
+    protected abstract void addRepository()
+        throws IOException;
+
+    public String input()
+    {
+        return INPUT;
+    }
+
+    public Object getModel()
+    {
+        return repository;
+    }
+
+    protected abstract AbstractRepositoryConfiguration createRepository();
+
+    public void prepare()
+        throws ConfigurationStoreException
+    {
+        configuration = configurationStore.getConfigurationFromStore();
+
+        if ( repository == null )
+        {
+            repository = getRepository( repoId );
+        }
+        if ( repository == null )
+        {
+            repository = createRepository();
+        }
+    }
+
+    public String getRepoId()
+    {
+        return repoId;
+    }
+
+    public void setRepoId( String repoId )
+    {
+        this.repoId = repoId;
+    }
+
+    protected AbstractRepositoryConfiguration getRepository()
+    {
+        return repository;
+    }
+
+    public Configuration getConfiguration()
+    {
+        return configuration;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractDeleteRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/AbstractDeleteRepositoryAction.java
new file mode 100644 (file)
index 0000000..83f92ed
--- /dev/null
@@ -0,0 +1,115 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationChangeException;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+import java.io.IOException;
+
+/**
+ * Base action for repository removal actions.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public abstract class AbstractDeleteRepositoryAction
+    extends PlexusActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    /**
+     * The repository ID to lookup when editing a repository.
+     */
+    protected String repoId;
+
+    /**
+     * Which operation to select.
+     */
+    private String operation = "unmodified";
+
+    public String execute()
+        throws ConfigurationStoreException, IOException, InvalidConfigurationException, ConfigurationChangeException
+    {
+        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+
+        if ( "delete-entry".equals( operation ) || "delete-contents".equals( operation ) )
+        {
+            Configuration configuration = configurationStore.getConfigurationFromStore();
+
+            AbstractRepositoryConfiguration existingRepository = getRepository( configuration );
+            if ( existingRepository == null )
+            {
+                addActionError( "A repository with that id does not exist" );
+                return ERROR;
+            }
+
+            // TODO: remove from index too!
+
+            removeRepository( configuration, existingRepository );
+
+            configurationStore.storeConfiguration( configuration );
+
+            if ( "delete-contents".equals( operation ) )
+            {
+                removeContents( existingRepository );
+            }
+        }
+
+        return SUCCESS;
+    }
+
+    protected abstract void removeContents( AbstractRepositoryConfiguration existingRepository )
+        throws IOException;
+
+    protected abstract AbstractRepositoryConfiguration getRepository( Configuration configuration );
+
+    protected abstract void removeRepository( Configuration configuration,
+                                              AbstractRepositoryConfiguration existingRepository );
+
+    public String input()
+    {
+        return INPUT;
+    }
+
+    public String getRepoId()
+    {
+        return repoId;
+    }
+
+    public void setRepoId( String repoId )
+    {
+        this.repoId = repoId;
+    }
+
+    public String getOperation()
+    {
+        return operation;
+    }
+
+    public void setOperation( String operation )
+    {
+        this.operation = operation;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java
new file mode 100644 (file)
index 0000000..b58aff5
--- /dev/null
@@ -0,0 +1,95 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationChangeException;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.apache.maven.archiva.indexing.RepositoryIndexException;
+import org.apache.maven.archiva.indexing.RepositoryIndexSearchException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Configures the application.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureAction"
+ */
+public class ConfigureAction
+    extends ActionSupport
+    implements ModelDriven, Preparable
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    /**
+     * The configuration.
+     */
+    private Configuration configuration;
+
+    public String execute()
+        throws IOException, RepositoryIndexException, RepositoryIndexSearchException, ConfigurationStoreException,
+        InvalidConfigurationException, ConfigurationChangeException
+    {
+        // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+        // TODO: if this is changed, do we move the index or recreate it?
+
+        // Normalize the path
+        File file = new File( configuration.getIndexPath() );
+        configuration.setIndexPath( file.getCanonicalPath() );
+        if ( !file.exists() )
+        {
+            file.mkdirs();
+            // TODO: error handling when this fails, or is not a directory
+        }
+
+        // Just double checking that our validation routines line up with what is expected in the configuration
+        assert configuration.isValid();
+
+        configurationStore.storeConfiguration( configuration );
+
+        // TODO: if the repository has changed, we need to check if indexing is needed
+
+        addActionMessage( "Successfully saved configuration" );
+
+        return SUCCESS;
+    }
+
+    public String input()
+    {
+        return INPUT;
+    }
+
+    public Object getModel()
+    {
+        return configuration;
+    }
+
+    public void prepare()
+        throws ConfigurationStoreException
+    {
+        configuration = configurationStore.getConfigurationFromStore();
+    }
+}
\ No newline at end of file
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureProxiedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureProxiedRepositoryAction.java
new file mode 100644 (file)
index 0000000..0179672
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ProxiedRepositoryConfiguration;
+
+import java.io.IOException;
+
+/**
+ * Configures the application repositories.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureProxiedRepositoryAction"
+ */
+public class ConfigureProxiedRepositoryAction
+    extends AbstractConfigureRepositoryAction
+{
+    protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
+    {
+        configuration.removeProxiedRepository( (ProxiedRepositoryConfiguration) existingRepository );
+    }
+
+    protected AbstractRepositoryConfiguration getRepository( String id )
+    {
+        return configuration.getProxiedRepositoryById( id );
+    }
+
+    protected void addRepository()
+        throws IOException
+    {
+        ProxiedRepositoryConfiguration repository = (ProxiedRepositoryConfiguration) getRepository();
+
+        configuration.addProxiedRepository( repository );
+    }
+
+    protected AbstractRepositoryConfiguration createRepository()
+    {
+        return new ProxiedRepositoryConfiguration();
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction.java
new file mode 100644 (file)
index 0000000..3de11d6
--- /dev/null
@@ -0,0 +1,66 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Configures the application repositories.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryAction"
+ */
+public class ConfigureRepositoryAction
+    extends AbstractConfigureRepositoryAction
+{
+    protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
+    {
+        configuration.removeRepository( (RepositoryConfiguration) existingRepository );
+    }
+
+    protected AbstractRepositoryConfiguration getRepository( String id )
+    {
+        return configuration.getRepositoryById( id );
+    }
+
+    protected void addRepository()
+        throws IOException
+    {
+        RepositoryConfiguration repository = (RepositoryConfiguration) getRepository();
+
+        // Normalize the path
+        File file = new File( repository.getDirectory() );
+        repository.setDirectory( file.getCanonicalPath() );
+        if ( !file.exists() )
+        {
+            file.mkdirs();
+            // TODO: error handling when this fails, or is not a directory
+        }
+
+        configuration.addRepository( repository );
+    }
+
+    protected AbstractRepositoryConfiguration createRepository()
+    {
+        RepositoryConfiguration repository = new RepositoryConfiguration();
+        repository.setIndexed( false );
+        return repository;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction.java
new file mode 100644 (file)
index 0000000..4eb9a8f
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.SyncedRepositoryConfiguration;
+
+import java.io.IOException;
+
+/**
+ * Configures the application repositories.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureSyncedRepositoryAction"
+ */
+public class ConfigureSyncedRepositoryAction
+    extends AbstractConfigureRepositoryAction
+{
+    protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
+    {
+        configuration.removeSyncedRepository( (SyncedRepositoryConfiguration) existingRepository );
+    }
+
+    protected AbstractRepositoryConfiguration getRepository( String id )
+    {
+        return configuration.getSyncedRepositoryById( id );
+    }
+
+    protected void addRepository()
+        throws IOException
+    {
+        SyncedRepositoryConfiguration repository = (SyncedRepositoryConfiguration) getRepository();
+
+        configuration.addSyncedRepository( repository );
+    }
+
+    protected AbstractRepositoryConfiguration createRepository()
+    {
+        return new SyncedRepositoryConfiguration();
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java
new file mode 100644 (file)
index 0000000..5de9b9a
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ProxiedRepositoryConfiguration;
+
+import java.io.IOException;
+
+/**
+ * Configures the application repositories.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteProxiedRepositoryAction"
+ */
+public class DeleteProxiedRepositoryAction
+    extends AbstractDeleteRepositoryAction
+{
+    protected AbstractRepositoryConfiguration getRepository( Configuration configuration )
+    {
+        return configuration.getProxiedRepositoryById( repoId );
+    }
+
+    protected void removeRepository( Configuration configuration, AbstractRepositoryConfiguration existingRepository )
+    {
+        configuration.removeProxiedRepository( (ProxiedRepositoryConfiguration) existingRepository );
+    }
+
+    protected void removeContents( AbstractRepositoryConfiguration existingRepository )
+        throws IOException
+    {
+        // TODO!
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteRepositoryAction.java
new file mode 100644 (file)
index 0000000..d28657e
--- /dev/null
@@ -0,0 +1,51 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.IOException;
+
+/**
+ * Configures the application repositories.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteRepositoryAction"
+ */
+public class DeleteRepositoryAction
+    extends AbstractDeleteRepositoryAction
+{
+    protected AbstractRepositoryConfiguration getRepository( Configuration configuration )
+    {
+        return configuration.getRepositoryById( repoId );
+    }
+
+    protected void removeRepository( Configuration configuration, AbstractRepositoryConfiguration existingRepository )
+    {
+        configuration.removeRepository( (RepositoryConfiguration) existingRepository );
+    }
+
+    protected void removeContents( AbstractRepositoryConfiguration existingRepository )
+        throws IOException
+    {
+        RepositoryConfiguration repository = (RepositoryConfiguration) existingRepository;
+        getLogger().info( "Removing " + repository.getDirectory() );
+        FileUtils.deleteDirectory( repository.getDirectory() );
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteSyncedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteSyncedRepositoryAction.java
new file mode 100644 (file)
index 0000000..dc286c6
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.SyncedRepositoryConfiguration;
+
+import java.io.IOException;
+
+/**
+ * Configures the application repositories.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteSyncedRepositoryAction"
+ */
+public class DeleteSyncedRepositoryAction
+    extends AbstractDeleteRepositoryAction
+{
+    protected AbstractRepositoryConfiguration getRepository( Configuration configuration )
+    {
+        return configuration.getSyncedRepositoryById( repoId );
+    }
+
+    protected void removeRepository( Configuration configuration, AbstractRepositoryConfiguration existingRepository )
+    {
+        configuration.removeSyncedRepository( (SyncedRepositoryConfiguration) existingRepository );
+    }
+
+    protected void removeContents( AbstractRepositoryConfiguration existingRepository )
+        throws IOException
+    {
+        // TODO!
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java
new file mode 100644 (file)
index 0000000..5517ca6
--- /dev/null
@@ -0,0 +1,43 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import org.apache.maven.archiva.scheduler.RepositoryTaskScheduler;
+import org.apache.maven.archiva.scheduler.TaskExecutionException;
+
+/**
+ * Configures the application.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="runIndexerAction"
+ */
+public class RunIndexerAction
+    extends ActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private RepositoryTaskScheduler taskScheduler;
+
+    public String execute()
+        throws TaskExecutionException
+    {
+        taskScheduler.runIndexer();
+
+        return SUCCESS;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java
new file mode 100644 (file)
index 0000000..afd7106
--- /dev/null
@@ -0,0 +1,74 @@
+package org.apache.maven.archiva.web.interceptor;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionInvocation;
+import com.opensymphony.xwork.interceptor.Interceptor;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+/**
+ * An interceptor that makes the application configuration available
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @todo might be a generally useful thing in plexus-xwork-integration
+ * @plexus.component role="com.opensymphony.xwork.interceptor.Interceptor" role-hint="configurationInterceptor"
+ */
+public class ConfigurationInterceptor
+    extends AbstractLogEnabled
+    implements Interceptor
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    public String intercept( ActionInvocation actionInvocation )
+        throws Exception
+    {
+        Configuration configuration = configurationStore.getConfigurationFromStore();
+
+        if ( !configuration.isValid() )
+        {
+            if ( configuration.getRepositories().isEmpty() )
+            {
+                getLogger().info( "No repositories were configured - forwarding to repository configuration page" );
+                return "config-repository-needed";
+            }
+            else
+            {
+                getLogger().info( "Configuration is incomplete - forwarding to configuration page" );
+                return "config-needed";
+            }
+        }
+        else
+        {
+            return actionInvocation.invoke();
+        }
+    }
+
+    public void destroy()
+    {
+        // This space left intentionally blank
+    }
+
+    public void init()
+    {
+        // This space left intentionally blank
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java
new file mode 100644 (file)
index 0000000..c686f72
--- /dev/null
@@ -0,0 +1,110 @@
+package org.apache.maven.archiva.web.mapper;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.webwork.dispatcher.mapper.ActionMapping;
+import com.opensymphony.webwork.dispatcher.mapper.DefaultActionMapper;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Map alternate URLs to specific actions. Used for the repository browser and the proxy.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class RepositoryActionMapper
+    extends DefaultActionMapper
+{
+    private static final String BROWSE_PREFIX = "/browse/";
+
+    private static final String PROXY_PREFIX = "/proxy/";
+
+    public String getUriFromActionMapping( ActionMapping actionMapping )
+    {
+        Map params = actionMapping.getParams();
+        if ( "browseGroup".equals( actionMapping.getName() ) )
+        {
+            return BROWSE_PREFIX + params.remove( "groupId" );
+        }
+        else if ( "browseArtifact".equals( actionMapping.getName() ) )
+        {
+            return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" );
+        }
+        else if ( "showArtifact".equals( actionMapping.getName() ) )
+        {
+            return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" ) + "/" +
+                params.remove( "version" );
+        }
+        else if ( "proxy".equals( actionMapping.getName() ) )
+        {
+            return PROXY_PREFIX + params.remove( "path" );
+        }
+
+        return super.getUriFromActionMapping( actionMapping );
+    }
+
+    public ActionMapping getMapping( HttpServletRequest httpServletRequest )
+    {
+        String path = httpServletRequest.getServletPath();
+        if ( path.startsWith( BROWSE_PREFIX ) )
+        {
+            path = path.substring( BROWSE_PREFIX.length() );
+            if ( path.length() == 0 )
+            {
+                return new ActionMapping( "browse", "/", "", null );
+            }
+            else
+            {
+                String[] parts = path.split( "/" );
+                if ( parts.length == 1 )
+                {
+                    Map params = new HashMap();
+                    params.put( "groupId", parts[0] );
+                    return new ActionMapping( "browseGroup", "/", "", params );
+                }
+                else if ( parts.length == 2 )
+                {
+                    Map params = new HashMap();
+                    params.put( "groupId", parts[0] );
+                    params.put( "artifactId", parts[1] );
+                    return new ActionMapping( "browseArtifact", "/", "", params );
+                }
+                else if ( parts.length == 3 )
+                {
+                    Map params = new HashMap();
+                    params.put( "groupId", parts[0] );
+                    params.put( "artifactId", parts[1] );
+                    params.put( "version", parts[2] );
+                    return new ActionMapping( "showArtifact", "/", "", params );
+                }
+            }
+        }
+        else if ( path.startsWith( PROXY_PREFIX ) )
+        {
+            // retain the leading /
+            path = path.substring( PROXY_PREFIX.length() - 1 );
+
+            Map params = new HashMap();
+            params.put( "path", path );
+            return new ActionMapping( "proxy", "/", "", params );
+        }
+
+        return super.getMapping( httpServletRequest );
+    }
+}
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/SearchAction-checksumSearch-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/SearchAction-checksumSearch-validation.xml
deleted file mode 100644 (file)
index 771a8ab..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
-    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
-  <field name="md5">
-    <field-validator type="requiredstring">
-      <message>
-        You must select a file, or enter the checksum. If the file was given and you receive this message,
-        there may have been an error generating the checksum.
-      </message>
-    </field-validator>
-  </field>
-</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/SearchAction-quickSearch-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/SearchAction-quickSearch-validation.xml
deleted file mode 100644 (file)
index 961cb7c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
-    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
-  <field name="q">
-    <field-validator type="requiredstring">
-      <message>You must enter some search terms.</message>
-    </field-validator>
-  </field>
-</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureAction-validation.xml
deleted file mode 100644 (file)
index 60b774b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
-    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
-  <field name="indexPath">
-    <field-validator type="requiredstring">
-      <message>You must enter the index directory.</message>
-    </field-validator>
-  </field>
-</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureProxiedRepositoryAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureProxiedRepositoryAction-validation.xml
deleted file mode 100644 (file)
index ee58ed9..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
-    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
-  <!-- TODO: constrain more -->
-  <field name="id">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository identifier.</message>
-    </field-validator>
-  </field>
-  <field name="name">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository name.</message>
-    </field-validator>
-  </field>
-  <field name="url">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository URL.</message>
-    </field-validator>
-  </field>
-  <!-- TODO: validate managed repository -->
-  <!-- TODO: validate layout -->
-  <!-- TODO: validate policies -->
-  <!-- TODO: validate that intervals are integers -->
-  <!-- TODO: validate that intervals are empty if policy is not interval -->
-</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureRepositoryAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureRepositoryAction-validation.xml
deleted file mode 100644 (file)
index 0a1bb77..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
-    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
-  <!-- TODO: constrain more -->
-  <field name="id">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository identifier.</message>
-    </field-validator>
-  </field>
-  <field name="name">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository name.</message>
-    </field-validator>
-  </field>
-  <field name="directory">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository directory.</message>
-    </field-validator>
-  </field>
-  <!-- TODO: validate layout -->
-</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction-addSelectedSyncedRepository-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction-addSelectedSyncedRepository-validation.xml
deleted file mode 100644 (file)
index 0a9f275..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
-    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
-  <field name="id">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository identifier.</message>
-    </field-validator>
-  </field>
-  <field name="name">
-    <field-validator type="requiredstring">
-      <message>You must enter the repository name.</message>
-    </field-validator>
-  </field>
-  <!-- TODO: validate managed repository -->
-  <!-- TODO: validate layout -->
-  <!-- TODO: validate sync settings, depending on what method -->
-</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/manager/web/action/admin/ConfigureSyncedRepositoryAction-validation.xml
deleted file mode 100644 (file)
index 154b28f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
-    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
-  <!-- TODO: constrain more -->
-  <field name="method">
-    <field-validator type="requiredstring">
-      <message>You must enter the synchronization method.</message>
-    </field-validator>
-  </field>
-</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/SearchAction-checksumSearch-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/SearchAction-checksumSearch-validation.xml
new file mode 100644 (file)
index 0000000..771a8ab
--- /dev/null
@@ -0,0 +1,29 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="md5">
+    <field-validator type="requiredstring">
+      <message>
+        You must select a file, or enter the checksum. If the file was given and you receive this message,
+        there may have been an error generating the checksum.
+      </message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/SearchAction-quickSearch-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/SearchAction-quickSearch-validation.xml
new file mode 100644 (file)
index 0000000..961cb7c
--- /dev/null
@@ -0,0 +1,26 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="q">
+    <field-validator type="requiredstring">
+      <message>You must enter some search terms.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAction-validation.xml
new file mode 100644 (file)
index 0000000..60b774b
--- /dev/null
@@ -0,0 +1,26 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="indexPath">
+    <field-validator type="requiredstring">
+      <message>You must enter the index directory.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureProxiedRepositoryAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureProxiedRepositoryAction-validation.xml
new file mode 100644 (file)
index 0000000..ee58ed9
--- /dev/null
@@ -0,0 +1,42 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <!-- TODO: constrain more -->
+  <field name="id">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository identifier.</message>
+    </field-validator>
+  </field>
+  <field name="name">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository name.</message>
+    </field-validator>
+  </field>
+  <field name="url">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository URL.</message>
+    </field-validator>
+  </field>
+  <!-- TODO: validate managed repository -->
+  <!-- TODO: validate layout -->
+  <!-- TODO: validate policies -->
+  <!-- TODO: validate that intervals are integers -->
+  <!-- TODO: validate that intervals are empty if policy is not interval -->
+</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureRepositoryAction-validation.xml
new file mode 100644 (file)
index 0000000..0a1bb77
--- /dev/null
@@ -0,0 +1,38 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <!-- TODO: constrain more -->
+  <field name="id">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository identifier.</message>
+    </field-validator>
+  </field>
+  <field name="name">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository name.</message>
+    </field-validator>
+  </field>
+  <field name="directory">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository directory.</message>
+    </field-validator>
+  </field>
+  <!-- TODO: validate layout -->
+</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction-addSelectedSyncedRepository-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction-addSelectedSyncedRepository-validation.xml
new file mode 100644 (file)
index 0000000..0a9f275
--- /dev/null
@@ -0,0 +1,34 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="id">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository identifier.</message>
+    </field-validator>
+  </field>
+  <field name="name">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository name.</message>
+    </field-validator>
+  </field>
+  <!-- TODO: validate managed repository -->
+  <!-- TODO: validate layout -->
+  <!-- TODO: validate sync settings, depending on what method -->
+</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureSyncedRepositoryAction-validation.xml
new file mode 100644 (file)
index 0000000..154b28f
--- /dev/null
@@ -0,0 +1,27 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <!-- TODO: constrain more -->
+  <field name="method">
+    <field-validator type="requiredstring">
+      <message>You must enter the synchronization method.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file
index 7da0abe60464679d8bd652e983698c92667e94cc..1ceb1567e3c9f2e52a585cacef9e9de970c28233 100644 (file)
@@ -1,5 +1,5 @@
 # define our own action mapper here
-webwork.mapper.class=org.apache.maven.archiva.manager.web.mapper.RepositoryActionMapper
+webwork.mapper.class=org.apache.maven.archiva.web.mapper.RepositoryActionMapper
 webwork.objectFactory = org.codehaus.plexus.xwork.PlexusObjectFactory
 
 # TODO: package up a theme and share with Continuum. Should contain everything from xhtml, and set templateDir to WEB-INF/themes
\ No newline at end of file