Package org.eclipse.emf.ecore.util

Examples of org.eclipse.emf.ecore.util.ExtendedMetaData


     * @param eNsURI - package name space URI specification
     * @return an {@link EStructuralFeature} instance if found, null otherwise.
     */
    public static EStructuralFeature eGetStructuralFeature(EPackage.Registry eRegistry,
            EClass eClass, String eName, String eNsURI) {
        ExtendedMetaData data = new BasicExtendedMetaData(eRegistry) {

            @Override
            protected boolean isFeatureKindSpecific() {
                return false;
            }

            @Override
            protected boolean isFeatureNamespaceMatchingLax() {
                return true;
            }

        };
        return data.getAttribute(eClass, eNsURI, eName);
    }
View Full Code Here


    copy = new JexXmlResource(original.getURI().trimFileExtension().appendFileExtension(extension));
    copy.getContents().addAll(EcoreUtil.copyAll(original.getContents()));
    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResources().add(copy);
    // set up extension
    ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(resourceSet.getPackageRegistry());
    resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
    Map extensions = copy.getEObjectToExtensionMap();
    // create extension attribute meta object
    EStructuralFeature originalAttributeFeature = extendedMetaData.demandFeature(null, "original", false);
    // create extension attribute
    AnyType originalAttribute = XMLTypeFactory.eINSTANCE.createAnyType();
    // set extension attribute value
    originalAttribute.eSet(originalAttributeFeature, original.getURI().toString());
    // add attribute to root object
View Full Code Here

   */
  public static void generateFromXMLSchema(String xsdFileName, String targetDirectory, String javaPackage, String prefix, int genOptions)
  {
    DataObjectUtil.initRuntime();
    EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
    ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry);
    XSDHelper xsdHelper = (new HelperContextImpl(extendedMetaData, false)).getXSDHelper();

    try
    {
      File inputFile = new File(xsdFileName).getAbsoluteFile();
View Full Code Here

  protected void run(String args[])
  {
    String xsdFileName = args[inputIndex];
    EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
    ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry);
    String packageURI = getSchemaNamespace(xsdFileName);
    Hashtable packageInfoTable = createPackageInfoTable(packageURI, schemaNamespace, javaPackage, prefix, namespaceInfo );
    generateFromXMLSchema(xsdFileName, packageRegistry, extendedMetaData, targetDirectory, packageInfoTable, genOptions, generateBuiltIn, allNamespaces);
  }
View Full Code Here

  }

  public static void generateFromXMLSchema(String xsdFileName, String namespace, String targetDirectory, String javaPackage, String prefix, int genOptions)
  {
    EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
    ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry);
    String packageURI = getSchemaNamespace(xsdFileName);
    Hashtable packageInfoTable = createPackageInfoTable(packageURI, namespace, javaPackage, prefix, null );
    generateFromXMLSchema(xsdFileName, packageRegistry, extendedMetaData, targetDirectory, packageInfoTable, genOptions, null, false );
  }
View Full Code Here

  {
    try
    {
      processArguments(args);
      EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
      ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry);
      String xsdFileName = args[inputIndex];
      String packageURI = getSchemaNamespace(xsdFileName);
      Hashtable packageInfoTable = createPackageInfoTable(packageURI, schemaNamespace, javaPackage, prefix, namespaceInfo );
      GenModel genModel = generateFromXMLSchema(xsdFileName, packageRegistry, extendedMetaData, targetDirectory, packageInfoTable, genOptions, generateBuiltIn, allNamespaces);
      generatedPackages = new GeneratedPackages(genModel,extendedMetaData);
View Full Code Here

   * @deprecated see {@link org.apache.tuscany.sdo.api.SDOUtil#createHelperContext}
   */
  public static TypeHelper createTypeHelper()
  {
    EPackage.Registry registry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
    ExtendedMetaData extendedMetaData = new SDOExtendedMetaDataImpl(registry); //TODO create subclass that makes demand() methods synchronous
    //return new TypeHelperImpl(extendedMetaData);
    return (new HelperContextImpl(extendedMetaData, false)).getTypeHelper();
  }
View Full Code Here

    }


   
    public Type createType(HelperContext hc, String uri, String name, boolean isDataType) {
        ExtendedMetaData extendedMetaData = ((HelperContextImpl)hc).getExtendedMetaData();
        if ("".equals(uri))
            uri = null; // FB

        EPackage ePackage = extendedMetaData.getPackage(uri);
        if (ePackage == null) {
            ePackage = EcoreFactory.eINSTANCE.createEPackage();
            ePackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl());
            ePackage.setNsURI(uri);
            String packagePrefix = uri != null ? URI.createURI(uri).trimFileExtension().lastSegment() : ""; // FB
            ePackage.setName(packagePrefix);
            ePackage.setNsPrefix(packagePrefix);
            extendedMetaData.putPackage(uri, ePackage);
        }

        EClassifier eClassifier = ePackage.getEClassifier(name);
        if (eClassifier != null) // already defined?
        {
View Full Code Here

  }
 
 
  public Property createOpenContentProperty(HelperContext hc, String uri, String name, Type type)
  {
        ExtendedMetaData extendedMetaData = ((HelperContextImpl)hc).getExtendedMetaData();

        // get/create document root
        EPackage ePackage = extendedMetaData.getPackage(uri);
        Type documentRoot = ePackage != null ? (Type)extendedMetaData.getType(ePackage, "") : null;
        if (documentRoot == null) {
            documentRoot = createType(hc, uri, null, false);
        }

        // Determine if property already exists
View Full Code Here

                }
                xmlOptions.setProcessSchemaLocations(true);
                if (option == null){
                    option = getDefaultLoadOptions().get(OPTION_EXTENDED_META_DATA);
                }
                ExtendedMetaData extendedMetaData;
                final XSDHelper xsdHelper;
                if (option == null) {
                    extendedMetaData = ExtendedMetaData.INSTANCE;
                    xsdHelper = XSDHelper.INSTANCE;
                } else {
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.util.ExtendedMetaData

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.