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;
private CmsInstance nodeInstance;
private ServiceTracker<UserAdmin, NodeUserAdmin> userAdminSt;
+ private ExecutorService internalExecutorService;
@Override
public void start(BundleContext bundleContext) throws Exception {
instance = this;
this.bc = bundleContext;
this.logReaderService = getService(LogReaderService.class);
+ this.internalExecutorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
try {
initSecurity();
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<String, Object> 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<String, Object> 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();
if (userAdminSt != null)
userAdminSt.close();
+ internalExecutorService.shutdown();
instance = null;
this.bc = null;
this.logReaderService = null;
}
+ static ExecutorService getInternalExecutorService() {
+ return instance.internalExecutorService;
+ }
+
// static CmsSecurity getCmsSecurity() {
// return instance.nodeSecurity;
// }