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

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource()


    // If there are no arguments, emit an appropriate usage message.
    //
    if (args.length == 0) {
      System.out.println("Enter a list of file paths or URIs that have content like this:");
      try {
        Resource resource = resourceSet.createResource(URI.createURI("http:///My.conf"));
        Application root = ConfFactory.eINSTANCE.createApplication();
        resource.getContents().add(root);
        resource.save(System.out, null);
      }
      catch (IOException exception) {
View Full Code Here


  }

  private static SecurityModel read(String modelString) throws IOException {
    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
    Resource xmlResource = resourceSet.createResource(URI.createURI("dummy.deploy")); //$NON-NLS-1$
    // Register the package -- only needed for stand-alone!
    resourceSet.getPackageRegistry().put(UamPackage.eNS_URI, UamPackage.eINSTANCE);
    resourceSet.getPackageRegistry().put(ExpressionPackage.eNS_URI, ExpressionPackage.eINSTANCE);
    resourceSet.getPackageRegistry().put(StdlibPackage.eNS_URI, StdlibPackage.eINSTANCE);
    ByteArrayInputStream bais = new ByteArrayInputStream(modelString.getBytes());
View Full Code Here

    // Register the default resource factory -- only needed for stand-alone!
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());

    // Create a resource for this file.
    Resource resource = resourceSet.createResource(URI.createURI("dummy.deploy")); //$NON-NLS-1$

    // Add the book and writer objects to the contents.
    resource.getContents().add(model);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    resource.save(outputStream, null);
View Full Code Here

    // If there are no arguments, emit an appropriate usage message.
    //
    if (args.length == 0) {
      System.out.println("Enter a list of file paths or URIs that have content like this:");
      try {
        Resource resource = resourceSet.createResource(URI.createURI("http:///My.xml"));
        DocumentRoot documentRoot = XmlFactory.eINSTANCE.createDocumentRoot();
        SecurityModelType root = XmlFactory.eINSTANCE.createSecurityModelType();
        documentRoot.setSecurityModel(root);
        resource.getContents().add(documentRoot);
        resource.save(System.out, null);
View Full Code Here

    // Get the URI of the model file.
    URI fileURI = URI.createFileURI(new File(fileName).getAbsolutePath());

    // Create a resource for this file.
    Resource resource = resourceSet.createResource(fileURI);

    // Add the book and writer objects to the contents.
    resource.getContents().add(generateModel());

    // Save the contents of the resource to the file system.
View Full Code Here

    // If there are no arguments, emit an appropriate usage message.
    //
    if (args.length == 0) {
      System.out.println("Enter a list of file paths or URIs that have content like this:");
      try {
        Resource resource = resourceSet.createResource(URI.createURI("http:///My.uam"));
        Permission root = UamFactory.eINSTANCE.createPermission();
        resource.getContents().add(root);
        resource.save(System.out, null);
      }
      catch (IOException exception) {
View Full Code Here

              //
              URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString());

              // Create a resource for this file.
              //
              Resource resource = resourceSet.createResource(fileURI);

              // Add the initial model object to the contents.
              //
              EObject rootObject = createInitialModel();
              if (rootObject != null) {
View Full Code Here

    assertEquals("Should have the expected name", "testcentos.pilsen.cloudsmith.com", c.getName());

    // Save the TargetEntry as a loadable resource
    ResourceSet resourceSet = new ResourceSetImpl();
    URI fileURI = URI.createFileURI(new File("testOutput/sample1.catalog").getAbsolutePath());
    Resource targetResource = resourceSet.createResource(fileURI);
    targetResource.getContents().add(c);
    targetResource.save(null);
    System.err.println("Target saved to: " + fileURI.toString());

  }
View Full Code Here

    assertEquals("Should have the expected name", "testcentos.pilsen.cloudsmith.com", c.getName());
    // Save the TargetEntry as a loadable resource
    ResourceSet resourceSet = new ResourceSetImpl();
    URI fileURI = URI.createFileURI(new File("testOutput/sample2.catalog").getAbsolutePath());
    Resource targetResource = resourceSet.createResource(fileURI);
    targetResource.getContents().add(c);
    targetResource.save(null);
    System.err.println("Target saved to: " + fileURI.toString());

  }
View Full Code Here

    assertEquals("Should have the expected name", "backend.i-fcda579c", c.getName());
    // Save the TargetEntry as a loadable resource
    ResourceSet resourceSet = new ResourceSetImpl();
    URI fileURI = URI.createFileURI(new File("testOutput/sample3.catalog").getAbsolutePath());
    Resource targetResource = resourceSet.createResource(fileURI);
    targetResource.getContents().add(c);
    targetResource.save(null);
    System.err.println("Target saved to: " + fileURI.toString());

  }
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.