Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-08-05 03:44:24 +0000
committerrescobar2010-08-05 03:44:24 +0000
commit727be9a143d157ef3a90feed01b5d86a2c9bf0f9 (patch)
tree0b75cbf25da804289f7e9ae2f6a487ae6f1c4d70 /plugins/org.eclipse.osee.framework.core.dsl.integration
parentf21c3ec19a963e1d794924a00690f43588014f4b (diff)
downloadorg.eclipse.osee-727be9a143d157ef3a90feed01b5d86a2c9bf0f9.tar.gz
org.eclipse.osee-727be9a143d157ef3a90feed01b5d86a2c9bf0f9.tar.xz
org.eclipse.osee-727be9a143d157ef3a90feed01b5d86a2c9bf0f9.zip
"Team Workflow" - YGHW1 - "Block changes to requirements unless done under an appropriate action."
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.dsl.integration')
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java1
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java1
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactInstanceRestrictionHandler.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandler.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandler.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/RelationTypeRestrictionHandler.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtil.java (renamed from plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/ModelUtil.java)97
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeUtil.java (renamed from plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeUtil.java)2
10 files changed, 29 insertions, 87 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF
index 947787b0f7..b228dba636 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF
@@ -31,4 +31,5 @@ Require-Bundle: org.eclipse.osee.framework.core.dsl,
org.eclipse.xtext
Eclipse-ExtensibleAPI: true
Bundle-Activator: org.eclipse.osee.framework.core.dsl.integration.internal.Activator
-Export-Package: org.eclipse.osee.framework.core.dsl.integration
+Export-Package: org.eclipse.osee.framework.core.dsl.integration,
+ org.eclipse.osee.framework.core.dsl.integration.util
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java
index 5817833ccf..c77ba196fc 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java
@@ -17,6 +17,7 @@ import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.dsl.integration.internal.Activator;
+import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory;
import org.eclipse.osee.framework.core.dsl.oseeDsl.RelationMultiplicityEnum;
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java
index 05b05de900..5bf515dcb3 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java
@@ -19,6 +19,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.dsl.integration.internal.Activator;
+import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.oseeDsl.AddEnum;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory;
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactInstanceRestrictionHandler.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactInstanceRestrictionHandler.java
index 06033f74e3..b5e250bb4d 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactInstanceRestrictionHandler.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactInstanceRestrictionHandler.java
@@ -11,7 +11,7 @@
package org.eclipse.osee.framework.core.dsl.integration.internal;
import org.eclipse.osee.framework.core.dsl.integration.ArtifactDataProvider.ArtifactData;
-import org.eclipse.osee.framework.core.dsl.integration.OseeUtil;
+import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.integration.RestrictionHandler;
import org.eclipse.osee.framework.core.dsl.oseeDsl.ArtifactInstanceRestriction;
import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction;
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandler.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandler.java
index 6a8aa88191..11a7bf6d0f 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandler.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandler.java
@@ -12,7 +12,7 @@ package org.eclipse.osee.framework.core.dsl.integration.internal;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.dsl.integration.ArtifactDataProvider.ArtifactData;
-import org.eclipse.osee.framework.core.dsl.integration.OseeUtil;
+import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.integration.RestrictionHandler;
import org.eclipse.osee.framework.core.dsl.oseeDsl.ArtifactTypeRestriction;
import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction;
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandler.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandler.java
index 4a224f5c21..f9606dda3f 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandler.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandler.java
@@ -13,7 +13,7 @@ package org.eclipse.osee.framework.core.dsl.integration.internal;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.dsl.integration.ArtifactDataProvider.ArtifactData;
-import org.eclipse.osee.framework.core.dsl.integration.OseeUtil;
+import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.integration.RestrictionHandler;
import org.eclipse.osee.framework.core.dsl.oseeDsl.AttributeTypeRestriction;
import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction;
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java
index 195a4907ae..c40364dd39 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java
@@ -20,10 +20,10 @@ import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot;
import org.eclipse.emf.compare.diff.metamodel.DiffFactory;
import org.eclipse.osee.framework.core.dsl.integration.CreateOseeTypeChangesReportOperation;
import org.eclipse.osee.framework.core.dsl.integration.EMFCompareOperation;
-import org.eclipse.osee.framework.core.dsl.integration.ModelUtil;
import org.eclipse.osee.framework.core.dsl.integration.OseeToXtextOperation;
import org.eclipse.osee.framework.core.dsl.integration.OseeTypeCache;
import org.eclipse.osee.framework.core.dsl.integration.XTextToOseeTypeOperation;
+import org.eclipse.osee.framework.core.dsl.integration.util.ModelUtil;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -127,7 +127,7 @@ public class OseeModelingServiceImpl implements IOseeModelingService {
if (request.isCreateCompareReport()) {
response.setComparisonSnapshotModelName("osee_compare.diff");
String modelString =
- ModelUtil.modelToString(comparisonSnapshot, "osee:/osee_compare.diff",
+ ModelUtil.modelToStringXML(comparisonSnapshot, "osee:/osee_compare.diff",
Collections.<String, Boolean> emptyMap());
response.setComparisonSnapshotModel(modelString);
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/RelationTypeRestrictionHandler.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/RelationTypeRestrictionHandler.java
index bcf7cac249..08946395b7 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/RelationTypeRestrictionHandler.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/RelationTypeRestrictionHandler.java
@@ -13,7 +13,7 @@ package org.eclipse.osee.framework.core.dsl.integration.internal;
import java.util.Collection;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.dsl.integration.ArtifactDataProvider.ArtifactData;
-import org.eclipse.osee.framework.core.dsl.integration.OseeUtil;
+import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.integration.RestrictionHandler;
import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction;
import org.eclipse.osee.framework.core.dsl.oseeDsl.RelationTypeRestriction;
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/ModelUtil.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtil.java
index df1a5314a3..0cc7184506 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/ModelUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtil.java
@@ -8,12 +8,11 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.dsl.integration;
+package org.eclipse.osee.framework.core.dsl.integration.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
@@ -45,34 +44,13 @@ public final class ModelUtil {
// Utility Class
}
- // private void loadDependencies(OseeTypeModel baseModel, List<OseeTypeModel> models) throws OseeCoreException, URISyntaxException {
- // // This is commented out cause we're using a combined file. Once combined files
- // // are no longer generated, this should be uncommented.
- // // for (Import dependant : baseModel.getImports()) {
- // // OseeTypeModel childModel = OseeTypeModelUtil.loadModel(context, new URI(dependant.getImportURI()));
- // // loadDependencies(childModel, models);
- // // System.out.println("depends on: " + dependant.getImportURI());
- // // }
- // // System.out.println("Added on: " + baseModel.eResource().getURI());
- // models.add(baseModel);
- //
- // }
-
- // OseeTypeModel targetModel = null;
- // try {
- // targetModel = OseeTypeModelUtil.loadModel(context, resource);
- // } catch (OseeCoreException ex) {
- // throw new OseeWrappedException(String.format("Error loading: [%s]", resource), ex);
- // }
- // loadDependencies(targetModel, models);
-
public static OseeDsl loadModel(String uri, String xTextData) throws OseeCoreException {
try {
OseeDslStandaloneSetup setup = new OseeDslStandaloneSetup();
Injector injector = setup.createInjectorAndDoEMFRegistration();
XtextResourceSet set = injector.getInstance(XtextResourceSet.class);
- set.setClasspathURIContext(ModelUtil.class);
+ // set.setClasspathURIContext(ModelUtil.class);
set.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
Resource resource = set.createResource(URI.createURI(uri));
@@ -87,57 +65,6 @@ public final class ModelUtil {
}
}
- public static OseeDsl loadModel(InputStream inputStream, boolean isZipped) throws OseeCoreException {
- Injector injector = new OseeDslStandaloneSetup().createInjectorAndDoEMFRegistration();
- XtextResource resource = injector.getInstance(XtextResource.class);
-
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
- if (isZipped) {
- options.put(Resource.OPTION_ZIP, Boolean.TRUE);
- }
- try {
- resource.setURI(URI.createURI("http://www.eclipse.org/osee/framework/OseeTypes"));
- resource.load(inputStream, options);
- } catch (IOException ex) {
- throw new OseeWrappedException(ex);
- }
- OseeDsl model = (OseeDsl) resource.getContents().get(0);
- for (Diagnostic diagnostic : resource.getErrors()) {
- throw new OseeStateException(diagnostic.toString());
- }
- return model;
- }
-
- public static OseeDsl loadModel(Object context, java.net.URI target) throws OseeCoreException {
- String uri = target.toASCIIString();
- Injector injector = new OseeDslStandaloneSetup().createInjectorAndDoEMFRegistration();
- XtextResourceSet set = injector.getInstance(XtextResourceSet.class);
-
- set.setClasspathURIContext(context);
- set.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
-
- Resource resource = set.getResource(URI.createURI(uri), true);
- OseeDsl model = (OseeDsl) resource.getContents().get(0);
- for (Diagnostic diagnostic : resource.getErrors()) {
- throw new OseeStateException(diagnostic.toString());
- }
- return model;
- }
-
- public static void saveModel(java.net.URI uri, OseeDsl model) throws IOException {
- OseeDslStandaloneSetup.doSetup();
-
- ResourceSet resourceSet = new ResourceSetImpl();
- Resource resource = resourceSet.createResource(URI.createURI(uri.toASCIIString()));
- resource.getContents().add(model);
-
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- // options.put(XtextResource.OPTION_FORMAT, Boolean.TRUE);
- SaveOptions saveOptions = SaveOptions.getOptions(options);
- resource.save(saveOptions.toOptionsMap());
- }
-
public static void saveModel(OseeDsl model, String uri, OutputStream outputStream, boolean isZipped) throws IOException {
OseeDslStandaloneSetup.doSetup();
@@ -154,8 +81,7 @@ public final class ModelUtil {
resource.save(outputStream, saveOptions.toOptionsMap());
}
- private static void storeModel(OutputStream outputStream, EObject object, String uri, Map<String, Boolean> options) throws OseeCoreException {
- Resource resource = new XMLResourceImpl();
+ private static void storeModel(Resource resource, OutputStream outputStream, EObject object, String uri, Map<String, Boolean> options) throws OseeCoreException {
try {
resource.setURI(URI.createURI(uri));
resource.getContents().add(object);
@@ -165,9 +91,22 @@ public final class ModelUtil {
}
}
- public static String modelToString(EObject object, String uri, Map<String, Boolean> options) throws OseeCoreException {
+ public static String modelToStringXML(EObject object, String uri, Map<String, Boolean> options) throws OseeCoreException {
+ return modelToString(new XMLResourceImpl(), object, uri, options);
+ }
+
+ public static String modelToStringXText(EObject object, String uri, Map<String, Boolean> options) throws OseeCoreException {
+ OseeDslStandaloneSetup setup = new OseeDslStandaloneSetup();
+ Injector injector = setup.createInjectorAndDoEMFRegistration();
+ Resource resource = injector.getInstance(XtextResource.class);
+ Map<String, Boolean> options2 = new HashMap<String, Boolean>();
+ options2.put(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
+ return modelToString(resource, object, uri, options2);
+ }
+
+ private static String modelToString(Resource resource, EObject object, String uri, Map<String, Boolean> options) throws OseeCoreException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- storeModel(outputStream, object, uri, options);
+ storeModel(resource, outputStream, object, uri, options);
try {
return outputStream.toString("UTF-8");
} catch (UnsupportedEncodingException ex) {
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeUtil.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeUtil.java
index 87694b2264..764879f6d9 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeUtil.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.dsl.integration;
+package org.eclipse.osee.framework.core.dsl.integration.util;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;

Back to the top