Package org.eclipse.emf.ecore.resource.impl

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


    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

    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

     * @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

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

        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

        }

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

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

        new EMFStoreCommand()
        {
            @Override
            protected void doRun()
View Full Code Here

    else
      uri = URI.createFileURI(wsdlURI);

    // Create a resource set, create a wsdl resource, and load the main wsdl file into it.

    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("wsdl", new WSDLResourceFactoryImpl());

    WSDLResourceImpl wsdlMainResource = (WSDLResourceImpl)resourceSet.createResource(URI.createURI("*.wsdl"));
    wsdlMainResource.setURI(uri);

    try
    {
      InputStream inputStream = resourceSet.getURIConverter().createInputStream(uri);
      wsdlMainResource.load(inputStream, resourceSet.getLoadOptions());
      //wsdlMainResource.load(resourceSet.getLoadOptions());
    }
    catch (IOException e)
    {
      throw new WSDLException(WSDLException.INVALID_WSDL, "WSDL URI: " + wsdlURI, e);
View Full Code Here

   * @return the definition described in the document pointed to
   * by the InputSource.
   */
  public Definition readWSDL(String documentBaseURI, InputSource inputSource) throws WSDLException
  {
    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("wsdl", new WSDLResourceFactoryImpl());
    WSDLResourceImpl wsdlMainResource = (WSDLResourceImpl)resourceSet.createResource(URI.createURI("*.wsdl"));

    try
    {
      if (documentBaseURI != null)
        wsdlMainResource.setURI(createURI(documentBaseURI));
      resourceSet.getLoadOptions().put(WSDLResourceImpl.CONTINUE_ON_LOAD_ERROR, new Boolean(false));
      wsdlMainResource.load(inputSource.getByteStream(), resourceSet.getLoadOptions());
    }
    catch (IOException ioe)
    {
      throw new WSDLException(WSDLException.INVALID_WSDL, "", ioe);
    }
View Full Code Here

    return globalResourceSet;
  }

  public static ResourceSet createResourceSet()
  {
    ResourceSet result = new ResourceSetImpl();
    result.getResourceFactoryRegistry().getExtensionToFactoryMap().put("wsdl", new WSDLResourceFactoryImpl()); //$NON-NLS-1$
    return result;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

Copyright © 2018 www.massapicom. 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.