Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EPF » Getting RoleSets from XMI files
Getting RoleSets from XMI files [message #49785] Fri, 25 April 2008 09:22 Go to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Hi,

I can list all the roles from my EPF Composer model, I can also list all
the tasks and phases, as well as the work products, etc.

But I can't find a way to get the RoleSets. I'd like to list the RoleSets
and then get the Roles from them.

Here is an example of how I can list all the roles (and also the rolesets,
but there's apparently no way to know whether it's a roleset or a role) :

Resource resource = resourceSet.getResource(fileURI,true);
for (Iterator i = resource.getAllContents(); i.hasNext();) {
Object o = i.next();
if (o instanceof RoleDescriptorImpl) {
RoleDescriptorImpl rdi = (RoleDescriptorImpl)o;
System.out.println(" - Role : " + rdi.getPresentationName());
}
}

And by the way, I get no "RoleSetImpl" from resource.getAllContents().

I also have the same problem for Work Products and Work Product Types. I
can list the Work Products but I can't have the Work Product Types.

Thanks in advance,

Quentin
Re: Getting RoleSets from XMI files [message #49844 is a reply to message #49785] Fri, 25 April 2008 12:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.


Quentin DEME wrote:
> Hi,
>
> I can list all the roles from my EPF Composer model, I can also list
> all the tasks and phases, as well as the work products, etc.
>
> But I can't find a way to get the RoleSets. I'd like to list the
> RoleSets and then get the Roles from them.
>
> Here is an example of how I can list all the roles (and also the
> rolesets, but there's apparently no way to know whether it's a roleset
> or a role) :
>
> Resource resource = resourceSet.getResource(fileURI,true);
> for (Iterator i = resource.getAllContents(); i.hasNext();) {
> Object o = i.next();
> if (o instanceof RoleDescriptorImpl) {
Try to avoid using Impl classes of the models. Using RoleDescriptor
should be sufficient for all your purposes.
> RoleDescriptorImpl rdi = (RoleDescriptorImpl)o;
> System.out.println(" - Role : " + rdi.getPresentationName());
> }
> }
>
> And by the way, I get no "RoleSetImpl" from resource.getAllContents().
I'm not sure how a RoleSet relates to a RoleDescriptor...
>
> I also have the same problem for Work Products and Work Product Types.
> I can list the Work Products but I can't have the Work Product Types.
I know nothing about this model, but my guess would be that these things
are contained in different resources while the above will only give you
the direct contents of the first resource. There's probably a better
way to get to them than by brute force, but I'd have to know the model
structure to know that, and I don't. For a brute force approach, try
resourceSet.getAllContents() to visit all the resources in the resource set.
>
> Thanks in advance,
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #49874 is a reply to message #49844] Fri, 25 April 2008 12:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Thank you for your reply,

You said that I should avoid using Impl classes, but when I use
getAllContents(), I only get Impl classes.

And, when I have an instance of RoleDescriptorImpl for example, I can use
RoleDescriptorImpl.getRole(), to get a "Role" class. So, in any cases, I
never get the "RoleDescriptor" class.

How can I get this kind of classes ?

I tried resourceSet.getAllContents(), but I get approximatively the same
results than before, because I apparently have only one resource.

Also, I can list guidelines from phases for example, but is it possible to
get all the guidelines independantly of the components they belong to ?
(all in the same iteration)

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #49903 is a reply to message #49874] Fri, 25 April 2008 13:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.

Quentin DEME wrote:
> Thank you for your reply,
>
> You said that I should avoid using Impl classes, but when I use
> getAllContents(), I only get Impl classes.
Yes, you get implementation classes of the public APIs. But that
doesn't mean you show be using those implementation classes in your
code. Similarly if you use an IFile, you'll end up with File
implementation class that you cannot use in your code because it's not
exported by the plugin.
>
> And, when I have an instance of RoleDescriptorImpl for example, I can
> use RoleDescriptorImpl.getRole(), to get a "Role" class. So, in any
> cases, I never get the "RoleDescriptor" class.
I think you're overlooking thef act that RoleDescriptorImpl implements
the RoleDescriptor interface and that the interface is the public API
you should be using.
>
> How can I get this kind of classes ?
The same way you got the Impl classes, but from the Java package that
has the API rather than the Java package that contains all the
implementation classes for that API.
>
> I tried resourceSet.getAllContents(), but I get approximatively the
> same results than before, because I apparently have only one resource.
This seems to imply there is only one resource and it does not contain
any of the data of the type you are looking for nor does it contain
reference to other resources. Does that make sense?
>
> Also, I can list guidelines from phases for example, but is it
> possible to get all the guidelines independantly of the components
> they belong to ? (all in the same iteration)
It seems to me your approach of visiting the whole resource would be the
way, but given my complete lack of knowledge about the model I can only
make guesses. What kind of relationship gets you from a phrase to a
guideline and how does that relate to this RoleSet thing... You might
just try to print out every "o" you visit to get a better sense of all
the objects contained in the resource...
>
> Thank you,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #49933 is a reply to message #49903] Fri, 25 April 2008 14:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Then how can I access the RoleDescriptor Interface ? I know that the
"path" is "org.eclipse.epf.uma.RoleDescriptor", but I don't know what to
do with this, since it has to be synchronized with the EPF Composer model
I've loaded just before, using : resourceSet.getResource(fileURI, true)

You said : "This seems to imply there is only one resource and it does not
contain any of the data of the type you are looking for nor does it
contain reference to other resources. Does that make sense?"
--> Yes it seems so, you're right.. that's why I'm really confused, because
the EPF Composer model I've been given effectively contains elements that have
been declared.

About the fact you don't know the model, I'm really sorry but the model is
"company confidential"... I'd like to quickly introduce you to it, but I
can't.

I can tell you that for example, in the "Business Development" phase,
there is a guideline associated to it, which explains some points about
marketing requirements.

But no connection with the RoleSets.. it's another problem (being able to
list the rolesets, and then the roles corresponding to them).
Re: Getting RoleSets from XMI files [message #50001 is a reply to message #49933] Fri, 25 April 2008 16:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.

Quentin DEME wrote:
> Then how can I access the RoleDescriptor Interface ? I know that the
> "path" is "org.eclipse.epf.uma.RoleDescriptor", but I don't know what
> to do with this, since it has to be synchronized with the EPF Composer
> model I've loaded
Somehow you managed to org.eclipse.epf.uma.impl.RoleDescriptorImpl, so
whatever you did for that, you'd do it the same way.
> just before, using : resourceSet.getResource(fileURI, true)
>
> You said : "This seems to imply there is only one resource and it does
> not contain any of the data of the type you are looking for nor does
> it contain reference to other resources. Does that make sense?"
> --> Yes it seems so, you're right.. that's why I'm really confused,
> because the EPF Composer model I've been given effectively contains
> elements that have been declared.
>
> About the fact you don't know the model, I'm really sorry but the
> model is "company confidential"... I'd like to quickly introduce you
> to it, but I can't.
Then I can only provide generic help and I'm all out of that now.
>
> I can tell you that for example, in the "Business Development" phase,
> there is a guideline associated to it, which explains some points
> about marketing requirements.
>
> But no connection with the RoleSets.. it's another problem (being able
> to list the rolesets, and then the roles corresponding to them).
Well, I know the fact there seem to be multiple problems completely
confuses me, so I'm all out of helpful things to suggest.
Re: Getting RoleSets from XMI files [message #50031 is a reply to message #50001] Mon, 28 April 2008 09:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Hi,

I have cast the RoleDescriptorImpl into RoleDescriptor and I'm able to use
the interface, but it unfortunately doesn't bring any solution to my
problems.

To sum up, my different problems are:

- I can't list the "RoleSet" elements from the model (my EPFC file:
model.xmi), but I can list all the "Role" elements (and some of them are
"RoleSet" but nothing can point out that they are Role Sets...)
- I can't list the "WorkProductType" elements neither, but I can list all
the "WorkProduct" elements
- When I list the guidelines, I can't have their name (getName() or
getPresentationName() returns an empty string) although they do have names
as EPF Composer shows them.

