Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy(Please help)
[CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1343804] Fri, 09 May 2014 13:11 Go to next message
Evgeny Karataev is currently offline Evgeny KarataevFriend
Messages: 18
Registered: May 2014
Junior Member
Hello.

I am very new to the EMF and all related tooling... So please forgive me if I use some terminology wrong.

Here is what I am trying to do:

Input:
Ecore file (with a model)
A bunch of XML files with models serialized in XMI format that conforms to the ecore file. Basically each XML file is an instance of the model defined by ecore file.

Note: no generated code from the ecore file.

Output/goal:
Import data from all XML files into one repository where each xml file will a separate resource in the repository. I use CDO Hibernate with MySQL as data store.

Here is how I am trying to solve the task:

1) At first I was happy to see that there is org.eclipse.emf.cdo.server.CDOServerImporter.XML and I though that will do what I need. But after reading some posts, it seems that it creates new repository every time and it mostly intended to use for kinda backup/restore use cases. So I gave up on using this.

2) Here is what I am trying to do right now but it fails (see exception below).

Server:

I start with empty MySQL database and lunch CDO server (I took the code from examples, org.eclipse.emf.cdo.examples.hibernate.server). The server starts successfully and I see that some tables are created in MySQL database (like cdo_lob, cdo_package_info, ...).

Client:

On the client I do following:

final CDOSession session = openSession(); 


OpenSession is like in the example org.eclipse.emf.cdo.examples.hibernate.client except the part where EPackages are registered, because I don't have generated code from the model, I am trying to register EPackaged by reading them from ecore file like this (got the idea from StackOverflow emf-register-ecore-meta-model-programmatically) :

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("src\\main\\resources\\ECOREFILENAME.ecore"), true);

EPackage[] packages = readPackagesFromEcoreAsResource(r); // just iterate over r.getAllContents() and create an array of eObjects that are instances of EPackage

// Register epackages from ecore file.
for (int i = 0; i < packages.length; i++) {
	session.getPackageRegistry().putEPackage(packages[i]);
}


After that I can see in the console that epackages were registered with correct URIs (the URIs are important because that will be problem later). I am not able to post any URLs in this post because I don't have enough posts on this forum, so in the text below the URI with COMPANYWEBSITE where COMPANYWEBSITE is the url of the company used as namespace.

main [org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl] Registering COMPANYWEBSITE/sad/dsm --> org.eclipse.emf.ecore.impl.EPackageImpl@1dbe14f (name: ManualDsm) (nsURI: COMPANYWEBSITE/sad/dsm, nsPrefix: dsm)


Then I do following:

final CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.getOrCreateResource("/resource1"); 
	
resource.getContents().clear();

final Resource importResource = new XMIResourceImpl();
	      
try (InputStream is = new FileInputStream(new File("src\\main\\resources\\FILENAME.xml"))) {
				
        importResource.load(is, Collections.EMPTY_MAP);
	resource.getContents().addAll(importResource.getContents());

} catch (IOException e1) {
	e1.printStackTrace();
}


Up until now everything seems like working fine. But then when I try to commit the transaction with the following:

	      
try {
        transaction.commit();
} catch (CommitException e) {
	e.printStackTrace();
}


I get errors like this (look at the URIs, they are wrong, they include location of the ecore file):

org.eclipse.emf.cdo.util.CommitException: org.eclipse.net4j.signal.RemoteException: java.lang.IllegalStateException: Unresolvable proxy: COMPANYWEBSITE/sad/src/main/resources/ECOREFILENAME.ecore#//Dependency
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commitSynced(CDOTransactionImpl.java:1239)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1186)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1178)
	at testCDO.App.ImportXMI(App.java:433)
	at testCDO.App.main(App.java:116)
Caused by: org.eclipse.net4j.signal.RemoteException: java.lang.IllegalStateException: Unresolvable proxy: COMPANYWEBSITE/sad/src/main/resources/ECOREFILENAME.ecore#//Dependency
	at org.eclipse.net4j.signal.RequestWithConfirmation.getRemoteException(RequestWithConfirmation.java:141)
	at org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:130)
	at org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:465)
	at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:66)
	at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:57)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
	at org.eclipse.net4j.signal.Indication.execute(Indication.java:51)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Unresolvable proxy: COMPANYWEBSITE/sad/src/main/resources/ECOREFILENAME.ecore#//Dependency
	at org.eclipse.emf.cdo.common.model.EMFUtil.safeResolve(EMFUtil.java:644)
	at org.eclipse.emf.cdo.common.model.EMFUtil.safeResolveAll(EMFUtil.java:674)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:155)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:99)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:110)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:87)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:66)
	... 5 more


Please help me to resolve the problem or suggest other way to do the task.

