git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@536680 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.0-alpha-1
@@ -574,7 +574,7 @@ | |||
</description> | |||
</field> | |||
<field> | |||
<name>goodConsumers</name> | |||
<name>knownContentConsumers</name> | |||
<version>1.0.0+</version> | |||
<required>true</required> | |||
<association> | |||
@@ -582,11 +582,11 @@ | |||
<multiplicity>*</multiplicity> | |||
</association> | |||
<description> | |||
The list of consumers for good content. | |||
The list of active consumers IDs for known content. | |||
</description> | |||
</field> | |||
<field> | |||
<name>badConsumers</name> | |||
<name>invalidContentConsumers</name> | |||
<version>1.0.0+</version> | |||
<required>true</required> | |||
<association> | |||
@@ -594,55 +594,10 @@ | |||
<multiplicity>*</multiplicity> | |||
</association> | |||
<description> | |||
The list of consumer IDs for this file processor. | |||
The list of active consumer IDs for invalid content. | |||
</description> | |||
</field> | |||
</fields> | |||
<!-- | |||
<codeSegments> | |||
<codeSegment> | |||
<version>1.0.0+</version> | |||
<code><![CDATA[ | |||
/** | |||
* Get a specific file type by ID. | |||
* | |||
* @param id the id of the filetype to get. (null or empty will result in null return) | |||
* @return the {@link FileType} or null if the id is not found. | |||
*/ | |||
public FileType getFileTypeById( String id ) | |||
{ | |||
if ( id == null ) | |||
{ | |||
return null; | |||
} | |||
if ( id.trim().length() <= 0 ) | |||
{ | |||
return null; | |||
} | |||
java.util.List types = getFileTypes(); | |||
if ( types == null ) | |||
{ | |||
return null; | |||
} | |||
java.util.Iterator it = types.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
FileType filetype = (FileType) it.next(); | |||
if ( id.equals( filetype.getId() ) ) | |||
{ | |||
return filetype; | |||
} | |||
} | |||
return null; | |||
} | |||
]]></code> | |||
</codeSegment> | |||
</codeSegments> | |||
--> | |||
</class> | |||
<class> | |||
<name>FileType</name> | |||
@@ -693,7 +648,7 @@ | |||
</description> | |||
</field> | |||
<field> | |||
<name>processedConsumers</name> | |||
<name>cleanupConsumers</name> | |||
<version>1.0.0+</version> | |||
<required>true</required> | |||
<association> | |||
@@ -701,7 +656,9 @@ | |||
<multiplicity>*</multiplicity> | |||
</association> | |||
<description> | |||
The list of consumers for previously processed ArchivaArtifact database objects. | |||
The list of consumers for previously processed ArchivaArtifact database | |||
objects that no longer exist on the filesystem, and might need to | |||
undergo a cleanup. | |||
</description> | |||
</field> | |||
</fields> |
@@ -135,19 +135,19 @@ | |||
</patterns> | |||
</fileType> | |||
</fileTypes> | |||
<goodConsumers> | |||
<goodConsumer>update-db-artifact</goodConsumer> | |||
<goodConsumer>create-missing-checksums</goodConsumer> | |||
<goodConsumer>update-db-repository-metadata</goodConsumer> | |||
<goodConsumer>validate-checksum</goodConsumer> | |||
<goodConsumer>validate-signature</goodConsumer> | |||
<goodConsumer>index-content</goodConsumer> | |||
<goodConsumer>auto-remove</goodConsumer> | |||
<goodConsumer>auto-rename</goodConsumer> | |||
</goodConsumers> | |||
<badConsumers> | |||
<badConsumer>update-db-bad-content</badConsumer> | |||
</badConsumers> | |||
<knownContentConsumers> | |||
<knownContentConsumer>update-db-artifact</knownContentConsumer> | |||
<knownContentConsumer>create-missing-checksums</knownContentConsumer> | |||
<knownContentConsumer>update-db-repository-metadata</knownContentConsumer> | |||
<knownContentConsumer>validate-checksum</knownContentConsumer> | |||
<knownContentConsumer>validate-signature</knownContentConsumer> | |||
<knownContentConsumer>index-content</knownContentConsumer> | |||
<knownContentConsumer>auto-remove</knownContentConsumer> | |||
<knownContentConsumer>auto-rename</knownContentConsumer> | |||
</knownContentConsumers> | |||
<invalidContentConsumers> | |||
<invalidContentConsumer>update-db-bad-content</invalidContentConsumer> | |||
</invalidContentConsumers> | |||
</repositoryScanning> | |||
<databaseScanning> | |||
@@ -160,11 +160,11 @@ | |||
<unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> | |||
<unprocessedConsumer>index-public-methods</unprocessedConsumer> | |||
</unprocessedConsumers> | |||
<processedConsumers> | |||
<processedConsumer>not-present-remove-db-artifact</processedConsumer> | |||
<processedConsumer>not-present-remove-db-project</processedConsumer> | |||
<processedConsumer>not-present-remove-indexed</processedConsumer> | |||
</processedConsumers> | |||
<cleanupConsumers> | |||
<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> | |||
<cleanupConsumer>not-present-remove-db-project</cleanupConsumer> | |||
<cleanupConsumer>not-present-remove-indexed</cleanupConsumer> | |||
</cleanupConsumers> | |||
</databaseScanning> | |||
</configuration> |
@@ -147,19 +147,19 @@ | |||
</patterns> | |||
</fileType> | |||
</fileTypes> | |||
<goodConsumers> | |||
<goodConsumer>update-db-artifact</goodConsumer> | |||
<goodConsumer>create-missing-checksums</goodConsumer> | |||
<goodConsumer>update-db-repository-metadata</goodConsumer> | |||
<goodConsumer>validate-checksum</goodConsumer> | |||
<goodConsumer>validate-signature</goodConsumer> | |||
<goodConsumer>index-content</goodConsumer> | |||
<goodConsumer>auto-remove</goodConsumer> | |||
<goodConsumer>auto-rename</goodConsumer> | |||
</goodConsumers> | |||
<badConsumers> | |||
<badConsumer>update-db-bad-content</badConsumer> | |||
</badConsumers> | |||
<knownContentConsumers> | |||
<knownContentConsumer>update-db-artifact</knownContentConsumer> | |||
<knownContentConsumer>create-missing-checksums</knownContentConsumer> | |||
<knownContentConsumer>update-db-repository-metadata</knownContentConsumer> | |||
<knownContentConsumer>validate-checksum</knownContentConsumer> | |||
<knownContentConsumer>validate-signature</knownContentConsumer> | |||
<knownContentConsumer>index-content</knownContentConsumer> | |||
<knownContentConsumer>auto-remove</knownContentConsumer> | |||
<knownContentConsumer>auto-rename</knownContentConsumer> | |||
</knownContentConsumers> | |||
<invalidContentConsumers> | |||
<invalidContentConsumer>update-db-bad-content</invalidContentConsumer> | |||
</invalidContentConsumers> | |||
</repositoryScanning> | |||
<databaseScanning> | |||
@@ -172,11 +172,11 @@ | |||
<unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> | |||
<unprocessedConsumer>index-public-methods</unprocessedConsumer> | |||
</unprocessedConsumers> | |||
<processedConsumers> | |||
<processedConsumer>not-present-remove-db-artifact</processedConsumer> | |||
<processedConsumer>not-present-remove-db-project</processedConsumer> | |||
<processedConsumer>not-present-remove-indexed</processedConsumer> | |||
</processedConsumers> | |||
<cleanupConsumers> | |||
<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> | |||
<cleanupConsumer>not-present-remove-db-project</cleanupConsumer> | |||
<cleanupConsumer>not-present-remove-indexed</cleanupConsumer> | |||
</cleanupConsumers> | |||
</databaseScanning> | |||
</configuration> |
@@ -60,8 +60,8 @@ public class ArchivaConfigurationTest extends PlexusTestCase | |||
RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning(); | |||
assertNotNull( "check repository scanning", repoScanning ); | |||
assertEquals( "check file types", 4, repoScanning.getFileTypes().size() ); | |||
assertEquals( "check good consumers", 8, repoScanning.getGoodConsumers().size() ); | |||
assertEquals( "check bad consumers", 1, repoScanning.getBadConsumers().size() ); | |||
assertEquals( "check known consumers", 8, repoScanning.getKnownContentConsumers().size() ); | |||
assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() ); | |||
List patterns = filetypes.getFileTypePatterns( "artifacts" ); | |||
assertNotNull( "check 'artifacts' file type", patterns ); | |||
@@ -70,7 +70,7 @@ public class ArchivaConfigurationTest extends PlexusTestCase | |||
DatabaseScanningConfiguration dbScanning = configuration.getDatabaseScanning(); | |||
assertNotNull( "check database scanning", dbScanning ); | |||
assertEquals( "check unprocessed consumers", 6, dbScanning.getUnprocessedConsumers().size() ); | |||
assertEquals( "check processed consumers", 3, dbScanning.getProcessedConsumers().size() ); | |||
assertEquals( "check cleanup consumers", 3, dbScanning.getCleanupConsumers().size() ); | |||
RepositoryConfiguration repository = | |||
(RepositoryConfiguration) configuration.getRepositories().iterator().next(); |
@@ -0,0 +1,32 @@ | |||
package org.apache.maven.archiva.consumers; | |||
/* | |||
* 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. | |||
*/ | |||
/** | |||
* DatabaseCleanupConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public interface DatabaseCleanupConsumer | |||
extends ArchivaArtifactConsumer | |||
{ | |||
} |
@@ -0,0 +1,32 @@ | |||
package org.apache.maven.archiva.consumers; | |||
/* | |||
* 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. | |||
*/ | |||
/** | |||
* DatabaseUnprocessedArtifactConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public interface DatabaseUnprocessedArtifactConsumer | |||
extends ArchivaArtifactConsumer | |||
{ | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.database; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* BytecodeStatsToDatabaseConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" | |||
* role-hint="update-db-bytecode-stats" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class BytecodeStatsToDatabaseConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseUnprocessedArtifactConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="update-db-bytecode-stats" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Update database with java bytecode stats." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.database; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* DatabaseCleanupRemoveArtifactConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" | |||
* role-hint="not-present-remove-db-artifact" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class DatabaseCleanupRemoveArtifactConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseCleanupConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="not-present-remove-db-artifact" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Remove artifact from database if not present on filesystem." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.database; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* DatabaseCleanupRemoveProjectConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" | |||
* role-hint="not-present-remove-db-project" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class DatabaseCleanupRemoveProjectConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseCleanupConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="not-present-remove-db-project" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Remove project from database if not present on filesystem." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.database; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* ProjectModelToDatabaseConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" | |||
* role-hint="update-db-project" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class ProjectModelToDatabaseConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseUnprocessedArtifactConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="update-db-project" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Update database with project model information." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.database; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* VerifyMetadataAgainstDatabaseConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" | |||
* role-hint="validate-repository-metadata" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class VerifyMetadataAgainstDatabaseConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseUnprocessedArtifactConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="validate-repository-metadata" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Verify repository metadata files against database." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.lucene; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* IndexArchiveTableOfContentsConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" | |||
* role-hint="index-archive-toc" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class IndexArchiveTableOfContentsConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseUnprocessedArtifactConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="index-archive-toc" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Index the archive table of contents for Full Text Search." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.lucene; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* IndexArtifactConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" | |||
* role-hint="index-artifact" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class IndexArtifactConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseUnprocessedArtifactConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="index-artifact" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Index the artifact details for Full Text Search." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -79,7 +79,7 @@ public class IndexContentConsumer | |||
private FileTypes filetypes; | |||
/** | |||
* @plexus.requirement | |||
* @plexus.requirement role-hint="lucene" | |||
*/ | |||
private RepositoryContentIndexFactory indexFactory; | |||
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.lucene; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* IndexJavaPublicMethodsConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" | |||
* role-hint="index-public-methods" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class IndexJavaPublicMethodsConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseUnprocessedArtifactConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="index-public-methods" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Index the java public methods for Full Text Search." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package org.apache.maven.archiva.consumers.lucene; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; | |||
import org.apache.maven.archiva.model.ArchivaArtifact; | |||
import java.util.List; | |||
/** | |||
* LuceneCleanupRemoveIndexedConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" | |||
* role-hint="not-present-remove-indexed" | |||
* instantiation-strategy="per-lookup" | |||
*/ | |||
public class LuceneCleanupRemoveIndexedConsumer | |||
extends AbstractMonitoredConsumer | |||
implements DatabaseCleanupConsumer | |||
{ | |||
/** | |||
* @plexus.configuration default-value="not-present-remove-indexed" | |||
*/ | |||
private String id; | |||
/** | |||
* @plexus.configuration default-value="Remove indexed content if not present on filesystem." | |||
*/ | |||
private String description; | |||
public void beginScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public void completeScan() | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public List getIncludedTypes() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
public void processArchivaArtifact( ArchivaArtifact artifact ) | |||
throws ConsumerException | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -88,6 +88,12 @@ | |||
<version>1.0-alpha-2</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>easymock</groupId> | |||
<artifactId>easymock</artifactId> | |||
<version>1.2_Java1.3</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
<build> | |||
<plugins> |
@@ -51,7 +51,7 @@ public class DefaultRepositoryScanner | |||
/** | |||
* @plexus.requirement | |||
*/ | |||
private RepositoryContentConsumerUtil consumerUtil; | |||
private RepositoryContentConsumers consumerUtil; | |||
public RepositoryContentStatistics scan( ArchivaRepository repository, long changesSince ) | |||
throws RepositoryException |
@@ -41,9 +41,9 @@ import java.util.Map; | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumerUtil" | |||
* @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers" | |||
*/ | |||
public class RepositoryContentConsumerUtil | |||
public class RepositoryContentConsumers | |||
{ | |||
/** | |||
* @plexus.requirement | |||
@@ -53,12 +53,12 @@ public class RepositoryContentConsumerUtil | |||
/** | |||
* @plexus.requirement role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer" | |||
*/ | |||
private List availableGoodConsumers; | |||
private List availableKnownConsumers; | |||
/** | |||
* @plexus.requirement role="org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer" | |||
*/ | |||
private List availableBadConsumers; | |||
private List availableInvalidConsumers; | |||
class SelectedKnownRepoConsumersPredicate | |||
implements Predicate | |||
@@ -72,7 +72,7 @@ public class RepositoryContentConsumerUtil | |||
KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object; | |||
Configuration config = archivaConfiguration.getConfiguration(); | |||
return config.getRepositoryScanning().getGoodConsumers().contains( known.getId() ); | |||
return config.getRepositoryScanning().getKnownContentConsumers().contains( known.getId() ); | |||
} | |||
return satisfies; | |||
@@ -87,12 +87,12 @@ public class RepositoryContentConsumerUtil | |||
{ | |||
boolean satisfies = false; | |||
if ( object instanceof KnownRepositoryContentConsumer ) | |||
if ( object instanceof InvalidRepositoryContentConsumer ) | |||
{ | |||
InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object; | |||
Configuration config = archivaConfiguration.getConfiguration(); | |||
return config.getRepositoryScanning().getBadConsumers().contains( invalid.getId() ); | |||
return config.getRepositoryScanning().getInvalidContentConsumers().contains( invalid.getId() ); | |||
} | |||
return satisfies; | |||
@@ -128,25 +128,33 @@ public class RepositoryContentConsumerUtil | |||
{ | |||
return new SelectedInvalidRepoConsumersPredicate(); | |||
} | |||
public Map getSelectedKnownConsumersMap() | |||
public List getSelectedKnownConsumerIds() | |||
{ | |||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); | |||
return scanning.getKnownContentConsumers(); | |||
} | |||
public List getSelectedInvalidConsumerIds() | |||
{ | |||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); | |||
return scanning.getInvalidContentConsumers(); | |||
} | |||
public Map getSelectedKnownConsumersMap() | |||
{ | |||
RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); | |||
Closure ifclosure = IfClosure.getInstance( getKnownSelectionPredicate(), consumerMapClosure ); | |||
CollectionUtils.forAllDo( scanning.getGoodConsumers(), ifclosure ); | |||
CollectionUtils.forAllDo( availableKnownConsumers, ifclosure ); | |||
return consumerMapClosure.getMap(); | |||
} | |||
public Map getSelectedInvalidConsumersMap() | |||
{ | |||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); | |||
RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); | |||
Closure ifclosure = IfClosure.getInstance( getInvalidSelectionPredicate(), consumerMapClosure ); | |||
CollectionUtils.forAllDo( scanning.getGoodConsumers(), ifclosure ); | |||
CollectionUtils.forAllDo( availableInvalidConsumers, ifclosure ); | |||
return consumerMapClosure.getMap(); | |||
} | |||
@@ -156,7 +164,7 @@ public class RepositoryContentConsumerUtil | |||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); | |||
List ret = new ArrayList(); | |||
ret.addAll( CollectionUtils.select( scanning.getGoodConsumers(), getKnownSelectionPredicate() )); | |||
ret.addAll( CollectionUtils.select( scanning.getKnownContentConsumers(), getKnownSelectionPredicate() )); | |||
return ret; | |||
} | |||
@@ -166,18 +174,18 @@ public class RepositoryContentConsumerUtil | |||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); | |||
List ret = new ArrayList(); | |||
ret.addAll( CollectionUtils.select( scanning.getBadConsumers(), getInvalidSelectionPredicate() )); | |||
ret.addAll( CollectionUtils.select( scanning.getInvalidContentConsumers(), getInvalidSelectionPredicate() )); | |||
return ret; | |||
} | |||
public List getAvailableKnownConsumers() | |||
{ | |||
return availableGoodConsumers; | |||
return availableKnownConsumers; | |||
} | |||
public List getAvailableInvalidConsumers() | |||
{ | |||
return availableBadConsumers; | |||
return availableInvalidConsumers; | |||
} | |||
} |
@@ -0,0 +1,103 @@ | |||
package org.apache.maven.archiva.repository.scanner; | |||
/* | |||
* 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.consumers.KnownRepositoryContentConsumer; | |||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer; | |||
import org.codehaus.plexus.PlexusTestCase; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* RepositoryContentConsumerUtilTest | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public class RepositoryContentConsumerUtilTest | |||
extends PlexusTestCase | |||
{ | |||
private RepositoryContentConsumers lookupRepositoryConsumerUtil() | |||
throws Exception | |||
{ | |||
RepositoryContentConsumers consumerUtil = (RepositoryContentConsumers) lookup( RepositoryContentConsumers.class | |||
.getName() ); | |||
assertNotNull( "RepositoryContentConsumerUtil should not be null.", consumerUtil ); | |||
return consumerUtil; | |||
} | |||
public void testGetSelectedIds() | |||
throws Exception | |||
{ | |||
RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); | |||
List knownConsumers = consumerutil.getSelectedKnownConsumerIds(); | |||
assertNotNull( "Known Consumer IDs should not be null", knownConsumers ); | |||
assertEquals( "Known Consumer IDs.size", 9, knownConsumers.size() ); | |||
List invalidConsumers = consumerutil.getSelectedInvalidConsumerIds(); | |||
assertNotNull( "Invalid Consumer IDs should not be null", invalidConsumers ); | |||
assertEquals( "Invalid Consumer IDs.size", 1, invalidConsumers.size() ); | |||
} | |||
public void testGetSelectedConsumersMaps() | |||
throws Exception | |||
{ | |||
RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); | |||
Map knownConsumerMap = consumerutil.getSelectedKnownConsumersMap(); | |||
assertNotNull( "Known Consumer Map should not be null", knownConsumerMap ); | |||
assertEquals( "Known Consumer Map.size", 1, knownConsumerMap.size() ); | |||
Object o = knownConsumerMap.get( "sample-known" ); | |||
assertNotNull( "Known[sample-known] should not be null.", o ); | |||
assertInstanceof( "Known[sample-known]", RepositoryContentConsumer.class, o ); | |||
assertInstanceof( "Known[sample-known]", KnownRepositoryContentConsumer.class, o ); | |||
Map invalidConsumerMap = consumerutil.getSelectedInvalidConsumersMap(); | |||
assertNotNull( "Invalid Consumer Map should not be null", invalidConsumerMap ); | |||
assertEquals( "Invalid Consumer Map.size", 0, invalidConsumerMap.size() ); | |||
} | |||
private void assertInstanceof( String msg, Class clazz, Object o ) | |||
{ | |||
if ( clazz.isInstance( o ) == false ) | |||
{ | |||
fail( msg + ": Object [" + o.getClass().getName() + "] should have been an instanceof [" + clazz.getName() | |||
+ "]" ); | |||
} | |||
} | |||
public void testGetAvailableLists() | |||
throws Exception | |||
{ | |||
RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); | |||
List knownConsumers = consumerutil.getAvailableKnownConsumers(); | |||
assertNotNull( "known consumers should not be null.", knownConsumers ); | |||
assertEquals( "known consumers", 1, knownConsumers.size() ); | |||
assertInstanceof( "Available Known Consumers", RepositoryContentConsumer.class, knownConsumers.get( 0 ) ); | |||
List invalidConsumers = consumerutil.getAvailableInvalidConsumers(); | |||
assertNotNull( "invalid consumers should not be null.", invalidConsumers ); | |||
assertEquals( "invalid consumers", 0, invalidConsumers.size() ); | |||
} | |||
} |
@@ -0,0 +1,83 @@ | |||
package org.apache.maven.archiva.repository.scanner; | |||
/* | |||
* 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.consumers.AbstractMonitoredConsumer; | |||
import org.apache.maven.archiva.consumers.ConsumerException; | |||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | |||
import org.apache.maven.archiva.model.ArchivaRepository; | |||
import java.util.List; | |||
/** | |||
* SampleKnownConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer" | |||
* role-hint="sample-known" | |||
*/ | |||
public class SampleKnownConsumer | |||
extends AbstractMonitoredConsumer | |||
implements KnownRepositoryContentConsumer | |||
{ | |||
public void beginScan( ArchivaRepository repository ) | |||
throws ConsumerException | |||
{ | |||
/* nothing to do */ | |||
} | |||
public void completeScan() | |||
{ | |||
/* nothing to do */ | |||
} | |||
public List getExcludes() | |||
{ | |||
return null; | |||
} | |||
public List getIncludes() | |||
{ | |||
return null; | |||
} | |||
public void processFile( String path ) | |||
throws ConsumerException | |||
{ | |||
/* nothing to do */ | |||
} | |||
public String getDescription() | |||
{ | |||
return "Sample Known Consumer"; | |||
} | |||
public String getId() | |||
{ | |||
return "sample-known"; | |||
} | |||
public boolean isPermanent() | |||
{ | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,53 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<component-set> | |||
<components> | |||
<component> | |||
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> | |||
<implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> | |||
<requirements> | |||
<requirement> | |||
<role>org.codehaus.plexus.registry.Registry</role> | |||
<role-hint>configured</role-hint> | |||
</requirement> | |||
</requirements> | |||
</component> | |||
<component> | |||
<role>org.codehaus.plexus.registry.Registry</role> | |||
<role-hint>configured</role-hint> | |||
<implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> | |||
<configuration> | |||
<properties> | |||
<system/> | |||
<xml fileName="${basedir}/src/test/resources/scanner-archiva.xml" | |||
config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> | |||
</properties> | |||
</configuration> | |||
</component> | |||
<component> | |||
<role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> | |||
<role-hint>sample-known</role-hint> | |||
<implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> | |||
</component> | |||
</components> | |||
</component-set> |
@@ -0,0 +1,110 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<configuration> | |||
<repositoryScanning> | |||
<fileTypes> | |||
<fileType> | |||
<id>artifacts</id> | |||
<patterns> | |||
<pattern>**/*.pom</pattern> | |||
<pattern>**/*.jar</pattern> | |||
<pattern>**/*.ear</pattern> | |||
<pattern>**/*.war</pattern> | |||
<pattern>**/*.car</pattern> | |||
<pattern>**/*.sar</pattern> | |||
<pattern>**/*.mar</pattern> | |||
<pattern>**/*.rar</pattern> | |||
<pattern>**/*.dtd</pattern> | |||
<pattern>**/*.tld</pattern> | |||
<pattern>**/*.tar.gz</pattern> | |||
<pattern>**/*.tar.bz2</pattern> | |||
<pattern>**/*.zip</pattern> | |||
</patterns> | |||
</fileType> | |||
<fileType> | |||
<id>indexable-content</id> | |||
<patterns> | |||
<pattern>**/*.txt</pattern> | |||
<pattern>**/*.TXT</pattern> | |||
<pattern>**/*.block</pattern> | |||
<pattern>**/*.config</pattern> | |||
<pattern>**/*.pom</pattern> | |||
<pattern>**/*.xml</pattern> | |||
<pattern>**/*.xsd</pattern> | |||
<pattern>**/*.dtd</pattern> | |||
<pattern>**/*.tld</pattern> | |||
</patterns> | |||
</fileType> | |||
<fileType> | |||
<id>auto-remove</id> | |||
<patterns> | |||
<pattern>**/*.bak</pattern> | |||
<pattern>**/*~</pattern> | |||
<pattern>**/*-</pattern> | |||
</patterns> | |||
</fileType> | |||
<fileType> | |||
<id>ignored</id> | |||
<patterns> | |||
<pattern>**/.htaccess</pattern> | |||
<pattern>**/KEYS</pattern> | |||
<pattern>**/*.rb</pattern> | |||
<pattern>**/*.sh</pattern> | |||
<pattern>**/.svn/**</pattern> | |||
<pattern>**/.DAV/**</pattern> | |||
</patterns> | |||
</fileType> | |||
</fileTypes> | |||
<knownContentConsumers> | |||
<knownContentConsumer>sample-known</knownContentConsumer> | |||
<knownContentConsumer>update-db-artifact</knownContentConsumer> | |||
<knownContentConsumer>create-missing-checksums</knownContentConsumer> | |||
<knownContentConsumer>update-db-repository-metadata</knownContentConsumer> | |||
<knownContentConsumer>validate-checksum</knownContentConsumer> | |||
<knownContentConsumer>validate-signature</knownContentConsumer> | |||
<knownContentConsumer>index-content</knownContentConsumer> | |||
<knownContentConsumer>auto-remove</knownContentConsumer> | |||
<knownContentConsumer>auto-rename</knownContentConsumer> | |||
</knownContentConsumers> | |||
<invalidContentConsumers> | |||
<invalidContentConsumer>update-db-bad-content</invalidContentConsumer> | |||
</invalidContentConsumers> | |||
</repositoryScanning> | |||
<databaseScanning> | |||
<cronExpression>0 0 * * ?</cronExpression> | |||
<unprocessedConsumers> | |||
<unprocessedConsumer>index-artifact</unprocessedConsumer> | |||
<unprocessedConsumer>update-db-project</unprocessedConsumer> | |||
<unprocessedConsumer>validate-repository-metadata</unprocessedConsumer> | |||
<unprocessedConsumer>index-archive-toc</unprocessedConsumer> | |||
<unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> | |||
<unprocessedConsumer>index-public-methods</unprocessedConsumer> | |||
</unprocessedConsumers> | |||
<cleanupConsumers> | |||
<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> | |||
<cleanupConsumer>not-present-remove-db-project</cleanupConsumer> | |||
<cleanupConsumer>not-present-remove-indexed</cleanupConsumer> | |||
</cleanupConsumers> | |||
</databaseScanning> | |||
</configuration> |
@@ -0,0 +1,157 @@ | |||
package org.apache.maven.archiva.database.updater; | |||
/* | |||
* 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.collections.CollectionUtils; | |||
import org.apache.commons.collections.Predicate; | |||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | |||
import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; | |||
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; | |||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; | |||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; | |||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
* DatabaseConsumers | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="org.apache.maven.archiva.database.updater.DatabaseConsumers" | |||
*/ | |||
public class DatabaseConsumers | |||
implements Initializable | |||
{ | |||
/** | |||
* @plexus.requirement | |||
*/ | |||
private ArchivaConfiguration archivaConfiguration; | |||
/** | |||
* @plexus.requirement role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" | |||
*/ | |||
private List availableUnprocessedConsumers; | |||
/** | |||
* @plexus.requirement role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" | |||
*/ | |||
private List availableCleanupConsumers; | |||
private SelectedCleanupConsumersPredicate selectedCleanupConsumers; | |||
private SelectedUnprocessedConsumersPredicate selectedUnprocessedConsumers; | |||
class SelectedUnprocessedConsumersPredicate | |||
implements Predicate | |||
{ | |||
public boolean evaluate( Object object ) | |||
{ | |||
boolean satisfies = false; | |||
if ( object instanceof DatabaseUnprocessedArtifactConsumer ) | |||
{ | |||
DatabaseUnprocessedArtifactConsumer consumer = (DatabaseUnprocessedArtifactConsumer) object; | |||
DatabaseScanningConfiguration config = archivaConfiguration.getConfiguration().getDatabaseScanning(); | |||
return config.getUnprocessedConsumers().contains( consumer.getId() ); | |||
} | |||
return satisfies; | |||
} | |||
} | |||
class SelectedCleanupConsumersPredicate | |||
implements Predicate | |||
{ | |||
public boolean evaluate( Object object ) | |||
{ | |||
boolean satisfies = false; | |||
if ( object instanceof DatabaseCleanupConsumer ) | |||
{ | |||
DatabaseCleanupConsumer consumer = (DatabaseCleanupConsumer) object; | |||
DatabaseScanningConfiguration config = archivaConfiguration.getConfiguration().getDatabaseScanning(); | |||
return config.getUnprocessedConsumers().contains( consumer.getId() ); | |||
} | |||
return satisfies; | |||
} | |||
} | |||
public void initialize() | |||
throws InitializationException | |||
{ | |||
selectedCleanupConsumers = new SelectedCleanupConsumersPredicate(); | |||
selectedUnprocessedConsumers = new SelectedUnprocessedConsumersPredicate(); | |||
} | |||
/** | |||
* Get the {@link List} of {@link DatabaseUnprocessedArtifactConsumer} objects | |||
* for those consumers selected due to the configuration. | |||
* | |||
* @return the list of selected {@link DatabaseUnprocessedArtifactConsumer} objects. | |||
*/ | |||
public List getSelectedUnprocessedConsumers() | |||
{ | |||
List ret = new ArrayList(); | |||
ret.addAll( CollectionUtils.select( availableUnprocessedConsumers, selectedUnprocessedConsumers ) ); | |||
return ret; | |||
} | |||
/** | |||
* Get the {@link List} of {@link DatabaseCleanupConsumer} objects for those | |||
* consumers selected due to the configuration. | |||
* | |||
* @return the list of selected {@link DatabaseCleanupConsumer} objects. | |||
*/ | |||
public List getSelectedCleanupConsumers() | |||
{ | |||
List ret = new ArrayList(); | |||
ret.addAll( CollectionUtils.select( availableCleanupConsumers, selectedCleanupConsumers ) ); | |||
return ret; | |||
} | |||
/** | |||
* Get the complete {@link List} of {@link DatabaseUnprocessedArtifactConsumer} objects | |||
* that are available in the system, regardless of configuration. | |||
* | |||
* @return the list of all available {@link DatabaseUnprocessedArtifactConsumer} objects. | |||
*/ | |||
public List getAvailableUnprocessedConsumers() | |||
{ | |||
return Collections.unmodifiableList( this.availableUnprocessedConsumers ); | |||
} | |||
/** | |||
* Get the complete {@link List} of {@link DatabaseCleanupConsumer} objects | |||
* that are available in the system, regardless of configuration. | |||
* | |||
* @return the list of all available {@link DatabaseCleanupConsumer} objects. | |||
*/ | |||
public List getAvailableCleanupConsumers() | |||
{ | |||
return Collections.unmodifiableList( this.availableCleanupConsumers ); | |||
} | |||
} |
@@ -217,7 +217,7 @@ public class JdoDatabaseUpdater | |||
} | |||
this.activeUnprocessedConsumers.addAll( getActiveConsumerList( dbScanning.getUnprocessedConsumers() ) ); | |||
this.activeProcessedConsumers.addAll( getActiveConsumerList( dbScanning.getProcessedConsumers() ) ); | |||
this.activeProcessedConsumers.addAll( getActiveConsumerList( dbScanning.getCleanupConsumers() ) ); | |||
} | |||
private List getActiveConsumerList( List potentialConsumerList ) |
@@ -58,6 +58,18 @@ | |||
<groupId>org.apache.maven.archiva</groupId> | |||
<artifactId>archiva-security</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.archiva</groupId> | |||
<artifactId>archiva-database-consumers</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.archiva</groupId> | |||
<artifactId>archiva-lucene-consumers</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.archiva</groupId> | |||
<artifactId>archiva-signature-consumers</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.archiva</groupId> | |||
<artifactId>archiva-applet</artifactId> |
@@ -0,0 +1,67 @@ | |||
package org.apache.maven.archiva.web.action.admin.database; | |||
/* | |||
* 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.collections.Closure; | |||
import org.apache.maven.archiva.consumers.ArchivaArtifactConsumer; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* AddAdminDatabaseConsumerClosure | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public class AddAdminDatabaseConsumerClosure | |||
implements Closure | |||
{ | |||
private List list = new ArrayList(); | |||
private List selectedIds; | |||
public AddAdminDatabaseConsumerClosure( List selectedIds ) | |||
{ | |||
this.selectedIds = selectedIds; | |||
} | |||
public void execute( Object input ) | |||
{ | |||
if ( input instanceof ArchivaArtifactConsumer ) | |||
{ | |||
ArchivaArtifactConsumer consumer = (ArchivaArtifactConsumer) input; | |||
boolean enabled = this.selectedIds.contains( consumer.getId() ); | |||
AdminDatabaseConsumer adminconsumer = new AdminDatabaseConsumer(); | |||
adminconsumer.setEnabled( enabled ); | |||
adminconsumer.setId( consumer.getId() ); | |||
adminconsumer.setDescription( consumer.getDescription() ); | |||
list.add( adminconsumer ); | |||
} | |||
} | |||
public List getList() | |||
{ | |||
return list; | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
package org.apache.maven.archiva.web.action.admin.database; | |||
/* | |||
* 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. | |||
*/ | |||
/** | |||
* AdminDatabaseConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public class AdminDatabaseConsumer | |||
{ | |||
private boolean enabled = false; | |||
private String id; | |||
private String description; | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isEnabled() | |||
{ | |||
return enabled; | |||
} | |||
public void setDescription( String description ) | |||
{ | |||
this.description = description; | |||
} | |||
public void setEnabled( boolean enabled ) | |||
{ | |||
this.enabled = enabled; | |||
} | |||
public void setId( String id ) | |||
{ | |||
this.id = id; | |||
} | |||
} |
@@ -0,0 +1,67 @@ | |||
package org.apache.maven.archiva.web.action.admin.database; | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you under the Apache License, Version 2.0 (the | |||
* "License"); you may not use this file except in compliance | |||
* with the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, | |||
* software distributed under the License is distributed on an | |||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |||
* KIND, either express or implied. See the License for the | |||
* specific language governing permissions and limitations | |||
* under the License. | |||
*/ | |||
import java.util.Comparator; | |||
/** | |||
* AdminDatabaseConsumerComparator | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public class AdminDatabaseConsumerComparator | |||
implements Comparator | |||
{ | |||
private static AdminDatabaseConsumerComparator INSTANCE = new AdminDatabaseConsumerComparator(); | |||
public static AdminDatabaseConsumerComparator getInstance() | |||
{ | |||
return INSTANCE; | |||
} | |||
public int compare( Object o1, Object o2 ) | |||
{ | |||
if ( o1 == null && o2 == null ) | |||
{ | |||
return 0; | |||
} | |||
if ( o1 == null && o2 != null ) | |||
{ | |||
return 1; | |||
} | |||
if ( o1 != null && o2 == null ) | |||
{ | |||
return -1; | |||
} | |||
if ( ( o1 instanceof AdminDatabaseConsumer ) && ( o2 instanceof AdminDatabaseConsumer ) ) | |||
{ | |||
String id1 = ( (AdminDatabaseConsumer) o1 ).getId(); | |||
String id2 = ( (AdminDatabaseConsumer) o2 ).getId(); | |||
return id1.compareToIgnoreCase( id2 ); | |||
} | |||
return 0; | |||
} | |||
} |
@@ -19,17 +19,23 @@ package org.apache.maven.archiva.web.action.admin.database; | |||
* under the License. | |||
*/ | |||
import com.opensymphony.webwork.interceptor.ServletRequestAware; | |||
import com.opensymphony.xwork.ModelDriven; | |||
import com.opensymphony.xwork.Preparable; | |||
import com.opensymphony.xwork.Validateable; | |||
import org.apache.commons.collections.CollectionUtils; | |||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | |||
import org.apache.maven.archiva.configuration.Configuration; | |||
import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; | |||
import org.apache.maven.archiva.database.updater.DatabaseConsumers; | |||
import org.apache.maven.archiva.security.ArchivaRoleConstants; | |||
import org.apache.maven.archiva.web.action.admin.scanning.AdminRepositoryConsumerComparator; | |||
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 javax.servlet.http.HttpServletRequest; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
* DatabaseAction | |||
@@ -40,34 +46,101 @@ import javax.servlet.http.HttpServletRequest; | |||
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="databaseAction" | |||
*/ | |||
public class DatabaseAction | |||
extends PlexusActionSupport | |||
implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware | |||
extends PlexusActionSupport | |||
implements Preparable, SecureAction | |||
{ | |||
/** | |||
* @plexus.requirement | |||
*/ | |||
private ArchivaConfiguration archivaConfiguration; | |||
public Object getModel() | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
/** | |||
* @plexus.requirement | |||
*/ | |||
private DatabaseConsumers databaseConsumers; | |||
private String cron; | |||
/** | |||
* List of {@link AdminDatabaseConsumer} objects for unprocessed artifacts. | |||
*/ | |||
private List unprocessedConsumers; | |||
/** | |||
* List of {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts. | |||
*/ | |||
private List cleanupConsumers; | |||
public void prepare() | |||
throws Exception | |||
{ | |||
// TODO Auto-generated method stub | |||
Configuration config = archivaConfiguration.getConfiguration(); | |||
DatabaseScanningConfiguration dbscanning = config.getDatabaseScanning(); | |||
this.cron = dbscanning.getCronExpression(); | |||
AddAdminDatabaseConsumerClosure addAdminDbConsumer; | |||
getLogger().info( "Total Available Unprocessed Consumers: " + databaseConsumers.getAvailableUnprocessedConsumers().size() ); | |||
getLogger().info( "Total Available Cleanup Consumers: " + databaseConsumers.getAvailableCleanupConsumers().size() ); | |||
addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getUnprocessedConsumers() ); | |||
CollectionUtils.forAllDo( databaseConsumers.getAvailableUnprocessedConsumers(), addAdminDbConsumer ); | |||
this.unprocessedConsumers = addAdminDbConsumer.getList(); | |||
Collections.sort( this.unprocessedConsumers, AdminRepositoryConsumerComparator.getInstance() ); | |||
addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getCleanupConsumers() ); | |||
CollectionUtils.forAllDo( databaseConsumers.getAvailableCleanupConsumers(), addAdminDbConsumer ); | |||
this.cleanupConsumers = addAdminDbConsumer.getList(); | |||
Collections.sort( this.cleanupConsumers, AdminRepositoryConsumerComparator.getInstance() ); | |||
} | |||
public String updateUnprocessedConsumers() | |||
{ | |||
getLogger().info( "updateUnprocesedConsumers()" ); | |||
return INPUT; | |||
} | |||
public String updateCleanupConsumers() | |||
{ | |||
getLogger().info( "updateCleanupConsumers()" ); | |||
return INPUT; | |||
} | |||
public String updateSchedule() | |||
{ | |||
getLogger().info( "updateSchedule()" ); | |||
return INPUT; | |||
} | |||
public SecureActionBundle getSecureActionBundle() | |||
throws SecureActionException | |||
{ | |||
// TODO Auto-generated method stub | |||
return null; | |||
SecureActionBundle bundle = new SecureActionBundle(); | |||
bundle.setRequiresAuthentication( true ); | |||
bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); | |||
return bundle; | |||
} | |||
public void setServletRequest( HttpServletRequest request ) | |||
public String getCron() | |||
{ | |||
// TODO Auto-generated method stub | |||
return cron; | |||
} | |||
public void setCron( String cron ) | |||
{ | |||
this.cron = cron; | |||
} | |||
public List getCleanupConsumers() | |||
{ | |||
return cleanupConsumers; | |||
} | |||
public List getUnprocessedConsumers() | |||
{ | |||
return unprocessedConsumers; | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
package org.apache.maven.archiva.web.action.admin.scanning; | |||
/* | |||
* 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.collections.Closure; | |||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* AddAdminRepoConsumerClosure | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public class AddAdminRepoConsumerClosure | |||
implements Closure | |||
{ | |||
private List list = new ArrayList(); | |||
private List selectedIds; | |||
public AddAdminRepoConsumerClosure( List selectedIds ) | |||
{ | |||
this.selectedIds = selectedIds; | |||
} | |||
public void execute( Object input ) | |||
{ | |||
if ( input instanceof RepositoryContentConsumer ) | |||
{ | |||
RepositoryContentConsumer consumer = (RepositoryContentConsumer) input; | |||
boolean enabled = this.selectedIds.contains( consumer.getId() ); | |||
AdminRepositoryConsumer adminconsumer = new AdminRepositoryConsumer(); | |||
adminconsumer.setEnabled( enabled ); | |||
adminconsumer.setId( consumer.getId() ); | |||
adminconsumer.setDescription( consumer.getDescription() ); | |||
list.add( adminconsumer ); | |||
} | |||
} | |||
public List getList() | |||
{ | |||
return list; | |||
} | |||
} |
@@ -0,0 +1,63 @@ | |||
package org.apache.maven.archiva.web.action.admin.scanning; | |||
/* | |||
* 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. | |||
*/ | |||
/** | |||
* AdminRepositoryConsumer | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public class AdminRepositoryConsumer | |||
{ | |||
private boolean enabled = false; | |||
private String id; | |||
private String description; | |||
public String getDescription() | |||
{ | |||
return description; | |||
} | |||
public String getId() | |||
{ | |||
return id; | |||
} | |||
public boolean isEnabled() | |||
{ | |||
return enabled; | |||
} | |||
public void setDescription( String description ) | |||
{ | |||
this.description = description; | |||
} | |||
public void setEnabled( boolean enabled ) | |||
{ | |||
this.enabled = enabled; | |||
} | |||
public void setId( String id ) | |||
{ | |||
this.id = id; | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
package org.apache.maven.archiva.web.action.admin.scanning; | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you under the Apache License, Version 2.0 (the | |||
* "License"); you may not use this file except in compliance | |||
* with the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, | |||
* software distributed under the License is distributed on an | |||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |||
* KIND, either express or implied. See the License for the | |||
* specific language governing permissions and limitations | |||
* under the License. | |||
*/ | |||
import java.util.Comparator; | |||
/** | |||
* AdminRepositoryConsumerComparator | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
*/ | |||
public class AdminRepositoryConsumerComparator | |||
implements Comparator | |||
{ | |||
private static AdminRepositoryConsumerComparator INSTANCE = new AdminRepositoryConsumerComparator(); | |||
public static AdminRepositoryConsumerComparator getInstance() | |||
{ | |||
return INSTANCE; | |||
} | |||
public int compare( Object o1, Object o2 ) | |||
{ | |||
if ( o1 == null && o2 == null ) | |||
{ | |||
return 0; | |||
} | |||
if ( o1 == null && o2 != null ) | |||
{ | |||
return 1; | |||
} | |||
if ( o1 != null && o2 == null ) | |||
{ | |||
return -1; | |||
} | |||
if ( ( o1 instanceof AdminRepositoryConsumer ) && ( o2 instanceof AdminRepositoryConsumer ) ) | |||
{ | |||
String id1 = ( (AdminRepositoryConsumer) o1 ).getId(); | |||
String id2 = ( (AdminRepositoryConsumer) o2 ).getId(); | |||
return id1.compareToIgnoreCase( id2 ); | |||
} | |||
return 0; | |||
} | |||
} |
@@ -1,62 +0,0 @@ | |||
package org.apache.maven.archiva.web.action.admin.scanning; | |||
/* | |||
* 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.Preparable; | |||
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.xwork.action.PlexusActionSupport; | |||
/** | |||
* ConfigureRepositoryScanningAction | |||
* | |||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> | |||
* @version $Id$ | |||
* | |||
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryScanningAction" | |||
*/ | |||
public class ConfigureRepositoryScanningAction | |||
extends PlexusActionSupport | |||
implements SecureAction, Preparable | |||
{ | |||
public SecureActionBundle getSecureActionBundle() | |||
throws SecureActionException | |||
{ | |||
SecureActionBundle bundle = new SecureActionBundle(); | |||
bundle.setRequiresAuthentication( true ); | |||
bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); | |||
return bundle; | |||
} | |||
public void prepare() | |||
throws Exception | |||
{ | |||
// TODO Auto-generated method stub | |||
} | |||
} |
@@ -23,10 +23,16 @@ import com.opensymphony.xwork.Preparable; | |||
import com.opensymphony.xwork.Validateable; | |||
import org.apache.commons.collections.CollectionUtils; | |||
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.FileType; | |||
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; | |||
import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate; | |||
import org.apache.maven.archiva.configuration.functors.FiletypeToMapClosure; | |||
import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers; | |||
import org.apache.maven.archiva.security.ArchivaRoleConstants; | |||
import org.codehaus.plexus.registry.RegistryException; | |||
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; | |||
@@ -55,58 +61,100 @@ public class RepositoryScanningAction | |||
*/ | |||
private ArchivaConfiguration archivaConfiguration; | |||
/** | |||
* @plexus.requirement | |||
*/ | |||
private RepositoryContentConsumers repoconsumerUtil; | |||
private Map fileTypeMap; | |||
private List fileTypeIds; | |||
private List goodConsumers = new ArrayList(); | |||
/** | |||
* List of {@link AdminRepositoryConsumer} objects for consumers of known content. | |||
*/ | |||
private List knownContentConsumers = new ArrayList(); | |||
/** | |||
* List of {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content. | |||
*/ | |||
private List invalidContentConsumers = new ArrayList(); | |||
private List badConsumers = new ArrayList(); | |||
private String pattern; | |||
private String fileTypeId; | |||
public void prepare() | |||
throws Exception | |||
public void addActionError( String anErrorMessage ) | |||
{ | |||
Configuration config = archivaConfiguration.getConfiguration(); | |||
FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure(); | |||
CollectionUtils.forAllDo( config.getRepositoryScanning().getFileTypes(), filetypeToMapClosure ); | |||
fileTypeMap = filetypeToMapClosure.getMap(); | |||
goodConsumers.clear(); | |||
goodConsumers.addAll( config.getRepositoryScanning().getGoodConsumers() ); | |||
badConsumers.clear(); | |||
badConsumers.addAll( config.getRepositoryScanning().getBadConsumers() ); | |||
fileTypeIds = new ArrayList(); | |||
fileTypeIds.addAll( fileTypeMap.keySet() ); | |||
Collections.sort( fileTypeIds ); | |||
super.addActionError( anErrorMessage ); | |||
getLogger().warn( "[ActionError] " + anErrorMessage ); | |||
} | |||
public String removeFiletypePattern() | |||
public void addActionMessage( String aMessage ) | |||
{ | |||
getLogger().info( "Remove File Type Pattern [" + getFileTypeId() + ":" + getPattern() + "]" ); | |||
// TODO: remove the filetype | |||
// TODO: save configuration | |||
return INPUT; | |||
super.addActionMessage( aMessage ); | |||
getLogger().info( "[ActionMessage] " + aMessage ); | |||
} | |||
public String addFiletypePattern() | |||
{ | |||
getLogger().info( "Add New File Type Pattern [" + getFileTypeId() + ":" + getPattern() + "]" ); | |||
// TODO: add the filetype. | |||
// TODO: report error if filetype pattern already exists. | |||
// TODO: report success (message) if added successfully. | |||
// TODO: save configuration each time. | |||
return INPUT; | |||
if ( !isValidFiletypeCommand() ) | |||
{ | |||
return INPUT; | |||
} | |||
String id = getFileTypeId(); | |||
String pattern = getPattern(); | |||
FileType filetype = findFileType( id ); | |||
if ( filetype == null ) | |||
{ | |||
addActionError( "Pattern not added, unable to find filetype " + id ); | |||
return INPUT; | |||
} | |||
if ( filetype.getPatterns().contains( pattern ) ) | |||
{ | |||
addActionError( "Not adding pattern \"" + pattern + "\" to filetype " + id + " as it already exists." ); | |||
return INPUT; | |||
} | |||
filetype.addPattern( pattern ); | |||
addActionMessage( "Added pattern \"" + pattern + "\" to filetype " + id ); | |||
return saveConfiguration(); | |||
} | |||
public String getFileTypeId() | |||
{ | |||
return fileTypeId; | |||
} | |||
public List getFileTypeIds() | |||
{ | |||
return fileTypeIds; | |||
} | |||
public Map getFileTypeMap() | |||
{ | |||
return fileTypeMap; | |||
} | |||
public List getInvalidContentConsumers() | |||
{ | |||
return invalidContentConsumers; | |||
} | |||
public List getKnownContentConsumers() | |||
{ | |||
return knownContentConsumers; | |||
} | |||
public String getPattern() | |||
{ | |||
return pattern; | |||
} | |||
public SecureActionBundle getSecureActionBundle() | |||
@@ -120,43 +168,112 @@ public class RepositoryScanningAction | |||
return bundle; | |||
} | |||
public List getBadConsumers() | |||
public void prepare() | |||
throws Exception | |||
{ | |||
return badConsumers; | |||
Configuration config = archivaConfiguration.getConfiguration(); | |||
RepositoryScanningConfiguration reposcanning = config.getRepositoryScanning(); | |||
FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure(); | |||
CollectionUtils.forAllDo( reposcanning.getFileTypes(), filetypeToMapClosure ); | |||
fileTypeMap = filetypeToMapClosure.getMap(); | |||
AddAdminRepoConsumerClosure addAdminRepoConsumer; | |||
addAdminRepoConsumer = new AddAdminRepoConsumerClosure( reposcanning.getKnownContentConsumers() ); | |||
CollectionUtils.forAllDo( repoconsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer ); | |||
knownContentConsumers.clear(); | |||
knownContentConsumers.addAll( addAdminRepoConsumer.getList() ); | |||
Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); | |||
addAdminRepoConsumer = new AddAdminRepoConsumerClosure( reposcanning.getInvalidContentConsumers() ); | |||
CollectionUtils.forAllDo( repoconsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer ); | |||
invalidContentConsumers.clear(); | |||
invalidContentConsumers.addAll( addAdminRepoConsumer.getList() ); | |||
Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); | |||
fileTypeIds = new ArrayList(); | |||
fileTypeIds.addAll( fileTypeMap.keySet() ); | |||
Collections.sort( fileTypeIds ); | |||
} | |||
public Map getFileTypeMap() | |||
public String removeFiletypePattern() | |||
{ | |||
return fileTypeMap; | |||
getLogger().info( "Remove File Type Pattern [" + getFileTypeId() + ":" + getPattern() + "]" ); | |||
if ( !isValidFiletypeCommand() ) | |||
{ | |||
return INPUT; | |||
} | |||
FileType filetype = findFileType( getFileTypeId() ); | |||
if ( filetype == null ) | |||
{ | |||
addActionError( "Pattern not removed, unable to find filetype " + getFileTypeId() ); | |||
return INPUT; | |||
} | |||
filetype.removePattern( getPattern() ); | |||
return saveConfiguration(); | |||
} | |||
public List getGoodConsumers() | |||
public void setFileTypeId( String fileTypeId ) | |||
{ | |||
return goodConsumers; | |||
this.fileTypeId = fileTypeId; | |||
} | |||
public String getFileTypeId() | |||
public void setPattern( String pattern ) | |||
{ | |||
return fileTypeId; | |||
this.pattern = pattern; | |||
} | |||
public void setFileTypeId( String fileTypeId ) | |||
public String updateInvalidConsumers() | |||
{ | |||
this.fileTypeId = fileTypeId; | |||
addActionMessage("Update Invalid Consumers"); | |||
return INPUT; | |||
} | |||
public String getPattern() | |||
public String updateKnownConsumers() | |||
{ | |||
return pattern; | |||
addActionMessage("Update Known Consumers"); | |||
return INPUT; | |||
} | |||
public void setPattern( String pattern ) | |||
private FileType findFileType( String id ) | |||
{ | |||
this.pattern = pattern; | |||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); | |||
return (FileType) CollectionUtils.find( scanning.getFileTypes(), new FiletypeSelectionPredicate( id ) ); | |||
} | |||
public List getFileTypeIds() | |||
private boolean isValidFiletypeCommand() | |||
{ | |||
return fileTypeIds; | |||
if ( StringUtils.isBlank( getFileTypeId() ) ) | |||
{ | |||
addActionError( "Unable to process blank filetype id." ); | |||
} | |||
if ( StringUtils.isBlank( getPattern() ) ) | |||
{ | |||
addActionError( "Unable to process blank pattern." ); | |||
} | |||
return !hasActionErrors(); | |||
} | |||
private String saveConfiguration() | |||
{ | |||
try | |||
{ | |||
archivaConfiguration.save( archivaConfiguration.getConfiguration() ); | |||
addActionMessage( "Successfully saved configuration" ); | |||
} | |||
catch ( RegistryException e ) | |||
{ | |||
addActionError( "Unable to save configuration: " + e.getMessage() ); | |||
} | |||
return INPUT; | |||
} | |||
} |
@@ -336,30 +336,6 @@ | |||
<result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result> | |||
</action> | |||
<action name="addRepositoryScanning" class="configureScanningAction" method="add"> | |||
<result name="input">/WEB-INF/jsp/admin/addRepositoryScanning.jsp</result> | |||
<result name="success" type="redirect-action">repositoryScanning</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="editRepositoryScanning" class="configureScanningAction" method="edit"> | |||
<result name="input">/WEB-INF/jsp/admin/editRepositoryScanning.jsp</result> | |||
<result name="success" type="redirect-action">repositoryScanning</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="saveRepositoryScanning" class="configureScanningAction" method="save"> | |||
<result name="input">/WEB-INF/jsp/admin/editRepositoryScanning.jsp</result> | |||
<result name="success" type="redirect-action">repositoryScanning</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="deleteRepositoryScanning" class="configureScanningAction" method="confirm"> | |||
<result name="input">/WEB-INF/jsp/admin/deleteRepositoryScanning.jsp</result> | |||
<result name="success" type="redirect-action">repositoryScanning</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<!-- .\ DATABASE \.________________________________________________ --> | |||
<action name="database" class="databaseAction" method="input"> | |||
@@ -368,7 +344,6 @@ | |||
<!-- .\ CONFIGURATION \.___________________________________________ --> | |||
<action name="configure" class="configureAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/configure.jsp</result> | |||
<interceptor-ref name="unconfiguredArchivaStack"/> |
@@ -0,0 +1,173 @@ | |||
<%-- | |||
~ 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="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | |||
<%@ taglib prefix="pss" uri="/plexusSecuritySystem"%> | |||
<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva"%> | |||
<html> | |||
<head> | |||
<title>Administration - Database</title> | |||
<ww:head /> | |||
</head> | |||
<body> | |||
<h1>Administration - Database</h1> | |||
<div id="contentArea"> | |||
<ww:actionerror /> | |||
<ww:actionmessage /> | |||
<c:url var="iconDeleteUrl" value="/images/icons/delete.gif" /> | |||
<c:url var="iconCreateUrl" value="/images/icons/create.png" /> | |||
<div class="admin"> | |||
<h2>Database - Unprocessed Artifacts Scanning</h2> | |||
<ww:form method="post" action="database!updateSchedule" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<table> | |||
<ww:textfield name="cron" label="Cron" size="40" theme="xhtml" /> | |||
<tr> | |||
<td colspan="2"> | |||
<ww:submit value="Update Cron" /> | |||
</td> | |||
</tr> | |||
</table> | |||
</ww:form> | |||
<h2>Database - Unprocessed Artifacts Scanning</h2> | |||
<c:choose> | |||
<c:when test="${empty(unprocessedConsumers)}"> | |||
<%-- No Consumers. Eeek! --%> | |||
<strong>There are no consumers for unprocessed artifacts.</strong> | |||
</c:when> | |||
<c:otherwise> | |||
<%-- Display the consumers. --%> | |||
<ww:form method="post" action="database!updateUnprocessedConsumers" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<table class="consumers"> | |||
<tr> | |||
<th> </th> | |||
<th>Enabled?</th> | |||
<th>ID</th> | |||
<th>Description</th> | |||
</tr> | |||
<c:forEach items="${unprocessedConsumers}" var="consumer" varStatus="i"> | |||
<c:choose> | |||
<c:when test='${(i.index)%2 eq 0}'> | |||
<c:set var="bgcolor" value="even" scope="page" /> | |||
</c:when> | |||
<c:otherwise> | |||
<c:set var="bgcolor" value="odd" scope="page" /> | |||
</c:otherwise> | |||
</c:choose> | |||
<tr> | |||
<td class="${bgcolor}"> | |||
<ww:checkbox name="enabledUnprocessedConsumer[]" theme="simple" value="${consumer.enabled}" /> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<c:if test="${consumer.enabled}"> | |||
<strong>enabled</strong> | |||
</c:if> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<code>${consumer.id}</code> | |||
</td> | |||
<td class="${bgcolor}">${consumer.description}</td> | |||
</tr> | |||
</c:forEach> | |||
<tr> | |||
<td colspan="4"> | |||
<ww:submit value="Update Consumers" /> | |||
</td> | |||
</tr> | |||
</table> | |||
</ww:form> | |||
</c:otherwise> | |||
</c:choose> | |||
<h2>Database - Artifact Cleanup Scanning</h2> | |||
<c:choose> | |||
<c:when test="${empty(cleanupConsumers)}"> | |||
<%-- No Consumers. Eeek! --%> | |||
<strong>There are no consumers for artifact cleanup.</strong> | |||
</c:when> | |||
<c:otherwise> | |||
<%-- Display the consumers. --%> | |||
<ww:form method="post" action="database!updateCleanupConsumers" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<table class="consumers"> | |||
<tr> | |||
<th> </th> | |||
<th>Enabled?</th> | |||
<th>ID</th> | |||
<th>Description</th> | |||
</tr> | |||
<c:forEach items="${cleanupConsumers}" var="consumer" varStatus="i"> | |||
<c:choose> | |||
<c:when test='${(i.index)%2 eq 0}'> | |||
<c:set var="bgcolor" value="even" scope="page" /> | |||
</c:when> | |||
<c:otherwise> | |||
<c:set var="bgcolor" value="odd" scope="page" /> | |||
</c:otherwise> | |||
</c:choose> | |||
<tr> | |||
<td class="${bgcolor}"> | |||
<ww:checkbox name="enabledCleanupConsumer[]" theme="simple" value="${consumer.enabled}" /> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<c:if test="${consumer.enabled}"> | |||
<strong>enabled</strong> | |||
</c:if> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<code>${consumer.id}</code> | |||
</td> | |||
<td class="${bgcolor}">${consumer.description}</td> | |||
</tr> | |||
</c:forEach> | |||
<tr> | |||
<td colspan="4"> | |||
<ww:submit value="Update Consumers" /> | |||
</td> | |||
</tr> | |||
</table> | |||
</ww:form> | |||
</c:otherwise> | |||
</c:choose> | |||
</div> | |||
</body> | |||
</html> |
@@ -144,65 +144,113 @@ | |||
</c:otherwise> | |||
</c:choose> | |||
<h2>Repository Scanning - Consumers of Good Content</h2> | |||
<h2>Repository Scanning - Consumers of Known Content</h2> | |||
<c:choose> | |||
<c:when test="${empty(goodConsumers)}"> | |||
<c:when test="${empty(knownContentConsumers)}"> | |||
<%-- No Good Consumers. Eeek! --%> | |||
<strong>There are no good consumers configured.</strong> | |||
<strong>There are no consumers of known content available.</strong> | |||
</c:when> | |||
<c:otherwise> | |||
<%-- Display the consumers. --%> | |||
<table> | |||
<c:forEach items="${goodConsumers}" var="consumer" varStatus="i"> | |||
<ww:form method="post" action="repositoryScanning!updateKnownConsumers" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<table class="consumers"> | |||
<tr> | |||
<th> </th> | |||
<th>Enabled?</th> | |||
<th>ID</th> | |||
<th>Description</th> | |||
</tr> | |||
<c:forEach items="${knownContentConsumers}" var="consumer" varStatus="i"> | |||
<c:choose> | |||
<c:when test='${(i.index)%2 eq 0}'> | |||
<c:set var="rowColor" value="dark" scope="page" /> | |||
<c:set var="bgcolor" value="even" scope="page" /> | |||
</c:when> | |||
<c:otherwise> | |||
<c:set var="rowColor" value="lite" scope="page" /> | |||
<c:set var="bgcolor" value="odd" scope="page" /> | |||
</c:otherwise> | |||
</c:choose> | |||
<tr> | |||
<td><code>${consumer}</code></td> | |||
<td><img src="<c:url value="/images/icons/delete.gif" />" /></td> | |||
<td class="${bgcolor}"> | |||
<ww:checkbox name="enabledKnownConsumer[]" theme="simple" value="${consumer.enabled}" /> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<c:if test="${consumer.enabled}"> | |||
<strong>enabled</strong> | |||
</c:if> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<code>${consumer.id}</code> | |||
</td> | |||
<td class="${bgcolor}">${consumer.description}</td> | |||
</tr> | |||
</c:forEach> | |||
<tr> | |||
<td colspan="4"> | |||
<ww:submit value="Update Consumers" /> | |||
</td> | |||
</tr> | |||
</table> | |||
</ww:form> | |||
</c:otherwise> | |||
</c:choose> | |||
<h2>Repository Scanning - Consumers of Bad Content</h2> | |||
<h2>Repository Scanning - Consumers of Invalid Content</h2> | |||
<c:choose> | |||
<c:when test="${empty(badConsumers)}"> | |||
<%-- No Bad Consumers. Eeek! --%> | |||
<strong>There are no bad consumers configured.</strong> | |||
<c:when test="${empty(invalidContentConsumers)}"> | |||
<%-- No Consumers. Eeek! --%> | |||
<strong>There are no consumers of invalid content available.</strong> | |||
</c:when> | |||
<c:otherwise> | |||
<%-- Display the consumers. --%> | |||
<table> | |||
<c:forEach items="${badConsumers}" var="consumer" varStatus="i"> | |||
<ww:form method="post" action="repositoryScanning!updateInvalidConsumers" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<table class="consumers"> | |||
<tr> | |||
<th> </th> | |||
<th>Enabled?</th> | |||
<th>ID</th> | |||
<th>Description</th> | |||
</tr> | |||
<c:forEach items="${invalidContentConsumers}" var="consumer" varStatus="i"> | |||
<c:choose> | |||
<c:when test='${(i.index)%2 eq 0}'> | |||
<c:set var="rowColor" value="dark" scope="page" /> | |||
<c:set var="bgcolor" value="even" scope="page" /> | |||
</c:when> | |||
<c:otherwise> | |||
<c:set var="rowColor" value="lite" scope="page" /> | |||
<c:set var="bgcolor" value="odd" scope="page" /> | |||
</c:otherwise> | |||
</c:choose> | |||
<tr> | |||
<td><code>${consumer}</code></td> | |||
<td><img src="<c:url value="/images/icons/delete.gif" />" /></td> | |||
<td class="${bgcolor}"> | |||
<ww:checkbox name="enabledUnknownConsumer[]" theme="simple" value="${consumer.enabled}" /> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<c:if test="${consumer.enabled}"> | |||
<strong>enabled</strong> | |||
</c:if> | |||
</td> | |||
<td class="${bgcolor}"> | |||
<code>${consumer.id}</code> | |||
</td> | |||
<td class="${bgcolor}">${consumer.description}</td> | |||
</tr> | |||
</c:forEach> | |||
<tr> | |||
<td colspan="4"> | |||
<ww:submit value="Update Consumers" /> | |||
</td> | |||
</tr> | |||
</table> | |||
</ww:form> | |||
</c:otherwise> | |||
</c:choose></div> |
@@ -63,12 +63,10 @@ div.clear hr { | |||
.xleft, #bannerLeft img { | |||
float: left; | |||
text-shadow: #7CFC00; | |||
} | |||
.xright, #bannerRight img { | |||
float: right; | |||
text-shadow: #7CFC00; | |||
} | |||
#banner { |
@@ -43,7 +43,6 @@ | |||
float: right; | |||
font-size: small; | |||
font-weight: bold; | |||
xmargin: 0px auto; | |||
margin: 15px auto 0px auto; | |||
height: auto; | |||
width: 150px; | |||
@@ -148,7 +147,9 @@ | |||
} | |||
.actionMessage { | |||
font-size: 1.0em; | |||
font-weight: bold; | |||
color: blue; | |||
} | |||
.errorBullet { | |||
@@ -318,11 +319,27 @@ div.filetype table td.controls { | |||
width: 5%; | |||
} | |||
div.filetype table td.odd { | |||
div.filetype table td.odd, | |||
div.admin table.consumers td.odd { | |||
background-color: #dddddd; | |||
} | |||
div.filetype table td.event { | |||
div.filetype table td.even, | |||
div.admin table.consumers td.even { | |||
background-color: white; | |||
} | |||
div.admin table.consumers { | |||
margin-left: 15px; | |||
border: 1px solid gray; | |||
} | |||
div.admin table.consumers th { | |||
font-size: 1.0em; | |||
background-color: #cccccc; | |||
text-align: left; | |||
} | |||
div.admin table.consumers td strong { | |||
font-size: 0.8em; | |||
} |
@@ -323,6 +323,11 @@ | |||
<artifactId>archiva-lucene-consumers</artifactId> | |||
<version>${archiva.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.archiva</groupId> | |||
<artifactId>archiva-signature-consumers</artifactId> | |||
<version>${archiva.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.archiva</groupId> | |||
<artifactId>archiva-model</artifactId> |