Home » Modeling » UML2 » Upgrade from UML2-2.2.1 to UML2-3.0.0
Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #483390] |
Tue, 01 September 2009 12:40 |
Scott Messages: 33 Registered: July 2009 |
Member |
|
|
Hi,
Im new to this group and have the following question:
I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1, and
UML2-2.2.1.
public static Model initResourceSet(String inputFile){
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri =
URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));
Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
return (Model) (res.getContents().get(0));
}
Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
jars, with only the following change:
URI uri =
URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
Now, Im getting the following error:
Exception in thread "main" java.lang.ClassCastException:
org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
org.eclipse.uml2.uml.Model
At this line: return (Model) (res.getContents().get(0));
Am I missing something?, Can anyone please help?
Thanks,
Scott
|
|
|
Re: Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #483446 is a reply to message #483390] |
Tue, 01 September 2009 15:31 |
Tim Myer Messages: 81 Registered: July 2009 |
Member |
|
|
Hi Scott,
I recently had the same problem loading a UML model in a JUnit test. I
did not see the same problem when the Eclipse platform itself was
running.
As a quick fix, I changed the xmlns:uml attribute to use 3.0.0 instead
of 2.1.0 in the .uml file itself. Is that an option for you?
I would be very interested in hearing a better solution....
---Tim---
Scott wrote:
> Hi,
> I�m new to this group and have the following question:
> I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1,
> and UML2-2.2.1.
> public static Model initResourceSet(String inputFile){
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
>
> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));
>
> Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
> return (Model) (res.getContents().get(0));
> }
>
> Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
> jars, with only the following change:
>
> URI uri =
> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>
>
> Now, I�m getting the following error:
>
> Exception in thread "main" java.lang.ClassCastException:
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
> org.eclipse.uml2.uml.Model
>
> At this line: return (Model) (res.getContents().get(0));
>
> Am I missing something?, Can anyone please help?
>
>
> Thanks,
>
> Scott
>
>
|
|
| |
Re: Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #483547 is a reply to message #483446] |
Wed, 02 September 2009 02:32 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Although I haven't verified this, you can try simply registering the older
nsURI against the latest UMLPackage.eINSTANCE in the package registry. The
automatic up-conversion to the latest version of UML should then occurr
automatically.
Try something like
resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
UMLPackage.eINSTANCE);
In general, if you are having problems in "stand alone" mode, you can look
at the extensions in the MANIFEST.MF in org.eclipse.uml2.uml and try to
mimic the extension point registrations that happen there.
Simply changing the nsURI in the file itself will work "most" of the time
since little has changed between the 2.1.0 and 3.0.0 opensource versions
however this is not recommended and could lead to problems.
The following describes what has changed:
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_3. 0_Migration_Guide/guide.html
Regards,
- James.
"Tim Myer" <timezra@gmail.com> wrote in message
news:h7jeo8$neh$1@build.eclipse.org...
> Hi Scott,
> I recently had the same problem loading a UML model in a JUnit test. I
> did not see the same problem when the Eclipse platform itself was
> running.
> As a quick fix, I changed the xmlns:uml attribute to use 3.0.0 instead of
> 2.1.0 in the .uml file itself. Is that an option for you?
> I would be very interested in hearing a better solution....
> ---Tim---
>
> Scott wrote:
>> Hi,
>> I?m new to this group and have the following question:
>> I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1, and
>> UML2-2.2.1.
>> public static Model initResourceSet(String inputFile){
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>> UMLPackage.eINSTANCE);
>>
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>> UMLResource.Factory.INSTANCE);
>> Map uriMap = resourceSet.getURIConverter().getURIMap();
>> URI uri =
>> URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
>> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
>> uri.appendSegment("libraries").appendSegment(""));
>> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
>> uri.appendSegment("metamodels").appendSegment(""));
>> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
>> uri.appendSegment("profiles").appendSegment(""));
>>
>> Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
>> return (Model) (res.getContents().get(0));
>> }
>>
>> Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
>> jars, with only the following change:
>>
>> URI uri =
>> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>> Now, I?m getting the following error:
>>
>> Exception in thread "main" java.lang.ClassCastException:
>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
>> org.eclipse.uml2.uml.Model
>>
>> At this line: return (Model) (res.getContents().get(0));
>>
>> Am I missing something?, Can anyone please help?
>>
>>
>> Thanks,
>>
>> Scott
>>
|
|
|
Re: Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #483697 is a reply to message #483547] |
Wed, 02 September 2009 15:55 |
Tim Myer Messages: 81 Registered: July 2009 |
Member |
|
|
Thanks, James! That solution worked for me, and it is much better.
---Tim---
James Bruck wrote:
> Although I haven't verified this, you can try simply registering the older
> nsURI against the latest UMLPackage.eINSTANCE in the package registry. The
> automatic up-conversion to the latest version of UML should then occurr
> automatically.
> Try something like
> resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
> UMLPackage.eINSTANCE);
>
> In general, if you are having problems in "stand alone" mode, you can look
> at the extensions in the MANIFEST.MF in org.eclipse.uml2.uml and try to
> mimic the extension point registrations that happen there.
>
> Simply changing the nsURI in the file itself will work "most" of the time
> since little has changed between the 2.1.0 and 3.0.0 opensource versions
> however this is not recommended and could lead to problems.
>
> The following describes what has changed:
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_3. 0_Migration_Guide/guide.html
>
> Regards,
> - James.
>
>
> "Tim Myer" <timezra@gmail.com> wrote in message
> news:h7jeo8$neh$1@build.eclipse.org...
>> Hi Scott,
>> I recently had the same problem loading a UML model in a JUnit test. I
>> did not see the same problem when the Eclipse platform itself was
>> running.
>> As a quick fix, I changed the xmlns:uml attribute to use 3.0.0 instead of
>> 2.1.0 in the .uml file itself. Is that an option for you?
>> I would be very interested in hearing a better solution....
>> ---Tim---
>>
>> Scott wrote:
>>> Hi,
>>> I?m new to this group and have the following question:
>>> I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1, and
>>> UML2-2.2.1.
>>> public static Model initResourceSet(String inputFile){
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>> UMLPackage.eINSTANCE);
>>>
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>> UMLResource.Factory.INSTANCE);
>>> Map uriMap = resourceSet.getURIConverter().getURIMap();
>>> URI uri =
>>> URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
>>> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
>>> uri.appendSegment("libraries").appendSegment(""));
>>> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
>>> uri.appendSegment("metamodels").appendSegment(""));
>>> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
>>> uri.appendSegment("profiles").appendSegment(""));
>>>
>>> Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
>>> return (Model) (res.getContents().get(0));
>>> }
>>>
>>> Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
>>> jars, with only the following change:
>>>
>>> URI uri =
>>> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>>> Now, I?m getting the following error:
>>>
>>> Exception in thread "main" java.lang.ClassCastException:
>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
>>> org.eclipse.uml2.uml.Model
>>>
>>> At this line: return (Model) (res.getContents().get(0));
>>>
>>> Am I missing something?, Can anyone please help?
>>>
>>>
>>> Thanks,
>>>
>>> Scott
>>>
>
|
|
| |
Re: Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #627918 is a reply to message #483390] |
Tue, 01 September 2009 15:31 |
Tim Myer Messages: 81 Registered: July 2009 |
Member |
|
|
Hi Scott,
I recently had the same problem loading a UML model in a JUnit test. I
did not see the same problem when the Eclipse platform itself was
running.
As a quick fix, I changed the xmlns:uml attribute to use 3.0.0 instead
of 2.1.0 in the .uml file itself. Is that an option for you?
I would be very interested in hearing a better solution....
---Tim---
Scott wrote:
> Hi,
> I�m new to this group and have the following question:
> I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1,
> and UML2-2.2.1.
> public static Model initResourceSet(String inputFile){
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
>
> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));
>
> Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
> return (Model) (res.getContents().get(0));
> }
>
> Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
> jars, with only the following change:
>
> URI uri =
> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>
>
> Now, I�m getting the following error:
>
> Exception in thread "main" java.lang.ClassCastException:
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
> org.eclipse.uml2.uml.Model
>
> At this line: return (Model) (res.getContents().get(0));
>
> Am I missing something?, Can anyone please help?
>
>
> Thanks,
>
> Scott
>
>
|
|
| |
Re: Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #627920 is a reply to message #483446] |
Wed, 02 September 2009 02:32 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Although I haven't verified this, you can try simply registering the older
nsURI against the latest UMLPackage.eINSTANCE in the package registry. The
automatic up-conversion to the latest version of UML should then occurr
automatically.
Try something like
resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
UMLPackage.eINSTANCE);
In general, if you are having problems in "stand alone" mode, you can look
at the extensions in the MANIFEST.MF in org.eclipse.uml2.uml and try to
mimic the extension point registrations that happen there.
Simply changing the nsURI in the file itself will work "most" of the time
since little has changed between the 2.1.0 and 3.0.0 opensource versions
however this is not recommended and could lead to problems.
The following describes what has changed:
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_3. 0_Migration_Guide/guide.html
Regards,
- James.
"Tim Myer" <timezra@gmail.com> wrote in message
news:h7jeo8$neh$1@build.eclipse.org...
> Hi Scott,
> I recently had the same problem loading a UML model in a JUnit test. I
> did not see the same problem when the Eclipse platform itself was
> running.
> As a quick fix, I changed the xmlns:uml attribute to use 3.0.0 instead of
> 2.1.0 in the .uml file itself. Is that an option for you?
> I would be very interested in hearing a better solution....
> ---Tim---
>
> Scott wrote:
>> Hi,
>> I?m new to this group and have the following question:
>> I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1, and
>> UML2-2.2.1.
>> public static Model initResourceSet(String inputFile){
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>> UMLPackage.eINSTANCE);
>>
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>> UMLResource.Factory.INSTANCE);
>> Map uriMap = resourceSet.getURIConverter().getURIMap();
>> URI uri =
>> URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
>> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
>> uri.appendSegment("libraries").appendSegment(""));
>> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
>> uri.appendSegment("metamodels").appendSegment(""));
>> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
>> uri.appendSegment("profiles").appendSegment(""));
>>
>> Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
>> return (Model) (res.getContents().get(0));
>> }
>>
>> Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
>> jars, with only the following change:
>>
>> URI uri =
>> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>> Now, I?m getting the following error:
>>
>> Exception in thread "main" java.lang.ClassCastException:
>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
>> org.eclipse.uml2.uml.Model
>>
>> At this line: return (Model) (res.getContents().get(0));
>>
>> Am I missing something?, Can anyone please help?
>>
>>
>> Thanks,
>>
>> Scott
>>
|
|
|
Re: Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #627922 is a reply to message #483547] |
Wed, 02 September 2009 15:55 |
Tim Myer Messages: 81 Registered: July 2009 |
Member |
|
|
Thanks, James! That solution worked for me, and it is much better.
---Tim---
James Bruck wrote:
> Although I haven't verified this, you can try simply registering the older
> nsURI against the latest UMLPackage.eINSTANCE in the package registry. The
> automatic up-conversion to the latest version of UML should then occurr
> automatically.
> Try something like
> resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
> UMLPackage.eINSTANCE);
>
> In general, if you are having problems in "stand alone" mode, you can look
> at the extensions in the MANIFEST.MF in org.eclipse.uml2.uml and try to
> mimic the extension point registrations that happen there.
>
> Simply changing the nsURI in the file itself will work "most" of the time
> since little has changed between the 2.1.0 and 3.0.0 opensource versions
> however this is not recommended and could lead to problems.
>
> The following describes what has changed:
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_3. 0_Migration_Guide/guide.html
>
> Regards,
> - James.
>
>
> "Tim Myer" <timezra@gmail.com> wrote in message
> news:h7jeo8$neh$1@build.eclipse.org...
>> Hi Scott,
>> I recently had the same problem loading a UML model in a JUnit test. I
>> did not see the same problem when the Eclipse platform itself was
>> running.
>> As a quick fix, I changed the xmlns:uml attribute to use 3.0.0 instead of
>> 2.1.0 in the .uml file itself. Is that an option for you?
>> I would be very interested in hearing a better solution....
>> ---Tim---
>>
>> Scott wrote:
>>> Hi,
>>> I?m new to this group and have the following question:
>>> I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1, and
>>> UML2-2.2.1.
>>> public static Model initResourceSet(String inputFile){
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>> UMLPackage.eINSTANCE);
>>>
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>> UMLResource.Factory.INSTANCE);
>>> Map uriMap = resourceSet.getURIConverter().getURIMap();
>>> URI uri =
>>> URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
>>> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
>>> uri.appendSegment("libraries").appendSegment(""));
>>> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
>>> uri.appendSegment("metamodels").appendSegment(""));
>>> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
>>> uri.appendSegment("profiles").appendSegment(""));
>>>
>>> Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
>>> return (Model) (res.getContents().get(0));
>>> }
>>>
>>> Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
>>> jars, with only the following change:
>>>
>>> URI uri =
>>> URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");
>>> Now, I?m getting the following error:
>>>
>>> Exception in thread "main" java.lang.ClassCastException:
>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
>>> org.eclipse.uml2.uml.Model
>>>
>>> At this line: return (Model) (res.getContents().get(0));
>>>
>>> Am I missing something?, Can anyone please help?
>>>
>>>
>>> Thanks,
>>>
>>> Scott
>>>
>
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 19:31:57 GMT 2024
Powered by FUDForum. Page generated in 0.03510 seconds
|