Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M Finkbeiner2013-11-26 19:03:27 -0500
committerRoberto E. Escobar2014-03-04 14:41:48 -0500
commitfc69b03bdebd634dbc49b247f78d76f599d763fd (patch)
tree1d2095777c12442aeceff2591a4ed9a728573b65
parent8c8dab25dd96cc9169a1b3bacfddbca7cba7cd76 (diff)
downloadorg.eclipse.osee-fc69b03bdebd634dbc49b247f78d76f599d763fd.tar.gz
org.eclipse.osee-fc69b03bdebd634dbc49b247f78d76f599d763fd.tar.xz
org.eclipse.osee-fc69b03bdebd634dbc49b247f78d76f599d763fd.zip
feature[ats_KKXWE]: Implement the OTE builder
This is the initial commit to get the OTE builder working. It also includes the rest interface changes and some environment changes so that we can disconnect from the server without killing the batch, and reconnect to the server and start getting updates again.
-rw-r--r--features/org.eclipse.osee.client.ote.feature/feature.xml7
-rw-r--r--features/org.eclipse.osee.ote.feature/feature.xml6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.workspacebundleloader/src/org/eclipse/osee/framework/ui/workspacebundleloader/BundleInfoLite.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.ws/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.ws/src/org/eclipse/osee/framework/ui/ws/AWorkspace.java6
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java2
-rw-r--r--plugins/org.eclipse.osee.ote.connection.jini/src/org/eclipse/osee/ote/connection/jini/Activator.java56
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/data/loading.test1.jar (renamed from plugins/org.eclipse.osee.ote.test/data/loading.test1.jar)bin1167 -> 1167 bytes
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/data/loading.test2.jar (renamed from plugins/org.eclipse.osee.ote.test/data/loading.test2.jar)bin1176 -> 1176 bytes
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/data/loading.test3.jar (renamed from plugins/org.eclipse.osee.ote.test/data/loading.test3.jar)bin1182 -> 1182 bytes
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/OTEApiTest.java226
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/OTEStatusCallbackForTests.java (renamed from plugins/org.eclipse.osee.ote.test/src/org/eclipse/osee/ote/internal/OTEStatusCallbackForTests.java)8
-rw-r--r--plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ote.core/OSGI-INF/StatusBoardComponent.xml2
-rw-r--r--plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.api.component.xml12
-rw-r--r--plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.runtime.manager.xml8
-rw-r--r--plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.folder.component.xml7
-rw-r--r--plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.runtime.cache.component.xml8
-rw-r--r--plugins/org.eclipse.osee.ote.core/build.properties4
-rw-r--r--plugins/org.eclipse.osee.ote.core/plugin.xml25
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/Configuration.java28
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationItem.java (renamed from plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfigurationItem.java)9
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatus.java (renamed from plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfigurationStatus.java)8
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEApi.java114
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEException.java (renamed from plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEException.java)2
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerFolder.java80
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerRuntimeCache.java26
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEStatusCallback.java (renamed from plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEStatusCallback.java)0
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OseeLogStatusCallback.java39
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServerApplication.java23
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java8
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java2
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java12
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java2
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/AbstractRuntimeManager.java666
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java9
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java55
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java2
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java2
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java18
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java19
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BatchLog.java54
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java16
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTests.java209
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsHandle.java68
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java25
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java3
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java10
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java2
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ProcessOutfileOverview.java127
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java7
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/Configure.java (renamed from plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/Configure.java)21
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DownloadConfiguration.java40
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEApiImpl.java195
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java262
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFolderImpl.java124
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java (renamed from plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java)17
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEServerRuntimeCacheImpl.java218
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java5
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java1
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java60
-rw-r--r--plugins/org.eclipse.osee.ote.parent/pom.xml3
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/BasicProgress.java55
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ConfigurationProgress.java5
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OTECacheItem.java31
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OteClient.java10
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ProgressWithCancel.java9
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/Cancel.java9
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java110
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServerFile.java99
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java8
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java28
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java83
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java112
-rw-r--r--plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/KeyValue.java62
-rw-r--r--plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfiguration.java (renamed from plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfiguration.java)33
-rw-r--r--plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfigurationIdentity.java (renamed from plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfigurationIdentity.java)2
-rw-r--r--plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfigurationItem.java (renamed from plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfigurationItem.java)16
-rw-r--r--plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEJobStatus.java (renamed from plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteJobStatus.java)4
-rw-r--r--plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTETestRun.java62
-rw-r--r--plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/Properties.java88
-rw-r--r--plugins/org.eclipse.osee.ote.rest/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.osee.ote.rest/OSGI-INF/ote.run.tests.component.xml7
-rw-r--r--plugins/org.eclipse.osee.ote.rest/build.properties3
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ConfigurationJobStatus.java18
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/HTMLBuilder.java127
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEConfigItemSort.java14
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEStatusCallbackForRun.java44
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchResource.java197
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchesResource.java71
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationResource.java30
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStore.java12
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStoreImpl.java37
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJob.java4
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobResource.java4
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStore.java4
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStoreImpl.java4
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRestApplication.java5
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRootResource.java100
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommands.java9
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommandsImpl.java28
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResource.java111
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResourceItem.java63
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ReverseAlphabeticalSort.java13
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TestResultSummary.java59
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TimeSort.java21
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TranslateUtil.java32
-rw-r--r--plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ZIPGenerator.java57
-rw-r--r--plugins/org.eclipse.osee.ote.runtimeManager/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/OTEBuilderResourceFinder.java53
-rw-r--r--plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java3
-rw-r--r--plugins/org.eclipse.osee.ote.server/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.runtime.manager.xml8
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/EnvironmentCreationParameter.java7
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java42
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java8
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java39
-rw-r--r--plugins/org.eclipse.osee.ote.test/META-INF/MANIFEST.MF11
-rw-r--r--plugins/org.eclipse.osee.ote.test/pom.xml35
-rw-r--r--plugins/org.eclipse.osee.ote.test/src/org/eclipse/osee/ote/internal/OTEApiTest.java141
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/.classpath (renamed from plugins/org.eclipse.osee.ote.test/.classpath)0
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/.project (renamed from plugins/org.eclipse.osee.ote.test/.project)2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/META-INF/MANIFEST.MF18
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/build.properties (renamed from plugins/org.eclipse.osee.ote.test/build.properties)2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/plugin.xml57
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/pom.xml (renamed from plugins/org.eclipse.osee.ote/pom.xml)4
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/Activator.java50
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ArchiveBuilder.java93
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/JarPackager.java108
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEBuilderPreferencePage.java65
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingBuilder.java174
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingNature.java81
-rw-r--r--plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ToggleNatureHandler.java130
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java24
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java21
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java10
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java8
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java1
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/OTEBuilderResourceFinder.java43
-rw-r--r--plugins/org.eclipse.osee.ote/.classpath7
-rw-r--r--plugins/org.eclipse.osee.ote/.project33
-rw-r--r--plugins/org.eclipse.osee.ote/META-INF/MANIFEST.MF13
-rw-r--r--plugins/org.eclipse.osee.ote/OSGI-INF/ote.api.component.xml7
-rw-r--r--plugins/org.eclipse.osee.ote/build.properties5
-rw-r--r--plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEApi.java15
-rw-r--r--plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfiguration.java28
-rw-r--r--plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEFuture.java7
-rw-r--r--plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiComponent.java42
-rw-r--r--plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiImpl.java74
-rw-r--r--plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java200
153 files changed, 4760 insertions, 1800 deletions
diff --git a/features/org.eclipse.osee.client.ote.feature/feature.xml b/features/org.eclipse.osee.client.ote.feature/feature.xml
index a128a9b88a..4118856849 100644
--- a/features/org.eclipse.osee.client.ote.feature/feature.xml
+++ b/features/org.eclipse.osee.client.ote.feature/feature.xml
@@ -214,4 +214,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.osee.ote.ui.builder"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/features/org.eclipse.osee.ote.feature/feature.xml b/features/org.eclipse.osee.ote.feature/feature.xml
index 076ec78c80..f4b7e7b2cb 100644
--- a/features/org.eclipse.osee.ote.feature/feature.xml
+++ b/features/org.eclipse.osee.ote.feature/feature.xml
@@ -24,11 +24,5 @@
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.eclipse.osee.ote"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
</feature>
diff --git a/plugins/org.eclipse.osee.framework.ui.workspacebundleloader/src/org/eclipse/osee/framework/ui/workspacebundleloader/BundleInfoLite.java b/plugins/org.eclipse.osee.framework.ui.workspacebundleloader/src/org/eclipse/osee/framework/ui/workspacebundleloader/BundleInfoLite.java
index 5a125e87d1..9da280223f 100644
--- a/plugins/org.eclipse.osee.framework.ui.workspacebundleloader/src/org/eclipse/osee/framework/ui/workspacebundleloader/BundleInfoLite.java
+++ b/plugins/org.eclipse.osee.framework.ui.workspacebundleloader/src/org/eclipse/osee/framework/ui/workspacebundleloader/BundleInfoLite.java
@@ -35,6 +35,7 @@ public class BundleInfoLite {
private final Manifest manifest;
private byte[] md5Digest;
private Bundle bundle;
+
public BundleInfoLite(URL systemLocation) throws IOException {
File tmpFile;
@@ -128,7 +129,6 @@ public class BundleInfoLite {
bundle.uninstall();
}
return bundle;
-
}
public boolean isInstalled() {
diff --git a/plugins/org.eclipse.osee.framework.ui.ws/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.ws/META-INF/MANIFEST.MF
index 9b70f4b156..6ac0768dbc 100644
--- a/plugins/org.eclipse.osee.framework.ui.ws/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.ws/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.osee.framework.jdk.core,
org.eclipse.osee.framework.logging,
org.eclipse.osee.framework.plugin.core,
- org.eclipse.osee.framework.ui.plugin
+ org.eclipse.osee.framework.ui.plugin,
+ org.eclipse.ui.navigator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.framework.ui.ws
diff --git a/plugins/org.eclipse.osee.framework.ui.ws/src/org/eclipse/osee/framework/ui/ws/AWorkspace.java b/plugins/org.eclipse.osee.framework.ui.ws/src/org/eclipse/osee/framework/ui/ws/AWorkspace.java
index b2ec30464a..c35c8fb76f 100644
--- a/plugins/org.eclipse.osee.framework.ui.ws/src/org/eclipse/osee/framework/ui/ws/AWorkspace.java
+++ b/plugins/org.eclipse.osee.framework.ui.ws/src/org/eclipse/osee/framework/ui/ws/AWorkspace.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.ui.ws;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -33,8 +34,10 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.ISetSelectionTarget;
import org.eclipse.ui.views.navigator.IResourceNavigator;
import org.eclipse.ui.views.navigator.ResourceNavigator;
+import org.eclipse.ui.navigator.CommonNavigator;
/**
* @author Donald G. Dunne
@@ -180,6 +183,9 @@ public final class AWorkspace {
} else if (targetPart instanceof IPackagesViewPart) {
IPackagesViewPart navigator = (IPackagesViewPart) targetPart;
return (StructuredSelection) navigator.getTreeViewer().getSelection();
+ } else if (targetPart instanceof CommonNavigator) {
+ CommonNavigator navigator = (CommonNavigator) targetPart;
+ return (StructuredSelection) navigator.getCommonViewer().getSelection();
}
return null;
}
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java
index cc1d415d46..7363287137 100644
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java
+++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java
@@ -105,7 +105,7 @@ public class ClientSession extends AbstractRemoteSession {
try {
sessionDelegate.handleInformationPrompt(message);
} catch (Exception ex) {
- throw new RemoteException("exception initiating prompt", ex);
+ System.out.println(message);
}
}
diff --git a/plugins/org.eclipse.osee.ote.connection.jini/src/org/eclipse/osee/ote/connection/jini/Activator.java b/plugins/org.eclipse.osee.ote.connection.jini/src/org/eclipse/osee/ote/connection/jini/Activator.java
index 0dd5153562..d7ae023872 100644
--- a/plugins/org.eclipse.osee.ote.connection.jini/src/org/eclipse/osee/ote/connection/jini/Activator.java
+++ b/plugins/org.eclipse.osee.ote.connection.jini/src/org/eclipse/osee/ote/connection/jini/Activator.java
@@ -12,6 +12,8 @@ package org.eclipse.osee.ote.connection.jini;
import java.util.logging.Level;
+import net.jini.config.ConfigurationException;
+
import org.eclipse.core.runtime.Plugin;
import org.eclipse.osee.connection.service.IConnectionService;
import org.eclipse.osee.framework.jini.JiniClassServer;
@@ -58,27 +60,39 @@ public class Activator extends Plugin {
}
void startJini() throws Exception {
- try {
- JiniClassServer.getInstance().addResourceFinder(new FrameworkResourceFinder());
- } catch (Exception e) {
- e.printStackTrace();
- }
- BundleContext context = getBundle().getBundleContext();
- connectionServiceTracker = new ServiceTracker(context, IConnectionService.class.getName(), null);
- connectionServiceTracker.open();
-
- packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
- packageAdminTracker.open();
-
- PackageAdmin pa = (PackageAdmin) packageAdminTracker.getService();
-
- exportClassLoader = new ExportClassLoader(pa);
- IConnectionService service = (IConnectionService) connectionServiceTracker.getService();
-
- registrar = new JiniConnectorRegistrar(exportClassLoader, service);
-
- // register the service
- registration = context.registerService(IJiniConnectorRegistrar.class.getName(), registrar, null);
+ Thread startJini = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ JiniClassServer.getInstance().addResourceFinder(new FrameworkResourceFinder());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ BundleContext context = getBundle().getBundleContext();
+ connectionServiceTracker = new ServiceTracker(context, IConnectionService.class.getName(), null);
+ connectionServiceTracker.open();
+
+ packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+ packageAdminTracker.open();
+
+ PackageAdmin pa = (PackageAdmin) packageAdminTracker.getService();
+
+ exportClassLoader = new ExportClassLoader(pa);
+ IConnectionService service = (IConnectionService) connectionServiceTracker.getService();
+
+ try {
+ registrar = new JiniConnectorRegistrar(exportClassLoader, service);
+ registration = context.registerService(IJiniConnectorRegistrar.class.getName(), registrar, null);
+ } catch (ConfigurationException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ startJini.setDaemon(true);
+ startJini.setName("Starting Jini");
+ startJini.start();
}
@Override
diff --git a/plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF
index 2c9fb7c4b8..25b39b6597 100644
--- a/plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Version: 0.17.0.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
Fragment-Host: org.eclipse.osee.ote.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.junit
+Require-Bundle: org.junit,
+ org.eclipse.equinox.ds
Export-Package: org.eclipse.osee.ote.core.framework
Import-Package: org.mockito,
org.mockito.stubbing
diff --git a/plugins/org.eclipse.osee.ote.test/data/loading.test1.jar b/plugins/org.eclipse.osee.ote.core.test/data/loading.test1.jar
index 0e6549aaa3..0e6549aaa3 100644
--- a/plugins/org.eclipse.osee.ote.test/data/loading.test1.jar
+++ b/plugins/org.eclipse.osee.ote.core.test/data/loading.test1.jar
Binary files differ
diff --git a/plugins/org.eclipse.osee.ote.test/data/loading.test2.jar b/plugins/org.eclipse.osee.ote.core.test/data/loading.test2.jar
index dac01e7d2a..dac01e7d2a 100644
--- a/plugins/org.eclipse.osee.ote.test/data/loading.test2.jar
+++ b/plugins/org.eclipse.osee.ote.core.test/data/loading.test2.jar
Binary files differ
diff --git a/plugins/org.eclipse.osee.ote.test/data/loading.test3.jar b/plugins/org.eclipse.osee.ote.core.test/data/loading.test3.jar
index ccd4c16226..ccd4c16226 100644
--- a/plugins/org.eclipse.osee.ote.test/data/loading.test3.jar
+++ b/plugins/org.eclipse.osee.ote.core.test/data/loading.test3.jar
Binary files differ
diff --git a/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/OTEApiTest.java b/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/OTEApiTest.java
new file mode 100644
index 0000000000..9f811b76cf
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/OTEApiTest.java
@@ -0,0 +1,226 @@
+package org.eclipse.osee.ote;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.concurrent.Future;
+
+import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil;
+import org.eclipse.osgi.framework.internal.core.BundleFragment;
+import org.eclipse.osgi.framework.internal.core.BundleHost;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+@SuppressWarnings("restriction")
+public class OTEApiTest {
+
+ private OTEApi oteApi;
+
+ @Before
+ public void setup(){
+ BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
+ ServiceReference<OTEApi> ref = context.getServiceReference(OTEApi.class);
+ Assert.assertNotNull(ref);
+ oteApi = context.getService(ref);
+ Assert.assertNotNull(oteApi);
+ }
+
+ @Test
+ public void testConfigurationLoading() throws IOException, Exception {
+ clearJarCache();
+ URL bundle1 = findEntry("data/loading.test1.jar");
+ URL bundle2 = findEntry("data/loading.test2.jar");
+ URL bundle3 = findEntry("data/loading.test3.jar");
+ ConfigurationItem config1 = new ConfigurationItem(bundle1.toString(), "1.0.0", "loading.test1", ChecksumUtil.createChecksumAsString(bundle1.openStream(), "MD5"), true);
+ ConfigurationItem config2 = new ConfigurationItem(bundle2.toString(), "1.0.0", "loading.test2", ChecksumUtil.createChecksumAsString(bundle2.openStream(), "MD5"), true);
+ ConfigurationItem config3 = new ConfigurationItem(bundle3.toString(), "1.0.0", "loading.test3", ChecksumUtil.createChecksumAsString(bundle3.openStream(), "MD5"), true);
+
+ Configuration validConfiguration = new Configuration();
+ validConfiguration.addItem(config1);
+ validConfiguration.addItem(config2);
+ validConfiguration.addItem(config3);
+
+ OTEStatusCallback<ConfigurationStatus> callable = new OTEStatusCallbackForTests<ConfigurationStatus>();
+
+ Future<ConfigurationStatus> statusFuture = oteApi.loadConfiguration(validConfiguration, callable);
+ ConfigurationStatus status = statusFuture.get();
+ Assert.assertTrue(status.isSuccess());
+ Assert.assertEquals(validConfiguration, status.getConfiguration());
+ Assert.assertEquals(validConfiguration, oteApi.getConfiguration().get().getConfiguration());
+
+
+ Bundle bundle = findBundle("loading.test1");
+ Assert.assertNotNull(bundle);
+ Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
+
+ bundle = findBundle("loading.test2");
+ Assert.assertNotNull(bundle);
+ Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
+
+ bundle = findBundle("loading.test3");
+ Assert.assertNotNull(bundle);
+ Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
+
+
+ Future<ConfigurationStatus> resetFeature = oteApi.resetConfiguration(callable);
+ ConfigurationStatus resetStatus = resetFeature.get();
+ Assert.assertTrue(resetStatus.isSuccess());
+ Assert.assertNull(findBundle("loading.test1"));
+ Assert.assertNull(findBundle("loading.test2"));
+ Assert.assertNull(findBundle("loading.test3"));
+
+ Configuration invalidConfiguration = new Configuration();
+ invalidConfiguration.addItem(config1);
+ invalidConfiguration.addItem(config3);
+ Future<ConfigurationStatus> failStatusFuture = oteApi.loadConfiguration(invalidConfiguration, callable);
+ ConfigurationStatus failStatus = failStatusFuture.get();
+ Assert.assertFalse(failStatus.isSuccess());
+ System.out.println(failStatus.getMessage());
+ Assert.assertNull(findBundle("loading.test1"));
+ Assert.assertNull(findBundle("loading.test2"));
+ Assert.assertNull(findBundle("loading.test3"));
+
+ //test the doing load case
+ Future<ConfigurationStatus> good = oteApi.loadConfiguration(validConfiguration, callable);
+ Future<ConfigurationStatus> bad = oteApi.loadConfiguration(validConfiguration, callable);
+
+ ConfigurationStatus goodStatus = good.get();
+ ConfigurationStatus badStatus = bad.get();
+ Assert.assertTrue(goodStatus.isSuccess());
+ Assert.assertFalse(badStatus.isSuccess());
+ System.out.println(badStatus.getMessage());
+
+ //test already configured
+ bad = oteApi.loadConfiguration(validConfiguration, callable);
+ badStatus = bad.get();
+ Assert.assertFalse(badStatus.isSuccess());
+ System.out.println(badStatus.getMessage());
+ }
+
+ @Test
+ public void testJarAcquire() throws IOException, Exception {
+ clearJarCache();
+ URL bundle1 = findEntry("data/loading.test1.jar");
+ URL bundle2 = findEntry("data/loading.test2.jar");
+ URL bundle3 = findEntry("data/loading.test3.jar");
+ ConfigurationItem config1 = new ConfigurationItem(bundle1.toString(), "1.0.0", "loading.test1", ChecksumUtil.createChecksumAsString(bundle1.openStream(), "MD5"), true);
+ ConfigurationItem config2 = new ConfigurationItem(bundle2.toString(), "1.0.0", "loading.test2", ChecksumUtil.createChecksumAsString(bundle2.openStream(), "MD5"), true);
+ ConfigurationItem config3 = new ConfigurationItem(bundle3.toString(), "1.0.0", "loading.test3", ChecksumUtil.createChecksumAsString(bundle3.openStream(), "MD5"), true);
+
+ Configuration validConfiguration = new Configuration();
+ validConfiguration.addItem(config1);
+ validConfiguration.addItem(config2);
+ validConfiguration.addItem(config3);
+
+ OTEStatusCallback<ConfigurationStatus> callable = new OTEStatusCallbackForTests<ConfigurationStatus>();
+
+ Future<ConfigurationStatus> statusFuture = oteApi.downloadConfigurationJars(validConfiguration, callable);
+ ConfigurationStatus status = statusFuture.get();
+ Assert.assertTrue(status.isSuccess());
+ OTEServerRuntimeCache cache = oteApi.getRuntimeCache();
+ Assert.assertNotNull(cache.get(config1.getSymbolicName(), config1.getMd5Digest()));
+ Assert.assertNotNull(cache.get(config2.getSymbolicName(), config2.getMd5Digest()));
+ Assert.assertNotNull(cache.get(config3.getSymbolicName(), config3.getMd5Digest()));
+
+ Assert.assertNull(cache.get(config1.getSymbolicName(), config2.getMd5Digest()));
+ Assert.assertNull(cache.get(config2.getSymbolicName(), config3.getMd5Digest()));
+ Assert.assertNull(cache.get(config3.getSymbolicName(), config1.getMd5Digest()));
+
+ //test failure to download
+ clearJarCache();
+ ConfigurationItem config4 = new ConfigurationItem("file://this/file/does/not/exist/2351.jar", "1.0.0", "loading.test11", ChecksumUtil.createChecksumAsString(bundle1.openStream(), "MD5"), true);
+ Configuration invalidConfiguration = new Configuration();
+ invalidConfiguration.addItem(config4);
+ statusFuture = oteApi.downloadConfigurationJars(invalidConfiguration, callable);
+ status = statusFuture.get();
+ Assert.assertFalse(status.isSuccess());
+
+
+// Assert.assertEquals(validConfiguration, status.getConfiguration());
+// Assert.assertEquals(validConfiguration, oteApi.getConfiguration().get().getConfiguration());
+
+
+// Bundle bundle = findBundle("loading.test1");
+// Assert.assertNotNull(bundle);
+// Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
+//
+// bundle = findBundle("loading.test2");
+// Assert.assertNotNull(bundle);
+// Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
+//
+// bundle = findBundle("loading.test3");
+// Assert.assertNotNull(bundle);
+// Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
+
+
+// Future<ConfigurationStatus> resetFeature = oteApi.resetConfiguration(callable);
+// ConfigurationStatus resetStatus = resetFeature.get();
+// Assert.assertTrue(resetStatus.isSuccess());
+// Assert.assertNull(findBundle("loading.test1"));
+// Assert.assertNull(findBundle("loading.test2"));
+// Assert.assertNull(findBundle("loading.test3"));
+
+// Configuration invalidConfiguration = new Configuration();
+// invalidConfiguration.addItem(config1);
+// invalidConfiguration.addItem(config3);
+// Future<ConfigurationStatus> failStatusFuture = oteApi.loadConfiguration(invalidConfiguration, callable);
+// ConfigurationStatus failStatus = failStatusFuture.get();
+// Assert.assertFalse(failStatus.isSuccess());
+// System.out.println(failStatus.getMessage());
+// Assert.assertNull(findBundle("loading.test1"));
+// Assert.assertNull(findBundle("loading.test2"));
+// Assert.assertNull(findBundle("loading.test3"));
+//
+// //test the doing load case
+// Future<ConfigurationStatus> good = oteApi.loadConfiguration(validConfiguration, callable);
+// Future<ConfigurationStatus> bad = oteApi.loadConfiguration(validConfiguration, callable);
+//
+// ConfigurationStatus goodStatus = good.get();
+// ConfigurationStatus badStatus = bad.get();
+// Assert.assertTrue(goodStatus.isSuccess());
+// Assert.assertFalse(badStatus.isSuccess());
+// System.out.println(badStatus.getMessage());
+//
+// //test already configured
+// bad = oteApi.loadConfiguration(validConfiguration, callable);
+// badStatus = bad.get();
+// Assert.assertFalse(badStatus.isSuccess());
+// System.out.println(badStatus.getMessage());
+ }
+
+ private void clearJarCache() {
+ oteApi.getRuntimeCache().clearJarCache();
+ }
+
+ private Bundle findBundle(String symbolicName){
+ Bundle[] bundles = FrameworkUtil.getBundle(OTEApiTest.class).getBundleContext().getBundles();
+ for(Bundle bundle:bundles){
+ if(bundle.getSymbolicName().equals(symbolicName)){
+ return bundle;
+ }
+ }
+ return null;
+ }
+
+ private URL findEntry(String path){
+ URL url = null;
+ Bundle bundle = FrameworkUtil.getBundle(OTEApiTest.class);
+ url = bundle.getEntry(path);
+ if(url == null && bundle instanceof BundleHost){
+ BundleFragment[] fragments = ((BundleHost)bundle).getFragments();
+ for(BundleFragment fragment: fragments){
+ url = fragment.getEntry(path);
+ if(url != null){
+ break;
+ }
+ }
+ }
+ Assert.assertNotNull(url);
+ return url;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.test/src/org/eclipse/osee/ote/internal/OTEStatusCallbackForTests.java b/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/OTEStatusCallbackForTests.java
index a11c913464..73d78edae8 100644
--- a/plugins/org.eclipse.osee.ote.test/src/org/eclipse/osee/ote/internal/OTEStatusCallbackForTests.java
+++ b/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/OTEStatusCallbackForTests.java
@@ -1,12 +1,10 @@
-package org.eclipse.osee.ote.internal;
+package org.eclipse.osee.ote;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEStatusCallback;
-public class OTEStatusCallbackForTests<T> implements OTEStatusCallback<OTEConfigurationStatus> {
+public class OTEStatusCallbackForTests<T> implements OTEStatusCallback<ConfigurationStatus> {
@Override
- public void complete(OTEConfigurationStatus done) {
+ public void complete(ConfigurationStatus done) {
System.out.println("done");
}
diff --git a/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF
index f89b1cb3d2..8cd1c30fea 100644
--- a/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF
@@ -4,7 +4,8 @@ Bundle-Name: OSEE Test Core Plug-in (Incubation)
Bundle-SymbolicName: org.eclipse.osee.ote.core;singleton:=true
Bundle-Version: 0.17.0.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
-Export-Package: org.eclipse.osee.ote.core,
+Export-Package: org.eclipse.osee.ote,
+ org.eclipse.osee.ote.core,
org.eclipse.osee.ote.core.annotations,
org.eclipse.osee.ote.core.cmd,
org.eclipse.osee.ote.core.enums,
diff --git a/plugins/org.eclipse.osee.ote.core/OSGI-INF/StatusBoardComponent.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/StatusBoardComponent.xml
index 735a6a3a63..66a3b14288 100644
--- a/plugins/org.eclipse.osee.ote.core/OSGI-INF/StatusBoardComponent.xml
+++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/StatusBoardComponent.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" immediate="true" name="org.eclipse.osee.ote.core">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" immediate="true" name="org.eclipse.osee.ote.core.statusboard">
<implementation class="org.eclipse.osee.ote.core.environment.status.StatusBoard"/>
<reference bind="bindEventAdmin" cardinality="1..1" interface="org.osgi.service.event.EventAdmin" name="EventAdmin" policy="static" unbind="unbindEventAdmin"/>
<service>
diff --git a/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.api.component.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.api.component.xml
new file mode 100644
index 0000000000..2a58ab38e6
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.api.component.xml
@@ -0,0 +1,12 @@
+<?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.ote.api">
+ <implementation class="org.eclipse.osee.ote.internal.OTEApiImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.ote.OTEApi"/>
+ </service>
+ <reference bind="bindRuntimeLibraryManager" cardinality="1..1" interface="org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager" name="IRuntimeLibraryManager" policy="static" unbind="unbindRuntimeLibraryManager"/>
+ <reference bind="bindOTEServerFolder" cardinality="1..1" interface="org.eclipse.osee.ote.OTEServerFolder" name="OTEServerFolder" policy="static" unbind="unbindOTEServerFolder"/>
+ <reference bind="bindOTEServerRuntimeCache" cardinality="1..1" interface="org.eclipse.osee.ote.OTEServerRuntimeCache" name="OTEServerRuntimeCache" policy="static" unbind="unbindOTEServerRuntimeCache"/>
+ <reference bind="bindTestEnvironmentInterface" cardinality="0..1" interface="org.eclipse.osee.ote.core.environment.TestEnvironmentInterface" name="TestEnvironmentInterface" policy="dynamic" unbind="unbindTestEnvironmentInterface"/>
+ <reference bind="bindIModelManager" cardinality="0..1" interface="org.eclipse.osee.ote.core.model.IModelManager" name="IModelManager" policy="dynamic" unbind="unbindIModelManager"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.runtime.manager.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.runtime.manager.xml
new file mode 100644
index 0000000000..1ecc266493
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.runtime.manager.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="org.eclipse.osee.ote.runtimeManager">
+ <implementation class="org.eclipse.osee.ote.internal.OTEBundleLoader"/>
+
+ <reference bind="bindOTEServerRuntimeCache" cardinality="1..1" interface="org.eclipse.osee.ote.OTEServerRuntimeCache" name="OTEServerRuntimeCache" policy="static" unbind="unbindOTEServerRuntimeCache"/> <service>
+ <provide interface="org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.folder.component.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.folder.component.xml
new file mode 100644
index 0000000000..9b49462678
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.folder.component.xml
@@ -0,0 +1,7 @@
+<?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.ote.server.folder">
+ <implementation class="org.eclipse.osee.ote.internal.OTEFolderImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.ote.OTEServerFolder"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.runtime.cache.component.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.runtime.cache.component.xml
new file mode 100644
index 0000000000..838367ed57
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.server.runtime.cache.component.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" immediate="true" name="org.eclipse.osee.ote.server.runtime.cache">
+ <implementation class="org.eclipse.osee.ote.internal.OTEServerRuntimeCacheImpl"/>
+ <reference bind="bindOTEServerFolder" cardinality="1..1" interface="org.eclipse.osee.ote.OTEServerFolder" name="OTEServerFolder" policy="static" unbind="unbindOTEServerFolder"/>
+ <service>
+ <provide interface="org.eclipse.osee.ote.OTEServerRuntimeCache"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.core/build.properties b/plugins/org.eclipse.osee.ote.core/build.properties
index f497f235f2..5ddf3a1885 100644
--- a/plugins/org.eclipse.osee.ote.core/build.properties
+++ b/plugins/org.eclipse.osee.ote.core/build.properties
@@ -3,5 +3,7 @@ bin.includes = plugin.xml,\
META-INF/,\
images/,\
.,\
- OSGI-INF/
+ OSGI-INF/,\
+ OSGI-INF/ote.server.runtime.cache.component.xml,\
+ OSGI-INF/ote.server.folder.component.xml
source.. = src/
diff --git a/plugins/org.eclipse.osee.ote.core/plugin.xml b/plugins/org.eclipse.osee.ote.core/plugin.xml
index 0bac272c21..16406f2405 100644
--- a/plugins/org.eclipse.osee.ote.core/plugin.xml
+++ b/plugins/org.eclipse.osee.ote.core/plugin.xml
@@ -20,4 +20,29 @@
point="org.eclipse.osee.framework.jini.JiniInterface">
<RegisterBundle/>
</extension>
+ <extension
+ id="server"
+ name="OTE Server"
+ point="org.eclipse.core.runtime.applications">
+ <application
+ cardinality="singleton-global"
+ thread="main"
+ visible="true">
+ <run
+ class="org.eclipse.osee.ote.core.ServerApplication">
+ </run>
+ </application>
+ </extension>
+ <extension
+ id="server"
+ point="org.eclipse.core.runtime.products">
+ <product
+ application="org.eclipse.osee.ote.core.server"
+ name="ote.server">
+ <property
+ name="appName"
+ value="ote.server">
+ </property>
+ </product>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/Configuration.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/Configuration.java
new file mode 100644
index 0000000000..82ba43a902
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/Configuration.java
@@ -0,0 +1,28 @@
+package org.eclipse.osee.ote;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This defines the bundles to be loaded into the OTE Server.
+ *
+ * @author Andrew M. Finkbeiner
+ *
+ */
+public class Configuration {
+
+ private ArrayList<ConfigurationItem> items;
+
+ public Configuration() {
+ items = new ArrayList<ConfigurationItem>();
+ }
+
+ public List<ConfigurationItem> getItems() {
+ return items;
+ }
+
+ public void addItem(ConfigurationItem config) {
+ items.add(config);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfigurationItem.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationItem.java
index e128db447f..2c43587031 100644
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfigurationItem.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationItem.java
@@ -6,20 +6,25 @@ package org.eclipse.osee.ote;
* @author Andrew M. Finkbeiner
*
*/
-public class OTEConfigurationItem {
+public class ConfigurationItem {
private String url;
private String version;
private String symbolicName;
private String md5;
+ private boolean isOsgiBundle;
- public OTEConfigurationItem(String url, String version, String symbolicName, String md5) {
+ public ConfigurationItem(String url, String version, String symbolicName, String md5, boolean isOsgiBundle) {
this.url = url;
this.version = version;
this.symbolicName = symbolicName;
this.md5 = md5;
}
+ public boolean isOsgiBundle() {
+ return isOsgiBundle;
+ }
+
public String getSymbolicName() {
return symbolicName;
}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfigurationStatus.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatus.java
index 2d936ec071..8a537147d0 100644
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfigurationStatus.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatus.java
@@ -1,12 +1,12 @@
package org.eclipse.osee.ote;
-public class OTEConfigurationStatus {
+public class ConfigurationStatus {
- private OTEConfiguration configuration;
+ private Configuration configuration;
private boolean success;
private String message;
- public OTEConfigurationStatus(OTEConfiguration configuration, boolean success, String message) {
+ public ConfigurationStatus(Configuration configuration, boolean success, String message) {
this.configuration = configuration;
this.success = success;
this.message = message;
@@ -25,7 +25,7 @@ public class OTEConfigurationStatus {
return message;
}
- public OTEConfiguration getConfiguration(){
+ public Configuration getConfiguration(){
return configuration;
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEApi.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEApi.java
new file mode 100644
index 0000000000..394fa0b8c2
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEApi.java
@@ -0,0 +1,114 @@
+package org.eclipse.osee.ote;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface;
+import org.eclipse.osee.ote.core.model.IModelManager;
+
+/**
+ * This is an API that exposes some of the key test environment interfaces and operations. It is expected
+ * that clients of OTE will operate either directly through this API or indirectly using a remote REST or
+ * Event API that makes use of this API.
+ *
+ * @author Andrew M. Finkbeiner
+ *
+ */
+public interface OTEApi {
+
+ /**
+ * Returns the OTEServerFolder service that enables management of the ote server folder area on
+ * the machine local to the server.
+ *
+ * @return the OTEServerFolder service
+ */
+ OTEServerFolder getServerFolder();
+
+ /**
+ * Returns the OTEServerJarCache that can be used for saving and getting files from the local
+ * ote server data store.
+ *
+ * @return the OTEServerJarCache service
+ */
+ OTEServerRuntimeCache getRuntimeCache();
+
+ /**
+ * Returns the IModelManager service that will give access to generic model controls. It depends on the TestEnvironmentInterface exisiting or it
+ * will be a null value.
+ *
+ * @return null or a valid IModelManager service
+ */
+ IModelManager getModelManager();
+
+ /**
+ * Returns the TestEnvironmentInterface service that is a top level object for interacting with the
+ * environment. It depends on a valid TestEnvironmentInterface getting registered. If we do not
+ * have a valid test environment it will return null. Generally a valid test environment will exist
+ * as long as a configuration has been loaded, this can happen if a user connects to a shell server
+ * or if we have an RCP that contains all the required startup information and bundles.
+ *
+ * @return null or a valid TestEnvironmentInterface service
+ */
+ TestEnvironmentInterface getTestEnvironment();
+
+
+ /**
+ * This method will make sure that the requested configuration is available to the server and then install them.
+ * Only jars that are proper OSGI bundles will be loaded. This also means that if configuration items are
+ * not currently available to the server it will acquire them from the client using the URL in the configuration item.
+ *
+ * @param configuration
+ * @param callable
+ * @return
+ * @throws InterruptedException
+ * @throws ExecutionException
+ */
+ Future<ConfigurationStatus> loadConfiguration(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException;
+
+ /**
+ * This method will uninstall the previous bundle configuration.
+ *
+ * @param callable
+ * @return
+ * @throws InterruptedException
+ * @throws ExecutionException
+ */
+ Future<ConfigurationStatus> resetConfiguration(OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException;
+
+ /**
+ * Gets the current test environment configuration.
+ *
+ * @return
+ */
+ Future<ConfigurationStatus> getConfiguration();
+
+ /**
+ * This method will make all bundles defined in the configuration available to the server. This means the server will attempt to use the URL in the configuration item
+ * to download any bundles not currently in its cache.
+ *
+ * @param configuration
+ * @param callable
+ * @return
+ * @throws InterruptedException
+ * @throws ExecutionException
+ */
+ Future<ConfigurationStatus> downloadConfigurationJars(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException;
+
+ /**
+ * Attempt to load a class from currently installed bundles and then from the script classpath.
+ *
+ * @param clazz
+ * @return the requested Class
+ * @throws ClassNotFoundException
+ */
+ Class<?> loadFromScriptClassLoader(String clazz) throws ClassNotFoundException;
+
+ /**
+ * Attempt to load a class from any currently installed bundled.
+ *
+ * @param clazz
+ * @return the requested Class
+ * @throws ClassNotFoundException
+ */
+ Class<?> loadFromRuntimeLibraryLoader(String clazz) throws ClassNotFoundException;
+}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEException.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEException.java
index a9d2ffee04..ed73660d46 100644
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEException.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEException.java
@@ -1,6 +1,6 @@
package org.eclipse.osee.ote;
-public class OTEException extends Exception {
+public class OTEException extends RuntimeException {
private static final long serialVersionUID = 8430838531056913404L;
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerFolder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerFolder.java
new file mode 100644
index 0000000000..5226dce876
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerFolder.java
@@ -0,0 +1,80 @@
+package org.eclipse.osee.ote;
+
+import java.io.File;
+
+/**
+ * This class is used to help manage the OTE Server Folder area. This includes the runtime cache and
+ * the batches area.
+ *
+ * @author Andrew M. Finkbeiner
+ *
+ */
+public interface OTEServerFolder {
+
+ /**
+ * This class will clean out all batch folders that have been marked for delete. It
+ * will not clean out sub-folders so if those exist the folder will not be completely
+ * removed.
+ */
+ public void cleanOldBatchFolders();
+
+ public File getServerFolder();
+
+ /**
+ * This is the root folder for all batch folders.
+ *
+ * @return
+ */
+ public File getBatchesFolder();
+
+ public File getCacheFolder();
+
+ /**
+ * This is the batch log file that contains all LEVEL.SEVERE and above log events that happened during
+ * a batch.
+ *
+ * @param batchFolder
+ * @return
+ */
+ public File getBatchLogFile(File batchFolder);
+
+ /**
+ * Generates a new File at the batches root folder with the current time as it's name. This method does
+ * not call mkdirs.
+ *
+ * @return
+ */
+ public File getNewBatchFolder();
+
+ public void markFolderForDelete(File folder);
+
+ public void unmarkFolderForDelete(File folder);
+
+ /**
+ * Returns a file that is the results summary of the given outfile. The format of the returned file
+ * if it has content is: <script name>,<results string>,<elapsed time>. There is no guarantee that the
+ * returned file exists or that it has any data, the user must check for existence and validity.
+ *
+ * @param outfile
+ * @return
+ */
+ public File getResultsFile(File outfile);
+
+ /**
+ * Returns a file that specifies the status of a given batch. Possible values in the file are 'in queue',
+ * 'running', and 'complete'. There is no guarantee that the file exists or that it has any content.
+ *
+ * @param batchFolder
+ * @return
+ */
+ public File getBatchStatusFile(File batchFolder);
+
+ /**
+ * Returns a file tht specifies the runlist of a batch. It will be of the format scripts<newline>scripts<newline>...
+ * There is no guarantee that the file exists or that it has any content.
+ *
+ * @param batchFolder
+ * @return
+ */
+ public File getBatchRunList(File batchFolder);
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerRuntimeCache.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerRuntimeCache.java
new file mode 100644
index 0000000000..1dcb52272f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerRuntimeCache.java
@@ -0,0 +1,26 @@
+package org.eclipse.osee.ote;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Store, find and remove jars that are used when running an OTE test server.
+ *
+ * The format is <pre>
+ * rootFolder/symbolicName/md5.jar - the jar
+ * rootFolder/symbolicName/md5.jar.date - the last time it was accessed
+ * </pre>
+ * @author Andrew M. Finkbeiner
+ *
+ */
+public interface OTEServerRuntimeCache {
+
+ void clearJarCache();
+
+ File save(String symbolicName, String md5Digest, InputStream servedBundleIn) throws IOException;
+
+ File get(String symbolicName, String md5Digest) throws FileNotFoundException;
+
+}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEStatusCallback.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEStatusCallback.java
index 28a15115b6..28a15115b6 100644
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEStatusCallback.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEStatusCallback.java
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OseeLogStatusCallback.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OseeLogStatusCallback.java
new file mode 100644
index 0000000000..d33f6413b9
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OseeLogStatusCallback.java
@@ -0,0 +1,39 @@
+package org.eclipse.osee.ote;
+
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.logging.OseeLog;
+
+public class OseeLogStatusCallback implements OTEStatusCallback<ConfigurationStatus> {
+
+ @Override
+ public void complete(ConfigurationStatus done) {
+ OseeLog.log(getClass(), Level.INFO, done.getMessage());
+ }
+
+ @Override
+ public void setTotalUnitsOfWork(int totalUnitsOfWork) {
+
+ }
+
+ @Override
+ public void incrememtUnitsWorked(int count) {
+
+ }
+
+ @Override
+ public void log(String message) {
+ OseeLog.log(getClass(), Level.INFO, message);
+ }
+
+ @Override
+ public void error(String message, Throwable th) {
+ OseeLog.log(getClass(), Level.SEVERE, message, th);
+ }
+
+ @Override
+ public void error(String message) {
+ OseeLog.log(getClass(), Level.SEVERE, message);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServerApplication.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServerApplication.java
new file mode 100644
index 0000000000..3b1f5db576
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServerApplication.java
@@ -0,0 +1,23 @@
+package org.eclipse.osee.ote.core;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+public class ServerApplication implements IApplication {
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ while(true){
+ synchronized (this) {
+ this.wait();
+ }
+ }
+ }
+
+ @Override
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java
index 64bf0772ff..869bafef21 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java
@@ -166,7 +166,6 @@ public abstract class TestScript implements ITimeout {
Collections.synchronizedSet(new HashSet<Class<? extends TestScript>>());
private static final AtomicLong constructed = new AtomicLong(0);
private static final AtomicLong finalized = new AtomicLong(0);
- private final IUserSession userSession;
private final boolean isBatchable;
private final ITestStation testStation;
private CommandDescription cmdDescription;
@@ -196,7 +195,6 @@ public abstract class TestScript implements ITimeout {
public TestScript(TestEnvironment environment, IUserSession callback, ScriptTypeEnum scriptType, boolean isBatchable) {
constructed.incrementAndGet();
this.scriptType = scriptType;
- this.userSession = ServiceUtility.getService(OTESessionManager.class).getActiveUser();
this.isBatchable = isBatchable;
this.isMpLevel = false;
@@ -264,7 +262,7 @@ public abstract class TestScript implements ITimeout {
}
public IUserSession getUserSession() {
- return userSession;
+ return ServiceUtility.getService(OTESessionManager.class).getActiveUser();
}
public TestScript getTestScript() {
@@ -294,9 +292,9 @@ public abstract class TestScript implements ITimeout {
@Override
public void run() {
try {
- userSession.initiateInformationalPrompt(prompt.toString());
+ getUserSession().initiateInformationalPrompt(prompt.toString());
} catch (Exception e) {
- e.printStackTrace();
+ System.out.println(prompt.toString());
}
}
});
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java
index bd0d81486e..7941fc10de 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java
@@ -27,7 +27,7 @@ public class ConsoleOutputJob implements Runnable {
try {
callback.initiateInformationalPrompt(message);
} catch (Throwable e) {
- e.printStackTrace();
+ System.out.println(message);
}
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java
index 99d610c16e..8790ec98cf 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java
@@ -41,6 +41,7 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.messaging.Message;
import org.eclipse.osee.framework.messaging.MessagingGateway;
import org.eclipse.osee.framework.messaging.NodeInfo;
+import org.eclipse.osee.ote.OseeLogStatusCallback;
import org.eclipse.osee.ote.core.GCHelper;
import org.eclipse.osee.ote.core.OseeTestThread;
import org.eclipse.osee.ote.core.OteProperties;
@@ -305,7 +306,8 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest
return getTimerCtrl().setTimerFor(listener, time);
}
- protected void setupOutfileDir(String outfileDir) throws IOException {
+ @Override
+ public void setupOutfileDir(String outfileDir) throws IOException {
if (Strings.isValid(outfileDir)) {
outDir = new File(outfileDir);
if (!outDir.isDirectory()) {
@@ -329,7 +331,7 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest
return;
}
isShutdown = true;
- runtimeManager.cleanup();
+ runtimeManager.uninstall(new OseeLogStatusCallback());
Activator.getInstance().unregisterTestEnvironment();
// here we remove all environment tasks (emulators)
removeAllTasks();
@@ -372,10 +374,10 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest
}
protected void stop() {
- try {
+ try{
myRegistration.unregister();
- } catch (IllegalStateException ex) {
- // Service may have already been unregistered, but we don't care
+ } catch (IllegalStateException ex){
+ //ignore if it's already unregistered
}
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java
index d2fa09ea8e..36897fbd29 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java
@@ -90,4 +90,6 @@ public interface TestEnvironmentInterface {
public IEnvironmentFactory getEnvironmentFactory();
+ void setupOutfileDir(String outfileDir) throws IOException;
+
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/AbstractRuntimeManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/AbstractRuntimeManager.java
deleted file mode 100644
index 7624c63873..0000000000
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/AbstractRuntimeManager.java
+++ /dev/null
@@ -1,666 +0,0 @@
-/*******************************************************************************
- * 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.ote.core.environment.interfaces;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.io.MatchFilter;
-import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamPumper;
-import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader;
-import org.eclipse.osee.ote.core.GCHelper;
-import org.eclipse.osee.ote.core.OseeURLClassLoader;
-import org.eclipse.osee.ote.core.ReturnStatus;
-import org.eclipse.osee.ote.core.environment.BundleConfigurationReport;
-import org.eclipse.osee.ote.core.environment.BundleDescription;
-import org.eclipse.osee.ote.core.environment.BundleResolveException;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.Version;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class AbstractRuntimeManager implements IRuntimeLibraryManager {
-
- private static final String OTE_ACTIVATION_POLICY = "OTE-ActivationPolicy";
- private final Collection<Bundle> installedBundles;
- private final Collection<Bundle> runningBundles;
- private final Map<String, byte[]> bundleNameToMd5Map;
- private final HashMap<String, File> availableJars;
- private ClassLoader runtimeLibraryLoader;
- private URLClassLoader scriptClassLoader;
-
- private volatile boolean cleanUpNeeded = true;
-
- private final BundleContext context;
-
- private PackageAdmin packageAdmin;
-
- public AbstractRuntimeManager() {
- this.context = FrameworkUtil.getBundle(AbstractRuntimeManager.class).getBundleContext();
- this.installedBundles = new LinkedList<Bundle>();
- this.runningBundles = new LinkedList<Bundle>();
- this.availableJars = new HashMap<String, File>(32);
- this.bundleNameToMd5Map = new HashMap<String, byte[]>();
- this.runtimeLibraryLoader = null;
- this.scriptClassLoader = null;
- }
-
- public void bindPackageAdmin(PackageAdmin admin){
- this.packageAdmin = admin;
- }
-
- public void unbindPackageAdmin(PackageAdmin admin){
- this.packageAdmin = null;
- }
-
- private final List<RuntimeLibraryListener> listeners = new ArrayList<RuntimeLibraryListener>();
-
- private String[] currentJarVersions = null;
-
- private URLClassLoader loader = null;
-
- protected URLClassLoader getClassLoader(String[] versions) throws IOException {
-
- ExportClassLoader classLoader = new ExportClassLoader(packageAdmin);
-
- ArrayList<URL> classpaths = new ArrayList<URL>();
- for (String version : versions) {
- File jar = getAvailableJar(version);
- if (jar != null) {
- classpaths.add(jar.toURI().toURL());
- } else {
- OseeLog.log(AbstractRuntimeManager.class, Level.FINE, "The null jar file for version " + version);
- }
- }
- loader =
- new OseeURLClassLoader("Runtime Library ClassLoader", classpaths.toArray(new URL[classpaths.size()]),
- classLoader);
-
- return loader;
- }
-
- protected URLClassLoader getLoader() {
- return loader;
- }
-
- @Override
- public boolean isMessageJarAvailable(String version) {
- boolean retVal = false;
-
- // For efficiency, first check the already known available Jars.
- // If the desired version is not available, then update that list
- // and check it again.
- if (availableJars.containsKey(version)) {
- retVal = true;
- } else {
- updateAvailableJars();
- if (availableJars.containsKey(version)) {
- retVal = true;
- }
- }
-
- return retVal;
- }
-
- //TODO MAKE SURE TO CHECK BUNDLE STATE IS RESOLVED OR ACTIVE
- @Override
- public boolean isBundleAvailable(String symbolicName, String version, byte[] md5Digest) {
- Bundle installedBundle = Platform.getBundle(symbolicName);
- if (installedBundle != null && !installedBundles.contains(installedBundle)) {
- return true;
- } else {
- Bundle[] bundles = Platform.getBundles(symbolicName, version);
- if (bundles == null) {
- return false;
- }
- for (Bundle bundle : bundles) {
- String bundleSymbolicName = bundle.getSymbolicName();
- if (bundleSymbolicName.equals(symbolicName) && bundle.getHeaders().get("Bundle-Version").equals(version)) {
- if (bundleNameToMd5Map.containsKey(bundleSymbolicName)) {
- // check for bundle binary equality
- if (Arrays.equals(bundleNameToMd5Map.get(bundleSymbolicName), md5Digest)) {
- return true;
- }
- } else {
- // we do not have a md5 hash for this bundle so we need to create one
- try {
- InputStream in = new FileInputStream(FileLocator.getBundleFile(bundle));
- try {
- byte[] digest = ChecksumUtil.createChecksum(in, "MD5");
- if (Arrays.equals(digest, md5Digest)) {
- bundleNameToMd5Map.put(bundle.getSymbolicName(), digest);
- return true;
- }
- } finally {
- in.close();
- }
- } catch (Exception e) {
- OseeLog.log(AbstractRuntimeManager.class, Level.SEVERE,
- "could not determine binary equality of bundles", e);
- }
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public BundleConfigurationReport checkBundleConfiguration(Collection<BundleDescription> bundles) throws Exception {
- List<BundleDescription> missing = new ArrayList<BundleDescription>();
- List<BundleDescription> versionMismatch = new ArrayList<BundleDescription>();
- List<BundleDescription> partOfInstallation = new ArrayList<BundleDescription>();
- for (BundleDescription bundleDescription : bundles) {
- boolean exists = false;
- for (Bundle bundle : runningBundles) {
- String bundleSymbolicName = bundle.getSymbolicName();
- if (bundleSymbolicName.equals(bundleDescription.getSymbolicName())) {
- exists = true;
- if (bundleNameToMd5Map.containsKey(bundleSymbolicName)) {
- if (bundle.getHeaders().get("Bundle-Version").equals(bundleDescription.getVersion()) && Arrays.equals(
- bundleNameToMd5Map.get(bundleSymbolicName), bundleDescription.getMd5Digest())) {
-
- } else {
- versionMismatch.add(bundleDescription);
- }
- } else {
- versionMismatch.add(bundleDescription);
- }
- }
- }
- if (!exists) {
- Bundle bundle = Platform.getBundle(bundleDescription.getSymbolicName());
- if (bundle == null) {
- missing.add(bundleDescription);
- } else {
- partOfInstallation.add(bundleDescription);
- }
- }
- }
- return new BundleConfigurationReport(missing, versionMismatch, partOfInstallation);
- }
-
- @Override
- public void loadBundles(Collection<BundleDescription> bundles) throws Exception {
- cleanUpNeeded = true;
- for (BundleDescription bundleDescription : bundles) {
-
- String bundleName = bundleDescription.getSymbolicName();
- try {
-
- boolean exists = false;
-
- for (Bundle bundle : runningBundles) {
- if (bundle.getSymbolicName().equals(bundleName)) {
- bundle.update();
- exists = true;
- break;
- }
- }
-
- if (!exists) {
- Bundle bundle = Platform.getBundle(bundleDescription.getSymbolicName());
- if (bundle == null) {
- Bundle installedBundle;
- if (bundleDescription.isLocalFile()) {
- installedBundle = context.installBundle(bundleDescription.getLocation());
- } else {
- InputStream bundleData = getBundleInputStream(bundleDescription);
- installedBundle = context.installBundle("OTE-" + bundleName, bundleData);
- bundleData.close();
- }
- bundleNameToMd5Map.put(bundleName, bundleDescription.getMd5Digest());
- installedBundles.add(installedBundle);
- }
- }
-
- } catch (Throwable th) {
- OseeLog.logf(AbstractRuntimeManager.class, Level.SEVERE, th, "Unable to load [%s].", bundleName);
- }
- }
-
- if (runtimeLibraryLoader == null) {
- runtimeLibraryLoader = getClassLoader(new String[0]);
- }
- scriptClassLoader =
- new OseeURLClassLoader("Script ClassLoader", Lib.getUrlFromString(new String[] {""}),
- this.runtimeLibraryLoader);
- transitionInstalledBundles();
- }
-
- private InputStream getBundleInputStream(BundleDescription bundleDescription) throws IOException {
- if (bundleDescription.isSystemLibrary()) {
- return acquireSystemLibraryStream(bundleDescription);
- } else {
- return acquireUserLibraryStream(bundleDescription);
- }
- }
-
- private InputStream acquireUserLibraryStream(BundleDescription bundleDescription) throws IOException {
- return bundleDescription.getBundleData();
- }
-
- private InputStream acquireSystemLibraryStream(BundleDescription bundleDescription) throws IOException {
- try {
- File dir = getJarCache();
- File anticipatedJarFile =
- new File(dir, bundleDescription.getSymbolicName() + "_" + bundleDescription.getVersion() + ".jar");
-
- ensureJarFileOnDisk(bundleDescription, anticipatedJarFile);
-
- OseeLog.logf(AbstractRuntimeManager.class, Level.FINEST,
- "Looking for [%s] on disk.", anticipatedJarFile.getAbsolutePath());
-
- return new FileInputStream(anticipatedJarFile);
- } catch (Exception ex) {
- OseeLog.log(
- AbstractRuntimeManager.class,
- Level.WARNING,
- "Failed to acquire system lib from cache. " + "Fell back to direct acquisition from server with out caching",
- ex);
-
- return bundleDescription.getBundleData();
- }
- }
-
- private void ensureJarFileOnDisk(BundleDescription bundleDescription, File anticipatedJarFile) throws IOException, FileNotFoundException, NoSuchAlgorithmException {
- // assume MD5 matches until we can check the file
- boolean md5Matches = true;
-
- if (anticipatedJarFile.exists()) {
- InputStream in = new FileInputStream(anticipatedJarFile);
- byte[] diskMd5Digest = ChecksumUtil.createChecksum(in, "MD5");
- in.close();
-
- md5Matches = Arrays.equals(diskMd5Digest, bundleDescription.getMd5Digest());
- }
-
- if (!md5Matches || !anticipatedJarFile.exists()) {
- InputStream servedBundleIn = bundleDescription.getBundleData();
- OutputStream cachedFileOut = new FileOutputStream(anticipatedJarFile);
-
- StreamPumper.pumpData(servedBundleIn, cachedFileOut);
-
- cachedFileOut.close();
- servedBundleIn.close();
- }
- }
-
- private void initClassloadersWithNoURLs() {
- if (runtimeLibraryLoader == null && scriptClassLoader == null) {
- try {
- runtimeLibraryLoader = getClassLoader(new String[0]);
- scriptClassLoader =
- new OseeURLClassLoader("Script ClassLoader", Lib.getUrlFromString(new String[] {""}),
- this.runtimeLibraryLoader);
- } catch (IOException ex) {
- OseeLog.log(AbstractRuntimeManager.class, Level.SEVERE, ex);
- }
- }
- }
-
- @Override
- public void updateBundles(Collection<BundleDescription> bundles) throws BundleException, IOException {
- for (BundleDescription bundle : bundles) {
- for (Bundle runningBundle : runningBundles) {
- if (runningBundle.getSymbolicName().equals(bundle.getSymbolicName())) {
- InputStream bundleData = getBundleInputStream(bundle);
- runningBundle.update(bundleData);
- bundleData.close();
- bundleNameToMd5Map.put(bundle.getSymbolicName(), bundle.getMd5Digest());
- }
- }
- }
-
- packageAdmin.refreshPackages(null);
- try {
- Thread.sleep(10000);
- } catch (InterruptedException ex) {
- }
- }
-
- /**
- * checks the file system for new jar files
- */
- private void updateAvailableJars() {
- File dir = getJarCache();
- File[] files = dir.listFiles(new MatchFilter(".*\\.jar"));
- if (files == null) {
- System.out.println("path=[" + dir.getAbsolutePath() + "]");
- return;
- }
- for (File file : files) {
- try {
- String version = Lib.getJarFileVersion(file.getAbsolutePath());
- availableJars.put(version, file);
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
- }
-
- private File getJarCache() {
- String path = System.getProperty("user.home") + File.separator + "OTESERVER";
- File jarCache = new File(path, "runtimeCache");
- if (!jarCache.exists()) {
- if (!jarCache.mkdirs()) {
- throw new RuntimeException("Could not create JAR cache at " + jarCache.getAbsolutePath());
- }
- }
- if (!jarCache.isDirectory()) {
- throw new IllegalStateException("the JAR cache is not a directory! Path=" + jarCache.getAbsolutePath());
- }
- return jarCache;
- }
-
- private void transitionInstalledBundles() throws BundleException, BundleResolveException {
- Iterator<Bundle> iter = installedBundles.iterator();
-
- // Make sure that all installed bundles have been resolved so that
- // the export class loader has access to their classes if necessary.
- try {
- resolveBundles();
- } catch (Throwable th) {
- th.printStackTrace();
- OseeLog.log(AbstractRuntimeManager.class, Level.SEVERE, th);
- }
-
- while (iter.hasNext()) {
- Bundle bundle = iter.next();
-
- try {
- String entry = bundle.getHeaders().get("Fragment-Host");
- if(entry == null){
- bundle.start();
- }
-
- // We got here because bundle.start did not exception
- runningBundles.add(bundle);
- } catch (BundleException ex) {
- OseeLog.log(AbstractRuntimeManager.class, Level.SEVERE, ex);
- // throw new BundleException("Error trying to start bundle " + bundle.getSymbolicName() + ": " + ex, ex);
- } finally {
- iter.remove();
- }
- }
- }
-
- private void resolveBundles() throws BundleResolveException {
- // Note: This is done one by one for simpler debugging when some
- // bundles don't resolve
-
- Collection<BundleException> resolveExceptions = new LinkedList<BundleException>();
- Bundle[] bundleArray = new Bundle[1];
- for (Bundle bundle : installedBundles) {
- // Prior calls to resolveBundles may have forced this bundle
- // to resolve so don't waste time recalling the resolve
- if (bundle.getState() != Bundle.INSTALLED) {
- continue;
- }
- bundleArray[0] = bundle;
- boolean resolved = packageAdmin.resolveBundles(bundleArray);
- if (!resolved) {
- try {
- bundle.start();
-
- // If resolve failed then the call to start should have forced a BundleException
- // and this code should never be reached
- OseeLog.log(AbstractRuntimeManager.class, Level.SEVERE,
- "Forced to start bundle " + bundle.getSymbolicName() + " to get it resolved, should never occur!");
- } catch (BundleException ex) {
- resolveExceptions.add(new BundleException(
- "Error trying to resolve bundle " + bundle.getSymbolicName() + ": " + ex, ex));
- }
- }
- }
-
- if (!resolveExceptions.isEmpty()) {
- throw new BundleResolveException("Unable to resolve all runtime bundles", resolveExceptions);
- }
- }
-
- private ReturnStatus checkCurrentJarVersions(String[] jarVersions) {
- computeRunningJarVersions();
- if (this.currentJarVersions == null) {
- return new ReturnStatus("No jar's currently loaded", false);
- }
- List<String> nonMatchingVersions = new ArrayList<String>();
- for (String version : jarVersions) {
- if (Arrays.binarySearch(this.currentJarVersions, version) < 0) {
- nonMatchingVersions.add(version);
- }
- }
- if (nonMatchingVersions.size() > 0) {
- return new ReturnStatus(String.format(
- "Bundle versions [%s] were not found in the currently configured environment that is running with [%s].",
- Arrays.deepToString(nonMatchingVersions.toArray()), Arrays.deepToString(currentJarVersions)), false);
- }
- return new ReturnStatus(String.format("Jar Versions [%s] are already loaded.", Arrays.deepToString(jarVersions)),
- true);
- }
-
- private void computeRunningJarVersions() {
- List<String> versions = new ArrayList<String>();
- for (Bundle bundle : runningBundles) {
- String versionStr =
- OteUtil.generateBundleVersionString((String) bundle.getHeaders().get("Implementation-Version"),
- bundle.getSymbolicName(), (String) bundle.getHeaders().get("Bundle-Version"),
- bundleNameToMd5Map.get(bundle.getSymbolicName()));
- versions.add(versionStr);
- }
- if (versions.size() > 0) {
- currentJarVersions = versions.toArray(new String[versions.size()]);
- Arrays.sort(currentJarVersions);
- }
- }
-
- @Override
- public ReturnStatus isRunningJarVersions(String[] versions) {
- return checkCurrentJarVersions(versions);
- }
-
- @Override
- public void addJarToClassLoader(byte[] jarData) throws IOException {
- File dir = getJarCache();
- File jar = File.createTempFile("runtimeLibrary_", ".jar", dir);
- Lib.writeBytesToFile(jarData, jar);
- availableJars.put(Lib.getJarFileVersion(jar.getAbsolutePath()), jar);
- }
-
- @Override
- public void resetScriptLoader(String[] classPaths) throws Exception {
- cleanUpNeeded = true;
- initClassloadersWithNoURLs();
- if (scriptClassLoader == null) {
- throw new IllegalStateException("Script Class Loader not yet created");
- }
- if (scriptClassLoader != null) {
- // TODO do we need some cleanup here
- }
- scriptClassLoader =
- new OseeURLClassLoader("Script ClassLoader", Lib.getUrlFromString(classPaths), this.runtimeLibraryLoader);
- }
-
- @Override
- public Class<?> loadFromScriptClassLoader(String path) throws ClassNotFoundException {
- cleanUpNeeded = true;
- initClassloadersWithNoURLs();
- if (scriptClassLoader == null) {
- throw new IllegalStateException("Script Class Loader not yet created");
- }
- Class<?> scriptClass = scriptClassLoader.loadClass(path);
- GCHelper.getGCHelper().addRefWatch(scriptClass);
- return scriptClass;
- }
-
- @Override
- public Class<?> loadClass(String name, Version version) throws ClassNotFoundException {
- ExportedPackage[] exportedPackages = packageAdmin.getExportedPackages(getPackageFromClass(name));
- for (ExportedPackage exportedPackage : exportedPackages) {
- Bundle bundle = exportedPackage.getExportingBundle();
- if (bundle.getVersion().equals(version)) {
- return bundle.loadClass(name);
- }
- }
- return null;
- }
-
- private String getPackageFromClass(String clazz) {
- int index = clazz.lastIndexOf(".");
- if (index > 0) {
- return clazz.substring(0, index);
- } else {
- return "";
- }
- }
-
- @Override
- public Class<?> loadFromRuntimeLibraryLoader(String path) throws ClassNotFoundException {
- cleanUpNeeded = true;
- initClassloadersWithNoURLs();
- if (runtimeLibraryLoader == null) {
- throw new IllegalStateException("The message/runtime library loader has not been configured");
- }
- Class<?> clazz = runtimeLibraryLoader.loadClass(path);
- GCHelper.getGCHelper().addRefWatch(clazz);
- return clazz;
- }
-
- @Override
- public void cleanup() {
- if (!cleanUpNeeded) {
- return;
- }
- cleanUpNeeded = false;
-
- for (Bundle bundle : installedBundles) {
- try {
- bundle.uninstall();
- } catch (BundleException ex) {
- OseeLog.log(AbstractRuntimeManager.class, Level.SEVERE, ex);
- }
- }
- installedBundles.clear();
-
- for (Bundle bundle : runningBundles) {
- try {
- bundle.stop();
- bundle.uninstall();
- } catch (BundleException ex) {
- OseeLog.log(AbstractRuntimeManager.class, Level.SEVERE, ex);
- }
- }
- runningBundles.clear();
- bundleNameToMd5Map.clear();
- if (packageAdmin != null) {
- packageAdmin.refreshPackages(null);
- }
-
- runtimeLibraryLoader = null;
- scriptClassLoader = null;
- availableJars.clear();
- }
-
- protected File getAvailableJar(String version) {
- return availableJars.get(version);
- }
-
- @Override
- public Element toXml(Document doc) {
- Element el = doc.createElement("RuntimeVersions");
-
- if (currentJarVersions != null) {
- for (String version : currentJarVersions) {
- Element versionEl = doc.createElement("Version");
- versionEl.appendChild(doc.createTextNode(version));
- el.appendChild(versionEl);
- }
- }
- for (Bundle bundle : runningBundles) {
- String version = (String) bundle.getHeaders().get("Bundle-Version");
- if (version != null) {
- Element versionEl = doc.createElement("Version");
- versionEl.appendChild(doc.createTextNode(bundle.getSymbolicName() + version));
- el.appendChild(versionEl);
- }
- String implVersion = (String) bundle.getHeaders().get("Implementation-Version");
- if (implVersion != null) {
- Element versionEl = doc.createElement("Version");
- versionEl.appendChild(doc.createTextNode(bundle.getSymbolicName() + implVersion));
- el.appendChild(versionEl);
- }
- }
- return el;
- }
-
- @Override
- public void toXml(XMLStreamWriter writer) throws XMLStreamException {
- writer.writeStartElement("RuntimeVersions");
- if (currentJarVersions != null) {
- for (String version : currentJarVersions) {
- XMLStreamWriterUtil.writeElement(writer, "Version", version);
- }
- }
- for (Bundle bundle : runningBundles) {
- String version = (String) bundle.getHeaders().get("Bundle-Version");
- if (version != null) {
- XMLStreamWriterUtil.writeElement(writer, "Version", bundle.getSymbolicName() + version);
- }
- String implVersion = (String) bundle.getHeaders().get("Implementation-Version");
- if (implVersion != null) {
- XMLStreamWriterUtil.writeElement(writer, "Version", bundle.getSymbolicName() + implVersion);
- }
- }
- writer.writeEndElement();
- }
-
- @Override
- public void addRuntimeLibraryListener(RuntimeLibraryListener listener) {
- listeners.add(listener);
- }
-
- @Override
- public void removeRuntimeLibraryListener(RuntimeLibraryListener listener) {
- listeners.remove(listener);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java
index 98cc451857..e0f615f19d 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java
@@ -12,15 +12,12 @@ package org.eclipse.osee.ote.core.environment.interfaces;
import java.rmi.Remote;
import java.rmi.RemoteException;
-import java.util.Collection;
import java.util.UUID;
import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties;
import org.eclipse.osee.framework.messaging.NodeInfo;
import org.eclipse.osee.ote.core.ConnectionRequestResult;
import org.eclipse.osee.ote.core.IRemoteUserSession;
-import org.eclipse.osee.ote.core.environment.BundleConfigurationReport;
-import org.eclipse.osee.ote.core.environment.BundleDescription;
import org.eclipse.osee.ote.core.environment.TestEnvironmentConfig;
/**
@@ -32,9 +29,7 @@ public interface IHostTestEnvironment extends Remote {
ConnectionRequestResult requestEnvironment(IRemoteUserSession session, UUID id, TestEnvironmentConfig config) throws RemoteException;
void disconnect(UUID sessionId) throws RemoteException;
- BundleConfigurationReport checkBundleConfiguration(Collection<BundleDescription> bundles) throws RemoteException;
- void sendRuntimeBundle(Collection<BundleDescription> bundles) throws RemoteException;
- void updateRuntimeBundle(Collection<BundleDescription> bundles) throws RemoteException;
- void cleanupRuntimeBundles() throws RemoteException;
public NodeInfo getBroker() throws RemoteException;
+
+ public String getHttpURL() throws RemoteException;
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java
index 0f267f887c..b90a8d6259 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java
@@ -10,50 +10,35 @@
*******************************************************************************/
package org.eclipse.osee.ote.core.environment.interfaces;
-import java.io.IOException;
-import java.util.Collection;
-import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable;
import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream;
-import org.eclipse.osee.ote.core.ReturnStatus;
-import org.eclipse.osee.ote.core.environment.BundleConfigurationReport;
-import org.eclipse.osee.ote.core.environment.BundleDescription;
-import org.osgi.framework.Version;
-
-public interface IRuntimeLibraryManager extends Xmlizable, XmlizableStream {
- /**
- * @deprecated use isBundleAvailable
- */
- @Deprecated
- boolean isMessageJarAvailable(String version);
-
- boolean isBundleAvailable(String symbolicName, String version, byte[] md5Digest);
-
- ReturnStatus isRunningJarVersions(String[] versions);
-
- void addRuntimeLibraryListener(RuntimeLibraryListener listener);
-
- void removeRuntimeLibraryListener(RuntimeLibraryListener listener);
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.ConfigurationStatus;
+import org.eclipse.osee.ote.OTEStatusCallback;
+
+/**
+ * An interface for
+ *
+ * @author Andrew M. Finkbeiner
+ *
+ */
+public interface IRuntimeLibraryManager extends XmlizableStream {
- /**
- * @deprecated see loadBundle
- */
- @Deprecated
- void addJarToClassLoader(byte[] jarData) throws IOException;
+ Class<?> loadFromScriptClassLoader(String path) throws ClassNotFoundException;
- void loadBundles(Collection<BundleDescription> bundles) throws Exception;
+ Class<?> loadFromRuntimeLibraryLoader(String path) throws ClassNotFoundException;
- BundleConfigurationReport checkBundleConfiguration(Collection<BundleDescription> bundles) throws Exception;
+ boolean installed();
- void updateBundles(Collection<BundleDescription> bundles) throws Exception;
+ boolean uninstall(OTEStatusCallback<ConfigurationStatus> callable);
- void resetScriptLoader(String[] strings) throws Exception;
+ boolean install(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable);
- Class<?> loadFromScriptClassLoader(String path) throws ClassNotFoundException;
+ boolean start(OTEStatusCallback<ConfigurationStatus> callable);
- Class<?> loadClass(String name, Version version) throws ClassNotFoundException;
+ void clearJarCache();
- Class<?> loadFromRuntimeLibraryLoader(String path) throws ClassNotFoundException;
+ boolean acquireBundles(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable);
- void cleanup();
+ void resetScriptLoader(Configuration configuration, String[] strings) throws Exception;
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java
index 5cc0e4dd98..7e998e322b 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java
@@ -26,8 +26,6 @@ public interface ITestEnvironment extends Remote {
Remote getControlInterface(String controlInterfaceID) throws RemoteException;
- ICommandHandle addCommand(ITestServerCommand cmd) throws RemoteException;
-
IRemoteCommandConsole getCommandConsole() throws RemoteException;
public void closeCommandConsole(IRemoteCommandConsole console) throws RemoteException;
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java
index 8f4fe3480f..2adfe48b52 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java
@@ -51,7 +51,7 @@ public class EclipseConsoleWriter extends Writer {
try {
callback.initiateInformationalPrompt(buffer.toString());
} catch (Exception ex) {
- throw new IOException("failed to initate promt");
+ System.out.println(buffer.toString());
}
buffer.delete(0, buffer.length());
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java
index abdfba3e6c..8789d706cd 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java
@@ -36,6 +36,8 @@ import org.eclipse.osee.ote.core.environment.status.msg.TestPointUpdateMessage;
import org.eclipse.osee.ote.core.environment.status.msg.TestServerCommandCompleteMessage;
import org.eclipse.osee.ote.core.environment.status.msg.TestStartMessage;
import org.eclipse.osee.ote.core.framework.command.ICommandHandle;
+import org.eclipse.osee.ote.core.framework.command.ITestCommandResult;
+import org.eclipse.osee.ote.core.framework.command.TestCommandStatus;
import org.eclipse.osee.ote.message.event.OteEventMessageUtil;
import org.eclipse.osee.ote.message.event.SerializedClassMessage;
import org.osgi.service.event.EventAdmin;
@@ -46,8 +48,7 @@ import org.osgi.service.event.EventAdmin;
*/
public class StatusBoard implements ITestEnvironmentListener, OTEStatusBoard {
private static final long TP_UPDATE_THROTTLE = 5000;
- private CommandDescription currentCommand;
-
+
private long lastTpUpdateTime = 0;
private final ThreadPoolExecutor executor;
@@ -141,8 +142,6 @@ private EventAdmin eventAdmin;
@Override
public void onCommandBegan(TestEnvironment env, CommandDescription cmdDesc) {
- this.currentCommand = cmdDesc;
-
SequentialCommandBegan seqCmdBegan = new SequentialCommandBegan();
seqCmdBegan.set(cmdDesc);
try {
@@ -186,6 +185,7 @@ private EventAdmin eventAdmin;
}
}
+ @SuppressWarnings("rawtypes")
void notifyListeners(final SerializedClassMessage msg) {
executor.execute(new StatusBoardRunnable(msg) {
@Override
@@ -202,13 +202,19 @@ private EventAdmin eventAdmin;
@Override
public void dispose() {
- currentCommand = null;
}
@Override
public void onTestServerCommandFinished(TestEnvironment env, ICommandHandle handle) {
try {
- TestServerCommandCompleteMessage msg = new TestServerCommandCompleteMessage(new TestServerCommandComplete(handle));
+ ITestCommandResult status = handle.get();
+ TestCommandStatus cmdStatus = null;
+ Throwable th = null;
+ if(status != null){
+ cmdStatus = status.getStatus();
+ th = status.getThrowable();
+ }
+ TestServerCommandCompleteMessage msg = new TestServerCommandCompleteMessage(new TestServerCommandComplete(cmdStatus, th));
notifyListeners(msg);
} catch (IOException e) {
OseeLog.log(StatusBoard.class, Level.SEVERE, e);
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java
index 4b664fc89b..ca2310c903 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java
@@ -11,7 +11,8 @@
package org.eclipse.osee.ote.core.environment.status;
import java.io.Serializable;
-import org.eclipse.osee.ote.core.framework.command.ICommandHandle;
+
+import org.eclipse.osee.ote.core.framework.command.TestCommandStatus;
/**
* @author Andrew M. Finkbeiner
@@ -19,10 +20,12 @@ import org.eclipse.osee.ote.core.framework.command.ICommandHandle;
public class TestServerCommandComplete implements Serializable, IServiceStatusData {
private static final long serialVersionUID = -2678833105694275416L;
- private final ICommandHandle handle;
+ private TestCommandStatus cmdStatus;
+ private Throwable th;
- public TestServerCommandComplete(ICommandHandle handle) {
- this.handle = handle;
+ public TestServerCommandComplete(TestCommandStatus cmdStatus, Throwable th) {
+ this.cmdStatus = cmdStatus;
+ this.th = th;
}
@Override
@@ -30,7 +33,11 @@ public class TestServerCommandComplete implements Serializable, IServiceStatusDa
visitor.asTestServerCommandComplete(this);
}
- public ICommandHandle getHandle() {
- return handle;
+ public TestCommandStatus getCmdStatus() {
+ return cmdStatus;
+ }
+
+ public Throwable getThrowable() {
+ return th;
}
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BatchLog.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BatchLog.java
new file mode 100644
index 0000000000..25635ec1fb
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BatchLog.java
@@ -0,0 +1,54 @@
+package org.eclipse.osee.ote.core.framework.command;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.logging.ILoggerListener;
+import org.eclipse.osee.framework.logging.OseeLog;
+
+public class BatchLog implements ILoggerListener {
+
+ private File fileToWriteTo;
+ private FileOutputStream fos;
+ private PrintWriter out;
+
+ public BatchLog(File fileToWriteTo){
+ this.fileToWriteTo = fileToWriteTo;
+ }
+
+ public void open() throws FileNotFoundException{
+ fos = new FileOutputStream(fileToWriteTo);
+ out = new PrintWriter(fileToWriteTo);
+ OseeLog.registerLoggerListener(this);
+ }
+
+ public void close(){
+ try {
+ fos.close();
+ out.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ OseeLog.unregisterLoggerListener(this);
+ }
+ }
+
+ public void flush(){
+ out.flush();
+ }
+
+ @Override
+ public void log(String loggerName, Level level, String message, Throwable th) {
+ if(level.intValue() >= Level.SEVERE.intValue()){
+ out.printf("%s %s\n", level.getName(), message);
+ if(th != null){
+ th.printStackTrace(out);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java
index 70449c1e5f..7b709894b3 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java
@@ -10,19 +10,17 @@
*******************************************************************************/
package org.eclipse.osee.ote.core.framework.command;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-public interface ICommandHandle extends Remote {
- boolean cancelAll(boolean mayInterruptIfRunning) throws RemoteException;
+public interface ICommandHandle {
+ boolean cancelAll(boolean mayInterruptIfRunning);
- boolean cancelSingle(boolean mayInterruptIfRunning) throws RemoteException;
+ boolean cancelSingle(boolean mayInterruptIfRunning);
- ITestCommandResult get() throws RemoteException;
+ ITestCommandResult get();
- boolean isCancelled() throws RemoteException;
+ boolean isCancelled();
- boolean isDone() throws RemoteException;
+ boolean isDone();
- String getCommandKey() throws RemoteException;
+ String getCommandKey();
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTests.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTests.java
new file mode 100644
index 0000000000..b3f1122e03
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTests.java
@@ -0,0 +1,209 @@
+package org.eclipse.osee.ote.core.framework.command;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.rmi.server.ExportException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.jdk.core.type.IPropertyStore;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.IHealthStatus;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.OTEApi;
+import org.eclipse.osee.ote.OTEServerFolder;
+import org.eclipse.osee.ote.core.ServiceUtility;
+import org.eclipse.osee.ote.core.environment.TestEnvironment;
+import org.eclipse.osee.ote.core.environment.status.CommandEndedStatusEnum;
+import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard;
+import org.eclipse.osee.ote.core.framework.IMethodResult;
+import org.eclipse.osee.ote.core.framework.ReturnCode;
+import org.eclipse.osee.ote.core.framework.saxparse.ProcessOutfileOverview;
+import org.eclipse.osee.ote.message.IMessageTestContext;
+
+public class RunTests implements ITestServerCommand, Serializable {
+
+ private static final long serialVersionUID = 7408758537342855854L;
+ private static final String DEVELOPMENT = "Development";
+
+ private final IPropertyStore global;
+ private final List<IPropertyStore> scripts;
+ private volatile boolean cancelAll = false;
+ private volatile boolean isRunning = false;
+ private final UUID sessionKey;
+ private final String guid;
+ private TestEnvironment environment;
+ private Configuration configuration;
+
+ public RunTests(String guid, UUID uuid, Configuration configuration, IPropertyStore global, List<IPropertyStore> scripts) {
+ this.global = global;
+ this.scripts = scripts;
+ this.sessionKey = uuid;
+ this.guid = guid;
+ this.configuration = configuration;
+ }
+
+ public UUID getSessionKey() {
+ return sessionKey;
+ }
+
+ @Override
+ public ICommandHandle createCommandHandle(Future<ITestCommandResult> result, ITestContext context) throws ExportException {
+ return new RunTestsHandle(result, context, this);
+ }
+
+ @Override
+ public ITestCommandResult execute(TestEnvironment environment, OTEStatusBoard statusBoard) throws Exception {
+ ITestCommandResult retVal = TestCommandResult.SUCCESS;
+ isRunning = true;
+ IMessageTestContext msgContext = (IMessageTestContext) environment;
+ this.environment = environment;
+
+ OTEApi ote = ServiceUtility.getService(OTEApi.class);
+ OTEServerFolder serverFolder = ote.getServerFolder();
+
+ File batchFolder = serverFolder.getNewBatchFolder();
+ batchFolder.mkdirs();
+ if(!isFolderToKeep()){
+ serverFolder.markFolderForDelete(batchFolder);
+ }
+ BatchLog batchLog = new BatchLog(serverFolder.getBatchLogFile(batchFolder));
+ batchLog.open();
+
+ File batchStatusFile = serverFolder.getBatchStatusFile(batchFolder);
+ File batchRunList = serverFolder.getBatchRunList(batchFolder);
+
+ setBatchStatus(batchStatusFile, "running");
+ setBatchRunList(batchRunList, scripts);
+
+ environment.setupOutfileDir(batchFolder.getAbsolutePath());
+ msgContext.resetScriptLoader(configuration, global.getArray(RunTestsKeys.classpath.name()));
+ for (IPropertyStore store : scripts) {
+ if (cancelAll) {
+ statusBoard.onTestComplete(store.get(RunTestsKeys.testClass.name()),
+ store.get(RunTestsKeys.serverOutfilePath.name()),
+ store.get(RunTestsKeys.clientOutfilePath.name()), CommandEndedStatusEnum.ABORTED,
+ new ArrayList<IHealthStatus>());
+ retVal = TestCommandResult.CANCEL;
+ continue;
+
+ }
+ statusBoard.onTestStart(store.get(RunTestsKeys.testClass.name()), store.get(RunTestsKeys.serverOutfilePath.name()), store.get(RunTestsKeys.clientOutfilePath.name()));
+ IMethodResult runResults = environment.getRunManager().run(environment, store);
+
+ CommandEndedStatusEnum status = CommandEndedStatusEnum.RAN_TO_COMPLETION;
+ if (runResults.getReturnCode() == ReturnCode.ABORTED) {
+ status = CommandEndedStatusEnum.ABORTED;
+ }
+ if (runResults.getReturnCode() == ReturnCode.ERROR) {
+ status = CommandEndedStatusEnum.EXCEPTION;
+ }
+
+ statusBoard.onTestComplete(store.get(RunTestsKeys.testClass.name()),
+ store.get(RunTestsKeys.serverOutfilePath.name()), store.get(RunTestsKeys.clientOutfilePath.name()),
+ status, runResults.getStatus());
+ batchLog.flush();
+
+ File outfile = new File(store.get(RunTestsKeys.serverOutfilePath.name()));
+ generateOutfileSummary(outfile, serverFolder.getResultsFile(outfile));
+ }
+ setBatchStatus(batchStatusFile, "complete");
+ isRunning = false;
+ batchLog.close();
+ return retVal;
+ }
+
+ private void setBatchRunList(File batchRunList, List<IPropertyStore> scripts2) {
+ StringBuilder sb = new StringBuilder();
+ for (IPropertyStore store : scripts) {
+ sb.append(store.get(RunTestsKeys.testClass.name()));
+ sb.append("\n");
+ }
+ try {
+ Lib.writeStringToFile(sb.toString(), batchRunList);
+ } catch (IOException ex) {
+ OseeLog.log(getClass(), Level.SEVERE, "Failed to write batch run list", ex);
+ }
+ }
+
+ private void setBatchStatus(File batchStatusFile, String string) {
+ try {
+ Lib.writeStringToFile(string, batchStatusFile);
+ } catch (IOException ex) {
+ OseeLog.log(getClass(), Level.SEVERE, "Failed to write batch status", ex);
+ }
+ }
+
+ private void generateOutfileSummary(File outfile, File resultsFile){
+ String summary = getResults(outfile);
+ writeSummaryToFile(resultsFile, summary);
+ }
+
+ private void writeSummaryToFile(File file, String summary) {
+ try {
+ Lib.writeStringToFile(summary, file);
+ } catch (IOException ex) {
+ OseeLog.log(getClass(), Level.SEVERE, "Failed to write outfile summary", ex);
+ }
+ }
+
+ private String getResults(File outfile){
+ ProcessOutfileOverview overview = new ProcessOutfileOverview();
+ FileInputStream fis = null;
+ try{
+ fis = new FileInputStream(outfile);
+ overview.run(fis);
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), Level.SEVERE, "Failed to write outfile summary", ex);
+ } finally {
+ if(fis != null){
+ try {
+ fis.close();
+ } catch (IOException e) {
+ OseeLog.log(getClass(), Level.SEVERE, "Failed to close outfile", e);
+ }
+ }
+ }
+ return String.format("%s,%s,%s", overview.getScriptName(), overview.getResults(), overview.getElapsedTime());
+ }
+
+ private boolean isFolderToKeep() {
+ IPropertyStore props = scripts.get(0);
+ String formalTestType = props.get("FormalTestType");
+ if(formalTestType != null && formalTestType.equalsIgnoreCase(DEVELOPMENT)){
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public boolean cancel() {
+ cancelAll = true;
+ return environment.getRunManager().abort();
+ }
+
+ public boolean cancelSingle() {
+ return environment.getRunManager().abort();
+ }
+
+ @Override
+ public String getGUID() {
+ return guid;
+ }
+
+ @Override
+ public UUID getUserSessionKey() {
+ return sessionKey;
+ }
+
+ boolean isRunning() {
+ return isRunning;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsHandle.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsHandle.java
new file mode 100644
index 0000000000..a939926a71
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsHandle.java
@@ -0,0 +1,68 @@
+package org.eclipse.osee.ote.core.framework.command;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.ote.core.framework.command.ICommandHandle;
+import org.eclipse.osee.ote.core.framework.command.ITestCommandResult;
+import org.eclipse.osee.ote.core.framework.command.ITestContext;
+
+public class RunTestsHandle implements ICommandHandle, Serializable {
+
+ private static final long serialVersionUID = 3643208660033506154L;
+
+ private final transient Future<ITestCommandResult> result;
+ private final transient ITestContext context;
+ private final transient RunTests command;
+ private final String guid;
+
+ public RunTestsHandle(Future<ITestCommandResult> result, ITestContext context, RunTests command) {
+ this.result = result;
+ this.context = context;
+ this.command = command;
+ this.guid = GUID.create();
+ }
+
+ @Override
+ public boolean cancelAll(boolean mayInterruptIfRunning) {
+ return command.cancel();
+ }
+
+ @Override
+ public boolean cancelSingle(boolean mayInterruptIfRunning) {
+ return command.cancelSingle();
+ }
+
+ @Override
+ public ITestCommandResult get() {
+ try {
+ return result.get();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return false;
+ }
+
+ @Override
+ public boolean isDone() {
+ return command.isRunning();
+ }
+
+ @Override
+ public String getCommandKey() {
+ return guid;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java
new file mode 100644
index 0000000000..1a108cb9a5
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java
@@ -0,0 +1,25 @@
+package org.eclipse.osee.ote.core.framework.command;
+
+public enum RunTestsKeys {
+ distributionStatement,
+ executablePath,
+ classpath,
+ version_repositoryType,
+ version_location,
+ version_revision,
+ version_lastAuthor,
+ version_lastModificationDate,
+ version_modifiedFlag,
+ serverOutfilePath,
+ executableOutputPath,
+ executableDebug,
+ testClass,
+ clientOutfilePath,
+ testVersion,
+ serverOutfileFolderOverride,
+ executablePathsArray,
+ executableArg1Array,
+ executableArg2Array,
+ spare1;
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java
index 73a0acb327..6ba914813a 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java
@@ -87,9 +87,6 @@ public abstract class AbstractInteractivePrompt<T> extends AbstractRemotePrompt
} finally {
script.getTestEnvironment().getScriptCtrl().lock();
}
- if (exception != null) {
- throw exception;
- }
return response;
}
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java
index 0fc657dfc2..07ddce254f 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java
@@ -12,11 +12,9 @@ package org.eclipse.osee.ote.core.framework.prompt;
import java.net.UnknownHostException;
import java.util.concurrent.Executor;
-import java.util.logging.Level;
+
import org.eclipse.osee.connection.service.IServiceConnector;
-import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.ote.core.IUserSession;
-import org.eclipse.osee.ote.core.environment.TestEnvironment;
/**
* @author Ken J. Aguilar
@@ -33,16 +31,16 @@ public class InformationalPrompt extends AbstractRemotePrompt {
@Override
public void run() {
+ String message = null;
try {
- String message = getPromptMessage();
+ message = getPromptMessage();
if (message != null) {
session.initiateInformationalPrompt(getPromptMessage());
} else {
session.initiateInformationalPrompt("null message");
}
} catch (Exception e) {
- OseeLog.log(TestEnvironment.class, Level.SEVERE, "exception while performing informational prompt", e);
-
+ System.out.println(message);
}
}
});
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java
index aaab2c8db5..9c69248321 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java
@@ -192,7 +192,7 @@ public class OteSaxHandler extends AbstractSaxHandler {
if (handler != null) {
handler.startElementFound(uri, localName, name, attributes);
} else {
- System.out.println(name);
+ System.out.println("No Handler for ELEMENT type" + name);
}
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ProcessOutfileOverview.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ProcessOutfileOverview.java
new file mode 100644
index 0000000000..f47eb0125f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ProcessOutfileOverview.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * 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.ote.core.framework.saxparse;
+
+import java.io.InputStream;
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.ote.core.framework.saxparse.elements.TestPointResultsData;
+import org.eclipse.osee.ote.core.framework.saxparse.elements.TimeSummaryData;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class ProcessOutfileOverview {
+
+ private String elapsedTime;
+ private String scriptName;
+ private String results = "";
+
+ public ProcessOutfileOverview() {
+ }
+
+ public void run(InputStream inputStream) throws Exception {
+
+ long time = System.currentTimeMillis();
+
+ XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+ OteSaxHandler handler = new OteSaxHandler();
+ xmlReader.setContentHandler(handler);
+ xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+
+ handler.getHandler("TimeSummary").addListener(new IBaseSaxElementListener() {
+
+ @Override
+ public void onEndElement(Object obj) {
+ }
+
+ @Override
+ public void onStartElement(Object obj) {
+ if (obj instanceof TimeSummaryData) {
+ TimeSummaryData data = (TimeSummaryData) obj;
+ elapsedTime = data.getElapsed();
+ }
+ }
+
+ });
+ handler.getHandler("TestPointResults").addListener(new IBaseSaxElementListener() {
+
+ @Override
+ public void onEndElement(Object obj) {
+ }
+
+ @Override
+ public void onStartElement(Object obj) {
+ if (obj instanceof TestPointResultsData) {
+ TestPointResultsData data = (TestPointResultsData) obj;
+ String fail = data.getFail();
+ String pass = data.getPass();
+ String aborted = data.getAborted();
+ try {
+ int failedTestPoints = Integer.parseInt(fail);
+ int passedTestPoints = Integer.parseInt(pass);
+ int totalTestPoints = passedTestPoints + failedTestPoints;
+ boolean abort = false;
+ if (aborted != null && aborted.length() > 0) {
+ abort = Boolean.parseBoolean(aborted);
+ }
+ results = "";
+ if (abort) {
+ results = String.format("ABORTED - Total[%d] Fail[%d]", totalTestPoints, failedTestPoints);
+ } else if (failedTestPoints > 0) {
+ results = String.format("FAILED - Total[%d] Fail[%d]", totalTestPoints, failedTestPoints);
+ } else {
+ results = String.format("PASSED - Total[%d] Fail[%d]", totalTestPoints, failedTestPoints);
+ }
+ } catch (NumberFormatException ex) {
+
+ }
+ }
+ }
+
+ });
+ handler.getHandler("ScriptName").addListener(new IBaseSaxElementListener() {
+
+ @Override
+ public void onEndElement(Object obj) {
+ scriptName = obj.toString();
+ }
+
+ @Override
+ public void onStartElement(Object obj) {
+ }
+ });
+
+ xmlReader.parse(new InputSource(inputStream));
+
+ long all = System.currentTimeMillis() - time;
+
+ OseeLog.logf(getClass(), Level.INFO, "It took %d ms total to process.", all);
+ }
+
+ public String getElapsedTime() {
+ return elapsedTime;
+ }
+
+ public String getResults() {
+ return results;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java
index f2e5283a0c..9ba5bc2e56 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java
@@ -124,9 +124,9 @@ public class ScriptConfigRecord extends TestRecord {
writeElement(writer, BaseTestTags.SCRIPT_NAME, getMessage());
writer.writeStartElement("User");
- writer.writeAttribute("name", this.userName);
- writer.writeAttribute("email", this.userEmail);
- writer.writeAttribute("id", this.userId);
+ writer.writeAttribute("name", userName == null ? "N/A" : userName);
+ writer.writeAttribute("email", userEmail == null ? "N/A" : userEmail);
+ writer.writeAttribute("id", userId == null ? "N/A" : userId);
writer.writeEndElement();
if (scriptVersionRecord != null) {
@@ -153,6 +153,5 @@ public class ScriptConfigRecord extends TestRecord {
this.userName = name;
this.userEmail = email;
this.userId = id;
-
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/Configure.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/Configure.java
index b3db14655f..1adfb82cf5 100644
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/Configure.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/Configure.java
@@ -2,25 +2,26 @@ package org.eclipse.osee.ote.internal;
import java.util.concurrent.Callable;
-import org.eclipse.osee.ote.OTEConfiguration;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.ConfigurationStatus;
import org.eclipse.osee.ote.OTEStatusCallback;
+import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager;
-public class Configure implements Callable<OTEConfigurationStatus> {
+public class Configure implements Callable<ConfigurationStatus> {
- private final OTEBundleLoader bundleLoader;
- private final OTEConfiguration configuration;
- private final OTEStatusCallback<OTEConfigurationStatus> callable;
+ private final IRuntimeLibraryManager bundleLoader;
+ private final Configuration configuration;
+ private final OTEStatusCallback<ConfigurationStatus> callable;
- public Configure(OTEBundleLoader bundleLoader, OTEConfiguration configuration, OTEStatusCallback<OTEConfigurationStatus> callable) {
- this.bundleLoader = bundleLoader;
+ public Configure(IRuntimeLibraryManager bundleLoader2, Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) {
+ this.bundleLoader = bundleLoader2;
this.configuration = configuration;
this.callable = callable;
}
@Override
- public OTEConfigurationStatus call() throws Exception {
- OTEConfigurationStatus status = new OTEConfigurationStatus(configuration, true, "");
+ public ConfigurationStatus call() throws Exception {
+ ConfigurationStatus status = new ConfigurationStatus(configuration, true, "");
try{
boolean completedUninstall = true;
callable.setTotalUnitsOfWork(determineUnitsOfWork());
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DownloadConfiguration.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DownloadConfiguration.java
new file mode 100644
index 0000000000..5667ef9003
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DownloadConfiguration.java
@@ -0,0 +1,40 @@
+package org.eclipse.osee.ote.internal;
+
+import java.util.concurrent.Callable;
+
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.ConfigurationStatus;
+import org.eclipse.osee.ote.OTEStatusCallback;
+import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager;
+
+public class DownloadConfiguration implements Callable<ConfigurationStatus> {
+
+ private final IRuntimeLibraryManager bundleLoader;
+ private final Configuration configuration;
+ private final OTEStatusCallback<ConfigurationStatus> callable;
+
+ public DownloadConfiguration(IRuntimeLibraryManager bundleLoader2, Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) {
+ this.bundleLoader = bundleLoader2;
+ this.configuration = configuration;
+ this.callable = callable;
+ }
+
+ @Override
+ public ConfigurationStatus call() throws Exception {
+ ConfigurationStatus status = new ConfigurationStatus(configuration, true, "");
+ try{
+ callable.setTotalUnitsOfWork(determineUnitsOfWork());
+ if(!bundleLoader.acquireBundles(configuration, callable)){
+ status.setFail("Failed to download all bundles.");
+ }
+ } finally {
+ callable.complete(status);
+ }
+ return status;
+ }
+
+ private int determineUnitsOfWork() {
+ return configuration.getItems().size();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEApiImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEApiImpl.java
new file mode 100644
index 0000000000..3a551d8686
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEApiImpl.java
@@ -0,0 +1,195 @@
+package org.eclipse.osee.ote.internal;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.ConfigurationStatus;
+import org.eclipse.osee.ote.OTEApi;
+import org.eclipse.osee.ote.OTEServerFolder;
+import org.eclipse.osee.ote.OTEServerRuntimeCache;
+import org.eclipse.osee.ote.OTEStatusCallback;
+import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface;
+import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager;
+import org.eclipse.osee.ote.core.model.IModelManager;
+
+public final class OTEApiImpl implements OTEApi {
+
+ private final Configuration emptyConfiguration;
+ private final ReentrantLock configurationLock;
+
+ private Future<ConfigurationStatus> currentConfigurationFuture;
+ private ExecutorService executor;
+ private IRuntimeLibraryManager runtimeLibraryManager;
+ private OTEServerFolder serverFolder;
+ private OTEServerRuntimeCache serverRuntimeCache;
+ private TestEnvironmentInterface env;
+ private IModelManager modelManager;
+
+ /**
+ * ds component method
+ */
+ public void start(){
+ }
+
+ /**
+ * ds component method
+ */
+ public void stop(){
+ }
+
+ /**
+ * ds component method
+ */
+ public void bindRuntimeLibraryManager(IRuntimeLibraryManager runtimeLibraryManager){
+ this.runtimeLibraryManager = runtimeLibraryManager;
+ }
+
+ /**
+ * ds component method
+ */
+ public void unbindRuntimeLibraryManager(IRuntimeLibraryManager runtimeLibraryManager){
+ this.runtimeLibraryManager = null;
+ }
+
+ /**
+ * ds component method
+ */
+ public void bindOTEServerFolder(OTEServerFolder serverFolder){
+ this.serverFolder = serverFolder;
+ }
+
+ /**
+ * ds component method
+ */
+ public void unbindOTEServerFolder(OTEServerFolder serverFolder){
+ this.serverFolder = null;
+ }
+
+ /**
+ * ds component method
+ */
+ public void bindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){
+ this.serverRuntimeCache = serverRuntimeCache;
+ }
+
+ /**
+ * ds component method
+ */
+ public void unbindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){
+ this.serverRuntimeCache = null;
+ }
+
+ /**
+ * ds component method
+ */
+ public void bindTestEnvironmentInterface(TestEnvironmentInterface env){
+ this.env = env;
+ }
+
+ /**
+ * ds component method
+ */
+ public void unbindTestEnvironmentInterface(TestEnvironmentInterface env){
+ this.env = null;
+ }
+
+ /**
+ * ds component method
+ */
+ public void bindIModelManager(IModelManager modelManager){
+ this.modelManager = modelManager;
+ }
+
+ /**
+ * ds component method
+ */
+ public void unbindIModelManager(IModelManager modelManager){
+ this.modelManager = null;
+ }
+
+ public OTEApiImpl(){
+ this.configurationLock = new ReentrantLock();
+ this.emptyConfiguration = new Configuration();
+ this.currentConfigurationFuture = new OTEFutureImpl(new ConfigurationStatus(emptyConfiguration, true, ""));
+ this.executor = Executors.newSingleThreadExecutor(new ThreadFactory(){
+ @Override
+ public Thread newThread(Runnable arg0) {
+ Thread th = new Thread(arg0);
+ th.setName("OteConfiguration");
+ return th;
+ }
+ });
+ }
+
+ @Override
+ public Future<ConfigurationStatus> loadConfiguration(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException {
+ Future<ConfigurationStatus> status;
+ configurationLock.lock();
+ try{
+ if(currentConfigurationFuture != null && !currentConfigurationFuture.isDone()){
+ status = new OTEFutureImpl(new ConfigurationStatus(configuration, false, "In the process of loading a configuration."));
+ callable.complete(status.get());
+ } else if(currentConfigurationFuture.get().getConfiguration() == emptyConfiguration || configuration == emptyConfiguration || !currentConfigurationFuture.get().isSuccess()){
+ status = new OTEFutureImpl(executor.submit(new Configure(runtimeLibraryManager, configuration, callable)));
+ currentConfigurationFuture = status;
+ } else {
+ status = new OTEFutureImpl(new ConfigurationStatus(configuration, false, "Environment already configured."));
+ callable.complete(status.get());
+ }
+ } finally {
+ configurationLock.unlock();
+ }
+ return status;
+ }
+
+ @Override
+ public Future<ConfigurationStatus> resetConfiguration(OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException {
+ return loadConfiguration(emptyConfiguration, callable);
+ }
+
+ @Override
+ public Future<ConfigurationStatus> getConfiguration() {
+ return currentConfigurationFuture;
+ }
+
+ @Override
+ public Future<ConfigurationStatus> downloadConfigurationJars(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException {
+ return new OTEFutureImpl(executor.submit(new DownloadConfiguration(runtimeLibraryManager, configuration, callable)));
+ }
+
+ @Override
+ public IModelManager getModelManager() {
+ return modelManager;
+ }
+
+ @Override
+ public TestEnvironmentInterface getTestEnvironment() {
+ return env;
+ }
+
+ @Override
+ public OTEServerFolder getServerFolder() {
+ return serverFolder;
+ }
+
+ @Override
+ public OTEServerRuntimeCache getRuntimeCache() {
+ return serverRuntimeCache;
+ }
+
+ @Override
+ public Class<?> loadFromScriptClassLoader(String clazz) throws ClassNotFoundException {
+ return runtimeLibraryManager.loadFromRuntimeLibraryLoader(clazz);
+ }
+
+ @Override
+ public Class<?> loadFromRuntimeLibraryLoader(String clazz) throws ClassNotFoundException {
+ return runtimeLibraryManager.loadFromScriptClassLoader(clazz);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java
new file mode 100644
index 0000000000..36f94a1e34
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * 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.ote.internal;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil;
+import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader;
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.ConfigurationItem;
+import org.eclipse.osee.ote.ConfigurationStatus;
+import org.eclipse.osee.ote.OTEServerRuntimeCache;
+import org.eclipse.osee.ote.OTEStatusCallback;
+import org.eclipse.osee.ote.core.OseeURLClassLoader;
+import org.eclipse.osee.ote.core.ServiceUtility;
+import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.FrameworkUtil;
+
+public class OTEBundleLoader implements IRuntimeLibraryManager{
+
+ private final Collection<Bundle> installedBundles;
+ private final Collection<Bundle> runningBundles;
+ private final Map<String, String> bundleNameToMd5Map;
+ private final BundleContext context;
+
+ private URLClassLoader scriptClassLoader;
+ private OTEServerRuntimeCache serverRuntimeCache;
+
+ public void bindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){
+ this.serverRuntimeCache = serverRuntimeCache;
+ }
+
+ public void unbindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){
+ this.serverRuntimeCache = serverRuntimeCache;
+ }
+
+ public OTEBundleLoader() {
+ this.context = FrameworkUtil.getBundle(getClass()).getBundleContext();
+ this.installedBundles = new LinkedList<Bundle>();
+ this.runningBundles = new LinkedList<Bundle>();
+ this.bundleNameToMd5Map = new HashMap<String, String>();
+ }
+
+ @Override
+ public boolean install(Configuration oteConfiguration, OTEStatusCallback<ConfigurationStatus> statusCallback) {
+ boolean pass = true;
+ for (ConfigurationItem bundleDescription : oteConfiguration.getItems()) {
+ String bundleName = bundleDescription.getSymbolicName();
+ try {
+ boolean exists = false;
+ for (Bundle bundle : runningBundles) {
+ if (bundle.getSymbolicName().equals(bundleName)) {
+ exists = true;
+ break;
+ }
+ }
+ if (!exists) {
+ Bundle bundle = Platform.getBundle(bundleDescription.getSymbolicName());
+ if (bundle == null) {
+ Bundle installedBundle;
+ File bundleData = acquireSystemLibraryStream(bundleDescription);
+ installedBundle = context.installBundle("reference:" + bundleData.toURI().toURL().toExternalForm());
+ bundleNameToMd5Map.put(bundleName, bundleDescription.getMd5Digest());
+ installedBundles.add(installedBundle);
+ }
+ }
+ statusCallback.log("installed " + bundleName);
+ } catch (Throwable th) {
+ statusCallback.error(String.format("Unable to load [%s].", bundleName), th);
+ pass = false;
+ } finally {
+ statusCallback.incrememtUnitsWorked(1);
+ }
+ }
+ return pass;
+ }
+
+ @Override
+ public boolean acquireBundles(Configuration oteConfiguration, OTEStatusCallback<ConfigurationStatus> statusCallback) {
+ boolean pass = true;
+ for (ConfigurationItem bundleDescription : oteConfiguration.getItems()) {
+ String bundleName = bundleDescription.getSymbolicName();
+ File bundleData = null;
+ try{
+ bundleData = acquireSystemLibraryStream(bundleDescription);
+ } catch (Exception e) {
+ pass = false;
+ statusCallback.error("Failed to aquire bundle from client.", e);
+ }
+ finally {
+ if(bundleData == null){
+ pass = false;
+ statusCallback.error("Failed to downloaded bundle " + bundleName);
+ }
+ statusCallback.incrememtUnitsWorked(1);
+ }
+ statusCallback.log("downloaded " + bundleName);
+ }
+ return pass;
+ }
+
+ @Override
+ public boolean start(OTEStatusCallback<ConfigurationStatus> statusCallback) {
+ boolean pass = true;
+ Iterator<Bundle> iter = installedBundles.iterator();
+ while (iter.hasNext()) {
+ Bundle bundle = iter.next();
+ try {
+ String entry = bundle.getHeaders().get("Fragment-Host");
+ if (entry == null) {
+ bundle.start();
+ }
+ // We got here because bundle.start did not exception
+ runningBundles.add(bundle);
+ iter.remove();
+ statusCallback.log("started " + bundle.getSymbolicName());
+ } catch (BundleException ex) {
+ pass = false;
+ statusCallback.error("Failed to start " + bundle.getSymbolicName(), ex);
+ } finally {
+ statusCallback.incrememtUnitsWorked(1);
+ }
+ }
+ return pass;
+ }
+
+ @Override
+ public boolean uninstall(OTEStatusCallback<ConfigurationStatus> statusCallback) {
+ boolean result = true;
+ for (Bundle bundle : installedBundles) {
+ try {
+ bundle.uninstall();
+ } catch (BundleException ex) {
+ result = false;
+ statusCallback.error("Failed to uninstall " + bundle.getSymbolicName(), ex);
+ }
+ }
+ installedBundles.clear();
+
+ for (Bundle bundle : runningBundles) {
+ try {
+ bundle.stop();
+ bundle.uninstall();
+ } catch (BundleException ex) {
+ result = false;
+ statusCallback.error("Failed to stop and uninstall " + bundle.getSymbolicName(), ex);
+ }
+ }
+ runningBundles.clear();
+
+ return result;
+ }
+
+ private File acquireSystemLibraryStream(ConfigurationItem bundleDescription) throws Exception {
+ File file = serverRuntimeCache.get(bundleDescription.getSymbolicName(), bundleDescription.getMd5Digest());
+ if (file == null) {
+ InputStream servedBundleIn = new URL(bundleDescription.getLocationUrl()).openConnection().getInputStream();
+ file = serverRuntimeCache.save(bundleDescription.getSymbolicName(), bundleDescription.getMd5Digest(), servedBundleIn);
+ servedBundleIn.close();
+ }
+ return file;
+ }
+
+ public void dispose() {
+ bundleNameToMd5Map.clear();
+ installedBundles.clear();
+ runningBundles.clear();
+ }
+
+ @Override
+ public boolean installed() {
+ return installedBundles.size() > 0 || runningBundles.size() > 0;
+ }
+
+ @Override
+ public void clearJarCache() {
+ serverRuntimeCache.clearJarCache();
+ }
+
+ @Override
+ public void resetScriptLoader(Configuration oteConfiguration, String[] classPaths) throws Exception {
+ List<URL> urls = new ArrayList<URL>();
+ if(oteConfiguration != null){
+ for(ConfigurationItem item:oteConfiguration.getItems()){
+ File file = serverRuntimeCache.get(item.getSymbolicName(), item.getMd5Digest());
+ if(file != null){
+ urls.add(file.toURI().toURL());
+ }
+ }
+ }
+ URL[] urlArray = urls.toArray(new URL[urls.size()+classPaths.length]);
+ URL[] urlClassPaths = Lib.getUrlFromString(classPaths);
+ System.arraycopy(urlClassPaths, 0, urlArray, urls.size(), urlClassPaths.length);
+ scriptClassLoader = new OseeURLClassLoader("Script ClassLoader", urlArray, ExportClassLoader.getInstance());
+ }
+
+ @Override
+ public Class<?> loadFromScriptClassLoader(String path) throws ClassNotFoundException {
+ if (scriptClassLoader == null) {
+ return loadFromRuntimeLibraryLoader(path);
+ }
+ Class<?> scriptClass = scriptClassLoader.loadClass(path);
+ return scriptClass;
+ }
+
+ @Override
+ public Class<?> loadFromRuntimeLibraryLoader(String clazz) throws ClassNotFoundException {
+ return ExportClassLoader.getInstance().loadClass(clazz);
+ }
+
+ @Override
+ public void toXml(XMLStreamWriter writer) throws XMLStreamException {
+ Bundle[] bundles = ServiceUtility.getContext().getBundles();
+ List<String> versions = new ArrayList<String>();
+ for(Bundle bundle: bundles ){
+ String version = (String) bundle.getHeaders().get("Bundle-Version");
+ String implVersion = (String) bundle.getHeaders().get("Implementation-Version");
+ if (version != null && implVersion != null) {
+ versions.add(String.format("%s_%s_%s", bundle.getSymbolicName(), version, implVersion));
+ } else if (version != null){
+ versions.add(String.format("%s_%s", bundle.getSymbolicName(), version));
+ } else {
+ versions.add(String.format("%s", bundle.getSymbolicName()));
+ }
+ }
+ Collections.sort(versions);
+
+ writer.writeStartElement("RuntimeVersions");
+ for (String bundleVersion : versions) {
+ XMLStreamWriterUtil.writeElement(writer, "Version", bundleVersion);
+ }
+ writer.writeEndElement();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFolderImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFolderImpl.java
new file mode 100644
index 0000000000..e0de178c60
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFolderImpl.java
@@ -0,0 +1,124 @@
+package org.eclipse.osee.ote.internal;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.osee.ote.OTEServerFolder;
+
+public class OTEFolderImpl implements OTEServerFolder{
+ private static final String DELETE_MARKER = ".delete";
+ private static final String LOG_FILE = ".log";
+ private static final String STATUS_FILE = ".status";
+ private static final String RUNLIST_FILE = ".runlist";
+ private static final String RESULTS_FILE = ".result";
+
+ private static File OTESERVER = new File(System.getProperty("user.home") + File.separator + "OTESERVER");
+ private static File BATCHES = new File(OTESERVER, "batches");
+ private static File JARCACHE = new File(OTESERVER, "runtimeCache");
+ private static SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd___kk_mm_ss");
+
+ /**
+ * ds component method
+ */
+ public void start(){
+ cleanOldBatchFolders();
+ }
+
+ /**
+ * ds component method
+ */
+ public void stop(){
+
+ }
+
+ /**
+ * This will not clean sub-folders
+ */
+ @Override
+ public void cleanOldBatchFolders(){
+ File[] files = BATCHES.listFiles();
+ for(File file:files){
+ if(file.isDirectory()){
+ File delete = new File(file, DELETE_MARKER);
+ boolean deleteFolder = delete.exists();
+ if(deleteFolder){
+ File[] toDelete = file.listFiles();
+ for(File f:toDelete){
+ f.delete();
+ }
+ file.delete();
+ }
+ }
+ }
+ }
+
+ @Override
+ public File getServerFolder(){
+ return OTESERVER;
+ }
+
+ @Override
+ public File getBatchesFolder(){
+ return BATCHES;
+ }
+
+ @Override
+ public File getCacheFolder(){
+ return JARCACHE;
+ }
+
+ @Override
+ public File getNewBatchFolder() {
+ return new File(getBatchesFolder(), format.format(new Date()));
+ }
+
+ @Override
+ public File getResultsFile(File outfile){
+ return new File(outfile.getAbsolutePath() + RESULTS_FILE);
+ }
+
+ @Override
+ public void markFolderForDelete(File folder) {
+ FileOutputStream fos = null;
+ try {
+ folder.mkdirs();
+ fos = new FileOutputStream(new File(folder, DELETE_MARKER));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } finally {
+ if(fos != null){
+ try {
+ fos.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void unmarkFolderForDelete(File folder) {
+ File delete = new File(folder, DELETE_MARKER);
+ if(delete.exists()){
+ delete.delete();
+ }
+ }
+
+ @Override
+ public File getBatchLogFile(File batchFolder) {
+ return new File(batchFolder, LOG_FILE);
+ }
+
+ @Override
+ public File getBatchStatusFile(File batchFolder) {
+ return new File(batchFolder, STATUS_FILE);
+ }
+
+ @Override
+ public File getBatchRunList(File batchFolder) {
+ return new File(batchFolder, RUNLIST_FILE);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java
index cdedcb96af..cf2ad43ebc 100644
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java
@@ -5,19 +5,18 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEFuture;
+import org.eclipse.osee.ote.ConfigurationStatus;
-public class OTEFutureImpl implements OTEFuture<OTEConfigurationStatus> {
+public class OTEFutureImpl implements Future<ConfigurationStatus> {
- private final Future<OTEConfigurationStatus> submit;
- private OTEConfigurationStatus oteConfigurationStatus;
+ private final Future<ConfigurationStatus> submit;
+ private ConfigurationStatus oteConfigurationStatus;
- public OTEFutureImpl(Future<OTEConfigurationStatus> submit) {
+ public OTEFutureImpl(Future<ConfigurationStatus> submit) {
this.submit = submit;
}
- public OTEFutureImpl(OTEConfigurationStatus oteConfigurationStatus) {
+ public OTEFutureImpl(ConfigurationStatus oteConfigurationStatus) {
this.submit = null;
this.oteConfigurationStatus = oteConfigurationStatus;
}
@@ -31,7 +30,7 @@ public class OTEFutureImpl implements OTEFuture<OTEConfigurationStatus> {
}
@Override
- public OTEConfigurationStatus get() throws InterruptedException, ExecutionException {
+ public ConfigurationStatus get() throws InterruptedException, ExecutionException {
if(submit == null){
return oteConfigurationStatus;
}
@@ -39,7 +38,7 @@ public class OTEFutureImpl implements OTEFuture<OTEConfigurationStatus> {
}
@Override
- public OTEConfigurationStatus get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
+ public ConfigurationStatus get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
if(submit == null){
return oteConfigurationStatus;
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEServerRuntimeCacheImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEServerRuntimeCacheImpl.java
new file mode 100644
index 0000000000..39595f8116
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEServerRuntimeCacheImpl.java
@@ -0,0 +1,218 @@
+package org.eclipse.osee.ote.internal;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamPumper;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.ote.OTEServerRuntimeCache;
+import org.eclipse.osee.ote.OTEServerFolder;
+
+public class OTEServerRuntimeCacheImpl implements OTEServerRuntimeCache {
+
+ private static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy_MM_dd___kk_mm_ss");
+
+ private File folder;
+ private OTEServerFolder oteServerFolder;
+
+ public OTEServerRuntimeCacheImpl(){
+ }
+
+ /**
+ * ds component method
+ */
+ public void start(){
+ folder = oteServerFolder.getCacheFolder();
+ if (!folder.exists()) {
+ if (!folder.mkdirs()) {
+ throw new RuntimeException("Could not create JAR cache at " + folder.getAbsolutePath());
+ }
+ }
+ if (!folder.isDirectory()) {
+ throw new IllegalStateException("the JAR cache is not a directory! Path=" + folder.getAbsolutePath());
+ }
+ clean();
+ }
+
+ /**
+ * ds component method
+ */
+ public void stop(){
+ }
+
+ /**
+ * ds component method
+ */
+ public void bindOTEServerFolder(OTEServerFolder oteServerFolder){
+ this.oteServerFolder = oteServerFolder;
+ }
+
+ /**
+ * ds component method
+ */
+ public void unbindOTEServerFolder(OTEServerFolder oteServerFolder){
+ this.oteServerFolder = oteServerFolder;
+ }
+
+ @Override
+ public void clearJarCache() {
+ File[] bundleFolders = folder.listFiles();
+ for(File bundleFolder: bundleFolders){
+ if(bundleFolder.isDirectory()){
+ File[] jars = bundleFolder.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File file) {
+ return file.getAbsolutePath().endsWith(".jar");
+ }
+ });
+ for(File jar:jars){
+ jar.delete();
+ }
+ } else {
+ bundleFolder.delete();
+ }
+ }
+ }
+
+ @Override
+ public File save(String symbolicName, String md5Digest, InputStream servedBundleIn) throws IOException {
+ File namedFolder = new File(folder, symbolicName);
+ if(namedFolder.exists() && !namedFolder.isDirectory()){
+ namedFolder.delete();
+ }
+ namedFolder.mkdirs();
+
+ File newCachedFile = new File(namedFolder, md5Digest + ".jar");
+ OutputStream cachedFileOut = new FileOutputStream(newCachedFile);
+ StreamPumper.pumpData(servedBundleIn, cachedFileOut);
+ cachedFileOut.close();
+ servedBundleIn.close();
+ writeDateFile(newCachedFile);
+ return newCachedFile;
+ }
+
+ @Override
+ public File get(String symbolicName, String md5Digest) throws FileNotFoundException {
+ File foundFile = new File(new File(folder, symbolicName), md5Digest + ".jar");
+ if(foundFile.exists()){
+ writeDateFile(foundFile);
+ return foundFile;
+ }
+ return null;
+ }
+
+ /**
+ * Write out a file that has the date a cached file was last accessed. This file will be used to determine when it is ok to remove a file.
+ *
+ * @param foundFile
+ */
+ private void writeDateFile(File foundFile) {
+ File dateFile = new File(foundFile.getParentFile(), foundFile.getName()+ ".date");
+ FileOutputStream fos = null;
+ try{
+ fos = new FileOutputStream(dateFile);
+ fos.write(formatter.format(new Date()).getBytes());
+ fos.flush();
+ } catch(IOException ex) {
+ OseeLog.log(getClass(), Level.SEVERE, ex);
+ } finally {
+ if(fos != null){
+ try {
+ fos.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ private void clean(){
+ File[] bundleFolders = folder.listFiles();
+ for(File bundleFolder: bundleFolders){
+ if(bundleFolder.isDirectory()){
+ File[] jars = bundleFolder.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File file) {
+ return file.getAbsolutePath().endsWith(".jar");
+ }
+ });
+ if(jars.length == 0){
+ if(bundleFolder.listFiles().length == 0){
+ bundleFolder.delete();
+ }
+ } else {
+ for(File jar:jars){
+ File dateFile = new File(jar.getAbsolutePath() + ".date");
+ if(dateFile.exists()){
+ if(isDateFileOld(dateFile)){//delete files that haven't been recently used
+ if(jar.exists()){
+ jar.delete();
+ }
+ dateFile.delete();
+ }
+ } else { //delete a jar without a ".date" file
+ jar.delete();
+ }
+ }
+ }
+ } else { //delete legacy style cache items
+ bundleFolder.delete();
+ }
+ }
+ }
+
+ private boolean isDateFileOld(File dateFile) {
+ String dateStr = getDateFromFile(dateFile);
+ Date date;
+ try {
+ date = formatter.parse(dateStr);
+ } catch (ParseException e) {
+ return true;
+ }
+ Date oldDate = getOldDate();
+ if(date.before(oldDate)){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private String getDateFromFile(File dateFile){
+ FileInputStream fis = null;
+ String dateStr = null;
+ try{
+ byte[] buffer = new byte[1024];
+ fis = new FileInputStream(dateFile);
+ fis.read(buffer);
+ dateStr = new String(buffer);
+ } catch(IOException ex) {
+ OseeLog.log(getClass(), Level.SEVERE, ex);
+ } finally {
+ if(fis != null){
+ try {
+ fis.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ return dateStr;
+ }
+
+ private Date getOldDate(){
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(new Date());
+ cal.add(Calendar.DAY_OF_MONTH, -7);
+ return cal.getTime();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java
index 96113dbd15..40bc5b8d4e 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java
@@ -10,11 +10,14 @@
*******************************************************************************/
package org.eclipse.osee.ote.message;
+import org.eclipse.osee.ote.Configuration;
import org.eclipse.osee.ote.core.framework.command.ITestContext;
/**
* @author Andrew M. Finkbeiner
*/
public interface IMessageTestContext extends ITestContext {
- void resetScriptLoader(String[] strings) throws Exception;
+ void resetScriptLoader(Configuration configuration, String[] strings) throws Exception;
+
+ void resetScriptLoader(String[] array) throws Exception;
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java
index 5d76ecf4a0..11888ad4da 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java
@@ -13,7 +13,6 @@ package org.eclipse.osee.ote.message;
/**
* @author Andrew M. Finkbeiner
*/
-@Deprecated
public interface IPreScriptInstantiation {
void run();
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java
index 350900ea6f..e883707397 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java
@@ -10,18 +10,15 @@
*******************************************************************************/
package org.eclipse.osee.ote.message;
-import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
-import java.rmi.RemoteException;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
+import org.eclipse.osee.ote.Configuration;
import org.eclipse.osee.ote.core.IUserSession;
import org.eclipse.osee.ote.core.ServiceUtility;
import org.eclipse.osee.ote.core.TestScript;
-import org.eclipse.osee.ote.core.environment.BundleDescription;
import org.eclipse.osee.ote.core.environment.TestEnvironment;
import org.eclipse.osee.ote.core.environment.interfaces.BasicTimeout;
import org.eclipse.osee.ote.core.environment.interfaces.IEnvironmentFactory;
@@ -64,6 +61,7 @@ public abstract class MessageSystemTestEnvironment extends TestEnvironment imple
}
}
+ @SuppressWarnings("rawtypes")
@Override
public IMessageManager getMsgManager() {
return ServiceUtility.getService(IMessageManager.class, false);
@@ -73,86 +71,37 @@ public abstract class MessageSystemTestEnvironment extends TestEnvironment imple
return ServiceUtility.getService(IModelManager.class, 5000);
}
- @Deprecated
- public boolean isMessageJarAvailable(String version) {
- return getRuntimeManager().isMessageJarAvailable(version);
- }
-
- public boolean isBundleAvailable(String symbolicName, String version, byte[] md5Digest) {
- return getRuntimeManager().isBundleAvailable(symbolicName, version, md5Digest);
- }
-
/**
* provides a way for sub classes to instantiate test scripts in their own way.
*/
protected abstract TestScript instantiateScriptClass(Class<?> scriptClass, IUserSession connection) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException;
- @Deprecated
- public void sendRuntimeJar(byte[] messageJar) throws IOException {
- getRuntimeManager().addJarToClassLoader(messageJar);
- }
-
- public void sendRuntimeBundle(Collection<BundleDescription> bundles) throws Exception {
- getRuntimeManager().loadBundles(bundles);
- }
-
- public void updateRuntimeBundle(Collection<BundleDescription> bundles) throws Exception {
- getRuntimeManager().updateBundles(bundles);
- }
-
- public void cleanupRuntimeBundles() throws Exception {
- if (isNoBundleCleanup()) {
- return;
- } else {
- getRuntimeManager().cleanup();
- cleanupClassReferences();
- }
- }
-
- private boolean isNoBundleCleanup() {
- return Boolean.valueOf(System.getProperty("osee.ote.nobundlecleanup"));
- }
-
public abstract void singleStepEnv();
- public void setClientClasses(URL[] urls) throws RemoteException {
- clientClasses = urls;
- }
-
@Override
- public void resetScriptLoader(String[] strings) throws Exception {
- getRuntimeManager().resetScriptLoader(strings);
- }
-
- @Deprecated
- public Class<?> loadClassFromScriptLoader(String path) throws ClassNotFoundException {
- return getRuntimeManager().loadFromScriptClassLoader(path);
+ public void resetScriptLoader(Configuration configuration, String[] strings) throws Exception {
+ getRuntimeManager().resetScriptLoader(configuration, strings);
}
- @Deprecated
public void addPreInstantiationListener(IPreScriptInstantiation listener) {
preInstantiation.add(listener);
}
- @Deprecated
public void removePreInstantiationListener(IPreScriptInstantiation listener) {
preInstantiation.remove(listener);
}
- @Deprecated
public void notifyPreInstantiationListeners() {
for (IPreScriptInstantiation pre : preInstantiation) {
pre.run();
}
}
- @Deprecated
public IOInstrumentation getIOInstrumentation(String name) {
setupIOInstrumentation();
return ioInstrumentation.getIOInstrumentation(name);
}
- @Deprecated
public IOInstrumentation registerIOInstrumentation(String name, IOInstrumentation io) {
setupIOInstrumentation();
return ioInstrumentation.registerIOInstrumentation(name, io);
@@ -173,7 +122,6 @@ public abstract class MessageSystemTestEnvironment extends TestEnvironment imple
ioInstrumentation.removeRegistrationListener(listener);
}
- @Deprecated
public Class<?> loadClassFromMessageLoader(String path) throws ClassNotFoundException {
return getRuntimeManager().loadFromRuntimeLibraryLoader(path);
}
diff --git a/plugins/org.eclipse.osee.ote.parent/pom.xml b/plugins/org.eclipse.osee.ote.parent/pom.xml
index e9086895bb..576d72b722 100644
--- a/plugins/org.eclipse.osee.ote.parent/pom.xml
+++ b/plugins/org.eclipse.osee.ote.parent/pom.xml
@@ -18,7 +18,6 @@
<modules>
<module>../../plugins/org.eclipse.osee.framework.ui.workspacebundleloader</module>
- <module>../../plugins/org.eclipse.osee.ote</module>
<module>../../plugins/org.eclipse.osee.ote.master</module>
<module>../../plugins/org.eclipse.osee.ote.master.test</module>
<module>../../plugins/org.eclipse.osee.ote.master.rest</module>
@@ -27,7 +26,6 @@
<module>../../features/org.eclipse.osee.ote.server.external.feature</module>
<module>../../features/org.eclipse.osee.ote.master.feature</module>
<module>../../plugins/org.eclipse.osee.ote.master.product</module>
- <module>../../plugins/org.eclipse.osee.ote.test</module>
<module>../../plugins/org.eclipse.osee.ote.rest</module>
<module>../../plugins/org.eclipse.osee.ote.rest.client</module>
<module>../../plugins/org.eclipse.osee.ote.rest.model</module>
@@ -44,6 +42,7 @@
<module>../../plugins/org.eclipse.osee.ote.server</module>
<module>../../plugins/org.eclipse.osee.ote.help.ui</module>
<module>../../plugins/org.eclipse.osee.ote.ui</module>
+ <module>../../plugins/org.eclipse.osee.ote.ui.builder</module>
<module>../../plugins/org.eclipse.osee.ote.ui.markers</module>
<module>../../plugins/org.eclipse.osee.ote.version</module>
<module>../../plugins/org.eclipse.osee.ote.version.git</module>
diff --git a/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
index be7211346f..00e1a28a5f 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
@@ -18,6 +18,7 @@ Import-Package: javax.ws.rs,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.framework.jdk.core.util.network,
+ org.eclipse.osee.framework.logging,
org.eclipse.osee.framework.plugin.core.server
Export-Package: org.eclipse.osee.ote.rest.client
Bundle-ActivationPolicy: lazy
@@ -25,4 +26,5 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.osee.ote.rest.model,
com.sun.jersey;bundle-version="1.18.0",
com.sun.jersey.client.apache;bundle-version="1.18.0",
- javax.servlet
+ javax.servlet,
+ org.codehaus.jackson.core
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/BasicProgress.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/BasicProgress.java
new file mode 100644
index 0000000000..295a0b6e99
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/BasicProgress.java
@@ -0,0 +1,55 @@
+package org.eclipse.osee.ote.rest.client;
+
+public class BasicProgress implements Progress {
+
+ private String fail;
+ private Throwable throwable;
+ private boolean success = false;
+ private int totalUnitsOfWork;
+ private int unitsWorked;
+
+ @Override
+ public void fail(String fail) {
+ this.fail = fail;
+ }
+
+ @Override
+ public void fail(Throwable th) {
+ this.throwable = th;
+ }
+
+ @Override
+ public void setUnitsOfWork(int totalUnitsOfWork) {
+ this.totalUnitsOfWork = totalUnitsOfWork;
+ }
+
+ @Override
+ public void setUnitsWorked(int unitsWorked) {
+ this.unitsWorked = unitsWorked;
+ }
+
+ @Override
+ public void success() {
+ success = true;
+ }
+
+ public String getFail() {
+ return fail;
+ }
+
+ public Throwable getThrowable() {
+ return throwable;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public int getTotalUnitsOfWork() {
+ return totalUnitsOfWork;
+ }
+
+ public int getUnitsWorked() {
+ return unitsWorked;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ConfigurationProgress.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ConfigurationProgress.java
deleted file mode 100644
index d103cb4181..0000000000
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ConfigurationProgress.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.eclipse.osee.ote.rest.client;
-
-public interface ConfigurationProgress extends Progress {
-
-}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OTECacheItem.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OTECacheItem.java
new file mode 100644
index 0000000000..b9b325152d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OTECacheItem.java
@@ -0,0 +1,31 @@
+package org.eclipse.osee.ote.rest.client;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil;
+
+public class OTECacheItem {
+ private File file;
+ private String md5;
+
+ public OTECacheItem(File file, String md5){
+ this.file = file;
+ this.md5 = md5;
+ }
+
+ public OTECacheItem(File file) throws FileNotFoundException, Exception{
+ this.file = file;
+ md5 = ChecksumUtil.createChecksumAsString(new FileInputStream(file), "MD5");
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getMd5() {
+ return md5;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OteClient.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OteClient.java
index 86c9bd6a6e..059bc44e5b 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OteClient.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/OteClient.java
@@ -15,11 +15,17 @@ import java.net.URI;
import java.util.List;
import java.util.concurrent.Future;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTETestRun;
+
/**
* @author Andrew Finkbeiner
*/
public interface OteClient {
- Future<GetFileProgress> getFile(URI uri, File destination, String filePath, final GetFileProgress progress);
- Future<ConfigurationProgress> configureServerEnvironment(URI uri, List<File> jars, final ConfigurationProgress progress);
+ Future<Progress> getFile(URI uri, File destination, String filePath, final Progress progress);
+ Future<Progress> configureServerEnvironment(URI uri, List<File> jars, final Progress progress);
+ Future<Progress> configureServerEnvironment(URI uri, OTEConfiguration configuration, final Progress progress);
+ Future<Progress> updateServerJarCache(URI uri, String baseJarURL, List<OTECacheItem> jars, final Progress progress);
+ Future<ProgressWithCancel> runTest(URI uri, OTETestRun tests, Progress progress);
}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ProgressWithCancel.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ProgressWithCancel.java
new file mode 100644
index 0000000000..72d8722b83
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/ProgressWithCancel.java
@@ -0,0 +1,9 @@
+package org.eclipse.osee.ote.rest.client;
+
+public interface ProgressWithCancel extends Progress {
+
+ boolean cancelAll();
+
+ boolean cancelSingle();
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/Cancel.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/Cancel.java
new file mode 100644
index 0000000000..243de6e7bc
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/Cancel.java
@@ -0,0 +1,9 @@
+package org.eclipse.osee.ote.rest.client.internal;
+
+public interface Cancel {
+
+ boolean cancelAll();
+
+ boolean cancelSingle();
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
new file mode 100644
index 0000000000..bf46779b7b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
@@ -0,0 +1,110 @@
+package org.eclipse.osee.ote.rest.client.internal;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.URI;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.util.network.PortUtil;
+import org.eclipse.osee.ote.rest.client.Progress;
+import org.eclipse.osee.ote.rest.client.internal.jarserver.BundleInfo;
+import org.eclipse.osee.ote.rest.client.internal.jarserver.HeadlessClassServer;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTEConfigurationIdentity;
+import org.eclipse.osee.ote.rest.model.OTEConfigurationItem;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
+
+import com.sun.jersey.api.client.WebResource;
+
+public class ConfigureOteServer extends BaseClientCallable<Progress> {
+
+ private static final long POLLING_RATE = 1000;
+ private URI uri;
+ private List<File> jars;
+ private Progress progress;
+ private WebResourceFactory factory;
+ private OTEJobStatus status;
+ private HeadlessClassServer classServer;
+ private OTEConfiguration configuration;
+
+ public ConfigureOteServer(URI uri, List<File> jars, Progress progress, WebResourceFactory factory) {
+ super(progress);
+ this.uri = uri;
+ this.jars = jars;
+ this.progress = progress;
+ this.factory = factory;
+ }
+
+ public ConfigureOteServer(URI uri, OTEConfiguration configuration, Progress progress, WebResourceFactory factory) {
+ super(progress);
+ this.uri = uri;
+ this.configuration = configuration;
+ this.progress = progress;
+ this.factory = factory;
+ }
+
+ @Override
+ public void doWork() throws Exception {
+ try{
+ status = sendBundleConfiguration();
+ if(!status.isJobComplete()){
+ waitForJobComplete();
+ }
+
+ if(!status.isSuccess()){
+ throw new Exception("Failed to configure the environment: " + status.getErrorLog());
+ }
+ } finally {
+ if(classServer != null){
+ classServer.stop();
+ }
+ }
+ }
+
+ private void waitForJobComplete() throws Exception {
+
+ URI jobUri = status.getUpdatedJobStatus().toURI();
+ final WebResource service = factory.createResource(jobUri);
+
+ while(!status.isJobComplete()){
+ Thread.sleep(POLLING_RATE);
+ status = service.accept(MediaType.APPLICATION_XML).get(OTEJobStatus.class);
+ progress.setUnitsOfWork(status.getTotalUnitsOfWork());
+ progress.setUnitsWorked(status.getUnitsWorked());
+ }
+ }
+
+ private OTEJobStatus sendBundleConfiguration() throws Exception {
+ WebResource baseService = factory.createResource(uri);
+ if(configuration == null){
+ OTEConfiguration localConfiguration = new OTEConfiguration();
+ OTEConfigurationIdentity identity = new OTEConfigurationIdentity();
+ identity.setName("test");
+ localConfiguration.setIdentity(identity);
+ classServer = new HeadlessClassServer(PortUtil.getInstance().getValidPort(), InetAddress.getLocalHost(), jars);
+ for (BundleInfo bundleInfo : classServer.getBundles()) {
+ OTEConfigurationItem item = new OTEConfigurationItem();
+ item.setBundleName(bundleInfo.getSymbolicName());
+ item.setBundleVersion(bundleInfo.getVersion());
+ item.setLocationUrl(bundleInfo.getServerBundleLocation().toString());
+ item.setMd5Digest(bundleInfo.getMd5Digest());
+ localConfiguration.addItem(item);
+ }
+ OTEConfiguration currentConfig = baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).get(OTEConfiguration.class);
+ if(currentConfig.equals(localConfiguration)){
+ OTEJobStatus status = new OTEJobStatus();
+ status.setSuccess(true);
+ status.setJobComplete(true);
+ return status;
+ } else {
+ return baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).post(OTEJobStatus.class, localConfiguration);
+ }
+ } else {
+ return baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).post(OTEJobStatus.class, this.configuration);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServerFile.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServerFile.java
deleted file mode 100644
index 5cc1d0f395..0000000000
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServerFile.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.osee.ote.rest.client.internal;
-
-import java.io.File;
-import java.net.InetAddress;
-import java.net.URI;
-import java.util.List;
-import javax.ws.rs.core.MediaType;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
-import org.eclipse.osee.framework.jdk.core.util.network.PortUtil;
-import org.eclipse.osee.ote.rest.client.ConfigurationProgress;
-import org.eclipse.osee.ote.rest.client.internal.jarserver.BundleInfo;
-import org.eclipse.osee.ote.rest.client.internal.jarserver.HeadlessClassServer;
-import org.eclipse.osee.ote.rest.model.OteConfiguration;
-import org.eclipse.osee.ote.rest.model.OteConfigurationIdentity;
-import org.eclipse.osee.ote.rest.model.OteConfigurationItem;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
-import com.sun.jersey.api.client.WebResource;
-
-public class ConfigureOteServerFile extends BaseClientCallable<ConfigurationProgress> {
-
- private static final long POLLING_RATE = 1000;
- private URI uri;
- private List<File> jars;
- private ConfigurationProgress progress;
- private WebResourceFactory factory;
- private OteJobStatus status;
- private HeadlessClassServer classServer;
-
- public ConfigureOteServerFile(URI uri, List<File> jars, ConfigurationProgress progress, WebResourceFactory factory) {
- super(progress);
- this.uri = uri;
- this.jars = jars;
- this.progress = progress;
- this.factory = factory;
- }
-
- @Override
- public void doWork() throws Exception {
- try{
- Conditions.checkNotNull(uri, "uri");
- Conditions.checkNotNull(factory, "factory");
- Conditions.checkNotNullOrEmpty(jars, "jars");
-
- status = sendBundleConfiguration();
- if(!status.isJobComplete()){
- waitForJobComplete();
- }
-
- if(!status.isSuccess()){
- throw new Exception("Failed to configure the environment: " + status.getErrorLog());
- }
- } finally {
- if(classServer != null){
- classServer.stop();
- }
- }
- }
-
- private void waitForJobComplete() throws Exception {
-
- URI jobUri = status.getUpdatedJobStatus().toURI();
- final WebResource service = factory.createResource(jobUri);
-
- while(!status.isJobComplete()){
- Thread.sleep(POLLING_RATE);
- status = service.accept(MediaType.APPLICATION_XML).get(OteJobStatus.class);
- progress.setUnitsOfWork(status.getTotalUnitsOfWork());
- progress.setUnitsWorked(status.getUnitsWorked());
- }
- }
-
- private OteJobStatus sendBundleConfiguration() throws Exception {
- OteConfiguration configuration = new OteConfiguration();
- OteConfigurationIdentity identity = new OteConfigurationIdentity();
- identity.setName("test");
- configuration.setIdentity(identity);
- classServer = new HeadlessClassServer(PortUtil.getInstance().getValidPort(), InetAddress.getLocalHost(), jars);
- for (BundleInfo bundleInfo : classServer.getBundles()) {
- OteConfigurationItem item = new OteConfigurationItem();
- item.setBundleName(bundleInfo.getSymbolicName());
- item.setBundleVersion(bundleInfo.getVersion());
- item.setLocationUrl(bundleInfo.getServerBundleLocation().toString());
- item.setMd5Digest(bundleInfo.getMd5Digest());
- configuration.addItem(item);
- }
- WebResource baseService = factory.createResource(uri);
-
- OteConfiguration currentConfig = baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).get(OteConfiguration.class);
- if(currentConfig.equals(configuration)){
- OteJobStatus status = new OteJobStatus();
- status.setSuccess(true);
- status.setJobComplete(true);
- return status;
- } else {
- return baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).post(OteJobStatus.class, configuration);
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
index fd47e20310..6e3325a799 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
@@ -7,21 +7,21 @@ import java.net.URI;
import javax.ws.rs.core.MediaType;
-import org.eclipse.osee.ote.rest.client.GetFileProgress;
+import org.eclipse.osee.ote.rest.client.Progress;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
-public class GetOteServerFile extends BaseClientCallable<GetFileProgress> {
+public class GetOteServerFile extends BaseClientCallable<Progress> {
private URI uri;
private String filePath;
@SuppressWarnings("unused")
- private GetFileProgress progress;
+ private Progress progress;
private WebResourceFactory factory;
private File destination;
- public GetOteServerFile(URI uri, File destination, String filePath, GetFileProgress progress, WebResourceFactory factory) {
+ public GetOteServerFile(URI uri, File destination, String filePath, Progress progress, WebResourceFactory factory) {
super(progress);
this.uri = uri;
this.filePath = filePath;
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
index 0e8e76eb86..ecc7ba9690 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
@@ -18,9 +18,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
-import org.eclipse.osee.ote.rest.client.ConfigurationProgress;
-import org.eclipse.osee.ote.rest.client.GetFileProgress;
+import org.eclipse.osee.ote.rest.client.OTECacheItem;
import org.eclipse.osee.ote.rest.client.OteClient;
+import org.eclipse.osee.ote.rest.client.Progress;
+import org.eclipse.osee.ote.rest.client.ProgressWithCancel;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTETestRun;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
@@ -62,13 +65,28 @@ public class OteClientImpl implements OteClient, WebResourceFactory {
}
@Override
- public Future<GetFileProgress> getFile(URI uri, File destination, String filePath, final GetFileProgress progress){
+ public Future<Progress> getFile(URI uri, File destination, String filePath, final Progress progress){
return executor.submit(new GetOteServerFile(uri, destination, filePath, progress, this));
}
@Override
- public Future<ConfigurationProgress> configureServerEnvironment(URI uri, List<File> jars, final ConfigurationProgress progress){
- return executor.submit(new ConfigureOteServerFile(uri, jars, progress, this));
+ public Future<Progress> configureServerEnvironment(URI uri, List<File> jars, final Progress progress){
+ return executor.submit(new ConfigureOteServer(uri, jars, progress, this));
+ }
+
+ @Override
+ public Future<Progress> updateServerJarCache(URI uri, String baseJarURL, List<OTECacheItem> jars, Progress progress) {
+ return executor.submit(new PrepareOteServerFile(uri, baseJarURL, jars, progress, this));
+ }
+
+ @Override
+ public Future<ProgressWithCancel> runTest(URI uri, OTETestRun tests, Progress progress) {
+ return executor.submit(new RunTests(uri, tests, progress, this));
+ }
+
+ @Override
+ public Future<Progress> configureServerEnvironment(URI uri, OTEConfiguration configuration, Progress progress) {
+ return executor.submit(new ConfigureOteServer(uri, configuration, progress, this));
}
}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
new file mode 100644
index 0000000000..70729e717b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
@@ -0,0 +1,83 @@
+package org.eclipse.osee.ote.rest.client.internal;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+
+import org.eclipse.osee.ote.rest.client.Progress;
+import org.eclipse.osee.ote.rest.client.OTECacheItem;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTEConfigurationIdentity;
+import org.eclipse.osee.ote.rest.model.OTEConfigurationItem;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
+
+import com.sun.jersey.api.client.WebResource;
+
+public class PrepareOteServerFile extends BaseClientCallable<Progress> {
+
+ private static final long POLLING_RATE = 1000;
+ private URI uri;
+ private List<OTECacheItem> jars;
+ private Progress progress;
+ private WebResourceFactory factory;
+ private OTEJobStatus status;
+ private String baseJarURL;
+
+ public PrepareOteServerFile(URI uri, String baseJarURL, List<OTECacheItem> jars, Progress progress, WebResourceFactory factory) {
+ super(progress);
+ this.uri = uri;
+ this.jars = jars;
+ this.progress = progress;
+ this.factory = factory;
+ this.baseJarURL = baseJarURL;
+ }
+
+ @Override
+ public void doWork() throws Exception {
+ try{
+ status = sendBundleConfiguration();
+ if(!status.isJobComplete()){
+ waitForJobComplete();
+ }
+
+ if(!status.isSuccess()){
+ throw new Exception("Failed to update the environment cache: " + status.getErrorLog());
+ }
+ } finally {
+
+ }
+ }
+
+ private void waitForJobComplete() throws Exception {
+
+ URI jobUri = status.getUpdatedJobStatus().toURI();
+ final WebResource service = factory.createResource(jobUri);
+
+ while(!status.isJobComplete()){
+ Thread.sleep(POLLING_RATE);
+ status = service.accept(MediaType.APPLICATION_JSON).get(OTEJobStatus.class);
+ progress.setUnitsOfWork(status.getTotalUnitsOfWork());
+ progress.setUnitsWorked(status.getUnitsWorked());
+ }
+ }
+
+ private OTEJobStatus sendBundleConfiguration() throws Exception {
+ OTEConfiguration configuration = new OTEConfiguration();
+ OTEConfigurationIdentity identity = new OTEConfigurationIdentity();
+ identity.setName("test");
+ configuration.setIdentity(identity);
+ for (OTECacheItem bundleInfo : jars) {
+ OTEConfigurationItem item = new OTEConfigurationItem();
+ item.setBundleName(bundleInfo.getFile().getName());
+ item.setBundleVersion("N/A");
+ item.setLocationUrl(baseJarURL + bundleInfo.getMd5());
+ item.setMd5Digest(bundleInfo.getMd5());
+ configuration.addItem(item);
+ }
+ WebResource baseService = factory.createResource(uri);
+
+ return baseService.path("ote").path("cache").accept(MediaType.APPLICATION_XML).post(OTEJobStatus.class, configuration);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
new file mode 100644
index 0000000000..a9402786d9
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
@@ -0,0 +1,112 @@
+package org.eclipse.osee.ote.rest.client.internal;
+
+import java.net.URI;
+import java.util.concurrent.Callable;
+import java.util.logging.Level;
+
+import javax.ws.rs.core.MediaType;
+
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.ote.rest.client.Progress;
+import org.eclipse.osee.ote.rest.client.ProgressWithCancel;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
+import org.eclipse.osee.ote.rest.model.OTETestRun;
+
+import com.sun.jersey.api.client.WebResource;
+
+public class RunTests implements ProgressWithCancel, Callable<ProgressWithCancel> {
+
+ private URI uri;
+ private OTETestRun tests;
+ private Progress progress;
+ private WebResourceFactory factory;
+ private OTEJobStatus status;
+ private String id;
+
+ public RunTests(URI uri, OTETestRun tests, Progress progress, WebResourceFactory factory) {
+ this.uri = uri;
+ this.tests = tests;
+ this.progress = progress;
+ this.factory = factory;
+ }
+
+ public void doWork() throws Exception {
+ try{
+ status = sendCommand();
+ id = status.getJobId();
+ if(!status.isSuccess()){
+ throw new Exception("Failed to submit the run command: " + status.getErrorLog());
+ }
+ } finally {
+
+ }
+ }
+
+ @Override
+ public boolean cancelSingle() {
+ WebResource baseService;
+ try {
+ baseService = factory.createResource(uri);
+ OTEJobStatus cancelStatus = baseService.path("ote").path("run").path(id).accept(MediaType.APPLICATION_JSON).put(OTEJobStatus.class);
+ return cancelStatus.isSuccess();
+ } catch (Exception e) {
+ OseeLog.log(getClass(), Level.SEVERE, e);
+ return false;
+ }
+ }
+
+ private OTEJobStatus sendCommand() throws Exception {
+ WebResource baseService = factory.createResource(uri);
+ return baseService.path("ote").path("run").accept(MediaType.APPLICATION_JSON).post(OTEJobStatus.class, tests);
+ }
+
+ @Override
+ public boolean cancelAll() {
+ WebResource baseService;
+ try {
+ baseService = factory.createResource(uri);
+ OTEJobStatus cancelStatus = baseService.path("ote").path("run").path(id).accept(MediaType.APPLICATION_JSON).delete(OTEJobStatus.class);
+ return cancelStatus.isSuccess();
+ } catch (Exception e) {
+ OseeLog.log(getClass(), Level.SEVERE, e);
+ return false;
+ }
+ }
+
+ @Override
+ final public ProgressWithCancel call() throws Exception {
+ try{
+ doWork();
+ progress.success();
+ } catch (Throwable th){
+ progress.fail(th);
+ }
+ return this;
+ }
+
+ @Override
+ public void fail(String string) {
+ progress.fail(string);
+ }
+
+ @Override
+ public void fail(Throwable th) {
+ progress.fail(th);
+ }
+
+ @Override
+ public void setUnitsOfWork(int totalUnitsOfWork) {
+ progress.setUnitsOfWork(totalUnitsOfWork);
+ }
+
+ @Override
+ public void setUnitsWorked(int unitsWorked) {
+ progress.setUnitsWorked(unitsWorked);
+ }
+
+ @Override
+ public void success() {
+ progress.success();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/KeyValue.java b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/KeyValue.java
new file mode 100644
index 0000000000..9726e7d4bb
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/KeyValue.java
@@ -0,0 +1,62 @@
+package org.eclipse.osee.ote.rest.model;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class KeyValue {
+
+ private String key;
+ private String value;
+
+ private List<String> values;
+
+ public KeyValue(){
+
+ }
+
+ public KeyValue(String key, String value){
+ this.key = key;
+ this.value = value;
+ }
+
+ public KeyValue(String key, List<String> values) {
+ this.key = key;
+ this.values = values;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @XmlElementWrapper
+ @XmlElement(name="Values")
+ public List<String> getValues() {
+ return values;
+ }
+
+ public List<String> setValues(List<String> values) {
+ return this.values = values;
+ }
+
+ public void setValueArray(List<String> values) {
+ this.values = values;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfiguration.java b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfiguration.java
index 4646693e40..a6a455d4fc 100644
--- a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfiguration.java
+++ b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfiguration.java
@@ -21,23 +21,26 @@ import javax.xml.bind.annotation.XmlRootElement;
* @author Andrew M. Finkbeiner
*/
@XmlRootElement
-public class OteConfiguration {
+public class OTEConfiguration {
- private OteConfigurationIdentity identity;
+ private OTEConfigurationIdentity identity;
- private List<OteConfigurationItem> items;
+ private List<OTEConfigurationItem> items;
+
+ private boolean install;
- public OteConfiguration(){
- items = new ArrayList<OteConfigurationItem>();
+ public OTEConfiguration(){
+ items = new ArrayList<OTEConfigurationItem>();
+ this.install = true;
}
- public OteConfigurationIdentity getIdentity(){
+ public OTEConfigurationIdentity getIdentity(){
return identity;
}
@XmlElementWrapper
- @XmlElement(name="OteConfigurationItem")
- public List<OteConfigurationItem> getItems(){
+ @XmlElement(name="OTEConfigurationItem")
+ public List<OTEConfigurationItem> getItems(){
return items;
}
@@ -58,7 +61,7 @@ public class OteConfiguration {
return false;
if (getClass() != obj.getClass())
return false;
- OteConfiguration other = (OteConfiguration) obj;
+ OTEConfiguration other = (OTEConfiguration) obj;
// if (identity == null) {
// if (other.identity != null)
// return false;
@@ -72,12 +75,20 @@ public class OteConfiguration {
return true;
}
- public void setIdentity(OteConfigurationIdentity identity) {
+ public void setIdentity(OTEConfigurationIdentity identity) {
this.identity = identity;
}
- public void addItem(OteConfigurationItem item){
+ public void addItem(OTEConfigurationItem item){
items.add(item);
}
+
+ public void setInstall(boolean install) {
+ this.install = install;
+ }
+
+ public boolean getInstall(){
+ return this.install;
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfigurationIdentity.java b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfigurationIdentity.java
index d0ecf1562d..7c104d4d99 100644
--- a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfigurationIdentity.java
+++ b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfigurationIdentity.java
@@ -16,7 +16,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* @author Roberto E. Escobar
*/
@XmlRootElement
-public class OteConfigurationIdentity {
+public class OTEConfigurationIdentity {
private String uuid;
private String name;
diff --git a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfigurationItem.java b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfigurationItem.java
index 0a5c8c3ad3..4dba4b9ac7 100644
--- a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteConfigurationItem.java
+++ b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEConfigurationItem.java
@@ -3,12 +3,13 @@ package org.eclipse.osee.ote.rest.model;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
-public class OteConfigurationItem {
+public class OTEConfigurationItem {
private String locationUrl;
private String md5Digest;
private String bundleVersion;
private String bundleName;
+ private boolean isOsgiBundle;
public String getLocationUrl() {
return locationUrl;
@@ -26,6 +27,7 @@ public class OteConfigurationItem {
int result = 1;
result = prime * result + ((bundleName == null) ? 0 : bundleName.hashCode());
result = prime * result + ((bundleVersion == null) ? 0 : bundleVersion.hashCode());
+ result = prime * result + (isOsgiBundle ? 1231 : 1237);
result = prime * result + ((locationUrl == null) ? 0 : locationUrl.hashCode());
result = prime * result + ((md5Digest == null) ? 0 : md5Digest.hashCode());
return result;
@@ -39,7 +41,7 @@ public class OteConfigurationItem {
return false;
if (getClass() != obj.getClass())
return false;
- OteConfigurationItem other = (OteConfigurationItem) obj;
+ OTEConfigurationItem other = (OTEConfigurationItem) obj;
if (bundleName == null) {
if (other.bundleName != null)
return false;
@@ -50,6 +52,8 @@ public class OteConfigurationItem {
return false;
} else if (!bundleVersion.equals(other.bundleVersion))
return false;
+ if (isOsgiBundle != other.isOsgiBundle)
+ return false;
if (locationUrl == null) {
if (other.locationUrl != null)
return false;
@@ -84,4 +88,12 @@ public class OteConfigurationItem {
return bundleVersion;
}
+ public boolean isOsgiBundle() {
+ return isOsgiBundle;
+ }
+ public void setOsgiBundle(boolean isOsgiBundle) {
+ this.isOsgiBundle = isOsgiBundle;
+ }
+
+
}
diff --git a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteJobStatus.java b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEJobStatus.java
index 62859ed50d..833ce5d2c5 100644
--- a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OteJobStatus.java
+++ b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTEJobStatus.java
@@ -5,7 +5,7 @@ import java.net.URL;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
-public class OteJobStatus {
+public class OTEJobStatus {
private URL updatedJobStatus;
private String jobId;
@@ -16,7 +16,7 @@ public class OteJobStatus {
private boolean jobComplete;
private boolean success;
- public OteJobStatus(){
+ public OTEJobStatus(){
errorLog = "";
jobComplete = false;
success = true;
diff --git a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTETestRun.java b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTETestRun.java
new file mode 100644
index 0000000000..b19f694f91
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/OTETestRun.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.ote.rest.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+@XmlRootElement
+public class OTETestRun {
+
+ private OTEConfiguration jarConfiguration;
+ private Properties globalProperties;
+ private List<Properties> tests;
+
+ public OTETestRun(){
+ tests = new ArrayList<Properties>();
+ globalProperties = new Properties();
+ }
+
+ public Properties getGlobalProperties(){
+ return globalProperties;
+ }
+
+ @XmlElementWrapper
+ @XmlElement(name="Properties")
+ public List<Properties> getTests(){
+ return tests;
+ }
+
+ public void setGlobalProperties(Properties globalProperties) {
+ this.globalProperties = globalProperties;
+ }
+
+ public void addTest(Properties test){
+ tests.add(test);
+ }
+
+ public OTEConfiguration getJarConfiguration() {
+ return jarConfiguration;
+ }
+
+ public void setJarConfiguration(OTEConfiguration jarConfiguration) {
+ this.jarConfiguration = jarConfiguration;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/Properties.java b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/Properties.java
new file mode 100644
index 0000000000..d25d46c76f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest.model/src/org/eclipse/osee/ote/rest/model/Properties.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.ote.rest.model;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+@XmlRootElement
+public class Properties {
+
+ private List<KeyValue> pairs;
+
+ public Properties(){
+ pairs = new ArrayList<KeyValue>();
+ }
+
+ public Properties(String simpleName) {
+ this();
+ }
+
+ @XmlElementWrapper
+ @XmlElement(name="Pair")
+ public List<KeyValue> getPairs(){
+ return pairs;
+ }
+
+ public List<KeyValue> setPairs(List<KeyValue> pairs){
+ return this.pairs = pairs;
+ }
+
+ public void addPair(KeyValue pair){
+ pairs.add(pair);
+ }
+
+ public void put(String key, boolean value) {
+ put(key, Boolean.toString(value));
+ }
+
+ public void put(String key, String value) {
+ KeyValue pair = findPair(key);
+ if(pair == null){
+ pairs.add(new KeyValue(key, value));
+ } else {
+ pair.setValueArray(null);
+ pair.setValue(value);
+ }
+ }
+
+ public void put(String key, List<String> values) {
+ KeyValue pair = findPair(key);
+ if(pair == null){
+ pairs.add(new KeyValue(key, values));
+ } else {
+ pair.setValueArray(values);
+ pair.setValue(null);
+ }
+ }
+
+ public void put(String key, String[] values) {
+ put(key, Arrays.asList(values));
+ }
+
+ private KeyValue findPair(String key) {
+ for(KeyValue pair:pairs){
+ if(pair.getKey().equals(key)){
+ return pair;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.rest/META-INF/MANIFEST.MF
index ce423aed97..8d00edf6c4 100644
--- a/plugins/org.eclipse.osee.ote.rest/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.rest/META-INF/MANIFEST.MF
@@ -11,6 +11,9 @@ Import-Package: javax.ws.rs,
javax.ws.rs.ext,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.ote,
+ org.eclipse.osee.ote.core,
+ org.eclipse.osee.ote.core.environment,
+ org.eclipse.osee.ote.core.framework.command,
org.eclipse.osee.ote.rest.model
-Require-Bundle: org.eclipse.osee.framework.jdk.core;bundle-version="0.11.0",
+Require-Bundle: org.eclipse.osee.framework.jdk.core,
org.eclipse.core.runtime
diff --git a/plugins/org.eclipse.osee.ote.rest/OSGI-INF/ote.run.tests.component.xml b/plugins/org.eclipse.osee.ote.rest/OSGI-INF/ote.run.tests.component.xml
new file mode 100644
index 0000000000..b5474dcb1e
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/OSGI-INF/ote.run.tests.component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.ote.rest.OteRunTests">
+ <implementation class="org.eclipse.osee.ote.rest.internal.OteRunTestCommandsImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.ote.rest.internal.OteRunTestCommands"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.rest/build.properties b/plugins/org.eclipse.osee.ote.rest/build.properties
index 168d2dd5dc..8910159624 100644
--- a/plugins/org.eclipse.osee.ote.rest/build.properties
+++ b/plugins/org.eclipse.osee.ote.rest/build.properties
@@ -3,5 +3,6 @@ bin.includes = META-INF/,\
.,\
OSGI-INF/,\
OSGI-INF/ote.configuration.store.xml,\
- OSGI-INF/ote.job.store.xml
+ OSGI-INF/ote.job.store.xml,\
+ OSGI-INF/ote.run.tests.component.xml
source.. = src/
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ConfigurationJobStatus.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ConfigurationJobStatus.java
index d2a55d3d2b..1066ad65c8 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ConfigurationJobStatus.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ConfigurationJobStatus.java
@@ -2,20 +2,20 @@ package org.eclipse.osee.ote.rest.internal;
import java.net.URL;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEFuture;
+import org.eclipse.osee.ote.ConfigurationStatus;
import org.eclipse.osee.ote.OTEStatusCallback;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
-public class ConfigurationJobStatus implements OTEStatusCallback<OTEConfigurationStatus>, OteJob {
+public class ConfigurationJobStatus implements OTEStatusCallback<ConfigurationStatus>, OteJob {
private int totalUnitsOfWork;
private int count;
private StringBuilder errorLog;
private StringBuilder statusLog;
- private OTEFuture<OTEConfigurationStatus> future;
+ private Future<ConfigurationStatus> future;
private String uuid;
private URL url;
@@ -26,7 +26,7 @@ public class ConfigurationJobStatus implements OTEStatusCallback<OTEConfiguratio
}
@Override
- public void complete(OTEConfigurationStatus done) {
+ public void complete(ConfigurationStatus done) {
}
@Override
@@ -59,13 +59,13 @@ public class ConfigurationJobStatus implements OTEStatusCallback<OTEConfiguratio
errorLog.append("\n");
}
- public void setFuture(OTEFuture<OTEConfigurationStatus> future) {
+ public void setFuture(Future<ConfigurationStatus> future) {
this.future = future;
}
@Override
- public OteJobStatus getStatus() throws InterruptedException, ExecutionException {
- OteJobStatus jobStatus = new OteJobStatus();
+ public OTEJobStatus getStatus() throws InterruptedException, ExecutionException {
+ OTEJobStatus jobStatus = new OTEJobStatus();
if(future.isDone()){
jobStatus.setJobComplete(true);
jobStatus.setSuccess(future.get().isSuccess());
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/HTMLBuilder.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/HTMLBuilder.java
new file mode 100644
index 0000000000..4bfc2cb82e
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/HTMLBuilder.java
@@ -0,0 +1,127 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+public class HTMLBuilder {
+
+ private static String hostname = "";
+ private static final String serverTitle = "OTE Server";
+
+ private StringBuilder sb;
+
+ static {
+ try {
+ InetAddress localHost = InetAddress.getLocalHost();
+ hostname = localHost.getHostName();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public HTMLBuilder() {
+ sb = new StringBuilder();
+ }
+
+ public void open(String title){
+ sb.append("<!DOCTYPE HTML>\n");
+ sb.append("<html>\n");
+ sb.append("<head>\n");
+ sb.append("<title>"+title+"</title>\n");
+ sb.append("</head>\n");
+ sb.append("<body>\n");
+ }
+
+ public void commonHeader(File directory){
+ h2(serverTitle + " on " + hostname);
+ h3("Local Folder:");
+ p(directory.getAbsolutePath());
+ }
+
+ private void h3(String string) {
+ sb.append("<h3>");
+ sb.append(string);
+ sb.append("</h3>");
+ }
+
+ public void addLink(String baseUrl, String path, String title){
+ sb.append("<a href=\"");
+ sb.append(baseUrl);
+ if(!baseUrl.endsWith("/")){
+ sb.append("/");
+ }
+ sb.append(path);
+ sb.append("\">");
+ sb.append(title);
+ sb.append("</a>");
+ }
+
+ public void close(){
+ sb.append("</body>\n");
+ sb.append("</html>\n");
+ }
+
+ public String get(){
+ return sb.toString();
+ }
+
+ public void br() {
+ sb.append("<br>");
+ }
+
+ public void pre(String statusFileContents) {
+ sb.append("<pre>");
+ sb.append(statusFileContents);
+ sb.append("</pre>");
+ }
+
+ public void p(String content) {
+ sb.append("<p>");
+ sb.append(content);
+ sb.append("</p>");
+ }
+
+ public void h2(String title) {
+ sb.append("<h2>");
+ sb.append(title);
+ sb.append("</h2>");
+ }
+
+ public void ulStart() {
+ sb.append("<ul>");
+ }
+
+ public void ulStop() {
+ sb.append("</ul>");
+ }
+
+ public void li(String name) {
+ sb.append("<li>");
+ sb.append(name);
+ sb.append("</li>");
+ }
+
+ public void tableStart() {
+ sb.append("<table border=\"1\">");
+ }
+
+ public void trStart() {
+ sb.append("<tr>");
+ }
+
+ public void td(String string) {
+ sb.append("<td>");
+ sb.append(string);
+ sb.append("</td>");
+ }
+
+ public void trEnd() {
+ sb.append("</tr>");
+ }
+
+ public void tableEnd() {
+ sb.append("</table>");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEConfigItemSort.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEConfigItemSort.java
new file mode 100644
index 0000000000..2d8c41105a
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEConfigItemSort.java
@@ -0,0 +1,14 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import java.util.Comparator;
+
+import org.eclipse.osee.ote.rest.model.OTEConfigurationItem;
+
+public class OTEConfigItemSort implements Comparator<OTEConfigurationItem> {
+
+ @Override
+ public int compare(OTEConfigurationItem arg0, OTEConfigurationItem arg1) {
+ return arg0.getBundleName().compareTo(arg1.getBundleName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEStatusCallbackForRun.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEStatusCallbackForRun.java
new file mode 100644
index 0000000000..ed47e1d761
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OTEStatusCallbackForRun.java
@@ -0,0 +1,44 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import org.eclipse.osee.ote.ConfigurationStatus;
+import org.eclipse.osee.ote.OTEStatusCallback;
+
+public class OTEStatusCallbackForRun<T> implements OTEStatusCallback<ConfigurationStatus> {
+
+ @Override
+ public void complete(ConfigurationStatus done) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTotalUnitsOfWork(int totalUnitsOfWork) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void incrememtUnitsWorked(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void log(String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void error(String message, Throwable th) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void error(String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchResource.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchResource.java
new file mode 100644
index 0000000000..280809abdb
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchResource.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * 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.ote.rest.internal;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
+
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.ote.OTEApi;
+import org.eclipse.osee.ote.core.ServiceUtility;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+@Path("batches")
+public class OteBatchResource {
+
+ // Allows to insert contextual objects into the class,
+ // e.g. ServletContext, Request, Response, UriInfo
+ @Context
+ UriInfo uriInfo;
+ @Context
+ Request request;
+ private String path;
+
+ public OteBatchResource(UriInfo uriInfo, Request request, String path) {
+ this.uriInfo = uriInfo;
+ this.request = request;
+ this.path = path;
+ }
+
+ public OteBatchResource() {
+ this.path = "";
+ }
+
+ @GET
+ @Produces(MediaType.TEXT_HTML)
+ public String getBatches() throws OseeCoreException {
+ OTEApi ote = ServiceUtility.getService(OTEApi.class);
+ File rootBatches = ote.getServerFolder().getBatchesFolder();
+ File myBatchFolder = new File(rootBatches, path);
+ File logFile = ote.getServerFolder().getBatchLogFile(myBatchFolder);
+
+ String url = uriInfo.getAbsolutePath().toASCIIString();
+ HTMLBuilder builder = new HTMLBuilder();
+
+ builder.open("OTE Batch Status");
+ builder.addLink(url, "content.zip", "Get Folder Contents");
+ builder.commonHeader(myBatchFolder);
+
+
+ generateStatusSection(builder, ote, myBatchFolder);
+
+ generateResultsSection(builder, ote, myBatchFolder);
+
+ builder.h2("Output");
+ builder.pre(getFileContents(logFile));
+ builder.close();
+ return builder.get();
+ }
+
+ private void generateResultsSection(HTMLBuilder builder, OTEApi ote, File myBatchFolder) {
+ File runList = ote.getServerFolder().getBatchRunList(myBatchFolder);
+ String runListContents = "";
+ if(runList.exists()){
+ runListContents = getFileContents(runList);
+ }
+ if(runListContents.length() > 0){
+ File[] resultFiles = myBatchFolder.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File arg0) {
+ return arg0.getName().endsWith(".result");
+ }
+ });
+ String[] runListArray = runListContents.split("\n");
+ List<TestResultSummary> results = getTestResults(resultFiles, runListArray);
+ builder.h2("Tests");
+ builder.tableStart();
+ builder.trStart();
+ builder.td("Test");
+ builder.td("Result");
+ builder.td("Time");
+ builder.trEnd();
+
+ for(TestResultSummary result:results){
+ builder.trStart();
+ builder.td(result.getName());
+ builder.td(result.getResult());
+ builder.td(result.getTime());
+ builder.trEnd();
+ }
+
+ builder.tableEnd();
+
+ } else {
+ builder.h2("Files");
+ builder.ulStart();
+ File[] batches = myBatchFolder.listFiles();
+ Arrays.sort(batches, new TimeSort());
+ for(File file:batches){
+ builder.li(file.getName());
+ }
+ builder.ulStop();
+ }
+ }
+
+
+
+ private List<TestResultSummary> getTestResults(File[] resultFiles, String[] runListArray) {
+ List<TestResultSummary> results = new ArrayList<TestResultSummary>();
+ Map<String, TestResultSummary> resultsTemp = new HashMap<String, TestResultSummary>();
+ for(File file:resultFiles){
+ String content = getFileContents(file);
+ if(content.length() > 0){
+ String[] data = content.split(",");
+ if(data.length == 3){
+ resultsTemp.put(data[0], new TestResultSummary(data[0], data[1], data[2]));
+ }
+ }
+ }
+ for(String name:runListArray){
+ TestResultSummary result = resultsTemp.get(name);
+ if(result == null){
+ result = new TestResultSummary(name);
+ }
+ results.add(result);
+ }
+ return results;
+ }
+
+ private void generateStatusSection(HTMLBuilder builder, OTEApi ote, File myBatchFolder){
+ builder.h2("Status");
+ String status = getFileContents(ote.getServerFolder().getBatchStatusFile(myBatchFolder));
+ if(status.length() == 0){
+ status = "unknown";
+ }
+ builder.p(status);
+ }
+
+ private String getFileContents(File statusFile) {
+ String status = "";
+ try {
+ if(statusFile.exists()){
+ status = Lib.fileToString(statusFile);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return status;
+ }
+
+ @Path("content.zip")
+ @GET
+ @Produces({"application/zip"})
+ public StreamingOutput getZip() throws Exception {
+ return new StreamingOutput() {
+ public void write(OutputStream output) throws IOException, WebApplicationException {
+ try {
+ OTEApi ote = ServiceUtility.getService(OTEApi.class);
+ File rootBatches = ote.getServerFolder().getBatchesFolder();
+ File myBatchFolder = new File(rootBatches, path);
+ ZIPGenerator generator = new ZIPGenerator(myBatchFolder);
+ generator.generateZip(output);
+ } catch (Exception e) {
+ throw new WebApplicationException(e);
+ }
+ }
+ };
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchesResource.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchesResource.java
new file mode 100644
index 0000000000..b92e6089ac
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteBatchesResource.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.ote.rest.internal;
+
+import java.io.File;
+import java.util.Arrays;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.ote.OTEApi;
+import org.eclipse.osee.ote.OTEServerFolder;
+import org.eclipse.osee.ote.core.ServiceUtility;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+@Path("batches")
+public class OteBatchesResource {
+
+ // Allows to insert contextual objects into the class,
+ // e.g. ServletContext, Request, Response, UriInfo
+ @Context
+ UriInfo uriInfo;
+ @Context
+ Request request;
+
+ @GET
+ @Produces(MediaType.TEXT_HTML)
+ public String getBatches() throws OseeCoreException {
+ OTEApi ote = ServiceUtility.getService(OTEApi.class);
+ File[] batches = ote.getServerFolder().getBatchesFolder().listFiles();
+ String url = uriInfo.getAbsolutePath().toASCIIString();
+ HTMLBuilder builder = new HTMLBuilder();
+ builder.open("OTE Server Batches");
+ builder.commonHeader(ote.getServerFolder().getBatchesFolder());
+
+ builder.h2("Archived Batches:");
+ Arrays.sort(batches, new ReverseAlphabeticalSort());
+ for(File file:batches){
+ if(file.isDirectory()){
+ builder.addLink(url, file.getName(), file.getName());
+ builder.br();
+ }
+ }
+ builder.close();
+ return builder.get();
+ }
+
+ @Path("{path}")
+ public OteBatchResource getConfiguration(@PathParam("path") String path) {
+ return new OteBatchResource(uriInfo, request, path);
+ }
+
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationResource.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationResource.java
index f0d46907cc..684b8500d4 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationResource.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationResource.java
@@ -12,6 +12,10 @@ package org.eclipse.osee.ote.rest.internal;
import java.io.IOException;
import java.net.MalformedURLException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
import java.util.concurrent.ExecutionException;
import javax.ws.rs.Consumes;
@@ -25,8 +29,9 @@ import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriBuilderException;
import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.ote.rest.model.OteConfiguration;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTEConfigurationItem;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
/**
* @author Andrew M. Finkbeiner
@@ -43,17 +48,34 @@ public class OteConfigurationResource {
@GET
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public OteConfiguration getConfiguration() throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException {
+ public OTEConfiguration getConfiguration() throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException {
return getDataStore().getConfiguration(uriInfo);
}
@POST
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public OteJobStatus createConfig(OteConfiguration config) throws IOException, InterruptedException, ExecutionException {
+ public OTEJobStatus createConfig(OTEConfiguration config) throws IOException, InterruptedException, ExecutionException {
return getDataStore().setup(config, uriInfo);
}
+ @GET
+ @Produces({MediaType.TEXT_HTML})
+ public String getHtmlConfiguration() throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException {
+ OTEConfiguration config = getDataStore().getConfiguration(uriInfo);
+ HTMLBuilder b = new HTMLBuilder();
+ b.open("OTE Server Configuration");
+ b.h2("Server Configuration");
+ b.ulStart();
+ List<OTEConfigurationItem> items = config.getItems();
+ Collections.sort(items, new OTEConfigItemSort());
+ for(OTEConfigurationItem item:config.getItems()){
+ b.li(String.format("%s %s", item.getBundleName(), item.getBundleVersion()));
+ }
+ b.ulStop();
+ return b.get();
+ }
+
private OteConfigurationStore getDataStore(){
return OteRestApplication.get();
}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStore.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStore.java
index a6c3751e25..2c58266fc5 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStore.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStore.java
@@ -7,13 +7,13 @@ import java.util.concurrent.ExecutionException;
import javax.ws.rs.core.UriBuilderException;
import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.ote.rest.model.OteConfiguration;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
public interface OteConfigurationStore {
- OteJobStatus setup(OteConfiguration config, UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException;
- OteJobStatus reset(UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException;
- OteConfiguration getConfiguration(UriInfo uriInfo) throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException;
- OteJobStatus getJob(String uuid) throws InterruptedException, ExecutionException;
+ OTEJobStatus setup(OTEConfiguration config, UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException;
+ OTEJobStatus reset(UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException;
+ OTEConfiguration getConfiguration(UriInfo uriInfo) throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException;
+ OTEJobStatus getJob(String uuid) throws InterruptedException, ExecutionException;
Collection<String> getAllJobIds();
}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStoreImpl.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStoreImpl.java
index 6d313cc3e2..6bbac8bb16 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStoreImpl.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteConfigurationStoreImpl.java
@@ -5,16 +5,16 @@ import java.net.URL;
import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
import javax.ws.rs.core.UriBuilderException;
import javax.ws.rs.core.UriInfo;
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.ConfigurationStatus;
import org.eclipse.osee.ote.OTEApi;
-import org.eclipse.osee.ote.OTEConfiguration;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEFuture;
-import org.eclipse.osee.ote.rest.model.OteConfiguration;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
public class OteConfigurationStoreImpl implements OteConfigurationStore {
@@ -41,15 +41,20 @@ public class OteConfigurationStoreImpl implements OteConfigurationStore {
}
@Override
- public OteJobStatus setup(OteConfiguration config, UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException {
- OTEConfiguration realConfig = TranslateUtil.translateToOtherConfig(config);
- ConfigurationJobStatus status = createConfigurationJobStatus(config, uriInfo);
- OTEFuture<OTEConfigurationStatus> future = ote.loadConfiguration(realConfig, status);
+ public OTEJobStatus setup(OTEConfiguration config, UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException {
+ Configuration realConfig = TranslateUtil.translateToOtherConfig(config);
+ ConfigurationJobStatus status = createConfigurationJobStatus(realConfig, uriInfo);
+ Future<ConfigurationStatus> future = null;
+ if(config.getInstall()){
+ future = ote.loadConfiguration(realConfig, status);
+ } else {
+ future = ote.downloadConfigurationJars(realConfig, status);
+ }
status.setFuture(future);
return status.getStatus();
}
- private ConfigurationJobStatus createConfigurationJobStatus(OteConfiguration config, UriInfo uriInfo) throws MalformedURLException, IllegalArgumentException, UriBuilderException {
+ private ConfigurationJobStatus createConfigurationJobStatus(Configuration config, UriInfo uriInfo) throws MalformedURLException, IllegalArgumentException, UriBuilderException {
ConfigurationJobStatus status = new ConfigurationJobStatus();
status.setId(UUID.randomUUID().toString());
status.setUrl(generateJobUrl(status, uriInfo));
@@ -62,22 +67,22 @@ public class OteConfigurationStoreImpl implements OteConfigurationStore {
}
@Override
- public OteJobStatus reset(UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException {
+ public OTEJobStatus reset(UriInfo uriInfo) throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, UriBuilderException {
ConfigurationJobStatus status = createConfigurationJobStatus(uriInfo);
- OTEFuture<OTEConfigurationStatus> future = ote.resetConfiguration(status);
+ Future<ConfigurationStatus> future = ote.resetConfiguration(status);
status.setFuture(future);
return status.getStatus();
}
@Override
- public OteConfiguration getConfiguration(UriInfo uriInfo) throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException {
+ public OTEConfiguration getConfiguration(UriInfo uriInfo) throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException {
ConfigurationJobStatus status = createConfigurationJobStatus(uriInfo);
- OTEFuture<OTEConfigurationStatus> future = ote.getConfiguration();
+ Future<ConfigurationStatus> future = ote.getConfiguration();
status.setFuture(future);
if(future.isDone()){
return TranslateUtil.translateConfig(future.get().getConfiguration());
} else {
- return new OteConfiguration();
+ return new OTEConfiguration();
}
}
@@ -90,7 +95,7 @@ public class OteConfigurationStoreImpl implements OteConfigurationStore {
}
@Override
- public OteJobStatus getJob(String uuid) throws InterruptedException, ExecutionException {
+ public OTEJobStatus getJob(String uuid) throws InterruptedException, ExecutionException {
return oteJobs.get(uuid);
}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJob.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJob.java
index d9614fdbe6..0d2c646793 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJob.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJob.java
@@ -2,12 +2,12 @@ package org.eclipse.osee.ote.rest.internal;
import java.util.concurrent.ExecutionException;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
public interface OteJob {
String getId();
void setId(String uuid);
- OteJobStatus getStatus() throws InterruptedException, ExecutionException;
+ OTEJobStatus getStatus() throws InterruptedException, ExecutionException;
}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobResource.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobResource.java
index adafd5f0c1..23a1f89232 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobResource.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobResource.java
@@ -18,7 +18,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
/**
* @author Andrew M. Finkbeiner
@@ -44,7 +44,7 @@ public class OteJobResource {
@GET
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public OteJobStatus getConfig() throws OseeCoreException, InterruptedException, ExecutionException {
+ public OTEJobStatus getConfig() throws OseeCoreException, InterruptedException, ExecutionException {
return store.getJob(uuid);
}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStore.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStore.java
index bba69370c6..90a74d0da3 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStore.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStore.java
@@ -3,11 +3,11 @@ package org.eclipse.osee.ote.rest.internal;
import java.util.Collection;
import java.util.concurrent.ExecutionException;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
public interface OteJobStore {
- OteJobStatus get(String uuid) throws InterruptedException, ExecutionException;
+ OTEJobStatus get(String uuid) throws InterruptedException, ExecutionException;
Collection<String> getAll();
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStoreImpl.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStoreImpl.java
index f3a30f587b..d163a4ed95 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStoreImpl.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteJobStoreImpl.java
@@ -4,7 +4,7 @@ import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
-import org.eclipse.osee.ote.rest.model.OteJobStatus;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
public class OteJobStoreImpl implements OteJobStore {
@@ -15,7 +15,7 @@ public class OteJobStoreImpl implements OteJobStore {
}
@Override
- public OteJobStatus get(String uuid) throws InterruptedException, ExecutionException {
+ public OTEJobStatus get(String uuid) throws InterruptedException, ExecutionException {
OteJob job = jobs.get(uuid);
if(job != null){
return job.getStatus();
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRestApplication.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRestApplication.java
index eea60588e9..3e16f5e67d 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRestApplication.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRestApplication.java
@@ -37,11 +37,16 @@ public class OteRestApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
+ classes.add(OteRootResource.class);
classes.add(OseeCoreExceptionMapper.class);
classes.add(OteConfigurationResource.class);
classes.add(OteJobsResource.class);
classes.add(OteFilesResource.class);
+ classes.add(OteRunTestResource.class);
+ classes.add(OteBatchesResource.class);
return classes;
}
+
+
}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRootResource.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRootResource.java
new file mode 100644
index 0000000000..dc5fce02f1
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRootResource.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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.ote.rest.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
+
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.ote.OTEApi;
+import org.eclipse.osee.ote.core.ServiceUtility;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+@Path("/")
+public class OteRootResource {
+
+ // Allows to insert contextual objects into the class,
+ // e.g. ServletContext, Request, Response, UriInfo
+ @Context
+ UriInfo uriInfo;
+ @Context
+ Request request;
+
+ @GET
+ @Produces(MediaType.TEXT_HTML)
+ public String getConfiguration() throws OseeCoreException {
+ String url = uriInfo.getAbsolutePath().toASCIIString();
+ OTEApi ote = ServiceUtility.getService(OTEApi.class);
+ File serverFolder = ote.getServerFolder().getServerFolder();
+ HTMLBuilder builder = new HTMLBuilder();
+ builder.open("OTE Server");
+ builder.commonHeader(serverFolder);
+ builder.h2("Batch Data:");
+ builder.addLink(url, "latestbatch", "Latest Batch");
+ builder.br();
+ builder.addLink(url, "batches", "Archived Batches");
+ builder.br();
+ builder.br();
+ builder.h2("Server Info:");
+ builder.addLink(url, "config", "Current Server Configuration");
+ builder.br();
+ builder.close();
+ return builder.get();
+ }
+
+ @Path("latestbatch")
+ @GET
+ @Produces(MediaType.TEXT_HTML)
+ public String getLatestBatch() throws Exception {
+ OTEApi ote = ServiceUtility.getService(OTEApi.class);
+ File[] batches = ote.getServerFolder().getBatchesFolder().listFiles();
+
+ Arrays.sort(batches, new ReverseAlphabeticalSort());
+ if(batches.length > 0){
+ return new OteBatchResource(uriInfo, request, batches[0].getName()).getBatches();
+ } else {
+ return new OteBatchResource().getBatches();
+ }
+ }
+
+ @Path("latestbatch/content.zip")
+ @GET
+ @Produces({"application/zip"})
+ public StreamingOutput getLatestBatchContent() throws Exception {
+ OTEApi ote = ServiceUtility.getService(OTEApi.class);
+ File[] batches = ote.getServerFolder().getBatchesFolder().listFiles();
+
+ Arrays.sort(batches, new ReverseAlphabeticalSort());
+ if(batches.length > 0){
+ return new OteBatchResource(uriInfo, request, batches[0].getName()).getZip();
+ } else {
+ return new OteBatchResource().getZip();
+ }
+ }
+
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommands.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommands.java
new file mode 100644
index 0000000000..0a2984db12
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommands.java
@@ -0,0 +1,9 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import org.eclipse.osee.ote.core.framework.command.RunTests;
+
+public interface OteRunTestCommands {
+ RunTests getCommand(String id);
+
+ void putCommand(String string, RunTests envTestRun);
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommandsImpl.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommandsImpl.java
new file mode 100644
index 0000000000..515cf0577f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestCommandsImpl.java
@@ -0,0 +1,28 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.osee.ote.core.framework.command.RunTests;
+
+public class OteRunTestCommandsImpl implements OteRunTestCommands {
+
+ private Map<String, WeakReference<RunTests>> tests;
+
+ public OteRunTestCommandsImpl(){
+ tests = new HashMap<String, WeakReference<RunTests>>();
+ }
+
+ @Override
+ public RunTests getCommand(String id) {
+ WeakReference<RunTests> ref = tests.get(id);
+ return ref.get();
+ }
+
+ @Override
+ public void putCommand(String id, RunTests envTestRun) {
+ tests.put(id, new WeakReference<RunTests>(envTestRun));
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResource.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResource.java
new file mode 100644
index 0000000000..09201f5507
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResource.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.ote.rest.internal;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriBuilderException;
+import javax.ws.rs.core.UriInfo;
+
+import org.eclipse.osee.framework.jdk.core.type.IPropertyStore;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.core.ServiceUtility;
+import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface;
+import org.eclipse.osee.ote.core.framework.command.RunTests;
+import org.eclipse.osee.ote.rest.model.KeyValue;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
+import org.eclipse.osee.ote.rest.model.OTETestRun;
+import org.eclipse.osee.ote.rest.model.Properties;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+@Path("run")
+public class OteRunTestResource {
+
+ // Allows to insert contextual objects into the class,
+ // e.g. ServletContext, Request, Response, UriInfo
+ @Context
+ UriInfo uriInfo;
+ @Context
+ Request request;
+
+ @GET
+ @Produces({MediaType.TEXT_HTML})
+ public String getCurrentRunStatus() throws MalformedURLException, IllegalArgumentException, UriBuilderException, InterruptedException, ExecutionException {
+ return "hello";//getDataStore().getConfiguration(uriInfo);
+ }
+
+ @POST
+ @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public OTEJobStatus run(OTETestRun tests) throws IOException, InterruptedException, ExecutionException {
+ TestEnvironmentInterface env = ServiceUtility.getService(TestEnvironmentInterface.class);
+ OTEJobStatus status = new OTEJobStatus();
+ if(env == null){
+ status.setSuccess(false);
+ status.setJobComplete(true);
+ status.setErrorLog("Failed to aquire TestEnvironmentInterface.");
+ } else {
+ UUID id = UUID.randomUUID();
+ Configuration configuration = TranslateUtil.translateToOtherConfig(tests.getJarConfiguration());
+ RunTests envTestRun = new RunTests(id.toString(), id, configuration, propertyStoreConversion(tests.getGlobalProperties()), propertyStoreConversion(tests.getTests()));
+ OteRunTestCommands commands = ServiceUtility.getService(OteRunTestCommands.class);
+ if(commands != null){
+ commands.putCommand(id.toString(), envTestRun);
+ }
+ env.addCommand(envTestRun);
+ status.setJobId(id.toString());
+ }
+ return status;
+ }
+
+ @Path("{uuid}")
+ public OteRunTestResourceItem getConfiguration(@PathParam("uuid") String id) {
+ return new OteRunTestResourceItem(uriInfo, request, id);
+ }
+
+ public IPropertyStore propertyStoreConversion(Properties properties){
+ IPropertyStore store = new PropertyStore();
+ for(KeyValue pair:properties.getPairs()){
+ if(pair.getValue() == null){
+ store.put(pair.getKey(), pair.getValues().toArray(new String[0]));
+ } else {
+ store.put(pair.getKey(), pair.getValue());
+ }
+ }
+ return store;
+ }
+
+ public List<IPropertyStore> propertyStoreConversion(List<Properties> properties){
+ List<IPropertyStore> stores = new ArrayList<IPropertyStore>();
+ for(Properties prop:properties){
+ stores.add(propertyStoreConversion(prop));
+ }
+ return stores;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResourceItem.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResourceItem.java
new file mode 100644
index 0000000000..62cc91f7fa
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/OteRunTestResourceItem.java
@@ -0,0 +1,63 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+
+import org.eclipse.osee.ote.core.ServiceUtility;
+import org.eclipse.osee.ote.core.framework.command.RunTests;
+import org.eclipse.osee.ote.rest.model.OTEJobStatus;
+
+public class OteRunTestResourceItem {
+
+ @SuppressWarnings("unused")
+ private UriInfo uriInfo;
+ @SuppressWarnings("unused")
+ private Request request;
+ private String id;
+
+ public OteRunTestResourceItem(UriInfo uriInfo, Request request, String id) {
+ this.uriInfo = uriInfo;
+ this.request = request;
+ this.id = id;
+ }
+
+ @DELETE
+ @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public OTEJobStatus abortAll() throws IOException, InterruptedException, ExecutionException {
+ OteRunTestCommands commands = ServiceUtility.getService(OteRunTestCommands.class);
+ OTEJobStatus status = new OTEJobStatus();
+ status.setSuccess(false);
+ if(commands != null){
+ RunTests cmd = commands.getCommand(id);
+ if(cmd != null){
+ cmd.cancel();
+ status.setSuccess(true);
+ }
+ }
+ return status;
+ }
+
+ @PUT
+ @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public OTEJobStatus abortSingle() {
+ OteRunTestCommands commands = ServiceUtility.getService(OteRunTestCommands.class);
+ OTEJobStatus status = new OTEJobStatus();
+ status.setSuccess(false);
+ if(commands != null){
+ RunTests cmd = commands.getCommand(id);
+ if(cmd != null){
+ cmd.cancelSingle();
+ status.setSuccess(true);
+ }
+ }
+ return status;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ReverseAlphabeticalSort.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ReverseAlphabeticalSort.java
new file mode 100644
index 0000000000..9ca21ee50d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ReverseAlphabeticalSort.java
@@ -0,0 +1,13 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import java.io.File;
+import java.util.Comparator;
+
+public class ReverseAlphabeticalSort implements Comparator<File> {
+
+ @Override
+ public int compare(File arg0, File arg1) {
+ return arg1.getName().compareToIgnoreCase(arg0.getName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TestResultSummary.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TestResultSummary.java
new file mode 100644
index 0000000000..611950c317
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TestResultSummary.java
@@ -0,0 +1,59 @@
+package org.eclipse.osee.ote.rest.internal;
+
+class TestResultSummary {
+
+ private static final String NA = "N/A";
+ private String name;
+ private String results;
+ private String time;
+
+ public TestResultSummary(String name, String results, String time) {
+ this.name = name;
+ this.results = results;
+ this.time = time;
+ }
+
+ public TestResultSummary(String name) {
+ this.name = name;
+ this.results = NA;
+ this.time = NA;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getResult() {
+ return results;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TestResultSummary other = (TestResultSummary) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TimeSort.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TimeSort.java
new file mode 100644
index 0000000000..96d74506cd
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TimeSort.java
@@ -0,0 +1,21 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import java.io.File;
+import java.util.Comparator;
+
+public class TimeSort implements Comparator<File> {
+
+ @Override
+ public int compare(File o1, File o2) {
+ long time1 = o1.lastModified();
+ long time2 = o2.lastModified();
+ if(time1 == time2){
+ return 0;
+ } else if ( time1 > time2) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TranslateUtil.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TranslateUtil.java
index 58337ae919..7362eef254 100644
--- a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TranslateUtil.java
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/TranslateUtil.java
@@ -1,28 +1,34 @@
package org.eclipse.osee.ote.rest.internal;
-import org.eclipse.osee.ote.OTEConfiguration;
-import org.eclipse.osee.ote.OTEConfigurationItem;
-import org.eclipse.osee.ote.rest.model.OteConfiguration;
-import org.eclipse.osee.ote.rest.model.OteConfigurationItem;
+import org.eclipse.osee.ote.Configuration;
+import org.eclipse.osee.ote.ConfigurationItem;
+import org.eclipse.osee.ote.rest.model.OTEConfiguration;
+import org.eclipse.osee.ote.rest.model.OTEConfigurationItem;
public class TranslateUtil {
- public static OTEConfiguration translateToOtherConfig(OteConfiguration restConfig) {
- OTEConfiguration config = new OTEConfiguration();
- for(OteConfigurationItem item:restConfig.getItems()){
+ public static Configuration translateToOtherConfig(OTEConfiguration restConfig) {
+ if(restConfig == null){
+ return null;
+ }
+ Configuration config = new Configuration();
+ for(OTEConfigurationItem item:restConfig.getItems()){
config.addItem(TranslateUtil.translateToOtherConfig(item));
}
return config;
}
- public static OTEConfigurationItem translateToOtherConfig(OteConfigurationItem restConfigItem) {
- return new OTEConfigurationItem(restConfigItem.getLocationUrl(), restConfigItem.getBundleVersion(), restConfigItem.getBundleName(), restConfigItem.getMd5Digest());
+ public static ConfigurationItem translateToOtherConfig(OTEConfigurationItem restConfigItem) {
+ return new ConfigurationItem(restConfigItem.getLocationUrl(), restConfigItem.getBundleVersion(), restConfigItem.getBundleName(), restConfigItem.getMd5Digest(), restConfigItem.isOsgiBundle());
}
- public static OteConfiguration translateConfig(OTEConfiguration config){
- OteConfiguration restConfig = new OteConfiguration();
- for(OTEConfigurationItem item:config.getItems()){
- OteConfigurationItem newitem = new OteConfigurationItem();
+ public static OTEConfiguration translateConfig(Configuration config){
+ if(config == null){
+ return null;
+ }
+ OTEConfiguration restConfig = new OTEConfiguration();
+ for(ConfigurationItem item:config.getItems()){
+ OTEConfigurationItem newitem = new OTEConfigurationItem();
newitem.setBundleName(item.getSymbolicName());
newitem.setBundleVersion(item.getVersion());
newitem.setLocationUrl(item.getLocationUrl());
diff --git a/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ZIPGenerator.java b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ZIPGenerator.java
new file mode 100644
index 0000000000..21af4eaf77
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.rest/src/org/eclipse/osee/ote/rest/internal/ZIPGenerator.java
@@ -0,0 +1,57 @@
+package org.eclipse.osee.ote.rest.internal;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.Deflater;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+public class ZIPGenerator {
+
+ private File folderToZip;
+
+ public ZIPGenerator(File folderToZip) {
+ this.folderToZip = folderToZip;
+ }
+
+ public void generateZip(OutputStream output) {
+ ZipOutputStream zipOut = new ZipOutputStream(output);
+ zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
+
+ for (File file : folderToZip.listFiles()) {
+ if (!file.isDirectory()){
+ try {
+ zipFile(zipOut, file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ try {
+ zipOut.flush();
+ zipOut.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void zipFile(ZipOutputStream zos, File file) throws IOException {
+ if (!file.canRead()) {
+ return;
+ }
+
+ zos.putNextEntry(new ZipEntry(file.getName()));
+ FileInputStream fis = new FileInputStream(file);
+ byte[] buffer = new byte[4092];
+ int byteCount = 0;
+ while ((byteCount = fis.read(buffer)) != -1)
+ {
+ zos.write(buffer, 0, byteCount);
+ }
+ fis.close();
+ zos.closeEntry();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.runtimeManager/META-INF/MANIFEST.MF
index fc2a988a46..c60afb6c08 100644
--- a/plugins/org.eclipse.osee.ote.runtimeManager/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.runtimeManager/META-INF/MANIFEST.MF
@@ -21,6 +21,7 @@ Import-Package: org.eclipse.core.resources,
org.eclipse.osee.framework.ui.swt,
org.eclipse.osee.framework.ui.workspacebundleloader,
org.eclipse.osee.ote.core,
+ org.eclipse.osee.ote.ui.builder,
org.eclipse.swt,
org.eclipse.swt.layout,
org.eclipse.swt.widgets,
diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/OTEBuilderResourceFinder.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/OTEBuilderResourceFinder.java
new file mode 100644
index 0000000000..6f892d8e66
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/OTEBuilderResourceFinder.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.ote.runtimemanager.internal;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.server.ResourceFinder;
+import org.eclipse.osee.ote.ui.builder.OTEPackagingBuilder;
+
+/**
+ * Resource finder for the OTE builder jars. This will enable the downloading of jars from the
+ * same http server that provides the precompiled jars.
+ *
+ * @author Andrew M. Finkbeiner
+ */
+public class OTEBuilderResourceFinder extends ResourceFinder {
+ private File rootFolder;
+
+ public OTEBuilderResourceFinder() {
+ super();
+ rootFolder = OTEPackagingBuilder.getWorkspaceArchiveFolder();
+ }
+
+ @Override
+ public byte[] find(String path) throws IOException {
+ try {
+ File bundleFile = new File(rootFolder, path);
+ if(bundleFile.exists()){
+ return Lib.inputStreamToBytes(new FileInputStream(bundleFile));
+ }
+ } catch (Exception ex) {
+ OseeLog.logf(getClass(), Level.SEVERE, "Error trying to read: [%s]", path);
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java
index 5fbe4b11d5..cfe9368429 100644
--- a/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java
+++ b/plugins/org.eclipse.osee.ote.runtimeManager/src/org/eclipse/osee/ote/runtimemanager/internal/RuntimeBundleServer.java
@@ -26,6 +26,7 @@ public class RuntimeBundleServer {
private ClassServer classServer;
private String classServerPath;
private ResourceFinder resourceFinder;
+ private OTEBuilderResourceFinder oteBuilderFinder;
/**
* Creates a new ClassServer which will serve all projects currently in the workspace
@@ -40,7 +41,9 @@ public class RuntimeBundleServer {
}
};
resourceFinder = new RuntimeLibResourceFinder(safeWorkspaceTracker);
+ oteBuilderFinder = new OTEBuilderResourceFinder();
classServer.addResourceFinder(resourceFinder);
+ classServer.addResourceFinder(oteBuilderFinder);
classServer.start();
if(useHostAddress instanceof Inet6Address){
classServerPath = "http://[" + useHostAddress.getHostAddress() + "]:" + classServer.getPort() + "/";
diff --git a/plugins/org.eclipse.osee.ote.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.server/META-INF/MANIFEST.MF
index 4770a8c6d1..2dad1c25cd 100644
--- a/plugins/org.eclipse.osee.ote.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.server/META-INF/MANIFEST.MF
@@ -22,6 +22,7 @@ Import-Package: org.apache.felix.service.command;status=provisional;version="0.8
org.eclipse.osee.framework.messaging.services,
org.eclipse.osee.framework.messaging.services.messages,
org.eclipse.osee.framework.plugin.core.util,
+ org.eclipse.osee.ote,
org.eclipse.osee.ote.connection.jini,
org.eclipse.osee.ote.core,
org.eclipse.osee.ote.core.cmd,
diff --git a/plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.runtime.manager.xml b/plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.runtime.manager.xml
deleted file mode 100644
index 757b48d6a9..0000000000
--- a/plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.runtime.manager.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="org.eclipse.osee.ote.server.runtimeManager">
- <implementation class="org.eclipse.osee.ote.core.environment.interfaces.AbstractRuntimeManager"/>
- <service>
- <provide interface="org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager"/>
- </service>
- <reference bind="bindPackageAdmin" cardinality="1..1" interface="org.osgi.service.packageadmin.PackageAdmin" name="PackageAdmin" policy="static" unbind="unbindPackageAdmin"/>
-</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/EnvironmentCreationParameter.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/EnvironmentCreationParameter.java
index e3831ac680..62b2d23ab8 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/EnvironmentCreationParameter.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/EnvironmentCreationParameter.java
@@ -21,7 +21,6 @@ import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentServiceConfig;
import org.eclipse.osee.ote.message.MessageSystemTestEnvironment;
import org.eclipse.osee.ote.server.TestEnvironmentFactory;
-import org.osgi.service.packageadmin.PackageAdmin;
/**
* @author Andrew M. Finkbeiner
@@ -34,16 +33,14 @@ class EnvironmentCreationParameter {
private ITestEnvironment remoteTestEnvironment;
private ITestEnvironment exportedRemoteTestEnvironment;
private TestEnvironmentFactory factory;
- private final PackageAdmin packageAdmin;
private final String environmentFactoryClass;
- public EnvironmentCreationParameter(IRuntimeLibraryManager runtimeLibraryManager, NodeInfo oteEmbeddedBroker, IServiceConnector serviceConnector, ITestEnvironmentServiceConfig config, TestEnvironmentFactory factory, String environmentFactoryClass, PackageAdmin packageAdmin) {
+ public EnvironmentCreationParameter(IRuntimeLibraryManager runtimeLibraryManager, NodeInfo oteEmbeddedBroker, IServiceConnector serviceConnector, ITestEnvironmentServiceConfig config, TestEnvironmentFactory factory, String environmentFactoryClass) {
this.oteEmbeddedBroker = oteEmbeddedBroker;
this.serviceConnector = serviceConnector;
this.config = config;
this.runtimeLibraryManager = runtimeLibraryManager;
this.factory = factory;
- this.packageAdmin = packageAdmin;
this.environmentFactoryClass = environmentFactoryClass;
}
@@ -66,7 +63,7 @@ class EnvironmentCreationParameter {
public MessageSystemTestEnvironment createEnvironment() throws Throwable {
if (factory == null) {
- ExportClassLoader exportClassLoader = new ExportClassLoader(packageAdmin);
+ ExportClassLoader exportClassLoader = ExportClassLoader.getInstance();
Class<? extends TestEnvironmentFactory> clazz =
exportClassLoader.loadClass(environmentFactoryClass).asSubclass(TestEnvironmentFactory.class);
factory = clazz.newInstance();
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java
index 3b7d2c3663..4e45883dcf 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java
@@ -157,38 +157,11 @@ public class OteService implements IHostTestEnvironment, IService {
@Override
public void kill() throws RemoteException {
- if (currentEnvironment != null) {
+ if(currentEnvironment != null){
currentEnvironment.shutdown();
}
}
- @Override
- public void cleanupRuntimeBundles() throws RemoteException {
- if (runtimeLibraryManager != null) {
- runtimeLibraryManager.cleanup();
- }
- }
-
- @Override
- public void sendRuntimeBundle(Collection<BundleDescription> bundles) throws RemoteException {
- try {
- runtimeLibraryManager.loadBundles(bundles);
- } catch (Exception ex) {
- OseeLog.log(OteService.class, Level.SEVERE, ex);
- throw new RemoteException(ex.getMessage());
- }
- }
-
- @Override
- public void updateRuntimeBundle(Collection<BundleDescription> bundles) throws RemoteException {
- try {
- runtimeLibraryManager.updateBundles(bundles);
- } catch (Exception ex) {
- OseeLog.log(OteService.class, Level.SEVERE, ex);
- throw new RemoteException(ex.getMessage());
- }
- }
-
public void set(RegisteredServiceReference ref) {
this.registeredServiceReference = ref;
}
@@ -200,15 +173,10 @@ public class OteService implements IHostTestEnvironment, IService {
updateDynamicInfo();
}
}
-
+
@Override
- public BundleConfigurationReport checkBundleConfiguration(Collection<BundleDescription> bundles) throws RemoteException {
- try {
- return runtimeLibraryManager.checkBundleConfiguration(bundles);
- } catch (Exception ex) {
- OseeLog.log(OteService.class, Level.SEVERE, ex);
- throw new RemoteException(ex.getMessage());
- }
+ public String getHttpURL() throws RemoteException {
+ return (String)enhancedProperties.getProperty("appServerURI");
}
-
+
}
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java
index 644e70d823..a7e630850b 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java
@@ -201,13 +201,15 @@ public class OteServiceStarterImpl implements OteServiceStarter, ServiceInfoPopu
brokerService.start();
URI uri = new URI(strUri);
- System.out.printf("SERVER ACTIVEMQ URI[\n\t%s\n]\n", strUri);
+ System.out.printf("SERVER CONNECTION(ACTIVEMQ) URI[\n\t%s\n]\n", strUri);
+ System.out.printf("SERVER URL[\n\thttp://%s:%s/ote\n]\n", InetAddress.getLocalHost().getHostAddress(), Integer.parseInt(System.getProperty("org.osgi.service.http.port")));
+ System.out.printf("SERVER REST WADL[http://%s:%s/ote/application.wadl]\n", InetAddress.getLocalHost().getHostAddress(), Integer.parseInt(System.getProperty("org.osgi.service.http.port")));
nodeInfo = new NodeInfo("OTEEmbeddedBroker", uri);
EnvironmentCreationParameter environmentCreationParameter =
new EnvironmentCreationParameter(runtimeLibraryManager, nodeInfo, serviceSideConnector, config, factory,
- environmentFactoryClass, packageAdmin);
+ environmentFactoryClass);
service =
new OteService(runtimeLibraryManager, environmentCreationParameter, oteSessions, propertyParameter,
@@ -292,7 +294,7 @@ public class OteServiceStarterImpl implements OteServiceStarter, ServiceInfoPopu
remoteServiceRegistrar.unregisterService("osee.ote.server", "1.0", service.getServiceID().toString());
service.kill();
service = null;
- } catch (RemoteException ex) {
+ } catch (Exception ex) {
OseeLog.log(getClass(), Level.SEVERE, ex);
}
}
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java
index 427e89298a..50c9d2ab96 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java
@@ -13,7 +13,6 @@ package org.eclipse.osee.ote.server.internal;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
@@ -21,13 +20,10 @@ import java.util.logging.Level;
import org.eclipse.osee.connection.service.IServiceConnector;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.messaging.Message;
-import org.eclipse.osee.ote.core.ReturnStatus;
import org.eclipse.osee.ote.core.ServiceUtility;
import org.eclipse.osee.ote.core.cmd.Command;
import org.eclipse.osee.ote.core.environment.console.ICommandManager;
import org.eclipse.osee.ote.core.environment.interfaces.IRemoteCommandConsole;
-import org.eclipse.osee.ote.core.framework.command.ICommandHandle;
-import org.eclipse.osee.ote.core.framework.command.ITestServerCommand;
import org.eclipse.osee.ote.core.model.IModel;
import org.eclipse.osee.ote.core.model.IModelListener;
import org.eclipse.osee.ote.core.model.IModelManagerRemote;
@@ -46,7 +42,6 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
private RemoteModelManager modelManager;
private final HashMap<IRemoteCommandConsole, RemoteShell> exportedConsoles =
new HashMap<IRemoteCommandConsole, RemoteShell>(32);
- private final boolean keepEnvAliveWithNoUsers;
private final ReentrantLock lock = new ReentrantLock();
private IRemoteMessageService exportedRemoteMessageService;
@@ -57,7 +52,6 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
}
this.env = currentEnvironment;
this.serviceConnector = serviceConnector;
- this.keepEnvAliveWithNoUsers = keepEnvAliveWithNoUsers;
}
@Override
@@ -94,15 +88,6 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
return exportedRemoteMessageService;
}
- public ReturnStatus isRunningJarVersions(String[] jarVersions) {
- return env.getRuntimeManager().isRunningJarVersions(jarVersions);
- }
-
- @Override
- public ICommandHandle addCommand(ITestServerCommand cmd) throws RemoteException {
- return env.addCommand(cmd);
- }
-
@Override
public IRemoteCommandConsole getCommandConsole() throws RemoteException {
OseeLog.log(RemoteTestEnvironment.class, Level.FINE, "Remote command onsole requested");
@@ -146,19 +131,6 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
}
}
- private void closeAllConsoles() throws RemoteException {
- lock.lock();
- LinkedList<IRemoteCommandConsole> consoles;
- try {
- consoles = new LinkedList<IRemoteCommandConsole>(exportedConsoles.keySet());
- } finally {
- lock.unlock();
- }
- for (IRemoteCommandConsole console : consoles) {
- closeCommandConsole(console);
- }
- }
-
@Override
public IModelManagerRemote getModelManager() throws RemoteException {
if (modelManager == null) {
@@ -203,19 +175,19 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
env.getModelManager().removeModelActivityListener(listener, key);
}
+ @SuppressWarnings("rawtypes")
@Override
public List<ModelKey> getRegisteredModels() throws RemoteException {
return env.getModelManager().getRegisteredModels();
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Remote getRemoteModel(ModelKey<?> key) throws RemoteException {
try {
Class modelClass;
try {
-
- modelClass = env.loadClassFromScriptLoader(key.getClassName());
+ modelClass = env.loadClassFromMessageLoader(key.getClassName());
} catch (ClassNotFoundException ex) {
throw new RemoteException("Could not load model class: " + key.getClassName(), ex);
}
@@ -233,11 +205,11 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public void changeModelState(ModelKey<?> key, ModelState state) throws RemoteException {
Class modelClass;
try {
- modelClass = env.loadClassFromScriptLoader(key.getClassName());
+ modelClass = env.loadClassFromMessageLoader(key.getClassName());
} catch (ClassNotFoundException ex) {
throw new RemoteException("Could not load model class: " + key.getClassName());
}
@@ -250,6 +222,7 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
return env.getModelManager().getModelState(key);
}
+ @SuppressWarnings("rawtypes")
@Override
public void releaseAllReferences(ModelKey key) throws RemoteException {
env.getModelManager().releaseAllReferences(key);
diff --git a/plugins/org.eclipse.osee.ote.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.test/META-INF/MANIFEST.MF
deleted file mode 100644
index ff91a90953..0000000000
--- a/plugins/org.eclipse.osee.ote.test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,11 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OTE Test (Incubation)
-Bundle-SymbolicName: org.eclipse.osee.ote.test
-Bundle-Version: 0.17.0.qualifier
-Fragment-Host: org.eclipse.osee.ote
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.junit,
- org.eclipse.equinox.event,
- org.eclipse.equinox.ds
-Bundle-Vendor: Eclipse Open System Engineering Environment
diff --git a/plugins/org.eclipse.osee.ote.test/pom.xml b/plugins/org.eclipse.osee.ote.test/pom.xml
deleted file mode 100644
index 953d4bd4d6..0000000000
--- a/plugins/org.eclipse.osee.ote.test/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<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.ote.parent</artifactId>
- <version>0.17.0-SNAPSHOT</version>
- <relativePath>../../plugins/org.eclipse.osee.ote.parent</relativePath>
- </parent>
-
- <artifactId>org.eclipse.osee.ote.test</artifactId>
- <name>OTE API Test (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>
-
- <packaging>eclipse-test-plugin</packaging>
-</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.test/src/org/eclipse/osee/ote/internal/OTEApiTest.java b/plugins/org.eclipse.osee.ote.test/src/org/eclipse/osee/ote/internal/OTEApiTest.java
deleted file mode 100644
index b32a0f7d03..0000000000
--- a/plugins/org.eclipse.osee.ote.test/src/org/eclipse/osee/ote/internal/OTEApiTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.osee.ote.internal;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil;
-import org.eclipse.osee.ote.OTEApi;
-import org.eclipse.osee.ote.OTEConfiguration;
-import org.eclipse.osee.ote.OTEConfigurationItem;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEFuture;
-import org.eclipse.osee.ote.OTEStatusCallback;
-import org.eclipse.osgi.framework.internal.core.BundleFragment;
-import org.eclipse.osgi.framework.internal.core.BundleHost;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-@SuppressWarnings("restriction")
-public class OTEApiTest {
-
- private OTEApi oteApi;
-
- @Before
- public void setup(){
- BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
- ServiceReference<OTEApi> ref = context.getServiceReference(OTEApi.class);
- Assert.assertNotNull(ref);
- oteApi = context.getService(ref);
- Assert.assertNotNull(oteApi);
- }
-
- @Test
- public void testConfigurationLoading() throws IOException, Exception {
- clearJarCache();
- URL bundle1 = findEntry("data/loading.test1.jar");
- URL bundle2 = findEntry("data/loading.test2.jar");
- URL bundle3 = findEntry("data/loading.test3.jar");
- OTEConfigurationItem config1 = new OTEConfigurationItem(bundle1.toString(), "1.0.0", "loading.test1", ChecksumUtil.createChecksumAsString(bundle1.openStream(), "MD5"));
- OTEConfigurationItem config2 = new OTEConfigurationItem(bundle2.toString(), "1.0.0", "loading.test2", ChecksumUtil.createChecksumAsString(bundle2.openStream(), "MD5"));
- OTEConfigurationItem config3 = new OTEConfigurationItem(bundle3.toString(), "1.0.0", "loading.test3", ChecksumUtil.createChecksumAsString(bundle3.openStream(), "MD5"));
-
- OTEConfiguration validConfiguration = new OTEConfiguration();
- validConfiguration.addItem(config1);
- validConfiguration.addItem(config2);
- validConfiguration.addItem(config3);
-
- OTEStatusCallback<OTEConfigurationStatus> callable = new OTEStatusCallbackForTests<OTEConfigurationStatus>();
-
- OTEFuture<OTEConfigurationStatus> statusFuture = oteApi.loadConfiguration(validConfiguration, callable);
- OTEConfigurationStatus status = statusFuture.get();
- Assert.assertTrue(status.isSuccess());
- Assert.assertEquals(validConfiguration, status.getConfiguration());
- Assert.assertEquals(validConfiguration, oteApi.getConfiguration().get().getConfiguration());
-
-
- Bundle bundle = findBundle("loading.test1");
- Assert.assertNotNull(bundle);
- Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
-
- bundle = findBundle("loading.test2");
- Assert.assertNotNull(bundle);
- Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
-
- bundle = findBundle("loading.test3");
- Assert.assertNotNull(bundle);
- Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
-
-
- OTEFuture<OTEConfigurationStatus> resetFeature = oteApi.resetConfiguration(callable);
- OTEConfigurationStatus resetStatus = resetFeature.get();
- Assert.assertTrue(resetStatus.isSuccess());
- Assert.assertNull(findBundle("loading.test1"));
- Assert.assertNull(findBundle("loading.test2"));
- Assert.assertNull(findBundle("loading.test3"));
-
- OTEConfiguration invalidConfiguration = new OTEConfiguration();
- invalidConfiguration.addItem(config1);
- invalidConfiguration.addItem(config3);
- OTEFuture<OTEConfigurationStatus> failStatusFuture = oteApi.loadConfiguration(invalidConfiguration, callable);
- OTEConfigurationStatus failStatus = failStatusFuture.get();
- Assert.assertFalse(failStatus.isSuccess());
- System.out.println(failStatus.getMessage());
- Assert.assertNull(findBundle("loading.test1"));
- Assert.assertNull(findBundle("loading.test2"));
- Assert.assertNull(findBundle("loading.test3"));
-
- //test the doing load case
- OTEFuture<OTEConfigurationStatus> good = oteApi.loadConfiguration(validConfiguration, callable);
- OTEFuture<OTEConfigurationStatus> bad = oteApi.loadConfiguration(validConfiguration, callable);
-
- OTEConfigurationStatus goodStatus = good.get();
- OTEConfigurationStatus badStatus = bad.get();
- Assert.assertTrue(goodStatus.isSuccess());
- Assert.assertFalse(badStatus.isSuccess());
- System.out.println(badStatus.getMessage());
-
- //test already configured
- bad = oteApi.loadConfiguration(validConfiguration, callable);
- badStatus = bad.get();
- Assert.assertFalse(badStatus.isSuccess());
- System.out.println(badStatus.getMessage());
- }
-
- private void clearJarCache() {
- OTEApiComponent impl = (OTEApiComponent)oteApi;
- impl.clearJarCache();
- }
-
- private Bundle findBundle(String symbolicName){
- Bundle[] bundles = FrameworkUtil.getBundle(OTEApiTest.class).getBundleContext().getBundles();
- for(Bundle bundle:bundles){
- if(bundle.getSymbolicName().equals(symbolicName)){
- return bundle;
- }
- }
- return null;
- }
-
- private URL findEntry(String path){
- URL url = null;
- Bundle bundle = FrameworkUtil.getBundle(OTEApiTest.class);
- url = bundle.getEntry(path);
- if(url == null && bundle instanceof BundleHost){
- BundleFragment[] fragments = ((BundleHost)bundle).getFragments();
- for(BundleFragment fragment: fragments){
- url = fragment.getEntry(path);
- if(url != null){
- break;
- }
- }
- }
- Assert.assertNotNull(url);
- return url;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ote.test/.classpath b/plugins/org.eclipse.osee.ote.ui.builder/.classpath
index ad32c83a78..ad32c83a78 100644
--- a/plugins/org.eclipse.osee.ote.test/.classpath
+++ b/plugins/org.eclipse.osee.ote.ui.builder/.classpath
diff --git a/plugins/org.eclipse.osee.ote.test/.project b/plugins/org.eclipse.osee.ote.ui.builder/.project
index eab8cb1197..931030f0e9 100644
--- a/plugins/org.eclipse.osee.ote.test/.project
+++ b/plugins/org.eclipse.osee.ote.ui.builder/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.osee.ote.test</name>
+ <name>org.eclipse.osee.ote.ui.builder</name>
<comment></comment>
<projects>
</projects>
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.ui.builder/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..9c687020e8
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OTE Builder Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.ote.ui.builder;singleton:=true
+Bundle-Version: 0.17.0.qualifier
+Bundle-Activator: org.eclipse.osee.ote.ui.builder.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.core
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.logging,
+ org.eclipse.osee.framework.plugin.core.server,
+ org.eclipse.osee.framework.plugin.core.util
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Export-Package: org.eclipse.osee.ote.ui.builder
diff --git a/plugins/org.eclipse.osee.ote.test/build.properties b/plugins/org.eclipse.osee.ote.ui.builder/build.properties
index be6734d3b4..e9863e281e 100644
--- a/plugins/org.eclipse.osee.ote.test/build.properties
+++ b/plugins/org.eclipse.osee.ote.ui.builder/build.properties
@@ -2,4 +2,4 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- data/
+ plugin.xml
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/plugin.xml b/plugins/org.eclipse.osee.ote.ui.builder/plugin.xml
new file mode 100644
index 0000000000..8cb6eba10b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/plugin.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="OTEPackagingBuilder"
+ name="OTE Packaging Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ hasNature="true">
+ <run
+ class="org.eclipse.osee.ote.ui.builder.OTEPackagingBuilder">
+ </run>
+ </builder>
+ </extension>
+ <extension
+ id="OTEPackagingNature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.eclipse.osee.ote.ui.builder.OTEPackagingNature">
+ </run>
+ </runtime>
+ <builder
+ id="org.eclipse.osee.ote.ui.builder.OTEPackagingBuilder">
+ </builder>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?after=additions">
+ <command
+ commandId="org.eclipse.osee.ote.ui.builder.addRemoveNatureCommand"
+ label="Add/Remove OTE Packaging Nature">
+ </command>
+ </menuContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.osee.ote.ui.builder.ToggleNatureHandler"
+ id="org.eclipse.osee.ote.ui.builder.addRemoveNatureCommand"
+ name="addRemoveNatureCommand">
+ </command>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.osee.framework.ui.skynet.OseePreferencePage"
+ class="org.eclipse.osee.ote.ui.builder.OTEBuilderPreferencePage"
+ id="org.eclipse.osee.ote.ui.builder.OTEBuilderPreferencePage"
+ name="OTE Builder">
+ </page>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.osee.ote/pom.xml b/plugins/org.eclipse.osee.ote.ui.builder/pom.xml
index 2966336b4f..509b918072 100644
--- a/plugins/org.eclipse.osee.ote/pom.xml
+++ b/plugins/org.eclipse.osee.ote.ui.builder/pom.xml
@@ -10,9 +10,9 @@
<relativePath>../../plugins/org.eclipse.osee.ote.parent</relativePath>
</parent>
- <artifactId>org.eclipse.osee.ote</artifactId>
+ <artifactId>org.eclipse.osee.ote.ui.builder</artifactId>
<packaging>eclipse-plugin</packaging>
- <name>OTE API(Incubation)</name>
+ <name>OTE Ui (Incubation)</name>
<build>
<!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 -->
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/Activator.java b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/Activator.java
new file mode 100644
index 0000000000..a042a8a7d6
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/Activator.java
@@ -0,0 +1,50 @@
+package org.eclipse.osee.ote.ui.builder;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.osee.ote.ui.builder"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ArchiveBuilder.java b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ArchiveBuilder.java
new file mode 100644
index 0000000000..d7a42288b4
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ArchiveBuilder.java
@@ -0,0 +1,93 @@
+package org.eclipse.osee.ote.ui.builder;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This class writes class files to a jar file. This is used as part of the OTE Builder that will package up
+ * java test classes and then ship them to a server to be executed.
+ *
+ * @author Andrew M. Finkbeiner
+ *
+ */
+class ArchiveBuilder {
+
+ private List<IPath> outputLocations;
+ private Set<IContainer> packages;
+ private File workspaceArchiveHome;
+
+ public ArchiveBuilder(File workspaceArchiveHome, List<IPath> outputLocations) {
+ this.workspaceArchiveHome = workspaceArchiveHome;
+ this.outputLocations = outputLocations;
+ this.packages = new HashSet<IContainer>();
+ }
+
+ /**
+ * Add a resources parent to be archived as a java package.
+ *
+ * @param resource
+ */
+ public void addFile(IResource resource) {
+ packages.add(resource.getParent());
+ }
+
+ /**
+ * Builds a jar file with the currently added packages.
+ */
+ public void archive() {
+ for(IContainer path:packages){
+ try {
+ IResource[] resources = path.members();
+ if(resources.length > 0){
+ String fileName = getFileName(path);
+ File archive = new File(workspaceArchiveHome, fileName + ".jar");
+ if(archive.exists()){
+ archive.delete();
+ }
+ JarPackager jarPackager = new JarPackager(getPath(path));
+ jarPackager.open(archive);
+ try{
+ for(IResource resource:resources){
+ if(resource.getFullPath().toString().endsWith(".class")){
+ jarPackager.add(resource);
+ }
+ }
+ } finally {
+ jarPackager.close();
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private String getFileName(IContainer path) {
+ String name = path.getFullPath().toString().replace(".", "").replace('/', '.');
+ return name.substring(1);
+ }
+
+ private String getPath(IContainer path){
+ String strPath = path.getFullPath().toString();
+ for(IPath sourcePath:outputLocations){
+ String source = sourcePath.toString();
+ if(strPath.startsWith(sourcePath.toString())){
+ return strPath.substring(source.length());
+ }
+ }
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/JarPackager.java b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/JarPackager.java
new file mode 100644
index 0000000000..fbf23f9ed2
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/JarPackager.java
@@ -0,0 +1,108 @@
+package org.eclipse.osee.ote.ui.builder;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil;
+
+/**
+ * Creates a jar file from a single package folder.
+ *
+ * @author Andrew M. Finkbeiner
+ *
+ */
+class JarPackager {
+
+ private JarOutputStream jos;
+ private String path;
+ private File archive;
+
+
+ JarPackager(String path){
+ this.path = path;
+ if(!this.path.endsWith("/")){
+ this.path += "/";
+ }
+ if(this.path.startsWith("/")){
+ this.path = this.path.substring(1);
+ }
+ }
+
+ /**
+ * Open the archive so that we can add resources to it.
+ *
+ * @param archive
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ public void open(File archive) throws FileNotFoundException, IOException {
+ this.archive = archive;
+ Manifest manifest = new Manifest();
+ manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ jos = new JarOutputStream(new FileOutputStream(archive), manifest);
+ JarEntry entry = new JarEntry(path);
+ jos.putNextEntry(entry);
+ jos.closeEntry();
+ }
+
+ public void close() throws Exception {
+ jos.close();
+ InputStream in = null;
+ PrintStream ps = null;
+ try{
+ in = new FileInputStream(archive);
+ String diskMd5Digest = ChecksumUtil.createChecksumAsString(in, "MD5");
+ ps = new PrintStream(new FileOutputStream(new File(archive.getParentFile(), archive.getName() + ".md5")));
+ ps.print(diskMd5Digest);
+ } finally {
+ if(in != null){
+ in.close();
+ }
+ if(ps != null){
+ ps.close();
+ }
+ }
+ }
+
+ public void add(IResource resource) throws IOException {
+ File theFile = resource.getLocation().toFile();
+ if(theFile.exists()){
+ BufferedInputStream in = null;
+ try
+ {
+ String name = path + theFile.getName();
+
+ JarEntry entry = new JarEntry(name);
+ jos.putNextEntry(entry);
+ in = new BufferedInputStream(new FileInputStream(theFile));
+
+ byte[] buffer = new byte[1024];
+ while (true)
+ {
+ int count = in.read(buffer);
+ if (count == -1)
+ break;
+ jos.write(buffer, 0, count);
+ }
+ jos.closeEntry();
+ }
+ finally
+ {
+ if (in != null)
+ in.close();
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEBuilderPreferencePage.java b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEBuilderPreferencePage.java
new file mode 100644
index 0000000000..c13470a0f7
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEBuilderPreferencePage.java
@@ -0,0 +1,65 @@
+package org.eclipse.osee.ote.ui.builder;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+public class OTEBuilderPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public static final String DO_JAR_PACKAGING = "DO_JAR_PACKAGING";
+
+ private Button oteBuilder;
+
+ public OTEBuilderPreferencePage() {
+ }
+
+ public OTEBuilderPreferencePage(String title) {
+ super(title);
+ }
+
+ public OTEBuilderPreferencePage(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+ oteBuilder = new Button(parent, SWT.CHECK);
+ oteBuilder.setText("Enable the OTE Jar Builder. This will enable client disconnect and not disrupt a batch.");
+ Preferences prefs = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ oteBuilder.setSelection(prefs.getBoolean(OTEBuilderPreferencePage.DO_JAR_PACKAGING, false));
+ oteBuilder.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Preferences prefs = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ prefs.putBoolean(OTEBuilderPreferencePage.DO_JAR_PACKAGING, oteBuilder.getSelection());
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e1) {
+ e1.printStackTrace();
+ }
+ }
+ });
+ return parent;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingBuilder.java b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingBuilder.java
new file mode 100644
index 0000000000..6c2cf0fc6b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingBuilder.java
@@ -0,0 +1,174 @@
+package org.eclipse.osee.ote.ui.builder;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.OseeData;
+import org.osgi.service.prefs.Preferences;
+
+public class OTEPackagingBuilder extends IncrementalProjectBuilder {
+
+ public static final String BUILDER_ID = "org.eclipse.osee.ote.ui.builder.OTEPackagingBuilder";
+
+ private static final String ROOT_FOLDER_NAME = "OTE";
+ private static final String JAR_FOLDER = "workspacejars";
+
+ public static boolean isOTEBuilderActive(){
+ if(Activator.getDefault() != null && Activator.getDefault().getPreferenceStore() != null){
+ Preferences prefs = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ return prefs.getBoolean(OTEBuilderPreferencePage.DO_JAR_PACKAGING, false);
+ } else {
+ return false;
+ }
+ }
+
+ public static File getWorkspaceArchiveFolder(){
+ File oteFolder = OseeData.getFile(ROOT_FOLDER_NAME);
+ File workspaceArchives = new File(oteFolder, JAR_FOLDER);
+ workspaceArchives.mkdirs();
+ return workspaceArchives;
+ }
+
+ public OTEPackagingBuilder(){
+ }
+
+ class SampleDeltaVisitor implements IResourceDeltaVisitor {
+
+
+ private ArchiveBuilder builder;
+
+ public SampleDeltaVisitor(ArchiveBuilder builder) {
+ this.builder = builder;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
+ */
+ @Override
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ IResource resource = delta.getResource();
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED:
+ // handle added resource
+ checkResource(resource, builder);
+ break;
+ case IResourceDelta.REMOVED:
+ // handle removed resource
+ break;
+ case IResourceDelta.CHANGED:
+ // handle changed resource
+ checkResource(resource, builder);
+ break;
+ }
+ //return true to continue visiting children.
+ return true;
+ }
+ }
+
+ class SampleResourceVisitor implements IResourceVisitor {
+
+ private ArchiveBuilder builder;
+
+ public SampleResourceVisitor(ArchiveBuilder builder) {
+ this.builder = builder;
+ }
+
+ @Override
+ public boolean visit(IResource resource) {
+ checkResource(resource, builder);
+ //return true to continue visiting children.
+ return true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.internal.events.InternalBuilder#build(int,
+ * java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
+ try{
+ if(!isOTEBuilderActive()){
+ return null;
+ }
+ long time = System.currentTimeMillis();
+ IJavaProject javaProject = JavaCore.create(getProject());
+ if(javaProject != null){
+ File workspaceArchiveHome = getWorkspaceArchiveFolder();
+ List<IPath> outputLocations = getOutputLocations(javaProject.getOutputLocation(), javaProject.getRawClasspath());
+
+ ArchiveBuilder builder = new ArchiveBuilder(workspaceArchiveHome, outputLocations);
+
+ if (kind == FULL_BUILD) {
+ fullBuild(monitor, builder);
+ } else {
+ IResourceDelta delta = getDelta(getProject());
+ if (delta == null) {
+ fullBuild(monitor, builder);
+ } else {
+ incrementalBuild(delta, monitor, builder);
+ }
+ }
+ builder.archive();
+ }
+ long elapsed = System.currentTimeMillis() - time;
+ System.out.printf("%s,%d\n", getProject().getName(), elapsed);
+ } catch (Throwable th){
+ OseeLog.log(getClass(), Level.SEVERE, "Failed to run the OTE Packager", th);
+ th.printStackTrace();
+ }
+ return null;
+ }
+
+ private List<IPath> getOutputLocations(IPath outputLocation, IClasspathEntry[] rawClasspath) {
+ List<IPath> outputLocations = new ArrayList<IPath>();
+ outputLocations.add(outputLocation);
+ for(IClasspathEntry classpathEntry:rawClasspath){
+ if(classpathEntry.getOutputLocation() != null){
+ outputLocations.add(classpathEntry.getOutputLocation());
+ }
+ }
+ return outputLocations;
+ }
+
+ void checkResource(IResource resource, ArchiveBuilder builder) {
+ if (resource instanceof IFile && resource.getName().endsWith(".class")) {
+ builder.addFile(resource);
+ }
+ }
+
+ protected void fullBuild(final IProgressMonitor monitor, ArchiveBuilder builder) throws CoreException {
+ try {
+ getProject().accept(new SampleResourceVisitor(builder));
+ } catch (CoreException e) {
+ }
+ }
+
+ protected void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor, ArchiveBuilder builder) throws CoreException {
+ // the visitor does the work.
+ delta.accept(new SampleDeltaVisitor(builder));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingNature.java b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingNature.java
new file mode 100644
index 0000000000..210a9cf300
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/OTEPackagingNature.java
@@ -0,0 +1,81 @@
+package org.eclipse.osee.ote.ui.builder;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+public class OTEPackagingNature implements IProjectNature {
+
+ /**
+ * ID of this project nature
+ */
+ public static final String NATURE_ID = "org.eclipse.osee.ote.ui.builder.OTEPackagingNature";
+
+ private IProject project;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IProjectNature#configure()
+ */
+ public void configure() throws CoreException {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] commands = desc.getBuildSpec();
+
+ for (int i = 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(OTEPackagingBuilder.BUILDER_ID)) {
+ return;
+ }
+ }
+
+ ICommand[] newCommands = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommands, 0, commands.length);
+ ICommand command = desc.newCommand();
+ command.setBuilderName(OTEPackagingBuilder.BUILDER_ID);
+ newCommands[newCommands.length - 1] = command;
+ desc.setBuildSpec(newCommands);
+ project.setDescription(desc, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+ */
+ public void deconfigure() throws CoreException {
+ IProjectDescription description = getProject().getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ for (int i = 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(OTEPackagingBuilder.BUILDER_ID)) {
+ ICommand[] newCommands = new ICommand[commands.length - 1];
+ System.arraycopy(commands, 0, newCommands, 0, i);
+ System.arraycopy(commands, i + 1, newCommands, i,
+ commands.length - i - 1);
+ description.setBuildSpec(newCommands);
+ project.setDescription(description, null);
+ return;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IProjectNature#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+ */
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ToggleNatureHandler.java b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ToggleNatureHandler.java
new file mode 100644
index 0000000000..b1730e139d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.builder/src/org/eclipse/osee/ote/ui/builder/ToggleNatureHandler.java
@@ -0,0 +1,130 @@
+package org.eclipse.osee.ote.ui.builder;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+public class ToggleNatureHandler extends AbstractHandler {
+
+ @Override
+ public void addHandlerListener(IHandlerListener handlerListener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection = getCurrentSelection();
+ if (selection != null && selection instanceof IStructuredSelection) {
+ for (Iterator it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
+ Object element = it.next();
+ IProject project = null;
+ if (element instanceof IProject) {
+ project = (IProject) element;
+ } else if (element instanceof IAdaptable) {
+ project = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
+ }
+ if (project != null) {
+ toggleNature(project);
+ }
+ }
+ }
+ return null;
+ }
+
+ private void toggleNature(IProject project) {
+ try {
+ IProjectDescription description = project.getDescription();
+ String[] natures = description.getNatureIds();
+
+ for (int i = 0; i < natures.length; ++i) {
+ if (OTEPackagingNature.NATURE_ID.equals(natures[i])) {
+ // Remove the nature
+ String[] newNatures = new String[natures.length - 1];
+ System.arraycopy(natures, 0, newNatures, 0, i);
+ System.arraycopy(natures, i + 1, newNatures, i,
+ natures.length - i - 1);
+ description.setNatureIds(newNatures);
+ project.setDescription(description, null);
+ return;
+ }
+ }
+
+ // Add the nature
+ String[] newNatures = new String[natures.length + 1];
+ System.arraycopy(natures, 0, newNatures, 0, natures.length);
+ newNatures[natures.length] = OTEPackagingNature.NATURE_ID;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, null);
+ } catch (CoreException e) {
+ }
+ }
+
+ private IStructuredSelection getCurrentSelection() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (!workbench.isStarting() && !workbench.isClosing()) {
+ IWorkbenchPage page = getActivePage();
+ if (page != null) {
+ IWorkbenchPart part = page.getActivePart();
+ if (part != null) {
+ IWorkbenchSite site = part.getSite();
+ if (site != null) {
+ ISelectionProvider selectionProvider = site.getSelectionProvider();
+ if(selectionProvider != null){
+ ISelection selection = selectionProvider.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return (IStructuredSelection) selection;
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isHandled() {
+ return true;
+ }
+
+ @Override
+ public void removeHandlerListener(IHandlerListener handlerListener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private IWorkbenchPage getActivePage() {
+ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ return workbenchWindow != null ? workbenchWindow.getActivePage() : null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.ui.test.manager/META-INF/MANIFEST.MF
index 94592b753b..6d8866ecc7 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/META-INF/MANIFEST.MF
@@ -48,5 +48,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.apache.xml.serialize,
org.eclipse.jdt.core,
org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.ote.ui.builder,
org.eclipse.osee.ote.version,
org.osgi.service.event;version="1.3.0"
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java
index b88d097862..be9ec77922 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java
@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import java.util.Vector;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
@@ -36,6 +37,7 @@ import org.eclipse.osee.ote.ui.test.manager.jobs.StoreOutfileJob;
import org.eclipse.osee.ote.ui.test.manager.models.OutputModelJob;
import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask.ScriptStatusEnum;
+import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTaskList;
/**
* @author Andrew M. Finkbeiner
@@ -76,7 +78,11 @@ public abstract class ScriptManager implements Runnable {
public void notifyScriptDequeued(String className) {
ScriptTask task = guidToScriptTask.get(className);
if (task != null) {
- guidToScriptTask.remove(task);
+
+ ScriptTask value = guidToScriptTask.remove(task);
+ if(value == null){
+ System.out.println("did not dq");
+ }
}
}
@@ -121,7 +127,21 @@ public abstract class ScriptManager implements Runnable {
}
public ScriptTask getScriptTask(String name) {
- return guidToScriptTask.get(name);
+ ScriptTask t = guidToScriptTask.get(name);
+ if(t == null){
+ Object obj = stv.getInput();
+ if(obj instanceof ScriptTaskList){
+ ScriptTaskList stl = (ScriptTaskList)obj;
+ for(ScriptTask task:stl.getTasks()){
+ String clazz = task.getScriptModel().getTestClass();
+ if(clazz.equals(name)){
+ t = task;
+ break;
+ }
+ }
+ }
+ }
+ return t;
}
public void notifyScriptQueued(GUID theGUID, final ScriptTask script) {
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java
index 4c66d531e7..9fa9dec112 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java
@@ -246,20 +246,18 @@ final class TestManagerServiceStatusDataVisitor implements IServiceStatusDataVis
@Override
public void run() {
try {
- ITestCommandResult result = end.getHandle().get();
- TestCommandStatus status = result.getStatus();
- Throwable th = result.getThrowable();
- if (th != null) {
- th.printStackTrace();
+ TestCommandStatus result = end.getCmdStatus();
+ Throwable th = end.getThrowable();
+ if (th != null && result != null) {
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("TestServer Command Completed [%s]", result.name()), th);
+ } else if ( result != null){
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("TestServer Command Completed [%s]", result.name()));
}
- if (status != null) {
- System.out.println(status.name());
- }
- } catch (RemoteException ex) {
+ } catch (Exception ex) {
OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ } finally {
+ notifyExecutionComplete(null);
}
-
- notifyExecutionComplete(null);
}
});
logExecutorSize();
@@ -342,6 +340,7 @@ final class TestManagerServiceStatusDataVisitor implements IServiceStatusDataVis
scriptManager.notifyScriptStart(task);
logOnConsole(Level.INFO, String.format("Test Started: [%s]", task.getName()));
}
+
}
});
logExecutorSize();
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java
index e131dd3791..8827f38f0a 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java
@@ -44,21 +44,21 @@ public class PageManager {
protected void createPages(Composite parent) {
hostPage = new HostPage(parent, SWT.NONE, testManager);
- registerPage(hostPage);
+ registerPage(hostPage, false);
scriptPage = this.factory.getScriptPageNewInstance(parent, SWT.NONE, testManager);
scriptPage.createPage();
- registerPage(scriptPage);
+ registerPage(scriptPage, true);
advancedPage = this.factory.getAdvancedPageNewInstance(parent, SWT.NONE, testManager);
advancedPage.createPage();
- registerPage(advancedPage);
+ registerPage(advancedPage, false);
}
- private void registerPage(TestManagerPage page) {
+ private void registerPage(TestManagerPage page, boolean isScriptPage) {
pages.add(page);
- testManager.registerPage(testManager.addPage(page), page.getPageName());
+ testManager.registerPage(testManager.addPage(page), page.getPageName(), isScriptPage);
}
/**
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java
index 6d9c930cf3..ca8524e74f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java
@@ -86,7 +86,7 @@ public abstract class TestManagerEditor extends MultiPageEditorPart implements I
private boolean reloadSourcePage = false;
- private int scriptPageIndex;
+ private int scriptPageIndex = 1;
private TextEditor sourceEditor;
@@ -116,6 +116,7 @@ public abstract class TestManagerEditor extends MultiPageEditorPart implements I
public void activateScriptsPage() {
setActivePage(scriptPageIndex);
}
+
public void addFile(String fullPath) {
pageManager.getScriptPage().addFile(fullPath);
@@ -163,8 +164,11 @@ public abstract class TestManagerEditor extends MultiPageEditorPart implements I
doSave();
}
- protected void registerPage(int pageNumber, String pageName) {
+ protected void registerPage(int pageNumber, String pageName, boolean isScriptPage) {
setPageText(pageNumber, pageName);
+ if(isScriptPage){
+ scriptPageIndex = pageNumber;
+ }
}
public void executionCompleted() {
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java
index 0203a96d46..54204a98ff 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java
@@ -62,6 +62,7 @@ public class ClassServerInst {
};
pathResourceFinder = new PathResourceFinder(new String[] {}, false);
classServer.addResourceFinder(new UserLibResourceFinder());
+ classServer.addResourceFinder(new OTEBuilderResourceFinder());
classServer.addResourceFinder(pathResourceFinder);
classServer.start();
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/OTEBuilderResourceFinder.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/OTEBuilderResourceFinder.java
new file mode 100644
index 0000000000..b1e43657af
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/OTEBuilderResourceFinder.java
@@ -0,0 +1,43 @@
+package org.eclipse.osee.ote.ui.test.manager.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.server.ResourceFinder;
+import org.eclipse.osee.ote.ui.builder.OTEPackagingBuilder;
+
+/**
+ * Resource finder for the OTE builder jars. This will enable the downloading of jars from the
+ * same http server that provides the precompiled jars.
+ *
+ * @author Andrew M. Finkbeiner
+ */
+public class OTEBuilderResourceFinder extends ResourceFinder {
+ private File rootFolder;
+
+ public OTEBuilderResourceFinder() {
+ super();
+ rootFolder = OTEPackagingBuilder.getWorkspaceArchiveFolder();
+ }
+
+ @Override
+ public byte[] find(String path) throws IOException {
+ try {
+ File bundleFile = new File(rootFolder, path);
+ if(bundleFile.exists()){
+ return Lib.inputStreamToBytes(new FileInputStream(bundleFile));
+ }
+ } catch (Exception ex) {
+ OseeLog.logf(getClass(), Level.SEVERE, "Error trying to read: [%s]", path);
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote/.classpath b/plugins/org.eclipse.osee.ote/.classpath
deleted file mode 100644
index ad32c83a78..0000000000
--- a/plugins/org.eclipse.osee.ote/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.ote/.project b/plugins/org.eclipse.osee.ote/.project
deleted file mode 100644
index 565c1c10cd..0000000000
--- a/plugins/org.eclipse.osee.ote/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.ote</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.ote/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote/META-INF/MANIFEST.MF
deleted file mode 100644
index 333ce85052..0000000000
--- a/plugins/org.eclipse.osee.ote/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,13 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OTE (Incubation)
-Bundle-SymbolicName: org.eclipse.osee.ote
-Bundle-Version: 0.17.0.qualifier
-Require-Bundle: org.eclipse.core.runtime
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.eclipse.osee.framework.jdk.core.util,
- org.eclipse.osee.framework.jdk.core.util.io.streams
-Service-Component: OSGI-INF/*.xml
-Export-Package: org.eclipse.osee.ote
-Bundle-Vendor: Eclipse Open System Engineering Environment
diff --git a/plugins/org.eclipse.osee.ote/OSGI-INF/ote.api.component.xml b/plugins/org.eclipse.osee.ote/OSGI-INF/ote.api.component.xml
deleted file mode 100644
index b151c9a703..0000000000
--- a/plugins/org.eclipse.osee.ote/OSGI-INF/ote.api.component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.ote.api">
- <implementation class="org.eclipse.osee.ote.internal.OTEApiComponent"/>
- <service>
- <provide interface="org.eclipse.osee.ote.OTEApi"/>
- </service>
-</scr:component>
diff --git a/plugins/org.eclipse.osee.ote/build.properties b/plugins/org.eclipse.osee.ote/build.properties
deleted file mode 100644
index 6210e849b5..0000000000
--- a/plugins/org.eclipse.osee.ote/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
-source.. = src/
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEApi.java b/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEApi.java
deleted file mode 100644
index 9d4ca4e2f8..0000000000
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEApi.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.osee.ote;
-
-import java.util.concurrent.ExecutionException;
-
-/**
- * This is an API for loading bundles into the OTE Server.
- *
- * @author Andrew M. Finkbeiner
- *
- */
-public interface OTEApi {
- OTEFuture<OTEConfigurationStatus> loadConfiguration(OTEConfiguration configuration, OTEStatusCallback<OTEConfigurationStatus> callable) throws InterruptedException, ExecutionException;
- OTEFuture<OTEConfigurationStatus> resetConfiguration(OTEStatusCallback<OTEConfigurationStatus> callable) throws InterruptedException, ExecutionException;
- OTEFuture<OTEConfigurationStatus> getConfiguration();
-}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfiguration.java b/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfiguration.java
deleted file mode 100644
index d8bef6bf59..0000000000
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEConfiguration.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.osee.ote;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This defines the bundles to be loaded into the OTE Server.
- *
- * @author Andrew M. Finkbeiner
- *
- */
-public class OTEConfiguration {
-
- private ArrayList<OTEConfigurationItem> items;
-
- public OTEConfiguration() {
- items = new ArrayList<OTEConfigurationItem>();
- }
-
- public List<OTEConfigurationItem> getItems() {
- return items;
- }
-
- public void addItem(OTEConfigurationItem config) {
- items.add(config);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEFuture.java b/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEFuture.java
deleted file mode 100644
index d0a60cc717..0000000000
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/OTEFuture.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.osee.ote;
-
-import java.util.concurrent.Future;
-
-public interface OTEFuture<V> extends Future<V> {
-
-}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiComponent.java b/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiComponent.java
deleted file mode 100644
index c00e9028fb..0000000000
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiComponent.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.osee.ote.internal;
-
-import java.util.concurrent.ExecutionException;
-
-import org.eclipse.osee.ote.OTEApi;
-import org.eclipse.osee.ote.OTEConfiguration;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEFuture;
-import org.eclipse.osee.ote.OTEStatusCallback;
-
-public class OTEApiComponent implements OTEApi {
-
- private OTEApiImpl oteApi;
-
- public void start(){
- OTEBundleLoader loader = new OTEBundleLoader();
- oteApi = new OTEApiImpl(loader);
- }
-
- public void stop(){
- oteApi = null;
- }
-
- @Override
- public OTEFuture<OTEConfigurationStatus> loadConfiguration(OTEConfiguration configuration, OTEStatusCallback<OTEConfigurationStatus> callable) throws InterruptedException, ExecutionException {
- return oteApi.loadConfiguration(configuration, callable);
- }
-
- @Override
- public OTEFuture<OTEConfigurationStatus> resetConfiguration(OTEStatusCallback<OTEConfigurationStatus> callable) throws InterruptedException, ExecutionException {
- return oteApi.resetConfiguration(callable);
- }
-
- @Override
- public OTEFuture<OTEConfigurationStatus> getConfiguration() {
- return oteApi.getConfiguration();
- }
-
- void clearJarCache(){
- oteApi.clearJarCache();
- }
-}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiImpl.java b/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiImpl.java
deleted file mode 100644
index 7ae20899c2..0000000000
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEApiImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.osee.ote.internal;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.eclipse.osee.ote.OTEApi;
-import org.eclipse.osee.ote.OTEConfiguration;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEFuture;
-import org.eclipse.osee.ote.OTEStatusCallback;
-
-public final class OTEApiImpl implements OTEApi{
-
- private final OTEBundleLoader bundleLoader;
- private final OTEConfiguration emptyConfiguration;
- private final ReentrantLock configurationLock;
-
- private OTEFuture<OTEConfigurationStatus> currentConfigurationFuture;
- private ExecutorService executor;
-
- OTEApiImpl(OTEBundleLoader bundleLoader){
- this.configurationLock = new ReentrantLock();
- this.bundleLoader = bundleLoader;
- this.emptyConfiguration = new OTEConfiguration();
- this.currentConfigurationFuture = new OTEFutureImpl(new OTEConfigurationStatus(emptyConfiguration, true, ""));
- this.executor = Executors.newSingleThreadExecutor(new ThreadFactory(){
- @Override
- public Thread newThread(Runnable arg0) {
- Thread th = new Thread(arg0);
- th.setName("OteConfiguration");
- return th;
- }
- });
- }
-
- @Override
- public OTEFuture<OTEConfigurationStatus> loadConfiguration(OTEConfiguration configuration, OTEStatusCallback<OTEConfigurationStatus> callable) throws InterruptedException, ExecutionException {
- OTEFuture<OTEConfigurationStatus> status;
- configurationLock.lock();
- try{
- if(currentConfigurationFuture != null && !currentConfigurationFuture.isDone()){
- status = new OTEFutureImpl(new OTEConfigurationStatus(configuration, false, "In the process of loading a configuration."));
- callable.complete(status.get());
- } else if(currentConfigurationFuture.get().getConfiguration() == emptyConfiguration || configuration == emptyConfiguration || !currentConfigurationFuture.get().isSuccess()){
- status = new OTEFutureImpl(executor.submit(new Configure(bundleLoader, configuration, callable)));
- currentConfigurationFuture = status;
- } else {
- status = new OTEFutureImpl(new OTEConfigurationStatus(configuration, false, "Environment already configured."));
- callable.complete(status.get());
- }
- } finally {
- configurationLock.unlock();
- }
- return status;
- }
-
- @Override
- public OTEFuture<OTEConfigurationStatus> resetConfiguration(OTEStatusCallback<OTEConfigurationStatus> callable) throws InterruptedException, ExecutionException {
- return loadConfiguration(emptyConfiguration, callable);
- }
-
- @Override
- public OTEFuture<OTEConfigurationStatus> getConfiguration() {
- return currentConfigurationFuture;
- }
-
- void clearJarCache(){
- bundleLoader.clearJarCache();
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java b/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java
deleted file mode 100644
index b270e5b962..0000000000
--- a/plugins/org.eclipse.osee.ote/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * 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.ote.internal;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil;
-import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamPumper;
-import org.eclipse.osee.ote.OTEConfiguration;
-import org.eclipse.osee.ote.OTEConfigurationItem;
-import org.eclipse.osee.ote.OTEConfigurationStatus;
-import org.eclipse.osee.ote.OTEStatusCallback;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.FrameworkUtil;
-
-public class OTEBundleLoader {
-
- private final Collection<Bundle> installedBundles;
- private final Collection<Bundle> runningBundles;
- private final Map<String, String> bundleNameToMd5Map;
-
- private final BundleContext context;
-
- public OTEBundleLoader() {
- this.context = FrameworkUtil.getBundle(getClass()).getBundleContext();
- this.installedBundles = new LinkedList<Bundle>();
- this.runningBundles = new LinkedList<Bundle>();
- this.bundleNameToMd5Map = new HashMap<String, String>();
- }
-
- public boolean install(OTEConfiguration oteConfiguration, OTEStatusCallback<OTEConfigurationStatus> statusCallback) {
- boolean pass = true;
- for (OTEConfigurationItem bundleDescription : oteConfiguration.getItems()) {
- String bundleName = bundleDescription.getSymbolicName();
- try {
- boolean exists = false;
- for (Bundle bundle : runningBundles) {
- if (bundle.getSymbolicName().equals(bundleName)) {
- exists = true;
- break;
- }
- }
- if (!exists) {
- Bundle bundle = Platform.getBundle(bundleDescription.getSymbolicName());
- if (bundle == null) {
- Bundle installedBundle;
- InputStream bundleData = acquireSystemLibraryStream(bundleDescription);
- installedBundle = context.installBundle("OTE-" + bundleName, bundleData);
- bundleData.close();
- bundleNameToMd5Map.put(bundleName, bundleDescription.getMd5Digest());
- installedBundles.add(installedBundle);
- }
- }
- statusCallback.log("installed " + bundleName);
- } catch (Throwable th) {
- statusCallback.error(String.format("Unable to load [%s].", bundleName), th);
- pass = false;
- } finally {
- statusCallback.incrememtUnitsWorked(1);
- }
- }
- return pass;
- }
-
- public boolean start(OTEStatusCallback<OTEConfigurationStatus> statusCallback) {
- boolean pass = true;
- Iterator<Bundle> iter = installedBundles.iterator();
- while (iter.hasNext()) {
- Bundle bundle = iter.next();
- try {
- String entry = bundle.getHeaders().get("Fragment-Host");
- if (entry == null) {
- bundle.start();
- }
- // We got here because bundle.start did not exception
- runningBundles.add(bundle);
- iter.remove();
- statusCallback.log("started " + bundle.getSymbolicName());
- } catch (BundleException ex) {
- pass = false;
- statusCallback.error("Failed to start " + bundle.getSymbolicName(), ex);
- } finally {
- statusCallback.incrememtUnitsWorked(1);
- }
- }
- return pass;
- }
-
- public boolean uninstall(OTEStatusCallback<OTEConfigurationStatus> statusCallback) {
- boolean result = true;
- for (Bundle bundle : installedBundles) {
- try {
- bundle.uninstall();
- } catch (BundleException ex) {
- result = false;
- statusCallback.error("Failed to uninstall " + bundle.getSymbolicName(), ex);
- }
- }
- installedBundles.clear();
-
- for (Bundle bundle : runningBundles) {
- try {
- bundle.stop();
- bundle.uninstall();
- } catch (BundleException ex) {
- result = false;
- statusCallback.error("Failed to stop and uninstall " + bundle.getSymbolicName(), ex);
- }
- }
- runningBundles.clear();
-
- return result;
- }
-
- private InputStream acquireSystemLibraryStream(OTEConfigurationItem bundleDescription) throws Exception {
- File dir = getJarCache();
- File anticipatedJarFile = new File(dir, bundleDescription.getSymbolicName() + "_" + bundleDescription.getVersion() + ".jar");
- ensureJarFileOnDisk(bundleDescription, anticipatedJarFile);
- return new FileInputStream(anticipatedJarFile);
- }
-
- private void ensureJarFileOnDisk(OTEConfigurationItem bundleDescription, File anticipatedJarFile) throws Exception {
- // assume MD5 matches until we can check the file
- boolean md5Matches = true;
-
- if (anticipatedJarFile.exists()) {
- InputStream in = new FileInputStream(anticipatedJarFile);
- String diskMd5Digest = ChecksumUtil.createChecksumAsString(in, "MD5");
- in.close();
- md5Matches = diskMd5Digest.equals(bundleDescription.getMd5Digest());
- }
-
- if (!md5Matches || !anticipatedJarFile.exists()) {
- InputStream servedBundleIn = new URL(bundleDescription.getLocationUrl()).openConnection().getInputStream();
- OutputStream cachedFileOut = new FileOutputStream(anticipatedJarFile);
- StreamPumper.pumpData(servedBundleIn, cachedFileOut);
- cachedFileOut.close();
- servedBundleIn.close();
- }
- }
-
- private File getJarCache() {
- String path = System.getProperty("user.home") + File.separator + "OTESERVER";
- File jarCache = new File(path, "runtimeCache");
- if (!jarCache.exists()) {
- if (!jarCache.mkdirs()) {
- throw new RuntimeException("Could not create JAR cache at " + jarCache.getAbsolutePath());
- }
- }
- if (!jarCache.isDirectory()) {
- throw new IllegalStateException("the JAR cache is not a directory! Path=" + jarCache.getAbsolutePath());
- }
- return jarCache;
- }
-
- void clearJarCache() {
- File[] jars = getJarCache().listFiles(new FileFilter() {
- @Override
- public boolean accept(File file) {
- return !file.isDirectory() && file.getAbsolutePath().endsWith(".jar");
- }
- });
- for(File jar:jars){
- jar.delete();
- }
- }
-
- public void dispose() {
- bundleNameToMd5Map.clear();
- installedBundles.clear();
- runningBundles.clear();
- }
-
- public boolean installed() {
- return installedBundles.size() > 0 || runningBundles.size() > 0;
- }
-
-}

Back to the top