Package org.eclipse.emf.ecore.resource

Examples of org.eclipse.emf.ecore.resource.ResourceSet.createResource()


                revisitNodeNames(def);

                // get the xml from Definitions
                ResourceSet rSet = new ResourceSetImpl();
                rSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("bpmn2", new JBPMBpmn2ResourceFactoryImpl());
                JBPMBpmn2ResourceImpl bpmn2resource = (JBPMBpmn2ResourceImpl) rSet.createResource(URI.createURI("virtual.bpmn2"));
                rSet.getResources().add(bpmn2resource);
                bpmn2resource.getContents().add(def);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                bpmn2resource.save(outputStream, new HashMap<Object, Object>());
                String fullXmlModel =  outputStream.toString();
View Full Code Here



                // get the xml from Definitions
                ResourceSet rSet = new ResourceSetImpl();
                rSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("bpmn2", new JBPMBpmn2ResourceFactoryImpl());
                JBPMBpmn2ResourceImpl bpmn2resource = (JBPMBpmn2ResourceImpl) rSet.createResource(URI.createURI("virtual.bpmn2"));
                bpmn2resource.getDefaultLoadOptions().put(JBPMBpmn2ResourceImpl.OPTION_ENCODING, "UTF-8");
                bpmn2resource.getDefaultLoadOptions().put(JBPMBpmn2ResourceImpl.OPTION_DEFER_IDREF_RESOLUTION, true);
                bpmn2resource.getDefaultLoadOptions().put( JBPMBpmn2ResourceImpl.OPTION_DISABLE_NOTIFY, true );
                bpmn2resource.getDefaultLoadOptions().put(JBPMBpmn2ResourceImpl.OPTION_PROCESS_DANGLING_HREF, JBPMBpmn2ResourceImpl.OPTION_PROCESS_DANGLING_HREF_RECORD);
                bpmn2resource.setEncoding("UTF-8");
View Full Code Here

        try {
            parser.nextToken(); // open the object
            ResourceSet rSet = new ResourceSetImpl();
            rSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("bpmn2",
                    new JBPMBpmn2ResourceFactoryImpl());
            Bpmn2Resource bpmn2 = (Bpmn2Resource) rSet.createResource(URI.createURI("virtual.bpmn2"));
            rSet.getResources().add(bpmn2);
            _currentResource = bpmn2;

            if(preProcessingData == null || preProcessingData.length() < 1) {
                preProcessingData = "ReadOnlyService";
View Full Code Here

   * @throws IOException if something goes wrong.
   */
  public XtextResource createResource(URI uri, String contents) throws IOException {
    // TODO get project from URI.
    ResourceSet resourceSet = resourceSetProvider.get(projects.activeProject());
    XtextResource resource = (XtextResource) resourceSet.createResource(uri, UNSPECIFIED_CONTENT_TYPE);
    resource.load(new StringInputStream(contents), singletonMap(OPTION_ENCODING, UTF_8));
    resolveLazyCrossReferences(resource, NullImpl);
    return resource;
  }
}
View Full Code Here

    super.setUp();

    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
        .put("library", new XMLResourceFactoryImpl());
    Resource resource = resourceSet.createResource(URI
        .createURI("test.library"));

    // create a library with three books and two writers
    fixture = LibraryFactory.eINSTANCE.createLibrary();
    fixture.setName("Test Library");
View Full Code Here

    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry()
        .getExtensionToFactoryMap()
        .put("library", new ResourceFactoryImpl());
    Resource resource = resourceSet.createResource(URI.createURI("test.library"));

    // create a library with three books and two writers
    fixture = LibraryFactory.eINSTANCE.createLibrary();
    fixture.setName("Test Library");
    resource.getContents().add(fixture);
View Full Code Here

    // based on generated IamlInitDiagramFileAction#run
    ResourceSet resourceSet = new ResourceSetImpl();
    URI sourceModelURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), false);
    URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), false);
    final Resource modelResource = resourceSet.getResource(sourceModelURI, true);
    final Resource diagramResource = resourceSet.createResource(diagramModelURI);
    final EObject modelRoot = (EObject) modelResource.getContents().get(0);
   
    List<Object> affectedFiles = new LinkedList<Object>();
    affectedFiles.add(diagramFile);
    TransactionalEditingDomain myEditingDomain = GMFEditingDomainFactory.INSTANCE
View Full Code Here

   
    ResourceSet resourceSet = new ResourceSetImpl();
    File modelFile = new File("test.modeldoc");
        URI fileURI = URI.createFileURI(modelFile
                .getAbsolutePath());
        Resource resource = resourceSet.createResource(fileURI);
        resource.getContents().add(root);
        resource.save(Collections.EMPTY_MAP);
     
    // generate code
    ModeldocCodeGenerator codegen = new ModeldocCodeGenerator();
View Full Code Here

    {
      ResourceSet resourceSet = new ResourceSetImpl();
          URI fileURI = URI.createFileURI(new File("test.modeldoc")
                  .getAbsolutePath());
          Resource resource = resourceSet.createResource(fileURI);
          resource.getContents().add(c);
          resource.save(Collections.EMPTY_MAP);
    }
       
        // try loading it!
View Full Code Here

   */
  public InternetApplication createNewInternetApplication(File file) {

    ResourceSet resourceSet = new ResourceSetImpl();
    URI uri = URI.createFileURI(file.getAbsolutePath());
    Resource resource = resourceSet.createResource(uri);
    assertNotNull(resource);
    assertEquals("The new model should be empty.", 0, resource.getContents().size());

    // create a new object
    InternetApplication a = ModelFactory.eINSTANCE.createInternetApplication();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.