Package org.eclipse.emf.ecore.util

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


        argList.add(""); //bogus arg
        String[] args = argList.toArray(new String[argList.size()]);

        packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
        extendedMetaData = new BasicExtendedMetaData(packageRegistry);
        HelperContext hc = new HelperContextImpl(extendedMetaData, false);
        xsdHelper = hc.getXSDHelper();
        typeHelper = hc.getTypeHelper();

   
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 XSDHelperImpl(extendedMetaData, null);

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

  protected static void generateFromXMLSchema(String xsdFileName, String namespace, String targetDirectory, String javaPackage, String prefix, int genOptions, String regenerateBuiltIn)
  {
    DataObjectUtil.initRuntime();
    EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
    ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry);
    XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData, regenerateBuiltIn);

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

      if (extendedMetaDataOption.equals(Boolean.TRUE))
      {
        extendedMetaData =
          resourceSet == null ?
            ExtendedMetaData.INSTANCE :
            new BasicExtendedMetaData(resourceSet.getPackageRegistry());
        if (xmlResource != null)
        {
          xmlResource.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
        }
      }
View Full Code Here

  {
    if (registry == null)
    {
      registry = new EPackageRegistryImpl();
    }
    return new BasicExtendedMetaData(registry);
  }
View Full Code Here

      if (extendedMetaDataOption.equals(Boolean.TRUE))
      {
        extendedMetaData =
          resource == null || resource.getResourceSet() == null ?
            ExtendedMetaData.INSTANCE :
            new BasicExtendedMetaData(resource.getResourceSet().getPackageRegistry());
      }
    }
    else
    {
      extendedMetaData = (ExtendedMetaData)options.get(XMLResource.OPTION_EXTENDED_META_DATA);
    }
   
    // set serialization options
    if (!toDOM)
    {
      declareXML = !Boolean.FALSE.equals(options.get(XMLResource.OPTION_DECLARE_XML));
   
      if (options.get(XMLResource.OPTION_FLUSH_THRESHOLD) instanceof Integer)
      {
        flushThreshold = (Integer)options.get(XMLResource.OPTION_FLUSH_THRESHOLD);
      }

      String temporaryFileName = null;
      if (Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_FILE_BUFFER)))
      {
        try
        {
          temporaryFileName = File.createTempFile("XMLSave", null).getPath();
        }
        catch (IOException exception)
        {
          // If we can't create a temp file then we have to ignore the option.
        }
      }
     
      Integer lineWidth = (Integer)options.get(XMLResource.OPTION_LINE_WIDTH);
      int effectiveLineWidth = lineWidth == null ? Integer.MAX_VALUE : lineWidth;
      String publicId = null, systemId = null;
      if (resource != null && Boolean.TRUE.equals(options.get(XMLResource.OPTION_SAVE_DOCTYPE)))
      {
        publicId = resource.getPublicId();
        systemId = resource.getSystemId();
      }
      if (useCache)
      {      
        doc = ConfigurationCache.INSTANCE.getPrinter();
        doc.reset(publicId, systemId, effectiveLineWidth, temporaryFileName);
        escape = Boolean.TRUE.equals(options.get(XMLResource.OPTION_SKIP_ESCAPE)) ? null : ConfigurationCache.INSTANCE.getEscape();
      }
      else
      {
        doc = new XMLString(effectiveLineWidth, publicId, systemId, temporaryFileName);
        escape = Boolean.TRUE.equals(options.get(XMLResource.OPTION_SKIP_ESCAPE)) ? null : new Escape();
      }

      if (Boolean.FALSE.equals(options.get(XMLResource.OPTION_FORMATTED)))
      {
        doc.setUnformatted(true);
      }
     

      escapeURI = Boolean.FALSE.equals(options.get(XMLResource.OPTION_SKIP_ESCAPE_URI)) ? escape : null;

      if (options.containsKey(XMLResource.OPTION_ENCODING))
      {
        encoding = (String)options.get(XMLResource.OPTION_ENCODING);
      }
      else if (resource != null)
      {
        encoding = resource.getEncoding();
      }

      if (options.containsKey(XMLResource.OPTION_XML_VERSION))
      {
        xmlVersion = (String)options.get(XMLResource.OPTION_XML_VERSION);
      }
      else if (resource != null)
      {
        xmlVersion = resource.getXMLVersion();
      }

      if (escape != null)
      {
        int maxSafeChar = MAX_UTF_MAPPABLE_CODEPOINT;
        if (encoding != null)
        {
          if (encoding.equalsIgnoreCase("ASCII") || encoding.equalsIgnoreCase("US-ASCII"))
          {
            maxSafeChar = MAX_ASCII_MAPPABLE_CODEPOINT;
          }
          else if (encoding.equalsIgnoreCase("ISO-8859-1"))
          {
            maxSafeChar = MAX_LATIN1_MAPPABLE_CODEPOINT;
          }
        }

        escape.setMappingLimit(maxSafeChar);
        if (!"1.0".equals(xmlVersion))
        {
          escape.setAllowControlCharacters(true);
        }

        escape.setUseCDATA(Boolean.TRUE.equals(options.get(XMLResource.OPTION_ESCAPE_USING_CDATA)));
      }

      resourceEntityHandler = (XMLResource.ResourceEntityHandler)options.get(XMLResource.OPTION_RESOURCE_ENTITY_HANDLER);
      if (resourceEntityHandler instanceof XMLResource.URIHandler && !options.containsKey(XMLResource.OPTION_URI_HANDLER))
      {
        Map<Object, Object> newOptions = new LinkedHashMap<Object, Object>(options);
        newOptions.put(XMLResource.OPTION_URI_HANDLER, resourceEntityHandler);
        options = newOptions;
      }
    }
    else
    {
      // DOM serialization
      if (handler instanceof DefaultDOMHandlerImpl)
      {
        ((DefaultDOMHandlerImpl)handler).setExtendedMetaData(extendedMetaData);
      }
    }
    processDanglingHREF = (String) options.get(XMLResource.OPTION_PROCESS_DANGLING_HREF);
    helper.setProcessDanglingHREF(processDanglingHREF);

    map = (XMLResource.XMLMap) options.get(XMLResource.OPTION_XML_MAP);
    if (map != null)
    {
      helper.setXMLMap(map);

      if (map.getIDAttributeName() != null)
      {
        idAttributeName = map.getIDAttributeName();
      }
    }

    if (resource != null)
    {
      eObjectToExtensionMap = resource.getEObjectToExtensionMap();
      if (eObjectToExtensionMap.isEmpty())
      {
        eObjectToExtensionMap = null;
      }
      else if (extendedMetaData == null)
      {
        extendedMetaData =
          resource.getResourceSet() == null ?
            ExtendedMetaData.INSTANCE :
            new BasicExtendedMetaData(resource.getResourceSet().getPackageRegistry());
      }
    }

    if (extendedMetaData != null)
    {
View Full Code Here

        argList.add(""); //bogus arg
        String[] args = argList.toArray(new String[argList.size()]);

        packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
        extendedMetaData = new BasicExtendedMetaData(packageRegistry);
        HelperContext hc = new HelperContextImpl(extendedMetaData, false);
        xsdHelper = hc.getXSDHelper();
        typeHelper = hc.getTypeHelper();

   
View Full Code Here

   * <!-- end-user-doc -->
   * @generated
   */
  public Subset0267ResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, Subset0267Package.eINSTANCE);
  }
View Full Code Here

   * <!-- end-user-doc -->
   * @generated
   */
  public Subset0268ResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, Subset0268Package.eINSTANCE);
  }
View Full Code Here

     * @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

TOP

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

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.