Examples of ResourceSetImpl


Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

   * @param filename the filename to save to, e.g. <code>foo.iaml</code>
   * @return
   * @throws IOException
   */
  protected File saveToFile(EObject model, String filename) throws IOException {
    ResourceSet resourceSet = new ResourceSetImpl();
    File modelFile = new File(filename);
        URI fileURI = URI.createFileURI(modelFile
                .getAbsolutePath());
        Resource resource = resourceSet.createResource(fileURI);
        resource.getContents().add(model);
        resource.save(Collections.EMPTY_MAP);
       
        return modelFile;
  }
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

   * some {@link ResourceSet}.
   *
   * @return a new, empty InternetApplication
   */
  private InternetApplication createInternetApplication() {
    ResourceSet set = new ResourceSetImpl();
    URI uri = URI.createFileURI("queue.iaml");
    Resource resource = set.createResource(uri);
   
    // create the model
    InternetApplication root = ModelFactory.eINSTANCE.createInternetApplication();
    assertNotNull(root);
    assertNotEqual(root.getName(), "created successfully");
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

   *
   * <p>If "A registered resource factory is needed" is thrown, add the
   * <code>org.eclipse.emf.ecore.xmi</code> plugin as a dependency.</p>
   */
  protected EObject loadModelDirectly(String filename) {
    ResourceSet resourceSet = new ResourceSetImpl();
    URI uri = URI.createFileURI(filename);
    Resource resource = resourceSet.getResource(uri, true);
    assertNotNull(resource);
    assertEquals("there should only be one contents in the model file", 1, resource.getContents().size());
    return resource.getContents().get(0);
  }
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

    map.put("xmi", new XMIResourceFactoryImpl());
    map.put("ecore", new  XMIResourceFactoryImpl());
   
    EPackage.Registry.INSTANCE.put("http://www.emftext.org/java/", JavaPackage.eINSTANCE);
   
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource umlMetamodel = resourceSet.createResource(
        InterpreterTest.resolveURI(URI.createURI("file://input/Metamodel_uml.ecore")));
    if(!umlMetamodel.isLoaded()){
      log.debug("Loading Parameter-metamodel" + umlMetamodel.getURI().toString());
      umlMetamodel.load(Collections.EMPTY_MAP);
      while(!umlMetamodel.isLoaded()){
        Thread.yield();
      }
      log.debug("isLoaded");
    }
    resourceSet.getPackageRegistry().put("http://www.reuseware.org/metamodel_uml", umlMetamodel.getContents().get(0));
  }
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

  public void saveInputModel() throws Exception{
    save("output/inputModel.xmi",getTemplate().getInputModel("model").getModelResource());
  }
 
  private void save(String path, Resource r) throws Exception{
    ResourceSet resourceSet = new ResourceSetImpl();
      resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());

      URI uri = URI.createFileURI(new File(path).getAbsolutePath());
      Resource resource = resourceSet.createResource(uri);
      Vector<EObject> rootObjects = new Vector<EObject>();
      for(EObject root : r.getContents()){
        rootObjects.add(root);
      }
     
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

    map.put("xmi", new XMIResourceFactoryImpl());
    map.put("ecore", new  XMIResourceFactoryImpl());
   
    EPackage.Registry.INSTANCE.put("http://www.emftext.org/java/", JavaPackage.eINSTANCE);
   
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource umlMetamodel = resourceSet.createResource(resolveURI(URI.createURI("file://input/Metamodel_uml.ecore")));
    if(!umlMetamodel.isLoaded()){
      log.debug("Loading Parameter-metamodel" + umlMetamodel.getURI().toString());
      umlMetamodel.load(Collections.EMPTY_MAP);
      while(!umlMetamodel.isLoaded()){
        Thread.yield();
      }
      log.debug("isLoaded");
    }
    resourceSet.getPackageRegistry().put("http://www.reuseware.org/metamodel_uml", umlMetamodel.getContents().get(0));


    templateMockup = new TemplateMockup();
  }
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

    map.put("xmi", new XMIResourceFactoryImpl());
    map.put("ecore", new  XMIResourceFactoryImpl());
   
    EPackage.Registry.INSTANCE.put("http://www.emftext.org/java/", JavaPackage.eINSTANCE);
   
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource umlMetamodel = resourceSet.createResource(
        InterpreterTest.resolveURI(URI.createURI("file://input/Metamodel_uml.ecore")));
    if(!umlMetamodel.isLoaded()){
      log.debug("Loading Parameter-metamodel" + umlMetamodel.getURI().toString());
      umlMetamodel.load(Collections.EMPTY_MAP);
      while(!umlMetamodel.isLoaded()){
        Thread.yield();
      }
      log.debug("isLoaded");
    }
    resourceSet.getPackageRegistry().put("http://www.reuseware.org/metamodel_uml", umlMetamodel.getContents().get(0));
  }
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

     * @param output the desired stream to send the output.
     */
    public static void serializeXSDSchema(XSDSchema schema, OutputStream output) {
//        try {
        //this seems to be how to save an XML Schema
        ResourceSet resourceSet = new ResourceSetImpl();
        Resource resource = new XSDResourceImpl(URI.createURI("file://D:/testing.xml"));
        resource.getContents().add(schema);
        resourceSet.getResources().add(resource);
        schema.validate();
        printDiagnostics(schema);
//            schema.eResource().save(output, null);
//        } catch (IOException e) {
//            e.printStackTrace();
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

    throw new IllegalArgumentException();
  }
 
  public static ResourceSet createResourceSet()
  {
    ResourceSet result = new ResourceSetImpl();
    configureResourceSet(result);
    return result;
  }
View Full Code Here

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

        else finalPath = fileName;

        final URI fileURI = URI.createFileURI(finalPath);
       
        // create resource set and resource
        ResourceSet resourceSet = new ResourceSetImpl();

        final Resource resource = resourceSet.getResource(fileURI, true);

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
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.