Thank you for your feedback in advance.
Re: [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1344019 is a reply to message #1343804] Fri, 09 May 2014 15:17 Go to previous messageGo to next message
Evgeny Karataev is currently offline Evgeny KarataevFriend
Messages: 18
Registered: May 2014
Junior Member
NOT SOLVED, but, by the way, everything works if I generate code from the ecore file and use generated EPackage to register like this:

session.getPackageRegistry().putEPackage(GeneratedModelPackage.eINSTANCE);


So, it seems that the problem is in the place where I register epackages. But I still want to be able to do the task without generating code from ecore file.

Thank you for any help.
Re: [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1349369 is a reply to message #1343804] Mon, 12 May 2014 06:58 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Hi Evgeny,

If your resources have cross references among them you simply cannot just load them individually from a stream. You must
use a ResourceSet to load them; otherwise the cross references cannot be resolved. And that's the exception you're seeing.

You should have a look a our resource transfer framework which addresses this challenge. You can test it by using drag
and drop between IResources (all types possible) in your workspace and a CDO repository in the CDO Sessions view. The
underlying framework can be used without that UI.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 09.05.2014 15:17, schrieb Evgeny Karataev:
> Hello.
>
> I am very new to the EMF and all related tooling... So please forgive me if I use some terminology wrong.
>
> Here is what I am trying to do:
>
> Input:
> Ecore file (with a model)
> A bunch of XML files with models serialized in XMI format that conforms to the ecore file. Basically each XML file
> is an instance of the model defined by ecore file.
>
> Note: no generated code from the ecore file.
>
> Output/goal:
> Import data from all XML files into one repository where each xml file will a separate resource in the repository.
> I use CDO Hibernate with MySQL as data store.
>
> Here is how I am trying to solve the task:
>
> 1) At first I was happy to see that there is org.eclipse.emf.cdo.server.CDOServerImporter.XML and I though that will
> do what I need. But after reading some posts, it seems that it creates new repository every time and it mostly
> intended to use for kinda backup/restore use cases. So I gave up on using this.
>
> 2) Here is what I am trying to do right now but it fails (see exception below).
>
> Server:
>
> I start with empty MySQL database and lunch CDO server (I took the code from examples,
> org.eclipse.emf.cdo.examples.hibernate.server). The server starts successfully and I see that some tables are created
> in MySQL database (like cdo_lob, cdo_package_info, ...).
>
> Client:
>
> On the client I do following:
>
> final CDOSession session = openSession();
> OpenSession is like in the example org.eclipse.emf.cdo.examples.hibernate.client except the part where EPackages are
> registered, because I don't have generated code from the model, I am trying to register EPackaged by reading them from
> ecore file like this (got the idea from StackOverflow emf-register-ecore-meta-model-programmatically) :
>
>
> 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("src\\main\\resources\\ECOREFILENAME.ecore"), true);
>
> EPackage[] packages = readPackagesFromEcoreAsResource(r); // just iterate over r.getAllContents() and create an array
> of eObjects that are instances of EPackage
>
> // Register epackages from ecore file.
> for (int i = 0; i < packages.length; i++) {
> session.getPackageRegistry().putEPackage(packages[i]);
> }
>
>
> After that I can see in the console that epackages were registered with correct URIs (the URIs are important because
> that will be problem later). I am not able to post any URLs in this post because I don't have enough posts on this
> forum, so in the text below the URI with COMPANYWEBSITE where COMPANYWEBSITE is the url of the company used as namespace.
>
>
> main [org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl] Registering COMPANYWEBSITE/sad/dsm -->
> org.eclipse.emf.ecore.impl.EPackageImpl@1dbe14f (name: ManualDsm) (nsURI: COMPANYWEBSITE/sad/dsm, nsPrefix: dsm)
>
>
> Then I do following:
>
>
> final CDOTransaction transaction = session.openTransaction();
> CDOResource resource = transaction.getOrCreateResource("/resource1");
> resource.getContents().clear();
>
> final Resource importResource = new XMIResourceImpl();
> try (InputStream is = new FileInputStream(new File("src\\main\\resources\\FILENAME.xml"))) {
>
> importResource.load(is, Collections.EMPTY_MAP);
> resource.getContents().addAll(importResource.getContents());
>
> } catch (IOException e1) {
> e1.printStackTrace();
> }
>
>
> Up until now everything seems like working fine. But then when I try to commit the transaction with the following:
>
> try {
> transaction.commit();
> } catch (CommitException e) {
> e.printStackTrace();
> }
>
>
> I get errors like this (look at the URIs, they are wrong, they include location of the ecore file):
>
>
> org.eclipse.emf.cdo.util.CommitException: org.eclipse.net4j.signal.RemoteException: java.lang.IllegalStateException:
> Unresolvable proxy: COMPANYWEBSITE/sad/src/main/resources/ECOREFILENAME.ecore#//Dependency
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commitSynced(CDOTransactionImpl.java:1239)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1186)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1178)
> at testCDO.App.ImportXMI(App.java:433)
> at testCDO.App.main(App.java:116)
> Caused by: org.eclipse.net4j.signal.RemoteException: java.lang.IllegalStateException: Unresolvable proxy:
> COMPANYWEBSITE/sad/src/main/resources/ECOREFILENAME.ecore#//Dependency
> at org.eclipse.net4j.signal.RequestWithConfirmation.getRemoteException(RequestWithConfirmation.java:141)
> at org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:130)
> at org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:465)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:66)
> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:57)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
> at org.eclipse.net4j.signal.Indication.execute(Indication.java:51)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.IllegalStateException: Unresolvable proxy:
> COMPANYWEBSITE/sad/src/main/resources/ECOREFILENAME.ecore#//Dependency
> at org.eclipse.emf.cdo.common.model.EMFUtil.safeResolve(EMFUtil.java:644)
> at org.eclipse.emf.cdo.common.model.EMFUtil.safeResolveAll(EMFUtil.java:674)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:155)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:99)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:110)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:87)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:92)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:66)
> ... 5 more
>
>
> Please help me to resolve the problem or suggest other way to do the task.
>
> Thank you for your feedback in advance.
Re: [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1357303 is a reply to message #1349369] Thu, 15 May 2014 13:07 Go to previous messageGo to next message
Evgeny Karataev is currently offline Evgeny KarataevFriend
Messages: 18
Registered: May 2014
Junior Member
Thank you Eike,

I am sorry if what I say doesn't make much send, I am very new to EMF and CDO world.

> If your resources have cross references among them you simply cannot just load them individually from a stream.

So, if I use the same ResourceSet to open all resources, then it might work, right?

I have tried it but still have the same unresovable proxy exception. Here is what I did (I use the same ResourceSet to create both resources, I pass rs variable to openSession method which uses it to create resource):

ResourceSet rs = new ResourceSetImpl();
		
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
    "ecore", new EcoreResourceFactoryImpl());
	
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
    "xml", new XMIResourceFactoryImpl());

