-->
<redbackTestJdbcUrl>jdbc:hsqldb:mem:redback-test</redbackTestJdbcUrl>
<redbackTestJdbcDriver>org.hsqldb.jdbcDriver</redbackTestJdbcDriver>
+ <jetty.version>9.4.5.v20170502</jetty.version>
</properties>
<dependencies>
</dependency>
<dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-juli</artifactId>
- <scope>test</scope>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
- <scope>test</scope>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
* under the License.
*/
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-
import org.apache.archiva.rest.api.services.PluginsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
* @author Eric Barboni
* @since 1.4.0
*/
-@Service("pluginsService#rest")
+@Service( "pluginsService#rest" )
public class DefaultPluginsServices
implements PluginsService
{
private List<String> adminFeatures = new ArrayList<>();
- private ApplicationContext appCont;
+ private ApplicationContext applicationContext;
private Logger log = LoggerFactory.getLogger( getClass() );
public DefaultPluginsServices( ApplicationContext applicationContext )
throws IOException
{
- this.appCont = applicationContext;
+ log.debug( "init DefaultPluginsServices" );
+ this.applicationContext = applicationContext;
// rebuild
- feed( repositoryType, "repository" );
- feed( adminFeatures, "features" );
+ repositoryType = feed( "repository" );
+ log.debug( "feed {}:{}", "repository" , repositoryType);
+ adminFeatures = feed( "features" );
+ log.debug( "feed {}:{}", "features", adminFeatures );
StringBuilder sb = new StringBuilder();
for ( String repoType : repositoryType )
{
}
}
- private void feed( List<String> repository, String key )
+ private List<String> feed( String key )
throws IOException
{
log.info( "Feeding: {}", key );
- repository.clear();
- Resource[] xmlResources;
-
- xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" );
+ Resource[] xmlResources = applicationContext.getResources( "/**/" + key + "/**/main.js" );
+ if (xmlResources == null)
+ {
+ return Collections.emptyList();
+ }
+ List<String> repository = new ArrayList<>( xmlResources.length );
for ( Resource rc : xmlResources )
{
String tmp = rc.getURL().toString();
tmp = tmp.substring( tmp.lastIndexOf( key ) + key.length() + 1, tmp.length() - 8 );
repository.add( "archiva/admin/" + key + "/" + tmp + "/main" );
}
-
+ return repository;
}
@Override
public String getAdminPlugins()
throws ArchivaRestServiceException
{
- return adminPlugins;
+ return adminPlugins;
}
}
-->
-<configuration status="debug">
+<configuration> <!-- status="debug" -->
<appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%L] [%t] %-5level %logger{3} - %msg%n}" />
</appenders>
<loggers>
- <logger name="org.codehaus.redback.rest.services" level="error"/>
-
+ <logger name="org.apache.archiva.redback.rest.services" level="error"/>
<logger name="JPOX" level="error"/>
-
-
- <logger name="org.springframework" level="error"/>
-
+ <logger name="org.apache.archiva.rest.services" level="info"/>
+ <logger name="org.springframework" level="info"/>
<logger name="org.apache.commons.configuration" level="error"/>
<root level="info">
<groupId>org.apache.archiva</groupId>
<artifactId>audit</artifactId>
</dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>