Example #1
0
 public static URI getPivotURI(URI uri) {
   String oldScheme = uri.scheme();
   if (oldScheme == null) {
     oldScheme = "null";
   }
   String[] oldSegments = uri.segments();
   String[] newSegments = new String[oldSegments.length + 1];
   newSegments[0] = oldScheme;
   System.arraycopy(oldSegments, 0, newSegments, 1, oldSegments.length);
   URI pivotURI =
       URI.createHierarchicalURI(
           SCHEME_PIVOT, uri.authority(), uri.device(), newSegments, uri.query(), uri.fragment());
   return pivotURI;
 }
Example #2
0
 public static URI getNonPivotURI(URI uri) {
   assert isPivotURI(uri);
   String[] oldSegments = uri.segments();
   String[] newSegments = new String[oldSegments.length - 1];
   newSegments[0] = uri.scheme();
   System.arraycopy(oldSegments, 1, newSegments, 0, oldSegments.length - 1);
   URI pivotURI =
       URI.createHierarchicalURI(
           oldSegments[0],
           uri.authority(),
           uri.device(),
           newSegments,
           uri.query(),
           uri.fragment());
   return pivotURI;
 }
Example #3
0
  public QvtOperationalModuleEnv defineLibrary(
      Library lib, Map<String, List<EOperation>> definedOperations)
      throws LibraryCreationException {
    org.eclipse.m2m.internal.qvt.oml.expressions.Library libModule =
        QvtOperationalStdLibrary.createLibrary(lib.getId());
    // FIXME - set isBlackBox=TRUE, as soon is it gets into the AST metamodel

    QvtOperationalModuleEnv libEnv = initLibEnvironment(lib, libModule);
    URI libUri =
        URI.createHierarchicalURI(
            BlackboxUnitDescriptor.URI_QVTO_SCHEME,
            BlackboxUnitDescriptor.URI_BLACKBOX_AUTHORITY,
            null,
            new String[] {lib.getId()},
            null,
            null);
    libModule.eResource().setURI(libUri);

    org.eclipse.m2m.internal.qvt.oml.expressions.Library opModule =
        QvtOperationalStdLibrary.createLibrary(lib.getId());
    QvtOperationalModuleEnv opEnv = initLibEnvironment(lib, opModule);

    for (LibraryOperation libOp : lib.getLibraryOperations()) {
      Helper helper = defineOperation(opModule, opEnv, libOp);

      libEnv.defineImperativeOperation(helper, false, true);

      List<EOperation> listOp = definedOperations.get(helper.getName());
      if (listOp == null) {
        listOp = new LinkedList<EOperation>();
        definedOperations.put(helper.getName(), listOp);
      }
      listOp.add(helper);
    }

    // FIXME - workaround to make Environment available with the module
    ASTBindingHelper.createCST2ASTBinding(
        CSTFactory.eINSTANCE.createLibraryCS(), libEnv.getModuleContextType(), libEnv);
    return libEnv;
  }
  @Before
  public void before() throws IOException, URISyntaxException {
    // Get SDR location within our bundle
    Bundle bundle = Platform.getBundle("gov.redhawk.diagram.tests");
    java.net.URL sdrDomURL = bundle.getEntry("sdr/dom");
    File sdrDomDir = new File(FileLocator.resolve(sdrDomURL).toURI());

    // Load SAD
    ResourceSet resourceSet = ScaResourceFactoryUtil.createResourceSet();
    String query =
        QueryParser.createQuery(
            Collections.singletonMap(
                ScaFileSystemConstants.QUERY_PARAM_FS, "file://" + sdrDomDir.toString()));
    URI sadURI =
        URI.createHierarchicalURI(
            ScaFileSystemConstants.SCHEME,
            null,
            null,
            new Path("/waveforms/InterfacesUtil/InterfacesUtil.sad.xml").segments(),
            query,
            SoftwareAssembly.EOBJECT_PATH);
    this.sad = (SoftwareAssembly) resourceSet.getEObject(sadURI, true);
  }