Java 类org.eclipse.emf.ecore.util.BasicExtendedMetaData 实例源码

项目:ATLauncher    文件:ATLLauncher.java   
private String lazyMetamodelRegistration(String metamodelPath){

    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());

    ResourceSet rs = new ResourceSetImpl();
    // Enables extended meta-data, weird we have to do this but well...
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(EPackage.Registry.INSTANCE);
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    Resource r = rs.getResource(URI.createFileURI(metamodelPath), true);
    EObject eObject = r.getContents().get(0);
    // A meta-model might have multiple packages we assume the main package is the first one listed
    if (eObject instanceof EPackage) {
        EPackage p = (EPackage)eObject;
        System.out.println(p.getNsURI());
        EPackage.Registry.INSTANCE.put(p.getNsURI(), p);
        return p.getNsURI();
    }
    return null;
}
项目:OpenSPIFe    文件:EDataTypeStringifier.java   
/**
 * @throws ParseException
 */
@Override
protected Object getJavaObjectFromTrimmed(String string, Object defaultObject) throws ParseException {
    try {
        if (eDataType.getInstanceClassName() != null 
                && eDataType.getInstanceClassName().equalsIgnoreCase(BigDecimal.class.getName())) {
            double value = Double.parseDouble(string);
            BasicExtendedMetaData bemd = new BasicExtendedMetaData();
            int factionDigits = bemd.getFractionDigitsFacet(eDataType);
            String minInclusiveString = bemd.getMinInclusiveFacet(eDataType);
            if (minInclusiveString != null) {
                int minInclusive = Integer.parseInt(minInclusiveString);
                if (value < minInclusive) {
                    value = 360 - Math.abs(value); // See SPF-9712
                }
            }
            return eFactoryInstance.createFromString(eDataType, String.format("%." + factionDigits + "f", value));
        }
        return eFactoryInstance.createFromString(eDataType, string);
    } catch (Exception e) {
        if (e instanceof ParseException) {
            throw (ParseException) e;
        }
        throw new ParseException(e.getMessage(), 0);
    }
}
项目:NeoEMF    文件:AbstractInputTest.java   
/**
 * Registers a EPackage in {@link Registry} according to its {@code prefix} and {@code uri}, from an Ecore file.
 * <p>
 * The targeted Ecore file must be present in {@code /resources/ecore}.
 */
protected static void registerEPackageFromEcore(String prefix, String uri) {
    File file = getResourceFile(ECORE_PATH.replaceAll("\\{name\\}", prefix));

    EPackage ePackage = null;

    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ECORE, new EcoreResourceFactoryImpl());

    ResourceSet rs = new ResourceSetImpl();

    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    Resource r = rs.getResource(URI.createFileURI(file.toString()), true);
    EObject eObject = r.getContents().get(0);
    if (eObject instanceof EPackage) {
        ePackage = (EPackage) eObject;
        rs.getPackageRegistry().put(ePackage.getNsURI(), ePackage);
    }

    assertThat(ePackage).isNotNull(); // "EPackage does not exist"

    Registry.INSTANCE.put(uri, ePackage);
}
项目:Tarski    文件:persistenceResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory. <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated
 */
