Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO export/import of data(CDO export/import of data)
CDO export/import of data [message #1018295] Wed, 13 March 2013 15:17 Go to next message
Andrew Whelan is currently offline Andrew Whelan
Messages: 69
Registered: October 2012
Location: Syracuse NY
Member
Greetings,

I am just looking for affirmation on what I suspect is the extent of the CDO import/export functionality that is currently available to clients.

Class org.eclipse.emf.cdo.server.CDOServerExporter.XML has functionality to export a full repository to an XML file.

Class org.eclipse.emf.cdo.server.CDOServerImporter.XML has functionality to import a full repository from an XML file to a new repository.

There is currently no functionality that will let you export a few records (maybe filtered on timestamp and branch) to an XML file and then import those records into a repository that already exists and has data in it.

Does this sound correct? Thanks!
Re: CDO export/import of data [message #1018375 is a reply to message #1018295] Wed, 13 March 2013 18:06 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5525
Registered: July 2009
Senior Member
Am 13.03.2013 16:17, schrieb Andrew Whelan:
> Greetings,
>
> I am just looking for affirmation on what I suspect is the extent of the CDO import/export functionality that is
> currently available to clients.
>
> Class org.eclipse.emf.cdo.server.CDOServerExporter.XML has functionality to export a full repository to an XML file.
Yes.

> Class org.eclipse.emf.cdo.server.CDOServerImporter.XML has functionality to import a full repository from an XML file
> to a new repository.
Yes.

> There is currently no functionality that will let you export a few records (maybe filtered on timestamp and branch) to
> an XML file and then import those records into a repository that already exists and has data in it.
>
> Does this sound correct?
Yes. This export/import is really more a backup/restore kind of thing. What you're talking about can be accomplished on
the CDO client side with code that works with pure EMF APIs. And there is the new (client side) CDO transfer framework
that also backs the drag and drop from and into the workspace or the external file system.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: CDO export/import of data [message #1020730 is a reply to message #1018375] Mon, 18 March 2013 20:20 Go to previous messageGo to next message
Andrew Whelan is currently offline Andrew Whelan
Messages: 69
Registered: October 2012
Location: Syracuse NY
Member
Eike,
I'm just looking for some verification here. It doesn't look like CDOServerImporter.XML/CDOServerExporter.XML works with qualifiedNames=true does it? With MySQL I end up with Table 'nighthawk.cdoresourcefolder' doesn't exist. "nighthawk" is the schema name and there is no cdoresourcefolder when Table qualifiedNames=true, but there is with qualifiedNames=false.

Re: CDO export/import of data [message #1021223 is a reply to message #1020730] Tue, 19 March 2013 17:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5525
Registered: July 2009
Senior Member
Am 18.03.2013 21:20, schrieb Andrew Whelan:
> Eike,
> I'm just looking for some verification here. It doesn't look like CDOServerImporter.XML/CDOServerExporter.XML works
> with qualifiedNames=true does it?
I'm not exactly sure what"works with" means. CDOServerExporter.XML.exportRevision(XMLOutput, CDORevision) outputs a
fully qualified class:

out.attribute(REVISION_CLASS, new CDOClassifierRef(rev.getEClass()).getURI());

CDOServerImporter imports into a repository that you have to instantiate yourself, not activate it and then pass it into
the constructor of CDOServerImporter. So qualifiedNames is set to whatever you created this repository with.

Does that help?

Cheers
/Eike

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


> With MySQL I end up with Table 'nighthawk.cdoresourcefolder' doesn't exist. "nighthawk" is the schema name and there
> is no cdoresourcefolder when Table qualifiedNames=true, but there is with qualifiedNames=false.
Re: CDO export/import of data [message #1021330 is a reply to message #1021223] Tue, 19 March 2013 21:59 Go to previous messageGo to next message
Andrew Whelan is currently offline Andrew Whelan
Messages: 69
Registered: October 2012
Location: Syracuse NY
Member
Eike Stepper wrote on Tue, 19 March 2013 13:21
Am 18.03.2013 21:20, schrieb Andrew Whelan:
> Eike,
> I'm just looking for some verification here. It doesn't look like CDOServerImporter.XML/CDOServerExporter.XML works
> with qualifiedNames=true does it?
I'm not exactly sure what"works with" means. CDOServerExporter.XML.exportRevision(XMLOutput, CDORevision) outputs a
fully qualified class:

out.attribute(REVISION_CLASS, new CDOClassifierRef(rev.getEClass()).getURI());

CDOServerImporter imports into a repository that you have to instantiate yourself, not activate it and then pass it into
the constructor of CDOServerImporter. So qualifiedNames is set to whatever you created this repository with.

Does that help?

Cheers
/Eike

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


> With MySQL I end up with Table 'nighthawk.cdoresourcefolder' doesn't exist. "nighthawk" is the schema name and there
> is no cdoresourcefolder when Table qualifiedNames=true, but there is with qualifiedNames=false.



I created the repository (named nighthawk using MySQL) with qualifiedNames=true

When I try to export I get the following exception. It doesn't happen using the Library model with qualifiedNames=false. The nightawk model needs to have qualifiedNames=true because the model has a couple of elements named "state". There are probably other duplicated element names where a qualified name makes them unique. Any ideas if I am doing something wrong here? (BTW: If I haven't said it enough, your help is greatly appreciated!).

Exception in thread "main" org.eclipse.net4j.db.DBException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'nighthawk.cdoresourcefolder' doesn't exist
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalMappingStrategy.queryResources(AbstractHorizontalMappingStrategy.java:445)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalMappingStrategy.queryResources(AbstractHorizontalMappingStrategy.java:121)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.queryResources(DBStoreAccessor.java:303)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.readResourceID(StoreAccessorBase.java:214)
at org.eclipse.emf.cdo.internal.server.Repository.readRootResource(Repository.java:1809)
at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1914)
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:76)
at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalActivate(ShareableLifecycle.java:43)
at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:162)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:213)
at org.eclipse.example.library.tests.TestCDO.Export(TestCDO.java:261)
at org.eclipse.example.library.tests.TestCDO.main(TestCDO.java:349)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'nighthawk.cdoresourcefolder' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1912)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalMappingStrategy.queryResources(AbstractHorizontalMappingStrategy.java:424)
... 13 more

