Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] GettingStartedWithUML2 - resource is null
[EMF] GettingStartedWithUML2 - resource is null [message #949907] Fri, 19 October 2012 12:31 Go to next message
Marius ID is currently offline Marius IDFriend
Messages: 2
Registered: October 2012
Junior Member
Hi everybody,

I know this may be a too simple question, but I just started playing with EMF and MDT UML2, evaluating the technology for usage in a future project.

I noticed that I can't save the model to an XMI/XML file with a code like this (or any other alternative found):


protected static void save(org.eclipse.uml2.uml.Package package_, URI uri) {

ResourceSet resourceSet = new ResourceSetImpl();

// This is in a separate guarded routine to isolate the compilation error
// from invoking a MDT/UML2 4.0.0 routine on MDT/UML2 3.0.0
org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(resourceSet);

Resource resource = resourceSet.createResource(uri);

if (resource != null) {
if (resource.getContents() != null) {
resource.getContents().add(package_);
try {
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> map = reg.getExtensionToFactoryMap();
map.put("epo2", new XMIResourceFactoryImpl());
resource.save(System.out, null);
out("Done saving " + package_.getName() + " at URI " + uri);
} catch (IOException ioe) {
err(ioe.getMessage());
}
}
else
err("Unable to save " + package_.getName() + " using URI " + uri
+ " since resource contents is null");
}
else
err("Unable to save " + package_.getName() + " using URI " + uri
+ " since resource is null");
}


since I always get that resource is null. But no other message.

I attached the whole example (constructed by following http://wiki.eclipse.org/MDT/UML2/Getting_Started_with_UML2 tutorial.

I'm using Eclipse Juno SR1 with Oracle JDK 1.7 and MDT-UML2 4.0.1.

Can somebody tell me what is missing? Or what else should I do to make it work?

Any help is greatly appreciated.
Many thanks in advance!


begin 644 GettingStartedWithUML2.java
M#0II;7!O<G0@:F%V82YI;RY)3T5X8V5P=&EO;CL-"FEM<&]R="!J879A+G5T
M:6PN36%P.PT*#0II;7!O<G0@;W)G+F5C;&EP<V4N96UF+F-O;6UO;BYU=&EL
M+E5223L-"FEM<&]R="!O<F<N96-L:7!S92YE;68N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W5T*")0
M86-K86=E("<B("L@<&%C:V%G95\N9V5T475A;&EF:65D3F%M92@I("L@(B<@
M8W)E871E9"XB*3L-"@D)<F5T=7)N('!A8VMA9V5?.PT*"7T-"@T*#0H)<')O
M=&5C=&5D('-T871I8R!0<FEM:71I=F54>7!E(&-R96%T95!R:6UI=&EV951Y
M<&4H;W)G+F5C;&EP<V4N=6UL,BYU;6PN4&%C:V%G92!P86-K86=E7RP@4W1R
M:6YG(&YA;64I('L-"@T*"0E0<FEM:71I=F54>7!E('!R:6UI=&EV951Y<&4@
M/2`H4')I;6ET:79E5'EP92D@<&%C:V%G95\N8W)E871E3W=N9610<FEM:71I
M=F54>7!E*&YA;64I.PT*"0EO=70H(E!R:6UI=&EV92!T>7!E("<B("L@<')I
M;6ET:79E5'EP92YG9711=6%L:69I961.86UE*"D@*R`B)R!C<F5A=&5D+B(I
M.PT*"0ER971U<FX@<')I;6ET:79E5'EP93L-"@E]#0H-"@T*"7!R;W1E8W1E
M9"!S=&%T:6,@16YU;65R871I;VX@8W)E871E16YU;65R871I;VXH;W)G+F5C
M;&EP<V4N=6UL,BYU;6PN4&%C:V%G92!P86-K86=E7RP@4W1R:6YG(&YA;64I
M('L-"@T*"0E%;G5M97)A=&EO;B!E;G5M97)A=&EO;B`]("A%;G5M97)A=&EO
M;BD@<&%C:V%G95\N8W)E871E3W=N961%;G5M97)A=&EO;BAN86UE*3L-"@D)
M;W5T*")%;G5M97)A=&EO;B`G(B`K(&5N=6UE<F%T:6]N+F=E=%%U86QI9FEE
M9$YA;64H*2`K("(G(&-R96%T960N(BD[#0H)"7)E='5R;B!E;G5M97)A=&EO
M;CL-"@E]#0H-"@T*"7!R;W1E8W1E9"!S=&%T:6,@16YU;65R871I;VY,:71E
M<F%L(&-R96%T945N=6UE<F%T:6]N3&ET97)A;"A%;G5M97)A=&EO;B!E;G5M
M97)A=&EO;BP@4W1R:6YG(&YA;64I('L-"@T*"0E%;G5M97)A=&EO;DQI=&5R
M86P@96YU;65R871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L-"@T*"0DO+PT*"0DO+PE0<FEM:71I=F54>7!E<PT*"0DO+PT*#0H)
M"5!R:6UI=&EV951Y<&4@9&%T95!R:6UI=&EV951Y<&4@/2!C<F5A=&50<FEM
M:71I=F54>7!E*&5P;S)-;V1E;"P@(D1A=&4B*3L-"@D)4')I;6ET:79E5'EP
M92!I;G10<FEM:71I=F54>7!E(#T@8W)E871E4')I;6ET:79E5'EP92AE<&\R
M36]D96PL(")I;G0B*3L-"@D)4')I;6ET:79E5'EP92!S:W50<FEM:71I=F54
M>7!E(#T@8W)E871E4')I;6ET:79E5'EP92AE<&\R36]D96PL(")32U4B*3L-
M"@D)4')I;6ET:79E5'EP92!S=')I;F=0<FEM:71I=F54>7!E(#T@8W)E871E
M4')I;6ET:79E5'EP92AE<&\R36]D96PL(")3=')I;F<B*3L-"@T*"0DO+PT*
M"0DO+PE%;G5M97)A=&EO;G,-"@D)+R\-"@T*"0E%;G5M97)A=&EO;B!O<F1E
M<E-T871U<T5N=6UE<F%T:6]N(#T@8W)E871E16YU;65R871I;VXH97!O,DUO
M9&5L+"`B3W)D97)3=&%T=7,B*3L-"@T*"0DO+PT*"0DO+PE%;G5M97)A=&EO
M;DQI=&5R86QS#0H)"2\O#0H-"@D)8W)E871E16YU;65R871I;VY,:71E<F%L
M*&]R9&5R4W1A='5S16YU;65R871I;VXL(")"86-K3W)D97(B*3L-"@D)8W)E
M871E16YU;65R871I;VY,:71E<F%L*&]R9&5R4W1A='5S16YU;65R871I;VXL
M(")#;VUP;&5T92(I.PT*"0EC<F5A=&5%;G5M97)A=&EO;DQI=&5R86PH;W)D
M97)3=&%T=7-%;G5M97)A=&EO;BP@(E!E;F1I;F<B*3L-"@T*"0DO+PT*"0DO
M+PE#;&%S<V5S#0H)"2\O#0H-"@D);W)G+F5C;&EP<V4N=6UL,BYU;6PN0VQA
M<W,@861D<F5S<T-L87-S(#T@8W)E871E0VQA<W,H97!O,DUO9&5L+"`B061D
M<F5S<R(L(&9A;'-E*3L-"@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&%S<RP@=')U92P@06=G<F5G871I;VY+:6YD+D-/35!/4TE415],251%4D%,
M+"`B;W)D97)S(BP@,"P@3&ET97)A;%5N;&EM:71E9$YA='5R86PN54Y,24U)
M5$5$+`T*"0D)"7!U<F-H87-E3W)D97)#;&%S<RP@9F%L<V4L($%G9W)E9V%T
M:6]N2VEN9"Y.3TY%7TQ)5$5204PL("(B+"`Q+"`Q*3L-"@D)8W)E871E07-S
M;V-I871I;VXH<W5P<&QI97)#;&%S<RP@=')U92P@06=G<F5G871I;VY+:6YD
M+D-/35!/4TE415],251%4D%,+"`B8W5S=&]M97)S(BP@,"P-"@D)"0E,:71E
M<F%L56YL:6UI=&5D3F%T=7)A;"Y53DQ)34E4140L(&-U<W1O;65R0VQA<W,L
M(&9A;'-E+"!!9V=R96=A=&EO;DMI;F0N3D].15],251%4D%,+"`B(BP@,2P@
M,2D[#0H)"6-R96%T94%S<V]C:6%T:6]N*'!U<F-H87-E3W)D97)#;&%S<RP@
M=')U92P@06=G<F5G871I;VY+:6YD+D-/35!/4TE415],251%4D%,+"`B8FEL
M;%1O(BP@,2P@,2P@861D<F5S<T-L87-S+"!F86QS92P-"@D)"0E!9V=R96=A
M=&EO;DMI;F0N3D].15],251%4D%,+"`B(BP@,2P@,2D[#0H)"6-R96%T94%S
M<V]C:6%T:6]N*'!U<F-H87-E3W)D97)#;&%S<RP@=')U92P@06=G<F5G871I
M;VY+:6YD+D-/35!/4TE415],251%4D%,+"`B<VAI<%1O(BP@,"P@,2P@861D
M<F5S<T-L87-S+"!F86QS92P-"@D)"0E!9V=R96=A=&EO;DMI;F0N3D].15],
M251%4D%,+"`B(BP@,2P@,2D[#0H)"6-R96%T94%S<V]C:6%T:6]N*'!U<F-H
M87-E3W)D97)#;&%S<RP@=')U92P@06=G<F5G871I;VY+:6YD+D-/35!/4TE4
M15],251%4D%,+"`B:71E;7,B+"`P+`T*"0D)"4QI=&5R86Q5;FQI;6ET961.
M871U<F%L+E5.3$E-251%1"P@:71E;4-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S)-;V1E;"P@55))+F-R96%T949I;&554DDH(F9I;&5S
M(BDN87!P96YD4V5G;65N="@B17AT96YD96103S(B*2YA<'!E;F1&:6QE17AT
M96YS:6]N*%5-3%)E<V]U<F-E+D9)3$5?15A414Y324].*2D[#0H)"2\O(&9O
M<B!B;W1H($D@9V5T.B!5;F%B;&4@=&\@<V%V92!E<&\R('5S:6YG(%5222!F
M:6QE<R]%>'1E;F1E9%!/,BYU;6P@<VEN8V4@<F5S;W5R8V4@:7,@;G5L;"X-
0"@D)#0H)?0T*#0H-"GT-"@``
`
end
Re: [EMF] GettingStartedWithUML2 - resource is null [message #950024 is a reply to message #949907] Fri, 19 October 2012 14:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4153
Registered: July 2009
Senior Member
Hi

Please use the UML2 newsgroup for UML2 discussions.

The introduction of UML 2.4 support has caused some difficulties in
ensuring compatibility with older UML
versions;https://bugs.eclipse.org/bugs/show_bug.cgi?id=389542

The final, least bad resolution was arrived at after SR1 and so you need
to use the maintenance branch from GIT, or a recent I-Build.

The problem lies variously in the

Resource resource = resourceSet.createResource(uri);

or the underlying registrations. With SR1, you need to add a global
registration:

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);

You should remove this once you use SR2. If you are also using pre-UML
4.0.0 nsURI models you must use the latest GIT/I-Build.

Regards

Ed Willink


On 19/10/2012 13:31, Marius ID wrote:
> Hi everybody,
>
> I know this may be a too simple question, but I just started playing with EMF and MDT UML2, evaluating the technology for usage in a future project.
>
> I noticed that I can't save the model to an XMI/XML file with a code like this (or any other alternative found):
>
>
> protected static void save(org.eclipse.uml2.uml.Package package_, URI uri) {
>
> ResourceSet resourceSet = new ResourceSetImpl();
>
> // This is in a separate guarded routine to isolate the compilation error
> // from invoking a MDT/UML2 4.0.0 routine on MDT/UML2 3.0.0
> org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(resourceSet);
>
> Resource resource = resourceSet.createResource(uri);
>
> if (resource != null) {
> if (resource.getContents() != null) {
> resource.getContents().add(package_);
> try {
> Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
> Map<String, Object> map = reg.getExtensionToFactoryMap();
> map.put("epo2", new XMIResourceFactoryImpl());
> resource.save(System.out, null);
> out("Done saving " + package_.getName() + " at URI " + uri);
> } catch (IOException ioe) {
> err(ioe.getMessage());
> }
> }
> else
> err("Unable to save " + package_.getName() + " using URI " + uri
> + " since resource contents is null");
> }
> else
> err("Unable to save " + package_.getName() + " using URI " + uri
> + " since resource is null");
> }
>
>
> since I always get that resource is null. But no other message.
>
> I attached the whole example (constructed by following http://wiki.eclipse.org/MDT/UML2/Getting_Started_with_UML2 tutorial.
>
> I'm using Eclipse Juno SR1 with Oracle JDK 1.7 and MDT-UML2 4.0.1.
>
> Can somebody tell me what is missing? Or what else should I do to make it work?
>
> Any help is greatly appreciated.
> Many thanks in advance!
>
>
Re: [EMF] GettingStartedWithUML2 - resource is null [message #955246 is a reply to message #950024] Tue, 23 October 2012 16:36 Go to previous messageGo to next message
Marius ID is currently offline Marius IDFriend
Messages: 2
Registered: October 2012
Junior Member
Hi Ed,

Thanks alot for the help.
Still it doesn't work, but it's ok. At least for now, I don't need this feature.
Re: [EMF] GettingStartedWithUML2 - resource is null [message #975043 is a reply to message #955246] Wed, 07 November 2012 14:51 Go to previous message
edipo federle is currently offline edipo federleFriend
Messages: 21
Registered: November 2012
Junior Member
worked Here.
Previous Topic:Missing requiremennt: org.eclipse.platform
Next Topic:Missing EMF Editor features in Indigo JEE Package
Goto Forum:
  


Current Time: Wed Nov 26 06:52:06 GMT 2014

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

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