Package org.eclipse.emf.ecore.resource

Examples of org.eclipse.emf.ecore.resource.ResourceSet


   * @return
   */
  public static int include2stream(Include include) {
    TranslationUnit tu = (TranslationUnit) include.eContainer();
    Resource resource = tu.eResource();
    ResourceSet resourceSet = resource.getResourceSet();
    EList<Resource> resources = resourceSet.getResources();

    int result = tu.getIncludes().indexOf(include);
    int res = resources.indexOf(resource);

    for (int i = 0; i < res; i++) {
View Full Code Here


    contexts.add(context);

    // Find other ModuleDefs with the same FQN
    if (context instanceof ModuleDef) {
      ResourceSet set = context.eResource().getResourceSet();
      String myFQN = IDLUtil.getFQN((ModuleDef) context);

      for (Resource resource : set.getResources()) {
        TreeIterator<EObject> it = resource.getAllContents();
        while (it.hasNext()) {
          EObject eobj = it.next();

          if (eobj != context && eobj instanceof ModuleDef && IDLUtil.getFQN((ModuleDef) eobj).equals(myFQN))
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

      logger.debug("Cache hit for " + filePath + "!");
      return includesMap.get(include);
    }

    // load the resource
    ResourceSet resourceSet = include.eResource().getResourceSet();
    Resource resource = resourceSet.createResource(URI.createURI("dummy:/" + numInclude + "/" + filePath));

    logger.debug("Cache fault! Loading " + filePath + " as " + resource.getURI());

    // cache
    includesMap.put(include, resource);

    InputStream in = new ByteArrayInputStream(resources.get(numInclude++).toByteArray());
   
    resource.load(in, resourceSet.getLoadOptions());

    // Transformations
    TranslationUnit trunit = (TranslationUnit) resource.getContents().get(0);
    ExpressionEvaluator.evaluate(trunit);
    ArrayExpander.expand(trunit);
View Full Code Here

            // Populate the typeMapping table that will be given to the Axis2 WSDL2Java
            Map<QName, SDODataBindingTypeMappingEntry> typeMapping =
                                    new HashMap<QName, SDODataBindingTypeMappingEntry>();
            if (!packageRegistry.values().isEmpty()) {
                ResourceSet resourceSet = DataObjectUtil.createResourceSet();

                // Populate list of GenPackages and a map of GenClasses keyed by EClass
                List<GenPackage> genPackages = new ArrayList<GenPackage>();
                Map<EClass, GenClass> genClasses = new HashMap<EClass, GenClass>();
                for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) {
View Full Code Here

            // Populate the typeMapping table that will be given to the Axis2 WSDL2Java
            Map<QName, SDODataBindingTypeMappingEntry> typeMapping =
                                    new HashMap<QName, SDODataBindingTypeMappingEntry>();
            if (!packageRegistry.values().isEmpty()) {
                ResourceSet resourceSet = DataObjectUtil.createResourceSet();

                // Populate list of GenPackages and a map of GenClasses keyed by EClass
                List<GenPackage> genPackages = new ArrayList<GenPackage>();
                Map<EClass, GenClass> genClasses = new HashMap<EClass, GenClass>();
                for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) {
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

            // Populate the typeMapping table that will be given to the Axis2 WSDL2Java
            Map<QName, SDODataBindingTypeMappingEntry> typeMapping =
                                    new HashMap<QName, SDODataBindingTypeMappingEntry>();
            if (!packageRegistry.values().isEmpty()) {
                ResourceSet resourceSet = DataObjectUtil.createResourceSet();

                // Populate list of GenPackages and a map of GenClasses keyed by EClass
                List<GenPackage> genPackages = new ArrayList<GenPackage>();
                Map<EClass, GenClass> genClasses = new HashMap<EClass, GenClass>();
                for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) {
View Full Code Here

    generatePackages(packageList, targetDirectory, packageInfoTable, genOptions, false);     
  }
 
  protected static GenModel generatePackages(Collection packageList, String targetDirectory, Hashtable packageInfoTable, int genOptions, boolean allNamespaces )
  {
    ResourceSet resourceSet = DataObjectUtil.createResourceSet();
    List usedGenPackages = new ArrayList();
    GenModel genModel = null;
    ArrayList packagesToModel = new ArrayList();
    for (Iterator iter = packageList.iterator(); iter.hasNext();)
    {
View Full Code Here

  /**
   * @deprecated
   */
  public static String getSchemaNamespace(String xsdFileName)
  {
    ResourceSet resourceSet = DataObjectUtil.createResourceSet();
    File inputFile = new File(xsdFileName).getAbsoluteFile();
    Resource model = resourceSet.getResource(URI.createURI(inputFile.toURI().toString()), true);
    XSDSchema schema = (XSDSchema)model.getContents().get(0);
    return schema.getTargetNamespace();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.resource.ResourceSet

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.