X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Finternal%2Fkernel%2FActivator.java;h=7b2cb78bfe403105566d7b1a60468cf399b711ab;hb=fb22feb37b0c2340d3d846dce4b6f47d0f728efb;hp=62c140efd5a5f167405380c45c2cb3dcd9b9614e;hpb=681290ba6cddc797e8a955d06d40c054b47e2ab2;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java index 62c140efd..7b2cb78bf 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java @@ -2,25 +2,23 @@ package org.argeo.cms.internal.kernel; import java.io.IOException; import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; import java.security.AllPermission; -import java.util.Dictionary; import java.util.List; import java.util.Locale; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import javax.security.auth.login.Configuration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.argeo.api.ArgeoLogger; +import org.argeo.api.NodeConstants; +import org.argeo.api.NodeDeployment; +import org.argeo.api.NodeInstance; +import org.argeo.api.NodeState; import org.argeo.cms.CmsException; import org.argeo.ident.IdentClient; -import org.argeo.node.ArgeoLogger; -import org.argeo.node.NodeConstants; -import org.argeo.node.NodeDeployment; -import org.argeo.node.NodeInstance; -import org.argeo.node.NodeState; -import org.argeo.util.LangUtils; import org.ietf.jgss.GSSCredential; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -58,6 +56,7 @@ public class Activator implements BundleActivator { private CmsInstance nodeInstance; private ServiceTracker userAdminSt; + private ExecutorService internalExecutorService; @Override public void start(BundleContext bundleContext) throws Exception { @@ -65,6 +64,7 @@ public class Activator implements BundleActivator { instance = this; this.bc = bundleContext; this.logReaderService = getService(LogReaderService.class); + this.internalExecutorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); try { initSecurity(); @@ -105,6 +105,18 @@ public class Activator implements BundleActivator { new ConditionInfo(BundleLocationCondition.class.getName(), new String[] { "*" }) }, new PermissionInfo[] { new PermissionInfo(AllPermission.class.getName(), null, null) }, ConditionalPermissionInfo.ALLOW)); + // TODO data admin permission +// PermissionInfo dataAdminPerm = new PermissionInfo(AuthPermission.class.getName(), +// "createLoginContext." + NodeConstants.LOGIN_CONTEXT_DATA_ADMIN, null); +// update.getConditionalPermissionInfos().add(permissionAdmin.newConditionalPermissionInfo(null, +// new ConditionInfo[] { +// new ConditionInfo(BundleLocationCondition.class.getName(), new String[] { "*" }) }, +// new PermissionInfo[] { dataAdminPerm }, ConditionalPermissionInfo.DENY)); +// update.getConditionalPermissionInfos().add(permissionAdmin.newConditionalPermissionInfo(null, +// new ConditionInfo[] { +// new ConditionInfo(BundleSignerCondition.class.getName(), new String[] { "CN=\"Eclipse.org Foundation, Inc.\", OU=IT, O=\"Eclipse.org Foundation, Inc.\", L=Nepean, ST=Ontario, C=CA" }) }, +// new PermissionInfo[] { dataAdminPerm }, ConditionalPermissionInfo.ALLOW)); + update.commit(); } else { SecurityProfile securityProfile = new SecurityProfile() { }; @@ -121,18 +133,18 @@ public class Activator implements BundleActivator { private void initNode() throws IOException { // Node state - Path stateUuidPath = bc.getDataFile("stateUuid").toPath(); - String stateUuid; - if (Files.exists(stateUuidPath)) { - stateUuid = Files.readAllLines(stateUuidPath).get(0); - } else { - stateUuid = bc.getProperty(Constants.FRAMEWORK_UUID); - Files.write(stateUuidPath, stateUuid.getBytes()); - } - nodeState = new CmsState(stateUuid); - Dictionary regProps = LangUtils.dico(Constants.SERVICE_PID, NodeConstants.NODE_STATE_PID); - regProps.put(NodeConstants.CN, stateUuid); - bc.registerService(NodeState.class, nodeState, regProps); +// Path stateUuidPath = bc.getDataFile("stateUuid").toPath(); +// String stateUuid; +// if (Files.exists(stateUuidPath)) { +// stateUuid = Files.readAllLines(stateUuidPath).get(0); +// } else { +// stateUuid = bc.getProperty(Constants.FRAMEWORK_UUID); +// Files.write(stateUuidPath, stateUuid.getBytes()); +// } + nodeState = new CmsState(); +// Dictionary regProps = LangUtils.dico(Constants.SERVICE_PID, NodeConstants.NODE_STATE_PID); +// regProps.put(NodeConstants.CN, stateUuid); + bc.registerService(NodeState.class, nodeState, null); // Node deployment nodeDeployment = new CmsDeployment(); @@ -156,6 +168,7 @@ public class Activator implements BundleActivator { if (userAdminSt != null) userAdminSt.close(); + internalExecutorService.shutdown(); instance = null; this.bc = null; this.logReaderService = null; @@ -217,6 +230,10 @@ public class Activator implements BundleActivator { } + static ExecutorService getInternalExecutorService() { + return instance.internalExecutorService; + } + // static CmsSecurity getCmsSecurity() { // return instance.nodeSecurity; // }