public persistenceResourceFactoryImpl() {
  super();
  extendedMetaData =
      new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
  extendedMetaData.putPackage(null, persistencePackage.eINSTANCE);
}
项目:NoSQLDataEngineering    文件:ModelLoader.java   
public ModelLoader()
{
    resourceSet = new ResourceSetImpl();
    final ExtendedMetaData extendedMetaData = 
        new BasicExtendedMetaData(resourceSet.getPackageRegistry());
    resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA,
        extendedMetaData);
}
项目:caml2tosca    文件:ToscaUtil.java   
public static void init(ResourceSet resourceSet, String path) {
    Resource_Set = resourceSet;
    Extended_Meta_Data = new BasicExtendedMetaData(resourceSet.getPackageRegistry());
    Package_Map = new HashMap<String, EPackage>();
    Text_Attribute = (EAttribute) XMLTypeFactory.eINSTANCE.createXMLTypeDocumentRoot().eClass().getEStructuralFeature("text");
    Path = path;
}
项目:menthor-xcore    文件:OntoumlResource.java   
public static EPackage readEcore (String ecorePath)
{   
    ResourceSet ecoreResourceSet = new ResourceSetImpl();       
    URI ecoreURI = URI.createFileURI(ecorePath);        
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
    ecoreResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
    ecoreResourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);                
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(ecoreResourceSet.getPackageRegistry());
    ecoreResourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA,  extendedMetaData);        
    Resource ecoreResource = ecoreResourceSet.getResource(ecoreURI,true);
    EPackage ecoremodel = (EPackage) ecoreResource.getContents().get(0);        
    ecoreResource.getResourceSet().getPackageRegistry().put(ecoremodel.getNsURI(),ecoremodel);
    EPackage.Registry.INSTANCE.put(ecoremodel.getNsURI(), ecoremodel);      
    return ecoremodel;
}
项目:WP3    文件:persistenceResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory. <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated
 */
public persistenceResourceFactoryImpl() {
  super();
  extendedMetaData =
      new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
  extendedMetaData.putPackage(null, persistencePackage.eINSTANCE);
}
项目:massif    文件:Exporter.java   
/**
 * Loads the EMF representation of a Simulink model.
 * 
 * @param fileNameWithoutExtension
 *            the file to load specified by its name
 * @return the loaded SimulinkModel root EMF model object
 * @throws SimulinkApiException
 */