Re: CDO export/import of data [message #1021344 is a reply to message #1021330] Tue, 19 March 2013 22:37 Go to previous messageGo to next message
Andrew Whelan is currently offline Andrew Whelan
Messages: 69
Registered: October 2012
Location: Syracuse NY
Member
Forget the last response. I was confusing concepts, I'm tired and I need to go home. The "nighthawk" we see in the exception is the name of the schema I created for the MySQL database. I am also using a model named nighthawk but that isn't your concern.

If I run the CDOServer with qualifiedNames=false and use the Library model, I can import and export just fine. The database schema that is generated has a cdoresourcefolder table.

If I have qualifiedNames=true and use the Library model there is no cdoresourcefolder generated.

If I try to run the export I get the exception I reported. I can't use qualifiedNames=false with my model because it has duplicate element names that are distinguished by qualified names. Sorry about the confusion in the last response.

Does that make sense?

Thanks for all of your help, sorry for the brainfart.
Re: CDO export/import of data [message #1021787 is a reply to message #1021344] Wed, 20 March 2013 17:19 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5525
Registered: July 2009
Senior Member
Am 19.03.2013 23:37, schrieb Andrew Whelan:
> Forget the last response. I was confusing concepts, I'm tired and I need to go home. The "nighthawk" we see in the
> exception is the name of the schema I created for the MySQL database. I am also using a model named nighthawk but that
> isn't your concern.
>
> If I run the CDOServer with qualifiedNames=false and use the Library model, I can import and export just fine. The
> database schema that is generated has a cdoresourcefolder table.
>
> If I have qualifiedNames=true and use the Library model there is no cdoresourcefolder generated.
>
> If I try to run the export I get the exception I reported. I can't use qualifiedNames=false with my model because it
> has duplicate element names that are distinguished by qualified names. Sorry about the confusion in the last response.
>
> Does that make sense?
Have you tried it with H2 to get an indication whether the problem depends on the DB type?

qualifiedNames==true must work. If it doesn't it may be a bug and you should report it.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: CDO export/import of data [message #1021848 is a reply to message #1021787] Wed, 20 March 2013 19:39 Go to previous message
Andrew Whelan is currently offline Andrew Whelan
Messages: 69
Registered: October 2012
Location: Syracuse NY
Member
I will try H2. I'll be back. If its a bug I will create a report. Thanks!
Previous Topic:[CDO/DBStore]
Next Topic:[CDO/EMF] Ecore SubPackages & CDOPackage reading
Goto Forum:
  


Current Time: Tue Sep 23 12:40:43 GMT 2014

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

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