Package org.eclipse.emf.ecore.resource

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


    ResourceSet resourceSet = DataObjectUtil.createResourceSet();
    URI ecoreURI = URI.createURI("file:///temp.ecore");
    URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");

    Resource ecoreResource = resourceSet.createResource(ecoreURI);
    ecoreResource.getContents().add(ePackage);

    Resource genModelResource = resourceSet.createResource(genModelURI);
    genModelResource.getContents().add(genModel);
View Full Code Here


    URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");

    Resource ecoreResource = resourceSet.createResource(ecoreURI);
    ecoreResource.getContents().add(ePackage);

    Resource genModelResource = resourceSet.createResource(genModelURI);
    genModelResource.getContents().add(genModel);

    generateFromGenModel(genModel, targetDirectory, genOptions);
  }
View Full Code Here

          e.printStackTrace();
        }
      }
    }
 
    resource = (XMLResource)resourceSet.createResource(URI.createURI("http:///temp.xml"));
    DataObjectUtil.configureXMLResource(resource, extendedMetaData);
  }

  protected XMLDocumentImpl(ExtendedMetaData extendedMetaData)
  {
View Full Code Here

      int length = objectInput.readInt();
      byte [] bytes = new byte [length];
      objectInput.readFully(bytes);

      ResourceSet resourceSet = createResourceSet();
      Resource resource = resourceSet.createResource(URI.createURI("all.datagraph"));
      resource.load(new ByteArrayInputStream(bytes), null);
      eDataGraph = (DataGraphImpl)resource.getContents().get(0);
    }

    protected ResourceSet createResourceSet()
View Full Code Here

   * @throws IOException
   */
  public static DataGraph loadDataGraph(InputStream inputStream, Map options) throws IOException
  {
    ResourceSet resourceSet = DataObjectUtil.createResourceSet();
    Resource resource = resourceSet.createResource(URI.createURI("all.datagraph"));
    resource.load(inputStream, options);
    return (DataGraph)resource.getContents().get(0);
  }
 
  /**
 
View Full Code Here

    for (Iterator iterator = packages.iterator(); iterator.hasNext(); ) {
      EPackage typePackage = (EPackage)iterator.next();
      Resource resource = typePackage.eResource();
      if (resource == null) {
        resource = resourceSet.createResource(URI.createURI(".ecore"));
        resource.setURI(URI.createURI(typePackage.getNsURI()));
        resource.getContents().add(typePackage);
      }
      else if (resource.getResourceSet() != resourceSet)
        resourceSet.getResources().add(resource);
View Full Code Here

  protected List /*Type*/define(InputSource inputSource, String schemaLocation)
  {
    try
    {
      ResourceSet resourceSet = DataObjectUtil.createResourceSet();
      Resource model = resourceSet.createResource(URI.createURI(schemaLocation != null ? schemaLocation : "null.xsd"));
      ((XSDResourceImpl)model).load(inputSource, null);
     
      List newTypes = new ArrayList();
      for (Iterator schemaIter = model.getContents().iterator(); schemaIter.hasNext(); )
      {
View Full Code Here

        // let us make the new file to write out
        File destFile = new File(dest);
        String absoluteDestPath = destFile.getAbsolutePath();

        URI destURI = URI.createFileURI(absoluteDestPath);
        Resource destResource = resourceSet.createResource(destURI);

        Collection<EObject> collection = new ArrayList<EObject>();
        for( Resource curResource : resources ) {
            collection.addAll(curResource.getContents());
        }
View Full Code Here

            URI registryURI = registryResource.getURI();
            projectURI.deresolve(registryURI, true, true, true);

            ResourceSet registeryResourceSet = registryResource.getResourceSet();
            Resource projectResource = registeryResourceSet.createResource(projectURI);
            try {
                projectResource.load(null);
            } catch (IOException e1) {
                // resource doesn't exist. That is ok.
            }
View Full Code Here

            ResourceSet resourceSet = new ResourceSetImpl();
            resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
                .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new Bpmn2ResourceFactoryImpl());
            resourceSet.getPackageRegistry().put("http://www.omg.org/spec/BPMN/20100524/MODEL", Bpmn2Package.eINSTANCE);
            Resource resource = resourceSet.createResource(URI.createURI("inputStream://dummyUriWithValidSuffix.xml"));
            InputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
            resource.load(is, Collections.EMPTY_MAP);
            resource.load(Collections.EMPTY_MAP);
            return ((DocumentRoot) resource.getContents().get(0)).getDefinitions();
        } catch (Throwable t) {
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.