public SimulinkModel loadSimulinkModel(String fileNameWithoutExtension) throws SimulinkApiException {

    // Register a resource factory for the extension "simulink"
    Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
    Map<String, Object> m = reg.getExtensionToFactoryMap();
    m.put("simulink", new XMIResourceFactoryImpl());

    // Obtain a new resource set
    ResourceSet rs = new ResourceSetImpl();
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    // The model will be saved to the root of the project for now under the
    // given name.
    // TODO save path may come from an extension or properties file
    String path = fileNameWithoutExtension + ".simulink";

    // Load the resource
    Resource loadResource = rs.getResource(URI.createURI(path), true);
    Object resourceContent = loadResource.getContents().get(0);

    // Make a log entry if the root object isn't a SimulinkModel
    if (!(resourceContent instanceof SimulinkModel))
        logger.error("The given resource contained no SimulinkModel as a root element!");

    // Return the root EMF model object
    // Also throws an exception when invalid cast occurs
    return (SimulinkModel) resourceContent;
}
项目:emfviews    文件:TestEMFViews.java   
@Before
public void setup() {
  // We need the TOGAF model for some of the tests, but the plugin has no update site.
  // Instead, we use the Ecore file in resources/metamodels.  However, while EMFViews works
  // with the Ecore file, the code in EclDelegate assumes that metamodels are registered in
  // the EMF package registry.
  //
  // To work around this issue, we load the EPackage from the Ecore file into the package registry.
  //
  // See: https://stackoverflow.com/a/9389901

  Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap()
      .put("ecore", new EcoreResourceFactoryImpl());

  ResourceSet rs = new ResourceSetImpl();
  // enable extended metadata
  final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
  rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

  Resource r = rs.getResource(resourceURI("metamodels/contentfwk.ecore"), true);
  EObject eObject = r.getContents().get(0);
  if (eObject instanceof EPackage) {
    EPackage p = (EPackage) eObject;
    EPackage.Registry.INSTANCE.put(p.getNsURI(), p);
  } else {
    throw new IllegalStateException("Error loading TOGAF metamodel for testing");
  }
}
项目:eclipse-avro    文件:EPackageImpl.java   
public BasicExtendedMetaData.EPackageExtendedMetaData getExtendedMetaData()
{
  return ePackageExtendedMetaData;
}
项目:eclipse-avro    文件:EPackageImpl.java   
public void setExtendedMetaData(BasicExtendedMetaData.EPackageExtendedMetaData ePackageExtendedMetaData)
{
  this.ePackageExtendedMetaData = ePackageExtendedMetaData;
}
项目:eclipse-avro    文件:EClassifierImpl.java   
public BasicExtendedMetaData.EClassifierExtendedMetaData getExtendedMetaData()
{
  return eClassifierExtendedMetaData;
}
项目:eclipse-avro    文件:EClassifierImpl.java   
public void setExtendedMetaData(BasicExtendedMetaData.EClassifierExtendedMetaData eClassifierExtendedMetaData)
{
  this.eClassifierExtendedMetaData = eClassifierExtendedMetaData;
}
项目:eclipse-avro    文件:EStructuralFeatureImpl.java   
public BasicExtendedMetaData.EStructuralFeatureExtendedMetaData getExtendedMetaData()
{
  return eStructuralFeatureExtendedMetaData;
}
项目:eclipse-avro    文件:EStructuralFeatureImpl.java   
public void setExtendedMetaData(BasicExtendedMetaData.EStructuralFeatureExtendedMetaData eStructuralFeatureExtendedMetaData)
{
  this.eStructuralFeatureExtendedMetaData = eStructuralFeatureExtendedMetaData;
}
项目:clickwatch    文件:EPackageImpl.java   
public BasicExtendedMetaData.EPackageExtendedMetaData getExtendedMetaData()
{
  return ePackageExtendedMetaData;
}
项目:clickwatch    文件:EPackageImpl.java   
public void setExtendedMetaData(BasicExtendedMetaData.EPackageExtendedMetaData ePackageExtendedMetaData)
{
  this.ePackageExtendedMetaData = ePackageExtendedMetaData;
}
项目:clickwatch    文件:EClassifierImpl.java   
public BasicExtendedMetaData.EClassifierExtendedMetaData getExtendedMetaData()
{
  return eClassifierExtendedMetaData;
}
项目:clickwatch    文件:EClassifierImpl.java   
public void setExtendedMetaData(BasicExtendedMetaData.EClassifierExtendedMetaData eClassifierExtendedMetaData)
{
  this.eClassifierExtendedMetaData = eClassifierExtendedMetaData;
}
项目:clickwatch    文件:EStructuralFeatureImpl.java   
public BasicExtendedMetaData.EStructuralFeatureExtendedMetaData getExtendedMetaData()
{
  return eStructuralFeatureExtendedMetaData;
}
项目:clickwatch    文件:EStructuralFeatureImpl.java   
public void setExtendedMetaData(BasicExtendedMetaData.EStructuralFeatureExtendedMetaData eStructuralFeatureExtendedMetaData)
{
  this.eStructuralFeatureExtendedMetaData = eStructuralFeatureExtendedMetaData;
}
项目:hybris-commerce-eclipse-plugin    文件:BeansResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public BeansResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, BeansPackage.eINSTANCE);
}
项目:tug_qt_unit_testing_fw    文件:Qt48XmlschemaQwtEnhancedResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Qt48XmlschemaQwtEnhancedResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, Qt48XmlschemaQwtEnhancedPackage.eINSTANCE);
}
项目:tug_qt_unit_testing_fw    文件:Qt48XmlSchemaResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Qt48XmlSchemaResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, Qt48XmlSchemaPackage.eINSTANCE);
}
项目:tug_qt_unit_testing_fw    文件:Qt48XmlschemaResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Qt48XmlschemaResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, Qt48XmlschemaPackage.eINSTANCE);
}
项目:OpenSPIFe    文件:EsmConfigResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EsmConfigResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, EsmConfigPackage.eINSTANCE);
}
项目:pnmlframework    文件:NupnResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NupnResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, NupnPackage.eINSTANCE);
}
项目:tool    文件:CatalogResourceFactoryImpl.java   
/**
 * Creates an instance of the resource factory.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public CatalogResourceFactoryImpl() {
    super();
    extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
    extendedMetaData.putPackage(null, CatalogPackage.eINSTANCE);
}