</description>
<defaultValue>0 0,30 * * * ?</defaultValue>
</field>
- </fields>\r
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <version>1.0.0+</version>
+ <code><![CDATA[
+ /**
+ * Utility method to help determine if configuration refers to a remote repository.
+ *
+ * @return true if configuration belongs to a remote repository.
+ * (note: false does not automatically mean this is a managed repository,
+ * you must use {@link #isManaged()} to test for that.)
+ */
+ public boolean isRemote()
+ {
+ if ( this.url == null )
+ {
+ return false;
+ }
+
+ return !this.url.startsWith( "file" );
+ }
+
+ /**
+ * Utility method to help determine if configuration refers to a managed repository.
+ *
+ * @return true if configuration belongs to a managed repository.
+ * (note: false does not automatically mean this is a remote repository,
+ * you must use {@link #isRemote()} to test for that.)
+ */
+ public boolean isManaged()
+ {
+ if ( this.url == null )
+ {
+ return false;
+ }
+
+ return this.url.startsWith( "file" );
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>\r
</class>
<!--
* under the License.
*/
+import java.io.Serializable;
import java.util.List;
/**
*/
List query( SimpleConstraint constraint );
+ /**
+ * Perform a simple save of a peristable object to the database.
+ *
+ * @param o the serializable (persistable) object to save.
+ * @return the post-serialized object.
+ */
+ Object save( Serializable obj );
+
ArtifactDAO getArtifactDAO();
ProjectModelDAO getProjectModelDAO();
--- /dev/null
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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.maven.archiva.model.RepositoryContentStatistics;
+
+/**
+ * MostRecentRepositoryScanStatistics
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class MostRecentRepositoryScanStatistics
+ extends AbstractSimpleConstraint
+{
+ private String sql;
+
+ public MostRecentRepositoryScanStatistics( String repoId )
+ {
+ sql = "SELECT FROM " + RepositoryContentStatistics.class.getName()
+ + " WHERE repositoryId == repoId PARAMETERS String repoId"
+ + " ORDER BY whenGathered DESCENDING"
+ + " RANGE 1,1";
+
+ super.params = new Object[] { repoId };
+ }
+
+ public Class getResultClass()
+ {
+ return RepositoryContentStatistics.class;
+ }
+
+ public String getSelectSql()
+ {
+ return sql;
+ }
+}
import org.apache.maven.archiva.database.SimpleConstraint;
import org.codehaus.plexus.logging.AbstractLogEnabled;
+import java.io.Serializable;
import java.util.List;
/**
* @plexus.requirement role-hint="archiva"
*/
private JdoAccess jdo;
-
+
/**
* @plexus.requirement role-hint="jdo"
*/
private ArtifactDAO artifactDAO;
-
+
/**
* @plexus.requirement role-hint="jdo"
*/
private ProjectModelDAO projectModelDAO;
-
+
/**
* @plexus.requirement role-hint="jdo"
*/
private RepositoryDAO repositoryDAO;
-
+
/**
* @plexus.requirement role-hint="jdo"
*/
private RepositoryProblemDAO repositoryProblemDAO;
-
+
public List query( SimpleConstraint constraint )
{
return jdo.queryObjects( constraint );
}
+ public Object save( Serializable obj )
+ {
+ return jdo.saveObject( obj );
+ }
+
public ArtifactDAO getArtifactDAO()
{
return artifactDAO;
}
-
+
public ProjectModelDAO getProjectModelDAO()
{
return projectModelDAO;
import java.io.File;
import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
public class AbstractArchivaDatabaseTestCase
extends PlexusTestCase
{
+ private static final String TIMESTAMP = "yyyy/MM/dd HH:mm:ss";
+
protected ArchivaDAO dao;
-
+
protected void setUp()
throws Exception
{
super.setUp();
-
+
DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" );
assertEquals( DefaultConfigurableJdoFactory.class.getName(), jdoFactory.getClass().getName() );
- jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" );
+ jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" );
/* derby version
- File derbyDbDir = new File( "target/plexus-home/testdb" );
- if ( derbyDbDir.exists() )
- {
- FileUtils.deleteDirectory( derbyDbDir );
- }
+ File derbyDbDir = new File( "target/plexus-home/testdb" );
+ if ( derbyDbDir.exists() )
+ {
+ FileUtils.deleteDirectory( derbyDbDir );
+ }
- jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) );
- jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) );
- */
+ jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) );
+ jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) );
+ */
- jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) );
+ jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) );
jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:hsqldb:mem:" + getName() ) );
-
- jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) );
- jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) );
+ jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) );
+
+ jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) );
- jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" );
+ jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" );
- jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" );
+ jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" );
- jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" );
+ jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" );
jdoFactory.setProperty( "javax.jdo.option.RetainValues", "true" );
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
}
- URL jdoFileUrls[] = new URL[] { getClass()
- .getResource( "/org/apache/maven/archiva/model/package.jdo" ) };
+ URL jdoFileUrls[] = new URL[] { getClass().getResource( "/org/apache/maven/archiva/model/package.jdo" ) };
if ( ( jdoFileUrls == null ) || ( jdoFileUrls[0] == null ) )
{
this.dao = (ArchivaDAO) lookup( ArchivaDAO.class.getName(), "jdo" );
}
+
+ protected Date toDate( String txt )
+ throws Exception
+ {
+ SimpleDateFormat sdf = new SimpleDateFormat( TIMESTAMP );
+ return sdf.parse( txt );
+ }
+
+ protected String fromDate( Date date )
+ throws Exception
+ {
+ SimpleDateFormat sdf = new SimpleDateFormat( TIMESTAMP );
+ return sdf.format( date );
+ }
}
import org.apache.maven.archiva.database.ArtifactDAO;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
return artifact;
}
- private Date toDate( String txt )
- throws Exception
- {
- SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" );
- return sdf.parse( txt );
- }
-
public void assertResults( String type, List results, String expectedArtifacts[] )
{
assertNotNull( "Results[" + type + "] should not be null.", results );
--- /dev/null
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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.maven.archiva.database.AbstractArchivaDatabaseTestCase;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+
+import java.util.List;
+
+/**
+ * MostRecentRepositoryScanStatisticsTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class MostRecentRepositoryScanStatisticsTest
+ extends AbstractArchivaDatabaseTestCase
+{
+ private RepositoryContentStatistics createStats( String repoId, String timestamp, long duration, long totalfiles,
+ long newfiles )
+ throws Exception
+ {
+ RepositoryContentStatistics stats = new RepositoryContentStatistics();
+ stats.setRepositoryId( repoId );
+ stats.setDuration( duration );
+ stats.setNewFileCount( newfiles );
+ stats.setTotalFileCount( totalfiles );
+ stats.setWhenGathered( toDate( timestamp ) );
+
+ return stats;
+ }
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ dao.save( createStats( "internal", "2007/02/21 10:00:00", 20000, 12000, 400 ) );
+ dao.save( createStats( "internal", "2007/02/20 10:00:00", 20000, 11800, 0 ) );
+ dao.save( createStats( "internal", "2007/02/19 10:00:00", 20000, 11800, 100 ) );
+ dao.save( createStats( "internal", "2007/02/18 10:00:00", 20000, 11700, 320 ) );
+ }
+
+ public void testNotProcessedYet()
+ throws Exception
+ {
+ List results = dao.query( new MostRecentRepositoryScanStatistics( "central" ) );
+ assertNotNull( "Not Processed Yet", results );
+ assertTrue( "Not Processed Yet", results.isEmpty() );
+ }
+
+ public void testStats()
+ throws Exception
+ {
+ List results = dao.query( new MostRecentRepositoryScanStatistics( "internal" ) );
+ assertNotNull( "Stats: results (not null)", results );
+ assertEquals( "Stats: results.size", 1, results.size() );
+
+ Object o = results.get( 0 );
+ assertTrue( "Stats: result[0] instanceof RepositoryScanStatistics", o instanceof RepositoryContentStatistics );
+ RepositoryContentStatistics stats = (RepositoryContentStatistics) o;
+ assertEquals( "Stats: id", "internal", stats.getRepositoryId() );
+ assertEquals( "Stats: when gathered", "2007/02/21 10:00:00", fromDate( stats.getWhenGathered() ) );
+ assertEquals( "Stats: duration", 20000, stats.getDuration() );
+ assertEquals( "Stats: total file count", 12000, stats.getTotalFileCount() );
+ assertEquals( "Stats: new file count", 400, stats.getNewFileCount() );
+ }
+
+}
* under the License.
*/
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
+import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
import org.codehaus.plexus.taskqueue.DefaultTaskQueue;
+import org.codehaus.plexus.taskqueue.Task;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+
+import java.util.Iterator;
+import java.util.List;
/**
* ArchivaTaskQueue
super();
/* do nothing special */
}
+
+ public boolean hasDatabaseTaskInQueue()
+ {
+ try
+ {
+ List queue = getQueueSnapshot();
+ Iterator it = queue.iterator();
+ while ( it.hasNext() )
+ {
+ Task task = (Task) it.next();
+ if ( task instanceof DatabaseTask )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ catch ( TaskQueueException e )
+ {
+ return false;
+ }
+ }
+
+ public boolean hasFilesystemTaskInQueue()
+ {
+ try
+ {
+ List queue = getQueueSnapshot();
+ Iterator it = queue.iterator();
+ while ( it.hasNext() )
+ {
+ Task task = (Task) it.next();
+ if ( task instanceof RepositoryTask )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ catch ( TaskQueueException e )
+ {
+ return false;
+ }
+ }
+
+ public boolean hasRepositoryTaskInQueue( String repoid )
+ {
+ try
+ {
+ List queue = getQueueSnapshot();
+ Iterator it = queue.iterator();
+ while ( it.hasNext() )
+ {
+ Task task = (Task) it.next();
+ if ( task instanceof RepositoryTask )
+ {
+ RepositoryTask rtask = (RepositoryTask) task;
+ if ( StringUtils.equals( repoid, rtask.getRepositoryId() ) )
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ catch ( TaskQueueException e )
+ {
+ return false;
+ }
+ }
}
* The Plexus component role.
*/
public final static String ROLE = ArchivaTaskScheduler.class.getName();
+
+ public ArchivaTaskQueue getTaskQueue();
- public void runDatabaseTasks() throws TaskExecutionException;
+ public void scheduleAllRepositoryTasks()
+ throws TaskExecutionException;
- public void runAllRepositoryTasks() throws TaskExecutionException;
-
- public void runRepositoryTasks( String repositoryId ) throws TaskExecutionException;
-
-}
+ public void scheduleDatabaseTasks()
+ throws TaskExecutionException;
+
+ public void scheduleRepositoryTask( String repositoryId )
+ throws TaskExecutionException;
+}
*/
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.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.ObjectNotFoundException;
-import org.apache.maven.archiva.database.RepositoryDAO;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.scheduled.tasks.ArchivaTask;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
import org.codehaus.plexus.registry.RegistryListener;
import org.codehaus.plexus.scheduler.Scheduler;
import org.codehaus.plexus.taskqueue.TaskQueue;
-import org.codehaus.plexus.taskqueue.TaskQueueException;
import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
import org.quartz.CronTrigger;
import org.quartz.JobDataMap;
private ArchivaConfiguration archivaConfiguration;
- public static final String DATABASE_DISCOVERER_GROUP = "database-group";
+ public static final String DATABASE_SCAN_GROUP = "database-group";
public static final String DATABASE_JOB = "database-job";
public static final String DATABASE_JOB_TRIGGER = "database-job-trigger";
- public static final String REPOSITORY_DISCOVERER_GROUP = "repository-group";
+ public static final String REPOSITORY_SCAN_GROUP = "repository-group";
public static final String REPOSITORY_JOB = "repository-job";
public static final String REPOSITORY_JOB_TRIGGER = "repository-job-trigger";
// setup the unprocessed artifact job
JobDetail repositoryJob =
- new JobDetail( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_DISCOVERER_GROUP, RepositoryTaskJob.class );
+ new JobDetail( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP, RepositoryTaskJob.class );
JobDataMap dataMap = new JobDataMap();
dataMap.put( RepositoryTaskJob.TASK_QUEUE, archivaTaskQueue );
+ dataMap.put( RepositoryTaskJob.TASK_QUEUE_POLICY, ArchivaTask.QUEUE_POLICY_WAIT );
dataMap.put( RepositoryTaskJob.TASK_REPOSITORY, repoConfig.getId() );
repositoryJob.setJobDataMap( dataMap );
try
{
CronTrigger trigger =
- new CronTrigger( REPOSITORY_JOB_TRIGGER + ":" + repoConfig.getId() , REPOSITORY_DISCOVERER_GROUP, cronString );
+ new CronTrigger( REPOSITORY_JOB_TRIGGER + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP, cronString );
scheduler.scheduleJob( repositoryJob, trigger );
}
// setup the unprocessed artifact job
JobDetail databaseJob =
- new JobDetail( DATABASE_JOB, DATABASE_DISCOVERER_GROUP, DatabaseTaskJob.class );
+ new JobDetail( DATABASE_JOB, DATABASE_SCAN_GROUP, DatabaseTaskJob.class );
JobDataMap dataMap = new JobDataMap();
dataMap.put( DatabaseTaskJob.TASK_QUEUE, archivaTaskQueue );
try
{
CronTrigger trigger =
- new CronTrigger( DATABASE_JOB_TRIGGER, DATABASE_DISCOVERER_GROUP, cronString );
+ new CronTrigger( DATABASE_JOB_TRIGGER, DATABASE_SCAN_GROUP, cronString );
scheduler.scheduleJob( databaseJob, trigger );
}
{
try
{
- scheduler.unscheduleJob( DATABASE_JOB, DATABASE_DISCOVERER_GROUP );
+ scheduler.unscheduleJob( DATABASE_JOB, DATABASE_SCAN_GROUP );
}
catch ( SchedulerException e )
{
try
{
- scheduler.unscheduleJob( DATABASE_JOB, DATABASE_DISCOVERER_GROUP );
+ scheduler.unscheduleJob( DATABASE_JOB, DATABASE_SCAN_GROUP );
scheduleDatabaseJobs();
}
try
{
// unschedule handles jobs that might not exist
- scheduler.unscheduleJob( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_DISCOVERER_GROUP );
+ scheduler.unscheduleJob( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP );
scheduleRepositoryJobs( repoConfig );
}
catch ( SchedulerException e )
}
}
- public void runAllRepositoryTasks() throws TaskExecutionException
+ public void scheduleAllRepositoryTasks() throws TaskExecutionException
{
try
{
}
}
- public void runDatabaseTasks() throws TaskExecutionException
+ public void scheduleDatabaseTasks() throws TaskExecutionException
{
try
{
}
}
- public void runRepositoryTasks( String repositoryId ) throws TaskExecutionException
+ public void scheduleRepositoryTask( String repositoryId ) throws TaskExecutionException
{
try
{
throw new TaskExecutionException( "Unable to schedule repository jobs: " + e.getMessage(), e );
}
}
-
-
+ public ArchivaTaskQueue getTaskQueue()
+ {
+ return (ArchivaTaskQueue) archivaTaskQueue;
+ }
}
+++ /dev/null
-package org.apache.maven.archiva.web.action.admin;
-
-/*
- * 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 com.opensymphony.xwork.ModelDriven;
-import com.opensymphony.xwork.Preparable;
-//import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.InvalidConfigurationException;
-import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.codehaus.plexus.rbac.profile.RoleProfileException;
-import org.codehaus.plexus.rbac.profile.RoleProfileManager;
-import org.codehaus.plexus.registry.RegistryException;
-import org.codehaus.plexus.security.rbac.RbacManagerException;
-import org.codehaus.plexus.security.rbac.Resource;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
-import org.codehaus.plexus.xwork.action.PlexusActionSupport;
-
-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 PlexusActionSupport
- implements ModelDriven, Preparable, SecureAction
-{
- /**
- * @plexus.requirement
- */
- private ArchivaConfiguration archivaConfiguration;
-
- /**
- * @plexus.requirement role-hint="archiva"
- */
- protected RoleProfileManager roleProfileManager;
-
- /**
- * 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, InvalidConfigurationException, RbacManagerException, RoleProfileException, RegistryException
- {
- // 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, InvalidConfigurationException, RbacManagerException, RoleProfileException, RegistryException
- {
- // 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, InvalidConfigurationException, RbacManagerException, RoleProfileException, RegistryException
- {
- addRepository();
-
- archivaConfiguration.save( configuration );
-
- // TODO: do we need to check if indexing is needed?
-
- addActionMessage( "Successfully saved configuration" );
-
- return SUCCESS;
- }
-
- protected abstract void addRepository()
- throws IOException, RoleProfileException;
-
- public String input()
- {
- return INPUT;
- }
-
- public Object getModel()
- {
- return new Object();
-// return repository;
- }
-
-// protected abstract AbstractRepositoryConfiguration createRepository();
-
- public void prepare()
- {
- configuration = archivaConfiguration.getConfiguration();
-
-// 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;
- }
-
- public SecureActionBundle getSecureActionBundle()
- throws SecureActionException
- {
- SecureActionBundle bundle = new SecureActionBundle();
-
- bundle.setRequiresAuthentication( true );
-
- if ( getRepoId() != null )
- {
- // TODO: this is not right. It needs to change based on method. But is this really the right way to restrict this area?
- // TODO: not right. We only care about this permission on managed repositories. Otherwise, it's configuration
- bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_EDIT_REPOSITORY, getRepoId() );
- }
- else
- {
- bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
- }
-
- return bundle;
- }
-}
--- /dev/null
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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 com.opensymphony.xwork.ActionContext;
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
+import org.codehaus.plexus.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.rbac.profile.RoleProfileManager;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.security.authorization.AuthorizationException;
+import org.codehaus.plexus.security.authorization.AuthorizationResult;
+import org.codehaus.plexus.security.rbac.RbacManagerException;
+import org.codehaus.plexus.security.rbac.Resource;
+import org.codehaus.plexus.security.system.SecuritySession;
+import org.codehaus.plexus.security.system.SecuritySystem;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * AbstractRepositoryAction
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractRepositoryAction
+ extends PlexusActionSupport
+ implements ModelDriven, Preparable, SecureAction
+{
+ protected static final String SUCCESS = "success";
+
+ /**
+ * @plexus.requirement role-hint="archiva"
+ */
+ private RoleProfileManager roleProfileManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private SecuritySystem securitySystem;
+
+ private String repoid;
+
+ private String mode;
+
+ /**
+ * @plexus.requirement
+ */
+ protected ArchivaConfiguration archivaConfiguration;
+
+ /**
+ * The model for this action.
+ */
+ protected AdminRepositoryConfiguration repository;
+
+ public String getMode()
+ {
+ return this.mode;
+ }
+
+ public Object getModel()
+ {
+ return getRepository();
+ }
+
+ public String getRepoid()
+ {
+ return repoid;
+ }
+
+ public SecureActionBundle getSecureActionBundle()
+ throws SecureActionException
+ {
+ SecureActionBundle bundle = new SecureActionBundle();
+
+ bundle.setRequiresAuthentication( true );
+ bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+
+ return bundle;
+ }
+
+ public String input()
+ {
+ getLogger().info( "input()" );
+ return INPUT;
+ }
+
+ public abstract void prepare()
+ throws Exception;
+
+ public void setMode( String mode )
+ {
+ this.mode = mode;
+ }
+
+ public void setRepoid( String repoid )
+ {
+ this.repoid = repoid;
+ }
+
+ protected void addRepository( AdminRepositoryConfiguration repository )
+ throws IOException, RoleProfileException
+ {
+ getLogger().info( ".addRepository(" + repository + ")" );
+
+ if ( repository.isManaged() )
+ {
+ // 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!
+ }
+ }
+
+ archivaConfiguration.getConfiguration().addRepository( repository );
+
+ // TODO: double check these are configured on start up
+ roleProfileManager.getDynamicRole( "archiva-repository-manager", repository.getId() );
+
+ roleProfileManager.getDynamicRole( "archiva-repository-observer", repository.getId() );
+ }
+
+ protected AdminRepositoryConfiguration getRepository()
+ {
+ if ( repository == null )
+ {
+ repository = new AdminRepositoryConfiguration();
+ }
+
+ return repository;
+ }
+
+ protected boolean operationAllowed( String permission, String repoid )
+ {
+ ActionContext context = ActionContext.getContext();
+ SecuritySession securitySession = (SecuritySession) context.get( SecuritySession.ROLE );
+
+ AuthorizationResult authzResult;
+ try
+ {
+ authzResult = securitySystem.authorize( securitySession, permission, repoid );
+
+ return authzResult.isAuthorized();
+ }
+ catch ( AuthorizationException e )
+ {
+ getLogger().info(
+ "Unable to authorize permission: " + permission + " against repo: " + repoid
+ + " due to: " + e.getMessage() );
+ return false;
+ }
+ }
+
+ protected void removeRepository( String repoId )
+ {
+ getLogger().info( ".removeRepository()" );
+
+ RepositoryConfiguration toremove = archivaConfiguration.getConfiguration().findRepositoryById( repoId );
+ if ( toremove != null )
+ {
+ archivaConfiguration.getConfiguration().removeRepository( toremove );
+ }
+ }
+
+ protected String saveConfiguration()
+ throws IOException, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+ RegistryException
+ {
+ getLogger().info( ".saveConfiguration()" );
+
+ archivaConfiguration.save( archivaConfiguration.getConfiguration() );
+
+ addActionMessage( "Successfully saved configuration" );
+
+ return SUCCESS;
+ }
+}
+++ /dev/null
-package org.apache.maven.archiva.web.action.admin;
-
-/*
- * 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.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.model.RepositoryURL;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * AdminModel
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class AdminModel
-{
- private String baseUrl;
-
- private List managedRepositories = new ArrayList();
-
- private List remoteRepositories = new ArrayList();
-
- public AdminModel()
- {
- /* do nothing */
- }
-
- public AdminModel( Configuration configuration )
- {
- Iterator it = configuration.getRepositories().iterator();
- while ( it.hasNext() )
- {
- RepositoryConfiguration repoconfig = (RepositoryConfiguration) it.next();
- RepositoryURL repourl = new RepositoryURL( repoconfig.getUrl() );
- if ( "file".equals( repourl.getProtocol() ) )
- {
- managedRepositories.add( repoconfig );
- }
- else
- {
- remoteRepositories.add( repoconfig );
- }
- }
- }
-
- public List getManagedRepositories()
- {
- return managedRepositories;
- }
-
- public void setManagedRepositories( List managedRepositories )
- {
- this.managedRepositories = managedRepositories;
- }
-
- public List getRemoteRepositories()
- {
- return remoteRepositories;
- }
-
- public void setRemoteRepositories( List remoteRepositories )
- {
- this.remoteRepositories = remoteRepositories;
- }
-
- public String getBaseUrl()
- {
- return baseUrl;
- }
-
- public void setBaseUrl( String baseUrl )
- {
- this.baseUrl = baseUrl;
- }
-}
public void validate()
{
+ getLogger().info( "validate()" );
//validate cron expression
}
throws IOException, RepositoryIndexException, RepositoryIndexSearchException, InvalidConfigurationException,
RegistryException
{
+ getLogger().info( "execute()" );
// 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?
+++ /dev/null
-package org.apache.maven.archiva.web.action.admin;
-
-/*
- * 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.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();
-// }
-}
* under the License.
*/
-//import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
import org.codehaus.plexus.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.rbac.profile.RoleProfileManager;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.security.rbac.RbacManagerException;
+import org.codehaus.plexus.security.rbac.Resource;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
import java.io.File;
import java.io.IOException;
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryAction"
*/
public class ConfigureRepositoryAction
- extends AbstractConfigureRepositoryAction
+ extends PlexusActionSupport
+ implements ModelDriven, Preparable, SecureAction
{
-// protected void removeRepository( AbstractRepositoryConfiguration existingRepository )
-// {
-// configuration.removeRepository( (RepositoryConfiguration) existingRepository );
-// }
-//
-// protected AbstractRepositoryConfiguration getRepository( String id )
-// {
-// return configuration.getRepositoryById( id );
-// }
-
- protected void addRepository()
+ /**
+ * @plexus.requirement
+ */
+ private ArchivaConfiguration archivaConfiguration;
+
+ /**
+ * @plexus.requirement role-hint="archiva"
+ */
+ private RoleProfileManager roleProfileManager;
+
+ /**
+ * The repository.
+ */
+ private AdminRepositoryConfiguration repository;
+
+ /**
+ * The repository ID to lookup when editing a repository.
+ */
+ private String repoId;
+
+ /**
+ * The previously read configuration.
+ */
+ private Configuration configuration;
+
+ public String add()
+ throws IOException, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+ RegistryException
+ {
+ // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+ getLogger().info( ".add()" );
+
+ AdminRepositoryConfiguration 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, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+ RegistryException
+ {
+ // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
+ getLogger().info( ".edit()" );
+
+ if ( StringUtils.isBlank( repository.getId() ) )
+ {
+ addFieldError( "id", "A repository with a blank id cannot be editted." );
+ return INPUT;
+ }
+
+ removeRepository( getRepository() );
+
+ addRepository();
+
+ return saveConfiguration();
+ }
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ public Object getModel()
+ {
+ getLogger().info( ".getModel()" );
+ if( repository == null )
+ {
+ repository = createRepository();
+ }
+
+ return repository;
+ }
+
+ public String getRepoId()
+ {
+ return repoId;
+ }
+
+ public SecureActionBundle getSecureActionBundle()
+ throws SecureActionException
+ {
+ SecureActionBundle bundle = new SecureActionBundle();
+
+ bundle.setRequiresAuthentication( true );
+
+ if ( getRepoId() != null )
+ {
+ // TODO: this is not right. It needs to change based on method. But is this really the right way to restrict this area?
+ // TODO: not right. We only care about this permission on managed repositories. Otherwise, it's configuration
+ bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_EDIT_REPOSITORY, getRepoId() );
+ }
+ else
+ {
+ bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+ }
+
+ return bundle;
+ }
+
+ public String input()
+ {
+ getLogger().info( ".input()" );
+ return INPUT;
+ }
+
+ public String doDefault()
+ throws Exception
+ {
+ getLogger().info( ".doDefault()" );
+ return super.doDefault();
+ }
+
+ public String doInput()
+ throws Exception
+ {
+ getLogger().info( ".doInput()" );
+ return super.doInput();
+ }
+
+ public void validate()
+ {
+ getLogger().info( ".validate()" );
+ // super.validate();
+ }
+
+ public String execute()
+ throws Exception
+ {
+ getLogger().info( ".execute()" );
+ return super.execute();
+ }
+
+ public void prepare()
+ {
+ getLogger().info( ".prepare()" );
+ configuration = archivaConfiguration.getConfiguration();
+
+ if ( repository == null )
+ {
+ repository = getRepository( repoId );
+ }
+ if ( repository == null )
+ {
+ repository = createRepository();
+ }
+ }
+
+ public void setRepoId( String repoId )
+ {
+ this.repoId = repoId;
+ }
+
+ private void addRepository()
throws IOException, RoleProfileException
{
-// 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 );
-//
-// // TODO: double check these are configured on start up
-// roleProfileManager.getDynamicRole( "archiva-repository-manager", repository.getId() );
-//
-// roleProfileManager.getDynamicRole( "archiva-repository-observer", repository.getId() );
- }
-
-// protected AbstractRepositoryConfiguration createRepository()
-// {
-// RepositoryConfiguration repository = new RepositoryConfiguration();
-// repository.setIndexed( false );
-// return repository;
-// }
+ getLogger().info( ".addRepository()" );
+ AdminRepositoryConfiguration repository = (AdminRepositoryConfiguration) getRepository();
+
+ if ( repository.isManaged() )
+ {
+ // 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 );
+
+ // TODO: double check these are configured on start up
+ roleProfileManager.getDynamicRole( "archiva-repository-manager", repository.getId() );
+
+ roleProfileManager.getDynamicRole( "archiva-repository-observer", repository.getId() );
+ }
+
+ private AdminRepositoryConfiguration createRepository()
+ {
+ getLogger().info( ".createRepository()" );
+ AdminRepositoryConfiguration repository = new AdminRepositoryConfiguration();
+ repository.setIndexed( false );
+ return repository;
+ }
+
+ private AdminRepositoryConfiguration getRepository()
+ {
+ return repository;
+ }
+
+ private AdminRepositoryConfiguration getRepository( String id )
+ {
+ getLogger().info( ".getRepository(" + id + ")" );
+
+ RepositoryConfiguration repoconfig = configuration.findRepositoryById( id );
+ if ( repoconfig == null )
+ {
+ return createRepository();
+ }
+ return new AdminRepositoryConfiguration( repoconfig );
+ }
+
+ private boolean removeRepository( RepositoryConfiguration existingRepository )
+ {
+ getLogger().info( ".removeRepository()" );
+
+ RepositoryConfiguration toremove = configuration.findRepositoryById( existingRepository.getId() );
+ if ( toremove != null )
+ {
+ configuration.removeRepository( toremove );
+ return true;
+ }
+
+ return false;
+ }
+
+ private String saveConfiguration()
+ throws IOException, InvalidConfigurationException, RbacManagerException, RoleProfileException,
+ RegistryException
+ {
+ getLogger().info( ".saveConfiguration()" );
+ addRepository();
+
+ archivaConfiguration.save( configuration );
+
+ // TODO: do we need to check if indexing is needed?
+
+ addActionMessage( "Successfully saved configuration" );
+
+ return SUCCESS;
+ }
}
+++ /dev/null
-package org.apache.maven.archiva.web.action.admin;
-
-/*
- * 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.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();
-// }
-}
+++ /dev/null
-package org.apache.maven.archiva.web.action.admin;
-
-/*
- * 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.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! delete it
-// }
-}
+++ /dev/null
-package org.apache.maven.archiva.web.action.admin;
-
-/*
- * 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.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! remove the contents
-// }
-}
--- /dev/null
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
+
+/**
+ * EditRepositoryAction
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="editRepositoryAction"
+ */
+public class EditRepositoryAction
+ extends AbstractRepositoryAction
+{
+ public String edit()
+ {
+ getLogger().info( ".edit()" );
+
+ if ( operationAllowed( ArchivaRoleConstants.OPERATION_EDIT_REPOSITORY, getRepoid() ) )
+ {
+ addActionError( "You do not have the appropriate permissions to edit the " + getRepoid() + " repository." );
+ return ERROR;
+ }
+
+ return INPUT;
+ }
+
+ public void prepare()
+ throws Exception
+ {
+ String id = getRepoid();
+ if ( id == null )
+ {
+ // TODO: Throw error?
+ return;
+ }
+
+ RepositoryConfiguration repoconfig = archivaConfiguration.getConfiguration().findRepositoryById( id );
+ if ( repoconfig != null )
+ {
+ this.repository = new AdminRepositoryConfiguration( repoconfig );
+ }
+ }
+
+ public String getMode()
+ {
+ return "edit";
+ }
+}
--- /dev/null
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.StringUtils;
+import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
+import org.apache.maven.archiva.scheduled.DefaultArchivaTaskScheduler;
+import org.apache.maven.archiva.scheduled.tasks.ArchivaTask;
+import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.codehaus.plexus.security.rbac.Resource;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+/**
+ * Configures the application.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="indexRepositoryAction"
+ */
+public class IndexRepositoryAction
+ extends PlexusActionSupport
+ implements SecureAction
+{
+ /**
+ * @plexus.requirement
+ */
+ private ArchivaTaskScheduler taskScheduler;
+
+ private String repoid;
+
+ public String run()
+ {
+ if ( StringUtils.isBlank( repoid ) )
+ {
+ addActionError( "Cannot run indexer on blank repository id." );
+ return SUCCESS;
+ }
+
+ RepositoryTask task = new RepositoryTask();
+ task.setRepositoryId( repoid );
+ task.setName( DefaultArchivaTaskScheduler.REPOSITORY_JOB + ":" + repoid );
+ task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
+
+ boolean scheduleTask = false;
+
+ if ( taskScheduler.getTaskQueue().hasFilesystemTaskInQueue() )
+ {
+ if ( taskScheduler.getTaskQueue().hasRepositoryTaskInQueue( repoid ) )
+ {
+ addActionError( "Repository [" + repoid + "] task was already queued." );
+ }
+ else
+ {
+ scheduleTask = true;
+ }
+ }
+ else
+ {
+ scheduleTask = true;
+ }
+
+ if ( scheduleTask )
+ {
+ try
+ {
+ taskScheduler.getTaskQueue().put( task );
+ addActionMessage( "Your request to have repository [" + repoid + "] be indexed has been queued." );
+ }
+ catch ( TaskQueueException e )
+ {
+ addActionError( "Unable to queue your request to have repository [" + repoid + "] be indexed: "
+ + e.getMessage() );
+ }
+ }
+
+ // Return to the repositories screen.
+ return SUCCESS;
+ }
+
+ public SecureActionBundle getSecureActionBundle()
+ throws SecureActionException
+ {
+ SecureActionBundle bundle = new SecureActionBundle();
+
+ bundle.setRequiresAuthentication( true );
+ bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_RUN_INDEXER, Resource.GLOBAL );
+
+ return bundle;
+ }
+
+ public String getRepoid()
+ {
+ return repoid;
+ }
+
+ public void setRepoid( String repoid )
+ {
+ this.repoid = repoid;
+ }
+}
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
+import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.admin.models.AdminModel;
+import org.apache.maven.archiva.web.action.admin.models.AdminRepositoryConfiguration;
+import org.apache.maven.archiva.web.util.ContextUtils;
import org.codehaus.plexus.security.rbac.Resource;
import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+import java.util.Iterator;
+import java.util.List;
+
import javax.servlet.http.HttpServletRequest;
/**
extends PlexusActionSupport
implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware
{
- /**
- * @plexus.requirement
- */
- private ArchivaConfiguration archivaConfiguration;
-
/**
* @plexus.requirement role-hint="jdo"
*/
private ArchivaDAO dao;
- private HttpServletRequest request;
+ /**
+ * @plexus.requirement
+ */
+ private ArchivaConfiguration archivaConfiguration;
private AdminModel model;
+ private String baseUrl;
+
public Object getModel()
{
- return model;
+ return getAdminModel();
}
public void prepare()
throws Exception
{
- model = new AdminModel( archivaConfiguration.getConfiguration() );
+ model = null;
+ getModel();
}
public void validate()
super.validate();
}
+ public String execute()
+ throws Exception
+ {
+ getLogger().info( ".execute()" );
+ return super.execute();
+ }
+
public SecureActionBundle getSecureActionBundle()
throws SecureActionException
{
public void setServletRequest( HttpServletRequest request )
{
- this.request = request;
- StringBuffer baseUrl = new StringBuffer();
+ this.baseUrl = ContextUtils.getBaseURL( request, "repository" );
+ }
- baseUrl.append( request.getScheme() );
- baseUrl.append( request.getServerName() );
- int portnum = request.getServerPort();
+ public AdminModel getAdminModel()
+ {
+ if ( model == null )
+ {
+ model = new AdminModel( archivaConfiguration.getConfiguration() );
+ model.setBaseUrl( baseUrl );
+ updateLastIndexed( model.getManagedRepositories() );
+ }
+
+ return model;
+ }
- // Only add port if non-standard.
- if ( ( "https".equalsIgnoreCase( request.getScheme() ) && ( portnum != 443 ) )
- || ( "http".equalsIgnoreCase( request.getScheme() ) && ( portnum != 80 ) ) )
+ private void updateLastIndexed( List managedRepositories )
+ {
+ Iterator it = managedRepositories.iterator();
+ while ( it.hasNext() )
{
- baseUrl.append( ":" ).append( String.valueOf( portnum ) );
+ AdminRepositoryConfiguration config = (AdminRepositoryConfiguration) it.next();
+
+ List results = dao.query( new MostRecentRepositoryScanStatistics( config.getId() ) );
+ if ( !results.isEmpty() )
+ {
+ RepositoryContentStatistics stats = (RepositoryContentStatistics) results.get( 0 );
+ config.setStats( stats );
+ }
}
- baseUrl.append( request.getContextPath() );
- baseUrl.append( "/repository" );
+ }
- model.setBaseUrl( baseUrl.toString() );
+ public String getBaseUrlB()
+ {
+ return baseUrl;
+ }
+
+ public void setBaseUrlB( String baseUrl )
+ {
+ this.baseUrl = baseUrl;
}
}
+++ /dev/null
-package org.apache.maven.archiva.web.action.admin;
-
-/*
- * 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.maven.archiva.scheduler.RepositoryTaskScheduler;
-import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.codehaus.plexus.security.rbac.Resource;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
-//import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
-import org.codehaus.plexus.xwork.action.PlexusActionSupport;
-
-/**
- * Configures the application.
- *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="runRepositoryTaskAction"
- */
-public class RunRepositoryTaskAction
- extends PlexusActionSupport
- implements SecureAction
-{
-// /**
-// * @plexus.requirement
-// */
-// private RepositoryTaskScheduler taskScheduler;
-
- public String runRefresh()
- {
-// taskScheduler.runDataRefresh();
-
- return SUCCESS;
- }
-
- public SecureActionBundle getSecureActionBundle()
- throws SecureActionException
- {
- SecureActionBundle bundle = new SecureActionBundle();
-
- bundle.setRequiresAuthentication( true );
- bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_RUN_INDEXER, Resource.GLOBAL );
-
- return bundle;
- }
-}
--- /dev/null
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * 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.StringUtils;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.codehaus.plexus.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.security.rbac.RbacManagerException;
+
+import java.io.IOException;
+
+/**
+ * SaveRepositoryAction
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="saveRepositoryAction"
+ */
+public class SaveRepositoryAction
+ extends AbstractRepositoryAction
+{
+ public void prepare()
+ throws Exception
+ {
+ /* nothing to do here */
+ }
+
+ public String save()
+ {
+ String mode = getMode();
+ String repoId = getRepository().getId();
+
+ getLogger().info( "edit(" + mode + ":" + repoId + ")" );
+
+ if ( StringUtils.isBlank( repository.getId() ) )
+ {
+ addFieldError( "id", "A repository with a blank id cannot be saved." );
+ return SUCCESS;
+ }
+
+ if( StringUtils.equalsIgnoreCase( "edit", mode ) )
+ {
+ removeRepository( repoId );
+ }
+
+ try
+ {
+ addRepository( getRepository() );
+ saveConfiguration();
+ }
+ catch ( IOException e )
+ {
+ addActionError( "I/O Exception: " + e.getMessage() );
+ }
+ catch ( RoleProfileException e )
+ {
+ addActionError( "Role Profile Exception: " + e.getMessage() );
+ }
+ catch ( InvalidConfigurationException e )
+ {
+ addActionError( "Invalid Configuration Exception: " + e.getMessage() );
+ }
+ catch ( RbacManagerException e )
+ {
+ addActionError( "RBAC Manager Exception: " + e.getMessage() );
+ }
+ catch ( RegistryException e )
+ {
+ addActionError( "Configuration Registry Exception: " + e.getMessage() );
+ }
+
+ return SUCCESS;
+ }
+}
--- /dev/null
+package org.apache.maven.archiva.web.action.admin.models;
+
+/*
+ * 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.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * AdminModel
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AdminModel
+{
+ private String baseUrl;
+
+ private List managedRepositories = new ArrayList();
+
+ private List remoteRepositories = new ArrayList();
+
+ private Map repoMap = new HashMap();
+
+ public AdminModel()
+ {
+ /* do nothing */
+ }
+
+ public AdminModel( Configuration configuration )
+ {
+ repoMap.putAll( configuration.createRepositoryMap() );
+
+ Iterator it = configuration.getRepositories().iterator();
+ while ( it.hasNext() )
+ {
+ RepositoryConfiguration repoconfig = (RepositoryConfiguration) it.next();
+ if ( repoconfig.isManaged() )
+ {
+ managedRepositories.add( new AdminRepositoryConfiguration( repoconfig ) );
+ }
+ else if ( repoconfig.isRemote() )
+ {
+ remoteRepositories.add( repoconfig );
+ }
+ else
+ {
+ // Should never occur, but it is possible that the configuration could
+ // contain a repository configuration which is null.
+ }
+ }
+ }
+
+ public List getManagedRepositories()
+ {
+ return managedRepositories;
+ }
+
+ public void setManagedRepositories( List managedRepositories )
+ {
+ this.managedRepositories = managedRepositories;
+ }
+
+ public List getRemoteRepositories()
+ {
+ return remoteRepositories;
+ }
+
+ public void setRemoteRepositories( List remoteRepositories )
+ {
+ this.remoteRepositories = remoteRepositories;
+ }
+
+ public String getBaseUrl()
+ {
+ return baseUrl;
+ }
+
+ public void setBaseUrl( String baseUrl )
+ {
+ this.baseUrl = baseUrl;
+ }
+
+ public String toString()
+ {
+ return "[ActionModel]";
+ }
+}
--- /dev/null
+package org.apache.maven.archiva.web.action.admin.models;
+
+/*
+ * 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.StringUtils;
+import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+import org.apache.maven.archiva.model.RepositoryURL;
+
+import java.io.File;
+
+/**
+ * AdminRepositoryConfiguration
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AdminRepositoryConfiguration
+ extends RepositoryConfiguration
+{
+ private String directory;
+
+ private RepositoryContentStatistics stats;
+
+ public AdminRepositoryConfiguration()
+ {
+ super();
+ }
+
+ /**
+ * Copy Constructor.
+ */
+ public AdminRepositoryConfiguration( RepositoryConfiguration repoconfig )
+ {
+ this.setId( repoconfig.getId() );
+ this.setName( repoconfig.getName() );
+ this.setUrl( repoconfig.getUrl() );
+ this.setLayout( repoconfig.getLayout() );
+ this.setIndexed( repoconfig.isIndexed() );
+ this.setReleases( repoconfig.isReleases() );
+ this.setSnapshots( repoconfig.isSnapshots() );
+
+ this.setIndexDir( repoconfig.getIndexDir() );
+ this.setRefreshCronExpression( repoconfig.getRefreshCronExpression() );
+
+ if ( repoconfig.isManaged() )
+ {
+ RepositoryURL url = new RepositoryURL( repoconfig.getUrl() );
+ this.setDirectory( url.getPath() );
+ }
+ }
+
+ public boolean isDirectoryExists()
+ {
+ if ( StringUtils.isBlank( directory ) )
+ {
+ return false;
+ }
+
+ File dir = new File( directory );
+ return ( dir.exists() && dir.isDirectory() );
+ }
+
+ public String getDirectory()
+ {
+ return directory;
+ }
+
+ public void setDirectory( String directory )
+ {
+ this.directory = directory;
+ this.setUrl( PathUtil.toUrl( directory ) );
+ }
+
+ public RepositoryContentStatistics getStats()
+ {
+ return stats;
+ }
+
+ public void setStats( RepositoryContentStatistics stats )
+ {
+ this.stats = stats;
+ }
+}
--- /dev/null
+package org.apache.maven.archiva.web.interceptor;
+
+/*
+ * 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 com.opensymphony.xwork.ActionContext;
+import com.opensymphony.xwork.ActionInvocation;
+import com.opensymphony.xwork.ActionProxy;
+import com.opensymphony.xwork.interceptor.Interceptor;
+import com.opensymphony.xwork.interceptor.PreResultListener;
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * WebworkIsDoingStrangeThingsInterceptor
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * @plexus.component role="com.opensymphony.xwork.interceptor.Interceptor"
+ * role-hint="webwork-is-doing-strange-things"
+ */
+public class WebworkIsDoingStrangeThingsInterceptor
+ extends AbstractLogEnabled
+ implements Interceptor, PreResultListener
+{
+ private String hint = "(nohint)";
+
+ public void init()
+ {
+ getLogger().info( ".init()" );
+ }
+
+ public String intercept( ActionInvocation invocation )
+ throws Exception
+ {
+ StringBuffer dbg = new StringBuffer();
+
+ invocation.addPreResultListener( this );
+
+ dbg.append( "[" ).append( hint ).append( "] " );
+ dbg.append( ".intercept(" ).append( invocation.getClass().getName() ).append( ")" );
+ dbg.append( "\n Action=" ).append( invocation.getAction().getClass().getName() );
+
+ ActionProxy proxy = invocation.getProxy();
+ dbg.append( "\n Proxy=" ).append( proxy.getClass().getName() );
+ dbg.append( "\n .namespace =" ).append( proxy.getNamespace() );
+ dbg.append( "\n .actionName =" ).append( proxy.getActionName() );
+ dbg.append( "\n .method =" ).append( proxy.getMethod() );
+ dbg.append( "\n .execute result =" ).append( proxy.getExecuteResult() );
+
+ ActionContext context = invocation.getInvocationContext();
+ dbg.append( "\n InvocationContext=" ).append( context.getClass().getName() );
+ appendMap( "\n .session=", dbg, context.getSession() );
+ appendMap( "\n .parameters=", dbg, context.getParameters() );
+
+ String result = invocation.invoke();
+
+ dbg.append( "\n ... result=\"" ).append( result ).append( "\"" );
+ dbg.append( ", code=" ).append( invocation.getResultCode() );
+ getLogger().info( dbg.toString() );
+ return result;
+ }
+
+ private void appendMap( String heading, StringBuffer dbg, Map map )
+ {
+ dbg.append( heading );
+
+ if ( map == null )
+ {
+ dbg.append( "<null>" );
+ return;
+ }
+
+ if ( map.isEmpty() )
+ {
+ dbg.append( "<empty>" );
+ return;
+ }
+
+ Iterator entries = map.entrySet().iterator();
+ while ( entries.hasNext() )
+ {
+ Map.Entry entry = (Entry) entries.next();
+ String key = (String) entry.getKey();
+ Object value = entry.getValue();
+ dbg.append( "\n [" ).append( key ).append( "]: " );
+ if ( value == null )
+ {
+ dbg.append( "<null>" );
+ }
+ else
+ {
+ try
+ {
+ dbg.append( value.toString() );
+ }
+ catch ( NullPointerException e )
+ {
+ dbg.append( "<npe>" );
+ }
+ }
+ }
+
+ }
+
+ public void destroy()
+ {
+ getLogger().info( ".destroy()" );
+ }
+
+ public void setHint( String hint )
+ {
+ this.hint = hint;
+ }
+
+ public void beforeResult( ActionInvocation invocation, String resultCode )
+ {
+ getLogger().info( "before result: invocation: " + invocation + ", resultCode: " + resultCode );
+ }
+}
*/
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ConfigurationNames;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.ObjectNotFoundException;
if ( !repoDir.exists() )
{
- repoDir.mkdirs();
+ if ( !repoDir.mkdirs() )
+ {
+ // Skip invalid directories.
+ log( "Unable to create missing directory for " + repo.getUrl().getPath() );
+ continue;
+ }
}
DavServerComponent server = createServer( repo.getId(), repoDir, servletConfig );
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
- if ( propertyName.startsWith( "repositories" ) )
+ if ( ConfigurationNames.isRepositories( propertyName ) )
{
- log( "Triggering managed repository configuration change with " + propertyName + " set to " + propertyValue );
getDavManager().removeAllServers();
try
e );
}
}
- else
- {
- log( "Not triggering managed repository configuration change with " + propertyName );
- }
}
}
--- /dev/null
+package org.apache.maven.archiva.web.tags;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+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;
+
+/**
+ * CopyPasteSnippet
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ *
+ * @plexus.component role="org.apache.maven.archiva.web.tags.CopyPasteSnippet"
+ */
+public class CopyPasteSnippet
+ extends AbstractLogEnabled
+{
+ public void write( Object o, PageContext pageContext )
+ throws JspException
+ {
+ StringBuffer buf = new StringBuffer();
+
+ if ( o == null )
+ {
+ buf.append( "Error generating snippet." );
+ getLogger().error( "Unable to generate snippet for null object." );
+ }
+ else if ( o instanceof RepositoryConfiguration )
+ {
+ createSnippet( buf, (RepositoryConfiguration) o, pageContext );
+ }
+ else
+ {
+ buf.append( "Unable to generate snippet for object " ).append( o.getClass().getName() );
+ }
+
+ try
+ {
+ JspWriter out = pageContext.getOut();
+ out.write( StringEscapeUtils.escapeXml( buf.toString() ) );
+ out.flush();
+ }
+ catch ( IOException e )
+ {
+ throw new JspException( "Unable to write snippet to output: " + e.getMessage(), e );
+ }
+ }
+
+ private void createSnippet( StringBuffer snippet, RepositoryConfiguration repo, PageContext pageContext )
+ {
+ snippet.append( "<project>\n" );
+ snippet.append( " ...\n" );
+ snippet.append( " <distributionManagement>\n" );
+
+ String distRepoName = "repository";
+ if ( repo.isSnapshots() )
+ {
+ distRepoName = "snapshotRepository";
+ }
+
+ snippet.append( " <" ).append( distRepoName ).append( ">\n" );
+ snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" );
+
+ if ( !"default".equals( repo.getLayout() ) )
+ {
+ snippet.append( " <layout>" ).append( repo.getLayout() ).append( "</layout>" );
+ }
+
+ snippet.append( " </" ).append( distRepoName ).append( ">\n" );
+ snippet.append( " </distributionManagement>\n" );
+ snippet.append( "\n" );
+
+ snippet.append( " <repositories>\n" );
+ snippet.append( " <repository>\n" );
+ snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" );
+ 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( "</url>\n" );
+
+ if ( !"default".equals( repo.getLayout() ) )
+ {
+ snippet.append( " <layout>" ).append( repo.getLayout() ).append( "</layout>\n" );
+ }
+
+ snippet.append( " <releases>\n" );
+ snippet.append( " <enabled>" ).append( Boolean.valueOf( repo.isReleases() ) ).append( "</enabled>\n" );
+ snippet.append( " </releases>\n" );
+ snippet.append( " <snapshots>\n" );
+ snippet.append( " <enabled>" ).append( Boolean.valueOf( repo.isSnapshots() ) ).append( "</enabled>\n" );
+ snippet.append( " </snapshots>\n" );
+ snippet.append( " </repository>\n" );
+ snippet.append( " </repositories>\n" );
+
+ snippet.append( " ...\n" );
+ snippet.append( "</project>\n" );
+ }
+}
--- /dev/null
+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.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * CopyPasteSnippetTag
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class CopyPasteSnippetTag
+ extends TagSupport
+{
+ private Object object;
+
+ public void release()
+ {
+ object = null;
+ super.release();
+ }
+
+ public int doEndTag()
+ throws JspException
+ {
+ CopyPasteSnippet snippet;
+ try
+ {
+ snippet = (CopyPasteSnippet) PlexusTagUtil.lookup( pageContext, CopyPasteSnippet.class.getName() );
+ }
+ catch ( ComponentLookupException e )
+ {
+ throw new JspException( "Unable to lookup CopyPasteSnippet: " + e.getMessage(), e );
+ }
+
+ if ( snippet == null )
+ {
+ throw new JspException( "Unable to process snippet. Component not found." );
+ }
+
+ snippet.write( object, pageContext );
+
+ return super.doEndTag();
+ }
+
+ public void setObject( Object object )
+ {
+ this.object = object;
+ }
+}
--- /dev/null
+package org.apache.maven.archiva.web.util;
+
+/*
+ * 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.StringUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.jsp.PageContext;
+
+/**
+ * ContextUtils
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ContextUtils
+{
+ private static final Map defaultSchemePortMap;
+
+ static
+ {
+ defaultSchemePortMap = new HashMap();
+ defaultSchemePortMap.put( "http", new Integer( 80 ) );
+ defaultSchemePortMap.put( "https", new Integer( 443 ) );
+ }
+
+ /**
+ * Using the page context, get the base url.
+ *
+ * @param pageContext the page context to use
+ * @return the base url with module name.
+ */
+ public static String getBaseURL( PageContext pageContext )
+ {
+ return getBaseURL( pageContext, null );
+ }
+
+ /**
+ * Using the page context, get the base url and append an optional resource name to the end of the provided url.
+ *
+ * @param pageContext the page context to use
+ * @param resource the resource name (or null if no resource name specified)
+ * @return the base url with resource name.
+ */
+ public static String getBaseURL( PageContext pageContext, String resource )
+ {
+ HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
+ return getBaseURL( request, resource );
+ }
+
+ /**
+ * Using the http servlet request, get the base url and append an optional resource name to the end of the url.
+ *
+ * @param request the request to use
+ * @param resource the resource name (or null if not resource name should be appended)
+ * @return the base url with resource name.
+ */
+ public static String getBaseURL( HttpServletRequest request, String resource )
+ {
+ StringBuffer baseUrl = new StringBuffer();
+
+ baseUrl.append( request.getScheme() ).append( "://" );
+ baseUrl.append( request.getServerName() );
+ int portnum = request.getServerPort();
+
+ // Only add port if non-standard.
+ Integer defaultPortnum = (Integer) defaultSchemePortMap.get( request.getScheme() );
+ if ( ( defaultPortnum == null ) || ( defaultPortnum.intValue() != portnum ) )
+ {
+ baseUrl.append( ":" ).append( String.valueOf( portnum ) );
+ }
+ baseUrl.append( request.getContextPath() );
+
+ if ( StringUtils.isNotBlank( resource ) )
+ {
+ if ( !baseUrl.toString().endsWith( "/" ) )
+ {
+ baseUrl.append( "/" );
+ }
+
+ baseUrl.append( resource );
+ }
+
+ return baseUrl.toString();
+ }
+}
<role>org.apache.maven.archiva.scheduled.ArchivaTaskScheduler</role>
<role-hint>default</role-hint>
</component>
- <!--
<component>
- <role>org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor</role>
+ <role>org.codehaus.plexus.taskqueue.execution.TaskExecutor</role>
<role-hint>archiva-task-executor</role-hint>
</component>
- -->
</load-on-start>
<lifecycle-handler-manager implementation="org.codehaus.plexus.lifecycle.DefaultLifecycleHandlerManager">
</tag>
+ <tag>
+
+ <name>copy-paste-snippet</name>
+ <tag-class>org.apache.maven.archiva.web.tags.CopyPasteSnippetTag</tag-class>
+ <body-content>empty</body-content>
+ <description><![CDATA[Render a copy paste snippet for the provided object]]></description>
+
+ <attribute>
+ <name>object</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ <description><![CDATA[The Object to Render]]></description>
+ </attribute>
+
+ </tag>
+
</taglib>
\ No newline at end of file
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %c{1} - %m%n"/>
+ <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
</layout>
</appender>
<level value="info"/>
</logger>
+ <logger name="org.apache.maven.archiva">
+ <level value="debug" />
+ </logger>
+
<logger name="org.codehaus.plexus.security">
<level value="info"/>
</logger>
<!-- squelch noisy objects (for now) -->
+ <logger name="org.apache.commons">
+ <level value="warn"/>
+ </logger>
+
+ <logger name="net.sf.ehcache">
+ <level value="warn"/>
+ </logger>
+
<logger name="org.codehaus.plexus.mailsender.MailSender">
<level value="info"/>
</logger>
+ <logger name="org.codehaus.plexus.velocity">
+ <level value="error"/>
+ </logger>
+
<logger name="org.quartz">
<level value="info"/>
</logger>
</logger>
<root>
- <priority value ="warn" />
+ <priority value ="info" />
<appender-ref ref="console" />
<appender-ref ref="rolling" />
</root>
webwork.objectFactory = org.codehaus.plexus.xwork.PlexusObjectFactory
webwork.url.includeParams = none
+webwork.devMode = true
+
# TODO: package up a theme and share with Continuum. Should contain everything from xhtml, and set templateDir to WEB-INF/themes
<package name="base" extends="webwork-default">
<interceptors>
+ <interceptor name="strange" class="webwork-is-doing-strange-things"/>
<interceptor name="configuration" class="configurationInterceptor"/>
<interceptor name="pssForceAdminUser" class="pssForceAdminUserInterceptor"/>
<interceptor name="pssSecureActions" class="pssSecureActionInterceptor"/>
<interceptor name="pssAutoLogin" class="pssAutoLoginInterceptor"/>
- <interceptor name="pssEnvironmentChecker" class="pssEnvironmentCheckInterceptor"/>
<interceptor name="pssPolicyEnforcement" class="pssPolicyEnforcementInterceptor"/>
- <interceptor-stack name="unconfiguredStack">
- <interceptor-ref name="defaultStack"/>
- <interceptor-ref name="pssEnvironmentChecker"/>
+ <interceptor-stack name="configuredArchivaStack">
<interceptor-ref name="pssForceAdminUser"/>
<interceptor-ref name="pssAutoLogin"/>
- <interceptor-ref name="pssPolicyEnforcement"/>
+ <interceptor-ref name="defaultStack"/>
<interceptor-ref name="pssSecureActions"/>
+ <interceptor-ref name="pssPolicyEnforcement"/>
+ <interceptor-ref name="configuration"/>
+ <interceptor-ref name="validation">
+ <param name="excludeMethods">input,back,cancel,browse</param>
+ </interceptor-ref>
+ <interceptor-ref name="workflow">
+ <param name="excludeMethods">input,back,cancel,browse</param>
+ </interceptor-ref>
</interceptor-stack>
- <interceptor-stack name="configuredStack">
- <interceptor-ref name="defaultStack"/>
- <interceptor-ref name="pssEnvironmentChecker"/>
+ <interceptor-stack name="unconfiguredArchivaStack">
<interceptor-ref name="pssForceAdminUser"/>
<interceptor-ref name="pssAutoLogin"/>
+ <interceptor-ref name="defaultStack"/>
<interceptor-ref name="pssPolicyEnforcement"/>
<interceptor-ref name="pssSecureActions"/>
- <interceptor-ref name="configuration"/>
+ <interceptor-ref name="validation">
+ <param name="excludeMethods">input,back,cancel,browse</param>
+ </interceptor-ref>
+ <interceptor-ref name="workflow">
+ <param name="excludeMethods">input,back,cancel,browse</param>
+ </interceptor-ref>
</interceptor-stack>
<interceptor-stack name="configuredPrepareParamsStack">
- <interceptor-ref name="paramsPrepareParamsStack"/>
- <interceptor-ref name="configuredStack"/>
+ <!-- <interceptor-ref name="prepare" /> -->
+ <interceptor-ref name="params" />
+ <interceptor-ref name="configuredArchivaStack"/>
</interceptor-stack>
+
</interceptors>
<!-- Default interceptor stack. -->
- <default-interceptor-ref name="configuredStack"/>
+ <default-interceptor-ref name="configuredArchivaStack"/>
<global-results>
<!-- TODO: want an extra message on the configure page when this first happens! -->
<action name="repositories" class="repositoriesAction" method="input">
<result name="input">/WEB-INF/jsp/admin/repositories.jsp</result>
</action>
+
+ <action name="indexRepository" class="indexRepositoryAction" method="run">
+ <result type="redirect-action">repositories</result>
+ </action>
<action name="addRepository" class="configureRepositoryAction" method="add">
<result name="input">/WEB-INF/jsp/admin/addRepository.jsp</result>
- <result type="redirect-action">managedRepositories</result>
- <interceptor-ref name="unconfiguredStack"/>
+ <result type="redirect-action">repositories</result>
+ <!-- <interceptor-ref name="unconfiguredArchivaStack"/> -->
</action>
- <action name="editRepository" class="configureRepositoryAction" method="edit">
+ <action name="editRepository" class="editRepositoryAction" method="edit">
<result name="input">/WEB-INF/jsp/admin/editRepository.jsp</result>
- <result type="redirect-action">managedRepositories</result>
+ <result name="error" type="redirect-action">repositories</result>
+ <result name="success" type="redirect-action">repositories</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
+
+ <action name="saveRepository" class="saveRepositoryAction" method="save">
+ <result name="success" type="redirect-action">repositories</result>
+ </action>
<action name="deleteRepository" class="deleteRepositoryAction">
<result name="input">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
- <result type="redirect-action">managedRepositories</result>
+ <result type="redirect-action">repositories</result>
</action>
<action name="configure" class="configureAction" method="input">
<result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
- <interceptor-ref name="unconfiguredStack"/>
+ <interceptor-ref name="unconfiguredArchivaStack"/>
</action>
<action name="saveConfiguration" class="configureAction">
<result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
<result>/WEB-INF/jsp/admin/index.jsp</result>
- <interceptor-ref name="unconfiguredStack"/>
+ <interceptor-ref name="unconfiguredArchivaStack"/>
</action>
<action name="reports" class="reportsAction">
</action>
<action name="runReport" class="reportsAction" method="runReport">
- <interceptor-ref name="configuredStack"/>
+ <interceptor-ref name="configuredArchivaStack"/>
<interceptor-ref name="execAndWait"/>
<result name="wait" type="redirect">/admin/reports.action?reportGroup=${reportGroup}&repositoryId=${repositoryId}&filter=${filter}</result>
<result name="success" type="redirect">/admin/reports.action?reportGroup=${reportGroup}&repositoryId=${repositoryId}&filter=${filter}</result>
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-
-<html>
-<head>
- <title>Configuration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Configuration</h1>
-
-<div id="contentArea">
-
- <h2>Add Proxied Repository</h2>
-
- <%@ include file="errorMessages.jsp" %>
-
- <ww:actionmessage/>
- <ww:form method="post" action="addProxiedRepository" namespace="/admin" validate="true">
- <ww:textfield name="id" label="Identifier" size="10"/>
- <%@ include file="/WEB-INF/jsp/admin/include/proxiedRepositoryForm.jspf" %>
-
- <ww:submit value="Add Repository"/>
- </ww:form>
-
- <script type="text/javascript">
- document.getElementById("addProxiedRepository_id").focus();
- </script>
-
-</div>
-
-</body>
-</html>
<ww:actionmessage/>
<ww:form method="post" action="addRepository" namespace="/admin" validate="true">
- <ww:textfield name="id" label="Identifier" size="10" required="true"/>
+ <ww:textfield name="model.id" label="Identifier" size="10" required="true"/>
<%@ include file="/WEB-INF/jsp/admin/include/managedRepositoryForm.jspf" %>
- <ww:checkbox name="indexed" fieldValue="true" value="true" label="Indexed"/>
<ww:submit value="Add Repository"/>
</ww:form>
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-<html>
-<head>
- <title>Configuration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Configuration</h1>
-
-<div id="contentArea">
-
- <h2>Add Synced Repository</h2>
-
- <%@ include file="errorMessages.jsp" %>
-
- <ww:actionmessage/>
- <ww:form method="post" action="addSelectedSyncedRepository" namespace="/admin" validate="true">
- <ww:textfield name="id" label="Identifier" size="10" required="true"/>
- <%@ include file="/WEB-INF/jsp/admin/include/syncedRepositoryForm.jspf" %>
-
- <ww:submit value="Add Repository"/>
- </ww:form>
-
- <script type="text/javascript">
- document.getElementById("addSelectedSyncedRepository_id").focus();
- </script>
-
-</div>
-
-</body>
-</html>
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-
-<html>
-<head>
- <title>Configuration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Configuration</h1>
-
-<div id="contentArea">
-
- <h2>Delete Proxied Repository</h2>
-
- <blockquote>
- <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
- </blockquote>
-
- <ww:form method="post" action="deleteProxiedRepository" namespace="/admin" validate="true">
- <ww:hidden name="repoId"/>
- <ww:radio list="#@java.util.LinkedHashMap@{
- 'delete-contents' : 'Remove the repository and delete its contents from managed repositories',
- 'delete-entry' : 'Remove the repository from the available list, but leave the contents in the managed repositories',
- 'unmodified' : 'Leave the repository unmodified'}" name="operation" theme="archiva"/>
- <ww:submit value="Go"/>
- </ww:form>
-</div>
-
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-
-<html>
-<head>
- <title>Configuration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Configuration</h1>
-
-<div id="contentArea">
-
- <h2>Delete Synced Repository</h2>
-
- <blockquote>
- <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
- </blockquote>
-
- <ww:form method="post" action="deleteSyncedRepository" namespace="/admin" validate="true">
- <ww:hidden name="repoId"/>
- <ww:radio list="#@java.util.LinkedHashMap@{
- 'delete-contents' : 'Remove the repository and delete its contents from managed repositories',
- 'delete-entry' : 'Remove the repository from the available list, but leave the contents in the managed repositories',
- 'unmodified' : 'Leave the repository unmodified'}" name="operation" theme="archiva"/>
- <ww:submit value="Go"/>
- </ww:form>
-</div>
-
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-
-<html>
-<head>
- <title>Configuration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Configuration</h1>
-
-<div id="contentArea">
-
- <h2>Edit Proxied Repository</h2>
-
- <%@ include file="errorMessages.jsp" %>
-
- <ww:actionmessage/>
- <ww:form method="post" action="editProxiedRepository" namespace="/admin" validate="true">
- <ww:hidden name="id"/>
- <%@ include file="/WEB-INF/jsp/admin/include/proxiedRepositoryForm.jspf" %>
- <ww:submit value="Update Repository"/>
- </ww:form>
-
- <script type="text/javascript">
- document.getElementById("editProxiedRepository_name").focus();
- </script>
-
-</div>
-
-</body>
-</html>
<h2>Edit Managed Repository</h2>
<ww:actionmessage/>
- <ww:form method="post" action="editRepository" namespace="/admin" validate="true">
+ <ww:form method="post" action="saveRepository" namespace="/admin" validate="false">
+ <ww:hidden name="mode"/>
<ww:hidden name="id"/>
<%@ include file="/WEB-INF/jsp/admin/include/managedRepositoryForm.jspf" %>
- <ww:checkbox name="indexed" fieldValue="true" label="Indexed"/>
<ww:submit value="Update Repository"/>
</ww:form>
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-<html>
-<head>
- <title>Configuration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Configuration</h1>
-
-<div id="contentArea">
-
- <h2>Edit Synced Repository</h2>
-
- <%@ include file="errorMessages.jsp" %>
-
- <ww:actionmessage/>
- <ww:form method="post" action="editSyncedRepository" namespace="/admin" validate="true">
- <ww:hidden name="id"/>
- <%@ include file="/WEB-INF/jsp/admin/include/syncedRepositoryForm.jspf" %>
-
- <ww:submit value="Update Repository"/>
- </ww:form>
-
- <script type="text/javascript">
- document.getElementById("editSyncedRepository_name").focus();
- </script>
-
-</div>
-
-</body>
-</html>
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<c:set var="urlbase">${pageContext.request.scheme}://${pageContext.request.serverName}
- :${pageContext.request.serverPort}${pageContext.request.contextPath}/repository/
-</c:set>
-
-<tr>
- <td>
- <ww:label for="urlName" theme="simple">URL Name*:</ww:label>
- </td>
- <td>
- <c:out value="${urlbase}"/>
- <ww:textfield name="urlName" id="urlName" size="20" theme="simple" required="true"/>
- </td>
-</tr>
-
<ww:textfield name="name" label="Name" size="50" required="true"/>
<ww:textfield name="directory" label="Directory" size="100" required="true"/>
<ww:select list="#@java.util.LinkedHashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}"
name="layout" label="Type"/>
-<ww:checkbox name="includeSnapshots" fieldValue="true" label="Snapshots Included"/>
+<ww:textfield name="refreshCronExpression" label="Cron" size="100" required="true" />
+<ww:checkbox name="releases" fieldValue="true" label="Releases Included"/>
+<ww:checkbox name="snapshots" fieldValue="false" label="Snapshots Included"/>
+<ww:checkbox name="indexed" fieldValue="true" label="Indexed"/>
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ taglib prefix="pss" uri="/plexusSecuritySystem" %>
-
-<html>
-<head>
- <title>Administration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Administration</h1>
-
-<div id="contentArea">
-
-<%-- DO NOT REFORMAT THIS LINE --%>
-<c:set var="urlbase">${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/repository/</c:set>
-
-<div>
- <div style="float: right">
- <%-- TODO replace with icons --%>
- <pss:ifAuthorized permission="archiva-manage-configuration">
- <ww:url id="addRepositoryUrl" action="addRepository" method="input"/>
- <ww:a href="%{addRepositoryUrl}">Add Repository</ww:a>
- </pss:ifAuthorized>
- </div>
- <h2>Managed Repositories</h2>
-</div>
-
-<ww:set name="repositories" value="repositories"/>
-<c:if test="${empty(repositories)}">
- <strong>There are no managed repositories configured yet.</strong>
-</c:if>
-<c:forEach items="${repositories}" var="repository" varStatus="i">
-
- <div>
- <div style="float: right">
- <pss:ifAnyAuthorized permissions="archiva-manage-configuration">
- <ww:url id="editRepositoryUrl" action="editRepository" method="input">
- <ww:param name="repoId" value="%{'${repository.id}'}"/>
- </ww:url>
- <ww:url id="deleteRepositoryUrl" action="deleteRepository" method="input">
- <ww:param name="repoId" value="%{'${repository.id}'}"/>
- </ww:url>
- <%-- TODO replace with icons --%>
- <ww:a href="%{editRepositoryUrl}">Edit Repository</ww:a>
- <ww:a href="%{deleteRepositoryUrl}">Delete Repository</ww:a>
- </pss:ifAnyAuthorized>
- </div>
- <h3>${repository.name}</h3>
- <table class="infoTable">
- <tr>
- <th>Identifier</th>
- <td>
- <code>${repository.id}</code>
- </td>
- </tr>
- <tr>
- <th>Directory</th>
- <td>${repository.directory}</td>
- </tr>
- <tr>
- <th>WebDAV URL</th>
- <td><a href="${urlbase}${repository.urlName}/">${urlbase}${repository.urlName}/</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>Snapshots Included</th>
- <td class="${repository.includeSnapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.includeSnapshots}</td>
- </tr>
- <tr>
- <th>Indexed</th>
- <td class="${repository.indexed ? 'donemark' : 'errormark'} booleanIcon"> ${repository.indexed}</td>
- </tr>
- <tr>
- <th>POM Snippet</th>
- <td><a href="#" onclick="Effect.toggle('repoPom${repository.id}','slide'); return false;">Show POM Snippet</a><br/>
- <%-- DO NOT REFORMAT THIS SECTION --%>
-<pre class="pom" style="display: none;" id="repoPom${repository.id}"><code><project>
- ...
- <distributionManagement>
- <${repository.includeSnapshots ? 'snapshotRepository' : 'repository'}>
- <id>${repository.id}</id>
- <url>dav:${urlbase}${repository.urlName}</url>
- <c:if test="${repository.layout != 'default'}">
- <layout>${repository.layout}</layout>
- </c:if>
- </${repository.includeSnapshots ? 'snapshotRepository' : 'repository'}>
- </distributionManagement>
-
- <repositories>
- <repository>
- <id>${repository.id}</id>
- <name>${repository.name}</name>
- <url>${urlbase}${repository.urlName}/</url>
- <c:if test="${repository.layout != 'default'}">
- <layout>${repository.layout}</layout>
- </c:if>
- <releases>
- <enabled>${repository.includeSnapshots ? 'false' : 'true'}</enabled>
- </releases>
- <snapshots>
- <enabled>${repository.includeSnapshots ? 'true' : 'false'}</enabled>
- </snapshots>
- </repository>
- </repositories>
- ...
- </project>
-</code></pre>
- </td>
- </tr>
- </table>
- </div>
-</c:forEach>
-</div>
-
-</body>
-</html>
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
-<%@ taglib prefix="pss" uri="/plexusSecuritySystem" %>
-
-<html>
-<head>
- <title>Administration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Administration</h1>
-
-<div id="contentArea">
- <div>
-
- <%-- TODO replace with icons --%>
- <div style="float: right">
- <pss:ifAuthorized permission="archiva-manage-configuration">
- <a href="<ww:url action="addProxiedRepository" method="input" />">Add Repository</a>
- </pss:ifAuthorized>
- </div>
-
- <h2>Proxied Repositories</h2>
- </div>
-
- <ww:set name="proxiedRepositories" value="proxiedRepositories"/>
- <c:if test="${empty(proxiedRepositories)}">
- <strong>There are no proxied repositories configured yet.</strong>
- </c:if>
- <c:forEach items="${proxiedRepositories}" var="repository" varStatus="i">
- <div>
- <div style="float: right">
- <%-- TODO replace with icons --%>
- <pss:ifAuthorized permission="archiva-manage-configuration">
- <a href="<ww:url action="editProxiedRepository" method="input"><ww:param name="repoId" value="%{'${repository.id}'}" /></ww:url>">Edit
- Repository</a> | <a
- href="<ww:url action="deleteProxiedRepository" method="input"><ww:param name="repoId" value="%{'${repository.id}'}" /></ww:url>">Delete
- Repository</a>
- </pss:ifAuthorized>
- </div>
- <h3>${repository.name}</h3>
- <table class="infoTable">
- <tr>
- <th>Identifier</th>
- <td>
- <code>${repository.id}</code>
- </td>
- </tr>
- <tr>
- <th>URL</th>
- <td><a href="${repository.url}">${repository.url}</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>Snapshots</th>
- <td>
- <my:displayUpdatePolicy policy="${repository.snapshotsPolicy}" interval="${repository.snapshotsInterval}"/>
- </td>
- </tr>
- <tr>
- <th>Releases</th>
- <td>
- <my:displayUpdatePolicy policy="${repository.releasesPolicy}" interval="${repository.releasesInterval}"/>
- </td>
- </tr>
- <tr>
- <th>Proxied through</th>
- <td>
- <%-- TODO: this is the hard way! would be nice if there was a ref in the model so it was directly linked --%>
- ${repositoriesMap[repository.managedRepository].name}
- (<code>${repositoriesMap[repository.managedRepository].id}</code>)
- </td>
- </tr>
- <tr>
- <th>Use HTTP Proxy</th>
- <td class="${repository.useNetworkProxy ? 'donemark' : 'errormark'} booleanIcon"></td>
- </tr>
- <tr>
- <th>Cache Failures</th>
- <td class="${repository.cacheFailures ? 'donemark' : 'errormark'} booleanIcon"></td>
- </tr>
- <tr>
- <th>Fail Whole Group</th>
- <td class="${repository.hardFail ? 'donemark' : 'errormark'} booleanIcon"></td>
- </tr>
- </table>
- </div>
- </c:forEach>
-</div>
-
-</body>
-</html>
\ No newline at end of file
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="pss" uri="/plexusSecuritySystem" %>
+<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %>
<html>
<head>
<div id="contentArea">
+<ww:actionerror />
+<ww:actionmessage />
+
<div>
<div style="float: right">
<%-- TODO replace with icons --%>
<pss:ifAuthorized permission="archiva-manage-configuration">
- <ww:url id="addRepositoryUrl" action="addRepository" method="input"/>
+ <ww:url id="addRepositoryUrl" action="addRepository"/>
<ww:a href="%{addRepositoryUrl}">Add Repository</ww:a>
</pss:ifAuthorized>
</div>
<h2>Managed Repositories</h2>
</div>
-<ww:set name="repositories" value="model.repositories"/>
-<c:if test="${empty(repositories)}">
- <strong>There are no managed repositories configured yet.</strong>
-</c:if>
-
-<%--
-<c:forEach items="${repositories}" var="repository" varStatus="i">
+<c:choose>
+ <c:when test="${empty(model.managedRepositories)}">
+ <%-- No Managed Repositories. --%>
+ <strong>There are no managed repositories configured yet.</strong>
+ </c:when>
+ <c:otherwise>
+ <%-- Display the repositories. --%>
+
+ <c:forEach items="${model.managedRepositories}" var="repository" varStatus="i">
- <div>
- <div style="float: right">
- <pss:ifAnyAuthorized permissions="archiva-manage-configuration">
- <ww:url id="editRepositoryUrl" action="editRepository" method="input">
- <ww:param name="repoId" value="%{'${repository.id}'}"/>
- </ww:url>
- <ww:url id="deleteRepositoryUrl" action="deleteRepository" method="input">
- <ww:param name="repoId" value="%{'${repository.id}'}"/>
- </ww:url>
- <ww:a href="%{editRepositoryUrl}">Edit Repository</ww:a>
- <ww:a href="%{deleteRepositoryUrl}">Delete Repository</ww:a>
- </pss:ifAnyAuthorized>
+ <div>
+
+ <div style="float: right">
+ <%-- TODO: make some icons --%>
+ <pss: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}">Edit Repository</ww:a>
+ <ww:a href="%{deleteRepositoryUrl}">Delete Repository</ww:a>
+ </pss:ifAnyAuthorized>
+ </div>
+
+ <h3>${repository.name}</h3>
+
+ <table class="infoTable">
+ <tr>
+ <th>Identifier</th>
+ <td>
+ <code>${repository.id}</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="${model.baseUrl}/${repository.id}/">${model.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>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>Indexed</th>
+ <td class="${repository.indexed ? 'donemark' : 'errormark'} booleanIcon"> ${repository.indexed}</td>
+ </tr>
+ <c:if test="${repository.indexed}">
+ <tr>
+ <th>Indexing Cron</th>
+ <td>${repository.refreshCronExpression}</td>
+ </tr>
+ <tr>
+ <th>Stats</th>
+ <td>
+ <div style="float: right">
+ <pss:ifAuthorized permission="archiva-run-indexer">
+ <ww:url id="indexRepositoryUrl" action="indexRepository">
+ <ww:param name="repoid" value="%{'${repository.id}'}" />
+ </ww:url>
+ <ww:a href="%{indexRepositoryUrl}">Index Repository</ww:a>
+ </pss:ifAuthorized>
+ </div>
+ <c:choose>
+ <c:when test="${empty(repository.stats)}">
+ Never indexed.
+ </c:when>
+ <c:otherwise>
+ <table>
+ <tr>
+ <th>Last Indexed</th>
+ <td>${repository.stats.whenStarted}</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>
+ </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>
- <h3>${repository.name}</h3>
- <table class="infoTable">
- <tr>
- <th>Identifier</th>
- <td>
- <code>${repository.id}</code>
- </td>
- </tr>
- <tr>
- <th>Directory</th>
- <td>${repository.directory}</td>
- </tr>
- <tr>
- <th>WebDAV URL</th>
- <td><a href="${urlbase}${repository.urlName}/">${urlbase}${repository.urlName}/</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>Snapshots Included</th>
- <td class="${repository.includeSnapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.includeSnapshots}</td>
- </tr>
- <tr>
- <th>Indexed</th>
- <td class="${repository.indexed ? 'donemark' : 'errormark'} booleanIcon"> ${repository.indexed}</td>
- </tr>
- <tr>
- <th>POM Snippet</th>
- <td><a href="#" onclick="Effect.toggle('repoPom${repository.id}','slide'); return false;">Show POM Snippet</a><br/>
- <% - - DO NOT REFORMAT THIS SECTION - - %>
-<pre class="pom" style="display: none;" id="repoPom${repository.id}"><code><project>
- ...
- <distributionManagement>
- <${repository.includeSnapshots ? 'snapshotRepository' : 'repository'}>
- <id>${repository.id}</id>
- <url>dav:${urlbase}${repository.urlName}</url>
- <c:if test="${repository.layout != 'default'}">
- <layout>${repository.layout}</layout>
- </c:if>
- </${repository.includeSnapshots ? 'snapshotRepository' : 'repository'}>
- </distributionManagement>
+ </c:forEach>
+
+ </c:otherwise>
+</c:choose>
- <repositories>
- <repository>
- <id>${repository.id}</id>
- <name>${repository.name}</name>
- <url>${urlbase}${repository.urlName}/</url>
- <c:if test="${repository.layout != 'default'}">
- <layout>${repository.layout}</layout>
- </c:if>
- <releases>
- <enabled>${repository.includeSnapshots ? 'false' : 'true'}</enabled>
- </releases>
- <snapshots>
- <enabled>${repository.includeSnapshots ? 'true' : 'false'}</enabled>
- </snapshots>
- </repository>
- </repositories>
- ...
- </project>
-</code></pre>
- </td>
- </tr>
- </table>
- </div>
-</c:forEach>
- --%>
</div>
</body>
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-
-<html>
-<head>
- <title>Configuration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Configuration</h1>
-
-<div id="contentArea">
-
- <h2>Add Synced Repository</h2>
-
- <ww:actionmessage/>
- <ww:form method="post" action="addSyncedRepository" namespace="/admin" validate="true">
- <ww:select list="#@java.util.LinkedHashMap@{
- 'rsync' : 'Rsync',
- 'svn' : 'Subversion',
- 'cvs' : 'CVS',
- 'file': 'Local File System'}" name="method" label="Method"/>
-
- <ww:submit value="Continue"/>
- </ww:form>
-</div>
-
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<%--
- ~ 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.
- --%>
-
-<%@ taglib prefix="ww" uri="/webwork" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-<html>
-<head>
- <title>Administration</title>
- <ww:head/>
-</head>
-
-<body>
-
-<h1>Administration</h1>
-
-<div id="contentArea">
-<div>
- <%-- TODO replace with icons --%>
- <div style="float: right">
- <a href="<ww:url action="addSyncedRepository" method="input" />">Add Repository</a>
- </div>
- <h2>Synced Repositories</h2>
-</div>
-
-<ww:set name="syncedRepositories" value="syncedRepositories"/>
-<c:if test="${empty(syncedRepositories)}">
- <strong>There are no synced repositories configured yet.</strong>
-</c:if>
-<c:forEach items="${syncedRepositories}" var="repository" varStatus="i">
- <div>
- <div style="float: right">
- <%-- TODO replace with icons --%>
- <a href="<ww:url action="editSyncedRepository" method="input"><ww:param name="repoId" value="%{'${repository.id}'}" /></ww:url>">Edit
- Repository</a> | <a
- href="<ww:url action="deleteSyncedRepository" method="input"><ww:param name="repoId" value="%{'${repository.id}'}" /></ww:url>">Delete
- Repository</a>
- </div>
- <h3>${repository.name}</h3>
- <table class="infoTable">
- <tr>
- <th>Identifier</th>
- <td>
- <code>${repository.id}</code>
- </td>
- </tr>
- <tr>
- <th>Method</th>
- <td>${repository.method}</td>
- </tr>
- <c:choose>
- <c:when test="${repository.method == 'cvs'}">
- <tr>
- <th>CVS Root</th>
- <td>${repository.properties['cvsRoot']}</td>
- </tr>
- </c:when>
- <c:when test="${repository.method == 'svn'}">
- <tr>
- <th>Subversion URL</th>
- <td>${repository.properties['svnUrl']}</td>
- </tr>
- <tr>
- <th>Subversion Username</th>
- <td>${repository.properties['username']}</td>
- </tr>
- </c:when>
- <c:when test="${repository.method == 'rsync'}">
- <tr>
- <th>Rsync Host</th>
- <td>${repository.properties['rsyncHost']}</td>
- </tr>
- <tr>
- <th>Rsync Directory</th>
- <td>${repository.properties['rsyncDirectory']}</td>
- </tr>
- <tr>
- <th>Rsync Method</th>
- <td>
- <c:choose>
- <c:when test="${repository.properties['rsyncMethod'] == 'rsync'}">
- Anonymous
- </c:when>
- <c:when test="${repository.properties['rsyncMethod'] == 'ssh'}">
- SSH
- </c:when>
- </c:choose>
- </td>
- </tr>
- <tr>
- <th>Username</th>
- <td>${repository.properties['username']}</td>
- </tr>
- </c:when>
- <c:when test="${repository.method == 'file'}">
- <tr>
- <th>Directory</th>
- <td>${repository.properties['directory']}</td>
- </tr>
- </c:when>
- </c:choose>
- <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>Synced to</th>
- <td>
- <%-- TODO: this is the hard way! would be nice if there was a ref in the model so it was directly linked --%>
- ${repositoriesMap[repository.managedRepository].name}
- (<code>${repositoriesMap[repository.managedRepository].id}</code>)
- </td>
- </tr>
- <tr>
- <th>Schedule</th>
- <td>${repository.cronExpression}</td>
- </tr>
- </table>
- </div>
-</c:forEach>
-</div>
-
-</body>
-</html>
\ No newline at end of file
@import url( "<c:url value="/css/site.css" />" );
</style>
<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" />" />
<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"/>
<my:currentWWUrl action="index" namespace="/admin">Settings</my:currentWWUrl>
</li>
<li class="none">
- <my:currentWWUrl action="managedRepositories" namespace="/admin">Managed Repositories</my:currentWWUrl>
+ <my:currentWWUrl action="repositories" namespace="/admin">Repositories</my:currentWWUrl>
</li>
+ <%--
<li class="none">
<my:currentWWUrl action="proxiedRepositories" namespace="/admin">Proxied Repositories</my:currentWWUrl>
</li>
+ --%>
<%-- TODO: add back after synced repos are implemented
<li class="none">
<c:set var="text">\r
<jsp:doBody/>\r
</c:set>\r
-<c:choose>\r
+<a href="${url}">\r
+<c:choose>
<c:when test="${currentUrl == url}">\r
<b>${text}</b>\r
</c:when>\r
<c:otherwise>\r
- <a href="${url}">${text}</a>\r
- </c:otherwise>\r
-</c:choose>\r
+ ${text}\r
+ </c:otherwise>
+</c:choose>
+</a>\r
<servlet>
<servlet-name>RepositoryServlet</servlet-name>
<servlet-class>org.apache.maven.archiva.web.repository.RepositoryServlet</servlet-class>
+ <!-- Loading this on startup so as to take advantage of configuration listeners -->
+ <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
body, td, th, select, input, li {
font-family: Verdana, Helvetica, Arial, sans-serif;
- font-size: 13px;
+ font-size: 11pt;
}
select, input {
- font-size: x-small;
+ font-size: 0.9em;
+ border: 1px solid #AAAAAA;
+}
+
+select {
+ padding-left: 3px;
+ height: 1.4em;
+}
+
+input {
+ padding: 2px;
+}
+
+label .required {
+ color: red;
+ font-weight: bold;
}
th {
border-left: 1px solid #DFDEDE;
padding-left: 1em;
}
+
+.missing {
+ background-color: red;
+ color: white;
+ font-weight: bold;
+ padding: 4px;
+ margin-left: 20px;
+ margin-right: 20px;
+
+}