Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EPackage$Registry


    return new InterpretationResult(instance,modelCorrespondence);
  }
 
  private void load() throws SimTLException{
    //Get root package in template instance
    EPackage instancePackage = template.getObjectLanguagePackage();
    Resource.Factory resourceFactory = template.getObjectLanguageTextResourceFactory();
   
    ResourceSet resourceSet = template.getChild().eResource().getResourceSet();
    // Register XML resource factory
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
View Full Code Here


 
 
 
  public static EObject instantiate(EClass tClass, EPackage iRootPackage){
    String tClassName = tClass.getName();
    EPackage tPackage = tClass.getEPackage();
    EPackage iPackage = findIPackageFromTPackage(
        tPackage, iRootPackage);
    if(iPackage == null){
      //Try with name
      return instantiateByName(tClass.getName(), iRootPackage);
    }
    return iPackage.getEFactoryInstance().create(
        (EClass)iPackage.getEClassifier(tClassName));
   
  }
View Full Code Here

    Vector<EPackage> tPathToTPackage = new Vector<EPackage>();
    while(!tPathToRootPackage.isEmpty()){
      tPathToTPackage.add(tPathToRootPackage.pop());
    }
   
    EPackage iPackage = findIPackageFromTPackage(tPathToTPackage, iRootPackage);
    if(iPackage == null|| !iPackage.getName().matches(tPackage.getName())){
      return null;
    }
    return iPackage;
  }
View Full Code Here

    }
    return iPackage;
  }
 
  private static EPackage findIPackageFromTPackage(Vector<EPackage> tPathToTPackage, EPackage iRootPackage){
    EPackage iPackage = iRootPackage;
    Iterator<EPackage> it = tPathToTPackage.iterator();
    if(it.hasNext()) it.next(); // forget tRootPackage
    while(it.hasNext()){
      EPackage tPackageChild = it.next();
      boolean found = false;
      for(EPackage iPackageChild : iPackage.getESubpackages()){
        if(iPackageChild.getName().matches(tPackageChild.getName())){
          iPackage = iPackageChild;
          found = true;
          break;
        }
      }
      if(!found){
        log.warn("Couldn't find iPackageChild " + tPackageChild.getName() + " in " + iPackage.getName());
        return null;
      }
    }
    return iPackage;
  }
View Full Code Here

                // 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();) {
                    EPackage currentEPackage = (EPackage)iter.next();
                    String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage);
                    String currentPrefix = CodeGenUtil.capName(currentEPackage.getName());

                    GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage,
                                                                    currentPrefix, genOptions, resourceSet);
                    genPackages.add(currentGenPackage);
                    for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
                        genClasses.put(genClass.getEcoreClass(), genClass);
                    }

                }

                // Process all the SDO packages
                // Populate the qname -> interfaceName typeMapping table
                for (GenPackage currentGenPackage : genPackages) {
                    EPackage currentEPackage = currentGenPackage.getEcorePackage();
                   
                    // Populate the type mappings for all the complex types
                    for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
                        QName qname = new QName(extendedMetaData.getNamespace(currentEPackage),
                                                extendedMetaData.getName(genClass.getEcoreClass()));
View Full Code Here

                // 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();) {
                    EPackage currentEPackage = (EPackage)iter.next();
                    String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage);
                    String currentPrefix = CodeGenUtil.capName(currentEPackage.getName());

                    GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage,
                                                                    currentPrefix, genOptions, resourceSet);
                    genPackages.add(currentGenPackage);
                    for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
                        genClasses.put(genClass.getEcoreClass(), genClass);
                    }

                }

                // Process all the SDO packages
                // Populate the QName -> interfaceName typeMapping table
                for (GenPackage currentGenPackage : genPackages) {
                    EPackage currentEPackage = currentGenPackage.getEcorePackage();
                   
                    // Populate the type mappings for all the complex types
                    for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
                        QName qname = new QName(extendedMetaData.getNamespace(currentEPackage),
                                                extendedMetaData.getName(genClass.getEcoreClass()));
View Full Code Here

                // 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();) {
                    EPackage currentEPackage = (EPackage)iter.next();
                    String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage);
                    String currentPrefix = CodeGenUtil.capName(currentEPackage.getName());

                    GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage,
                                                                    currentPrefix, genOptions, resourceSet);
                    genPackages.add(currentGenPackage);
                    for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
                        genClasses.put(genClass.getEcoreClass(), genClass);
                    }

                }

                // Process all the SDO packages
                // Populate the qname -> interfaceName typeMapping table
                for (GenPackage currentGenPackage : genPackages) {
                    EPackage currentEPackage = currentGenPackage.getEcorePackage();
                   
                    // Populate the type mappings for all the complex types
                    for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
                        QName qname = new QName(extendedMetaData.getNamespace(currentEPackage),
                                                extendedMetaData.getName(genClass.getEcoreClass()));
View Full Code Here

  {
    GenModel genModel = ecore2GenModel(ePackages, packageInfoTable, genOptions);

    for (Iterator iter = ePackages.iterator(); iter.hasNext();)
    {
      EPackage ePackage = (EPackage)iter.next();
       
      URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore");
      URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");

      Resource ecoreResource = resourceSet.createResource(ecoreURI);
      ecoreResource.getContents().add(ePackage);
View Full Code Here

    List usedGenPackages = new ArrayList();
    GenModel genModel = null;
    ArrayList packagesToModel = new ArrayList();
    for (Iterator iter = packageList.iterator(); iter.hasNext();)
    {
      EPackage currentEPackage = (EPackage)iter.next();
      String packageNamespace  = currentEPackage.getNsURI();
      PackageInfo packageInfo  = (PackageInfo)packageInfoTable.get(packageNamespace);
      boolean bTargetPackage   = allNamespaces;
      String javaPackage       = null;
      String prefix            = null;
      String shortName         = null;
      if( packageInfo != null )
      {
        bTargetPackage = true;
        javaPackage    = packageInfo.getBasePackage();
        prefix         = packageInfo.getPrefix();
        shortName      = packageInfo.getShortName();
      }   
      String currentBasePackage = extractBasePackageName(currentEPackage, bTargetPackage ? javaPackage : null);
      String currentPrefix = bTargetPackage && prefix != null ? prefix : CodeGenUtil.capName(shortName != null ? shortName : currentEPackage.getName());
      packageInfoTable.put(currentEPackage, new PackageInfo(currentBasePackage, currentPrefix, null, null ));
     
      if( allNamespaces || packageInfo != null )
          packagesToModel.add(currentEPackage);
      else
View Full Code Here

        SDOXSDEcoreBuilder ecoreBuilder = new SDOXSDEcoreBuilder(extendedMetaData, extensibleNamespaces);

        // Add the built-in models to the targetNamespaceToEPackageMap so they
        // can't be (re)defined/overridden
        for (Iterator iter = TypeHelperImpl.getBuiltInModels().iterator(); iter.hasNext();) {
            EPackage ePackage = (EPackage)iter.next();
            ecoreBuilder.getTargetNamespaceToEPackageMap().put(ePackage.getNsURI(), ePackage);
        }

        return ecoreBuilder;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.EPackage$Registry

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.