diff options
author | rbrooks | 2010-07-24 08:02:08 +0000 |
---|---|---|
committer | rbrooks | 2010-07-24 08:02:08 +0000 |
commit | 4ed8bddc791fda93940f238c5135556a07041dc0 (patch) | |
tree | 64a118285c5006c3a38320dbb2d374e8ea72a061 /plugins/org.eclipse.osee.ote.define | |
parent | 542cc7344d3f129d64e47f547384297c8e1b1f43 (diff) | |
download | org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.gz org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.xz org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.zip |
converted all line terminators to unix style
Diffstat (limited to 'plugins/org.eclipse.osee.ote.define')
30 files changed, 1203 insertions, 1203 deletions
diff --git a/plugins/org.eclipse.osee.ote.define/.classpath b/plugins/org.eclipse.osee.ote.define/.classpath index 8a8f1668cdc..ad32c83a788 100644 --- a/plugins/org.eclipse.osee.ote.define/.classpath +++ b/plugins/org.eclipse.osee.ote.define/.classpath @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?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.define/.project b/plugins/org.eclipse.osee.ote.define/.project index 6bc88ca2aed..d768568dbcb 100644 --- a/plugins/org.eclipse.osee.ote.define/.project +++ b/plugins/org.eclipse.osee.ote.define/.project @@ -1,40 +1,40 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.ote.define</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.xtext.ui.core.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.xtext.ui.core.xtextNature</nature>
- <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osee.ote.define</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.xtext.ui.core.xtextBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.xtext.ui.core.xtextNature</nature> + <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.osee.ote.define/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.define/META-INF/MANIFEST.MF index e54b12ed180..1c6efdd0263 100644 --- a/plugins/org.eclipse.osee.ote.define/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ote.define/META-INF/MANIFEST.MF @@ -1,33 +1,33 @@ -Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OTE Define Plug-in (Incubation)
-Bundle-SymbolicName: org.eclipse.osee.ote.define;singleton:=true
-Bundle-Version: 0.9.5.qualifier
-Bundle-Activator: org.eclipse.osee.ote.define.OteDefinePlugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.core.filebuffers,
- org.eclipse.core.filesystem,
- org.eclipse.osee.framework.jdk.core,
- org.eclipse.osee.framework.plugin.core,
- org.eclipse.osee.framework.ui.plugin,
- org.eclipse.osee.framework.skynet.core
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.osee.ote.define,
- org.eclipse.osee.ote.define.AUTOGEN,
- org.eclipse.osee.ote.define.artifacts,
- org.eclipse.osee.ote.define.jobs,
- org.eclipse.osee.ote.define.operations,
- org.eclipse.osee.ote.define.parser,
- org.eclipse.osee.ote.define.parser.handlers,
- org.eclipse.osee.ote.define.utilities
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.apache.commons.lang;version="2.4.0",
- org.eclipse.osee.framework.core.data,
- org.eclipse.osee.framework.core.enums,
- org.eclipse.osee.framework.core.exception,
- org.eclipse.osee.framework.core.model,
- org.eclipse.osee.framework.core.util,
- org.eclipse.osee.framework.logging
+Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: OTE Define Plug-in (Incubation) +Bundle-SymbolicName: org.eclipse.osee.ote.define;singleton:=true +Bundle-Version: 0.9.5.qualifier +Bundle-Activator: org.eclipse.osee.ote.define.OteDefinePlugin +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.core.filebuffers, + org.eclipse.core.filesystem, + org.eclipse.osee.framework.jdk.core, + org.eclipse.osee.framework.plugin.core, + org.eclipse.osee.framework.ui.plugin, + org.eclipse.osee.framework.skynet.core +Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.osee.ote.define, + org.eclipse.osee.ote.define.AUTOGEN, + org.eclipse.osee.ote.define.artifacts, + org.eclipse.osee.ote.define.jobs, + org.eclipse.osee.ote.define.operations, + org.eclipse.osee.ote.define.parser, + org.eclipse.osee.ote.define.parser.handlers, + org.eclipse.osee.ote.define.utilities +Bundle-Vendor: Eclipse Open System Engineering Environment +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Import-Package: org.apache.commons.lang;version="2.4.0", + org.eclipse.osee.framework.core.data, + org.eclipse.osee.framework.core.enums, + org.eclipse.osee.framework.core.exception, + org.eclipse.osee.framework.core.model, + org.eclipse.osee.framework.core.util, + org.eclipse.osee.framework.logging diff --git a/plugins/org.eclipse.osee.ote.define/build.properties b/plugins/org.eclipse.osee.ote.define/build.properties index 87d235ce811..0d09cd77c15 100644 --- a/plugins/org.eclipse.osee.ote.define/build.properties +++ b/plugins/org.eclipse.osee.ote.define/build.properties @@ -1,7 +1,7 @@ -source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- images/,\
+source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ support/
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/plugin.xml b/plugins/org.eclipse.osee.ote.define/plugin.xml index 1641a6c6d27..ddba2d566fb 100644 --- a/plugins/org.eclipse.osee.ote.define/plugin.xml +++ b/plugins/org.eclipse.osee.ote.define/plugin.xml @@ -1,29 +1,29 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="OutfileParser" name="OutfileParser" schema="schema/OutfileParser.exsd"/>
- <extension
- id="OseeTypesOTE"
- name="OseeTypesOTE"
- point="org.eclipse.osee.framework.skynet.core.OseeTypes">
- <OseeTypes
- resource="support/OseeTypes_OTE.osee">
- </OseeTypes>
- </extension>
- <extension
- id="OteOutfileParser"
- point="org.eclipse.osee.ote.define.OutfileParser">
- <OutfileParser
- classname="org.eclipse.osee.ote.define.parser.OteOutfileParser"
- supportedExtensions="tmo">
- </OutfileParser>
- </extension>
- <extension
- id="MappedAttributeDataProvider"
- name="name"
- point="org.eclipse.osee.framework.skynet.core.AttributeDataProvider">
- <BinaryAttributeDataProvider
- class="org.eclipse.osee.ote.define.MappedAttributeDataProviderOld">
- </BinaryAttributeDataProvider>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + <extension-point id="OutfileParser" name="OutfileParser" schema="schema/OutfileParser.exsd"/> + <extension + id="OseeTypesOTE" + name="OseeTypesOTE" + point="org.eclipse.osee.framework.skynet.core.OseeTypes"> + <OseeTypes + resource="support/OseeTypes_OTE.osee"> + </OseeTypes> + </extension> + <extension + id="OteOutfileParser" + point="org.eclipse.osee.ote.define.OutfileParser"> + <OutfileParser + classname="org.eclipse.osee.ote.define.parser.OteOutfileParser" + supportedExtensions="tmo"> + </OutfileParser> + </extension> + <extension + id="MappedAttributeDataProvider" + name="name" + point="org.eclipse.osee.framework.skynet.core.AttributeDataProvider"> + <BinaryAttributeDataProvider + class="org.eclipse.osee.ote.define.MappedAttributeDataProviderOld"> + </BinaryAttributeDataProvider> + </extension> +</plugin> diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/OteDefinePlugin.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/OteDefinePlugin.java index 64131fe8e45..b7d853b8d81 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/OteDefinePlugin.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/OteDefinePlugin.java @@ -8,25 +8,25 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define;
-
+package org.eclipse.osee.ote.define; + import org.eclipse.osee.framework.ui.plugin.OseeUiActivator; import org.osgi.framework.BundleContext; -
-/**
- * The activator class controls the plug-in life cycle
- */
-public class OteDefinePlugin extends OseeUiActivator {
- public static final String PLUGIN_ID = "org.eclipse.osee.ote.define";
-
- public OteDefinePlugin() {
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-}
+ +/** + * The activator class controls the plug-in life cycle + */ +public class OteDefinePlugin extends OseeUiActivator { + public static final String PLUGIN_ID = "org.eclipse.osee.ote.define"; + + public OteDefinePlugin() { + } + + public void start(BundleContext context) throws Exception { + super.start(context); + } + + public void stop(BundleContext context) throws Exception { + super.stop(context); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/FindCommitableJob.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/FindCommitableJob.java index f3aed72f441..c27f7734ee1 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/FindCommitableJob.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/FindCommitableJob.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.jobs;
-
+package org.eclipse.osee.ote.define.jobs; + import java.util.ArrayList; import java.util.List; import java.util.logging.Level; @@ -22,67 +22,67 @@ import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.ote.define.OteDefinePlugin; import org.eclipse.osee.ote.define.artifacts.TestRunOperator; -
-/**
- * @author Roberto E. Escobar
- */
-public class FindCommitableJob extends Job {
-
- private static final String JOB_NAME = "Check commit allowed";
- private Artifact[] artifactsToSort;
- private Artifact[] itemsToCommit;
- private Artifact[] nonCommitableItems;
-
- public FindCommitableJob(Artifact... artifactsToSort) {
- super(JOB_NAME);
- setUser(true);
- setPriority(Job.LONG);
- this.artifactsToSort = artifactsToSort;
- this.itemsToCommit = this.nonCommitableItems = new Artifact[0];
- }
-
- public Artifact[] getAll() {
- return this.artifactsToSort;
- }
-
- public Artifact[] getCommitAllowed() {
- return itemsToCommit;
- }
-
- public Artifact[] getCommitNotAllowed() {
- return nonCommitableItems;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- IStatus toReturn = Status.CANCEL_STATUS;
- monitor.beginTask(getName(), artifactsToSort.length);
- List<Artifact> commitable = new ArrayList<Artifact>();
- List<Artifact> nonCommitable = new ArrayList<Artifact>();
- for (Artifact artifact : artifactsToSort) {
- try {
- TestRunOperator operator = new TestRunOperator(artifact);
- if (operator.isCommitAllowed() == true) {
- commitable.add(artifact);
- } else {
- nonCommitable.add(artifact);
- }
- } catch (OseeArgumentException ex) {
- OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex);
- }
-
- if (monitor.isCanceled() == true) {
- break;
- }
- monitor.worked(1);
- }
- itemsToCommit = commitable.toArray(new Artifact[commitable.size()]);
- nonCommitableItems = nonCommitable.toArray(new Artifact[nonCommitable.size()]);
- if (monitor.isCanceled() != true) {
- toReturn = Status.OK_STATUS;
- }
- monitor.subTask("Done");
- monitor.done();
- return toReturn;
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class FindCommitableJob extends Job { + + private static final String JOB_NAME = "Check commit allowed"; + private Artifact[] artifactsToSort; + private Artifact[] itemsToCommit; + private Artifact[] nonCommitableItems; + + public FindCommitableJob(Artifact... artifactsToSort) { + super(JOB_NAME); + setUser(true); + setPriority(Job.LONG); + this.artifactsToSort = artifactsToSort; + this.itemsToCommit = this.nonCommitableItems = new Artifact[0]; + } + + public Artifact[] getAll() { + return this.artifactsToSort; + } + + public Artifact[] getCommitAllowed() { + return itemsToCommit; + } + + public Artifact[] getCommitNotAllowed() { + return nonCommitableItems; + } + + @Override + public IStatus run(IProgressMonitor monitor) { + IStatus toReturn = Status.CANCEL_STATUS; + monitor.beginTask(getName(), artifactsToSort.length); + List<Artifact> commitable = new ArrayList<Artifact>(); + List<Artifact> nonCommitable = new ArrayList<Artifact>(); + for (Artifact artifact : artifactsToSort) { + try { + TestRunOperator operator = new TestRunOperator(artifact); + if (operator.isCommitAllowed() == true) { + commitable.add(artifact); + } else { + nonCommitable.add(artifact); + } + } catch (OseeArgumentException ex) { + OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex); + } + + if (monitor.isCanceled() == true) { + break; + } + monitor.worked(1); + } + itemsToCommit = commitable.toArray(new Artifact[commitable.size()]); + nonCommitableItems = nonCommitable.toArray(new Artifact[nonCommitable.size()]); + if (monitor.isCanceled() != true) { + toReturn = Status.OK_STATUS; + } + monitor.subTask("Done"); + monitor.done(); + return toReturn; + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/OutfileToArtifactJob.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/OutfileToArtifactJob.java index bf2c27741aa..adad8fcea19 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/OutfileToArtifactJob.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/OutfileToArtifactJob.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.jobs;
-
+package org.eclipse.osee.ote.define.jobs; + import java.net.URI; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -20,56 +20,56 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.ote.define.OteDefinePlugin; import org.eclipse.osee.ote.define.operations.LinkTestRunToTestScriptOperation; import org.eclipse.osee.ote.define.operations.OutfileToArtifactOperation; -
-/**
- * @author Roberto E. Escobar
- */
-public class OutfileToArtifactJob extends Job {
-
- private static final String JOB_NAME = "Convert Outfile to Artifact";
- private URI[] filesToImport;
- private Artifact[] results;
- private URI[] filesWithErrors;
- private Branch branch;
-
- public OutfileToArtifactJob(Branch branch, URI... filesToImport) {
- super(JOB_NAME);
- setUser(true);
- setPriority(Job.LONG);
- this.branch = branch;
- this.filesToImport = filesToImport;
- this.results = new Artifact[0];
- this.filesWithErrors = new URI[0];
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IStatus toReturn = Status.OK_STATUS;
- try {
- monitor.beginTask(getName(), filesToImport.length * 2);
- OutfileToArtifactOperation outfileToArtifactOperation = new OutfileToArtifactOperation(branch, filesToImport);
- outfileToArtifactOperation.execute(monitor);
- results = outfileToArtifactOperation.getResults();
- filesWithErrors = outfileToArtifactOperation.getUnparseableFiles();
- if (monitor.isCanceled() != true) {
- LinkTestRunToTestScriptOperation linkingOperation = new LinkTestRunToTestScriptOperation(results);
- linkingOperation.execute(monitor);
- }
-
- } catch (Exception ex) {
- toReturn = new Status(Status.ERROR, OteDefinePlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
- } finally {
- monitor.subTask("Done");
- monitor.done();
- }
- return toReturn;
- }
-
- public Artifact[] getResults() {
- return results;
- }
-
- public URI[] getUnparseableFiles() {
- return filesWithErrors;
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class OutfileToArtifactJob extends Job { + + private static final String JOB_NAME = "Convert Outfile to Artifact"; + private URI[] filesToImport; + private Artifact[] results; + private URI[] filesWithErrors; + private Branch branch; + + public OutfileToArtifactJob(Branch branch, URI... filesToImport) { + super(JOB_NAME); + setUser(true); + setPriority(Job.LONG); + this.branch = branch; + this.filesToImport = filesToImport; + this.results = new Artifact[0]; + this.filesWithErrors = new URI[0]; + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + IStatus toReturn = Status.OK_STATUS; + try { + monitor.beginTask(getName(), filesToImport.length * 2); + OutfileToArtifactOperation outfileToArtifactOperation = new OutfileToArtifactOperation(branch, filesToImport); + outfileToArtifactOperation.execute(monitor); + results = outfileToArtifactOperation.getResults(); + filesWithErrors = outfileToArtifactOperation.getUnparseableFiles(); + if (monitor.isCanceled() != true) { + LinkTestRunToTestScriptOperation linkingOperation = new LinkTestRunToTestScriptOperation(results); + linkingOperation.execute(monitor); + } + + } catch (Exception ex) { + toReturn = new Status(Status.ERROR, OteDefinePlugin.PLUGIN_ID, -1, ex.getMessage(), ex); + } finally { + monitor.subTask("Done"); + monitor.done(); + } + return toReturn; + } + + public Artifact[] getResults() { + return results; + } + + public URI[] getUnparseableFiles() { + return filesWithErrors; + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/RemoteResourceRequestJob.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/RemoteResourceRequestJob.java index 01e5fb7a422..a061be9044d 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/RemoteResourceRequestJob.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/RemoteResourceRequestJob.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.jobs;
-
+package org.eclipse.osee.ote.define.jobs; + import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -17,43 +17,43 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.osee.ote.define.OteDefinePlugin; import org.eclipse.osee.ote.define.operations.RemoteResourceRequestOperation; -
-/**
- * @author Roberto E. Escobar
- */
-public class RemoteResourceRequestJob extends Job {
- private static final String JOB_NAME = "Download Resource";
- private String urlRequest;
- private String targetFileName;
- private IFile downloaded;
-
- public RemoteResourceRequestJob(String urlRequest, String targetFileName) {
- super(JOB_NAME);
- this.urlRequest = urlRequest;
- this.targetFileName = targetFileName;
- setUser(false);
- setPriority(Job.LONG);
- }
-
- public IFile getDownloadedFile() {
- return downloaded;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.CANCEL_STATUS;
- try {
- RemoteResourceRequestOperation remoteRequest =
- new RemoteResourceRequestOperation("TEMP", urlRequest, targetFileName);
- remoteRequest.execute(monitor);
- downloaded = remoteRequest.getResults();
- status = Status.OK_STATUS;
- } catch (Exception ex) {
- status =
- new Status(Status.ERROR, OteDefinePlugin.PLUGIN_ID, String.format("Error downloading resource [%s]",
- targetFileName), ex);
- }
- return status;
- }
-
-}
+ +/** + * @author Roberto E. Escobar + */ +public class RemoteResourceRequestJob extends Job { + private static final String JOB_NAME = "Download Resource"; + private String urlRequest; + private String targetFileName; + private IFile downloaded; + + public RemoteResourceRequestJob(String urlRequest, String targetFileName) { + super(JOB_NAME); + this.urlRequest = urlRequest; + this.targetFileName = targetFileName; + setUser(false); + setPriority(Job.LONG); + } + + public IFile getDownloadedFile() { + return downloaded; + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + IStatus status = Status.CANCEL_STATUS; + try { + RemoteResourceRequestOperation remoteRequest = + new RemoteResourceRequestOperation("TEMP", urlRequest, targetFileName); + remoteRequest.execute(monitor); + downloaded = remoteRequest.getResults(); + status = Status.OK_STATUS; + } catch (Exception ex) { + status = + new Status(Status.ERROR, OteDefinePlugin.PLUGIN_ID, String.format("Error downloading resource [%s]", + targetFileName), ex); + } + return status; + } + +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/AbstractRemoteResourceRequestTemplate.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/AbstractRemoteResourceRequestTemplate.java index 34209045b15..b0c24207ce4 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/AbstractRemoteResourceRequestTemplate.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/AbstractRemoteResourceRequestTemplate.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.operations;
-
+package org.eclipse.osee.ote.define.operations; + import java.io.File; import java.io.IOException; import java.net.HttpURLConnection; @@ -27,109 +27,109 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.plugin.core.util.OseeData; import org.eclipse.osee.ote.define.OteDefinePlugin; -
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractRemoteResourceRequestTemplate {
- private static final int CONNECTION_TIMEOUT = 120000;
- private static final int CONNECTION_READ_TIMEOUT = 10000;
- private IFile remoteFile;
- private String tempFolderName;
- private String remoteRequestUrl;
-
- public AbstractRemoteResourceRequestTemplate(String tempFolderName, String remoteRequestUrl) {
- super();
- this.tempFolderName = tempFolderName;
- this.remoteRequestUrl = remoteRequestUrl;
- this.remoteFile = null;
- createTemporaryDirectory();
- }
-
- private void createTemporaryDirectory() {
- try {
- final IProject project = OseeData.getProject();
- final IFolder folder = project.getFolder(tempFolderName + File.separator);
- if (folder != null && folder.exists() != true) {
- ContainerCreator containerCreator = new ContainerCreator(folder.getWorkspace(), folder.getFullPath());
- containerCreator.createContainer(new NullProgressMonitor());
- }
- } catch (CoreException ex1) {
- OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex1.toString(), ex1);
- }
- }
-
- private boolean isLocalFileAvailable(IFile file) {
- boolean found = false;
- if (file != null) {
- try {
- IFileStore store = EFS.getStore(file.getLocationURI());
- found = store.fetchInfo().exists();
- } catch (Exception ex) {
- OseeLog.log(OteDefinePlugin.class, Level.SEVERE, "Error retrieving file system. ", ex);
- }
- }
- return found;
- }
-
- public IFile getResults() {
- return remoteFile;
- }
-
- protected HttpURLConnection setupConnection(URL url) throws IOException {
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setConnectTimeout(CONNECTION_TIMEOUT);
- connection.setReadTimeout(CONNECTION_READ_TIMEOUT);
- return connection;
- }
-
- public int getTotalWork() throws Exception {
- return isLocalFileAvailable(getLocalStorageIFile()) != true ? 4 : 1;
- }
-
- private boolean isRemoteRequestNeeded() throws Exception {
- return isLocalFileAvailable(getLocalStorageIFile()) != true;
- }
-
- public void execute(IProgressMonitor monitor) throws Exception {
- if (isRemoteRequestNeeded() != false) {
- HttpURLConnection connection = null;
- try {
- monitor.setTaskName(String.format("Requesting Resource: [%s]", getRemoteFileName()));
- connection = setupConnection(new URL(remoteRequestUrl));
- connection.connect();
- monitor.worked(1);
- if (monitor.isCanceled() != true) {
- this.remoteFile = handleTransfer(monitor, connection);
- monitor.worked(1);
- }
- } finally {
- if (connection != null) {
- connection.disconnect();
- }
- }
- } else {
- this.remoteFile = getLocalStorageIFile();
- }
- monitor.worked(1);
- }
-
- protected IFile getLocalStorageIFile() throws Exception {
- return OseeData.getIFile(getLocalStorageName());
- }
-
- protected String getRemoteRequestUrl() {
- return remoteRequestUrl;
- }
-
- protected String getTempFolderName() {
- return tempFolderName;
- }
-
- protected abstract String getLocalStorageName() throws Exception;
-
- protected abstract String getRemoteFileName();
-
- protected abstract IFile handleTransfer(IProgressMonitor monitor, HttpURLConnection connection) throws Exception;
-
+ +/** + * @author Roberto E. Escobar + */ +public abstract class AbstractRemoteResourceRequestTemplate { + private static final int CONNECTION_TIMEOUT = 120000; + private static final int CONNECTION_READ_TIMEOUT = 10000; + private IFile remoteFile; + private String tempFolderName; + private String remoteRequestUrl; + + public AbstractRemoteResourceRequestTemplate(String tempFolderName, String remoteRequestUrl) { + super(); + this.tempFolderName = tempFolderName; + this.remoteRequestUrl = remoteRequestUrl; + this.remoteFile = null; + createTemporaryDirectory(); + } + + private void createTemporaryDirectory() { + try { + final IProject project = OseeData.getProject(); + final IFolder folder = project.getFolder(tempFolderName + File.separator); + if (folder != null && folder.exists() != true) { + ContainerCreator containerCreator = new ContainerCreator(folder.getWorkspace(), folder.getFullPath()); + containerCreator.createContainer(new NullProgressMonitor()); + } + } catch (CoreException ex1) { + OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex1.toString(), ex1); + } + } + + private boolean isLocalFileAvailable(IFile file) { + boolean found = false; + if (file != null) { + try { + IFileStore store = EFS.getStore(file.getLocationURI()); + found = store.fetchInfo().exists(); + } catch (Exception ex) { + OseeLog.log(OteDefinePlugin.class, Level.SEVERE, "Error retrieving file system. ", ex); + } + } + return found; + } + + public IFile getResults() { + return remoteFile; + } + + protected HttpURLConnection setupConnection(URL url) throws IOException { + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setConnectTimeout(CONNECTION_TIMEOUT); + connection.setReadTimeout(CONNECTION_READ_TIMEOUT); + return connection; + } + + public int getTotalWork() throws Exception { + return isLocalFileAvailable(getLocalStorageIFile()) != true ? 4 : 1; + } + + private boolean isRemoteRequestNeeded() throws Exception { + return isLocalFileAvailable(getLocalStorageIFile()) != true; + } + + public void execute(IProgressMonitor monitor) throws Exception { + if (isRemoteRequestNeeded() != false) { + HttpURLConnection connection = null; + try { + monitor.setTaskName(String.format("Requesting Resource: [%s]", getRemoteFileName())); + connection = setupConnection(new URL(remoteRequestUrl)); + connection.connect(); + monitor.worked(1); + if (monitor.isCanceled() != true) { + this.remoteFile = handleTransfer(monitor, connection); + monitor.worked(1); + } + } finally { + if (connection != null) { + connection.disconnect(); + } + } + } else { + this.remoteFile = getLocalStorageIFile(); + } + monitor.worked(1); + } + + protected IFile getLocalStorageIFile() throws Exception { + return OseeData.getIFile(getLocalStorageName()); + } + + protected String getRemoteRequestUrl() { + return remoteRequestUrl; + } + + protected String getTempFolderName() { + return tempFolderName; + } + + protected abstract String getLocalStorageName() throws Exception; + + protected abstract String getRemoteFileName(); + + protected abstract IFile handleTransfer(IProgressMonitor monitor, HttpURLConnection connection) throws Exception; + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/ImportOutfileOperation.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/ImportOutfileOperation.java index 105b620b0a7..a9b8e24ac73 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/ImportOutfileOperation.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/ImportOutfileOperation.java @@ -1,152 +1,152 @@ -/*******************************************************************************
- * 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.define.operations;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
-import org.eclipse.osee.ote.define.jobs.FindCommitableJob;
-import org.eclipse.osee.ote.define.jobs.OutfileToArtifactJob;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ImportOutfileOperation {
-
- private final URI[] fileSystemObjects;
- private final Branch selectedBranch;
-
- public ImportOutfileOperation(Branch selectedBranch, URI... fileSystemObjects) throws OseeCoreException {
- checkForNull(selectedBranch);
- checkForNull(fileSystemObjects);
- checkForEmpty(fileSystemObjects);
-
- this.fileSystemObjects = fileSystemObjects;
- this.selectedBranch = selectedBranch;
- }
-
- private void checkSuccessful(IStatus status) throws OseeStateException {
- if (status.equals(Status.OK_STATUS) != true && status.equals(Status.OK) != true) {
- throw new OseeStateException(String.format("Error detected: %s", status.getMessage()));
- }
- }
-
- private void checkForEmpty(Object[] items) throws OseeArgumentException {
- if (items.length <= 0) {
- throw new OseeArgumentException("No items to process. Size was 0.");
- }
- }
-
- private void checkForNull(Object object) throws OseeArgumentException {
- if (object == null) {
- throw new OseeArgumentException("Object cannot be null");
- }
- }
-
- public void execute(IProgressMonitor monitor) throws Exception {
- OutfileToArtifactJob job = new OutfileToArtifactJob(selectedBranch, fileSystemObjects);
- job.setUser(false);
- job.schedule();
- job.join();
-
- checkSuccessful(job.getResult());
-
- // Report Parse Errors
- URI[] itemsWithError = job.getUnparseableFiles();
- if (itemsWithError.length > 0) {
- throw new Exception(String.format("Error parsing files [%s]", Arrays.deepToString(itemsWithError)));
- } else {
- launchFindCommitableJob(monitor, "", job.getResults());
- }
- }
-
- private void launchFindCommitableJob(IProgressMonitor monitor, String commitComment, final Artifact[] artifacts) throws Exception {
- // Find Commit Allowed
- FindCommitableJob job = new FindCommitableJob(artifacts);
- job.setUser(false);
- job.schedule();
- job.join();
-
- checkSuccessful(job.getResult());
-
- Artifact[] notAllowed = job.getCommitNotAllowed();
- if (notAllowed.length > 0) {
- throw new IllegalArgumentException(String.format("Some items are not commitable. [%s]", toString(notAllowed)));
- }
- commitSelectedArtifacts(monitor, commitComment, job.getCommitAllowed());
- }
-
- private String toString(Artifact[] artifacts) {
- List<String> toReturn = new ArrayList<String>();
- for (Artifact artifact : artifacts) {
- toReturn.add(artifact.getName());
- }
- return org.eclipse.osee.framework.jdk.core.util.Collections.toString(toReturn, ",\n");
- }
-
- private void commitSelectedArtifacts(IProgressMonitor monitor, String commitComment, Object[] items) throws Exception {
- Map<Branch, List<Artifact>> commitMap = getArtifactsByBranch(items);
- for (Branch branch : commitMap.keySet()) {
- monitor.setTaskName(String.format("Committing Artifacts into Branch: [%s]", branch.getName()));
- List<Artifact> artList = commitMap.get(branch);
- commitTestRunTx(monitor, commitComment, branch, artList.toArray(new Artifact[artList.size()]));
- }
- }
-
- private Map<Branch, List<Artifact>> getArtifactsByBranch(Object[] items) {
- Map<Branch, List<Artifact>> branchMap = new HashMap<Branch, List<Artifact>>();
- for (Object object : items) {
- Artifact testRun = (Artifact) object;
- Branch branch = testRun.getBranch();
- List<Artifact> artList = branchMap.get(branch);
- if (artList == null) {
- artList = new ArrayList<Artifact>();
- branchMap.put(branch, artList);
- }
- artList.add(testRun);
- }
- return branchMap;
- }
-
- public static void commitTestRunTx(IProgressMonitor monitor, String commitComment, Branch branch, Artifact... artifacts) throws OseeCoreException {
- monitor.setTaskName("Persist Test Runs");
- for (Artifact artifact : artifacts) {
- monitor.subTask(String.format("Persisting: [%s] ", artifact.getName()));
-
- TestRunOperator operator = new TestRunOperator(artifact);
- operator.setLastDateUploaded(new Date());
- if (monitor.isCanceled() != false) {
- break;
- }
- monitor.worked(1);
- }
-
- Artifacts.persistInTransaction(commitComment, artifacts);
- if (monitor.isCanceled() != false) {
- throw new OseeCoreException("User Cancelled");
- }
- monitor.done();
- }
-}
+/******************************************************************************* + * 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.define.operations; + +import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeStateException; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.utility.Artifacts; +import org.eclipse.osee.ote.define.artifacts.TestRunOperator; +import org.eclipse.osee.ote.define.jobs.FindCommitableJob; +import org.eclipse.osee.ote.define.jobs.OutfileToArtifactJob; + +/** + * @author Roberto E. Escobar + */ +public class ImportOutfileOperation { + + private final URI[] fileSystemObjects; + private final Branch selectedBranch; + + public ImportOutfileOperation(Branch selectedBranch, URI... fileSystemObjects) throws OseeCoreException { + checkForNull(selectedBranch); + checkForNull(fileSystemObjects); + checkForEmpty(fileSystemObjects); + + this.fileSystemObjects = fileSystemObjects; + this.selectedBranch = selectedBranch; + } + + private void checkSuccessful(IStatus status) throws OseeStateException { + if (status.equals(Status.OK_STATUS) != true && status.equals(Status.OK) != true) { + throw new OseeStateException(String.format("Error detected: %s", status.getMessage())); + } + } + + private void checkForEmpty(Object[] items) throws OseeArgumentException { + if (items.length <= 0) { + throw new OseeArgumentException("No items to process. Size was 0."); + } + } + + private void checkForNull(Object object) throws OseeArgumentException { + if (object == null) { + throw new OseeArgumentException("Object cannot be null"); + } + } + + public void execute(IProgressMonitor monitor) throws Exception { + OutfileToArtifactJob job = new OutfileToArtifactJob(selectedBranch, fileSystemObjects); + job.setUser(false); + job.schedule(); + job.join(); + + checkSuccessful(job.getResult()); + + // Report Parse Errors + URI[] itemsWithError = job.getUnparseableFiles(); + if (itemsWithError.length > 0) { + throw new Exception(String.format("Error parsing files [%s]", Arrays.deepToString(itemsWithError))); + } else { + launchFindCommitableJob(monitor, "", job.getResults()); + } + } + + private void launchFindCommitableJob(IProgressMonitor monitor, String commitComment, final Artifact[] artifacts) throws Exception { + // Find Commit Allowed + FindCommitableJob job = new FindCommitableJob(artifacts); + job.setUser(false); + job.schedule(); + job.join(); + + checkSuccessful(job.getResult()); + + Artifact[] notAllowed = job.getCommitNotAllowed(); + if (notAllowed.length > 0) { + throw new IllegalArgumentException(String.format("Some items are not commitable. [%s]", toString(notAllowed))); + } + commitSelectedArtifacts(monitor, commitComment, job.getCommitAllowed()); + } + + private String toString(Artifact[] artifacts) { + List<String> toReturn = new ArrayList<String>(); + for (Artifact artifact : artifacts) { + toReturn.add(artifact.getName()); + } + return org.eclipse.osee.framework.jdk.core.util.Collections.toString(toReturn, ",\n"); + } + + private void commitSelectedArtifacts(IProgressMonitor monitor, String commitComment, Object[] items) throws Exception { + Map<Branch, List<Artifact>> commitMap = getArtifactsByBranch(items); + for (Branch branch : commitMap.keySet()) { + monitor.setTaskName(String.format("Committing Artifacts into Branch: [%s]", branch.getName())); + List<Artifact> artList = commitMap.get(branch); + commitTestRunTx(monitor, commitComment, branch, artList.toArray(new Artifact[artList.size()])); + } + } + + private Map<Branch, List<Artifact>> getArtifactsByBranch(Object[] items) { + Map<Branch, List<Artifact>> branchMap = new HashMap<Branch, List<Artifact>>(); + for (Object object : items) { + Artifact testRun = (Artifact) object; + Branch branch = testRun.getBranch(); + List<Artifact> artList = branchMap.get(branch); + if (artList == null) { + artList = new ArrayList<Artifact>(); + branchMap.put(branch, artList); + } + artList.add(testRun); + } + return branchMap; + } + + public static void commitTestRunTx(IProgressMonitor monitor, String commitComment, Branch branch, Artifact... artifacts) throws OseeCoreException { + monitor.setTaskName("Persist Test Runs"); + for (Artifact artifact : artifacts) { + monitor.subTask(String.format("Persisting: [%s] ", artifact.getName())); + + TestRunOperator operator = new TestRunOperator(artifact); + operator.setLastDateUploaded(new Date()); + if (monitor.isCanceled() != false) { + break; + } + monitor.worked(1); + } + + Artifacts.persistInTransaction(commitComment, artifacts); + if (monitor.isCanceled() != false) { + throw new OseeCoreException("User Cancelled"); + } + monitor.done(); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/LinkTestRunToTestScriptOperation.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/LinkTestRunToTestScriptOperation.java index e64a1ae3623..511495ddbb5 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/LinkTestRunToTestScriptOperation.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/LinkTestRunToTestScriptOperation.java @@ -8,56 +8,56 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.operations;
-
+package org.eclipse.osee.ote.define.operations; + import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.exception.OseeArgumentException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.ote.define.artifacts.TestRunOperator; -
-/**
- * @author Roberto E. Escobar
- */
-public class LinkTestRunToTestScriptOperation {
- private static final String OPERATION_NAME = "Link Test Run to Test Script";
- private Artifact[] artifacts;
- private List<Artifact> unlinked;
- private List<Artifact> linked;
-
- public LinkTestRunToTestScriptOperation(Artifact... artifacts) {
- this.artifacts = artifacts;
- this.unlinked = new ArrayList<Artifact>();
- this.linked = new ArrayList<Artifact>();
- }
-
- public void execute(IProgressMonitor monitor) throws OseeArgumentException {
- int count = 0;
- monitor.setTaskName(OPERATION_NAME);
- for (Artifact testRun : artifacts) {
-
- monitor.subTask(String.format("Linking [%s] [%s of %s] ", testRun.getName(), ++count,
- artifacts.length));
- TestRunOperator operator = new TestRunOperator(testRun);
- try {
- operator.createTestScriptSoftLink();
- linked.add(testRun);
- } catch (Exception ex) {
- unlinked.add(testRun);
- }
- if (monitor.isCanceled() == true) {
- break;
- }
- monitor.worked(1);
- }
- }
-
- public Artifact[] getLinkedArtifacts() {
- return linked.toArray(new Artifact[linked.size()]);
- }
-
- public Artifact[] getUnlinkedArtifacts() {
- return unlinked.toArray(new Artifact[unlinked.size()]);
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class LinkTestRunToTestScriptOperation { + private static final String OPERATION_NAME = "Link Test Run to Test Script"; + private Artifact[] artifacts; + private List<Artifact> unlinked; + private List<Artifact> linked; + + public LinkTestRunToTestScriptOperation(Artifact... artifacts) { + this.artifacts = artifacts; + this.unlinked = new ArrayList<Artifact>(); + this.linked = new ArrayList<Artifact>(); + } + + public void execute(IProgressMonitor monitor) throws OseeArgumentException { + int count = 0; + monitor.setTaskName(OPERATION_NAME); + for (Artifact testRun : artifacts) { + + monitor.subTask(String.format("Linking [%s] [%s of %s] ", testRun.getName(), ++count, + artifacts.length)); + TestRunOperator operator = new TestRunOperator(testRun); + try { + operator.createTestScriptSoftLink(); + linked.add(testRun); + } catch (Exception ex) { + unlinked.add(testRun); + } + if (monitor.isCanceled() == true) { + break; + } + monitor.worked(1); + } + } + + public Artifact[] getLinkedArtifacts() { + return linked.toArray(new Artifact[linked.size()]); + } + + public Artifact[] getUnlinkedArtifacts() { + return unlinked.toArray(new Artifact[unlinked.size()]); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/RemoteResourceRequestOperation.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/RemoteResourceRequestOperation.java index 7c8563aa9d9..e3b7f8ea1bf 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/RemoteResourceRequestOperation.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/RemoteResourceRequestOperation.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.operations;
-
+package org.eclipse.osee.ote.define.operations; + import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -17,59 +17,59 @@ import java.net.HttpURLConnection; import java.net.URL; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IProgressMonitor; -
-/**
- * @author Roberto E. Escobar
- */
-public class RemoteResourceRequestOperation extends AbstractRemoteResourceRequestTemplate {
- private static final String STORAGE_PATH = "TEMP";
- private String fileName;
-
- public RemoteResourceRequestOperation(String tempFolderName, String remoteRequestUrl, String fileName) {
- super(STORAGE_PATH, remoteRequestUrl);
- this.fileName = fileName;
- }
-
- @Override
- protected String getLocalStorageName() throws Exception {
- StringBuilder builder = new StringBuilder();
- builder.append(getTempFolderName());
- builder.append(File.separator);
- builder.append(fileName);
- return builder.toString();
- }
-
- @Override
- protected String getRemoteFileName() {
- return fileName;
- }
-
- protected HttpURLConnection setupConnection(URL url) throws IOException {
- HttpURLConnection connection = super.setupConnection(url);
- connection.setAllowUserInteraction(false);
- connection.setDoInput(true);
- connection.setDoOutput(true);
- connection.setInstanceFollowRedirects(true);
- return connection;
- }
-
- @Override
- protected IFile handleTransfer(IProgressMonitor monitor, HttpURLConnection connection) throws Exception {
- IFile file = null;
- InputStream stream = null;
- try {
- int result = connection.getResponseCode();
- if (result == 200) {
- stream = (InputStream) connection.getContent();
- file = getLocalStorageIFile();
- file.create(stream, true, monitor);
- monitor.setTaskName("File Transfer Complete.");
- }
- } finally {
- if (stream != null) {
- stream.close();
- }
- }
- return file;
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class RemoteResourceRequestOperation extends AbstractRemoteResourceRequestTemplate { + private static final String STORAGE_PATH = "TEMP"; + private String fileName; + + public RemoteResourceRequestOperation(String tempFolderName, String remoteRequestUrl, String fileName) { + super(STORAGE_PATH, remoteRequestUrl); + this.fileName = fileName; + } + + @Override + protected String getLocalStorageName() throws Exception { + StringBuilder builder = new StringBuilder(); + builder.append(getTempFolderName()); + builder.append(File.separator); + builder.append(fileName); + return builder.toString(); + } + + @Override + protected String getRemoteFileName() { + return fileName; + } + + protected HttpURLConnection setupConnection(URL url) throws IOException { + HttpURLConnection connection = super.setupConnection(url); + connection.setAllowUserInteraction(false); + connection.setDoInput(true); + connection.setDoOutput(true); + connection.setInstanceFollowRedirects(true); + return connection; + } + + @Override + protected IFile handleTransfer(IProgressMonitor monitor, HttpURLConnection connection) throws Exception { + IFile file = null; + InputStream stream = null; + try { + int result = connection.getResponseCode(); + if (result == 200) { + stream = (InputStream) connection.getContent(); + file = getLocalStorageIFile(); + file.create(stream, true, monitor); + monitor.setTaskName("File Transfer Complete."); + } + } finally { + if (stream != null) { + stream.close(); + } + } + return file; + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/BaseOutfileParser.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/BaseOutfileParser.java index 7e2d35dff5c..571aeb3ffc3 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/BaseOutfileParser.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/BaseOutfileParser.java @@ -1,71 +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.define.parser;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class BaseOutfileParser {
- private Set<IDataListener> listeners;
-
- public BaseOutfileParser() {
- this.listeners = new HashSet<IDataListener>();
- }
-
- public void registerListener(IDataListener listener) {
- listeners.add(listener);
- }
-
- public void deregisterListener(IDataListener listener) {
- listeners.remove(listener);
- }
-
- protected Set<IDataListener> getDataListeners() {
- return listeners;
- }
-
- protected void notifyOnDataEvent(String name, String value) {
- for (IDataListener listener : listeners) {
- listener.notifyDataEvent(name, value);
- }
- }
-
- public final void execute(IProgressMonitor monitor, URL fileToParse) throws Exception {
- long time = System.currentTimeMillis();
- String file = new File(fileToParse.toURI()).getName();
- monitor.subTask(String.format("Parsing: [%s]", file));
- InputStream inputStream = null;
- try {
- inputStream = fileToParse.openStream();
- doParse(monitor, file, inputStream);
- } finally {
- try {
- if (inputStream != null) {
- inputStream.close();
- }
- } finally {
- long elapsedTime = System.currentTimeMillis() - time;
- monitor.subTask(String.format("Parsed: [%s] in [%d] ms", file, elapsedTime));
- }
- }
- }
-
- public abstract boolean isValidParser(URL fileToParse);
-
- protected abstract void doParse(IProgressMonitor monitor, String fileName, InputStream inputStream) throws Exception;
-}
+/******************************************************************************* + * 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.define.parser; + +import java.io.File; +import java.io.InputStream; +import java.net.URL; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * @author Roberto E. Escobar + */ +public abstract class BaseOutfileParser { + private Set<IDataListener> listeners; + + public BaseOutfileParser() { + this.listeners = new HashSet<IDataListener>(); + } + + public void registerListener(IDataListener listener) { + listeners.add(listener); + } + + public void deregisterListener(IDataListener listener) { + listeners.remove(listener); + } + + protected Set<IDataListener> getDataListeners() { + return listeners; + } + + protected void notifyOnDataEvent(String name, String value) { + for (IDataListener listener : listeners) { + listener.notifyDataEvent(name, value); + } + } + + public final void execute(IProgressMonitor monitor, URL fileToParse) throws Exception { + long time = System.currentTimeMillis(); + String file = new File(fileToParse.toURI()).getName(); + monitor.subTask(String.format("Parsing: [%s]", file)); + InputStream inputStream = null; + try { + inputStream = fileToParse.openStream(); + doParse(monitor, file, inputStream); + } finally { + try { + if (inputStream != null) { + inputStream.close(); + } + } finally { + long elapsedTime = System.currentTimeMillis() - time; + monitor.subTask(String.format("Parsed: [%s] in [%d] ms", file, elapsedTime)); + } + } + } + + public abstract boolean isValidParser(URL fileToParse); + + protected abstract void doParse(IProgressMonitor monitor, String fileName, InputStream inputStream) throws Exception; +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/CollectionParser.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/CollectionParser.java index f315582275c..cbaf4d47665 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/CollectionParser.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/CollectionParser.java @@ -8,41 +8,41 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser;
-
+package org.eclipse.osee.ote.define.parser; + import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.jdk.core.util.io.xml.AbstractSaxHandler; import org.xml.sax.Attributes; import org.xml.sax.SAXException; -
-public class CollectionParser extends AbstractSaxHandler implements ICollectionSource {
-
- private List<SaxChunkCollector> collectors;
-
- public CollectionParser(ArrayList<SaxChunkCollector> collectors) {
- this.collectors = collectors;
- }
-
- public CollectionParser() {
- collectors = new ArrayList<SaxChunkCollector>();
- }
-
- @Override
- public void endElementFound(String uri, String localName, String name) throws SAXException {
- for (SaxChunkCollector collector : collectors) {
- collector.endElementFound(localName, this);
- }
- }
-
- @Override
- public void startElementFound(String uri, String localName, String name, Attributes attributes) throws SAXException {
- for (SaxChunkCollector collector : collectors) {
- collector.startElementFound(localName, attributes, this);
- }
- }
-
- public List<SaxChunkCollector> getCollectors() {
- return collectors;
- }
-}
+ +public class CollectionParser extends AbstractSaxHandler implements ICollectionSource { + + private List<SaxChunkCollector> collectors; + + public CollectionParser(ArrayList<SaxChunkCollector> collectors) { + this.collectors = collectors; + } + + public CollectionParser() { + collectors = new ArrayList<SaxChunkCollector>(); + } + + @Override + public void endElementFound(String uri, String localName, String name) throws SAXException { + for (SaxChunkCollector collector : collectors) { + collector.endElementFound(localName, this); + } + } + + @Override + public void startElementFound(String uri, String localName, String name, Attributes attributes) throws SAXException { + for (SaxChunkCollector collector : collectors) { + collector.startElementFound(localName, attributes, this); + } + } + + public List<SaxChunkCollector> getCollectors() { + return collectors; + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ICollectionSource.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ICollectionSource.java index d775451716d..eb5543b734c 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ICollectionSource.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ICollectionSource.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser;
-
-public interface ICollectionSource {
- String getContents();
-}
+package org.eclipse.osee.ote.define.parser; + +public interface ICollectionSource { + String getContents(); +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/IDataListener.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/IDataListener.java index fb6cfb53eff..cdd3eb5a3df 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/IDataListener.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/IDataListener.java @@ -8,12 +8,12 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IDataListener {
-
- public void notifyDataEvent(String name, String value);
-}
+package org.eclipse.osee.ote.define.parser; + +/** + * @author Roberto E. Escobar + */ +public interface IDataListener { + + public void notifyDataEvent(String name, String value); +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ISaxElementHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ISaxElementHandler.java index 49ff36869ce..0ba4d2ebbcc 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ISaxElementHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ISaxElementHandler.java @@ -8,13 +8,13 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser;
-
-public interface ISaxElementHandler {
-
- public void processSaxChunkCollectorData(String currentLocalName, String xmlData);
-
- public void addListener(IDataListener listener);
-
- public void removeListener(IDataListener listener);
-}
+package org.eclipse.osee.ote.define.parser; + +public interface ISaxElementHandler { + + public void processSaxChunkCollectorData(String currentLocalName, String xmlData); + + public void addListener(IDataListener listener); + + public void removeListener(IDataListener listener); +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/SaxChunkCollector.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/SaxChunkCollector.java index a39f753a986..43adc5e5ff6 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/SaxChunkCollector.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/SaxChunkCollector.java @@ -8,82 +8,82 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser;
-
+package org.eclipse.osee.ote.define.parser; + import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.xml.sax.Attributes; -
-public class SaxChunkCollector {
-
- private Set<String> collectionElement;
- private int currentDepth = 0;
- private boolean isCollecting = false;
- private StringBuilder builder;
- private List<String> collectionChunks;
- private ISaxElementHandler handler;
- private String currentLocalName;
-
- public SaxChunkCollector(ISaxElementHandler handler, String... collect) {
- this.collectionElement = new HashSet<String>();
- for (String item : collect) {
- collectionElement.add(item);
- }
- this.handler = handler;
- collectionChunks = new ArrayList<String>();
- builder = new StringBuilder(5000);
- }
-
- /**
- * @param localName
- * @param collectionParser
- */
- public void endElementFound(String localName, ICollectionSource collectionSource) {
- if (isCollecting) {
- currentDepth--;
- builder.append(collectionSource.getContents());
- builder.append("</");
- builder.append(localName);
- builder.append(">");
- if (currentDepth < 1) {
- isCollecting = false;
- String data = builder.toString();
- collectionChunks.add(data);
- handler.processSaxChunkCollectorData(currentLocalName, data);
- builder.setLength(0);
- }
- }
- }
-
- public ISaxElementHandler getHandler() {
- return handler;
- }
-
- /**
- * @param localName
- * @param attributes
- * @param collectionParser
- */
- public void startElementFound(String localName, Attributes attributes, CollectionParser collectionParser) {
- if (collectionElement.contains(localName)) {
- isCollecting = true;
- currentLocalName = localName;
- }
-
- if (isCollecting) {
- currentDepth++;
- builder.append("<");
- builder.append(localName);
- for (int i = 0; i < attributes.getLength(); i++) {
- builder.append(" ");
- builder.append(attributes.getLocalName(i));
- builder.append("=\"");
- builder.append(attributes.getValue(i));
- builder.append("\"");
- }
- builder.append(" >");
- }
- }
-}
+ +public class SaxChunkCollector { + + private Set<String> collectionElement; + private int currentDepth = 0; + private boolean isCollecting = false; + private StringBuilder builder; + private List<String> collectionChunks; + private ISaxElementHandler handler; + private String currentLocalName; + + public SaxChunkCollector(ISaxElementHandler handler, String... collect) { + this.collectionElement = new HashSet<String>(); + for (String item : collect) { + collectionElement.add(item); + } + this.handler = handler; + collectionChunks = new ArrayList<String>(); + builder = new StringBuilder(5000); + } + + /** + * @param localName + * @param collectionParser + */ + public void endElementFound(String localName, ICollectionSource collectionSource) { + if (isCollecting) { + currentDepth--; + builder.append(collectionSource.getContents()); + builder.append("</"); + builder.append(localName); + builder.append(">"); + if (currentDepth < 1) { + isCollecting = false; + String data = builder.toString(); + collectionChunks.add(data); + handler.processSaxChunkCollectorData(currentLocalName, data); + builder.setLength(0); + } + } + } + + public ISaxElementHandler getHandler() { + return handler; + } + + /** + * @param localName + * @param attributes + * @param collectionParser + */ + public void startElementFound(String localName, Attributes attributes, CollectionParser collectionParser) { + if (collectionElement.contains(localName)) { + isCollecting = true; + currentLocalName = localName; + } + + if (isCollecting) { + currentDepth++; + builder.append("<"); + builder.append(localName); + for (int i = 0; i < attributes.getLength(); i++) { + builder.append(" "); + builder.append(attributes.getLocalName(i)); + builder.append("=\""); + builder.append(attributes.getValue(i)); + builder.append("\""); + } + builder.append(" >"); + } + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/AbstractParseHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/AbstractParseHandler.java index 28cf8b44ba6..c1193546df8 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/AbstractParseHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/AbstractParseHandler.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -21,46 +21,46 @@ import org.eclipse.osee.ote.define.parser.IDataListener; import org.eclipse.osee.ote.define.parser.ISaxElementHandler; import org.w3c.dom.Document; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractParseHandler implements ISaxElementHandler {
- private Set<IDataListener> listeners;
-
- protected AbstractParseHandler() {
- this.listeners = Collections.synchronizedSet(new HashSet<IDataListener>());
- }
-
- public void addListener(IDataListener listener) {
- if (!listeners.contains(listener)) {
- listeners.add(listener);
- }
- }
-
- public void removeListener(IDataListener listener) {
- if (listeners.contains(listener)) {
- listeners.remove(listener);
- }
- }
-
- public void notifyOnDataEvent(String name, String value) {
- for (final IDataListener listener : listeners) {
- listener.notifyDataEvent(name, value);
- }
- }
-
- public void processSaxChunkCollectorData(String currentLocalName, String xmlData) {
- try {
- Document doc = Jaxp.readXmlDocument(xmlData);
- Element root = doc.getDocumentElement();
- if (root != null) {
- processSaxChunk(root);
- }
- } catch (Exception ex) {
- OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex);
- }
- }
-
- protected abstract void processSaxChunk(Element element);
-}
+ +/** + * @author Roberto E. Escobar + */ +public abstract class AbstractParseHandler implements ISaxElementHandler { + private Set<IDataListener> listeners; + + protected AbstractParseHandler() { + this.listeners = Collections.synchronizedSet(new HashSet<IDataListener>()); + } + + public void addListener(IDataListener listener) { + if (!listeners.contains(listener)) { + listeners.add(listener); + } + } + + public void removeListener(IDataListener listener) { + if (listeners.contains(listener)) { + listeners.remove(listener); + } + } + + public void notifyOnDataEvent(String name, String value) { + for (final IDataListener listener : listeners) { + listener.notifyDataEvent(name, value); + } + } + + public void processSaxChunkCollectorData(String currentLocalName, String xmlData) { + try { + Document doc = Jaxp.readXmlDocument(xmlData); + Element root = doc.getDocumentElement(); + if (root != null) { + processSaxChunk(root); + } + } catch (Exception ex) { + OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex); + } + } + + protected abstract void processSaxChunk(Element element); +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ConfigHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ConfigHandler.java index c009e1422c7..729f0f91a75 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ConfigHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ConfigHandler.java @@ -8,32 +8,32 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class ConfigHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- Element user = Jaxp.getChildDirect(element, "User");
- if (user != null) {
- notifyOnDataEvent(TestRunField.USER_ID.toString(), user.getAttribute("id"));
- notifyOnDataEvent(TestRunField.USER_NAME.toString(), user.getAttribute("name"));
- }
- notifyOnDataEvent(TestRunField.SCRIPT_NAME.toString(), Jaxp.getChildTextTrim(element, "ScriptName"));
- Element versionElement = Jaxp.getChild(element, "ScriptVersion");
- if (versionElement != null) {
- notifyOnDataEvent(TestRunField.SCRIPT_REVISION.toString(), versionElement.getAttribute("revision"));
- notifyOnDataEvent(TestRunField.SCRIPT_MODIFIED_FLAG.toString(), versionElement.getAttribute("modifiedFlag"));
- notifyOnDataEvent(TestRunField.SCRIPT_LAST_AUTHOR.toString(), versionElement.getAttribute("lastAuthor"));
- notifyOnDataEvent(TestRunField.SCRIPT_LAST_MODIFIED.toString(), versionElement.getAttribute("lastModified"));
- notifyOnDataEvent(TestRunField.SCRIPT_URL.toString(), versionElement.getAttribute("url"));
- }
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class ConfigHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + Element user = Jaxp.getChildDirect(element, "User"); + if (user != null) { + notifyOnDataEvent(TestRunField.USER_ID.toString(), user.getAttribute("id")); + notifyOnDataEvent(TestRunField.USER_NAME.toString(), user.getAttribute("name")); + } + notifyOnDataEvent(TestRunField.SCRIPT_NAME.toString(), Jaxp.getChildTextTrim(element, "ScriptName")); + Element versionElement = Jaxp.getChild(element, "ScriptVersion"); + if (versionElement != null) { + notifyOnDataEvent(TestRunField.SCRIPT_REVISION.toString(), versionElement.getAttribute("revision")); + notifyOnDataEvent(TestRunField.SCRIPT_MODIFIED_FLAG.toString(), versionElement.getAttribute("modifiedFlag")); + notifyOnDataEvent(TestRunField.SCRIPT_LAST_AUTHOR.toString(), versionElement.getAttribute("lastAuthor")); + notifyOnDataEvent(TestRunField.SCRIPT_LAST_MODIFIED.toString(), versionElement.getAttribute("lastModified")); + notifyOnDataEvent(TestRunField.SCRIPT_URL.toString(), versionElement.getAttribute("url")); + } + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/CurrentProcessorHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/CurrentProcessorHandler.java index 0a37ab042eb..b4eb182ddf3 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/CurrentProcessorHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/CurrentProcessorHandler.java @@ -8,18 +8,18 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class CurrentProcessorHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- notifyOnDataEvent(TestRunField.PROCESSOR_ID.toString(), element.getAttribute("proc"));
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class CurrentProcessorHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + notifyOnDataEvent(TestRunField.PROCESSOR_ID.toString(), element.getAttribute("proc")); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/DemoInfoHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/DemoInfoHandler.java index 57e41fca417..b7bd1c69580 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/DemoInfoHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/DemoInfoHandler.java @@ -8,30 +8,30 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class DemoInfoHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- String formalityLevel = element.getAttribute("level");
- String buildId = element.getAttribute("buildId");
-
- if (Strings.isValid(formalityLevel) != true) {
- formalityLevel = "DEVELOPMENT";
- }
- notifyOnDataEvent(TestRunField.QUALIFICATION_LEVEL.toString(), formalityLevel.toUpperCase());
-
- if (Strings.isValid(buildId) != true) {
- buildId = "unknown";
- }
- notifyOnDataEvent(TestRunField.BUILD_ID.toString(), buildId);
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class DemoInfoHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + String formalityLevel = element.getAttribute("level"); + String buildId = element.getAttribute("buildId"); + + if (Strings.isValid(formalityLevel) != true) { + formalityLevel = "DEVELOPMENT"; + } + notifyOnDataEvent(TestRunField.QUALIFICATION_LEVEL.toString(), formalityLevel.toUpperCase()); + + if (Strings.isValid(buildId) != true) { + buildId = "unknown"; + } + notifyOnDataEvent(TestRunField.BUILD_ID.toString(), buildId); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ElapsedTimeHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ElapsedTimeHandler.java index 27a3d2408a1..647531976fa 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ElapsedTimeHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ElapsedTimeHandler.java @@ -8,31 +8,31 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class ElapsedTimeHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- /*
- * <RuntimeVersions> <Version>B3_V1_FTB1.PROPOSED.2007_08_28_14:12:23</Version>
- * <Version>VER1__13-September-2007_03:19:29</Version> </RuntimeVersions>
- *
- * <ElapsedTime elapsed="0:01:28" endDate="Thu Sep 13 15:50:24 MDT 2007" milliseconds="88768"
- * startDate="Thu Sep 13 15:48:55 MDT 2007"/> <TestPointResults fail="41" pass="167"
- * total="208"/>
- *
- */
- notifyOnDataEvent(TestRunField.SCRIPT_END_DATE.toString(), element.getAttribute("endDate"));
- notifyOnDataEvent(TestRunField.SCRIPT_START_DATE.toString(), element.getAttribute("startDate"));
- notifyOnDataEvent(TestRunField.SCRIPT_ELAPSED_TIME.toString(), element.getAttribute("elapsed"));
- // callback.addOverviewData("Time Info", String.format("Elapsed [ %s ] Start [ %s ] Stop [
- // %s ]", elapsed, startDate, endDate));
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class ElapsedTimeHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + /* + * <RuntimeVersions> <Version>B3_V1_FTB1.PROPOSED.2007_08_28_14:12:23</Version> + * <Version>VER1__13-September-2007_03:19:29</Version> </RuntimeVersions> + * + * <ElapsedTime elapsed="0:01:28" endDate="Thu Sep 13 15:50:24 MDT 2007" milliseconds="88768" + * startDate="Thu Sep 13 15:48:55 MDT 2007"/> <TestPointResults fail="41" pass="167" + * total="208"/> + * + */ + notifyOnDataEvent(TestRunField.SCRIPT_END_DATE.toString(), element.getAttribute("endDate")); + notifyOnDataEvent(TestRunField.SCRIPT_START_DATE.toString(), element.getAttribute("startDate")); + notifyOnDataEvent(TestRunField.SCRIPT_ELAPSED_TIME.toString(), element.getAttribute("elapsed")); + // callback.addOverviewData("Time Info", String.format("Elapsed [ %s ] Start [ %s ] Stop [ + // %s ]", elapsed, startDate, endDate)); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ExecutionStatusHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ExecutionStatusHandler.java index 7e26e1b8543..f56286e39a6 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ExecutionStatusHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ExecutionStatusHandler.java @@ -8,21 +8,21 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class ExecutionStatusHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_TIME.toString(), Jaxp.getChildText(element, "Time"));
- notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_RESULTS.toString(), Jaxp.getChildText(element, "ExecutionResult"));
- notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_ERRORS.toString(), Jaxp.getChildText(element, "ExecutionDetails"));
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class ExecutionStatusHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_TIME.toString(), Jaxp.getChildText(element, "Time")); + notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_RESULTS.toString(), Jaxp.getChildText(element, "ExecutionResult")); + notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_ERRORS.toString(), Jaxp.getChildText(element, "ExecutionDetails")); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/RuntimeVersionsHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/RuntimeVersionsHandler.java index bfbd9af1e3b..5fc7bc811e8 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/RuntimeVersionsHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/RuntimeVersionsHandler.java @@ -8,26 +8,26 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import java.util.List; import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class RuntimeVersionsHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- List<Element> versions = Jaxp.getChildDirects(element, "Version");
- StringBuilder sb = new StringBuilder();
- for (Element el : versions) {
- sb.append(Jaxp.getElementCharacterData(el));
- sb.append(" ");
- }
- notifyOnDataEvent(TestRunField.SYSTEM_OSEE_SERVER_JAR_VERSIONS.toString(), sb.toString());
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class RuntimeVersionsHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + List<Element> versions = Jaxp.getChildDirects(element, "Version"); + StringBuilder sb = new StringBuilder(); + for (Element el : versions) { + sb.append(Jaxp.getElementCharacterData(el)); + sb.append(" "); + } + notifyOnDataEvent(TestRunField.SYSTEM_OSEE_SERVER_JAR_VERSIONS.toString(), sb.toString()); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/SystemInfoHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/SystemInfoHandler.java index dc259120b1c..3e5a8d55313 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/SystemInfoHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/SystemInfoHandler.java @@ -8,27 +8,27 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class SystemInfoHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- /*
- * <RuntimeVersions> <Version>B3_V1_FTB1.PROPOSED.2007_08_28_14:12:23</Version>
- * <Version>VER1__13-September-2007_03:19:29</Version> </RuntimeVersions> <SystemInfo
- * osArch="i386" osName="Linux" osVersion="2.6.11.12" oseeVersion="Development"/>
- */
- notifyOnDataEvent(TestRunField.SYSTEM_OS_ARCH.toString(), element.getAttribute("osArch"));
- notifyOnDataEvent(TestRunField.SYSTEM_OS_NAME.toString(), element.getAttribute("osName"));
- notifyOnDataEvent(TestRunField.SYSTEM_OS_VERSION.toString(), element.getAttribute("osVersion"));
- notifyOnDataEvent(TestRunField.SYSTEM_OSEE_VERSION.toString(), element.getAttribute("oseeVersion"));
- notifyOnDataEvent(TestRunField.SYSTEM_OSEE_SERVER_TITLE.toString(), element.getAttribute("oseeServerTitle"));
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class SystemInfoHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + /* + * <RuntimeVersions> <Version>B3_V1_FTB1.PROPOSED.2007_08_28_14:12:23</Version> + * <Version>VER1__13-September-2007_03:19:29</Version> </RuntimeVersions> <SystemInfo + * osArch="i386" osName="Linux" osVersion="2.6.11.12" oseeVersion="Development"/> + */ + notifyOnDataEvent(TestRunField.SYSTEM_OS_ARCH.toString(), element.getAttribute("osArch")); + notifyOnDataEvent(TestRunField.SYSTEM_OS_NAME.toString(), element.getAttribute("osName")); + notifyOnDataEvent(TestRunField.SYSTEM_OS_VERSION.toString(), element.getAttribute("osVersion")); + notifyOnDataEvent(TestRunField.SYSTEM_OSEE_VERSION.toString(), element.getAttribute("oseeVersion")); + notifyOnDataEvent(TestRunField.SYSTEM_OSEE_SERVER_TITLE.toString(), element.getAttribute("oseeServerTitle")); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/TestPointResultsHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/TestPointResultsHandler.java index bfa14c6191a..f03c8bd8a1f 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/TestPointResultsHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/TestPointResultsHandler.java @@ -8,21 +8,21 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import org.eclipse.osee.ote.define.TestRunField; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class TestPointResultsHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- notifyOnDataEvent(TestRunField.TEST_POINTS_PASSED.toString(), element.getAttribute("pass"));
- notifyOnDataEvent(TestRunField.TEST_POINTS_FAILED.toString(), element.getAttribute("fail"));
- notifyOnDataEvent(TestRunField.TOTAL_TEST_POINTS.toString(), element.getAttribute("total"));
- notifyOnDataEvent(TestRunField.TEST_ABORT_STATUS.toString(), element.getAttribute("aborted"));
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class TestPointResultsHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + notifyOnDataEvent(TestRunField.TEST_POINTS_PASSED.toString(), element.getAttribute("pass")); + notifyOnDataEvent(TestRunField.TEST_POINTS_FAILED.toString(), element.getAttribute("fail")); + notifyOnDataEvent(TestRunField.TOTAL_TEST_POINTS.toString(), element.getAttribute("total")); + notifyOnDataEvent(TestRunField.TEST_ABORT_STATUS.toString(), element.getAttribute("aborted")); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/VersionInformationHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/VersionInformationHandler.java index 24df840b65d..6e263b8cd33 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/VersionInformationHandler.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/VersionInformationHandler.java @@ -8,27 +8,27 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.parser.handlers;
-
+package org.eclipse.osee.ote.define.parser.handlers; + import java.util.List; import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; import org.w3c.dom.Element; -
-/**
- * @author Roberto E. Escobar
- */
-public class VersionInformationHandler extends AbstractParseHandler {
-
- @Override
- protected void processSaxChunk(Element element) {
- List<Element> versions = Jaxp.getChildDirects(element, "Version");
- for (Element version : versions) {
- notifyOnDataEvent("name", version.getAttribute("name"));
- notifyOnDataEvent("underTest", version.getAttribute("underTest"));
- notifyOnDataEvent("version", version.getAttribute("version"));
- notifyOnDataEvent("versionUnit", version.getAttribute("versionUnit"));
- // item.getChildren().add(new BaseOutfileTreeItem(name, versionTitle,
- // String.format("unitId[%s] underTest[%s]", unit, underTest), null));
- }
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class VersionInformationHandler extends AbstractParseHandler { + + @Override + protected void processSaxChunk(Element element) { + List<Element> versions = Jaxp.getChildDirects(element, "Version"); + for (Element version : versions) { + notifyOnDataEvent("name", version.getAttribute("name")); + notifyOnDataEvent("underTest", version.getAttribute("underTest")); + notifyOnDataEvent("version", version.getAttribute("version")); + notifyOnDataEvent("versionUnit", version.getAttribute("versionUnit")); + // item.getChildren().add(new BaseOutfileTreeItem(name, versionTitle, + // String.format("unitId[%s] underTest[%s]", unit, underTest), null)); + } + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileParserExtensionManager.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileParserExtensionManager.java index 0b07132019a..c6383485684 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileParserExtensionManager.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileParserExtensionManager.java @@ -8,8 +8,8 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ote.define.utilities;
-
+package org.eclipse.osee.ote.define.utilities; + import java.lang.reflect.Method; import java.net.URL; import java.util.Collection; @@ -29,113 +29,113 @@ import org.eclipse.osee.framework.plugin.core.util.ExtensionPoints; import org.eclipse.osee.ote.define.OteDefinePlugin; import org.eclipse.osee.ote.define.parser.BaseOutfileParser; import org.osgi.framework.Bundle; -
-/**
- * @author Roberto E. Escobar
- */
-public class OutfileParserExtensionManager {
-
- private static final String OUTFILE_PARSER = "OutfileParser";
- private static final String CLASS_NAME = "classname";
- private static final String SUPPORTED_EXTENSIONS = "supportedExtensions";
- private final Map<String, BaseOutfileParser> contributions;
- private final HashCollection<String, BaseOutfileParser> extensionsToParsers;
-
- private static OutfileParserExtensionManager instance = null;
-
- private OutfileParserExtensionManager() {
- contributions = new HashMap<String, BaseOutfileParser>();
- extensionsToParsers = new HashCollection<String, BaseOutfileParser>(false, HashSet.class);
- }
-
- public static OutfileParserExtensionManager getInstance() {
- if (instance == null) {
- instance = new OutfileParserExtensionManager();
- }
- return instance;
- }
-
- public String[] getSupportedExtensions() throws OseeCoreException {
- checkObjectsLoaded();
- Set<String> set = extensionsToParsers.keySet();
- return set.toArray(new String[set.size()]);
- }
-
- public BaseOutfileParser getOutfileParserFor(URL fileToImport) throws OseeCoreException {
- checkObjectsLoaded();
- BaseOutfileParser toReturn = null;
- for (BaseOutfileParser parser : getOutfileParsers()) {
- if (parser.isValidParser(fileToImport)) {
- toReturn = parser;
- break;
- }
- }
- if (toReturn == null) {
- throw new OseeStateException(String.format("Unsupported outfile type [%s] no valid outfile parser found",
- fileToImport));
- }
- return toReturn;
- }
-
- public BaseOutfileParser getOutfileParserById(String id) throws OseeCoreException {
- checkObjectsLoaded();
- return contributions.get(id);
- }
-
- public Collection<BaseOutfileParser> getOutfileParsers() throws OseeCoreException {
- checkObjectsLoaded();
- return contributions.values();
- }
-
- private void checkObjectsLoaded() throws OseeCoreException {
- if (contributions.isEmpty()) {
- List<IConfigurationElement> elements =
- ExtensionPoints.getExtensionElements(OteDefinePlugin.PLUGIN_ID + "." + OUTFILE_PARSER, OUTFILE_PARSER);
- for (IConfigurationElement element : elements) {
- IExtension extension = ((IExtension) element.getParent());
- String identifier = extension.getUniqueIdentifier();
- String bundleName = element.getContributor().getName();
- String parserClassName = element.getAttribute(CLASS_NAME);
- String supportedExtensions = element.getAttribute(SUPPORTED_EXTENSIONS);
- Set<String> supportedSet = getSupportedExtensions(supportedExtensions);
- BaseOutfileParser parser = (BaseOutfileParser) loadClass(bundleName, parserClassName);
- if (parser != null) {
- contributions.put(identifier, parser);
- for (String extensionType : supportedSet) {
- extensionsToParsers.put(extensionType, parser);
- }
- }
- }
- }
- }
-
- private Set<String> getSupportedExtensions(String rawExtensions) {
- Set<String> toReturn = new HashSet<String>();
- for (String value : rawExtensions.split(";")) {
- value = value.trim();
- if (Strings.isValid(value)) {
- toReturn.add(value);
- }
- }
- return toReturn;
- }
-
- private Object loadClass(String bundleName, String className) throws OseeCoreException {
- Object object = null;
- if (Strings.isValid(bundleName) && Strings.isValid(className)) {
- try {
- Bundle bundle = Platform.getBundle(bundleName);
- Class<?> taskClass = bundle.loadClass(className);
- try {
- Method getInstance = taskClass.getMethod("getInstance", new Class[] {});
- object = getInstance.invoke(null, new Object[] {});
- } catch (Exception ex) {
- object = taskClass.newInstance();
- }
- } catch (Exception ex) {
- throw new OseeCoreException(String.format("Unable to Load: [%s - %s]", bundleName, className), ex);
- }
- }
- return object;
- }
-}
+ +/** + * @author Roberto E. Escobar + */ +public class OutfileParserExtensionManager { + + private static final String OUTFILE_PARSER = "OutfileParser"; + private static final String CLASS_NAME = "classname"; + private static final String SUPPORTED_EXTENSIONS = "supportedExtensions"; + private final Map<String, BaseOutfileParser> contributions; + private final HashCollection<String, BaseOutfileParser> extensionsToParsers; + + private static OutfileParserExtensionManager instance = null; + + private OutfileParserExtensionManager() { + contributions = new HashMap<String, BaseOutfileParser>(); + extensionsToParsers = new HashCollection<String, BaseOutfileParser>(false, HashSet.class); + } + + public static OutfileParserExtensionManager getInstance() { + if (instance == null) { + instance = new OutfileParserExtensionManager(); + } + return instance; + } + + public String[] getSupportedExtensions() throws OseeCoreException { + checkObjectsLoaded(); + Set<String> set = extensionsToParsers.keySet(); + return set.toArray(new String[set.size()]); + } + + public BaseOutfileParser getOutfileParserFor(URL fileToImport) throws OseeCoreException { + checkObjectsLoaded(); + BaseOutfileParser toReturn = null; + for (BaseOutfileParser parser : getOutfileParsers()) { + if (parser.isValidParser(fileToImport)) { + toReturn = parser; + break; + } + } + if (toReturn == null) { + throw new OseeStateException(String.format("Unsupported outfile type [%s] no valid outfile parser found", + fileToImport)); + } + return toReturn; + } + + public BaseOutfileParser getOutfileParserById(String id) throws OseeCoreException { + checkObjectsLoaded(); + return contributions.get(id); + } + + public Collection<BaseOutfileParser> getOutfileParsers() throws OseeCoreException { + checkObjectsLoaded(); + return contributions.values(); + } + + private void checkObjectsLoaded() throws OseeCoreException { + if (contributions.isEmpty()) { + List<IConfigurationElement> elements = + ExtensionPoints.getExtensionElements(OteDefinePlugin.PLUGIN_ID + "." + OUTFILE_PARSER, OUTFILE_PARSER); + for (IConfigurationElement element : elements) { + IExtension extension = ((IExtension) element.getParent()); + String identifier = extension.getUniqueIdentifier(); + String bundleName = element.getContributor().getName(); + String parserClassName = element.getAttribute(CLASS_NAME); + String supportedExtensions = element.getAttribute(SUPPORTED_EXTENSIONS); + Set<String> supportedSet = getSupportedExtensions(supportedExtensions); + BaseOutfileParser parser = (BaseOutfileParser) loadClass(bundleName, parserClassName); + if (parser != null) { + contributions.put(identifier, parser); + for (String extensionType : supportedSet) { + extensionsToParsers.put(extensionType, parser); + } + } + } + } + } + + private Set<String> getSupportedExtensions(String rawExtensions) { + Set<String> toReturn = new HashSet<String>(); + for (String value : rawExtensions.split(";")) { + value = value.trim(); + if (Strings.isValid(value)) { + toReturn.add(value); + } + } + return toReturn; + } + + private Object loadClass(String bundleName, String className) throws OseeCoreException { + Object object = null; + if (Strings.isValid(bundleName) && Strings.isValid(className)) { + try { + Bundle bundle = Platform.getBundle(bundleName); + Class<?> taskClass = bundle.loadClass(className); + try { + Method getInstance = taskClass.getMethod("getInstance", new Class[] {}); + object = getInstance.invoke(null, new Object[] {}); + } catch (Exception ex) { + object = taskClass.newInstance(); + } + } catch (Exception ex) { + throw new OseeCoreException(String.format("Unable to Load: [%s - %s]", bundleName, className), ex); + } + } + return object; + } +} |