Use new Commons features
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 22 Mar 2013 15:22:36 +0000 (15:22 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 22 Mar 2013 15:22:36 +0000 (15:22 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@6206 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

modules/org.argeo.slc.agent/META-INF/spring/osgi.xml
modules/org.argeo.slc.server.repo/META-INF/spring/repo-osgi.xml
runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/deploy/OsgiModuleLabel.java [deleted file]

index ad4281624951c92a6e1ac2104853b31da0cd4eaf..f22371189d8ceb7b4c4d203f0e6cf4afb9570aee 100644 (file)
        <service ref="modulesManager" interface="org.argeo.slc.execution.ExecutionModulesManager" />\r
 \r
        <!-- LABEL -->\r
-       <beans:bean class="org.argeo.slc.osgi.deploy.OsgiModuleLabel">\r
+       <beans:bean class="org.argeo.security.core.OsgiModuleLabel">\r
                <beans:property name="bundleContext" ref="bundleContext" />\r
        </beans:bean>\r
+\r
+       <!-- ROLES -->\r
+       <reference id="userAdminService" interface="org.argeo.security.UserAdminService" />\r
+\r
+       <beans:bean class="org.argeo.security.core.SimpleRoleRegistration"\r
+               init-method="run">\r
+               <beans:property name="role" value="ROLE_SLC" />\r
+               <beans:property name="userAdminService" ref="userAdminService" />\r
+       </beans:bean>\r
 </beans:beans>
\ No newline at end of file
index cc3cbdbf3029c0021e89b38f6c6addbfd2aff9ec..fc2362c89745ea9874216b433d90aa9e77a27aa8 100644 (file)
        <service ref="mavenProxyService" interface="org.argeo.slc.repo.maven.proxy.MavenProxyService" />\r
 \r
        <!-- LABEL -->\r
-       <beans:bean class="org.argeo.slc.osgi.deploy.OsgiModuleLabel">\r
+       <beans:bean class="org.argeo.security.core.OsgiModuleLabel">\r
                <beans:property name="bundleContext" ref="bundleContext" />\r
        </beans:bean>\r
+\r
+       <!-- ROLES -->\r
+       <reference id="userAdminService" interface="org.argeo.security.UserAdminService" />\r
+\r
+       <beans:bean class="org.argeo.security.core.SimpleRoleRegistration"\r
+               init-method="run">\r
+               <beans:property name="role" value="ROLE_SLC" />\r
+               <beans:property name="userAdminService" ref="userAdminService" />\r
+       </beans:bean>\r
 </beans:beans>\r
 \r
 <!-- <reference id="mavenRepositorySystem" interface="org.sonatype.aether.RepositorySystem" -->\r
diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/deploy/OsgiModuleLabel.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/deploy/OsgiModuleLabel.java
deleted file mode 100644 (file)
index 5da8b96..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.argeo.slc.osgi.deploy;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-
-/** Logs the version of an OSGi bundle. */
-public class OsgiModuleLabel {
-       private final static Log log = LogFactory.getLog(OsgiModuleLabel.class);
-
-       private Bundle bundle;
-
-       public OsgiModuleLabel() {
-       }
-
-       /** Sets without logging. */
-       public OsgiModuleLabel(Bundle bundle) {
-               this.bundle = bundle;
-       }
-
-       /**
-        * Retrieved bundle from a bundle context and logs it. Typically to be set
-        * as a Spring bean.
-        */
-       public void setBundleContext(BundleContext bundleContext) {
-               this.bundle = bundleContext.getBundle();
-               log.info(msg());
-       }
-
-       public String msg() {
-               String name = bundle.getHeaders().get(Constants.BUNDLE_NAME).toString();
-               String symbolicName = bundle.getSymbolicName();
-               String version = bundle.getVersion().toString();
-               return name + " v" + version + " (" + symbolicName + ")";
-       }
-}