Is it possible to access EPF Composer source code ? There would surely be
the solution to my problem in it, since it can browse my model.

Thanks in advance,

Quentin
Re: Getting RoleSets from XMI files [message #50091 is a reply to message #50031] Mon, 28 April 2008 12:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.

Quentin DEME wrote:
> Hi,
>
> I have cast the RoleDescriptorImpl into RoleDescriptor and I'm able to
> use the interface, but it unfortunately doesn't bring any solution to
> my problems.
>
> To sum up, my different problems are:
>
> - I can't list the "RoleSet" elements from the model (my EPFC file:
> model.xmi), but I can list all the "Role" elements (and some of them
> are "RoleSet" but nothing can point out that they are Role Sets...)
I almost get the sense that multiple inheritance is involved. I.e., I
think you are telling me that RoleSet inherits from Role, right? It's
important to realize that Java doesn't not support multiple inheritance
of classes. So the Impl class that implements RoleSet might not inherit
from the Impl class that implements Role. After all, if it inherits
from two unrelated model classes A and B, while RoleSet will be an
instance of A and of B, RoleSetImpl will inherit from either AImpl or
BImpl, but not both. In any case, you are telling me you can list all
the Role instances but none indicated that instanceof RoleSet is true.
That seems to imply to me that none of the Role instances are RoleSets;
Java doesn't tend to lie abut such things.
> - I can't list the "WorkProductType" elements neither, but I can list
> all the "WorkProduct" elements
This is like asking, why can I find A but I can find B? How would I know?
> - When I list the guidelines, I can't have their name (getName() or
> getPresentationName() returns an empty string) although they do have
> names as EPF Composer shows them.
It sounds to my like an unresolved proxy. Does EObject.eIsProxy return
true for them? If you have unresolved proxy problems, which also
sounds like a likely issue, it's most likely caused by not using an
appropriate absolute URI to load the initial resolves. Relative URIs
within the serialization are resolved against the URI used to load the
resource (just like in .html pages in a browser). Does the .xmi contain
href="" attributes?
>
> Is it possible to access EPF Composer source code ? There would surely
> be the solution to my problem in it, since it can browse my model.
Most projects ship with an SDK that includes the source code. It's
certainly in CVS...
>
> Thanks in advance,
I wonder why I'm the only one answering questions here? Doesn't anyone
working on this project read the newsgroup?
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #50150 is a reply to message #50091] Mon, 28 April 2008 14:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

No, RoleSets don't inherit from Roles. As the name explicitely shows off,
the RoleSets are composed of Role, it's not the same relation.
Anyway, I finally figured out why I could list roles and rolesets at the
same time, and why I was getting duplicate roles : what we get from
getAllContents() is the entire Work Breakdown Structure, as displayed in
Eclipse Process Framework. So, if we only extract the Roles, we miss the
Phases that are the fathers of roles (as in Tree meaning). And that could
be OK for our project... I thus believe it is no more a problem now.

But the problem of the work products having no name is still actual.
EObject.eIsProxy() applied on work products returns "true". Plus, I use
absolute URI, as you told me to do. The .xmi file doesn't contain any
empty link (href="").

Another problem, but maybe it's not the right place to ask for here, when
I want to use the classes I've made for reading the XMI files, from my
Eclipse plugin which is graphical, I get a NoClassDefFoundError. I've been
searching the web for a while now, without succeeding in resolving this
new problem... Seems to be a CLASSPATH environment variable problem, but
I've tried many manipulations on it, it still doesn't work :
java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/resource/ResourceSet

Thanks for your help,

