You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2007/08/18 15:37:48 UTC
svn commit: r567269 [4/4] - in /maven/archiva/branches/MRM-462:
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/
a...
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryConfigurationAdminTransformer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryConfigurationAdminTransformer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryConfigurationAdminTransformer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryConfigurationAdminTransformer.java Sat Aug 18 06:37:43 2007
@@ -20,7 +20,7 @@
*/
import org.apache.commons.collections.Transformer;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
@@ -28,13 +28,13 @@
import java.util.List;
/**
- * RepositoryConfigurationAdminTransformer
+ * RepositoryConfigurationAdminTransformer
*
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
- *
+ * @todo check usages!
* @plexus.component role="org.apache.commons.collections.Transformer"
- * role-hint="adminrepoconfig"
+ * role-hint="adminrepoconfig"
*/
public class RepositoryConfigurationAdminTransformer
implements Transformer
@@ -46,15 +46,12 @@
public Object transform( Object input )
{
- if ( input instanceof RepositoryConfiguration )
+ if ( input instanceof ManagedRepositoryConfiguration )
{
- RepositoryConfiguration repoconfig = (RepositoryConfiguration) input;
+ ManagedRepositoryConfiguration repoconfig = (ManagedRepositoryConfiguration) input;
AdminRepositoryConfiguration arepo = new AdminRepositoryConfiguration( repoconfig );
- if ( arepo.isManaged() )
- {
- arepo.setStats( getLatestStats( arepo.getId() ) );
- }
+ arepo.setStats( getLatestStats( arepo.getId() ) );
return arepo;
}
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/check/RoleExistanceEnvironmentCheck.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/check/RoleExistanceEnvironmentCheck.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/check/RoleExistanceEnvironmentCheck.java (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/check/RoleExistanceEnvironmentCheck.java Sat Aug 18 06:37:43 2007
@@ -19,7 +19,6 @@
* under the License.
*/
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.ObjectNotFoundException;
@@ -68,22 +67,20 @@
{
List repos = dao.getRepositoryDAO().getRepositories();
- if ( hasManagedRepository( repos ) )
+ // TODO! this be skipping non-managed repos
+ Iterator it = repos.iterator();
+ while ( it.hasNext() )
{
- Iterator it = repos.iterator();
- while ( it.hasNext() )
+ ArchivaRepository repository = (ArchivaRepository) it.next();
+
+ if ( !roleManager.templatedRoleExists( "archiva-repository-manager", repository.getId() ) )
{
- ArchivaRepository repository = (ArchivaRepository) it.next();
+ roleManager.createTemplatedRole( "archiva-repository-manager", repository.getId() );
+ }
- if ( !roleManager.templatedRoleExists( "archiva-repository-manager", repository.getId() ) )
- {
- roleManager.createTemplatedRole( "archiva-repository-manager", repository.getId() );
- }
-
- if ( !roleManager.templatedRoleExists( "archiva-repository-observer", repository.getId() ) )
- {
- roleManager.createTemplatedRole( "archiva-repository-observer", repository.getId() );
- }
+ if ( !roleManager.templatedRoleExists( "archiva-repository-observer", repository.getId() ) )
+ {
+ roleManager.createTemplatedRole( "archiva-repository-observer", repository.getId() );
}
}
}
@@ -94,7 +91,8 @@
}
catch ( ObjectNotFoundException e )
{
- list.add( this.getClass().getName() + "error initializing roles (repository not found): " + e.getMessage() );
+ list.add(
+ this.getClass().getName() + "error initializing roles (repository not found): " + e.getMessage() );
getLogger().info( "error initializing roles", e );
}
catch ( ArchivaDatabaseException e )
@@ -107,18 +105,4 @@
}
}
- public boolean hasManagedRepository( List repos )
- {
- Iterator it = repos.iterator();
- while ( it.hasNext() )
- {
- ArchivaRepository repo = (ArchivaRepository) it.next();
- if ( repo.isManaged() )
- {
- return true;
- }
- }
-
- return false;
- }
}
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java Sat Aug 18 06:37:43 2007
@@ -22,16 +22,10 @@
import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.interceptor.Interceptor;
-
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.codehaus.plexus.logging.AbstractLogEnabled;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.http.HttpSession;
+import javax.servlet.ServletContext;
/**
* An interceptor that makes the configuration bits available, both to the application and the webapp
@@ -45,41 +39,18 @@
implements Interceptor
{
/**
- * @plexus.requirement role-hint="jdo"
- */
- private ArchivaDAO dao;
-
- /**
* @plexus.requirement role-hint="default"
*/
private ArchivaConfiguration configuration;
-
- /**
- * @param actionInvocation
- * @return
- * @throws Exception
- */
+
public String intercept( ActionInvocation actionInvocation )
throws Exception
{
// populate webapp configuration bits into the session
- HttpSession session = ServletActionContext.getRequest().getSession();
- if ( session != null )
- {
- session.setAttribute( "uiOptions", configuration.getConfiguration().getWebapp().getUi() );
- }
-
- List repos = dao.getRepositoryDAO().getRepositories();
-
- if ( !hasManagedRepository( repos ) )
- {
- getLogger().info( "No repositories exist - forwarding to repository configuration page" );
- return "config-repository-needed";
- }
- else
- {
- return actionInvocation.invoke();
- }
+ ServletContext applicationScope = ServletActionContext.getServletContext();
+ applicationScope.setAttribute( "uiOptions", configuration.getConfiguration().getWebapp().getUi() );
+
+ return actionInvocation.invoke();
}
public void destroy()
@@ -92,28 +63,4 @@
// This space left intentionally blank
}
- public boolean hasManagedRepository( List repos )
- {
- if ( repos == null )
- {
- return false;
- }
-
- if ( repos.isEmpty() )
- {
- return false;
- }
-
- Iterator it = repos.iterator();
- while ( it.hasNext() )
- {
- ArchivaRepository repo = (ArchivaRepository) it.next();
- if ( repo.isManaged() )
- {
- return true;
- }
- }
-
- return false;
- }
}
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java Sat Aug 18 06:37:43 2007
@@ -21,7 +21,7 @@
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
@@ -78,7 +78,7 @@
private BidirectionalRepositoryLayout layout;
- private RepositoryConfiguration repositoryConfiguration;
+ private ManagedRepositoryConfiguration repositoryConfiguration;
private ArchivaRepository managedRepository;
@@ -109,7 +109,7 @@
Configuration config = archivaConfiguration.getConfiguration();
- repositoryConfiguration = config.findRepositoryById( getPrefix() );
+ repositoryConfiguration = config.findManagedRepositoryById( getPrefix() );
managedRepository = ArchivaConfigurationAdaptor.toArchivaRepository( repositoryConfiguration );
@@ -214,7 +214,6 @@
{
connectors.fetchFromProxies( managedRepository, project );
request.getRequest().setPathInfo( layout.toPath( project ) );
- return;
}
}
catch ( LayoutException e )
@@ -228,7 +227,7 @@
}
}
- public RepositoryConfiguration getRepositoryConfiguration()
+ public ManagedRepositoryConfiguration getRepositoryConfiguration()
{
return repositoryConfiguration;
}
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java Sat Aug 18 06:37:43 2007
@@ -19,15 +19,9 @@
* under the License.
*/
-import org.apache.commons.collections.Closure;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.functors.IfClosure;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.configuration.functors.LocalRepositoryPredicate;
-import org.apache.maven.archiva.configuration.functors.RepositoryConfigurationToMapClosure;
-import org.apache.maven.archiva.model.RepositoryURL;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authentication.AuthenticationException;
import org.codehaus.plexus.redback.authentication.AuthenticationResult;
@@ -46,6 +40,10 @@
import org.codehaus.plexus.webdav.servlet.multiplexed.MultiplexedWebDavServlet;
import org.codehaus.plexus.webdav.util.WebdavMethodUtil;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@@ -53,11 +51,6 @@
import java.util.List;
import java.util.Map;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* RepositoryServlet
*
@@ -88,7 +81,8 @@
*/
private ArchivaConfiguration configuration;
- private Map repositoryMap = new HashMap();
+ private Map<String, ManagedRepositoryConfiguration> repositoryMap =
+ new HashMap<String, ManagedRepositoryConfiguration>();
public void initComponents()
throws ServletException
@@ -108,26 +102,20 @@
public void initServers( ServletConfig servletConfig )
throws DavServerException
{
- List repositories = configuration.getConfiguration().getRepositories();
+ List repositories = configuration.getConfiguration().getManagedRepositories();
Iterator itrepos = repositories.iterator();
while ( itrepos.hasNext() )
{
- RepositoryConfiguration repo = (RepositoryConfiguration) itrepos.next();
- if ( !repo.isManaged() )
- {
- // Skip non-managed.
- continue;
- }
+ ManagedRepositoryConfiguration repo = (ManagedRepositoryConfiguration) itrepos.next();
- RepositoryURL url = new RepositoryURL( repo.getUrl() );
- File repoDir = new File( url.getPath() );
+ File repoDir = new File( repo.getLocation() );
if ( !repoDir.exists() )
{
if ( !repoDir.mkdirs() )
{
// Skip invalid directories.
- log( "Unable to create missing directory for " + url.getPath() );
+ log( "Unable to create missing directory for " + repo.getLocation() );
continue;
}
}
@@ -138,17 +126,18 @@
}
}
- public RepositoryConfiguration getRepository( DavServerRequest request )
+ public ManagedRepositoryConfiguration getRepository( DavServerRequest request )
{
+ // TODO: use sync wrapper instead?
synchronized ( this.repositoryMap )
{
- return (RepositoryConfiguration) repositoryMap.get( request.getPrefix() );
+ return repositoryMap.get( request.getPrefix() );
}
}
public String getRepositoryName( DavServerRequest request )
{
- RepositoryConfiguration repoConfig = getRepository( request );
+ ManagedRepositoryConfiguration repoConfig = getRepository( request );
if ( repoConfig == null )
{
return "Unknown";
@@ -159,14 +148,10 @@
private void updateRepositoryMap()
{
- RepositoryConfigurationToMapClosure repoMapClosure = new RepositoryConfigurationToMapClosure();
- Closure localRepoMap = IfClosure.getInstance( LocalRepositoryPredicate.getInstance(), repoMapClosure );
- CollectionUtils.forAllDo( configuration.getConfiguration().getRepositories(), localRepoMap );
-
synchronized ( this.repositoryMap )
{
this.repositoryMap.clear();
- this.repositoryMap.putAll( repoMapClosure.getMap() );
+ this.repositoryMap.putAll( configuration.getConfiguration().getManagedRepositoriesAsMap() );
}
}
@@ -180,7 +165,7 @@
{
AuthenticationResult result = httpAuth.getAuthenticationResult( request, response );
- if ( ( result != null ) && !result.isAuthenticated() )
+ if ( result != null && !result.isAuthenticated() )
{
// Must Authenticate.
httpAuth.challenge( request, response, "Repository " + getRepositoryName( davRequest ),
@@ -232,9 +217,9 @@
{
if ( authzResult.getException() != null )
{
- log( "Authorization Denied [ip=" + request.getRemoteAddr() + ",isWriteRequest=" + isWriteRequest
- + ",permission=" + permission + ",repo=" + davRequest.getPrefix() + "] : "
- + authzResult.getException().getMessage() );
+ log( "Authorization Denied [ip=" + request.getRemoteAddr() + ",isWriteRequest=" + isWriteRequest +
+ ",permission=" + permission + ",repo=" + davRequest.getPrefix() + "] : " +
+ authzResult.getException().getMessage() );
}
// Issue HTTP Challenge.
@@ -258,7 +243,7 @@
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
- if ( ConfigurationNames.isRepositories( propertyName ) )
+ if ( ConfigurationNames.isManagedRepositories( propertyName ) )
{
// Attempt to reduce the number of times we refresh the repository map.
if ( propertyName.endsWith( ".id" ) || propertyName.endsWith( ".url" ) )
@@ -275,8 +260,8 @@
}
catch ( DavServerException e )
{
- log( "Error restarting WebDAV server after configuration change - service disabled: "
- + e.getMessage(), e );
+ log( "Error restarting WebDAV server after configuration change - service disabled: " +
+ e.getMessage(), e );
}
}
}
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ConfigurationSynchronization.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ConfigurationSynchronization.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ConfigurationSynchronization.java (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ConfigurationSynchronization.java Sat Aug 18 06:37:43 2007
@@ -19,9 +19,10 @@
* under the License.
*/
+import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.ObjectNotFoundException;
@@ -39,14 +40,12 @@
import java.util.List;
/**
- * ConfigurationSynchronization
+ * ConfigurationSynchronization
*
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
- *
- * @plexus.component
- * role="org.apache.maven.archiva.web.startup.ConfigurationSynchronization"
- * role-hint="default"
+ * @plexus.component role="org.apache.maven.archiva.web.startup.ConfigurationSynchronization"
+ * role-hint="default"
*/
public class ConfigurationSynchronization
extends AbstractLogEnabled
@@ -69,9 +68,10 @@
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
- if ( ConfigurationNames.isRepositories( propertyName ) )
+ // TODO! this used to store both types, but do we even need it?
+ if ( ConfigurationNames.isManagedRepositories( propertyName ) )
{
- synchConfiguration();
+ synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
}
}
@@ -80,13 +80,12 @@
/* do nothing */
}
- private void synchConfiguration()
+ private void synchConfiguration( List repos )
{
- List repos = archivaConfiguration.getConfiguration().getRepositories();
Iterator it = repos.iterator();
while ( it.hasNext() )
{
- RepositoryConfiguration repoConfig = (RepositoryConfiguration) it.next();
+ ManagedRepositoryConfiguration repoConfig = (ManagedRepositoryConfiguration) it.next();
try
{
try
@@ -95,7 +94,7 @@
// Found repository. Update it.
repository.getModel().setName( repoConfig.getName() );
- repository.getModel().setUrl( repoConfig.getUrl() );
+ repository.getModel().setUrl( PathUtil.toUrl( repoConfig.getLocation() ) );
repository.getModel().setLayoutName( repoConfig.getLayout() );
repository.getModel().setCreationSource( "configuration" );
repository.getModel().setReleasePolicy( repoConfig.isReleases() );
@@ -143,7 +142,7 @@
public void initialize()
throws InitializationException
{
- synchConfiguration();
+ synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
archivaConfiguration.addChangeListener( this );
}
}
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java Sat Aug 18 06:37:43 2007
@@ -1,22 +1,39 @@
package org.apache.maven.archiva.web.tags;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.web.util.ContextUtils;
import org.codehaus.plexus.logging.AbstractLogEnabled;
-import java.io.IOException;
-
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
+import java.io.IOException;
/**
- * CopyPasteSnippet
+ * CopyPasteSnippet
*
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
- *
* @plexus.component role="org.apache.maven.archiva.web.tags.CopyPasteSnippet"
*/
public class CopyPasteSnippet
@@ -32,9 +49,9 @@
buf.append( "Error generating snippet." );
getLogger().error( "Unable to generate snippet for null object." );
}
- else if ( o instanceof RepositoryConfiguration )
+ else if ( o instanceof ManagedRepositoryConfiguration )
{
- createSnippet( buf, (RepositoryConfiguration) o, pageContext );
+ createSnippet( buf, (ManagedRepositoryConfiguration) o, pageContext );
}
else
{
@@ -53,7 +70,7 @@
}
}
- private void createSnippet( StringBuffer snippet, RepositoryConfiguration repo, PageContext pageContext )
+ private void createSnippet( StringBuffer snippet, ManagedRepositoryConfiguration repo, PageContext pageContext )
{
snippet.append( "<project>\n" );
snippet.append( " ...\n" );
@@ -83,15 +100,8 @@
snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" );
snippet.append( " <url>" );
- if ( repo.isManaged() )
- {
- snippet.append( ContextUtils.getBaseURL( pageContext, "repository" ) );
- snippet.append( "/" ).append( repo.getId() ).append( "/" );
- }
- else
- {
- snippet.append( repo.getUrl() );
- }
+ snippet.append( ContextUtils.getBaseURL( pageContext, "repository" ) );
+ snippet.append( "/" ).append( repo.getId() ).append( "/" );
snippet.append( "</url>\n" );
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/resources/xwork.xml?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/resources/xwork.xml Sat Aug 18 06:37:43 2007
@@ -30,6 +30,7 @@
<package name="base" extends="webwork-default">
<interceptors>
+ <!-- TODO! eh? -->
<interceptor name="strange" class="webwork-is-doing-strange-things"/>
<interceptor name="configuration" class="configurationInterceptor"/>
<interceptor name="redbackForceAdminUser" class="redbackForceAdminUserInterceptor"/>
@@ -89,13 +90,6 @@
<result name="config-needed" type="redirect-action">
<param name="namespace">/admin</param>
<param name="actionName">repositories</param>
- </result>
-
- <!-- This redirect is triggered by the configuration interceptor -->
- <result name="config-repository-needed" type="redirect-action">
- <param name="namespace">/admin</param>
- <param name="actionName">addRepository</param>
- <param name="method">input</param>
</result>
<!-- The following security-* result names arrive from the plexus-security package -->
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp Sat Aug 18 06:37:43 2007
@@ -19,7 +19,7 @@
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
+<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %>
<html>
@@ -34,197 +34,202 @@
<div id="contentArea">
-<ww:actionerror />
-<ww:actionmessage />
+<ww:actionerror/>
+<ww:actionmessage/>
<div class="admin">
- <div class="controls">
- <redback:ifAuthorized permission="archiva-manage-configuration">
- <ww:url id="addRepositoryUrl" action="addRepository"/>
- <ww:a href="%{addRepositoryUrl}">
- <img src="<c:url value="/images/icons/create.png" />" />
- Add Repository</ww:a>
- </redback:ifAuthorized>
- </div>
- <h2>Managed Repositories</h2>
+<div class="controls">
+ <redback:ifAuthorized permission="archiva-manage-configuration">
+ <ww:url id="addRepositoryUrl" action="addRepository"/>
+ <ww:a href="%{addRepositoryUrl}">
+ <img src="<c:url value="/images/icons/create.png" />"/>
+ Add Repository
+ </ww:a>
+ </redback:ifAuthorized>
+</div>
+<h2>Managed Repositories</h2>
<c:choose>
- <c:when test="${empty(managedRepositories)}">
- <%-- No Managed Repositories. --%>
- <strong>There are no managed repositories configured yet.</strong>
+<c:when test="${empty(managedRepositories)}">
+ <%-- No Managed Repositories. --%>
+ <strong>There are no managed repositories configured yet.</strong>
+</c:when>
+<c:otherwise>
+<%-- Display the repositories. --%>
+
+<c:forEach items="${managedRepositories}" var="repository" varStatus="i">
+<c:choose>
+ <c:when test='${(i.index)%2 eq 0}'>
+ <c:set var="rowColor" value="dark" scope="page"/>
</c:when>
<c:otherwise>
- <%-- Display the repositories. --%>
-
- <c:forEach items="${managedRepositories}" var="repository" varStatus="i">
+ <c:set var="rowColor" value="lite" scope="page"/>
+ </c:otherwise>
+</c:choose>
+
+<div class="repository ${rowColor}">
+
+<div class="controls">
+ <%-- TODO: make some icons --%>
+ <redback:ifAnyAuthorized permissions="archiva-manage-configuration">
+ <ww:url id="editRepositoryUrl" action="editRepository">
+ <ww:param name="repoid" value="%{'${repository.id}'}"/>
+ </ww:url>
+ <ww:url id="deleteRepositoryUrl" action="deleteRepository" method="confirm">
+ <ww:param name="repoid" value="%{'${repository.id}'}"/>
+ </ww:url>
+ <ww:a href="%{editRepositoryUrl}">
+ <img src="<c:url value="/images/icons/edit.png" />"/>
+ Edit Repository
+ </ww:a>
+ <ww:a href="%{deleteRepositoryUrl}">
+ <img src="<c:url value="/images/icons/delete.gif" />"/>
+ Delete Repository
+ </ww:a>
+ </redback:ifAnyAuthorized>
+</div>
+
+<div style="float: left">
+ <img src="<c:url value="/images/archiva-splat-32.gif"/>"/>
+</div>
+
+<h3 class="repository">${repository.name}</h3>
+
+<table class="infoTable">
+<tr>
+ <th>Identifier</th>
+ <td>
+ <code>${repository.id}</code>
+ </td>
+</tr>
+<tr>
+ <th>Name</th>
+ <td>
+ <code>${repository.name}</code>
+ </td>
+</tr>
+<tr>
+ <th>Directory</th>
+ <td>${repository.location}
+ <c:if test="${not(repository.directoryExists)}">
+ <span class="missing">Directory Does Not Exist</span>
+ </c:if>
+ </td>
+</tr>
+<tr>
+ <th>WebDAV URL</th>
+ <td><a href="${baseUrl}/${repository.id}/">${baseUrl}/${repository.id}/</a></td>
+</tr>
+<tr>
+ <th>Type</th>
+ <%-- TODO: can probably just use layout appended to a key prefix in i18n to simplify this --%>
+ <td>
+ <c:choose>
+ <c:when test="${repository.layout == 'default'}">
+ Maven 2.x Repository
+ </c:when>
+ <c:otherwise>
+ Maven 1.x Repository
+ </c:otherwise>
+ </c:choose>
+ </td>
+</tr>
+<tr>
+ <th>Repository Purge By Days Older Than</th>
+ <td>${repository.daysOlder}</td>
+</tr>
+<tr>
+ <th>Repository Purge By Retention Count</th>
+ <td>${repository.retentionCount}</td>
+</tr>
+<tr>
+ <th>Releases Included</th>
+ <td class="${repository.releases ? 'donemark' : 'errormark'} booleanIcon"> ${repository.releases}</td>
+</tr>
+<tr>
+ <th>Snapshots Included</th>
+ <td class="${repository.snapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.snapshots}</td>
+</tr>
+<tr>
+ <th>Scanned</th>
+ <td class="${repository.indexed ? 'donemark' : 'errormark'} booleanIcon"> ${repository.indexed}</td>
+</tr>
+<tr>
+ <th>Delete Released Snapshots</th>
+ <td class="${repository.deleteReleasedSnapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.deleteReleasedSnapshots}</td>
+</tr>
+<c:if test="${repository.indexed}">
+ <tr>
+ <th>Scanning Cron</th>
+ <td>${repository.refreshCronExpression}</td>
+ </tr>
+ <tr>
+ <th>
+ Actions
+ </th>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <redback:ifAuthorized permission="archiva-run-indexer">
+ <ww:form action="indexRepository" theme="simple">
+ <ww:hidden name="repoid" value="%{'${repository.id}'}"/>
+ <ww:submit value="Scan Repository Now"/>
+ </ww:form>
+ </redback:ifAuthorized>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th>Stats</th>
+ <td>
<c:choose>
- <c:when test='${(i.index)%2 eq 0}'>
- <c:set var="rowColor" value="dark" scope="page" />
+ <c:when test="${empty(repository.stats)}">
+ No Statistics Available.
</c:when>
<c:otherwise>
- <c:set var="rowColor" value="lite" scope="page" />
- </c:otherwise>
- </c:choose>
-
- <div class="repository ${rowColor}">
-
- <div class="controls">
- <%-- TODO: make some icons --%>
- <redback:ifAnyAuthorized permissions="archiva-manage-configuration">
- <ww:url id="editRepositoryUrl" action="editRepository">
- <ww:param name="repoid" value="%{'${repository.id}'}" />
- </ww:url>
- <ww:url id="deleteRepositoryUrl" action="deleteRepository" method="confirm">
- <ww:param name="repoid" value="%{'${repository.id}'}" />
- </ww:url>
- <ww:a href="%{editRepositoryUrl}">
- <img src="<c:url value="/images/icons/edit.png" />" />
- Edit Repository</ww:a>
- <ww:a href="%{deleteRepositoryUrl}">
- <img src="<c:url value="/images/icons/delete.gif" />" />
- Delete Repository</ww:a>
- </redback:ifAnyAuthorized>
- </div>
-
- <div style="float: left">
- <img src="<c:url value="/images/archiva-splat-32.gif"/>" />
- </div>
-
- <h3 class="repository">${repository.name}</h3>
-
- <table class="infoTable">
- <tr>
- <th>Identifier</th>
- <td>
- <code>${repository.id}</code>
- </td>
- </tr>
- <tr>
- <th>Name</th>
- <td>
- <code>${repository.name}</code>
- </td>
- </tr>
- <tr>
- <th>Directory</th>
- <td>${repository.directory}
- <c:if test="${not(repository.directoryExists)}">
- <span class="missing">Directory Does Not Exist</span>
- </c:if>
- </td>
- </tr>
- <tr>
- <th>WebDAV URL</th>
- <td><a href="${baseUrl}/${repository.id}/">${baseUrl}/${repository.id}/</a></td>
- </tr>
- <tr>
- <th>Type</th>
- <%-- TODO: can probably just use layout appended to a key prefix in i18n to simplify this --%>
- <td>
- <c:choose>
- <c:when test="${repository.layout == 'default'}">
- Maven 2.x Repository
- </c:when>
- <c:otherwise>
- Maven 1.x Repository
- </c:otherwise>
- </c:choose>
- </td>
- </tr>
- <tr>
- <th>Repository Purge By Days Older Than</th>
- <td>${repository.daysOlder}</td>
- </tr>
- <tr>
- <th>Repository Purge By Retention Count</th>
- <td>${repository.retentionCount}</td>
- </tr>
- <tr>
- <th>Releases Included</th>
- <td class="${repository.releases ? 'donemark' : 'errormark'} booleanIcon"> ${repository.releases}</td>
- </tr>
- <tr>
- <th>Snapshots Included</th>
- <td class="${repository.snapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.snapshots}</td>
- </tr>
- <tr>
- <th>Scanned</th>
- <td class="${repository.indexed ? 'donemark' : 'errormark'} booleanIcon"> ${repository.indexed}</td>
- </tr>
- <tr>
- <th>Delete Released Snapshots</th>
- <td class="${repository.deleteReleasedSnapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.deleteReleasedSnapshots}</td>
- </tr>
- <c:if test="${repository.indexed}">
+ <table>
<tr>
- <th>Scanning Cron</th>
- <td>${repository.refreshCronExpression}</td>
+ <th>Last Scanned</th>
+ <td>${repository.stats.whenGathered}</td>
</tr>
<tr>
- <th>
- Actions
- </th>
- <td>
- <table>
- <tr>
- <td>
- <redback:ifAuthorized permission="archiva-run-indexer">
- <ww:form action="indexRepository" theme="simple">
- <ww:hidden name="repoid" value="%{'${repository.id}'}"/>
- <ww:submit value="Scan Repository Now"/>
- </ww:form>
- </redback:ifAuthorized>
- </td>
- </tr>
- </table>
- </td>
+ <th>Duration</th>
+ <td>${repository.stats.duration} ms</td>
</tr>
<tr>
- <th>Stats</th>
- <td>
- <c:choose>
- <c:when test="${empty(repository.stats)}">
- No Statistics Available.
- </c:when>
- <c:otherwise>
- <table>
- <tr>
- <th>Last Scanned</th>
- <td>${repository.stats.whenGathered}</td>
- </tr>
- <tr>
- <th>Duration</th>
- <td>${repository.stats.duration} ms</td>
- </tr>
- <tr>
- <th>Total File Count</th>
- <td>${repository.stats.totalFileCount}
- </tr>
- <tr>
- <th>New Files Found</th>
- <td>${repository.stats.newFileCount}
- </tr>
- </table>
- </c:otherwise>
- </c:choose>
- </td>
+ <th>Total File Count</th>
+ <td>${repository.stats.totalFileCount}
</tr>
- </c:if>
- <tr>
- <th>POM Snippet</th>
- <td><a href="#" onclick="Effect.toggle('repoPom${repository.id}','slide'); return false;">Show POM Snippet</a><br/>
-<pre class="pom" style="display: none;" id="repoPom${repository.id}"><code><archiva:copy-paste-snippet object="${repository}" /></code></pre>
- </td>
- </tr>
- </table>
-
- </div>
- </c:forEach>
-
- </c:otherwise>
+ <tr>
+ <th>New Files Found</th>
+ <td>${repository.stats.newFileCount}
+ </tr>
+ </table>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+</c:if>
+<tr>
+ <th>POM Snippet</th>
+ <td><a href="#" onclick="Effect.toggle('repoPom${repository.id}','slide'); return false;">Show POM Snippet</a><br/>
+ <pre class="pom" style="display: none;" id="repoPom${repository.id}"><code>
+ <archiva:copy-paste-snippet object="${repository}"/>
+ </code></pre>
+ </td>
+</tr>
+</table>
+
+</div>
+</c:forEach>
+
+</c:otherwise>
</c:choose>
- <h2>Remote Repositories</h2>
+<h2>Remote Repositories</h2>
<c:choose>
<c:when test="${empty(remoteRepositories)}">
@@ -233,43 +238,45 @@
</c:when>
<c:otherwise>
<%-- Display the repositories. --%>
-
+
<c:forEach items="${remoteRepositories}" var="repository" varStatus="i">
<c:choose>
<c:when test='${(i.index)%2 eq 0}'>
- <c:set var="rowColor" value="dark" scope="page" />
+ <c:set var="rowColor" value="dark" scope="page"/>
</c:when>
<c:otherwise>
- <c:set var="rowColor" value="lite" scope="page" />
+ <c:set var="rowColor" value="lite" scope="page"/>
</c:otherwise>
</c:choose>
-
+
<div class="repository ${rowColor}">
<div class="controls">
- <%-- TODO: make some icons --%>
+ <%-- TODO: make some icons --%>
<redback:ifAnyAuthorized permissions="archiva-manage-configuration">
<ww:url id="editRepositoryUrl" action="editRepository">
- <ww:param name="repoid" value="%{'${repository.id}'}" />
+ <ww:param name="repoid" value="%{'${repository.id}'}"/>
</ww:url>
<ww:url id="deleteRepositoryUrl" action="deleteRepository" method="confirm">
- <ww:param name="repoid" value="%{'${repository.id}'}" />
+ <ww:param name="repoid" value="%{'${repository.id}'}"/>
</ww:url>
<ww:a href="%{editRepositoryUrl}">
- <img src="<c:url value="/images/icons/edit.png" />" />
- Edit Repository</ww:a>
+ <img src="<c:url value="/images/icons/edit.png" />"/>
+ Edit Repository
+ </ww:a>
<ww:a href="%{deleteRepositoryUrl}">
- <img src="<c:url value="/images/icons/delete.gif" />" />
- Delete Repository</ww:a>
+ <img src="<c:url value="/images/icons/delete.gif" />"/>
+ Delete Repository
+ </ww:a>
</redback:ifAnyAuthorized>
</div>
-
+
<div style="float: left">
- <img src="<c:url value="/images/archiva-world.png"/>" />
+ <img src="<c:url value="/images/archiva-world.png"/>"/>
</div>
-
+
<h3 class="repository">${repository.name}</h3>
-
+
<table class="infoTable">
<tr>
<th>Identifier</th>
@@ -310,7 +317,7 @@
<td class="${repository.snapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.snapshots}</td>
</tr>
</table>
-
+
</div>
</c:forEach>
</c:otherwise>
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp Sat Aug 18 06:37:43 2007
@@ -23,7 +23,7 @@
<%@ taglib uri="/webwork" prefix="ww" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
-<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
+<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
<%@ page import="java.util.Calendar" %>
<html>
<head>
@@ -36,7 +36,7 @@
<link rel="stylesheet" href="<c:url value="/css/redback/table.css"/>" type="text/css" media="all"/>
<link rel="stylesheet" href="<c:url value="/css/site.css"/>" type="text/css" media="all"/>
<link rel="stylesheet" href="<c:url value="/css/print.css"/>" type="text/css" media="print"/>
- <link rel="shortcut icon" href="<c:url value="/favicon.ico" />" />
+ <link rel="shortcut icon" href="<c:url value="/favicon.ico" />"/>
<script type="text/javascript" src="<c:url value="/js/scriptaculous/prototype.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/scriptaculous/scriptaculous.js"/>"></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
@@ -83,8 +83,8 @@
<li class="none">
<my:currentWWUrl action="index" namespace="/">Search</my:currentWWUrl>
</li>
-
- <ww:if test="${sessionScope.uiOptions.showFindArtifacts}">
+
+ <ww:if test="${applicationScope.uiOptions.showFindArtifacts}">
<li class="none">
<my:currentWWUrl action="findArtifact" namespace="/">Find Artifact</my:currentWWUrl>
</li>
@@ -118,7 +118,7 @@
<my:currentWWUrl action="configureAppearance" namespace="/admin">Appearance</my:currentWWUrl>
</li>
</redback:ifAuthorized>
- <%-- TODO: future options here.
+ <%-- TODO: future options here.
* Repository Statistics.
* Web Services Statistics.
--%>
@@ -128,21 +128,21 @@
<redback:ifAuthorized permission="archiva-manage-configuration">
<h5>Administration</h5>
<ul>
- <li class="none">
- <my:currentWWUrl action="repositories" namespace="/admin">Repositories</my:currentWWUrl>
- </li>
- <li class="none">
- <my:currentWWUrl action="proxyConnectors" namespace="/admin">Proxy Connectors</my:currentWWUrl>
- </li>
- <li class="none">
- <my:currentWWUrl action="networkProxies" namespace="/admin">Network Proxies</my:currentWWUrl>
- </li>
- <li class="none">
- <my:currentWWUrl action="repositoryScanning" namespace="/admin">Repository Scanning</my:currentWWUrl>
- </li>
- <li class="none">
- <my:currentWWUrl action="database" namespace="/admin">Database</my:currentWWUrl>
- </li>
+ <li class="none">
+ <my:currentWWUrl action="repositories" namespace="/admin">Repositories</my:currentWWUrl>
+ </li>
+ <li class="none">
+ <my:currentWWUrl action="proxyConnectors" namespace="/admin">Proxy Connectors</my:currentWWUrl>
+ </li>
+ <li class="none">
+ <my:currentWWUrl action="networkProxies" namespace="/admin">Network Proxies</my:currentWWUrl>
+ </li>
+ <li class="none">
+ <my:currentWWUrl action="repositoryScanning" namespace="/admin">Repository Scanning</my:currentWWUrl>
+ </li>
+ <li class="none">
+ <my:currentWWUrl action="database" namespace="/admin">Database</my:currentWWUrl>
+ </li>
<%-- TODO: future options here.
* Repository Syncing Connectors. (rsync, ftp, scp, etc...)
* Web Services (enable / disable), role based?
Modified: maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/findArtifact.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/findArtifact.jsp?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/findArtifact.jsp (original)
+++ maven/archiva/branches/MRM-462/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/findArtifact.jsp Sat Aug 18 06:37:43 2007
@@ -31,7 +31,7 @@
<div id="contentArea">
<div id="searchBox">
- <ww:if test="${sessionScope.uiOptions.appletFindEnabled}">
+ <ww:if test="${applicationScope.uiOptions.appletFindEnabled}">
<script type="text/javascript">
function generateMd5( file, defVal )
{