Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2011-10-22 01:13:59 +0000
committerRoberto E. Escobar2011-10-22 01:13:59 +0000
commitf45d8c0ce30df5da8c1fccf21fbe43d4d5638245 (patch)
treea73467876d8d2420c941996120b748190233c5e9
parent4faaa5303f2e761ce00150174c8251e39c113fc3 (diff)
downloadorg.eclipse.osee-f45d8c0ce30df5da8c1fccf21fbe43d4d5638245.tar.gz
org.eclipse.osee-f45d8c0ce30df5da8c1fccf21fbe43d4d5638245.tar.xz
org.eclipse.osee-f45d8c0ce30df5da8c1fccf21fbe43d4d5638245.zip
feature[ats_Q9NLC]: Create executor admin
-rw-r--r--features/org.eclipse.osee.x.core.feature.source/feature.xml8
-rw-r--r--features/org.eclipse.osee.x.core.feature/feature.xml7
-rw-r--r--features/org.eclipse.osee.x.server.feature.source/feature.xml2
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/.classpath7
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/.project28
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/META-INF/MANIFEST.MF11
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/build.properties5
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/pom.xml30
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/ExecutorAdminTestSuite.java21
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminIternalTestSuite.java20
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java67
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockEventService.java62
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockLog.java105
-rw-r--r--plugins/org.eclipse.osee.executor.admin/.classpath7
-rw-r--r--plugins/org.eclipse.osee.executor.admin/.project33
-rw-r--r--plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml9
-rw-r--r--plugins/org.eclipse.osee.executor.admin/build.properties7
-rw-r--r--plugins/org.eclipse.osee.executor.admin/pom.xml34
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutionCallback.java24
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java31
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java28
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java20
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java39
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java149
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java63
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceImpl.java98
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceLifecycleListener.java19
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java71
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/FutureTaskWithCallback.java66
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ThreadCleaner.java42
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/OrcsIntegrationTestSuite.launch4
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/pom.xml6
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java18
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/TestBranches.java27
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/Utility.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java105
-rw-r--r--plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.db/build.properties3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java17
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java13
-rw-r--r--plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.x.core.parent/pom.xml3
-rw-r--r--plugins/org.eclipse.osee.x.server.parent/pom.xml2
48 files changed, 1288 insertions, 52 deletions
diff --git a/features/org.eclipse.osee.x.core.feature.source/feature.xml b/features/org.eclipse.osee.x.core.feature.source/feature.xml
index cad640a899..7b9196cd1e 100644
--- a/features/org.eclipse.osee.x.core.feature.source/feature.xml
+++ b/features/org.eclipse.osee.x.core.feature.source/feature.xml
@@ -71,7 +71,7 @@
download-size="0"
install-size="0"
version="0.0.0"
- unpack="false"/>
+ unpack="false"/>
<plugin
id="org.eclipse.osee.event.osgi.source"
@@ -87,4 +87,10 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.osee.executor.admin.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
</feature>
diff --git a/features/org.eclipse.osee.x.core.feature/feature.xml b/features/org.eclipse.osee.x.core.feature/feature.xml
index 6e1dd199be..46ff780d7b 100644
--- a/features/org.eclipse.osee.x.core.feature/feature.xml
+++ b/features/org.eclipse.osee.x.core.feature/feature.xml
@@ -122,4 +122,11 @@
fragment="true"
unpack="false"/>
+ <plugin
+ id="org.eclipse.osee.executor.admin"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/features/org.eclipse.osee.x.server.feature.source/feature.xml b/features/org.eclipse.osee.x.server.feature.source/feature.xml
index cfc3f49faa..8b05eb8102 100644
--- a/features/org.eclipse.osee.x.server.feature.source/feature.xml
+++ b/features/org.eclipse.osee.x.server.feature.source/feature.xml
@@ -139,5 +139,5 @@
install-size="0"
version="0.0.0"
unpack="false"/>
-
+
</feature>
diff --git a/plugins/org.eclipse.osee.executor.admin.test/.classpath b/plugins/org.eclipse.osee.executor.admin.test/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.executor.admin.test/.project b/plugins/org.eclipse.osee.executor.admin.test/.project
new file mode 100644
index 0000000000..c6f815a299
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.executor.admin.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.executor.admin.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.executor.admin.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..7abc66e61b
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Executor Admin Test (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.executor.admin.test
+Bundle-Version: 0.9.9.qualifier
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Fragment-Host: org.eclipse.osee.executor.admin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.junit;version="4.8.2",
+ org.junit.runner;version="4.8.2",
+ org.junit.runners;version="4.8.2"
diff --git a/plugins/org.eclipse.osee.executor.admin.test/build.properties b/plugins/org.eclipse.osee.executor.admin.test/build.properties
new file mode 100644
index 0000000000..5b9d2918ff
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
+additional.bundles = org.junit
diff --git a/plugins/org.eclipse.osee.executor.admin.test/pom.xml b/plugins/org.eclipse.osee.executor.admin.test/pom.xml
new file mode 100644
index 0000000000..4eda239164
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/pom.xml
@@ -0,0 +1,30 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.x.server.parent</artifactId>
+ <version>0.9.9-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.executor.admin.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <name>OSEE Executor Admin Test - (Incubation)</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <testSuite>org.eclipse.osee.executor.admin.test</testSuite>
+ <testClass>org.eclipse.osee.executor.admin.ExecutorAdminTestSuite</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/ExecutorAdminTestSuite.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/ExecutorAdminTestSuite.java
new file mode 100644
index 0000000000..bf2c100d1b
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/ExecutorAdminTestSuite.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin;
+
+import org.eclipse.osee.executor.admin.internal.ExecutorAdminIternalTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ExecutorAdminIternalTestSuite.class})
+public class ExecutorAdminTestSuite {
+ //
+}
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminIternalTestSuite.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminIternalTestSuite.java
new file mode 100644
index 0000000000..5569d96927
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminIternalTestSuite.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ExecutorAdminTest.class})
+public class ExecutorAdminIternalTestSuite {
+ //
+}
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java
new file mode 100644
index 0000000000..65011395d5
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.util.HashMap;
+import java.util.concurrent.ExecutorService;
+import org.eclipse.osee.executor.admin.mock.MockEventService;
+import org.eclipse.osee.executor.admin.mock.MockLog;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExecutorAdminTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void testInitializationGuard() throws Exception {
+ ExecutorAdminImpl admin = new ExecutorAdminImpl();
+ admin.getDefaultExecutor();
+ }
+
+ @Test
+ public void testGetService() throws Exception {
+ ExecutorAdminImpl admin = new ExecutorAdminImpl();
+ admin.setLogger(new MockLog());
+ admin.setEventService(new MockEventService());
+ admin.start(new HashMap<String, Object>());
+
+ ExecutorService defaultService = admin.getDefaultExecutor();
+ Assert.assertNotNull(defaultService);
+
+ ExecutorService serviceByName = admin.getExecutor("default.executor");
+ Assert.assertNotNull(serviceByName);
+ Assert.assertEquals(serviceByName, defaultService);
+
+ ExecutorService anotherExecutor = admin.getExecutor("hello");
+ Assert.assertNotNull(anotherExecutor);
+ Assert.assertTrue(!anotherExecutor.equals(defaultService));
+ }
+
+ @Test
+ public void testTerminateExecutorService() throws Exception {
+ ExecutorAdminImpl admin = new ExecutorAdminImpl();
+ admin.setLogger(new MockLog());
+ admin.setEventService(new MockEventService());
+ admin.start(new HashMap<String, Object>());
+
+ ExecutorService anotherExecutor = admin.getExecutor("hello");
+ Assert.assertNotNull(anotherExecutor);
+
+ ExecutorService second = admin.getExecutor("hello");
+ Assert.assertEquals(anotherExecutor, second);
+
+ second.shutdown();
+ ExecutorService third = admin.getExecutor("hello");
+ Assert.assertFalse(third.equals(second));
+ }
+}
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockEventService.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockEventService.java
new file mode 100644
index 0000000000..edb8fa8b69
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockEventService.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.mock;
+
+import java.util.Map;
+import org.eclipse.osee.event.EventService;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockEventService implements EventService {
+
+ private String topic;
+ private Map<String, ?> data;
+ private int postEvent;
+ private int sendEvent;
+
+ @Override
+ public void postEvent(String topic, Map<String, ?> data) {
+ this.topic = topic;
+ this.data = data;
+ postEvent++;
+ }
+
+ @Override
+ public void sendEvent(String topic, Map<String, ?> data) {
+ this.topic = topic;
+ this.data = data;
+ sendEvent++;
+ }
+
+ public void reset() {
+ this.topic = null;
+ this.data = null;
+ postEvent = 0;
+ sendEvent = 0;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public Map<String, ?> getData() {
+ return data;
+ }
+
+ public int getPostEventCount() {
+ return postEvent;
+ }
+
+ public int getSendEventCount() {
+ return sendEvent;
+ }
+}
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockLog.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockLog.java
new file mode 100644
index 0000000000..7588b181b5
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/mock/MockLog.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.mock;
+
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class MockLog implements Log {
+
+ @Override
+ public boolean isTraceEnabled() {
+ return true;
+ }
+
+ @Override
+ public void trace(String format, Object... args) {
+ commonOut(format, args);
+ }
+
+ @Override
+ public void trace(Throwable th, String format, Object... args) {
+ commonOut(format, args);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return true;
+ }
+
+ @Override
+ public void debug(String format, Object... args) {
+ commonOut(format, args);
+ }
+
+ @Override
+ public void debug(Throwable th, String format, Object... args) {
+ commonOut(th, format, args);
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return true;
+ }
+
+ @Override
+ public void info(String format, Object... args) {
+ commonOut(format, args);
+ }
+
+ @Override
+ public void info(Throwable th, String format, Object... args) {
+ commonOut(th, format, args);
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return true;
+ }
+
+ @Override
+ public void warn(String format, Object... args) {
+ commonOut(format, args);
+ }
+
+ @Override
+ public void warn(Throwable th, String format, Object... args) {
+ commonOut(th, format, args);
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return true;
+ }
+
+ @Override
+ public void error(String format, Object... args) {
+ commonOut(format, args);
+ }
+
+ @Override
+ public void error(Throwable th, String format, Object... args) {
+ commonOut(th, format, args);
+ }
+
+ private void commonOut(String format, Object... args) {
+ System.out.printf(format, args);
+ System.out.println();
+ }
+
+ private void commonOut(Throwable th, String format, Object... args) {
+ commonOut(format, args);
+ th.printStackTrace();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/.classpath b/plugins/org.eclipse.osee.executor.admin/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.executor.admin/.project b/plugins/org.eclipse.osee.executor.admin/.project
new file mode 100644
index 0000000000..d75547755e
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.executor.admin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..d3e721708c
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Executor Admin (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.executor.admin
+Bundle-Version: 0.9.9.qualifier
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: org.eclipse.osee.executor.admin
+Import-Package: org.eclipse.osee.event,
+ org.eclipse.osee.logger
+Service-Component: OSGI-INF/*.xml
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml b/plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml
new file mode 100644
index 0000000000..5cc9bba98b
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.executor.admin.internal.ExecutorAdminImpl">
+ <implementation class="org.eclipse.osee.executor.admin.internal.ExecutorAdminImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.executor.admin.ExecutorAdmin"/>
+ </service>
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setEventService" cardinality="1..1" interface="org.eclipse.osee.event.EventService" name="EventService" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.executor.admin/build.properties b/plugins/org.eclipse.osee.executor.admin/build.properties
new file mode 100644
index 0000000000..c6eab3a02e
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/build.properties
@@ -0,0 +1,7 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
+source.. = src/
+additional.bundles = org.eclipse.osee.logger,\
+ org.eclipse.osee.event
diff --git a/plugins/org.eclipse.osee.executor.admin/pom.xml b/plugins/org.eclipse.osee.executor.admin/pom.xml
new file mode 100644
index 0000000000..05248c07f1
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/pom.xml
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.x.server.parent</artifactId>
+ <version>0.9.9-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.executor.admin</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSEE Executor Admin - (Incubation)</name>
+
+ <build>
+ <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 -->
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutionCallback.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutionCallback.java
new file mode 100644
index 0000000000..3d457be0c0
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutionCallback.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface ExecutionCallback<T> {
+
+ void onCancelled();
+
+ void onSuccess(T result);
+
+ void onFailure(Throwable throwable);
+
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java
new file mode 100644
index 0000000000..989c034b0c
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface ExecutorAdmin {
+
+ ExecutorService getDefaultExecutor() throws Exception;
+
+ ExecutorService getExecutor(String name) throws Exception;
+
+ <T> Callable<T> addCallback(Callable<T> callable, ExecutionCallback<T> callback);
+
+ <T> Future<T> schedule(Callable<T> callable, ExecutionCallback<T> callback) throws Exception;
+
+ <T> Future<T> schedule(String id, Callable<T> callable, ExecutionCallback<T> callback) throws Exception;
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java
new file mode 100644
index 0000000000..e2cbf4ce8e
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class ExecutorConstants {
+
+ private ExecutorConstants() {
+ // Constants Class
+ }
+
+ private static final String PREFIX = "org/eclipse/osee/executor/admin/";
+
+ public static final String EXECUTOR_ADMIN_REGISTRATION_EVENT = PREFIX + "EXECUTOR_ADMIN_REGISTRATION";
+
+ public static final String EXECUTOR_ADMIN_DEREGISTRATION_EVENT = PREFIX + "EXECUTOR_ADMIN_DEREGISTRATION";
+
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java
new file mode 100644
index 0000000000..89fcb63eac
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface HasExecutionCallback<T> {
+
+ ExecutionCallback<T> getExecutionCallback();
+
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java
new file mode 100644
index 0000000000..ef03459407
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.util.concurrent.Callable;
+import org.eclipse.osee.executor.admin.ExecutionCallback;
+import org.eclipse.osee.executor.admin.HasExecutionCallback;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CallableWithCallbackImpl<T> implements Callable<T>, HasExecutionCallback<T> {
+
+ private final Callable<T> innerWorker;
+ private final ExecutionCallback<T> callback;
+
+ public CallableWithCallbackImpl(Callable<T> innerWorker, ExecutionCallback<T> callback) {
+ this.innerWorker = innerWorker;
+ this.callback = callback;
+ }
+
+ @Override
+ public T call() throws Exception {
+ return innerWorker.call();
+ }
+
+ @Override
+ public ExecutionCallback<T> getExecutionCallback() {
+ return callback;
+ }
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java
new file mode 100644
index 0000000000..4f8a608674
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import org.eclipse.osee.event.EventService;
+import org.eclipse.osee.executor.admin.ExecutionCallback;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
+import org.eclipse.osee.executor.admin.ExecutorConstants;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExecutorAdminImpl implements ExecutorAdmin {
+
+ private static final String DEFAULT_EXECUTOR = "default.executor";
+ private static final int THREAD_CHECK_TIME = 5000; // every 5 seconds
+
+ private ExecutorCache cache;
+ private Log logger;
+ private EventService eventService;
+ private Timer timer;
+ private boolean wasInitialized;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ private Log getLogger() {
+ return logger;
+ }
+
+ public void setEventService(EventService eventService) {
+ this.eventService = eventService;
+ }
+
+ private EventService getEventService() {
+ return eventService;
+ }
+
+ public void start(Map<String, ?> props) {
+ cache = new ExecutorCache();
+
+ timer = new Timer();
+ TimerTask task = new ThreadCleaner(getLogger(), cache);
+ timer.scheduleAtFixedRate(task, 0, THREAD_CHECK_TIME);
+
+ getEventService().postEvent(ExecutorConstants.EXECUTOR_ADMIN_REGISTRATION_EVENT, props);
+ wasInitialized = true;
+ }
+
+ public void stop(Map<String, ?> props) {
+ wasInitialized = false;
+ timer.cancel();
+ timer = null;
+ for (Entry<String, ExecutorService> entry : cache.getExecutors().entrySet()) {
+ shutdown(entry.getKey(), entry.getValue());
+ }
+ cache = null;
+ getEventService().postEvent(ExecutorConstants.EXECUTOR_ADMIN_DEREGISTRATION_EVENT, props);
+ }
+
+ private synchronized void ensureInitialized() throws Exception {
+ if (!wasInitialized) {
+ throw new IllegalStateException("Executor service was not properly initialized. Ensure start() is called.");
+ }
+ }
+
+ @Override
+ public ExecutorService getDefaultExecutor() throws Exception {
+ ensureInitialized();
+ return getExecutor(DEFAULT_EXECUTOR);
+ }
+
+ @Override
+ public ExecutorService getExecutor(String id) throws Exception {
+ ensureInitialized();
+ ExecutorService service = cache.getById(id);
+ if (service == null) {
+ service = createExecutor(id);
+ cache.put(id, service);
+ }
+ if (service.isShutdown() || service.isTerminated()) {
+ throw new IllegalStateException(String.format("Error executor [%s] was previously shutdown.", id));
+ }
+ return service;
+ }
+
+ @Override
+ public <T> Callable<T> addCallback(Callable<T> callable, ExecutionCallback<T> callback) {
+ return new CallableWithCallbackImpl<T>(callable, callback);
+ }
+
+ @Override
+ public <T> Future<T> schedule(Callable<T> callable, ExecutionCallback<T> callback) throws Exception {
+ return schedule(DEFAULT_EXECUTOR, callable, callback);
+ }
+
+ @Override
+ public <T> Future<T> schedule(String id, Callable<T> callable, ExecutionCallback<T> callback) throws Exception {
+ Callable<T> toExecute = callable;
+ if (callback != null) {
+ toExecute = addCallback(callable, callback);
+ }
+ return getExecutor(id).submit(toExecute);
+ }
+
+ private ExecutorService createExecutor(String id) throws Exception {
+ ExecutorThreadFactory threadFactory = new ExecutorThreadFactory(id, Thread.NORM_PRIORITY);
+ cache.put(id, threadFactory);
+
+ int numberOfProcessor = Runtime.getRuntime().availableProcessors();
+ return new ExecutorServiceImpl(id, numberOfProcessor, threadFactory, cache);
+ }
+
+ private void shutdown(String id, ExecutorService executor) {
+ try {
+ executor.shutdown();
+ boolean completed = executor.awaitTermination(10000, TimeUnit.SECONDS);
+ if (!completed) {
+ //List<Runnable> runnables =
+ executor.shutdownNow();
+ // TODO figure out what didn't execute
+ // for (Runnable runable : runnables) {
+ // runnable.
+ // }
+ }
+ } catch (InterruptedException ex) {
+ getLogger().error(ex, "Error shutting down executor [%s]", id);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java
new file mode 100644
index 0000000000..1448393beb
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExecutorCache implements ExecutorServiceLifecycleListener {
+
+ private final Map<String, ExecutorService> executors = new ConcurrentHashMap<String, ExecutorService>();
+ private final Map<String, ExecutorThreadFactory> factories = new ConcurrentHashMap<String, ExecutorThreadFactory>();
+
+ public void put(String id, ExecutorService service) throws IllegalStateException {
+ if (executors.containsKey(id)) {
+ throw new IllegalStateException(String.format("Error non-unique executor detected [%s]", id));
+ }
+ executors.put(id, service);
+ }
+
+ public void put(String id, ExecutorThreadFactory factory) throws IllegalStateException {
+ if (factories.containsKey(id)) {
+ throw new IllegalStateException(String.format("Error non-unique thread factory detected [%s]", id));
+ }
+ factories.put(id, factory);
+ }
+
+ public void remove(String id) {
+ executors.remove(id);
+ factories.remove(id);
+ }
+
+ public ExecutorService getById(String id) throws IllegalArgumentException {
+ if (id == null || id.length() <= 0) {
+ throw new IllegalArgumentException("Error - executorId cannot be null");
+ }
+ return executors.get(id);
+ }
+
+ @Override
+ public void onTerminate(String id) {
+ remove(id);
+ }
+
+ public Map<String, ExecutorThreadFactory> getThreadFactories() {
+ return factories;
+ }
+
+ public Map<String, ExecutorService> getExecutors() {
+ return executors;
+ }
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceImpl.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceImpl.java
new file mode 100644
index 0000000000..07aa256ef5
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceImpl.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import org.eclipse.osee.executor.admin.ExecutionCallback;
+import org.eclipse.osee.executor.admin.HasExecutionCallback;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExecutorServiceImpl extends ThreadPoolExecutor {
+
+ private final String id;
+ private final ExecutorServiceLifecycleListener listener;
+
+ public ExecutorServiceImpl(String id, int corePoolSize, ThreadFactory threadFactory, ExecutorServiceLifecycleListener listener) {
+ super(corePoolSize, corePoolSize, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory);
+ this.id = id;
+ this.listener = listener;
+ }
+
+ @Override
+ protected void terminated() {
+ super.terminated();
+ listener.onTerminate(id);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Future<T> submit(Callable<T> task) {
+ Future<T> toReturn = null;
+ ExecutionCallback<T> callback = getCallBack(task);
+ if (callback != null) {
+ FutureTask<T> fTask = new FutureTaskWithCallback<T>(task, callback);
+ toReturn = (Future<T>) super.submit(fTask);
+ } else {
+ toReturn = super.submit(task);
+ }
+ return toReturn;
+ }
+
+ @Override
+ public <T> Future<T> submit(Runnable task, T result) {
+ Runnable toRun = task;
+ ExecutionCallback<T> callback = getCallBack(task);
+ if (callback != null) {
+ toRun = new FutureTaskWithCallback<T>(task, result, callback);
+ }
+ return super.submit(toRun, result);
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ @Override
+ public Future<?> submit(Runnable task) {
+ Runnable toRun = task;
+ ExecutionCallback<?> callback = getCallBack(task);
+ if (callback != null) {
+ toRun = new FutureTaskWithCallback(task, null, callback);
+ }
+ return super.submit(toRun);
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ @Override
+ public void execute(Runnable command) {
+ Runnable toRun = command;
+ ExecutionCallback<?> callback = getCallBack(command);
+ if (callback != null) {
+ toRun = new FutureTaskWithCallback(command, null, callback);
+ }
+ super.execute(toRun);
+ }
+
+ @SuppressWarnings("unchecked")
+ private <V> ExecutionCallback<V> getCallBack(Object object) {
+ ExecutionCallback<V> callback = null;
+ if (object instanceof HasExecutionCallback) {
+ HasExecutionCallback<V> item = (HasExecutionCallback<V>) object;
+ callback = item.getExecutionCallback();
+ }
+ return callback;
+ }
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceLifecycleListener.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceLifecycleListener.java
new file mode 100644
index 0000000000..61a2130668
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorServiceLifecycleListener.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface ExecutorServiceLifecycleListener {
+
+ void onTerminate(String id);
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java
new file mode 100644
index 0000000000..a5d8c7c26b
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.lang.Thread.State;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ThreadFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExecutorThreadFactory implements ThreadFactory {
+
+ private final List<WeakReference<Thread>> threads;
+ private final String threadName;
+ private final int priority;
+
+ public ExecutorThreadFactory(String threadName, int priority) {
+ this.threadName = threadName;
+ this.threads = new CopyOnWriteArrayList<WeakReference<Thread>>();
+ this.priority = priority;
+ }
+
+ public ExecutorThreadFactory(String name) {
+ this(name, Thread.NORM_PRIORITY);
+ }
+
+ @Override
+ public Thread newThread(Runnable runnable) {
+ Thread thread = new Thread(runnable, threadName + ":" + threads.size());
+ thread.setPriority(priority);
+ this.threads.add(new WeakReference<Thread>(thread));
+ return thread;
+ }
+
+ public List<Thread> getThreads() {
+ List<Thread> toReturn = new ArrayList<Thread>();
+ for (WeakReference<Thread> weak : threads) {
+ Thread thread = weak.get();
+ if (thread != null) {
+ toReturn.add(thread);
+ }
+ }
+ return toReturn;
+ }
+
+ public synchronized void cleanUp() {
+ Set<WeakReference<Thread>> toRemove = new HashSet<WeakReference<Thread>>();
+ for (WeakReference<Thread> reference : threads) {
+ Thread thread = reference.get();
+ if (thread == null || State.TERMINATED == thread.getState()) {
+ toRemove.add(reference);
+ }
+ }
+ threads.removeAll(toRemove);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/FutureTaskWithCallback.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/FutureTaskWithCallback.java
new file mode 100644
index 0000000000..5cccf87f84
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/FutureTaskWithCallback.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+import org.eclipse.osee.executor.admin.ExecutionCallback;
+import org.eclipse.osee.executor.admin.HasExecutionCallback;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class FutureTaskWithCallback<T> extends FutureTask<T> implements HasExecutionCallback<T> {
+
+ private final ExecutionCallback<T> callback;
+ private T result;
+
+ public FutureTaskWithCallback(Callable<T> callable, ExecutionCallback<T> callback) {
+ super(callable);
+ this.callback = callback;
+ }
+
+ public FutureTaskWithCallback(Runnable runnable, T result, ExecutionCallback<T> callback) {
+ super(runnable, result);
+ this.callback = callback;
+ this.result = result;
+ }
+
+ @Override
+ public ExecutionCallback<T> getExecutionCallback() {
+ return callback;
+ }
+
+ @Override
+ protected void set(T result) {
+ super.set(result);
+ this.result = result;
+ }
+
+ @Override
+ protected void done() {
+ super.done();
+ callback.onSuccess(result);
+ }
+
+ @Override
+ protected void setException(Throwable throwable) {
+ super.setException(throwable);
+ callback.onFailure(throwable);
+ }
+
+ @Override
+ public boolean cancel(boolean mayInterruptIfRunning) {
+ boolean result = super.cancel(mayInterruptIfRunning);
+ callback.onCancelled();
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ThreadCleaner.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ThreadCleaner.java
new file mode 100644
index 0000000000..d1d99fbc8f
--- /dev/null
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ThreadCleaner.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.executor.admin.internal;
+
+import java.util.Map.Entry;
+import java.util.TimerTask;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ThreadCleaner extends TimerTask {
+
+ private final ExecutorCache cache;
+ private final Log logger;
+
+ public ThreadCleaner(Log logger, ExecutorCache cache) {
+ super();
+ this.logger = logger;
+ this.cache = cache;
+ }
+
+ @Override
+ public void run() {
+ for (Entry<String, ExecutorThreadFactory> entry : cache.getThreadFactories().entrySet()) {
+ try {
+ ExecutorThreadFactory factory = entry.getValue();
+ factory.cleanUp();
+ } catch (Throwable ex) {
+ logger.error(ex, "Error removing dead threads for [%s]", entry.getKey());
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.core.integration.test/META-INF/MANIFEST.MF
index f30a7eadc3..ffd0284768 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Fragment-Host: org.eclipse.osee.orcs.core;bundle-version="0.9.9"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: junit.framework;version="4.8.2",
org.eclipse.osee.event,
+ org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/OrcsIntegrationTestSuite.launch b/plugins/org.eclipse.osee.orcs.core.integration.test/OrcsIntegrationTestSuite.launch
index f067fa1416..b38c09fb37 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/OrcsIntegrationTestSuite.launch
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/OrcsIntegrationTestSuite.launch
@@ -34,9 +34,9 @@
<stringAttribute key="product" value="lba.ote.outfile.conversion.app.convert"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
<stringAttribute key="selected_target_plugins" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.google.collect@default:default,com.google.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.antlr.runtime@default:default,org.aopalliance@default:default,org.apache.commons.codec@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.log4j@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.core.net@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.emf.common@default:default,org.eclipse.emf.compare.diff@default:default,org.eclipse.emf.compare.match@default:default,org.eclipse.emf.compare@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.xtext.logging@default:false,org.eclipse.xtext.util@default:default,org.eclipse.xtext@default:default,org.h2@default:default,org.hamcrest.core@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.framework.core.dsl.integration.test@default:false,org.eclipse.osee.framework.core.dsl.integration@default:default,org.eclipse.osee.framework.core.dsl@default:default,org.eclipse.osee.framework.core.model.test@default:false,org.eclipse.osee.framework.core.model@default:default,org.eclipse.osee.framework.core.test@default:false,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.database.test@default:false,org.eclipse.osee.framework.database@default:default,org.eclipse.osee.framework.h2@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.framework.resource.management.test@default:false,org.eclipse.osee.framework.resource.management@default:default,org.eclipse.osee.logback.config@default:false,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:true,org.eclipse.osee.orcs.core.integration.test@default:false,org.eclipse.osee.orcs.core.test@default:false,org.eclipse.osee.orcs.core@default:default,org.eclipse.osee.orcs.db.mock@default:default,org.eclipse.osee.orcs.db.test@default:false,org.eclipse.osee.orcs.db@default:default,org.eclipse.osee.orcs.mock@default:default,org.eclipse.osee.orcs@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.executor.admin@default:default,org.eclipse.osee.framework.core.dsl.integration.test@default:false,org.eclipse.osee.framework.core.dsl.integration@default:default,org.eclipse.osee.framework.core.dsl@default:default,org.eclipse.osee.framework.core.model.test@default:false,org.eclipse.osee.framework.core.model@default:default,org.eclipse.osee.framework.core.test@default:false,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.database.test@default:false,org.eclipse.osee.framework.database@default:default,org.eclipse.osee.framework.h2@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.framework.resource.management.test@default:false,org.eclipse.osee.framework.resource.management@default:default,org.eclipse.osee.logback.config@default:false,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:true,org.eclipse.osee.orcs.core.integration.test@default:false,org.eclipse.osee.orcs.core.test@default:false,org.eclipse.osee.orcs.core@default:default,org.eclipse.osee.orcs.db.mock@default:default,org.eclipse.osee.orcs.db.test@default:false,org.eclipse.osee.orcs.db@default:default,org.eclipse.osee.orcs.mock@default:default,org.eclipse.osee.orcs@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
-<stringAttribute key="timestamp" value="1319170959521"/>
+<stringAttribute key="timestamp" value="1319517127352"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/pom.xml b/plugins/org.eclipse.osee.orcs.core.integration.test/pom.xml
index 50b8f85a34..dc4ace54ba 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/pom.xml
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/pom.xml
@@ -140,7 +140,11 @@
<artifactId>org.eclipse.equinox.util</artifactId>
<version>0.0.0</version>
</dependency>
-
+ <dependency>
+ <type>eclipse-plugin</type>
+ <artifactId>org.eclipse.osee.executor.admin</artifactId>
+ <version>0.0.0</version>
+ </dependency>
<!--
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java
index 3dff6cfea5..be94267189 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java
@@ -18,8 +18,6 @@ import java.util.List;
import junit.framework.Assert;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
@@ -28,6 +26,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.core.mock.TestBranches;
import org.eclipse.osee.orcs.core.mock.Utility;
import org.eclipse.osee.orcs.data.ReadableArtifact;
import org.eclipse.osee.orcs.data.ReadableAttribute;
@@ -49,8 +48,6 @@ import org.junit.Test;
* @author Roberto E. Escobar
*/
public class OrcsQueryTest {
- public static final IOseeBranch SAW_Bld_1 = TokenFactory.createBranch("AyH_f2sSKy3l07fIvAAA", "SAW_Bld_1");
- public static final IOseeBranch SAW_Bld_2 = TokenFactory.createBranch("AyH_f2sSKy3l07fIvBBB", "SAW_Bld_2");
@Rule
public OseeDatabase db = new OseeDatabase("osee.demo.h2");
@@ -120,7 +117,8 @@ public class OrcsQueryTest {
}
private void checkQueryArtifactTypeInheritance(QueryFactory factory) throws OseeCoreException {
- QueryBuilder builder = factory.fromBranch(SAW_Bld_1).andIsOfType(CoreArtifactTypes.AbstractSoftwareRequirement);//
+ QueryBuilder builder =
+ factory.fromBranch(TestBranches.SAW_Bld_1).andIsOfType(CoreArtifactTypes.AbstractSoftwareRequirement);//
builder.excludeTypeInheritance();
Assert.assertEquals(0, builder.getCount());
@@ -195,7 +193,7 @@ public class OrcsQueryTest {
private void checkQueryArtifactTypeAndNameValue(QueryFactory factory) throws OseeCoreException {
//////////////////////
- QueryBuilder builder = factory.fromBranch(SAW_Bld_1);
+ QueryBuilder builder = factory.fromBranch(TestBranches.SAW_Bld_1);
builder.and(CoreAttributeTypes.Name, Operator.EQUAL, "%Requirement%");
Assert.assertEquals(7, builder.getCount());
@@ -218,7 +216,7 @@ public class OrcsQueryTest {
checkContainsTypes(folders, CoreArtifactTypes.Folder);
//////////////////////
- QueryBuilder builder1 = factory.fromBranch(SAW_Bld_1);
+ QueryBuilder builder1 = factory.fromBranch(TestBranches.SAW_Bld_1);
builder1.and(CoreAttributeTypes.Name, Operator.EQUAL, "%Requirement%");
builder1.andIsOfType(CoreArtifactTypes.SubsystemRequirement);
Assert.assertEquals(1, builder1.getCount());
@@ -228,7 +226,7 @@ public class OrcsQueryTest {
checkContainsTypes(subSystemReqs, CoreArtifactTypes.SubsystemRequirement);
//////////////////////
- QueryBuilder builder2 = factory.fromBranch(SAW_Bld_1);
+ QueryBuilder builder2 = factory.fromBranch(TestBranches.SAW_Bld_1);
builder2.and(CoreAttributeTypes.Name, Operator.EQUAL, "%Requirement%");
builder2.includeTypeInheritance();
builder2.andIsOfType(CoreArtifactTypes.Requirement);
@@ -245,7 +243,7 @@ public class OrcsQueryTest {
}
private void checkQueryAttributeKeyword(QueryFactory factory) throws OseeCoreException {
- QueryBuilder builder = factory.fromBranch(SAW_Bld_1);
+ QueryBuilder builder = factory.fromBranch(TestBranches.SAW_Bld_1);
builder.and(CoreAttributeTypes.Name, StringOperator.TOKENIZED_ANY_ORDER, CaseType.IGNORE_CASE, "REQUIREMENTS");
Assert.assertEquals(7, builder.getCount());
@@ -280,7 +278,7 @@ public class OrcsQueryTest {
checkMatchSingleAttribute(matchIterator.next(), "System Requirements", CoreAttributeTypes.Name, "Requirements");
// @formatter:on
- QueryBuilder builder1 = factory.fromBranch(SAW_Bld_1);
+ QueryBuilder builder1 = factory.fromBranch(TestBranches.SAW_Bld_1);
builder1.and(CoreAttributeTypes.Name, StringOperator.TOKENIZED_ANY_ORDER, CaseType.MATCH_CASE, "REQUIREMENTS");
Assert.assertEquals(0, builder1.getCount());
}
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/TestBranches.java b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/TestBranches.java
new file mode 100644
index 0000000000..2432d3ba40
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/TestBranches.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.core.mock;
+
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.TokenFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class TestBranches {
+
+ private TestBranches() {
+ // Constants class
+ }
+
+ public static final IOseeBranch SAW_Bld_1 = TokenFactory.createBranch("AyH_f2sSKy3l07fIvAAA", "SAW_Bld_1");
+ public static final IOseeBranch SAW_Bld_2 = TokenFactory.createBranch("AyH_f2sSKy3l07fIvBBB", "SAW_Bld_2");
+}
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/Utility.java b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/Utility.java
index 430049956c..c37b58a0fc 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/Utility.java
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/mock/Utility.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.orcs.core.mock;
import org.eclipse.osee.event.EventService;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
@@ -44,6 +45,7 @@ public final class Utility {
OsgiUtil.getService(IOseeModelingService.class);
OsgiUtil.getService(EventAdmin.class);
OsgiUtil.getService(EventService.class);
+ OsgiUtil.getService(ExecutorAdmin.class);
OsgiUtil.getService(IOseeCachingService.class);
OsgiUtil.getService(QueryEngine.class);
OsgiUtil.getService(DataStoreTypeCache.class);
diff --git a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
index cef307d7da..5aaaeee0e3 100644
--- a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/*.xml
Import-Package: com.google.common.collect;version="1.0.0",
+ org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
index 9236ad9ccb..36246ceac5 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
@@ -15,13 +15,15 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import java.util.concurrent.Future;
+import org.eclipse.osee.executor.admin.ExecutionCallback;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.HumanReadableId;
@@ -43,15 +45,15 @@ import org.eclipse.osee.orcs.search.StringOperator;
*/
public class QueryBuilderImpl implements QueryBuilder {
- private final ResultSetFactory rsetFactory;
+ private final QueryExecutor queryExecutor;
private final CriteriaFactory criteriaFactory;
private final SessionContext sessionContext;
private final CriteriaSet criteriaSet;
private final QueryOptions options;
- public QueryBuilderImpl(ResultSetFactory rsetFactory, CriteriaFactory criteriaFactory, SessionContext sessionContext, CriteriaSet criteriaSet, QueryOptions options) {
- this.rsetFactory = rsetFactory;
+ public QueryBuilderImpl(QueryExecutor queryExecutor, CriteriaFactory criteriaFactory, SessionContext sessionContext, CriteriaSet criteriaSet, QueryOptions options) {
+ this.queryExecutor = queryExecutor;
this.criteriaFactory = criteriaFactory;
this.sessionContext = sessionContext;
this.criteriaSet = criteriaSet;
@@ -265,36 +267,103 @@ public class QueryBuilderImpl implements QueryBuilder {
}
@Override
- public ResultSet<ReadableArtifact> build(LoadLevel loadLevel) throws OseeCoreException {
- return rsetFactory.createResultSet(sessionContext, loadLevel, criteriaSet.clone(), options.clone());
+ public QueryBuilder andNameEquals(String artifactName) throws OseeCoreException {
+ return and(CoreAttributeTypes.Name, Operator.EQUAL, artifactName);
}
@Override
- public ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> buildMatches(LoadLevel loadLevel) throws OseeCoreException {
- return rsetFactory.createMatchesResultSet(sessionContext, loadLevel, criteriaSet.clone(), options.clone());
+ public QueryBuilder andIds(IArtifactToken... artifactToken) throws OseeCoreException {
+ return andIds(Arrays.asList(artifactToken));
+ }
+
+ @Override
+ public QueryBuilder andIds(Collection<? extends IArtifactToken> artifactTokens) throws OseeCoreException {
+ Set<String> guids = new HashSet<String>();
+ for (IArtifactToken token : artifactTokens) {
+ guids.add(token.getGuid());
+ }
+ return andGuidsOrHrids(guids);
+ }
+
+ @Override
+ public ResultSet<ReadableArtifact> getResults() throws OseeCoreException {
+ ResultSet<ReadableArtifact> result = null;
+ try {
+ result = search().get();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return result;
+ }
+
+ @Override
+ public ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> getMatches() throws OseeCoreException {
+ ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> result = null;
+ try {
+ result = searchWithMatches().get();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return result;
}
@Override
public int getCount() throws OseeCoreException {
- return rsetFactory.getCount(sessionContext, criteriaSet.clone(), options.clone());
+ int result = -1;
+ try {
+ result = computeCount().get();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return result;
}
@Override
- public QueryBuilder andNameEquals(String artifactName) throws OseeCoreException {
- return and(CoreAttributeTypes.Name, Operator.EQUAL, artifactName);
+ public Future<Integer> computeCount() throws OseeCoreException {
+ return computeCount(null);
}
@Override
- public QueryBuilder andIds(IArtifactToken... artifactToken) throws OseeCoreException {
- return andIds(Arrays.asList(artifactToken));
+ public Future<ResultSet<ReadableArtifact>> search() throws OseeCoreException {
+ return search(null);
}
@Override
- public QueryBuilder andIds(Collection<? extends IArtifactToken> artifactTokens) throws OseeCoreException {
- Set<String> guids = new HashSet<String>();
- for (IArtifactToken token : artifactTokens) {
- guids.add(token.getGuid());
+ public Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> searchWithMatches() throws OseeCoreException {
+ return searchWithMatches(null);
+ }
+
+ @Override
+ public Future<Integer> computeCount(ExecutionCallback<Integer> callback) throws OseeCoreException {
+ Future<Integer> toReturn = null;
+ try {
+ toReturn = queryExecutor.scheduleCount(sessionContext, criteriaSet.clone(), options.clone(), callback);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
}
- return andGuidsOrHrids(guids);
+ return toReturn;
+ }
+
+ @Override
+ public Future<ResultSet<ReadableArtifact>> search(ExecutionCallback<ResultSet<ReadableArtifact>> callback) throws OseeCoreException {
+ Future<ResultSet<ReadableArtifact>> toReturn = null;
+ try {
+ toReturn = queryExecutor.scheduleSearch(sessionContext, criteriaSet.clone(), options.clone(), callback);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return toReturn;
+ }
+
+ @Override
+ public Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> searchWithMatches(ExecutionCallback<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> callback) throws OseeCoreException {
+ Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> toReturn = null;
+ try {
+ toReturn =
+ queryExecutor.scheduleSearchWithMatches(sessionContext, criteriaSet.clone(), options.clone(), callback);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return toReturn;
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF
index 675dd9fa0c..bbacd914df 100644
--- a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/*.xml
Import-Package: org.eclipse.osee.event,
+ org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
diff --git a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml
index 3088801345..ad0daa8cdf 100644
--- a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml
+++ b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml
@@ -9,6 +9,7 @@
<reference bind="setFactoryService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/>
<reference bind="setModelService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelingService" name="IOseeModelingService" policy="static"/>
<reference bind="setEventService" cardinality="1..1" interface="org.eclipse.osee.event.EventService" name="EventService" policy="static"/>
+ <reference bind="setExecutorAdmin" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/>
<service>
<provide interface="org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory"/>
</service>
diff --git a/plugins/org.eclipse.osee.orcs.db/build.properties b/plugins/org.eclipse.osee.orcs.db/build.properties
index f1258538ac..938ccb2692 100644
--- a/plugins/org.eclipse.osee.orcs.db/build.properties
+++ b/plugins/org.eclipse.osee.orcs.db/build.properties
@@ -11,4 +11,5 @@ additional.bundles = org.eclipse.osee.framework.database,\
org.eclipse.osee.framework.resource.management,\
org.eclipse.osee.framework.core.model,\
org.eclipse.osee.orcs,\
- org.eclipse.osee.event
+ org.eclipse.osee.event,\
+ org.eclipse.osee.executor.admin
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java
index 0363819e17..f546345101 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java
@@ -10,9 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import org.eclipse.osee.event.EventService;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.core.model.OseeCachingService;
import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
@@ -50,16 +49,14 @@ public class CacheFactoryService implements IOseeCachingServiceFactory {
private IdentityService identityService;
private Log logger;
private EventService eventService;
-
- private ExecutorService executor;
+ private ExecutorAdmin executorAdmin;
public void start() {
- // TODO: Pass in executor admin service
- executor = Executors.newFixedThreadPool(5);
+ //
}
public void stop() {
- executor.shutdownNow();
+ //
}
public void setLogger(Log logger) {
@@ -94,11 +91,15 @@ public class CacheFactoryService implements IOseeCachingServiceFactory {
this.eventService = eventService;
}
+ public void setExecutorAdmin(ExecutorAdmin executorAdmin) {
+ this.executorAdmin = executorAdmin;
+ }
+
@Override
public IOseeCachingService createCachingService() {
TransactionCache txCache = new TransactionCache();
BranchCache branchCache =
- new BranchCache(new DatabaseBranchAccessor(logger, executor, eventService, dbService, txCache,
+ new BranchCache(new DatabaseBranchAccessor(logger, executorAdmin, eventService, dbService, txCache,
factoryService.getBranchFactory()));
txCache.setAccessor(new DatabaseTransactionRecordAccessor(dbService, branchCache,
factoryService.getTransactionFactory()));
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java
index cc9644349e..f84e6524bb 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java
@@ -16,10 +16,10 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.event.EventService;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.core.enums.BranchArchivedState;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
@@ -53,13 +53,13 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<String, Branch>
private final Log logger;
private final IOseeDatabaseService dbService;
- private final ExecutorService executor;
+ private final ExecutorAdmin executor;
private final EventService eventService;
private final TransactionCache txCache;
private final BranchFactory branchFactory;
- public DatabaseBranchAccessor(Log logger, ExecutorService executor, EventService eventService, IOseeDatabaseService dbService, TransactionCache txCache, BranchFactory branchFactory) {
+ public DatabaseBranchAccessor(Log logger, ExecutorAdmin executor, EventService eventService, IOseeDatabaseService dbService, TransactionCache txCache, BranchFactory branchFactory) {
this.logger = logger;
this.executor = executor;
this.eventService = eventService;
@@ -193,8 +193,8 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<String, Branch>
@Override
public void store(Collection<Branch> branches) throws OseeCoreException {
StoreBranchCallable task = new StoreBranchCallable(dbService, executor, eventService, branches);
- Future<IStatus> future = executor.submit(task);
try {
+ Future<IStatus> future = executor.getDefaultExecutor().submit(task);
IStatus status = future.get();
if (!status.isOK()) {
throw new OseeStateException("Error storing branches");
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java
index 0d1618fb76..9e92d2b99b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java
@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ExecutorService;
import org.eclipse.osee.event.EventService;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.AbstractOseeType;
import org.eclipse.osee.framework.core.model.Branch;
@@ -41,10 +42,10 @@ public class StoreBranchCallable extends DatabaseTxCallable {
private static final String DELETE_BRANCH = "DELETE from osee_branch where branch_id = ?";
private final Collection<Branch> branches;
- private final ExecutorService executor;
+ private final ExecutorAdmin executor;
private final EventService eventService;
- public StoreBranchCallable(IOseeDatabaseService dbService, ExecutorService executor, EventService eventService, Collection<Branch> branches) {
+ public StoreBranchCallable(IOseeDatabaseService dbService, ExecutorAdmin executor, EventService eventService, Collection<Branch> branches) {
super(dbService, "Branch Archive Operation");
this.executor = executor;
this.eventService = eventService;
@@ -55,8 +56,12 @@ public class StoreBranchCallable extends DatabaseTxCallable {
return eventService;
}
- private ExecutorService getExecutorService() {
- return executor;
+ private ExecutorService getExecutorService() throws OseeCoreException {
+ try {
+ return executor.getDefaultExecutor();
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
index 6302367f56..347cfa0ad4 100644
--- a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.osee.orcs
Bundle-Version: 0.9.9.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.eclipse.osee.framework.core.data,
+Import-Package: org.eclipse.osee.executor.admin,
+ org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
diff --git a/plugins/org.eclipse.osee.x.core.parent/pom.xml b/plugins/org.eclipse.osee.x.core.parent/pom.xml
index 3c9ab2ef74..3545aab704 100644
--- a/plugins/org.eclipse.osee.x.core.parent/pom.xml
+++ b/plugins/org.eclipse.osee.x.core.parent/pom.xml
@@ -21,6 +21,9 @@
<module>../../plugins/org.eclipse.osee.event</module>
<module>../../plugins/org.eclipse.osee.event.osgi</module>
+ <module>../../plugins/org.eclipse.osee.executor.admin</module>
+ <module>../../plugins/org.eclipse.osee.executor.admin.test</module>
+
<module>../../plugins/org.eclipse.osee.framework.jdk.core</module>
<module>../../plugins/org.eclipse.osee.framework.jdk.core.test</module>
diff --git a/plugins/org.eclipse.osee.x.server.parent/pom.xml b/plugins/org.eclipse.osee.x.server.parent/pom.xml
index 21a5491def..5bc8220d46 100644
--- a/plugins/org.eclipse.osee.x.server.parent/pom.xml
+++ b/plugins/org.eclipse.osee.x.server.parent/pom.xml
@@ -23,7 +23,7 @@
<module>../../plugins/org.eclipse.osee.framework.database.test</module>
<module>../../plugins/org.eclipse.osee.database</module>
-
+
<module>../../plugins/org.eclipse.osee.display.api</module>
<module>../../plugins/org.eclipse.osee.display.view.web</module>
<module>../../plugins/org.eclipse.osee.display.presenter</module>

Back to the top