Datapool from standalone application [message #65603] |
Tue, 11 April 2006 11:41  |
Eclipse User |
|
|
|
Originally posted by: mindism.yahoo.com
Hi,
What actions must be taken (registration of unzipping EMF resource
factories etc.) in order to be able use Datapools from standalone
application (not in execution agent).
For instance:
//Initialize the datapool factory
IDatapoolFactory dpFactory = new Common_DatapoolFactoryImpl();
// Load the shoppingCartDatapool datapool
URL testDataPoolURL = getClass().getResource("x.datapool");
IDatapool datapool = dpFactory.load(
new File(testDataPoolURL.toURI()),
false);
assertNotNull(datapool);
// Create an iterator to traverse the datapool
IDatapoolIterator dpIterator =
dpFactory.open(datapool," org.eclipse.hyades.datapool.iterator.DatapoolIteratorSequent ialPrivate ");
// Initialize the datapool to traverse the first equivalence class.
dpIterator.dpInitialize(datapool,0);
Thanks,
Mindaugas
|
|
|
|
Re: Datapool from standalone application [message #98694 is a reply to message #65603] |
Tue, 15 May 2007 09:20  |
Eclipse User |
|
|
|
Originally posted by: stolp.verit.de
Hi,
since I suffered through this as well, just two quick additions which
might be of help to people who have the same problem:
1. With Eclipse 3.2 you will also need
org.eclipse.equinox.common_${Version}.jar on your classpath since this
contains the missing org.eclipse.core.runtime.IAdaptable class. As of
TPTP 4.3.1 this is not part of the documentation yet.
2. To successfully load the datapool resource you will have to add the
missing resource registration for the .datapool extension like in:
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
ICommonConstants.DATAPOOL_FILE_EXTENSION,
new DatapoolFacadeResourceFactoryImpl());
As noted in the thread entitled "Datapool and" in this newsgroup the
exception leading to the above solution (Cannot create a resource for '"
+ uri + "'; a registered resource factory is needed" ) gets suppressed
in the Common_DatapoolFactoryImpl.loadForEdit(File, boolean) method
where it will show up as "Datapool could not be loaded from file ..."
DatapoolException.
Please note that this applies to a standalone invocation.
Hope this helps,
Torsten
Paul Slauenwhite wrote:
> Hi Mindaugas,
> You will find ht necessary code snippets for programmatically
accessing
> TPTP datapools in the TPTP documentation:
>
> Help >> Help Contents >> Testing automatically and manually >> Testing
> automatically and manually >> Tutorial: Accessing a datapool from a JUnit
> test
>
> Paul
> "Mindaugas Malinauskas" <mindism@yahoo.com> wrote in message
> news:e1gimp$ad1$1@utils.eclipse.org...
>> Hi,
>>
>> What actions must be taken (registration of unzipping EMF resource
>> factories etc.) in order to be able use Datapools from standalone
>> application (not in execution agent).
>> For instance:
>>
>> //Initialize the datapool factory
>> IDatapoolFactory dpFactory = new Common_DatapoolFactoryImpl();
>>
>> // Load the shoppingCartDatapool datapool
>> URL testDataPoolURL = getClass().getResource("x.datapool");
>> IDatapool datapool = dpFactory.load(
>> new File(testDataPoolURL.toURI()),
>> false);
>>
>> assertNotNull(datapool);
>> // Create an iterator to traverse the datapool
>> IDatapoolIterator dpIterator =
>>
>
dpFactory.open(datapool,"org.eclipse.hyades.datapool.iterator.DatapoolIterat
> orSequentialPrivate");
>> // Initialize the datapool to traverse the first equivalence class.
>> dpIterator.dpInitialize(datapool,0);
>>
>>
>> Thanks,
>>
>> Mindaugas
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.08030 seconds