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

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


        TypeSystemDescription tsDesc = TypeSystemUtil.typeSystem2TypeSystemDescription(aCas
                .getTypeSystem());
        // register default resource factory
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*",
                new XMIResourceFactoryImpl());
        ResourceSet resourceSet = new ResourceSetImpl();
        URI outputURI = URI.createFileURI(new File(mOutputDir, "typesystem.ecore")
                .getAbsolutePath());
        Resource outputResource = resourceSet.createResource(outputURI);
        schemaLocationMap = new HashMap();
        try {
          UimaTypeSystem2Ecore
                  .uimaTypeSystem2Ecore(tsDesc, outputResource, null, schemaLocationMap);
        } catch (InvalidXMLException e) {
View Full Code Here


      loadServers();
      if (servers == null) {
        Bundle bundle = Platform.getBundle(Activator.BUNDLE_ID);
        File stateLocation = Platform.getStateLocation(bundle).toFile();
        File serversFile = new File(stateLocation,MODEL_FILE_NAME);
        Resource resource = new ResourceSetImpl().createResource(URI.createFileURI(serversFile.getPath()));
        servers = HadoopFactory.eINSTANCE.createServers();
        resource.getContents().add(servers);
      }
    }
    return servers;
View Full Code Here

  private void loadServers() {
    Bundle bundle = Platform.getBundle(Activator.BUNDLE_ID);
    File stateLocation = Platform.getStateLocation(bundle).toFile();
    File serversFile = new File(stateLocation,MODEL_FILE_NAME);
    if (serversFile.exists()) {
      Resource resource = new ResourceSetImpl().getResource(URI.createFileURI(serversFile.getPath()), true);
      servers = (Servers) resource.getContents().get(0);
      HDFSManager.INSTANCE.loadServers();
      ZooKeeperManager.INSTANCE.loadServers();
    }
  }
View Full Code Here

          @Override
          protected void execute(IProgressMonitor progressMonitor) {
            try {
              // Create a resource set
              //
              ResourceSet resourceSet = new ResourceSetImpl();

              // Get the URI of the model file.
              //
              URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);

              // 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

   * @generated
   */
  public static void main(String[] args) {
    // Create a resource set to hold the resources.
    //
    ResourceSet resourceSet = new ResourceSetImpl();
   
    // Register the appropriate resource factory to handle all file extensions.
    //
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put
      (Resource.Factory.Registry.DEFAULT_EXTENSION,
       new XMIResourceFactoryImpl());

    // Register the package to ensure it is available during loading.
    //
    resourceSet.getPackageRegistry().put
      (TurtlePackage.eNS_URI,
       TurtlePackage.eINSTANCE);
       
    // 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.turtle"));
        Turtle root = TurtleFactory.eINSTANCE.createTurtle();
        resource.getContents().add(root);
        resource.save(System.out, null);
      }
      catch (IOException exception) {
        exception.printStackTrace();
      }
    }
    else {
      // Iterate over all the arguments.
      //
      for (int i = 0; i < args.length; ++i) {
        // Construct the URI for the instance file.
        // The argument is treated as a file path only if it denotes an existing file.
        // Otherwise, it's directly treated as a URL.
        //
        File file = new File(args[i]);
        URI uri = file.isFile() ? URI.createFileURI(file.getAbsolutePath()): URI.createURI(args[0]);

        try {
          // Demand load resource for this file.
          //
          Resource resource = resourceSet.getResource(uri, true);
          System.out.println("Loaded " + uri);

          // Validate the contents of the loaded resource.
          //
          for (EObject eObject : resource.getContents()) {
View Full Code Here

    try {
      new StandaloneSetup().setPlatformUri("..");
      final String uri = new File("./emf-gen").getAbsolutePath();
      GenModelPackage.eINSTANCE.getGenAnnotation();

      ResourceSet rs = new ResourceSetImpl();
      Resource resource = rs.getResource(URI
          .createURI("platform:/resource/org.eclipse.xtext/model/parsetree.genmodel"), true);
      GenModel genModel = (GenModel) resource.getContents().get(0);
      genModel.setForceOverwrite(true);
      genModel.setCanGenerate(true);
      genModel.reconcile();
View Full Code Here

    public ViewMetadataGenerator(final String uri)
    {
        _root = MetadataFactory.eINSTANCE.createModel();
        _root.setId(uri);
        _root.setType("tagFile"); //$NON-NLS-1$
        _resourceSet = new ResourceSetImpl();
        _mapper = new ViewMetadataMapper();
        _extendedMetadata = new BasicExtendedMetaData(_resourceSet
                .getPackageRegistry());

        // Register the appropriate resource factory to handle all file
View Full Code Here

        TypeSystemDescription tsDesc = TypeSystemUtil.typeSystem2TypeSystemDescription(aCas
                .getTypeSystem());
        // register default resource factory
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*",
                new XMIResourceFactoryImpl());
        ResourceSet resourceSet = new ResourceSetImpl();
        URI outputURI = URI.createFileURI(new File(mOutputDir, "typesystem.ecore")
                .getAbsolutePath());
        Resource outputResource = resourceSet.createResource(outputURI);
        schemaLocationMap = new HashMap();
        try {
          UimaTypeSystem2Ecore
                  .uimaTypeSystem2Ecore(tsDesc, outputResource, null, schemaLocationMap);
        } catch (InvalidXMLException e) {
View Full Code Here

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

          @Override
          protected void execute(IProgressMonitor progressMonitor) {
            try {
              // Create a resource set
              //
              ResourceSet resourceSet = new ResourceSetImpl();

              // Get the URI of the model file.
              //
              URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);

              // 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

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.