Quentin
Re: Getting RoleSets from XMI files [message #50177 is a reply to message #50150] Mon, 28 April 2008 15:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.

Quentin DEME wrote:
> No, RoleSets don't inherit from Roles. As the name explicitely shows
> off, the RoleSets are composed of Role, it's not the same relation.
> Anyway, I finally figured out why I could list roles and rolesets at
> the same time, and why I was getting duplicate roles : what we get
> from getAllContents() is the entire Work Breakdown Structure, as
> displayed in Eclipse Process Framework. So, if we only extract the
> Roles, we miss the Phases that are the fathers of roles (as in Tree
> meaning). And that could be OK for our project... I thus believe it is
> no more a problem now.
It sure hurts my brain when you say some Roles are RoleSets...
>
> But the problem of the work products having no name is still actual.
> EObject.eIsProxy() applied on work products returns "true". Plus, I
> use absolute URI, as you told me to do. The .xmi file doesn't contain
> any empty link (href="").
I wasn't trying to imply there were empty but rather to determine if
there are cross file references. What was the actual value of the URI
you used to load the initial resource as what do these href values look
like?
>
> Another problem, but maybe it's not the right place to ask for here,
> when I want to use the classes I've made for reading the XMI files,
> from my Eclipse plugin which is graphical, I get a
> NoClassDefFoundError. I've been searching the web for a while now,
> without succeeding in resolving this new problem... Seems to be a
> CLASSPATH environment variable problem, but I've tried many
> manipulations on it, it still doesn't work :
> java.lang.NoClassDefFoundError:
> org/eclipse/emf/ecore/resource/ResourceSet
A common mistake is to fiddle with the classpath via the project's
properties when, for a plugin, you must edit the dependencies of the
MANIFEST.MF or the compile time problem will just come back at runtime.
>
> Thanks for your help,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #50205 is a reply to message #50177] Tue, 29 April 2008 07:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

The initial resource URI that I load in my program is (actualy obviously)
the path of the xmi file I loaded : model.xmi.

And about the proxyURI of the guidelines, it's uma links like this one for
example : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g

I've tried to use resource.getEOBject("the URI") but I couldn't get any
object : always 'null'.

In what concerns the classpath, I've already tried to modify my graphical
plugin dependencies, but I couldn't get it to work. I always get the error
message "Error creating the view", because of the
java.lang.NoClassDefFoundError exception.

In the PDE (Plugin Development Environment), I can't add my library in
"Imported Packages". And when I try to add it myself directly into the
MANIFEST.MF, with "Import-Package com.(...).library", I get this error :
"No available bundle exports package 'com.(...).library'.

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #50236 is a reply to message #50205] Tue, 29 April 2008 14:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.

Quentin DEME wrote:
> The initial resource URI that I load in my program is (actualy
> obviously) the path of the xmi file I loaded : model.xmi.
This is a relative URI, not an absolute one, so relative references
within that resource will not likely be handled correctly. It would be
good to see the actual value that you're using.
>
> And about the proxyURI of the guidelines, it's uma links like this one
> for example : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
I don't know anything about uma schemes. I guess human readability
wasn't a concern...
>
> I've tried to use resource.getEOBject("the URI") but I couldn't get
> any object : always 'null'.
That method uses just the fragment, i.e., "_GgH6wOn8EdyMKb-pMuCr4g". I
would imagine that even if the proxy fails to resolve (you can cast to
InternalEObject and use eProxyURI to see the URI of the proxy that's
failing to resolve) you'd still have a resource with URI
"uma://_wTuT0MmrEdyxNoaGNtevxw". If you called getErrors on that
resource, it will likely indicate why it failed to load. It sounds like
you might well need to be hooking up some special support to handle uma:
scheme, but that's an probably EPF question I can't answer...
>
> In what concerns the classpath, I've already tried to modify my
> graphical plugin dependencies, but I couldn't get it to work. I always
> get the error message "Error creating the view", because of the
> java.lang.NoClassDefFoundError exception.
Well, you mustn't have the dependencies right.
>
> In the PDE (Plugin Development Environment), I can't add my library in
> "Imported Packages". And when I try to add it myself directly into the
> MANIFEST.MF, with "Import-Package com.(...).library", I get this error
> : "No available bundle exports package 'com.(...).library'.
Try using "Required Plug-ins" instead.
>
> Thank you,
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #50265 is a reply to message #50236] Wed, 30 April 2008 08:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Ed, thanks again for your reply,


Concerning the path of the XMI file, I said "model.xmi", but I actualy
specified the absolute path for model.xmi. So I don't think the problem is
here.

For the proxies, I don't really understand how to use the proxy functions
on the objects, as I don't have a big knowledge about those structures.
I tried to perform some tests, like, for example :

InternalEObject p =
(InternalEObject)resource.getEObject(_GgH6wOn8EdyMKb-pMuCr4g ");
System.out.println("eProxy : " + p.eProxyURI().toString());
for (Iterator j = resource.getErrors().iterator(); j.hasNext();) {
Diagnostic d = (Diagnostic)j.next();
System.out.println("Error message : " + d.getMessage());
}

This sort of stuff... but I don't get anything interesting. I'm surely
doing wrong.

Concerning the NoClassDefFoundError exception that I get when I want to
use my library from my Eclipse plugin, I had already tried (but didn't
tell you because it seemed useless to me) to use the "Required Plug-ins",
but it's the same problem : I can't add my library in the list.

I don't know what to do now

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #50295 is a reply to message #50265] Wed, 30 April 2008 12:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.

Quentin DEME wrote:
> Ed, thanks again for your reply,
>
>
> Concerning the path of the XMI file, I said "model.xmi", but I actualy
> specified the absolute path for model.xmi. So I don't think the
> problem is here.
The annoying thing is that I keep asking to see it. Given that the
references are using uma: scheme, it makes me wonder if your starting
resource should do the same.
>
> For the proxies, I don't really understand how to use the proxy
> functions on the objects, as I don't have a big knowledge about those
> structures.
> I tried to perform some tests, like, for example :
>
> InternalEObject p =
> (InternalEObject)resource.getEObject(_GgH6wOn8EdyMKb-pMuCr4g ");
> System.out.println("eProxy : " + p.eProxyURI().toString());
> for (Iterator j = resource.getErrors().iterator(); j.hasNext();) {
> Diagnostic d = (Diagnostic)j.next();
> System.out.println("Error message : " + d.getMessage());
> }
>
> This sort of stuff... but I don't get anything interesting. I'm surely
> doing wrong.
You've already determined you have objects for which eIsProxy is
returning true. Cast that object to InternalEObject and ask for the
eProxyURI of that.
>
> Concerning the NoClassDefFoundError exception that I get when I want
> to use my library from my Eclipse plugin, I had already tried (but
> didn't tell you because it seemed useless to me) to use the "Required
> Plug-ins", but it's the same problem : I can't add my library in the
> list.
Then it sounds to my like the library on which you want to depend isn't
a plugin. When building plugins, all your dependencies must be in plugins.
>
> I don't know what to do now
It sounds like you have a lot of problems. I'm not sure how are getting
past the class not found problem to see these other problems.
>
> Thank you,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #50324 is a reply to message #50295] Wed, 30 April 2008 13:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Ed, I have splitted the message in two problems:

--------------- Unresolved proxy (Obtaining the names of the guidelines)

The path is
" C:/myWorkspace/com.st.library/EPF6/PMM_plugin/deliveryproces ses/PMM_lifecycle/model.xmi "
This xmi file contains uma references inside.

I've understood what you wanted me to do about eProxyURI() of the
InternalEOBject. Here is a debug output I made, from inside the loop:

- Phase : Project Specification and Project Definition
- Guideline : org.eclipse.epf.uma.impl.GuidelineImpl
- getPresentationName() :
- getName() :
- eIsProxy() : true
- getGuid() : _ou7UEha3Ed22s7Cm8XbSQw
- eProxyURI() : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
- eProxyURI of InternalEObject:
uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g

The two proxyURI seem to be the same... what does this mean?

--------------- Library into plugin (Using the library from the Eclise
plugin)

I've created a test plugin which only contains System.out.println stuff. I
have exported it to a .jar file. In my plugin, I did "Runtime" ->
"Classpath" -> "Add", and I added this .jar file.
And it worked fine!

Then, I tried to so the same with my library. I have exported it to a .jar
file and added it to my plugin's classpath.
--> Now, I don't get "NoClassDefFoundError: com/st/library/STXMIParser", but I
get this : "NoClassDefFoundError: org/eclipse/emf/ecore/resource/resourceSet"
(and it's my library that uses emf)

I even tried to export emf.ecore to a .jar file and to add it to the
plugin's classpath, but it doesn't solve anything.

---------------

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #50352 is a reply to message #50324] Fri, 02 May 2008 14:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Hi,

I'm able to import my library with the "Import-Package" MANIFEST feature.
What I had to do was: "New" -> "Plug-in from existing JAR archives" -> and
indicate my library in .jar format (I exported it to .jar before).
Now, the plug-in doesn't throw any error when I put "Import-Package
com.st.library" in the MANIFEST.MF.

But at launch time, I get this error message and many other lines:

!MESSAGE Bundle update@../myWorkspace/com.st.project/ [332] was not
resolved.
!SUBENTRY 2 com.st.project 2 0 2008-05-02 16:20:27.593
!MESSAGE Missing Constraint: Import-Package: com.st.library;
version="0.0.0"

!ENTRY org.eclipse.osgi 4 0 2008-05-02 16:20:27.593
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "com.st.project.application" could
not be found in the registry. The applications available are:
org.eclipse.ant.core.antRunner, org.eclipse.equinox.app.error,
org.eclipse.help.base.infocenterApplication,
org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool,
org.eclipse.jdt.apt.core.aptBuild, org.eclipse.jdt.core.JavaCodeFormatter,
org.eclipse.pde.build.Build,
org.eclipse.pde.junit.runtime.uitestapplication,
org.eclipse.pde.junit.runtime.legacytestapplication,
org.eclipse.pde.junit.runtime.coretestapplication,
org.eclipse.ui.ide.workbench, org.eclipse.update.core.standaloneUpdate,
org.eclipse.update.core.siteOptimizer,
org.eclipse.xsd.ecore.importer.XSD2GenModel,
org.eclipse.emf.codegen.CodeGen, org.eclipse.emf.codegen.JMerger,
org.eclipse.emf.codegen.ecore.Generator,
org.eclipse.emf.importer.ecore.Ecore2GenModel,
org.eclipse.emf.importer.java.Java2GenModel,
org.eclipse.emf.importer.rose.Rose2GenModel,
org.eclipse.epf.rcp.ui.MainApplication,
org.eclipse.uml2.uml.ecore.importer.UML2GenModel.
at
org.eclipse.equinox.internal.app.EclipseAppContainer.startDe faultApp(EclipseAppContainer.java:242)

But I found that I had to add the newly created plug-in in "Open Run
Dialog" -> "Plug-ins" tab

And now, I get my NoClassDefFoundError:
org/eclipse/emf/ecore/resource/ResourceSet

I really don't know what to do now...

Thank you for your help,

Quentin
Re: Getting RoleSets from XMI files [message #50378 is a reply to message #50324] Fri, 02 May 2008 16:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin,

Comments below.


Quentin DEME wrote:
> Ed, I have splitted the message in two problems:
>
> --------------- Unresolved proxy (Obtaining the names of the guidelines)
>
> The path is
> " C:/myWorkspace/com.st.library/EPF6/PMM_plugin/deliveryproces ses/PMM_lifecycle/model.xmi "
>
Well, this isn't a good URI. You should be using URI.createFileURI
given this path to create a proper URI for it. With the above path,
relative references won't work correctly. In fact, I suspect you really
should be using a platform resource URI, i.e.,
platform:/resource/com.st.library/EPF6/PMM_plugin/deliverypr ocesses/PMM_lifecycle/model.xmi
(which you'd created from an IFile using
URI.createPlatformResourceURI(ifile.getFullPath().toString() ).
> This xmi file contains uma references inside.
>
> I've understood what you wanted me to do about eProxyURI() of the
> InternalEOBject. Here is a debug output I made, from inside the loop:
>
> - Phase : Project Specification and Project Definition
> - Guideline : org.eclipse.epf.uma.impl.GuidelineImpl
> - getPresentationName() : - getName() : - eIsProxy() : true
> - getGuid() : _ou7UEha3Ed22s7Cm8XbSQw
> - eProxyURI() : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
> - eProxyURI of InternalEObject:
> uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
>
> The two proxyURI seem to be the same... what does this mean?
Not sure how you got the two, but a proxy has a URI just like this. I
would expect there to be a resource in the resource set with URI
"uma://_wTuT0MmrEdyxNoaGNtevxw". Is there such a resource in the
resource set?
>
> --------------- Library into plugin (Using the library from the Eclise
> plugin)
>
> I've created a test plugin which only contains System.out.println
> stuff. I have exported it to a .jar file. In my plugin, I did
> "Runtime" -> "Classpath" -> "Add", and I added this .jar file.
> And it worked fine!
>
> Then, I tried to so the same with my library. I have exported it to a
> .jar file and added it to my plugin's classpath.
> --> Now, I don't get "NoClassDefFoundError:
> com/st/library/STXMIParser", but I get this : "NoClassDefFoundError:
> org/eclipse/emf/ecore/resource/resourceSet" (and it's my library that
> uses emf)
>
> I even tried to export emf.ecore to a .jar file and to add it to the
> plugin's classpath, but it doesn't solve anything.
EMF is already in a jar file. You should just create a dependency on
the org.eclipse.emf.ecore plugin. When we generate your model, it
should already be set up this way...
>
> ---------------
>
> Thank you,
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #50405 is a reply to message #50352] Fri, 02 May 2008 16:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Quentin DEME wrote:
> Hi,
>
> I'm able to import my library with the "Import-Package" MANIFEST
> feature. What I had to do was: "New" -> "Plug-in from existing JAR
> archives" -> and indicate my library in .jar format (I exported it to
> .jar before).
> Now, the plug-in doesn't throw any error when I put "Import-Package
> com.st.library" in the MANIFEST.MF.
>
> But at launch time, I get this error message and many other lines:
>
> !MESSAGE Bundle update@../myWorkspace/com.st.project/ [332] was not
> resolved.
> !SUBENTRY 2 com.st.project 2 0 2008-05-02 16:20:27.593
> !MESSAGE Missing Constraint: Import-Package: com.st.library;
> version="0.0.0"
>
> !ENTRY org.eclipse.osgi 4 0 2008-05-02 16:20:27.593
> !MESSAGE Application error
> !STACK 1
> java.lang.RuntimeException: Application "com.st.project.application"
> could not be found in the registry. The applications available are:
> org.eclipse.ant.core.antRunner, org.eclipse.equinox.app.error,
> org.eclipse.help.base.infocenterApplication,
> org.eclipse.help.base.helpApplication,
> org.eclipse.help.base.indexTool, org.eclipse.jdt.apt.core.aptBuild,
> org.eclipse.jdt.core.JavaCodeFormatter, org.eclipse.pde.build.Build,
> org.eclipse.pde.junit.runtime.uitestapplication,
> org.eclipse.pde.junit.runtime.legacytestapplication,
> org.eclipse.pde.junit.runtime.coretestapplication,
> org.eclipse.ui.ide.workbench,
> org.eclipse.update.core.standaloneUpdate,
> org.eclipse.update.core.siteOptimizer,
> org.eclipse.xsd.ecore.importer.XSD2GenModel,
> org.eclipse.emf.codegen.CodeGen, org.eclipse.emf.codegen.JMerger,
> org.eclipse.emf.codegen.ecore.Generator,
> org.eclipse.emf.importer.ecore.Ecore2GenModel,
> org.eclipse.emf.importer.java.Java2GenModel,
> org.eclipse.emf.importer.rose.Rose2GenModel,
> org.eclipse.epf.rcp.ui.MainApplication,
> org.eclipse.uml2.uml.ecore.importer.UML2GenModel.
> at
> org.eclipse.equinox.internal.app.EclipseAppContainer.startDe faultApp(EclipseAppContainer.java:242)
>
>
> But I found that I had to add the newly created plug-in in "Open Run
> Dialog" -> "Plug-ins" tab
>
> And now, I get my NoClassDefFoundError:
> org/eclipse/emf/ecore/resource/ResourceSet
>
> I really don't know what to do now...
If you follow one of the EMF tutorials, it will generate well formed
plugins for you...
>
> Thank you for your help,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #50517 is a reply to message #50378] Tue, 13 May 2008 12:51 Go to previous message
Eclipse UserFriend
Originally posted by: qdeme.yahoo.fr

Hi,

I finally found a solution to all the problems.

Concerning the guidances (guidelines in particular), I simply had to
obtain a resourceSet from the file plugin.xmi, and not the .xmi file of my
lifecycle. Thus, the guidelines can return a name.

Concerning the problem about using my library in my Eclipse plugin, I
tried to add default plugins in "Open Run Dialog", and then remove the
useless ones, and add the missing ones, according to the error log. I was
finally able to start my plugin and use the library through it.

Thank you very much for the help you provided.

Quentin Demé
Re: Getting RoleSets from XMI files [message #589021 is a reply to message #49785] Fri, 25 April 2008 12:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.


Quentin DEME wrote:
> Hi,
>
> I can list all the roles from my EPF Composer model, I can also list
> all the tasks and phases, as well as the work products, etc.
>
> But I can't find a way to get the RoleSets. I'd like to list the
> RoleSets and then get the Roles from them.
>
> Here is an example of how I can list all the roles (and also the
> rolesets, but there's apparently no way to know whether it's a roleset
> or a role) :
>
> Resource resource = resourceSet.getResource(fileURI,true);
> for (Iterator i = resource.getAllContents(); i.hasNext();) {
> Object o = i.next();
> if (o instanceof RoleDescriptorImpl) {
Try to avoid using Impl classes of the models. Using RoleDescriptor
should be sufficient for all your purposes.
> RoleDescriptorImpl rdi = (RoleDescriptorImpl)o;
> System.out.println(" - Role : " + rdi.getPresentationName());
> }
> }
>
> And by the way, I get no "RoleSetImpl" from resource.getAllContents().
I'm not sure how a RoleSet relates to a RoleDescriptor...
>
> I also have the same problem for Work Products and Work Product Types.
> I can list the Work Products but I can't have the Work Product Types.
I know nothing about this model, but my guess would be that these things
are contained in different resources while the above will only give you
the direct contents of the first resource. There's probably a better
way to get to them than by brute force, but I'd have to know the model
structure to know that, and I don't. For a brute force approach, try
resourceSet.getAllContents() to visit all the resources in the resource set.
>
> Thanks in advance,
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #589039 is a reply to message #49844] Fri, 25 April 2008 12:58 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Thank you for your reply,

You said that I should avoid using Impl classes, but when I use
getAllContents(), I only get Impl classes.

And, when I have an instance of RoleDescriptorImpl for example, I can use
RoleDescriptorImpl.getRole(), to get a "Role" class. So, in any cases, I
never get the "RoleDescriptor" class.

How can I get this kind of classes ?

I tried resourceSet.getAllContents(), but I get approximatively the same
results than before, because I apparently have only one resource.

Also, I can list guidelines from phases for example, but is it possible to
get all the guidelines independantly of the components they belong to ?
(all in the same iteration)

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #589057 is a reply to message #49874] Fri, 25 April 2008 13:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.

Quentin DEME wrote:
> Thank you for your reply,
>
> You said that I should avoid using Impl classes, but when I use
> getAllContents(), I only get Impl classes.
Yes, you get implementation classes of the public APIs. But that
doesn't mean you show be using those implementation classes in your
code. Similarly if you use an IFile, you'll end up with File
implementation class that you cannot use in your code because it's not
exported by the plugin.
>
> And, when I have an instance of RoleDescriptorImpl for example, I can
> use RoleDescriptorImpl.getRole(), to get a "Role" class. So, in any
> cases, I never get the "RoleDescriptor" class.
I think you're overlooking thef act that RoleDescriptorImpl implements
the RoleDescriptor interface and that the interface is the public API
you should be using.
>
> How can I get this kind of classes ?
The same way you got the Impl classes, but from the Java package that
has the API rather than the Java package that contains all the
implementation classes for that API.
>
> I tried resourceSet.getAllContents(), but I get approximatively the
> same results than before, because I apparently have only one resource.
This seems to imply there is only one resource and it does not contain
any of the data of the type you are looking for nor does it contain
reference to other resources. Does that make sense?
>
> Also, I can list guidelines from phases for example, but is it
> possible to get all the guidelines independantly of the components
> they belong to ? (all in the same iteration)
It seems to me your approach of visiting the whole resource would be the
way, but given my complete lack of knowledge about the model I can only
make guesses. What kind of relationship gets you from a phrase to a
guideline and how does that relate to this RoleSet thing... You might
just try to print out every "o" you visit to get a better sense of all
the objects contained in the resource...
>
> Thank you,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #589069 is a reply to message #49903] Fri, 25 April 2008 14:49 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Then how can I access the RoleDescriptor Interface ? I know that the
"path" is "org.eclipse.epf.uma.RoleDescriptor", but I don't know what to
do with this, since it has to be synchronized with the EPF Composer model
I've loaded just before, using : resourceSet.getResource(fileURI, true)

You said : "This seems to imply there is only one resource and it does not
contain any of the data of the type you are looking for nor does it
contain reference to other resources. Does that make sense?"
--> Yes it seems so, you're right.. that's why I'm really confused, because
the EPF Composer model I've been given effectively contains elements that have
been declared.

About the fact you don't know the model, I'm really sorry but the model is
"company confidential"... I'd like to quickly introduce you to it, but I
can't.

I can tell you that for example, in the "Business Development" phase,
there is a guideline associated to it, which explains some points about
marketing requirements.

But no connection with the RoleSets.. it's another problem (being able to
list the rolesets, and then the roles corresponding to them).
Re: Getting RoleSets from XMI files [message #589089 is a reply to message #49933] Fri, 25 April 2008 16:21 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.

Quentin DEME wrote:
> Then how can I access the RoleDescriptor Interface ? I know that the
> "path" is "org.eclipse.epf.uma.RoleDescriptor", but I don't know what
> to do with this, since it has to be synchronized with the EPF Composer
> model I've loaded
Somehow you managed to org.eclipse.epf.uma.impl.RoleDescriptorImpl, so
whatever you did for that, you'd do it the same way.
> just before, using : resourceSet.getResource(fileURI, true)
>
> You said : "This seems to imply there is only one resource and it does
> not contain any of the data of the type you are looking for nor does
> it contain reference to other resources. Does that make sense?"
> --> Yes it seems so, you're right.. that's why I'm really confused,
> because the EPF Composer model I've been given effectively contains
> elements that have been declared.
>
> About the fact you don't know the model, I'm really sorry but the
> model is "company confidential"... I'd like to quickly introduce you
> to it, but I can't.
Then I can only provide generic help and I'm all out of that now.
>
> I can tell you that for example, in the "Business Development" phase,
> there is a guideline associated to it, which explains some points
> about marketing requirements.
>
> But no connection with the RoleSets.. it's another problem (being able
> to list the rolesets, and then the roles corresponding to them).
Well, I know the fact there seem to be multiple problems completely
confuses me, so I'm all out of helpful things to suggest.
Re: Getting RoleSets from XMI files [message #589101 is a reply to message #50001] Mon, 28 April 2008 09:13 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Hi,

I have cast the RoleDescriptorImpl into RoleDescriptor and I'm able to use
the interface, but it unfortunately doesn't bring any solution to my
problems.

To sum up, my different problems are:

- I can't list the "RoleSet" elements from the model (my EPFC file:
model.xmi), but I can list all the "Role" elements (and some of them are
"RoleSet" but nothing can point out that they are Role Sets...)
- I can't list the "WorkProductType" elements neither, but I can list all
the "WorkProduct" elements
- When I list the guidelines, I can't have their name (getName() or
getPresentationName() returns an empty string) although they do have names
as EPF Composer shows them.

Is it possible to access EPF Composer source code ? There would surely be
the solution to my problem in it, since it can browse my model.

Thanks in advance,

Quentin
Re: Getting RoleSets from XMI files [message #589119 is a reply to message #50031] Mon, 28 April 2008 12:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.

Quentin DEME wrote:
> Hi,
>
> I have cast the RoleDescriptorImpl into RoleDescriptor and I'm able to
> use the interface, but it unfortunately doesn't bring any solution to
> my problems.
>
> To sum up, my different problems are:
>
> - I can't list the "RoleSet" elements from the model (my EPFC file:
> model.xmi), but I can list all the "Role" elements (and some of them
> are "RoleSet" but nothing can point out that they are Role Sets...)
I almost get the sense that multiple inheritance is involved. I.e., I
think you are telling me that RoleSet inherits from Role, right? It's
important to realize that Java doesn't not support multiple inheritance
of classes. So the Impl class that implements RoleSet might not inherit
from the Impl class that implements Role. After all, if it inherits
from two unrelated model classes A and B, while RoleSet will be an
instance of A and of B, RoleSetImpl will inherit from either AImpl or
BImpl, but not both. In any case, you are telling me you can list all
the Role instances but none indicated that instanceof RoleSet is true.
That seems to imply to me that none of the Role instances are RoleSets;
Java doesn't tend to lie abut such things.
> - I can't list the "WorkProductType" elements neither, but I can list
> all the "WorkProduct" elements
This is like asking, why can I find A but I can find B? How would I know?
> - When I list the guidelines, I can't have their name (getName() or
> getPresentationName() returns an empty string) although they do have
> names as EPF Composer shows them.
It sounds to my like an unresolved proxy. Does EObject.eIsProxy return
true for them? If you have unresolved proxy problems, which also
sounds like a likely issue, it's most likely caused by not using an
appropriate absolute URI to load the initial resolves. Relative URIs
within the serialization are resolved against the URI used to load the
resource (just like in .html pages in a browser). Does the .xmi contain
href="" attributes?
>
> Is it possible to access EPF Composer source code ? There would surely
> be the solution to my problem in it, since it can browse my model.
Most projects ship with an SDK that includes the source code. It's
certainly in CVS...
>
> Thanks in advance,
I wonder why I'm the only one answering questions here? Doesn't anyone
working on this project read the newsgroup?
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #589138 is a reply to message #50091] Mon, 28 April 2008 14:48 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

No, RoleSets don't inherit from Roles. As the name explicitely shows off,
the RoleSets are composed of Role, it's not the same relation.
Anyway, I finally figured out why I could list roles and rolesets at the
same time, and why I was getting duplicate roles : what we get from
getAllContents() is the entire Work Breakdown Structure, as displayed in
Eclipse Process Framework. So, if we only extract the Roles, we miss the
Phases that are the fathers of roles (as in Tree meaning). And that could
be OK for our project... I thus believe it is no more a problem now.

But the problem of the work products having no name is still actual.
EObject.eIsProxy() applied on work products returns "true". Plus, I use
absolute URI, as you told me to do. The .xmi file doesn't contain any
empty link (href="").

Another problem, but maybe it's not the right place to ask for here, when
I want to use the classes I've made for reading the XMI files, from my
Eclipse plugin which is graphical, I get a NoClassDefFoundError. I've been
searching the web for a while now, without succeeding in resolving this
new problem... Seems to be a CLASSPATH environment variable problem, but
I've tried many manipulations on it, it still doesn't work :
java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/resource/ResourceSet

Thanks for your help,

Quentin
Re: Getting RoleSets from XMI files [message #589149 is a reply to message #50150] Mon, 28 April 2008 15:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.

Quentin DEME wrote:
> No, RoleSets don't inherit from Roles. As the name explicitely shows
> off, the RoleSets are composed of Role, it's not the same relation.
> Anyway, I finally figured out why I could list roles and rolesets at
> the same time, and why I was getting duplicate roles : what we get
> from getAllContents() is the entire Work Breakdown Structure, as
> displayed in Eclipse Process Framework. So, if we only extract the
> Roles, we miss the Phases that are the fathers of roles (as in Tree
> meaning). And that could be OK for our project... I thus believe it is
> no more a problem now.
It sure hurts my brain when you say some Roles are RoleSets...
>
> But the problem of the work products having no name is still actual.
> EObject.eIsProxy() applied on work products returns "true". Plus, I
> use absolute URI, as you told me to do. The .xmi file doesn't contain
> any empty link (href="").
I wasn't trying to imply there were empty but rather to determine if
there are cross file references. What was the actual value of the URI
you used to load the initial resource as what do these href values look
like?
>
> Another problem, but maybe it's not the right place to ask for here,
> when I want to use the classes I've made for reading the XMI files,
> from my Eclipse plugin which is graphical, I get a
> NoClassDefFoundError. I've been searching the web for a while now,
> without succeeding in resolving this new problem... Seems to be a
> CLASSPATH environment variable problem, but I've tried many
> manipulations on it, it still doesn't work :
> java.lang.NoClassDefFoundError:
> org/eclipse/emf/ecore/resource/ResourceSet
A common mistake is to fiddle with the classpath via the project's
properties when, for a plugin, you must edit the dependencies of the
MANIFEST.MF or the compile time problem will just come back at runtime.
>
> Thanks for your help,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #589162 is a reply to message #50177] Tue, 29 April 2008 07:48 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

The initial resource URI that I load in my program is (actualy obviously)
the path of the xmi file I loaded : model.xmi.

And about the proxyURI of the guidelines, it's uma links like this one for
example : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g

I've tried to use resource.getEOBject("the URI") but I couldn't get any
object : always 'null'.

In what concerns the classpath, I've already tried to modify my graphical
plugin dependencies, but I couldn't get it to work. I always get the error
message "Error creating the view", because of the
java.lang.NoClassDefFoundError exception.

In the PDE (Plugin Development Environment), I can't add my library in
"Imported Packages". And when I try to add it myself directly into the
MANIFEST.MF, with "Import-Package com.(...).library", I get this error :
"No available bundle exports package 'com.(...).library'.

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #589175 is a reply to message #50205] Tue, 29 April 2008 14:13 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.

Quentin DEME wrote:
> The initial resource URI that I load in my program is (actualy
> obviously) the path of the xmi file I loaded : model.xmi.
This is a relative URI, not an absolute one, so relative references
within that resource will not likely be handled correctly. It would be
good to see the actual value that you're using.
>
> And about the proxyURI of the guidelines, it's uma links like this one
> for example : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
I don't know anything about uma schemes. I guess human readability
wasn't a concern...
>
> I've tried to use resource.getEOBject("the URI") but I couldn't get
> any object : always 'null'.
That method uses just the fragment, i.e., "_GgH6wOn8EdyMKb-pMuCr4g". I
would imagine that even if the proxy fails to resolve (you can cast to
InternalEObject and use eProxyURI to see the URI of the proxy that's
failing to resolve) you'd still have a resource with URI
"uma://_wTuT0MmrEdyxNoaGNtevxw". If you called getErrors on that
resource, it will likely indicate why it failed to load. It sounds like
you might well need to be hooking up some special support to handle uma:
scheme, but that's an probably EPF question I can't answer...
>
> In what concerns the classpath, I've already tried to modify my
> graphical plugin dependencies, but I couldn't get it to work. I always
> get the error message "Error creating the view", because of the
> java.lang.NoClassDefFoundError exception.
Well, you mustn't have the dependencies right.
>
> In the PDE (Plugin Development Environment), I can't add my library in
> "Imported Packages". And when I try to add it myself directly into the
> MANIFEST.MF, with "Import-Package com.(...).library", I get this error
> : "No available bundle exports package 'com.(...).library'.
Try using "Required Plug-ins" instead.
>
> Thank you,
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #589193 is a reply to message #50236] Wed, 30 April 2008 08:07 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Ed, thanks again for your reply,


Concerning the path of the XMI file, I said "model.xmi", but I actualy
specified the absolute path for model.xmi. So I don't think the problem is
here.

For the proxies, I don't really understand how to use the proxy functions
on the objects, as I don't have a big knowledge about those structures.
I tried to perform some tests, like, for example :

InternalEObject p =
(InternalEObject)resource.getEObject(_GgH6wOn8EdyMKb-pMuCr4g ");
System.out.println("eProxy : " + p.eProxyURI().toString());
for (Iterator j = resource.getErrors().iterator(); j.hasNext();) {
Diagnostic d = (Diagnostic)j.next();
System.out.println("Error message : " + d.getMessage());
}

This sort of stuff... but I don't get anything interesting. I'm surely
doing wrong.

Concerning the NoClassDefFoundError exception that I get when I want to
use my library from my Eclipse plugin, I had already tried (but didn't
tell you because it seemed useless to me) to use the "Required Plug-ins",
but it's the same problem : I can't add my library in the list.

I don't know what to do now

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #589211 is a reply to message #50265] Wed, 30 April 2008 12:26 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.

Quentin DEME wrote:
> Ed, thanks again for your reply,
>
>
> Concerning the path of the XMI file, I said "model.xmi", but I actualy
> specified the absolute path for model.xmi. So I don't think the
> problem is here.
The annoying thing is that I keep asking to see it. Given that the
references are using uma: scheme, it makes me wonder if your starting
resource should do the same.
>
> For the proxies, I don't really understand how to use the proxy
> functions on the objects, as I don't have a big knowledge about those
> structures.
> I tried to perform some tests, like, for example :
>
> InternalEObject p =
> (InternalEObject)resource.getEObject(_GgH6wOn8EdyMKb-pMuCr4g ");
> System.out.println("eProxy : " + p.eProxyURI().toString());
> for (Iterator j = resource.getErrors().iterator(); j.hasNext();) {
> Diagnostic d = (Diagnostic)j.next();
> System.out.println("Error message : " + d.getMessage());
> }
>
> This sort of stuff... but I don't get anything interesting. I'm surely
> doing wrong.
You've already determined you have objects for which eIsProxy is
returning true. Cast that object to InternalEObject and ask for the
eProxyURI of that.
>
> Concerning the NoClassDefFoundError exception that I get when I want
> to use my library from my Eclipse plugin, I had already tried (but
> didn't tell you because it seemed useless to me) to use the "Required
> Plug-ins", but it's the same problem : I can't add my library in the
> list.
Then it sounds to my like the library on which you want to depend isn't
a plugin. When building plugins, all your dependencies must be in plugins.
>
> I don't know what to do now
It sounds like you have a lot of problems. I'm not sure how are getting
past the class not found problem to see these other problems.
>
> Thank you,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #589226 is a reply to message #50295] Wed, 30 April 2008 13:22 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Ed, I have splitted the message in two problems:

--------------- Unresolved proxy (Obtaining the names of the guidelines)

The path is
" C:/myWorkspace/com.st.library/EPF6/PMM_plugin/deliveryproces ses/PMM_lifecycle/model.xmi "
This xmi file contains uma references inside.

I've understood what you wanted me to do about eProxyURI() of the
InternalEOBject. Here is a debug output I made, from inside the loop:

- Phase : Project Specification and Project Definition
- Guideline : org.eclipse.epf.uma.impl.GuidelineImpl
- getPresentationName() :
- getName() :
- eIsProxy() : true
- getGuid() : _ou7UEha3Ed22s7Cm8XbSQw
- eProxyURI() : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
- eProxyURI of InternalEObject:
uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g

The two proxyURI seem to be the same... what does this mean?

--------------- Library into plugin (Using the library from the Eclise
plugin)

I've created a test plugin which only contains System.out.println stuff. I
have exported it to a .jar file. In my plugin, I did "Runtime" ->
"Classpath" -> "Add", and I added this .jar file.
And it worked fine!

Then, I tried to so the same with my library. I have exported it to a .jar
file and added it to my plugin's classpath.
--> Now, I don't get "NoClassDefFoundError: com/st/library/STXMIParser", but I
get this : "NoClassDefFoundError: org/eclipse/emf/ecore/resource/resourceSet"
(and it's my library that uses emf)

I even tried to export emf.ecore to a .jar file and to add it to the
plugin's classpath, but it doesn't solve anything.

---------------

Thank you,

Quentin
Re: Getting RoleSets from XMI files [message #589240 is a reply to message #50324] Fri, 02 May 2008 14:25 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.deme.st.com

Hi,

I'm able to import my library with the "Import-Package" MANIFEST feature.
What I had to do was: "New" -> "Plug-in from existing JAR archives" -> and
indicate my library in .jar format (I exported it to .jar before).
Now, the plug-in doesn't throw any error when I put "Import-Package
com.st.library" in the MANIFEST.MF.

But at launch time, I get this error message and many other lines:

!MESSAGE Bundle update@../myWorkspace/com.st.project/ [332] was not
resolved.
!SUBENTRY 2 com.st.project 2 0 2008-05-02 16:20:27.593
!MESSAGE Missing Constraint: Import-Package: com.st.library;
version="0.0.0"

!ENTRY org.eclipse.osgi 4 0 2008-05-02 16:20:27.593
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "com.st.project.application" could
not be found in the registry. The applications available are:
org.eclipse.ant.core.antRunner, org.eclipse.equinox.app.error,
org.eclipse.help.base.infocenterApplication,
org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool,
org.eclipse.jdt.apt.core.aptBuild, org.eclipse.jdt.core.JavaCodeFormatter,
org.eclipse.pde.build.Build,
org.eclipse.pde.junit.runtime.uitestapplication,
org.eclipse.pde.junit.runtime.legacytestapplication,
org.eclipse.pde.junit.runtime.coretestapplication,
org.eclipse.ui.ide.workbench, org.eclipse.update.core.standaloneUpdate,
org.eclipse.update.core.siteOptimizer,
org.eclipse.xsd.ecore.importer.XSD2GenModel,
org.eclipse.emf.codegen.CodeGen, org.eclipse.emf.codegen.JMerger,
org.eclipse.emf.codegen.ecore.Generator,
org.eclipse.emf.importer.ecore.Ecore2GenModel,
org.eclipse.emf.importer.java.Java2GenModel,
org.eclipse.emf.importer.rose.Rose2GenModel,
org.eclipse.epf.rcp.ui.MainApplication,
org.eclipse.uml2.uml.ecore.importer.UML2GenModel.
at
org.eclipse.equinox.internal.app.EclipseAppContainer.startDe faultApp(EclipseAppContainer.java:242)

But I found that I had to add the newly created plug-in in "Open Run
Dialog" -> "Plug-ins" tab

And now, I get my NoClassDefFoundError:
org/eclipse/emf/ecore/resource/ResourceSet

I really don't know what to do now...

Thank you for your help,

Quentin
Re: Getting RoleSets from XMI files [message #589256 is a reply to message #50324] Fri, 02 May 2008 16:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin,

Comments below.


Quentin DEME wrote:
> Ed, I have splitted the message in two problems:
>
> --------------- Unresolved proxy (Obtaining the names of the guidelines)
>
> The path is
> " C:/myWorkspace/com.st.library/EPF6/PMM_plugin/deliveryproces ses/PMM_lifecycle/model.xmi "
>
Well, this isn't a good URI. You should be using URI.createFileURI
given this path to create a proper URI for it. With the above path,
relative references won't work correctly. In fact, I suspect you really
should be using a platform resource URI, i.e.,
platform:/resource/com.st.library/EPF6/PMM_plugin/deliverypr ocesses/PMM_lifecycle/model.xmi
(which you'd created from an IFile using
URI.createPlatformResourceURI(ifile.getFullPath().toString() ).
> This xmi file contains uma references inside.
>
> I've understood what you wanted me to do about eProxyURI() of the
> InternalEOBject. Here is a debug output I made, from inside the loop:
>
> - Phase : Project Specification and Project Definition
> - Guideline : org.eclipse.epf.uma.impl.GuidelineImpl
> - getPresentationName() : - getName() : - eIsProxy() : true
> - getGuid() : _ou7UEha3Ed22s7Cm8XbSQw
> - eProxyURI() : uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
> - eProxyURI of InternalEObject:
> uma://_wTuT0MmrEdyxNoaGNtevxw#_GgH6wOn8EdyMKb-pMuCr4g
>
> The two proxyURI seem to be the same... what does this mean?
Not sure how you got the two, but a proxy has a URI just like this. I
would expect there to be a resource in the resource set with URI
"uma://_wTuT0MmrEdyxNoaGNtevxw". Is there such a resource in the
resource set?
>
> --------------- Library into plugin (Using the library from the Eclise
> plugin)
>
> I've created a test plugin which only contains System.out.println
> stuff. I have exported it to a .jar file. In my plugin, I did
> "Runtime" -> "Classpath" -> "Add", and I added this .jar file.
> And it worked fine!
>
> Then, I tried to so the same with my library. I have exported it to a
> .jar file and added it to my plugin's classpath.
> --> Now, I don't get "NoClassDefFoundError:
> com/st/library/STXMIParser", but I get this : "NoClassDefFoundError:
> org/eclipse/emf/ecore/resource/resourceSet" (and it's my library that
> uses emf)
>
> I even tried to export emf.ecore to a .jar file and to add it to the
> plugin's classpath, but it doesn't solve anything.
EMF is already in a jar file. You should just create a dependency on
the org.eclipse.emf.ecore plugin. When we generate your model, it
should already be set up this way...
>
> ---------------
>
> Thank you,
>
> Quentin
>
>
Re: Getting RoleSets from XMI files [message #589283 is a reply to message #50352] Fri, 02 May 2008 16:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26215
Registered: July 2009
Senior Member
Quentin DEME wrote:
> Hi,
>
> I'm able to import my library with the "Import-Package" MANIFEST
> feature. What I had to do was: "New" -> "Plug-in from existing JAR
> archives" -> and indicate my library in .jar format (I exported it to
> .jar before).
> Now, the plug-in doesn't throw any error when I put "Import-Package
> com.st.library" in the MANIFEST.MF.
>
> But at launch time, I get this error message and many other lines:
>
> !MESSAGE Bundle update@../myWorkspace/com.st.project/ [332] was not
> resolved.
> !SUBENTRY 2 com.st.project 2 0 2008-05-02 16:20:27.593
> !MESSAGE Missing Constraint: Import-Package: com.st.library;
> version="0.0.0"
>
> !ENTRY org.eclipse.osgi 4 0 2008-05-02 16:20:27.593
> !MESSAGE Application error
> !STACK 1
> java.lang.RuntimeException: Application "com.st.project.application"
> could not be found in the registry. The applications available are:
> org.eclipse.ant.core.antRunner, org.eclipse.equinox.app.error,
> org.eclipse.help.base.infocenterApplication,
> org.eclipse.help.base.helpApplication,
> org.eclipse.help.base.indexTool, org.eclipse.jdt.apt.core.aptBuild,
> org.eclipse.jdt.core.JavaCodeFormatter, org.eclipse.pde.build.Build,
> org.eclipse.pde.junit.runtime.uitestapplication,
> org.eclipse.pde.junit.runtime.legacytestapplication,
> org.eclipse.pde.junit.runtime.coretestapplication,
> org.eclipse.ui.ide.workbench,
> org.eclipse.update.core.standaloneUpdate,
> org.eclipse.update.core.siteOptimizer,
> org.eclipse.xsd.ecore.importer.XSD2GenModel,
> org.eclipse.emf.codegen.CodeGen, org.eclipse.emf.codegen.JMerger,
> org.eclipse.emf.codegen.ecore.Generator,
> org.eclipse.emf.importer.ecore.Ecore2GenModel,
> org.eclipse.emf.importer.java.Java2GenModel,
> org.eclipse.emf.importer.rose.Rose2GenModel,
> org.eclipse.epf.rcp.ui.MainApplication,
> org.eclipse.uml2.uml.ecore.importer.UML2GenModel.
> at
> org.eclipse.equinox.internal.app.EclipseAppContainer.startDe faultApp(EclipseAppContainer.java:242)
>
>
> But I found that I had to add the newly created plug-in in "Open Run
> Dialog" -> "Plug-ins" tab
>
> And now, I get my NoClassDefFoundError:
> org/eclipse/emf/ecore/resource/ResourceSet
>
> I really don't know what to do now...
If you follow one of the EMF tutorials, it will generate well formed
plugins for you...
>
> Thank you for your help,
>
> Quentin
>
Re: Getting RoleSets from XMI files [message #589344 is a reply to message #50378] Tue, 13 May 2008 12:51 Go to previous message
Eclipse UserFriend
Originally posted by: qdeme.yahoo.fr

Hi,

I finally found a solution to all the problems.

Concerning the guidances (guidelines in particular), I simply had to
obtain a resourceSet from the file plugin.xmi, and not the .xmi file of my
lifecycle. Thus, the guidelines can return a name.

Concerning the problem about using my library in my Eclipse plugin, I
tried to add default plugins in "Open Run Dialog", and then remove the
useless ones, and add the missing ones, according to the error log. I was
finally able to start my plugin and use the library through it.

Thank you very much for the help you provided.

Quentin Demé
Previous Topic:Plan for 1.2.0.4 release?
Next Topic:Export to PDF
Goto Forum:
  


Current Time: Sun Nov 23 01:11:31 GMT 2014

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

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