Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Help with Porting over to Indigo
Help with Porting over to Indigo [message #764768] Mon, 12 December 2011 20:15 Go to next message
Kenneth Cheung is currently offline Kenneth CheungFriend
Messages: 9
Registered: July 2009
Junior Member
Hi,

We are porting our code to Indigo and found some API changes. We try to come up with a list of mappings between the old and new APIs to the best of our abilities. Is anyone able to verify and complete the list? Thanks!

org.eclipse.jpt.core.context.java.JavaManyToManyRelationshipReference
->
org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship

org.eclipse.jpt.core.context.orm.OrmPersistentAttribute.makeSpecified(String mappingKey)
-> org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute.convertToSpecified(String mappingKey)

org.eclipse.jpt.core.context.PersistentAttribute.setSpecifiedMappingKey(String key) ->
org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute.setMappingKey(String key)

org.eclipse.jpt.jpa.core.context.Converter.TEMPORAL_CONVERTER
->
org.eclipse.jpt.jpa.core.context.TemporalConverter.class

org.eclipse.jpt.jpa.core.context.ConvertibleMapping.setConverter(Converter.TEMPORAL_CONVERTER)
->
org.eclipse.jpt.jpa.core.context.ConvertibleMapping.setConverter(TemporalConverter.class)

org.eclipse.jpt.core.context.orm.OrmXml.getEntityMappings()
->
org.eclipse.jpt.jpa.core.context.orm.OrmXml.getEntityMappings().getRoot()

org.eclipse.jpt.core.context.PersistentAttribute.getSpecifiedMapping()
->
org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute.getMapping()

org.eclipse.jpt.core.context.PersistentType.getShortName()
->
org.eclipse.jpt.jpa.core.context.PersistentType.getSimpleName()

org.eclipse.jpt.core.JpaProject.Updater->??

org.eclipse.jpt.core.internal.SynchronousJpaProjectUpdater->??
Re: Help with Porting over to Indigo [message #766473 is a reply to message #764768] Thu, 15 December 2011 21:10 Go to previous messageGo to next message
Brian Vosburgh is currently offline Brian VosburghFriend
Messages: 137
Registered: July 2009
Senior Member
Kenneth Cheung wrote on Mon, 12 December 2011 15:15

org.eclipse.jpt.core.JpaProject.Updater->??

org.eclipse.jpt.core.internal.SynchronousJpaProjectUpdater->??


Your list looks reasonably accurate. To fill in your missing entries:

JpaProject.Updater -> org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer

SynchronousJpaProjectUpdater -> org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer

Also, I have to warn you that these two classes are set to change yet again in Juno. :-) The API for making "large" changes to a Dali JpaProject should be much simpler with the next milestone. At least that's the hope.

Brian
Re: Help with Porting over to Indigo [message #766478 is a reply to message #764768] Thu, 15 December 2011 21:31 Go to previous messageGo to next message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
Just a few more comments.

Quote:
org.eclipse.jpt.core.context.orm.OrmXml.getEntityMappings()
->
org.eclipse.jpt.jpa.core.context.orm.OrmXml.getEntityMappings().getRoot()

The new api is just OrmXml.getRoot(), I'm guessing this was just a typo

Quote:
org.eclipse.jpt.core.context.PersistentAttribute.getSpecifiedMapping()
->
org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute.getMapping()

This API is somewhat different since the new API would never return null. You can ask the returned AttributeMapping if it isDefault() (vs. specified). The getSpecifiedMapping() api has been removed.

Karen
Re: Help with Porting over to Indigo [message #768812 is a reply to message #766478] Tue, 20 December 2011 21:13 Go to previous messageGo to next message
Kenneth Cheung is currently offline Kenneth CheungFriend
Messages: 9
Registered: July 2009
Junior Member
Thanks all!

Also does it still apply?

Changing the Context model programatically
If you are changing the model outside the UI thread you will need to configure the JPA project to make modifications on the UI thread as necessary. See JpaProject#setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor).

Also note the model is "updated" asynchronously with every change. If you want these updates to happen synchronously, you will need to set the JPA project's "updater". See JpaProject#setUpdater(Updater). Note the comments in SynchronousJpaProjectUpdater.


If so what is the new way of doing it?
Re: Help with Porting over to Indigo [message #772004 is a reply to message #768812] Wed, 28 December 2011 19:18 Go to previous messageGo to next message
Brian Vosburgh is currently offline Brian VosburghFriend
Messages: 137
Registered: July 2009
Senior Member
Quote:
Also does it still apply?

Yes.
Quote:
If so what is the new way of doing it?

It's a bit more painful with Indigo. (It will be much better with Juno.) You need to set a couple of synchronizers on the JpaProject. This example code is lifted from the Dali test harness (org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject):
this.jpaProject.setContextModelSynchronizer(this.buildSynchronousCMS());
this.jpaProject.setUpdateSynchronizer(this.buildSynchronousUS());

protected Synchronizer buildSynchronousCMS() {
	return new SynchronousSynchronizer(this.buildSynchronousCMSCommand());
}

protected Command buildSynchronousCMSCommand() {
	return new SynchronousContextModelSynchronizerCommand();
}

protected class SynchronousContextModelSynchronizerCommand implements Command {
	public void execute() {
		TestJpaProject.this.jpaProject.synchronizeContextModel(new NullProgressMonitor());
	}
}

protected CallbackSynchronizer buildSynchronousUS() {
	return new CallbackSynchronousSynchronizer(this.buildSynchronousUSCommand());
}

protected Command buildSynchronousUSCommand() {
	return new SynchronousUpdateSynchronizerCommand();
}

protected class SynchronousUpdateSynchronizerCommand implements Command {
	public void execute() {
		TestJpaProject.this.jpaProject.update(new NullProgressMonitor());
	}
}
Re: Help with Porting over to Indigo [message #778504 is a reply to message #772004] Thu, 12 January 2012 22:30 Go to previous messageGo to next message
Kenneth Cheung is currently offline Kenneth CheungFriend
Messages: 9
Registered: July 2009
Junior Member
Thanks I'd never have figured it out myself.
Re: Help with Porting over to Indigo [message #1711277 is a reply to message #764768] Wed, 14 October 2015 14:15 Go to previous messageGo to next message
Miranda Jane is currently offline Miranda JaneFriend
Messages: 1
Registered: October 2015
Junior Member
Hi,

Can you help me with porting to Mars the following class:
org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer
The changes in the packages are big and it is hard to map it. Thanks in advance.
Re: Help with Porting over to Indigo [message #1712736 is a reply to message #1711277] Tue, 27 October 2015 18:33 Go to previous message
Brian Vosburgh is currently offline Brian VosburghFriend
Messages: 137
Registered: July 2009
Senior Member
I'm sorry about the delayed response.

Can you explain what you are trying to do with SynchronousJpaProjectUpdater?
Testing? Executing a background job? This stuff has changed a lot; there is no super simple migration to Mars.

You might start with looking at JpaProjectManager.execute(Command, ExtendedCommandContext) and references to it.

Brian
Previous Topic:JPA-Diagram Editor + JUnit4 Test Synch
Next Topic:Generated classes recreated after delete
Goto Forum:
  


Current Time: Tue Apr 23 11:25:46 GMT 2024

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

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

Back to the top