aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-rest
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-12-02 05:02:19 +0000
committerOlivier Lamy <olamy@apache.org>2013-12-02 05:02:19 +0000
commitf7cf70133bedf38119116addc0bd26f5ff6add3d (patch)
treec0d2a5c392646930f1e7200c88b450ec9b6ef606 /archiva-modules/archiva-web/archiva-rest
parent500b4e8d5eb2502d40b79486d7e1edbbeb70f1f9 (diff)
downloadarchiva-f7cf70133bedf38119116addc0bd26f5ff6add3d.tar.gz
archiva-f7cf70133bedf38119116addc0bd26f5ff6add3d.zip
setup this bean on startup: will make it more thread safe
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1546898 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest')
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java57
1 files changed, 28 insertions, 29 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
index 4f61ad15c..a7c1c494a 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
@@ -50,38 +50,14 @@ public class DefaultPluginsServices
private Logger log = LoggerFactory.getLogger( getClass() );
+ private String adminPlugins;
+
@Inject
public DefaultPluginsServices( ApplicationContext applicationContext )
+ throws IOException
{
this.appCont = applicationContext;
- }
-
- private void feed( List<String> repository, String key )
- throws ArchivaRestServiceException
- {
- log.debug( "Feeding: {}", key );
- repository.clear();
- Resource[] xmlResources;
- try
- {
- xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" );
- 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" );
- }
- }
- catch ( IOException e )
- {
- throw new ArchivaRestServiceException( e.getMessage(), e );
- }
- }
- @Override
- public String getAdminPlugins()
- throws ArchivaRestServiceException
- {
// rebuild
feed( repositoryType, "repository" );
feed( adminFeatures, "features" );
@@ -97,12 +73,35 @@ public class DefaultPluginsServices
log.debug( "getAdminPlugins: {}", sb.toString() );
if ( sb.length() > 1 )
{
- return sb.substring( 0, sb.length() - 1 );
+ adminPlugins = sb.substring( 0, sb.length() - 1 );
}
else
{
- return sb.toString();
+ adminPlugins = sb.toString();
+ }
+ }
+
+ private void feed( List<String> repository, String key )
+ throws IOException
+ {
+ log.info( "Feeding: {}", key );
+ repository.clear();
+ Resource[] xmlResources;
+
+ xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" );
+ 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" );
}
}
+
+ @Override
+ public String getAdminPlugins()
+ throws ArchivaRestServiceException
+ {
+ return adminPlugins;
+ }
}