Home » Archived » Visual Editor (VE) » JEM ecore model - registered?
JEM ecore model - registered? [message #124130] |
Mon, 01 May 2006 10:22  |
Eclipse User |
|
|
|
Will JEM become a registered EMF resource?
Notice that if you import a resource into an ecore doc, you have the
choice to browse the registered packages, and those include mostly core
emf resources. There is no way to create an ecore that references JEM
ecore models without loading the actual JEM project into your workspace.
This seems like a pain.
Ideas?
|
|
| |
Re: JEM ecore model - registered? [message #124156 is a reply to message #124144] |
Mon, 01 May 2006 13:26   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------070504060802000909020900
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Jeff,
You'd need to add these attributes:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension
point="org.eclipse.emf.ecore.generated_package">
<package
uri="http:///org/eclipse/jem/internal/instantiation.ecore"
class="org.eclipse.jem.internal.instantiation.InstantiationPackage "
genModel="model/instance.genmodel">
</package>
<package
uri="java.xmi"
class="org.eclipse.jem.java.JavaRefPackage"
genModel="model/javaModel.genmodel">
</package>
</extension>
<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration container="org.eclipse.jdt.launching.JRE_CONTAINER">
<override
package="java.lang"
path="overrides/java/lang">
</override>
<override
package="..ROOT.."
path="overrides">
</override>
</registration>
</extension>
</plugin>
And change your build.properties to move model to the bin.includes
src.excludes = **/.cvsignore
bin.includes = plugin.xml,\
plugin.properties,\
model/,\
about.html,\
about.ini,\
about.mappings,\
about.properties,\
eclipse32.gif,\
overrides/,\
.options,\
META-INF/,\
.
jars.compile.order = .
src.includes = about.html,\
model/,\
rose/
output.. = bin/
source.. = mofjava/,\
javainst/
Jeff Myers wrote:
> Paul,
>
> FYI - Rich Kulp, the guy who's likely to comment on this issue is on
> vacation until May 5th. So don't be discouraged by a lack of response.
>
> - Jeff
>
> Paul Fullbright wrote:
>
>> Will JEM become a registered EMF resource?
>>
>> Notice that if you import a resource into an ecore doc, you have the
>> choice to browse the registered packages, and those include mostly
>> core emf resources. There is no way to create an ecore that
>> references JEM ecore models without loading the actual JEM project
>> into your workspace. This seems like a pain.
>>
>> Ideas?
>>
--------------070504060802000909020900
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jeff,<br>
<br>
You'd need to add <font color="#3333ff">these </font>attributes:<br>
<blockquote><?xml version="1.0" encoding="UTF-8"?><br>
<?eclipse version="3.0"?><br>
<plugin><br>
<br>
|
|
| | | | | | | | |
Re: JEM ecore model - registered? [message #124962 is a reply to message #124950] |
Tue, 16 May 2006 12:45  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The WTP model hasn't changed. They still point to Javaclasses all
related to one project.
You can still do what you want by doing:
First, if your EMF objects are code generated and you want a reference
to a JEM model class, you will need to load into your development
workspace where you have your genmodel and ecore files, the ecore file
from the JEM source plugin. I'm assuming you are not using rose but
instead either changing your ecore files directly or through annotated
java. If you are using Rose, then you would load the rose models too. By
loading the ecore file you are now able to reference these in your ecore
model as a type for an EReference. Then generate your code.
Now as I said, you can't use the EMF XMI document editor because it
doesn't provide access to the special resource set that is required for
JEM. So you will need to create your model through code instead.
You can use the JEM project resourceset to hold your own resource, but
then you need to worry about your resource being visible to all other
editors in the project. That is because the resourceset is common for
the project. If you don't use an unique URI for your resource it could
collide with some other resource.
Here's some sample code. I writing this on the fly, so there may be
syntax errors or some other problems, but it gives you the gist of it.
This is for JEM 1.2 code. It is different for 1.1.0.1, that code isn't
API code. This code here is API code.
EMFNature emfNature = JemProjectUtilities.getJEM_EMF_Nature(iproject,
true); // Get the jem emf nature for the project, add the nature if not
there.
ResourceSet jemProjectRset = emfNature.getResourceSet(); // The project
wide resource set for jem.
// Build up your model.
Resource yourRes =
jemProjectRset.createResource(URI.createURI(your-unique-uri) );
YourEMF yourEMF = YourEMFFactory.eINSTANCE.createYourEMF();
yourEMF.setJavaClass(JavaRefFactory.eINSTANCE.reflectType("some.java.Class ",
jemProjectRset));
yourRes.getContents().add(YourEMF);
yourRes.save(...);
and finally, ALWAYS do a jemProjectRset.getResources().remove(yourRes)
so that it doesn't hang around in the project wide resource set when no
longer needed.
----- Now when you need to load do:
Resource yourRes =
jemProjectRes.getResource(URI.createURI(your-unique-uri), true);
now when you do yourEMF.getJavaClass() it will know what project to use
to find the JavaClass.
JavaClass jc = yourEMF.getJavaClass();
if (jc.getKind() != TypeKind.UNDEFINED_LITERAL) {
... valid ...
} else {
... invalid ...
}
And again finally always remove yourRes.
------------------------------ Alternative ---------------
This alternative is if you just want it for validation. Then I wouldn't
put the JavaClass as a reference. I would leave it a string and just use
code to take the string, pass it to reflectType() for the jemProjectRset
and then do is valid test as shown above.
--
Thanks,
Rich Kulp
|
|
|
Re: JEM ecore model - registered? [message #612793 is a reply to message #124130] |
Mon, 01 May 2006 11:19  |
Eclipse User |
|
|
|
Paul,
FYI - Rich Kulp, the guy who's likely to comment on this issue is on
vacation until May 5th. So don't be discouraged by a lack of response.
- Jeff
Paul Fullbright wrote:
> Will JEM become a registered EMF resource?
>
> Notice that if you import a resource into an ecore doc, you have the
> choice to browse the registered packages, and those include mostly core
> emf resources. There is no way to create an ecore that references JEM
> ecore models without loading the actual JEM project into your
> workspace. This seems like a pain.
>
> Ideas?
>
|
|
|
Re: JEM ecore model - registered? [message #612795 is a reply to message #124144] |
Mon, 01 May 2006 13:26  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------070504060802000909020900
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Jeff,
You'd need to add these attributes:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension
point="org.eclipse.emf.ecore.generated_package">
<package
uri="http:///org/eclipse/jem/internal/instantiation.ecore"
class="org.eclipse.jem.internal.instantiation.InstantiationPackage "
genModel="model/instance.genmodel">
</package>
<package
uri="java.xmi"
class="org.eclipse.jem.java.JavaRefPackage"
genModel="model/javaModel.genmodel">
</package>
</extension>
<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration container="org.eclipse.jdt.launching.JRE_CONTAINER">
<override
package="java.lang"
path="overrides/java/lang">
</override>
<override
package="..ROOT.."
path="overrides">
</override>
</registration>
</extension>
</plugin>
And change your build.properties to move model to the bin.includes
src.excludes = **/.cvsignore
bin.includes = plugin.xml,\
plugin.properties,\
model/,\
about.html,\
about.ini,\
about.mappings,\
about.properties,\
eclipse32.gif,\
overrides/,\
.options,\
META-INF/,\
.
jars.compile.order = .
src.includes = about.html,\
model/,\
rose/
output.. = bin/
source.. = mofjava/,\
javainst/
Jeff Myers wrote:
> Paul,
>
> FYI - Rich Kulp, the guy who's likely to comment on this issue is on
> vacation until May 5th. So don't be discouraged by a lack of response.
>
> - Jeff
>
> Paul Fullbright wrote:
>
>> Will JEM become a registered EMF resource?
>>
>> Notice that if you import a resource into an ecore doc, you have the
>> choice to browse the registered packages, and those include mostly
>> core emf resources. There is no way to create an ecore that
>> references JEM ecore models without loading the actual JEM project
>> into your workspace. This seems like a pain.
>>
>> Ideas?
>>
--------------070504060802000909020900
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jeff,<br>
<br>
You'd need to add <font color="#3333ff">these </font>attributes:<br>
<blockquote><?xml version="1.0" encoding="UTF-8"?><br>
<?eclipse version="3.0"?><br>
<plugin><br>
<br>
|
|
| |
Re: JEM ecore model - registered? [message #612801 is a reply to message #124166] |
Mon, 01 May 2006 14:31  |
Eclipse User |
|
|
|
Paul,
This mechanism allow the tools to find models that are registered in the
environment. If you want it to find the models in your dev environment
it would require having it there, but if you only need it in the target
environment, it would be good enough to only be there.
Paul Fullbright wrote:
> Ed, would this (eventually) require that you have JEM installed in
> your dev environment? Or simply that it is included in your target
> environment?
>
> - Paul
>
|
|
| |
Re: JEM ecore model - registered? [message #612849 is a reply to message #124144] |
Tue, 09 May 2006 14:58  |
Eclipse User |
|
|
|
Bump for post-vacation. :)
Jeff Myers wrote:
> Paul,
> FYI - Rich Kulp, the guy who's likely to comment on this issue is on
> vacation until May 5th. So don't be discouraged by a lack of response.
> - Jeff
> Paul Fullbright wrote:
>> Will JEM become a registered EMF resource?
>>
>> Notice that if you import a resource into an ecore doc, you have the
>> choice to browse the registered packages, and those include mostly core
>> emf resources. There is no way to create an ecore that references JEM
>> ecore models without loading the actual JEM project into your
>> workspace. This seems like a pain.
>>
>> Ideas?
>>
|
|
|
Re: JEM ecore model - registered? [message #612854 is a reply to message #124130] |
Tue, 09 May 2006 16:13  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Your Eclipse needs to have the JEM plugins installed. Otherwise the JEM
EMF ecore model will not be registered for usages of JEM from within
your eclipse.
But there is the additional problem in that JEM models are not
standalone EMF objects. They are backed up by referencing the actual
java class from a project. Without that the JEM model is incomplete. The
features of a JEM object would not be known because those are created on
the fly as needed from reflecting/introspecting the actual java class.
--
Thanks,
Rich Kulp
|
|
|
Re: JEM ecore model - registered? [message #612913 is a reply to message #124518] |
Mon, 15 May 2006 16:52  |
Eclipse User |
|
|
|
Rich Kulp wrote:
> Your Eclipse needs to have the JEM plugins installed. Otherwise the JEM
> EMF ecore model will not be registered for usages of JEM from within
> your eclipse.
I have installed the JEM plugins (1.2M3) into my runtime eclipse as well
as my target platform. It still doesn't look like JEM is a registered
package I can use to add to my ecore model. Is there some way of doing
this that I haven't seen?
> But there is the additional problem in that JEM models are not
> standalone EMF objects. They are backed up by referencing the actual
> java class from a project. Without that the JEM model is incomplete. The
> features of a JEM object would not be known because those are created on
> the fly as needed from reflecting/introspecting the actual java class.
We would of course use JEM in this way, but I don't understand what this
has to do with my original post. Is there something I'm not seeing or
understanding?
- Paul
|
|
|
Re: JEM ecore model - registered? [message #612918 is a reply to message #124905] |
Tue, 16 May 2006 10:46  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
I misunderstood your question. JEM is a registered package and can be
used from an xmi document. However, the EMF xmi editor doesn't see it as
a valid package because the genmodel doesn't exist.
The xmi could still reference it. We don't supply the genmodel at
runtime because it is normally only used in development. The genmodel
and ecore are in the org.eclipse.jem source plugin.
But this still won't let you use the EMF xmi editor to create such a
document. You will need to write code to do it. That is because we use a
special protocol in our uri's so that we know that it is not a standard
EMF object. A standard EMF object can be simply loaded from a file. JEM
objects cannot be. That it because an instance of JavaClass by itself is
insufficient. It needs to know about the java class that it represents.
Otherwise it won't be complete. It won't know things like is it an
interface, what are the methods and fields, what are the properties.
Our special URI protocol is registered with a special resource set. This
resource set is retrieved from the JEM model on a pre-project basis.
That way the resource set knows what the classpath is (from the project)
and it can then correctly create the JavaClass wrappering the real JDT
java class.
--
Thanks,
Rich Kulp
|
|
|
Re: JEM ecore model - registered? [message #612919 is a reply to message #124939] |
Tue, 16 May 2006 11:36  |
Eclipse User |
|
|
|
Hi Rich,
OK, so I can't use JavaClass objects in a model that I'm generating from
an ecore? Am I understanding that correctly?
This is what I want to do: I have an XML document with String class names
represented. However, I don't want to represent them as String objects in
my model, since they actually *should* represent java class objects that
are in the project. I would like to validate that they exist and that
they have the correct class characteristics among other things, which
JavaClass objects would help me do. How do I have to proceed in order to
represent these objects in the model as JavaClasses but write them out to
the document as Strings? Do I have to abandon the ecore model generation
process?
Are there any example that do this? I see that most of the WTP models
that use JEM have old ecores from when all projects were simply all in
your workspace, so I don't understand how one would develop an EMF model
today using JEM.
Thanks,
- Paul
|
|
|
Re: JEM ecore model - registered? [message #612921 is a reply to message #124950] |
Tue, 16 May 2006 12:45  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The WTP model hasn't changed. They still point to Javaclasses all
related to one project.
You can still do what you want by doing:
First, if your EMF objects are code generated and you want a reference
to a JEM model class, you will need to load into your development
workspace where you have your genmodel and ecore files, the ecore file
from the JEM source plugin. I'm assuming you are not using rose but
instead either changing your ecore files directly or through annotated
java. If you are using Rose, then you would load the rose models too. By
loading the ecore file you are now able to reference these in your ecore
model as a type for an EReference. Then generate your code.
Now as I said, you can't use the EMF XMI document editor because it
doesn't provide access to the special resource set that is required for
JEM. So you will need to create your model through code instead.
You can use the JEM project resourceset to hold your own resource, but
then you need to worry about your resource being visible to all other
editors in the project. That is because the resourceset is common for
the project. If you don't use an unique URI for your resource it could
collide with some other resource.
Here's some sample code. I writing this on the fly, so there may be
syntax errors or some other problems, but it gives you the gist of it.
This is for JEM 1.2 code. It is different for 1.1.0.1, that code isn't
API code. This code here is API code.
EMFNature emfNature = JemProjectUtilities.getJEM_EMF_Nature(iproject,
true); // Get the jem emf nature for the project, add the nature if not
there.
ResourceSet jemProjectRset = emfNature.getResourceSet(); // The project
wide resource set for jem.
// Build up your model.
Resource yourRes =
jemProjectRset.createResource(URI.createURI(your-unique-uri) );
YourEMF yourEMF = YourEMFFactory.eINSTANCE.createYourEMF();
yourEMF.setJavaClass(JavaRefFactory.eINSTANCE.reflectType("some.java.Class ",
jemProjectRset));
yourRes.getContents().add(YourEMF);
yourRes.save(...);
and finally, ALWAYS do a jemProjectRset.getResources().remove(yourRes)
so that it doesn't hang around in the project wide resource set when no
longer needed.
----- Now when you need to load do:
Resource yourRes =
jemProjectRes.getResource(URI.createURI(your-unique-uri), true);
now when you do yourEMF.getJavaClass() it will know what project to use
to find the JavaClass.
JavaClass jc = yourEMF.getJavaClass();
if (jc.getKind() != TypeKind.UNDEFINED_LITERAL) {
... valid ...
} else {
... invalid ...
}
And again finally always remove yourRes.
------------------------------ Alternative ---------------
This alternative is if you just want it for validation. Then I wouldn't
put the JavaClass as a reference. I would leave it a string and just use
code to take the string, pass it to reflectType() for the jemProjectRset
and then do is valid test as shown above.
--
Thanks,
Rich Kulp
|
|
|
Goto Forum:
Current Time: Mon Jun 23 12:53:35 EDT 2025
Powered by FUDForum. Page generated in 0.97861 seconds
|