// enable extended metadata
final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());

rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
		
final CDOSession session = openSession(rs, "src\\main\\resources\\ECOREFILENAME.ecore");
		
final CDOTransaction transaction = session.openTransaction();
// get/create a resource

CDOResource resource = transaction.getOrCreateResource("/resource1"); //$NON-NLS-1$
	
// clear any previous data
resource.getContents().clear();
	      
final Resource importResource = rs.getResource(URI.createFileURI("src\\main\\resources\\FILENAME.xml"), true); 
	      
try { 

        resource.getContents().addAll(importResource.getContents());
} catch (Exception e1) {
	// TODO Auto-generated catch block
	e1.printStackTrace();
}


Thank you.
Re: [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1357517 is a reply to message #1357303] Thu, 15 May 2014 15:03 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Am 15.05.2014 15:07, schrieb Evgeny Karataev:
> Thank you Eike,
>
> I am sorry if what I say doesn't make much send, I am very new to EMF and CDO world.
>> If your resources have cross references among them you simply cannot just load them individually from a stream.
>
> So, if I use the same ResourceSet to open all resources, then it might work, right?
>
> I have tried it but still have the same unresovable proxy exception. Here is what I did (I use the same ResourceSet to
> create both resources, I pass rs variable to openSession method which uses it to create resource):
That doesn't make sense to me, but maybe that's because you don't show what your openSession() does exactly. In CDO a
transaction - not a session - is associated with a resource set.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
>
> ResourceSet rs = new ResourceSetImpl();
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
> "ecore", new EcoreResourceFactoryImpl());
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
> "xml", new XMIResourceFactoryImpl());
>
> // enable extended metadata
> final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
>
> rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>
> final CDOSession session = openSession(rs, "src\\main\\resources\\ECOREFILENAME.ecore");
>
> final CDOTransaction transaction = session.openTransaction();
> // get/create a resource
>
> CDOResource resource = transaction.getOrCreateResource("/resource1"); //$NON-NLS-1$
>
> // clear any previous data
> resource.getContents().clear();
> final Resource importResource = rs.getResource(URI.createFileURI("src\\main\\resources\\FILENAME.xml"),
> true); try {
> resource.getContents().addAll(importResource.getContents());
> } catch (Exception e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
>
>
> Thank you.
>
Re: [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1357877 is a reply to message #1357517] Thu, 15 May 2014 18:40 Go to previous messageGo to next message
Evgeny Karataev is currently offline Evgeny KarataevFriend
Messages: 18
Registered: May 2014
Junior Member
Thank you for your reply. Here is what openSession method does:

protected CDOSession openSession(ResourceSet rs, String ecoreFileLocation)
{
	if (sessionConfiguration == null)
	{
	      initialize();
	}

	CDONet4jSession cdoSession = sessionConfiguration.openNet4jSession();
	    
	Resource r = rs.getResource(URI.createFileURI(ecoreFileLocation), true);
		
	EPackage[] packages = readPackagesFromEcoreResource(r);
	    
	for (int i = 0; i < packages.length; i++) {
		 cdoSession.getPackageRegistry().putEPackage(packages[i]);
	}
	    
        return cdoSession;
}

private static EPackage[] readPackagesFromEcoreResource(Resource resource) {
		
	List<EPackage> ePackages = new ArrayList<EPackage>();

	TreeIterator<EObject> treeIter = resource.getAllContents();
	while(treeIter.hasNext()){
		EObject eObject = treeIter.next();
		if (eObject instanceof EPackage) {
			EPackage p = (EPackage)eObject;
		        ePackages.add(p);
		}
	}
		
	return ePackages.toArray(new EPackage[] {});
}

protected void initialize()
{
	    OMPlatform.INSTANCE.setDebugging(true);
	    OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
	    OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);

	    // Prepare container
	    final IManagedContainer container = ContainerUtil.createContainer();
	    Net4jUtil.prepareContainer(container); // Register Net4j factories
	    TCPUtil.prepareContainer(container); // Register TCP factories
	    CDONet4jUtil.prepareContainer(container); // Register CDO factories
	    // LifecycleUtil.activate(container);
	    container.activate();

	    // Create connector
	    final IConnector connector = TCPUtil.getConnector(container, CONNECTION_ADDRESS);

	    // Create configuration
	    sessionConfiguration = CDONet4jUtil.createNet4jSessionConfiguration();
	    sessionConfiguration.setConnector(connector);
	    sessionConfiguration.setRepositoryName(REPO_NAME);
}
Re: [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1358780 is a reply to message #1357877] Fri, 16 May 2014 03:51 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Hi Evgeny,

it seems to be a problem with dynamic packages, but without the actual packages I can't tell what it is. Can you attach
an executable version of your project so that I can analyze the problem? If you can't post it to the public you could
send a zip to me privately.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Am 15.05.2014 20:40, schrieb Evgeny Karataev:
> Thank you for your reply. Here is what openSession method does:
>
>
> protected CDOSession openSession(ResourceSet rs, String ecoreFileLocation)
> {
> if (sessionConfiguration == null)
> {
> initialize();
> }
>
> CDONet4jSession cdoSession = sessionConfiguration.openNet4jSession();
> Resource r = rs.getResource(URI.createFileURI(ecoreFileLocation), true);
>
> EPackage[] packages = readPackagesFromEcoreResource(r);
> for (int i = 0; i < packages.length; i++) {
> cdoSession.getPackageRegistry().putEPackage(packages[i]);
> }
> return cdoSession;
> }
>
> private static EPackage[] readPackagesFromEcoreResource(Resource resource) {
>
> List<EPackage> ePackages = new ArrayList<EPackage>();
>
> TreeIterator<EObject> treeIter = resource.getAllContents();
> while(treeIter.hasNext()){
> EObject eObject = treeIter.next();
> if (eObject instanceof EPackage) {
> EPackage p = (EPackage)eObject;
> ePackages.add(p);
> }
> }
>
> return ePackages.toArray(new EPackage[] {});
> }
>
> protected void initialize()
> {
> OMPlatform.INSTANCE.setDebugging(true);
> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
>
> // Prepare container
> final IManagedContainer container = ContainerUtil.createContainer();
> Net4jUtil.prepareContainer(container); // Register Net4j factories
> TCPUtil.prepareContainer(container); // Register TCP factories
> CDONet4jUtil.prepareContainer(container); // Register CDO factories
> // LifecycleUtil.activate(container);
> container.activate();
>
> // Create connector
> final IConnector connector = TCPUtil.getConnector(container, CONNECTION_ADDRESS);
>
> // Create configuration
> sessionConfiguration = CDONet4jUtil.createNet4jSessionConfiguration();
> sessionConfiguration.setConnector(connector);
> sessionConfiguration.setRepositoryName(REPO_NAME);
> }
>
Re: [CDO/Hibernate]Import data from XMI files to an existing repository - Unresolved proxy [message #1369431 is a reply to message #1358780] Tue, 20 May 2014 15:35 Go to previous message
Evgeny Karataev is currently offline Evgeny KarataevFriend
Messages: 18
Registered: May 2014
Junior Member
Thank you Eike for helping. Unfortunately the code I have right cannot be shared. I will try recreate it with a toy example and then share it here.
Previous Topic:ecore references
Next Topic:[EMF Query] Using EMF Query outside Eclipse (with OCL)
Goto Forum:
  


Current Time: Mon Dec 22 21:37:48 GMT 2014

Powered by FUDForum. Page generated in 0.01779 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software