Search in sources :

Example 1 with DatabaseResourceFactoryImpl

use of org.obeonetwork.dsl.database.util.DatabaseResourceFactoryImpl in project InformationSystem by ObeoNetwork.

the class TestReverse method loadModel.

private static DataBase loadModel(String databaseTestPluginRelativePath, String typesLibraryPathmapUri) {
    URI uri = URI.createFileURI(databaseTestPluginRelativePath);
    DatabaseResourceFactoryImpl databaseResourceFactory = new DatabaseResourceFactoryImpl();
    Resource resourceDatabase = databaseResourceFactory.createResource(uri);
    TypesLibraryResourceFactoryImpl typesLibraryresourceFactory = new TypesLibraryResourceFactoryImpl();
    Resource typeResource = typesLibraryresourceFactory.createResource(URI.createURI(typesLibraryPathmapUri));
    ResourceSet rs = new ResourceSetImpl();
    rs.getResources().add(resourceDatabase);
    rs.getResources().add(typeResource);
    try {
        Map options = rs.getLoadOptions();
        options.put(DatabasePackage.eINSTANCE.getNsURI(), DatabasePackage.eINSTANCE);
        options.put(TypesLibraryPackage.eINSTANCE.getNsURI(), TypesLibraryPackage.eINSTANCE);
        resourceDatabase.load(options);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return (DataBase) resourceDatabase.getContents().get(0);
}
Also used : DatabaseResourceFactoryImpl(org.obeonetwork.dsl.database.util.DatabaseResourceFactoryImpl) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) Resource(org.eclipse.emf.ecore.resource.Resource) TypesLibraryResourceFactoryImpl(org.obeonetwork.dsl.typeslibrary.util.TypesLibraryResourceFactoryImpl) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) URI(org.eclipse.emf.common.util.URI) Map(java.util.Map) DataBase(org.obeonetwork.dsl.database.DataBase)

Example 2 with DatabaseResourceFactoryImpl

use of org.obeonetwork.dsl.database.util.DatabaseResourceFactoryImpl in project InformationSystem by ObeoNetwork.

the class DatabaseCompareAbstractTestSuite method createResourceSet.

/**
 * Creates a {@link ResourceSet} properly initialized for Database,
 * Dbevolution, EMFCompare and XMI models.
 *
 * @return
 */
protected static ResourceSet createResourceSet() {
    final ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getPackageRegistry().put(DatabasePackage.eNS_URI, DatabasePackage.eINSTANCE);
    resourceSet.getPackageRegistry().put(DbevolutionPackage.eNS_URI, DbevolutionPackage.eINSTANCE);
    resourceSet.getPackageRegistry().put(ComparePackage.eNS_URI, ComparePackage.eINSTANCE);
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("dbevolution", new XMIResourceFactoryImpl());
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("database", new DatabaseResourceFactoryImpl());
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("typeslibrary", new XMIResourceFactoryImpl());
    return resourceSet;
}
Also used : DatabaseResourceFactoryImpl(org.obeonetwork.dsl.database.util.DatabaseResourceFactoryImpl) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) XMIResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet)

Example 3 with DatabaseResourceFactoryImpl

use of org.obeonetwork.dsl.database.util.DatabaseResourceFactoryImpl in project InformationSystem by ObeoNetwork.

the class AbtractTest method standaloneBootStrap.

protected void standaloneBootStrap(ResourceSet resourceSet) {
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new DatabaseResourceFactoryImpl());
    resourceSet.getPackageRegistry().put(DatabasePackage.eNS_URI, DatabasePackage.eINSTANCE);
    resourceSet.getPackageRegistry().put(DbevolutionPackage.eNS_URI, DbevolutionPackage.eINSTANCE);
}
Also used : DatabaseResourceFactoryImpl(org.obeonetwork.dsl.database.util.DatabaseResourceFactoryImpl)

Aggregations

DatabaseResourceFactoryImpl (org.obeonetwork.dsl.database.util.DatabaseResourceFactoryImpl)3 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)2 Map (java.util.Map)1 URI (org.eclipse.emf.common.util.URI)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 XMIResourceFactoryImpl (org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl)1 DataBase (org.obeonetwork.dsl.database.DataBase)1 TypesLibraryResourceFactoryImpl (org.obeonetwork.dsl.typeslibrary.util.TypesLibraryResourceFactoryImpl)1