<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
<test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
+ <!-- restore when we will be able to use a derby in memory database -->
+ <!--redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url-->
<redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
<archiva.user.configFileName>${project.build.directory}/archiva.xml</archiva.user.configFileName>
</systemPropertyVariables>
</configuration>
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
</plugin>
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.math.NumberUtils;
import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
+import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
implements IndexMerger
{
+ /**
+ * default tmp created group index ttl in minutes
+ */
+ static final int DEFAULT_GROUP_INDEX_TTL = 30;
+
private Logger log = LoggerFactory.getLogger( getClass() );
@Inject
private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>();
+ private int defaultGroupIndexTtl;
+
@Inject
public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils )
throws PlexusSisuBridgeException
indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
}
+ @PostConstruct
+ public void intialize()
+ {
+ String ttlStr =
+ System.getProperty( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, Integer.toString( DEFAULT_GROUP_INDEX_TTL ) );
+ this.defaultGroupIndexTtl = NumberUtils.toInt( ttlStr, DEFAULT_GROUP_INDEX_TTL );
+
+ }
+
public IndexingContext buildMergedIndex( Collection<String> repositoriesIds, boolean packIndex )
throws IndexMergerException
{
{
return this.temporaryGroupIndexes;
}
+
+ public int getDefaultGroupIndexTtl()
+ {
+ return this.defaultGroupIndexTtl;
+ }
}
*/
public interface IndexMerger
{
+
/**
- * default tmp created group index ttl in minutes
+ * system property which contains the value in s for ttl of temporary index groups
*/
- static final int DEFAULT_GROUP_INDEX_TTL = 30;
-
+ static final String TMP_GROUP_INDEX_SYS_KEY = "archiva.tmp.group.index.ttl";
+
/**
* @param repositoriesIds repositories Ids to merge content
* @param packIndex will generate a downloadable index
Collection<TemporaryGroupIndex> getTemporaryGroupIndexes();
+ /**
+ * @return ttl of temporay group index
+ */
+ int getDefaultGroupIndexTtl();
}
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
</plugin>
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
</plugin>
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
<basedir>${basedir}</basedir>
</systemPropertyVariables>
</configuration>
<archiva.baseRestUrl>${archiva.baseRestUrl}</archiva.baseRestUrl>
<rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd>
<test.useTomcat>${test.useTomcat}</test.useTomcat>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
</plugin>
<configuration>
<systemPropertyVariables>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
</plugin>
<rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd>
<archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
<test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
<basedir>${basedir}</basedir>
</systemPropertyVariables>
</configuration>
<appserver.home>${project.build.directory}/appserver-home</appserver.home>
<derby.system.home>${basedir}/appserver-base/logs</derby.system.home>
<redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>
+ <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
</systemProperties>
</configuration>
<dependencies>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
<test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
<archiva.user.configFileName>${project.build.testOutputDirectory}/repository-archiva.xml</archiva.user.configFileName>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
</systemPropertyVariables>
<forkMode>${webdav.forkMode}</forkMode>
</configuration>
if ( tmp != null && tmp.getDirectory() != null && tmp.getDirectory().exists() )
{
- if ( System.currentTimeMillis() - tmp.getCreationTime() > ( IndexMerger.DEFAULT_GROUP_INDEX_TTL * 60
+ if ( System.currentTimeMillis() - tmp.getCreationTime() > ( indexMerger.getDefaultGroupIndexTtl() * 60
* 1000 ) )
{
log.debug( "tmp group index is too old so delete it" );
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
<java.io.tmpdir>${project.build.testOutputDirectory}</java.io.tmpdir>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
- <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+ <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+ <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
</systemPropertyVariables>
</configuration>
</plugin>
<derbyVersion>10.1.3.1</derbyVersion>
<javaxMailVersion>1.4</javaxMailVersion>
<jettyVersion>7.4.5.v20110725</jettyVersion>
+ <!-- restore when we will be able to use a derby in memory database -->
+ <!--redbackTestJdbcUrl>jdbc:derby:memory:users-test;create=true</redbackTestJdbcUrl-->
+ <redbackTestJdbcDriver>org.apache.derby.jdbc.EmbeddedDriver</redbackTestJdbcDriver>
</properties>
<dependencyManagement>