Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » static profiles - not working ;)
static profiles - not working ;) [message #476864] Tue, 22 January 2008 14:26 Go to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080903030902080901060108
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

hi all,

I've followed this tutorial:
----------- Create your Profile -------------
1. Create your uml profile as you would normally ( For example, create a
stereotype called MyExtendedClass that extends uml:Class ). (see the getting
started article for details ). (Call it My.profile.uml for example)
2. ** don't do the "define" step ***
3. On your profile, apply the <<ePackage>> stereotype from the existing
Ecore profile.
4. Set the nsURI to something ... say http://www.myOrg/MyProfile

------- Generate code ---------
1. Create an EMF project as you would from any other .uml model to generate
code from but specify your profile as the source ( My.profile.uml )
2. Select the "Process All" options when loading your My.profile.uml.
3. Generate code as you would normally from the resulting .genmodel.

------- Using your profile ------
Up to this point, things were pretty easy. Here comes the tricky part...

1. Move your previously generated code for your profile to your development
environment.
2. Create a new plugin in your development environment ( say a JUnit plugin
to get started with ).
3. In your JUnit plugin test, add the line:

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is the
id of the profile in your model.
4. Create a resource set and load your My.profile.uml.
5. Next, Load your profile using..
Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
.... )
from the already generated MyProfilePackage from the "Generate Code"
step.
6. Next, obtain your stereotype with..
Stereotype myStereotype =
myProfile.getOwnedStereotype("MyExtendedClass");
7. This is the interesting part ... Apply your stereotype as follows:
MyExtendedClass myExtendedClass =
(MyExtendedClass)myClass.applyStereotype(myStereotype);
Notice how you do not get a stereotype application but rather a type of
"MyExtendedClass".
8. Now you have full access to setting variagbles to MyExtendedClass etc.
--- how cool is that ;) ----


and couldn't get it running. The reason is that
package_.applyProfile(myProfile); calls ProfileOperations: EPackage
getDefinition(Profile profile). This calls getTaggedValue(package_,
"Ecore" ... which -since I skipped the the define step (2)- is always
not there (null).

I've attached my test code and the .profile.uml.

For online-viewing, see http://rafb.net/p/9BbS1L94.html

The result of the code is:

>>>>>>>>>>>>>

Content of ProfileResi
org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
visibility: <unset>) (visibility: public)
org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
(instanceClassName: null) (abstract: false, interface: false)) (mixed:
[], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
packageName=myProf, nsURI=http://www.my.org/Profile])
myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
My, visibility: <unset>) (visibility: public)
Profile could not be applied
java.lang.IllegalArgumentException:
org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
visibility: <unset>) (visibility: public)
at
org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
at
org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
at test.StaticProfile.testProfile(StaticProfile.java:102)

Stereotypes
at test.StaticProfile.main(StaticProfile.java:32


What am I doing wrong?
-stefan

--------------080903030902080901060108
Content-Type: text/xml;
name="GUI_OiO.profile.uml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="GUI_OiO.profile.uml"

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4 pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
<uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232" name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
<packageImport xmi:id="_0metamodelReferenceGUI_OiO">
<importedPackage xmi:type="uml:Model" href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
</packageImport>
<packageImport xmi:id="_0primitiveTypesGUI_OiO">
<importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
<importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl" isAbstract="true">
<ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class" visibility="private" association="_12_5_1_15200e0_1191951461742_136617_256">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name" visibility="public">
<type xmi:type="uml:PrimitiveType" href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name="" memberEnd="_12_5_1_15200e0_1191951461749_945624_258 _12_5_1_15200e0_1191951461747_586671_257">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_" visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254" aggregation="composite" association="_12_5_1_15200e0_1191951461742_136617_256">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Enumeration" xmi:id="_12_5_1_15200e0_1191951577864_290094_283" name="UIContainerType">
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302" name="COMPOSITE"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304" name="SECTION"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306" name="DIALOG"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308" name="WIZARD"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310" name="VIEW"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312" name="TABFOLDER"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314" name="GROUP"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316" name="SCREEN"/>
</packagedElement>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
<generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346" isSubstitutable="false" general="_12_5_1_15200e0_1191951444711_532617_254"/>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class" visibility="private" association="_12_5_1_15200e0_1191951692820_933016_321">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type" visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name="" memberEnd="_12_5_1_15200e0_1191951692820_263208_322 _12_5_1_15200e0_1191951692821_296714_323">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_" visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319" aggregation="composite" association="_12_5_1_15200e0_1191951692820_933016_321">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl" isAbstract="true">
<generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447" isSubstitutable="false" general="_12_5_1_15200e0_1191951444711_532617_254"/>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class" visibility="private" association="_12_5_1_15200e0_1191951767428_598809_373">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name="" memberEnd="_12_5_1_15200e0_1191951767428_923400_374 _12_5_1_15200e0_1191951767428_297656_375">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_" visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371" aggregation="composite" association="_12_5_1_15200e0_1191951767428_598809_373">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children UIContainer->UIControl">
<ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609" name="base_Association" visibility="private" association="_12_5_1_15200e0_1191952252680_904621_608">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name="" memberEnd="_12_5_1_15200e0_1191952252681_480707_610 _12_5_1_15200e0_1191952252681_709833_609">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_" visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606" aggregation="composite" association="_12_5_1_15200e0_1191952252680_904621_608">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Enumeration" xmi:id="_12_5_1_15200e0_1191952434982_520771_645" name="UIComplexDataControlType">
<ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664" name="TABLE"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666" name="TREE"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668" name="LIST"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670" name="FORM"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672" name="EDITOR"/>
</packagedElement>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191952552688_338708_675" name="dataControlChildren UIComplexDataControl->UIDataControl">
<ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678" name="base_Association" visibility="private" association="_12_5_1_15200e0_1191952555379_305362_677">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name="" memberEnd="_12_5_1_15200e0_1191952555380_36450_679 _12_5_1_15200e0_1191952555379_166950_678">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_" visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675" aggregation="composite" association="_12_5_1_15200e0_1191952555379_305362_677">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191952642401_691287_756" name="UIComplexDataControl">
<generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789" isSubstitutable="false" general="_12_5_1_15200e0_1191951761873_224879_371"/>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759" name="base_Class" visibility="private" association="_12_5_1_15200e0_1191952645284_484596_758">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780" name="type" visibility="public" type="_12_5_1_15200e0_1191952434982_520771_645">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name="" memberEnd="_12_5_1_15200e0_1191952645284_114215_759 _12_5_1_15200e0_1191952645284_100915_760">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_" visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756" aggregation="composite" association="_12_5_1_15200e0_1191952645284_484596_758">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191953026669_238956_938" name="complexDataControl UIDataControl->UIComplexDataControl">
<ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941" name="base_Association" visibility="private" association="_12_5_1_15200e0_1191953028759_918634_940">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name="" memberEnd="_12_5_1_15200e0_1191953028759_804402_942 _12_5_1_15200e0_1191953028759_239041_941">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_" visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938" aggregation="composite" association="_12_5_1_15200e0_1191953028759_918634_940">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Stereotype" xmi:id="_12_5_1_15200e0_1191953113254_841091_964" name="UIPrimitiveDataControl">
<generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019" isSubstitutable="false" general="_12_5_1_15200e0_1191951761873_224879_371"/>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967" name="base_Class" visibility="private" association="_12_5_1_15200e0_1191953116891_964982_966">
<type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
</ownedAttribute>
<ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014" name="type" visibility="public" type="_12_5_1_15200e0_1191953126646_606954_989">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
</ownedAttribute>
</packagedElement>
<packagedElement xmi:type="uml:Extension" xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name="" memberEnd="_12_5_1_15200e0_1191953116892_385941_968 _12_5_1_15200e0_1191953116891_548625_967">
<ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_" visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964" aggregation="composite" association="_12_5_1_15200e0_1191953116891_964982_966">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
</ownedEnd>
</packagedElement>
<packagedElement xmi:type="uml:Enumeration" xmi:id="_12_5_1_15200e0_1191953126646_606954_989" name="UIPrimitiveDataControlType">
<ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008" name="BUTTON"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010" name="TEXT"/>
<ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012" name="LABEL"/>
</packagedElement>
<profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
<eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
</eAnnotations>
<appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
</profileApplication>
</uml:Profile>
<Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ" base_Package="_12_5_1_15200e0_1191951371278_589868_232" packageName="guiProfile" nsPrefix="guiProfileNS" nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile" basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
</xmi:XMI>

--------------080903030902080901060108
Content-Type: text/x-java;
name="StaticProfile.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="StaticProfile.java"

package test;
import java.io.IOException;
import java.util.Map;

import myProf.MyClass;
import myProf.MyProfPackage;

import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UMLPlugin;
import org.eclipse.uml2.uml.resource.UMLResource;
import org.eclipse.uml2.uml.util.UMLUtil;


public class StaticProfile {


public static void main(String[] args){
try {
testProfile();
} catch (Exception e) {
e.printStackTrace();
}
}
private final static String workspace = "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
// private final static String runtime = " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
private final static String testModel = " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
private final static String umlJarLoc = " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
private final static String path2profile = workspace;

// private final static String profileEPackageName = "myProf";
private final static String profileNS = MyProfPackage.eNS_URI; //"http://www.my.org/Profile";
private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";

private static void testProfile() {
System.out.println(">>>>>>>>>>>>>");

System.out.println();
// UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName, URI.createURI(path2profile+suffix));
// UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName, URI.createURI(path2profile));
UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS, URI.createURI(path2profile+suffix));
// UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS, URI.createURI(path2profile));
// UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName, URI.createURI(path2profile+suffix));

// Map<String, URI> nsURI2ProfileMap = UMLPlugin.getEPackageNsURIToProfileLocationMap();

// uml init
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI(umlJarLoc);
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(""));

Map<String,Object> p2fMap = resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
// uml init ()
// Resource testResi = resourceSet.getResource(URI.createURI(path2profile+suffix), true);
// System.out.println("Content of TestResi");
// for(EObject obj : testResi.getContents()){
// System.out.println(obj);
// }

Resource resi = resourceSet.createResource(URI.createFileURI(testModel));
Resource profileResi = resourceSet.getResource(URI.createFileURI(path2profile), true);
System.out.println("Content of ProfileResi");
for(EObject obj : profileResi.getContents()){
System.out.println(obj);
}


// uml bsp data
Package package_ = UMLFactory.eINSTANCE.createPackage();
resi.getContents().add(package_);
package_.setName("MeinPacket");
Class clazz = UMLFactory.eINSTANCE.createClass();
clazz.setPackage(package_);
clazz.setName("MeineKlasse2");
// uml bsp data()

Profile myProfile = UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
if(myProfile==null){
System.out.println("myProfile==null");
} else{
System.out.println("myProfile: "+myProfile);
}

try{
package_.applyProfile(myProfile);
} catch (Exception e) {
System.out.println("Profile could not be applied");
e.printStackTrace();
}

System.out.println("\nStereotypes");
for(Stereotype stereo : clazz.getApplicableStereotypes()){
System.out.println(stereo);
}


// save
try {
resi.save(null);
} catch (IOException e) {
e.printStackTrace();
}
}
}

--------------080903030902080901060108--
Re: static profiles - not working ;) [message #476865 is a reply to message #476864] Tue, 22 January 2008 14:57 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Stefan,

In steps 3 and 4, you should have applied the <<ePackage>> stereotype to the
profile and set the value of the 'nsURI' tag:

3. On your profile, apply the <<ePackage>> stereotype from the existing
Ecore profile.
4. Set the nsURI to something ... say http://www.myOrg/MyProfile

This is the tag whose value is being obtained during look-up of the
profile's definition. If this look-up is failing, something else must be
going wrong... have you tried debugging the code?

Kenn

"SKuhn" <kuhn@oio.de> wrote in message
news:fn4umc$q8s$1@build.eclipse.org...
> hi all,
>
> I've followed this tutorial:
> ----------- Create your Profile -------------
> 1. Create your uml profile as you would normally ( For example, create a
> stereotype called MyExtendedClass that extends uml:Class ). (see the
> getting
> started article for details ). (Call it My.profile.uml for example)
> 2. ** don't do the "define" step ***
> 3. On your profile, apply the <<ePackage>> stereotype from the existing
> Ecore profile.
> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>
> ------- Generate code ---------
> 1. Create an EMF project as you would from any other .uml model to
> generate
> code from but specify your profile as the source ( My.profile.uml )
> 2. Select the "Process All" options when loading your My.profile.uml.
> 3. Generate code as you would normally from the resulting .genmodel.
>
> ------- Using your profile ------
> Up to this point, things were pretty easy. Here comes the tricky part...
>
> 1. Move your previously generated code for your profile to your
> development
> environment.
> 2. Create a new plugin in your development environment ( say a JUnit
> plugin
> to get started with ).
> 3. In your JUnit plugin test, add the line:
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is
> the
> id of the profile in your model.
> 4. Create a resource set and load your My.profile.uml.
> 5. Next, Load your profile using..
> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
> ... )
> from the already generated MyProfilePackage from the "Generate Code"
> step.
> 6. Next, obtain your stereotype with..
> Stereotype myStereotype =
> myProfile.getOwnedStereotype("MyExtendedClass");
> 7. This is the interesting part ... Apply your stereotype as follows:
> MyExtendedClass myExtendedClass =
> (MyExtendedClass)myClass.applyStereotype(myStereotype);
> Notice how you do not get a stereotype application but rather a type
> of
> "MyExtendedClass".
> 8. Now you have full access to setting variagbles to MyExtendedClass etc.
> --- how cool is that ;) ----
>
>
> and couldn't get it running. The reason is that
> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
> getDefinition(Profile profile). This calls getTaggedValue(package_,
> "Ecore" ... which -since I skipped the the define step (2)- is always
> not there (null).
>
> I've attached my test code and the .profile.uml.
>
> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>
> The result of the code is:
>
> >>>>>>>>>>>>>
>
> Content of ProfileResi
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
> visibility: <unset>) (visibility: public)
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
> packageName=myProf, nsURI=http://www.my.org/Profile])
> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
> My, visibility: <unset>) (visibility: public)
> Profile could not be applied
> java.lang.IllegalArgumentException:
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
> visibility: <unset>) (visibility: public)
> at
> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
> at
> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
> at test.StaticProfile.testProfile(StaticProfile.java:102)
>
> Stereotypes
> at test.StaticProfile.main(StaticProfile.java:32
>
>
> What am I doing wrong?
> -stefan
>


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


> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
> isAbstract="true">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951461742_136617_256">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
> name="name" visibility="public">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
> _12_5_1_15200e0_1191951461747_586671_257">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951461742_136617_256">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191951577864_290094_283" name="UIContainerType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
> name="COMPOSITE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
> name="SECTION"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
> name="DIALOG"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
> name="WIZARD"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
> name="VIEW"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
> name="TABFOLDER"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
> name="GROUP"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
> name="SCREEN"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951444711_532617_254"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951692820_933016_321">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191951577864_290094_283">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
> _12_5_1_15200e0_1191951692821_296714_323">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951692820_933016_321">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
> isAbstract="true">
> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951444711_532617_254"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951767428_598809_373">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
> _12_5_1_15200e0_1191951767428_297656_375">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951767428_598809_373">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
> UIContainer->UIControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191952252680_904621_608">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
> _12_5_1_15200e0_1191952252681_709833_609">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952252680_904621_608">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
> name="UIComplexDataControlType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
> name="TABLE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
> name="TREE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
> name="LIST"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
> name="FORM"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
> name="EDITOR"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
> name="dataControlChildren UIComplexDataControl->UIDataControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191952555379_305362_677">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
> _12_5_1_15200e0_1191952555379_166950_678">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952555379_305362_677">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
> name="UIComplexDataControl">
> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951761873_224879_371"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191952645284_484596_758">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191952434982_520771_645">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
> _12_5_1_15200e0_1191952645284_100915_760">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952645284_484596_758">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191953026669_238956_938" name="complexDataControl
> UIDataControl->UIComplexDataControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191953028759_918634_940">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
> _12_5_1_15200e0_1191953028759_239041_941">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
> aggregation="composite"
> association="_12_5_1_15200e0_1191953028759_918634_940">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
> name="UIPrimitiveDataControl">
> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951761873_224879_371"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191953116891_964982_966">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191953126646_606954_989">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
> _12_5_1_15200e0_1191953116891_548625_967">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
> aggregation="composite"
> association="_12_5_1_15200e0_1191953116891_964982_966">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
> name="UIPrimitiveDataControlType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
> name="BUTTON"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
> name="TEXT"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
> name="LABEL"/>
> </packagedElement>
> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
> </eAnnotations>
> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
> </profileApplication>
> </uml:Profile>
> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
> packageName="guiProfile" nsPrefix="guiProfileNS"
> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
> </xmi:XMI>
>


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


> package test;
> import java.io.IOException;
> import java.util.Map;
>
> import myProf.MyClass;
> import myProf.MyProfPackage;
>
> import org.eclipse.emf.common.EMFPlugin;
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.emf.ecore.EPackage.Registry;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.util.EcoreUtil;
> import org.eclipse.uml2.uml.Class;
> import org.eclipse.uml2.uml.Package;
> import org.eclipse.uml2.uml.Profile;
> import org.eclipse.uml2.uml.Stereotype;
> import org.eclipse.uml2.uml.UMLFactory;
> import org.eclipse.uml2.uml.UMLPackage;
> import org.eclipse.uml2.uml.UMLPlugin;
> import org.eclipse.uml2.uml.resource.UMLResource;
> import org.eclipse.uml2.uml.util.UMLUtil;
>
>
> public class StaticProfile {
>
>
> public static void main(String[] args){
> try {
> testProfile();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> private final static String workspace =
> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
> // private final static String runtime =
> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
> private final static String testModel =
> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
> private final static String umlJarLoc =
> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
> private final static String path2profile = workspace;
>
> // private final static String profileEPackageName = "myProf";
> private final static String profileNS = MyProfPackage.eNS_URI;
> //"http://www.my.org/Profile";
> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>
> private static void testProfile() {
> System.out.println(">>>>>>>>>>>>>");
>
> System.out.println();
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile+suffix));
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile));
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
> URI.createURI(path2profile+suffix));
> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
> URI.createURI(path2profile));
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile+suffix));
>
> // Map<String, URI> nsURI2ProfileMap =
> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>
> // uml init
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri = URI.createURI(umlJarLoc);
> 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(""));
>
> Map<String,Object> p2fMap =
> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
> // uml init ()
> // Resource testResi =
> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
> // System.out.println("Content of TestResi");
> // for(EObject obj : testResi.getContents()){
> // System.out.println(obj);
> // }
>
> Resource resi = resourceSet.createResource(URI.createFileURI(testModel));
> Resource profileResi =
> resourceSet.getResource(URI.createFileURI(path2profile), true);
> System.out.println("Content of ProfileResi");
> for(EObject obj : profileResi.getContents()){
> System.out.println(obj);
> }
>
>
> // uml bsp data
> Package package_ = UMLFactory.eINSTANCE.createPackage();
> resi.getContents().add(package_);
> package_.setName("MeinPacket");
> Class clazz = UMLFactory.eINSTANCE.createClass();
> clazz.setPackage(package_);
> clazz.setName("MeineKlasse2");
> // uml bsp data()
>
> Profile myProfile = UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
> if(myProfile==null){
> System.out.println("myProfile==null");
> } else{
> System.out.println("myProfile: "+myProfile);
> }
>
> try{
> package_.applyProfile(myProfile);
> } catch (Exception e) {
> System.out.println("Profile could not be applied");
> e.printStackTrace();
> }
>
> System.out.println("\nStereotypes");
> for(Stereotype stereo : clazz.getApplicableStereotypes()){
> System.out.println(stereo);
> }
>
>
> // save
> try {
> resi.save(null);
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }
>
Re: static profiles - not working ;) [message #476867 is a reply to message #476865] Tue, 22 January 2008 15:06 Go to previous messageGo to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
oh right, I haven't seen it in the UML Editor, and when I looked in the
..uml late at night didn't see it, but the annotation is there:

<profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
<eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
</eAnnotations>
<appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
</profileApplication>
---

I've tried debugging the code, but as I said, the eAnnotation was not
resolved. I'll try it again, now that I now it is there :)

-stefan



Kenn Hussey wrote:
> Stefan,
>
> In steps 3 and 4, you should have applied the <<ePackage>> stereotype to the
> profile and set the value of the 'nsURI' tag:
>
> 3. On your profile, apply the <<ePackage>> stereotype from the existing
> Ecore profile.
> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>
> This is the tag whose value is being obtained during look-up of the
> profile's definition. If this look-up is failing, something else must be
> going wrong... have you tried debugging the code?
>
> Kenn
>
> "SKuhn" <kuhn@oio.de> wrote in message
> news:fn4umc$q8s$1@build.eclipse.org...
>> hi all,
>>
>> I've followed this tutorial:
>> ----------- Create your Profile -------------
>> 1. Create your uml profile as you would normally ( For example, create a
>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>> getting
>> started article for details ). (Call it My.profile.uml for example)
>> 2. ** don't do the "define" step ***
>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>> Ecore profile.
>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>
>> ------- Generate code ---------
>> 1. Create an EMF project as you would from any other .uml model to
>> generate
>> code from but specify your profile as the source ( My.profile.uml )
>> 2. Select the "Process All" options when loading your My.profile.uml.
>> 3. Generate code as you would normally from the resulting .genmodel.
>>
>> ------- Using your profile ------
>> Up to this point, things were pretty easy. Here comes the tricky part...
>>
>> 1. Move your previously generated code for your profile to your
>> development
>> environment.
>> 2. Create a new plugin in your development environment ( say a JUnit
>> plugin
>> to get started with ).
>> 3. In your JUnit plugin test, add the line:
>>
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is
>> the
>> id of the profile in your model.
>> 4. Create a resource set and load your My.profile.uml.
>> 5. Next, Load your profile using..
>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>> ... )
>> from the already generated MyProfilePackage from the "Generate Code"
>> step.
>> 6. Next, obtain your stereotype with..
>> Stereotype myStereotype =
>> myProfile.getOwnedStereotype("MyExtendedClass");
>> 7. This is the interesting part ... Apply your stereotype as follows:
>> MyExtendedClass myExtendedClass =
>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>> Notice how you do not get a stereotype application but rather a type
>> of
>> "MyExtendedClass".
>> 8. Now you have full access to setting variagbles to MyExtendedClass etc.
>> --- how cool is that ;) ----
>>
>>
>> and couldn't get it running. The reason is that
>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>> "Ecore" ... which -since I skipped the the define step (2)- is always
>> not there (null).
>>
>> I've attached my test code and the .profile.uml.
>>
>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>
>> The result of the code is:
>>
>> Content of ProfileResi
>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>> visibility: <unset>) (visibility: public)
>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>> packageName=myProf, nsURI=http://www.my.org/Profile])
>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
>> My, visibility: <unset>) (visibility: public)
>> Profile could not be applied
>> java.lang.IllegalArgumentException:
>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>> visibility: <unset>) (visibility: public)
>> at
>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>> at
>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>
>> Stereotypes
>> at test.StaticProfile.main(StaticProfile.java:32
>>
>>
>> What am I doing wrong?
>> -stefan
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>> </packageImport>
>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>> isAbstract="true">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951461742_136617_256">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>> name="name" visibility="public">
>> <type xmi:type="uml:PrimitiveType"
>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>> _12_5_1_15200e0_1191951461747_586671_257">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951461742_136617_256">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283" name="UIContainerType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>> name="COMPOSITE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>> name="SECTION"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>> name="DIALOG"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>> name="WIZARD"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>> name="VIEW"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>> name="TABFOLDER"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>> name="GROUP"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>> name="SCREEN"/>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951692820_933016_321">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191951577864_290094_283">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>> _12_5_1_15200e0_1191951692821_296714_323">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951692820_933016_321">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>> isAbstract="true">
>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951767428_598809_373">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>> _12_5_1_15200e0_1191951767428_297656_375">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951767428_598809_373">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>> UIContainer->UIControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191952252680_904621_608">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>> _12_5_1_15200e0_1191952252681_709833_609">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952252680_904621_608">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>> name="UIComplexDataControlType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>> name="TABLE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>> name="TREE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>> name="LIST"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>> name="FORM"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>> name="EDITOR"/>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191952555379_305362_677">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>> _12_5_1_15200e0_1191952555379_166950_678">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952555379_305362_677">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>> name="UIComplexDataControl">
>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191952645284_484596_758">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191952434982_520771_645">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>> _12_5_1_15200e0_1191952645284_100915_760">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952645284_484596_758">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938" name="complexDataControl
>> UIDataControl->UIComplexDataControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191953028759_918634_940">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>> _12_5_1_15200e0_1191953028759_239041_941">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191953028759_918634_940">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>> name="UIPrimitiveDataControl">
>> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191953116891_964982_966">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191953126646_606954_989">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>> _12_5_1_15200e0_1191953116891_548625_967">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191953116891_964982_966">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>> name="UIPrimitiveDataControlType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>> name="BUTTON"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>> name="TEXT"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>> name="LABEL"/>
>> </packagedElement>
>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>> </eAnnotations>
>> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>> </profileApplication>
>> </uml:Profile>
>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>> packageName="guiProfile" nsPrefix="guiProfileNS"
>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>> </xmi:XMI>
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> package test;
>> import java.io.IOException;
>> import java.util.Map;
>>
>> import myProf.MyClass;
>> import myProf.MyProfPackage;
>>
>> import org.eclipse.emf.common.EMFPlugin;
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.ecore.EObject;
>> import org.eclipse.emf.ecore.EPackage.Registry;
>> import org.eclipse.emf.ecore.resource.Resource;
>> import org.eclipse.emf.ecore.resource.ResourceSet;
>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>> import org.eclipse.emf.ecore.util.EcoreUtil;
>> import org.eclipse.uml2.uml.Class;
>> import org.eclipse.uml2.uml.Package;
>> import org.eclipse.uml2.uml.Profile;
>> import org.eclipse.uml2.uml.Stereotype;
>> import org.eclipse.uml2.uml.UMLFactory;
>> import org.eclipse.uml2.uml.UMLPackage;
>> import org.eclipse.uml2.uml.UMLPlugin;
>> import org.eclipse.uml2.uml.resource.UMLResource;
>> import org.eclipse.uml2.uml.util.UMLUtil;
>>
>>
>> public class StaticProfile {
>>
>>
>> public static void main(String[] args){
>> try {
>> testProfile();
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>> }
>> private final static String workspace =
>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>> // private final static String runtime =
>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>> private final static String testModel =
>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>> private final static String umlJarLoc =
>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>> private final static String path2profile = workspace;
>>
>> // private final static String profileEPackageName = "myProf";
>> private final static String profileNS = MyProfPackage.eNS_URI;
>> //"http://www.my.org/Profile";
>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>
>> private static void testProfile() {
>> System.out.println(">>>>>>>>>>>>>");
>>
>> System.out.println();
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile+suffix));
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile));
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>> URI.createURI(path2profile+suffix));
>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>> URI.createURI(path2profile));
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile+suffix));
>>
>> // Map<String, URI> nsURI2ProfileMap =
>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>
>> // uml init
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>> UMLPackage.eINSTANCE);
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>> UMLResource.Factory.INSTANCE);
>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>> URI uri = URI.createURI(umlJarLoc);
>> 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(""));
>>
>> Map<String,Object> p2fMap =
>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>> // uml init ()
>> // Resource testResi =
>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>> // System.out.println("Content of TestResi");
>> // for(EObject obj : testResi.getContents()){
>> // System.out.println(obj);
>> // }
>>
>> Resource resi = resourceSet.createResource(URI.createFileURI(testModel));
>> Resource profileResi =
>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>> System.out.println("Content of ProfileResi");
>> for(EObject obj : profileResi.getContents()){
>> System.out.println(obj);
>> }
>>
>>
>> // uml bsp data
>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>> resi.getContents().add(package_);
>> package_.setName("MeinPacket");
>> Class clazz = UMLFactory.eINSTANCE.createClass();
>> clazz.setPackage(package_);
>> clazz.setName("MeineKlasse2");
>> // uml bsp data()
>>
>> Profile myProfile = UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>> if(myProfile==null){
>> System.out.println("myProfile==null");
>> } else{
>> System.out.println("myProfile: "+myProfile);
>> }
>>
>> try{
>> package_.applyProfile(myProfile);
>> } catch (Exception e) {
>> System.out.println("Profile could not be applied");
>> e.printStackTrace();
>> }
>>
>> System.out.println("\nStereotypes");
>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>> System.out.println(stereo);
>> }
>>
>>
>> // save
>> try {
>> resi.save(null);
>> } catch (IOException e) {
>> e.printStackTrace();
>> }
>> }
>> }
>>
>
>
Re: static profiles - not working ;) [message #476868 is a reply to message #476867] Tue, 22 January 2008 17:06 Go to previous messageGo to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
well, with a closer look in PackageOperations, ApplyProfile I found
following:

EPackage profileDefinition = profile.getDefinition();

if (profileDefinition == null) {
throw new IllegalArgumentException(String.valueOf(profile));
}

if (package_.getProfileApplication(profile) == null) {
package_.createProfileApplication().setAppliedProfile(profil e);
}


--
profile.getDefinition(); return null, and the eAnnotation which I found
in .profile.uml is used -later on- for getProfile Application.

So, because my Profile is not defined, I don't have an annotation for it
-help!

-stefan

SKuhn wrote:
> oh right, I haven't seen it in the UML Editor, and when I looked in the
> .uml late at night didn't see it, but the annotation is there:
>
> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
> </eAnnotations>
> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
> </profileApplication>
> ---
>
> I've tried debugging the code, but as I said, the eAnnotation was not
> resolved. I'll try it again, now that I now it is there :)
>
> -stefan
>
>
>
> Kenn Hussey wrote:
>> Stefan,
>>
>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>> to the profile and set the value of the 'nsURI' tag:
>>
>> 3. On your profile, apply the <<ePackage>> stereotype from the
>> existing Ecore profile.
>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>
>> This is the tag whose value is being obtained during look-up of the
>> profile's definition. If this look-up is failing, something else must
>> be going wrong... have you tried debugging the code?
>>
>> Kenn
>>
>> "SKuhn" <kuhn@oio.de> wrote in message
>> news:fn4umc$q8s$1@build.eclipse.org...
>>> hi all,
>>>
>>> I've followed this tutorial:
>>> ----------- Create your Profile -------------
>>> 1. Create your uml profile as you would normally ( For example, create a
>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>> getting
>>> started article for details ). (Call it My.profile.uml for example)
>>> 2. ** don't do the "define" step ***
>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>> Ecore profile.
>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>
>>> ------- Generate code ---------
>>> 1. Create an EMF project as you would from any other .uml model to
>>> generate
>>> code from but specify your profile as the source ( My.profile.uml )
>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>
>>> ------- Using your profile ------
>>> Up to this point, things were pretty easy. Here comes the tricky
>>> part...
>>>
>>> 1. Move your previously generated code for your profile to your
>>> development
>>> environment.
>>> 2. Create a new plugin in your development environment ( say a JUnit
>>> plugin
>>> to get started with ).
>>> 3. In your JUnit plugin test, add the line:
>>>
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>
>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>> is the
>>> id of the profile in your model.
>>> 4. Create a resource set and load your My.profile.uml.
>>> 5. Next, Load your profile using..
>>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>> ... )
>>> from the already generated MyProfilePackage from the "Generate Code"
>>> step.
>>> 6. Next, obtain your stereotype with..
>>> Stereotype myStereotype =
>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>> 7. This is the interesting part ... Apply your stereotype as follows:
>>> MyExtendedClass myExtendedClass =
>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>> Notice how you do not get a stereotype application but rather a
>>> type of
>>> "MyExtendedClass".
>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>> etc.
>>> --- how cool is that ;) ----
>>>
>>>
>>> and couldn't get it running. The reason is that
>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>> not there (null).
>>>
>>> I've attached my test code and the .profile.uml.
>>>
>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>
>>> The result of the code is:
>>>
>>> Content of ProfileResi
>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>> visibility: <unset>) (visibility: public)
>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
>>> My, visibility: <unset>) (visibility: public)
>>> Profile could not be applied
>>> java.lang.IllegalArgumentException:
>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>> visibility: <unset>) (visibility: public)
>>> at
>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>
>>> at
>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>
>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>
>>> Stereotypes
>>> at test.StaticProfile.main(StaticProfile.java:32
>>>
>>>
>>> What am I doing wrong?
>>> -stefan
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xmi:XMI xmi:version="2.1"
>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>> </packageImport>
>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>> </packageImport>
>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>> </packageImport>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>> isAbstract="true">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name"
>>> visibility="public">
>>> <type xmi:type="uml:PrimitiveType"
>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>> _12_5_1_15200e0_1191951461747_586671_257">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>> name="UIContainerType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>> name="COMPOSITE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>> name="SECTION"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>> name="DIALOG"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>> name="WIZARD"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>> name="VIEW"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>> name="TABFOLDER"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>> name="GROUP"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>> name="SCREEN"/>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type"
>>> visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>> _12_5_1_15200e0_1191951692821_296714_323">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371"
>>> name="UIDataControl" isAbstract="true">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>> _12_5_1_15200e0_1191951767428_297656_375">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>> UIContainer->UIControl">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>> _12_5_1_15200e0_1191952252681_709833_609">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>> name="UIComplexDataControlType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>> name="TABLE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>> name="TREE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>> name="LIST"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>> name="FORM"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>> name="EDITOR"/>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>> _12_5_1_15200e0_1191952555379_166950_678">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>> name="UIComplexDataControl">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952645284_114215_759" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952721352_812895_780" name="type"
>>> visibility="public" type="_12_5_1_15200e0_1191952434982_520771_645">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>> _12_5_1_15200e0_1191952645284_100915_760">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>> _12_5_1_15200e0_1191953028759_239041_941">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>> name="UIPrimitiveDataControl">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191953116891_548625_967" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>> name="type" visibility="public"
>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>> _12_5_1_15200e0_1191953116891_548625_967">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>> name="UIPrimitiveDataControlType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>> name="BUTTON"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>> name="TEXT"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>> name="LABEL"/>
>>> </packagedElement>
>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>> <references xmi:type="ecore:EPackage"
>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>
>>> </eAnnotations>
>>> <appliedProfile
>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>> </profileApplication>
>>> </uml:Profile>
>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>> </xmi:XMI>
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>
>>> package test;
>>> import java.io.IOException;
>>> import java.util.Map;
>>>
>>> import myProf.MyClass;
>>> import myProf.MyProfPackage;
>>>
>>> import org.eclipse.emf.common.EMFPlugin;
>>> import org.eclipse.emf.common.util.URI;
>>> import org.eclipse.emf.ecore.EObject;
>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>> import org.eclipse.emf.ecore.resource.Resource;
>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>> import org.eclipse.uml2.uml.Class;
>>> import org.eclipse.uml2.uml.Package;
>>> import org.eclipse.uml2.uml.Profile;
>>> import org.eclipse.uml2.uml.Stereotype;
>>> import org.eclipse.uml2.uml.UMLFactory;
>>> import org.eclipse.uml2.uml.UMLPackage;
>>> import org.eclipse.uml2.uml.UMLPlugin;
>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>
>>>
>>> public class StaticProfile {
>>>
>>>
>>> public static void main(String[] args){
>>> try {
>>> testProfile();
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> }
>>> }
>>> private final static String workspace =
>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>> // private final static String runtime =
>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>
>>> private final static String testModel =
>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>
>>> private final static String umlJarLoc =
>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>
>>> private final static String path2profile = workspace;
>>>
>>> // private final static String profileEPackageName = "myProf";
>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>> //"http://www.my.org/Profile";
>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>
>>> private static void testProfile() {
>>> System.out.println(">>>>>>>>>>>>>");
>>>
>>> System.out.println();
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile+suffix));
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile));
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>> URI.createURI(path2profile+suffix));
>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>> URI.createURI(path2profile));
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile+suffix));
>>>
>>> // Map<String, URI> nsURI2ProfileMap =
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>
>>> // uml init
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>> UMLPackage.eINSTANCE);
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>> UMLResource.Factory.INSTANCE);
>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>> URI uri = URI.createURI(umlJarLoc);
>>> 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(""));
>>>
>>> Map<String,Object> p2fMap =
>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>> // uml init ()
>>> // Resource testResi =
>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>> // System.out.println("Content of TestResi");
>>> // for(EObject obj : testResi.getContents()){
>>> // System.out.println(obj);
>>> // }
>>>
>>> Resource resi =
>>> resourceSet.createResource(URI.createFileURI(testModel));
>>> Resource profileResi =
>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>> System.out.println("Content of ProfileResi");
>>> for(EObject obj : profileResi.getContents()){
>>> System.out.println(obj);
>>> }
>>>
>>>
>>> // uml bsp data
>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>> resi.getContents().add(package_);
>>> package_.setName("MeinPacket");
>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>> clazz.setPackage(package_);
>>> clazz.setName("MeineKlasse2");
>>> // uml bsp data()
>>>
>>> Profile myProfile =
>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>> if(myProfile==null){
>>> System.out.println("myProfile==null");
>>> } else{
>>> System.out.println("myProfile: "+myProfile);
>>> }
>>>
>>> try{
>>> package_.applyProfile(myProfile);
>>> } catch (Exception e) {
>>> System.out.println("Profile could not be applied");
>>> e.printStackTrace();
>>> }
>>>
>>> System.out.println("\nStereotypes");
>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>> System.out.println(stereo);
>>> }
>>>
>>>
>>> // save
>>> try {
>>> resi.save(null);
>>> } catch (IOException e) {
>>> e.printStackTrace();
>>> }
>>> }
>>> }
>>>
>>
>>
Re: static profiles - not working ;) [message #476869 is a reply to message #476868] Tue, 22 January 2008 17:34 Go to previous messageGo to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
btw, I get the same error if I launch the test in the normal workspace


SKuhn wrote:
> well, with a closer look in PackageOperations, ApplyProfile I found
> following:
>
> EPackage profileDefinition = profile.getDefinition();
>
> if (profileDefinition == null) {
> throw new IllegalArgumentException(String.valueOf(profile));
> }
>
> if (package_.getProfileApplication(profile) == null) {
> package_.createProfileApplication().setAppliedProfile(profil e);
> }
>
>
> --
> profile.getDefinition(); return null, and the eAnnotation which I found
> in .profile.uml is used -later on- for getProfile Application.
>
> So, because my Profile is not defined, I don't have an annotation for it
> -help!
>
> -stefan
>
> SKuhn wrote:
>> oh right, I haven't seen it in the UML Editor, and when I looked in
>> the .uml late at night didn't see it, but the annotation is there:
>>
>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>> </eAnnotations>
>> <appliedProfile
>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>> </profileApplication>
>> ---
>>
>> I've tried debugging the code, but as I said, the eAnnotation was not
>> resolved. I'll try it again, now that I now it is there :)
>>
>> -stefan
>>
>>
>>
>> Kenn Hussey wrote:
>>> Stefan,
>>>
>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>> to the profile and set the value of the 'nsURI' tag:
>>>
>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>> existing Ecore profile.
>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>
>>> This is the tag whose value is being obtained during look-up of the
>>> profile's definition. If this look-up is failing, something else must
>>> be going wrong... have you tried debugging the code?
>>>
>>> Kenn
>>>
>>> "SKuhn" <kuhn@oio.de> wrote in message
>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>> hi all,
>>>>
>>>> I've followed this tutorial:
>>>> ----------- Create your Profile -------------
>>>> 1. Create your uml profile as you would normally ( For example,
>>>> create a
>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>> getting
>>>> started article for details ). (Call it My.profile.uml for example)
>>>> 2. ** don't do the "define" step ***
>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>> Ecore profile.
>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>
>>>> ------- Generate code ---------
>>>> 1. Create an EMF project as you would from any other .uml model to
>>>> generate
>>>> code from but specify your profile as the source ( My.profile.uml )
>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>
>>>> ------- Using your profile ------
>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>> part...
>>>>
>>>> 1. Move your previously generated code for your profile to your
>>>> development
>>>> environment.
>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>> plugin
>>>> to get started with ).
>>>> 3. In your JUnit plugin test, add the line:
>>>>
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>
>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where
>>>> XXX is the
>>>> id of the profile in your model.
>>>> 4. Create a resource set and load your My.profile.uml.
>>>> 5. Next, Load your profile using..
>>>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>> ... )
>>>> from the already generated MyProfilePackage from the "Generate Code"
>>>> step.
>>>> 6. Next, obtain your stereotype with..
>>>> Stereotype myStereotype =
>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>> 7. This is the interesting part ... Apply your stereotype as
>>>> follows:
>>>> MyExtendedClass myExtendedClass =
>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>> Notice how you do not get a stereotype application but rather a
>>>> type of
>>>> "MyExtendedClass".
>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>> etc.
>>>> --- how cool is that ;) ----
>>>>
>>>>
>>>> and couldn't get it running. The reason is that
>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>> not there (null).
>>>>
>>>> I've attached my test code and the .profile.uml.
>>>>
>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>
>>>> The result of the code is:
>>>>
>>>> Content of ProfileResi
>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>> visibility: <unset>) (visibility: public)
>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>> (name:
>>>> My, visibility: <unset>) (visibility: public)
>>>> Profile could not be applied
>>>> java.lang.IllegalArgumentException:
>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>> visibility: <unset>) (visibility: public)
>>>> at
>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>
>>>> at
>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>
>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>
>>>> Stereotypes
>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>
>>>>
>>>> What am I doing wrong?
>>>> -stefan
>>>>
>>>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xmi:XMI xmi:version="2.1"
>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>> </packageImport>
>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>> </packageImport>
>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>> </packageImport>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>> isAbstract="true">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name"
>>>> visibility="public">
>>>> <type xmi:type="uml:PrimitiveType"
>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>> name="UIContainerType">
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>> name="COMPOSITE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>> name="SECTION"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>> name="DIALOG"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>> name="WIZARD"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>> name="VIEW"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>> name="TABFOLDER"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>> name="GROUP"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>> name="SCREEN"/>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type"
>>>> visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371"
>>>> name="UIDataControl" isAbstract="true">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>> UIContainer->UIControl">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>> name="UIComplexDataControlType">
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>> name="TABLE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>> name="TREE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>> name="LIST"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>> name="FORM"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>> name="EDITOR"/>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>> name="UIComplexDataControl">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952645284_114215_759" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952721352_812895_780" name="type"
>>>> visibility="public" type="_12_5_1_15200e0_1191952434982_520771_645">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>> name="UIPrimitiveDataControl">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191953116891_548625_967" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191953185029_1046_1014" name="type"
>>>> visibility="public" type="_12_5_1_15200e0_1191953126646_606954_989">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>> name="UIPrimitiveDataControlType">
>>>> <ownedLiteral
>>>> xmi:id="_12_5_1_15200e0_1191953148501_880223_1008" name="BUTTON"/>
>>>> <ownedLiteral
>>>> xmi:id="_12_5_1_15200e0_1191953162205_626311_1010" name="TEXT"/>
>>>> <ownedLiteral
>>>> xmi:id="_12_5_1_15200e0_1191953167709_704400_1012" name="LABEL"/>
>>>> </packagedElement>
>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>> <references xmi:type="ecore:EPackage"
>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>
>>>> </eAnnotations>
>>>> <appliedProfile
>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>> </profileApplication>
>>>> </uml:Profile>
>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>> </xmi:XMI>
>>>>
>>>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>
>>>> package test;
>>>> import java.io.IOException;
>>>> import java.util.Map;
>>>>
>>>> import myProf.MyClass;
>>>> import myProf.MyProfPackage;
>>>>
>>>> import org.eclipse.emf.common.EMFPlugin;
>>>> import org.eclipse.emf.common.util.URI;
>>>> import org.eclipse.emf.ecore.EObject;
>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>> import org.eclipse.uml2.uml.Class;
>>>> import org.eclipse.uml2.uml.Package;
>>>> import org.eclipse.uml2.uml.Profile;
>>>> import org.eclipse.uml2.uml.Stereotype;
>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>
>>>>
>>>> public class StaticProfile {
>>>>
>>>>
>>>> public static void main(String[] args){
>>>> try {
>>>> testProfile();
>>>> } catch (Exception e) {
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>> private final static String workspace =
>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>> // private final static String runtime =
>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>
>>>> private final static String testModel =
>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>
>>>> private final static String umlJarLoc =
>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>
>>>> private final static String path2profile = workspace;
>>>>
>>>> // private final static String profileEPackageName = "myProf";
>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>> //"http://www.my.org/Profile";
>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>
>>>> private static void testProfile() {
>>>> System.out.println(">>>>>>>>>>>>>");
>>>>
>>>> System.out.println();
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile+suffix));
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile));
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>> URI.createURI(path2profile+suffix));
>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>> URI.createURI(path2profile));
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile+suffix));
>>>>
>>>> // Map<String, URI> nsURI2ProfileMap =
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>
>>>> // uml init
>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>> UMLPackage.eINSTANCE);
>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>> UMLResource.Factory.INSTANCE);
>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>> URI uri = URI.createURI(umlJarLoc);
>>>> 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(""));
>>>>
>>>> Map<String,Object> p2fMap =
>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>> // uml init ()
>>>> // Resource testResi =
>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>> // System.out.println("Content of TestResi");
>>>> // for(EObject obj : testResi.getContents()){
>>>> // System.out.println(obj);
>>>> // }
>>>>
>>>> Resource resi =
>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>> Resource profileResi =
>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>> System.out.println("Content of ProfileResi");
>>>> for(EObject obj : profileResi.getContents()){
>>>> System.out.println(obj);
>>>> }
>>>>
>>>>
>>>> // uml bsp data
>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>> resi.getContents().add(package_);
>>>> package_.setName("MeinPacket");
>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>> clazz.setPackage(package_);
>>>> clazz.setName("MeineKlasse2");
>>>> // uml bsp data()
>>>>
>>>> Profile myProfile =
>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>> if(myProfile==null){
>>>> System.out.println("myProfile==null");
>>>> } else{
>>>> System.out.println("myProfile: "+myProfile);
>>>> }
>>>>
>>>> try{
>>>> package_.applyProfile(myProfile);
>>>> } catch (Exception e) {
>>>> System.out.println("Profile could not be applied");
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> System.out.println("\nStereotypes");
>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>> System.out.println(stereo);
>>>> }
>>>>
>>>>
>>>> // save
>>>> try {
>>>> resi.save(null);
>>>> } catch (IOException e) {
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>> }
>>>>
>>>
>>>
Re: static profiles - not working ;) [message #476872 is a reply to message #476869] Tue, 22 January 2008 18:43 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
.... but the definition of a static profile is obtained by looking it up in
the registry... are you sure that the URI you've put in the registry is
being resolved properly?

Kenn

"SKuhn" <kuhn@oio.de> wrote in message
news:fn59n9$rja$1@build.eclipse.org...
> btw, I get the same error if I launch the test in the normal workspace
>
>
> SKuhn wrote:
>> well, with a closer look in PackageOperations, ApplyProfile I found
>> following:
>>
>> EPackage profileDefinition = profile.getDefinition();
>>
>> if (profileDefinition == null) {
>> throw new IllegalArgumentException(String.valueOf(profile));
>> }
>>
>> if (package_.getProfileApplication(profile) == null) {
>>
>> package_.createProfileApplication().setAppliedProfile(profil e);
>> }
>>
>>
>> --
>> profile.getDefinition(); return null, and the eAnnotation which I found
>> in .profile.uml is used -later on- for getProfile Application.
>>
>> So, because my Profile is not defined, I don't have an annotation for
>> it -help!
>>
>> -stefan
>>
>> SKuhn wrote:
>>> oh right, I haven't seen it in the UML Editor, and when I looked in the
>>> .uml late at night didn't see it, but the annotation is there:
>>>
>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>> <references xmi:type="ecore:EPackage"
>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>> </eAnnotations>
>>> <appliedProfile
>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>> </profileApplication>
>>> ---
>>>
>>> I've tried debugging the code, but as I said, the eAnnotation was not
>>> resolved. I'll try it again, now that I now it is there :)
>>>
>>> -stefan
>>>
>>>
>>>
>>> Kenn Hussey wrote:
>>>> Stefan,
>>>>
>>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>>> to the profile and set the value of the 'nsURI' tag:
>>>>
>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>> Ecore profile.
>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>
>>>> This is the tag whose value is being obtained during look-up of the
>>>> profile's definition. If this look-up is failing, something else must
>>>> be going wrong... have you tried debugging the code?
>>>>
>>>> Kenn
>>>>
>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>> hi all,
>>>>>
>>>>> I've followed this tutorial:
>>>>> ----------- Create your Profile -------------
>>>>> 1. Create your uml profile as you would normally ( For example, create
>>>>> a
>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>> getting
>>>>> started article for details ). (Call it My.profile.uml for example)
>>>>> 2. ** don't do the "define" step ***
>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>> existing
>>>>> Ecore profile.
>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>
>>>>> ------- Generate code ---------
>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>> generate
>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>
>>>>> ------- Using your profile ------
>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>> part...
>>>>>
>>>>> 1. Move your previously generated code for your profile to your
>>>>> development
>>>>> environment.
>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>> plugin
>>>>> to get started with ).
>>>>> 3. In your JUnit plugin test, add the line:
>>>>>
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>>>> is the
>>>>> id of the profile in your model.
>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>> 5. Next, Load your profile using..
>>>>> Profile myProfile =
>>>>> UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>> ... )
>>>>> from the already generated MyProfilePackage from the "Generate
>>>>> Code"
>>>>> step.
>>>>> 6. Next, obtain your stereotype with..
>>>>> Stereotype myStereotype =
>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>> follows:
>>>>> MyExtendedClass myExtendedClass =
>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>> Notice how you do not get a stereotype application but rather a
>>>>> type of
>>>>> "MyExtendedClass".
>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>> etc.
>>>>> --- how cool is that ;) ----
>>>>>
>>>>>
>>>>> and couldn't get it running. The reason is that
>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>>> not there (null).
>>>>>
>>>>> I've attached my test code and the .profile.uml.
>>>>>
>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>
>>>>> The result of the code is:
>>>>>
>>>>> Content of ProfileResi
>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>> visibility: <unset>) (visibility: public)
>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>> (name:
>>>>> My, visibility: <unset>) (visibility: public)
>>>>> Profile could not be applied
>>>>> java.lang.IllegalArgumentException:
>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>> visibility: <unset>) (visibility: public)
>>>>> at
>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>> at
>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>
>>>>> Stereotypes
>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>
>>>>>
>>>>> What am I doing wrong?
>>>>> -stefan
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <xmi:XMI xmi:version="2.1"
>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>> </packageImport>
>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>> </packageImport>
>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>> </packageImport>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>> isAbstract="true">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>>>>> name="name" visibility="public">
>>>>> <type xmi:type="uml:PrimitiveType"
>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>> name="UIContainerType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>> name="COMPOSITE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>> name="SECTION"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>> name="DIALOG"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>> name="WIZARD"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>> name="VIEW"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>> name="TABFOLDER"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>> name="GROUP"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>> name="SCREEN"/>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>>>>> isAbstract="true">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>> UIContainer->UIControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>> name="UIComplexDataControlType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>> name="TABLE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>> name="TREE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>> name="LIST"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>> name="FORM"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>> name="EDITOR"/>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>>> name="UIComplexDataControl">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191952434982_520771_645">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>>> name="UIPrimitiveDataControl">
>>>>> <generalization
>>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>>> name="UIPrimitiveDataControlType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>>>> name="BUTTON"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>>>> name="TEXT"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>>>> name="LABEL"/>
>>>>> </packagedElement>
>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>> <references xmi:type="ecore:EPackage"
>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>> </eAnnotations>
>>>>> <appliedProfile
>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>> </profileApplication>
>>>>> </uml:Profile>
>>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>>> </xmi:XMI>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>
>>>>> package test;
>>>>> import java.io.IOException;
>>>>> import java.util.Map;
>>>>>
>>>>> import myProf.MyClass;
>>>>> import myProf.MyProfPackage;
>>>>>
>>>>> import org.eclipse.emf.common.EMFPlugin;
>>>>> import org.eclipse.emf.common.util.URI;
>>>>> import org.eclipse.emf.ecore.EObject;
>>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>>> import org.eclipse.uml2.uml.Class;
>>>>> import org.eclipse.uml2.uml.Package;
>>>>> import org.eclipse.uml2.uml.Profile;
>>>>> import org.eclipse.uml2.uml.Stereotype;
>>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>>
>>>>>
>>>>> public class StaticProfile {
>>>>>
>>>>>
>>>>> public static void main(String[] args){
>>>>> try {
>>>>> testProfile();
>>>>> } catch (Exception e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>> }
>>>>> private final static String workspace =
>>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>>> // private final static String runtime =
>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>> private final static String testModel =
>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>> private final static String umlJarLoc =
>>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>> private final static String path2profile = workspace;
>>>>>
>>>>> // private final static String profileEPackageName = "myProf";
>>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>>> //"http://www.my.org/Profile";
>>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>>
>>>>> private static void testProfile() {
>>>>> System.out.println(">>>>>>>>>>>>>");
>>>>>
>>>>> System.out.println();
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile+suffix));
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile));
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>> URI.createURI(path2profile+suffix));
>>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>> URI.createURI(path2profile));
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile+suffix));
>>>>>
>>>>> // Map<String, URI> nsURI2ProfileMap =
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>>
>>>>> // uml init
>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>>> UMLPackage.eINSTANCE);
>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>>> UMLResource.Factory.INSTANCE);
>>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>>> URI uri = URI.createURI(umlJarLoc);
>>>>> 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(""));
>>>>>
>>>>> Map<String,Object> p2fMap =
>>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>>> // uml init ()
>>>>> // Resource testResi =
>>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>>> // System.out.println("Content of TestResi");
>>>>> // for(EObject obj : testResi.getContents()){
>>>>> // System.out.println(obj);
>>>>> // }
>>>>>
>>>>> Resource resi =
>>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>>> Resource profileResi =
>>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>>> System.out.println("Content of ProfileResi");
>>>>> for(EObject obj : profileResi.getContents()){
>>>>> System.out.println(obj);
>>>>> }
>>>>>
>>>>>
>>>>> // uml bsp data
>>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>>> resi.getContents().add(package_);
>>>>> package_.setName("MeinPacket");
>>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>>> clazz.setPackage(package_);
>>>>> clazz.setName("MeineKlasse2");
>>>>> // uml bsp data()
>>>>>
>>>>> Profile myProfile =
>>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>>> if(myProfile==null){
>>>>> System.out.println("myProfile==null");
>>>>> } else{
>>>>> System.out.println("myProfile: "+myProfile);
>>>>> }
>>>>>
>>>>> try{
>>>>> package_.applyProfile(myProfile);
>>>>> } catch (Exception e) {
>>>>> System.out.println("Profile could not be applied");
>>>>> e.printStackTrace();
>>>>> }
>>>>>
>>>>> System.out.println("\nStereotypes");
>>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>>> System.out.println(stereo);
>>>>> }
>>>>>
>>>>>
>>>>> // save
>>>>> try {
>>>>> resi.save(null);
>>>>> } catch (IOException e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>
>>>>
Re: static profiles - not working ;) [message #476873 is a reply to message #476872] Tue, 22 January 2008 18:48 Go to previous messageGo to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
I think otherwise UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_)
would return null. Is this correct?

-stefan


Kenn Hussey wrote:
> ... but the definition of a static profile is obtained by looking it up in
> the registry... are you sure that the URI you've put in the registry is
> being resolved properly?
>
> Kenn
>
> "SKuhn" <kuhn@oio.de> wrote in message
> news:fn59n9$rja$1@build.eclipse.org...
>> btw, I get the same error if I launch the test in the normal workspace
>>
>>
>> SKuhn wrote:
>>> well, with a closer look in PackageOperations, ApplyProfile I found
>>> following:
>>>
>>> EPackage profileDefinition = profile.getDefinition();
>>>
>>> if (profileDefinition == null) {
>>> throw new IllegalArgumentException(String.valueOf(profile));
>>> }
>>>
>>> if (
..getProfileApplication(profile) == null) {
>>>
>>> package_.createProfileApplication().setAppliedProfile(profil e);
>>> }
>>>
>>>
>>> --
>>> profile.getDefinition(); return null, and the eAnnotation which I found
>>> in .profile.uml is used -later on- for getProfile Application.
>>>
>>> So, because my Profile is not defined, I don't have an annotation for
>>> it -help!
>>>
>>> -stefan
>>>
>>> SKuhn wrote:
>>>> oh right, I haven't seen it in the UML Editor, and when I looked in the
>>>> .uml late at night didn't see it, but the annotation is there:
>>>>
>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>> <references xmi:type="ecore:EPackage"
>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>> </eAnnotations>
>>>> <appliedProfile
>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>> </profileApplication>
>>>> ---
>>>>
>>>> I've tried debugging the code, but as I said, the eAnnotation was not
>>>> resolved. I'll try it again, now that I now it is there :)
>>>>
>>>> -stefan
>>>>
>>>>
>>>>
>>>> Kenn Hussey wrote:
>>>>> Stefan,
>>>>>
>>>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>>>> to the profile and set the value of the 'nsURI' tag:
>>>>>
>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>>> Ecore profile.
>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>
>>>>> This is the tag whose value is being obtained during look-up of the
>>>>> profile's definition. If this look-up is failing, something else must
>>>>> be going wrong... have you tried debugging the code?
>>>>>
>>>>> Kenn
>>>>>
>>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>>> hi all,
>>>>>>
>>>>>> I've followed this tutorial:
>>>>>> ----------- Create your Profile -------------
>>>>>> 1. Create your uml profile as you would normally ( For example, create
>>>>>> a
>>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>>> getting
>>>>>> started article for details ). (Call it My.profile.uml for example)
>>>>>> 2. ** don't do the "define" step ***
>>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>>> existing
>>>>>> Ecore profile.
>>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>>
>>>>>> ------- Generate code ---------
>>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>>> generate
>>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>>
>>>>>> ------- Using your profile ------
>>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>>> part...
>>>>>>
>>>>>> 1. Move your previously generated code for your profile to your
>>>>>> development
>>>>>> environment.
>>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>>> plugin
>>>>>> to get started with ).
>>>>>> 3. In your JUnit plugin test, add the line:
>>>>>>
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>>>>> is the
>>>>>> id of the profile in your model.
>>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>>> 5. Next, Load your profile using..
>>>>>> Profile myProfile =
>>>>>> UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>>> ... )
>>>>>> from the already generated MyProfilePackage from the "Generate
>>>>>> Code"
>>>>>> step.
>>>>>> 6. Next, obtain your stereotype with..
>>>>>> Stereotype myStereotype =
>>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>>> follows:
>>>>>> MyExtendedClass myExtendedClass =
>>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>>> Notice how you do not get a stereotype application but rather a
>>>>>> type of
>>>>>> "MyExtendedClass".
>>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>>> etc.
>>>>>> --- how cool is that ;) ----
>>>>>>
>>>>>>
>>>>>> and couldn't get it running. The reason is that
>>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>>>> not there (null).
>>>>>>
>>>>>> I've attached my test code and the .profile.uml.
>>>>>>
>>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>>
>>>>>> The result of the code is:
>>>>>>
>>>>>> Content of ProfileResi
>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>> visibility: <unset>) (visibility: public)
>>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>>> (name:
>>>>>> My, visibility: <unset>) (visibility: public)
>>>>>> Profile could not be applied
>>>>>> java.lang.IllegalArgumentException:
>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>> visibility: <unset>) (visibility: public)
>>>>>> at
>>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>>> at
>>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>>
>>>>>> Stereotypes
>>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>>
>>>>>>
>>>>>> What am I doing wrong?
>>>>>> -stefan
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------ --------------------
>>>>>
>>>>>
>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <xmi:XMI xmi:version="2.1"
>>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>>> isAbstract="true">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>>>>>> name="name" visibility="public">
>>>>>> <type xmi:type="uml:PrimitiveType"
>>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>>> name="UIContainerType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>>> name="COMPOSITE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>>> name="SECTION"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>>> name="DIALOG"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>>> name="WIZARD"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>>> name="VIEW"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>>> name="TABFOLDER"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>>> name="GROUP"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>>> name="SCREEN"/>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>>>>>> name="type" visibility="public"
>>>>>> type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>>>>>> isAbstract="true">
>>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>>> UIContainer->UIControl">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>>> name="UIComplexDataControlType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>>> name="TABLE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>>> name="TREE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>>> name="LIST"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>>> name="FORM"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>>> name="EDITOR"/>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>> name="UIComplexDataControl">
>>>>>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>>>>>> name="type" visibility="public"
>>>>>> type="_12_5_1_15200e0_1191952434982_520771_645">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>> name="UIPrimitiveDataControl">
>>>>>> <generalization
>>>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>>>>> name="type" visibility="public"
>>>>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>>>> name="UIPrimitiveDataControlType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>>>>> name="BUTTON"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>>>>> name="TEXT"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>>>>> name="LABEL"/>
>>>>>> </packagedElement>
>>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>>> <references xmi:type="ecore:EPackage"
>>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>>> </eAnnotations>
>>>>>> <appliedProfile
>>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>>> </profileApplication>
>>>>>> </uml:Profile>
>>>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>>>> </xmi:XMI>
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------ --------------------
>>>>>
>>>>>
>>>>>
>>>>>> package test;
>>>>>> import java.io.IOException;
>>>>>> import java.util.Map;
>>>>>>
>>>>>> import myProf.MyClass;
>>>>>> import myProf.MyProfPackage;
>>>>>>
>>>>>> import org.eclipse.emf.common.EMFPlugin;
>>>>>> import org.eclipse.emf.common.util.URI;
>>>>>> import org.eclipse.emf.ecore.EObject;
>>>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>>>> import org.eclipse.uml2.uml.Class;
>>>>>> import org.eclipse.uml2.uml.Package;
>>>>>> import org.eclipse.uml2.uml.Profile;
>>>>>> import org.eclipse.uml2.uml.Stereotype;
>>>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>>>
>>>>>>
>>>>>> public class StaticProfile {
>>>>>>
>>>>>>
>>>>>> public static void main(String[] args){
>>>>>> try {
>>>>>> testProfile();
>>>>>> } catch (Exception e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> }
>>>>>> private final static String workspace =
>>>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>>>> // private final static String runtime =
>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>>> private final static String testModel =
>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>>> private final static String umlJarLoc =
>>>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>>> private final static String path2profile = workspace;
>>>>>>
>>>>>> // private final static String profileEPackageName = "myProf";
>>>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>>>> //"http://www.my.org/Profile";
>>>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>>>
>>>>>> private static void testProfile() {
>>>>>> System.out.println(">>>>>>>>>>>>>");
>>>>>>
>>>>>> System.out.println();
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile));
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>> URI.createURI(path2profile));
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>>
>>>>>> // Map<String, URI> nsURI2ProfileMap =
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>>>
>>>>>> // uml init
>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>>>> UMLPackage.eINSTANCE);
>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>>>> UMLResource.Factory.INSTANCE);
>>>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>>>> URI uri = URI.createURI(umlJarLoc);
>>>>>> 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(""));
>>>>>>
>>>>>> Map<String,Object> p2fMap =
>>>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>>>> // uml init ()
>>>>>> // Resource testResi =
>>>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>>>> // System.out.println("Content of TestResi");
>>>>>> // for(EObject obj : testResi.getContents()){
>>>>>> // System.out.println(obj);
>>>>>> // }
>>>>>>
>>>>>> Resource resi =
>>>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>>>> Resource profileResi =
>>>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>>>> System.out.println("Content of ProfileResi");
>>>>>> for(EObject obj : profileResi.getContents()){
>>>>>> System.out.println(obj);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> // uml bsp data
>>>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>>>> resi.getContents().add(package_);
>>>>>> package_.setName("MeinPacket");
>>>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>>>> clazz.setPackage(package_);
>>>>>> clazz.setName("MeineKlasse2");
>>>>>> // uml bsp data()
>>>>>>
>>>>>> Profile myProfile =
>>>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>>>> if(myProfile==null){
>>>>>> System.out.println("myProfile==null");
>>>>>> } else{
>>>>>> System.out.println("myProfile: "+myProfile);
>>>>>> }
>>>>>>
>>>>>> try{
>>>>>> package_.applyProfile(myProfile);
>>>>>> } catch (Exception e) {
>>>>>> System.out.println("Profile could not be applied");
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>>
>>>>>> System.out.println("\nStereotypes");
>>>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>>>> System.out.println(stereo);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> // save
>>>>>> try {
>>>>>> resi.save(null);
>>>>>> } catch (IOException e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>>
>>>>>
>
>
Re: static profiles - not working ;) [message #476876 is a reply to message #476873] Wed, 23 January 2008 02:07 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Yes, if the URL that you've registered against the generated Ecore package
for the profile can't be resolved, that method will return null...

Kenn

"SKuhn" <kuhn@oio.de> wrote in message news:fn5e25$lp$1@build.eclipse.org...
>I think otherwise UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_)
>would return null. Is this correct?
>
> -stefan
>
>
> Kenn Hussey wrote:
>> ... but the definition of a static profile is obtained by looking it up
>> in the registry... are you sure that the URI you've put in the registry
>> is being resolved properly?
>>
>> Kenn
>>
>> "SKuhn" <kuhn@oio.de> wrote in message
>> news:fn59n9$rja$1@build.eclipse.org...
>>> btw, I get the same error if I launch the test in the normal workspace
>>>
>>>
>>> SKuhn wrote:
>>>> well, with a closer look in PackageOperations, ApplyProfile I found
>>>> following:
>>>>
>>>> EPackage profileDefinition = profile.getDefinition();
>>>>
>>>> if (profileDefinition == null) {
>>>> throw new
>>>> IllegalArgumentException(String.valueOf(profile));
>>>> }
>>>>
>>>> if (
> .getProfileApplication(profile) == null) {
>>>>
>>>> package_.createProfileApplication().setAppliedProfile(profil e);
>>>> }
>>>>
>>>>
>>>> --
>>>> profile.getDefinition(); return null, and the eAnnotation which I found
>>>> in .profile.uml is used -later on- for getProfile Application.
>>>>
>>>> So, because my Profile is not defined, I don't have an annotation for
>>>> it -help!
>>>>
>>>> -stefan
>>>>
>>>> SKuhn wrote:
>>>>> oh right, I haven't seen it in the UML Editor, and when I looked in
>>>>> the .uml late at night didn't see it, but the annotation is there:
>>>>>
>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>> <references xmi:type="ecore:EPackage"
>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>> </eAnnotations>
>>>>> <appliedProfile
>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>> </profileApplication>
>>>>> ---
>>>>>
>>>>> I've tried debugging the code, but as I said, the eAnnotation was not
>>>>> resolved. I'll try it again, now that I now it is there :)
>>>>>
>>>>> -stefan
>>>>>
>>>>>
>>>>>
>>>>> Kenn Hussey wrote:
>>>>>> Stefan,
>>>>>>
>>>>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>>>>> to the profile and set the value of the 'nsURI' tag:
>>>>>>
>>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>>> existing Ecore profile.
>>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>>
>>>>>> This is the tag whose value is being obtained during look-up of the
>>>>>> profile's definition. If this look-up is failing, something else must
>>>>>> be going wrong... have you tried debugging the code?
>>>>>>
>>>>>> Kenn
>>>>>>
>>>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>>>> hi all,
>>>>>>>
>>>>>>> I've followed this tutorial:
>>>>>>> ----------- Create your Profile -------------
>>>>>>> 1. Create your uml profile as you would normally ( For example,
>>>>>>> create a
>>>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>>>> getting
>>>>>>> started article for details ). (Call it My.profile.uml for
>>>>>>> example)
>>>>>>> 2. ** don't do the "define" step ***
>>>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>>>> existing
>>>>>>> Ecore profile.
>>>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>>>
>>>>>>> ------- Generate code ---------
>>>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>>>> generate
>>>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>>>> 2. Select the "Process All" options when loading your
>>>>>>> My.profile.uml.
>>>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>>>
>>>>>>> ------- Using your profile ------
>>>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>>>> part...
>>>>>>>
>>>>>>> 1. Move your previously generated code for your profile to your
>>>>>>> development
>>>>>>> environment.
>>>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>>>> plugin
>>>>>>> to get started with ).
>>>>>>> 3. In your JUnit plugin test, add the line:
>>>>>>>
>>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where
>>>>>>> XXX is the
>>>>>>> id of the profile in your model.
>>>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>>>> 5. Next, Load your profile using..
>>>>>>> Profile myProfile =
>>>>>>> UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>>>> ... )
>>>>>>> from the already generated MyProfilePackage from the "Generate
>>>>>>> Code"
>>>>>>> step.
>>>>>>> 6. Next, obtain your stereotype with..
>>>>>>> Stereotype myStereotype =
>>>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>>>> follows:
>>>>>>> MyExtendedClass myExtendedClass =
>>>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>>>> Notice how you do not get a stereotype application but rather a
>>>>>>> type of
>>>>>>> "MyExtendedClass".
>>>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>>>> etc.
>>>>>>> --- how cool is that ;) ----
>>>>>>>
>>>>>>>
>>>>>>> and couldn't get it running. The reason is that
>>>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>>>> "Ecore" ... which -since I skipped the the define step (2)- is
>>>>>>> always
>>>>>>> not there (null).
>>>>>>>
>>>>>>> I've attached my test code and the .profile.uml.
>>>>>>>
>>>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>>>
>>>>>>> The result of the code is:
>>>>>>>
>>>>>>> Content of ProfileResi
>>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>>> visibility: <unset>) (visibility: public)
>>>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>>>> (instanceClassName: null) (abstract: false, interface: false))
>>>>>>> (mixed:
>>>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>>>> (name:
>>>>>>> My, visibility: <unset>) (visibility: public)
>>>>>>> Profile could not be applied
>>>>>>> java.lang.IllegalArgumentException:
>>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>>> visibility: <unset>) (visibility: public)
>>>>>>> at
>>>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>>>> at
>>>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>>>
>>>>>>> Stereotypes
>>>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>>>
>>>>>>>
>>>>>>> What am I doing wrong?
>>>>>>> -stefan
>>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------ --------------------
>>>>>>
>>>>>>
>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <xmi:XMI xmi:version="2.1"
>>>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>>>> </packageImport>
>>>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>>>> </packageImport>
>>>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>>>> </packageImport>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>>>> isAbstract="true">
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name"
>>>>>>> visibility="public">
>>>>>>> <type xmi:type="uml:PrimitiveType"
>>>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name=""
>>>>>>> value="1"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>>>> name="UIContainerType">
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>>>> name="COMPOSITE"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>>>> name="SECTION"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>>>> name="DIALOG"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>>>> name="WIZARD"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>>>> name="VIEW"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>>>> name="TABFOLDER"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>>>> name="GROUP"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>>>> name="SCREEN"/>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319"
>>>>>>> name="UIContainer">
>>>>>>> <generalization
>>>>>>> xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>>>> isSubstitutable="false"
>>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type"
>>>>>>> visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name=""
>>>>>>> value="1"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>>> name="UIDataControl" isAbstract="true">
>>>>>>> <generalization
>>>>>>> xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>>>> isSubstitutable="false"
>>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>>>> UIContainer->UIControl">
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>>>> name="base_Association" visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>>>> name="UIComplexDataControlType">
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>>>> name="TABLE"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>>>> name="TREE"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>>>> name="LIST"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>>>> name="FORM"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>>>> name="EDITOR"/>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>>>> name="base_Association" visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>>> name="UIComplexDataControl">
>>>>>>> <generalization
>>>>>>> xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>>>>> isSubstitutable="false"
>>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_114215_759" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191952721352_812895_780" name="type"
>>>>>>> visibility="public" type="_12_5_1_15200e0_1191952434982_520771_645">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name=""
>>>>>>> value="1"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>>>>> name="base_Association" visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>>> name="UIPrimitiveDataControl">
>>>>>>> <generalization
>>>>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>>>>> isSubstitutable="false"
>>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191953116891_548625_967" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191953185029_1046_1014" name="type"
>>>>>>> visibility="public" type="_12_5_1_15200e0_1191953126646_606954_989">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name=""
>>>>>>> value="1"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>>>>> name="UIPrimitiveDataControlType">
>>>>>>> <ownedLiteral
>>>>>>> xmi:id="_12_5_1_15200e0_1191953148501_880223_1008" name="BUTTON"/>
>>>>>>> <ownedLiteral
>>>>>>> xmi:id="_12_5_1_15200e0_1191953162205_626311_1010" name="TEXT"/>
>>>>>>> <ownedLiteral
>>>>>>> xmi:id="_12_5_1_15200e0_1191953167709_704400_1012" name="LABEL"/>
>>>>>>> </packagedElement>
>>>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>>>> <references xmi:type="ecore:EPackage"
>>>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>>>> </eAnnotations>
>>>>>>> <appliedProfile
>>>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>>>> </profileApplication>
>>>>>>> </uml:Profile>
>>>>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>>>>> </xmi:XMI>
>>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------ --------------------
>>>>>>
>>>>>>
>>>>>>
>>>>>>> package test;
>>>>>>> import java.io.IOException;
>>>>>>> import java.util.Map;
>>>>>>>
>>>>>>> import myProf.MyClass;
>>>>>>> import myProf.MyProfPackage;
>>>>>>>
>>>>>>> import org.eclipse.emf.common.EMFPlugin;
>>>>>>> import org.eclipse.emf.common.util.URI;
>>>>>>> import org.eclipse.emf.ecore.EObject;
>>>>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>>>>> import org.eclipse.uml2.uml.Class;
>>>>>>> import org.eclipse.uml2.uml.Package;
>>>>>>> import org.eclipse.uml2.uml.Profile;
>>>>>>> import org.eclipse.uml2.uml.Stereotype;
>>>>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>>>>
>>>>>>>
>>>>>>> public class StaticProfile {
>>>>>>>
>>>>>>>
>>>>>>> public static void main(String[] args){
>>>>>>> try {
>>>>>>> testProfile();
>>>>>>> } catch (Exception e) {
>>>>>>> e.printStackTrace();
>>>>>>> }
>>>>>>> }
>>>>>>> private final static String workspace =
>>>>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>>>>> // private final static String runtime =
>>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>>>> private final static String testModel =
>>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>>>> private final static String umlJarLoc =
>>>>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>>>> private final static String path2profile = workspace;
>>>>>>>
>>>>>>> // private final static String profileEPackageName = "myProf";
>>>>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>>>>> //"http://www.my.org/Profile";
>>>>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>>>>
>>>>>>> private static void testProfile() {
>>>>>>> System.out.println(">>>>>>>>>>>>>");
>>>>>>>
>>>>>>> System.out.println();
>>>>>>> //
>>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>>> URI.createURI(path2profile+suffix));
>>>>>>> //
>>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>>> URI.createURI(path2profile));
>>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>>> URI.createURI(path2profile+suffix));
>>>>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>>> URI.createURI(path2profile));
>>>>>>> //
>>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>>> URI.createURI(path2profile+suffix));
>>>>>>>
>>>>>>> // Map<String, URI> nsURI2ProfileMap =
>>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>>>>
>>>>>>> // uml init
>>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>>>>> UMLPackage.eINSTANCE);
>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>>>>> UMLResource.Factory.INSTANCE);
>>>>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>>>>> URI uri = URI.createURI(umlJarLoc);
>>>>>>> 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(""));
>>>>>>>
>>>>>>> Map<String,Object> p2fMap =
>>>>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>>>>> // uml init ()
>>>>>>> // Resource testResi =
>>>>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>>>>> // System.out.println("Content of TestResi");
>>>>>>> // for(EObject obj : testResi.getContents()){
>>>>>>> // System.out.println(obj);
>>>>>>> // }
>>>>>>>
>>>>>>> Resource resi =
>>>>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>>>>> Resource profileResi =
>>>>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>>>>> System.out.println("Content of ProfileResi");
>>>>>>> for(EObject obj : profileResi.getContents()){
>>>>>>> System.out.println(obj);
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> // uml bsp data
>>>>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>>>>> resi.getContents().add(package_);
>>>>>>> package_.setName("MeinPacket");
>>>>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>>>>> clazz.setPackage(package_);
>>>>>>> clazz.setName("MeineKlasse2");
>>>>>>> // uml bsp data()
>>>>>>>
>>>>>>> Profile myProfile =
>>>>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>>>>> if(myProfile==null){
>>>>>>> System.out.println("myProfile==null");
>>>>>>> } else{
>>>>>>> System.out.println("myProfile: "+myProfile);
>>>>>>> }
>>>>>>>
>>>>>>> try{
>>>>>>> package_.applyProfile(myProfile);
>>>>>>> } catch (Exception e) {
>>>>>>> System.out.println("Profile could not be applied");
>>>>>>> e.printStackTrace();
>>>>>>> }
>>>>>>>
>>>>>>> System.out.println("\nStereotypes");
>>>>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>>>>> System.out.println(stereo);
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> // save
>>>>>>> try {
>>>>>>> resi.save(null);
>>>>>>> } catch (IOException e) {
>>>>>>> e.printStackTrace();
>>>>>>> }
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>
>>
Re: static profiles - not working ;) [message #476878 is a reply to message #476864] Wed, 23 January 2008 15:23 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi,

I was just wondering if you managed to get this working after all?

Step 3 in the "Using your profile" section below can be replaced with using
the existing extension point to register your profile.
Apart from that, you should be able to use your profile as normal.

- James.


"SKuhn" <kuhn@oio.de> wrote in message
news:fn4umc$q8s$1@build.eclipse.org...
> hi all,
>
> I've followed this tutorial:
> ----------- Create your Profile -------------
> 1. Create your uml profile as you would normally ( For example, create a
> stereotype called MyExtendedClass that extends uml:Class ). (see the
> getting
> started article for details ). (Call it My.profile.uml for example)
> 2. ** don't do the "define" step ***
> 3. On your profile, apply the <<ePackage>> stereotype from the existing
> Ecore profile.
> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>
> ------- Generate code ---------
> 1. Create an EMF project as you would from any other .uml model to
> generate
> code from but specify your profile as the source ( My.profile.uml )
> 2. Select the "Process All" options when loading your My.profile.uml.
> 3. Generate code as you would normally from the resulting .genmodel.
>
> ------- Using your profile ------
> Up to this point, things were pretty easy. Here comes the tricky part...
>
> 1. Move your previously generated code for your profile to your
> development
> environment.
> 2. Create a new plugin in your development environment ( say a JUnit
> plugin
> to get started with ).
> 3. In your JUnit plugin test, add the line:
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is
> the
> id of the profile in your model.
> 4. Create a resource set and load your My.profile.uml.
> 5. Next, Load your profile using..
> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
> ... )
> from the already generated MyProfilePackage from the "Generate Code"
> step.
> 6. Next, obtain your stereotype with..
> Stereotype myStereotype =
> myProfile.getOwnedStereotype("MyExtendedClass");
> 7. This is the interesting part ... Apply your stereotype as follows:
> MyExtendedClass myExtendedClass =
> (MyExtendedClass)myClass.applyStereotype(myStereotype);
> Notice how you do not get a stereotype application but rather a type
> of
> "MyExtendedClass".
> 8. Now you have full access to setting variagbles to MyExtendedClass etc.
> --- how cool is that ;) ----
>
>
> and couldn't get it running. The reason is that
> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
> getDefinition(Profile profile). This calls getTaggedValue(package_,
> "Ecore" ... which -since I skipped the the define step (2)- is always
> not there (null).
>
> I've attached my test code and the .profile.uml.
>
> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>
> The result of the code is:
>
> >>>>>>>>>>>>>
>
> Content of ProfileResi
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
> visibility: <unset>) (visibility: public)
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
> packageName=myProf, nsURI=http://www.my.org/Profile])
> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
> My, visibility: <unset>) (visibility: public)
> Profile could not be applied
> java.lang.IllegalArgumentException:
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
> visibility: <unset>) (visibility: public)
> at
> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
> at
> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
> at test.StaticProfile.testProfile(StaticProfile.java:102)
>
> Stereotypes
> at test.StaticProfile.main(StaticProfile.java:32
>
>
> What am I doing wrong?
> -stefan
>


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


> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
> isAbstract="true">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951461742_136617_256">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
> name="name" visibility="public">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
> _12_5_1_15200e0_1191951461747_586671_257">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951461742_136617_256">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191951577864_290094_283" name="UIContainerType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
> name="COMPOSITE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
> name="SECTION"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
> name="DIALOG"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
> name="WIZARD"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
> name="VIEW"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
> name="TABFOLDER"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
> name="GROUP"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
> name="SCREEN"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951444711_532617_254"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951692820_933016_321">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191951577864_290094_283">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
> _12_5_1_15200e0_1191951692821_296714_323">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951692820_933016_321">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
> isAbstract="true">
> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951444711_532617_254"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951767428_598809_373">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
> _12_5_1_15200e0_1191951767428_297656_375">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951767428_598809_373">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
> UIContainer->UIControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191952252680_904621_608">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
> _12_5_1_15200e0_1191952252681_709833_609">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952252680_904621_608">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
> name="UIComplexDataControlType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
> name="TABLE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
> name="TREE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
> name="LIST"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
> name="FORM"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
> name="EDITOR"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
> name="dataControlChildren UIComplexDataControl->UIDataControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191952555379_305362_677">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
> _12_5_1_15200e0_1191952555379_166950_678">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952555379_305362_677">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
> name="UIComplexDataControl">
> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951761873_224879_371"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191952645284_484596_758">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191952434982_520771_645">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
> _12_5_1_15200e0_1191952645284_100915_760">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952645284_484596_758">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191953026669_238956_938" name="complexDataControl
> UIDataControl->UIComplexDataControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191953028759_918634_940">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
> _12_5_1_15200e0_1191953028759_239041_941">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
> aggregation="composite"
> association="_12_5_1_15200e0_1191953028759_918634_940">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
> name="UIPrimitiveDataControl">
> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951761873_224879_371"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191953116891_964982_966">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191953126646_606954_989">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
> _12_5_1_15200e0_1191953116891_548625_967">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
> aggregation="composite"
> association="_12_5_1_15200e0_1191953116891_964982_966">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
> name="UIPrimitiveDataControlType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
> name="BUTTON"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
> name="TEXT"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
> name="LABEL"/>
> </packagedElement>
> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
> </eAnnotations>
> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
> </profileApplication>
> </uml:Profile>
> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
> packageName="guiProfile" nsPrefix="guiProfileNS"
> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
> </xmi:XMI>
>


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


> package test;
> import java.io.IOException;
> import java.util.Map;
>
> import myProf.MyClass;
> import myProf.MyProfPackage;
>
> import org.eclipse.emf.common.EMFPlugin;
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.emf.ecore.EPackage.Registry;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.util.EcoreUtil;
> import org.eclipse.uml2.uml.Class;
> import org.eclipse.uml2.uml.Package;
> import org.eclipse.uml2.uml.Profile;
> import org.eclipse.uml2.uml.Stereotype;
> import org.eclipse.uml2.uml.UMLFactory;
> import org.eclipse.uml2.uml.UMLPackage;
> import org.eclipse.uml2.uml.UMLPlugin;
> import org.eclipse.uml2.uml.resource.UMLResource;
> import org.eclipse.uml2.uml.util.UMLUtil;
>
>
> public class StaticProfile {
>
>
> public static void main(String[] args){
> try {
> testProfile();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> private final static String workspace =
> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
> // private final static String runtime =
> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
> private final static String testModel =
> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
> private final static String umlJarLoc =
> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
> private final static String path2profile = workspace;
>
> // private final static String profileEPackageName = "myProf";
> private final static String profileNS = MyProfPackage.eNS_URI;
> //"http://www.my.org/Profile";
> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>
> private static void testProfile() {
> System.out.println(">>>>>>>>>>>>>");
>
> System.out.println();
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile+suffix));
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile));
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
> URI.createURI(path2profile+suffix));
> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
> URI.createURI(path2profile));
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile+suffix));
>
> // Map<String, URI> nsURI2ProfileMap =
> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>
> // uml init
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri = URI.createURI(umlJarLoc);
> 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(""));
>
> Map<String,Object> p2fMap =
> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
> // uml init ()
> // Resource testResi =
> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
> // System.out.println("Content of TestResi");
> // for(EObject obj : testResi.getContents()){
> // System.out.println(obj);
> // }
>
> Resource resi = resourceSet.createResource(URI.createFileURI(testModel));
> Resource profileResi =
> resourceSet.getResource(URI.createFileURI(path2profile), true);
> System.out.println("Content of ProfileResi");
> for(EObject obj : profileResi.getContents()){
> System.out.println(obj);
> }
>
>
> // uml bsp data
> Package package_ = UMLFactory.eINSTANCE.createPackage();
> resi.getContents().add(package_);
> package_.setName("MeinPacket");
> Class clazz = UMLFactory.eINSTANCE.createClass();
> clazz.setPackage(package_);
> clazz.setName("MeineKlasse2");
> // uml bsp data()
>
> Profile myProfile = UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
> if(myProfile==null){
> System.out.println("myProfile==null");
> } else{
> System.out.println("myProfile: "+myProfile);
> }
>
> try{
> package_.applyProfile(myProfile);
> } catch (Exception e) {
> System.out.println("Profile could not be applied");
> e.printStackTrace();
> }
>
> System.out.println("\nStereotypes");
> for(Stereotype stereo : clazz.getApplicableStereotypes()){
> System.out.println(stereo);
> }
>
>
> // save
> try {
> resi.save(null);
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }
>
Re: static profiles - not working ;) [message #476879 is a reply to message #476878] Wed, 23 January 2008 23:58 Go to previous messageGo to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
no I wasn't. I decided to take a CPU expensive way and wait until it is
supported. The best thing I could do is "apply" the stereotypes, but the
tree-uml2 editor of eclipse didn't really recognized them as
stereotypes. They were plain EMF instances attached to the uml model.
Things like the reflection property sheet and the <<StereotypeName>> in
front of the class didn't work.

-stefan


James Bruck wrote:
> Hi,
>
> I was just wondering if you managed to get this working after all?
>
> Step 3 in the "Using your profile" section below can be replaced with using
> the existing extension point to register your profile.
> Apart from that, you should be able to use your profile as normal.
>
> - James.
>
>
> "SKuhn" <kuhn@oio.de> wrote in message
> news:fn4umc$q8s$1@build.eclipse.org...
>> hi all,
>>
>> I've followed this tutorial:
>> ----------- Create your Profile -------------
>> 1. Create your uml profile as you would normally ( For example, create a
>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>> getting
>> started article for details ). (Call it My.profile.uml for example)
>> 2. ** don't do the "define" step ***
>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>> Ecore profile.
>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>
>> ------- Generate code ---------
>> 1. Create an EMF project as you would from any other .uml model to
>> generate
>> code from but specify your profile as the source ( My.profile.uml )
>> 2. Select the "Process All" options when loading your My.profile.uml.
>> 3. Generate code as you would normally from the resulting .genmodel.
>>
>> ------- Using your profile ------
>> Up to this point, things were pretty easy. Here comes the tricky part...
>>
>> 1. Move your previously generated code for your profile to your
>> development
>> environment.
>> 2. Create a new plugin in your development environment ( say a JUnit
>> plugin
>> to get started with ).
>> 3. In your JUnit plugin test, add the line:
>>
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is
>> the
>> id of the profile in your model.
>> 4. Create a resource set and load your My.profile.uml.
>> 5. Next, Load your profile using..
>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>> ... )
>> from the already generated MyProfilePackage from the "Generate Code"
>> step.
>> 6. Next, obtain your stereotype with..
>> Stereotype myStereotype =
>> myProfile.getOwnedStereotype("MyExtendedClass");
>> 7. This is the interesting part ... Apply your stereotype as follows:
>> MyExtendedClass myExtendedClass =
>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>> Notice how you do not get a stereotype application but rather a type
>> of
>> "MyExtendedClass".
>> 8. Now you have full access to setting variagbles to MyExtendedClass etc.
>> --- how cool is that ;) ----
>>
>>
>> and couldn't get it running. The reason is that
>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>> "Ecore" ... which -since I skipped the the define step (2)- is always
>> not there (null).
>>
>> I've attached my test code and the .profile.uml.
>>
>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>
>> The result of the code is:
>>
>> Content of ProfileResi
>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>> visibility: <unset>) (visibility: public)
>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>> packageName=myProf, nsURI=http://www.my.org/Profile])
>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
>> My, visibility: <unset>) (visibility: public)
>> Profile could not be applied
>> java.lang.IllegalArgumentException:
>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>> visibility: <unset>) (visibility: public)
>> at
>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>> at
>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>
>> Stereotypes
>> at test.StaticProfile.main(StaticProfile.java:32
>>
>>
>> What am I doing wrong?
>> -stefan
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>> </packageImport>
>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>> isAbstract="true">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951461742_136617_256">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>> name="name" visibility="public">
>> <type xmi:type="uml:PrimitiveType"
>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>> _12_5_1_15200e0_1191951461747_586671_257">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951461742_136617_256">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283" name="UIContainerType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>> name="COMPOSITE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>> name="SECTION"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>> name="DIALOG"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>> name="WIZARD"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>> name="VIEW"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>> name="TABFOLDER"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>> name="GROUP"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>> name="SCREEN"/>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951692820_933016_321">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191951577864_290094_283">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>> _12_5_1_15200e0_1191951692821_296714_323">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951692820_933016_321">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>> isAbstract="true">
>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951767428_598809_373">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>> _12_5_1_15200e0_1191951767428_297656_375">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951767428_598809_373">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>> UIContainer->UIControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191952252680_904621_608">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>> _12_5_1_15200e0_1191952252681_709833_609">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952252680_904621_608">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>> name="UIComplexDataControlType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>> name="TABLE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>> name="TREE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>> name="LIST"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>> name="FORM"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>> name="EDITOR"/>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191952555379_305362_677">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>> _12_5_1_15200e0_1191952555379_166950_678">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952555379_305362_677">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>> name="UIComplexDataControl">
>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191952645284_484596_758">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191952434982_520771_645">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>> _12_5_1_15200e0_1191952645284_100915_760">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952645284_484596_758">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938" name="complexDataControl
>> UIDataControl->UIComplexDataControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191953028759_918634_940">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>> _12_5_1_15200e0_1191953028759_239041_941">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191953028759_918634_940">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>> name="UIPrimitiveDataControl">
>> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191953116891_964982_966">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191953126646_606954_989">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>> _12_5_1_15200e0_1191953116891_548625_967">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191953116891_964982_966">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>> name="UIPrimitiveDataControlType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>> name="BUTTON"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>> name="TEXT"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>> name="LABEL"/>
>> </packagedElement>
>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>> </eAnnotations>
>> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>> </profileApplication>
>> </uml:Profile>
>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>> packageName="guiProfile" nsPrefix="guiProfileNS"
>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>> </xmi:XMI>
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> package test;
>> import java.io.IOException;
>> import java.util.Map;
>>
>> import myProf.MyClass;
>> import myProf.MyProfPackage;
>>
>> import org.eclipse.emf.common.EMFPlugin;
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.ecore.EObject;
>> import org.eclipse.emf.ecore.EPackage.Registry;
>> import org.eclipse.emf.ecore.resource.Resource;
>> import org.eclipse.emf.ecore.resource.ResourceSet;
>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>> import org.eclipse.emf.ecore.util.EcoreUtil;
>> import org.eclipse.uml2.uml.Class;
>> import org.eclipse.uml2.uml.Package;
>> import org.eclipse.uml2.uml.Profile;
>> import org.eclipse.uml2.uml.Stereotype;
>> import org.eclipse.uml2.uml.UMLFactory;
>> import org.eclipse.uml2.uml.UMLPackage;
>> import org.eclipse.uml2.uml.UMLPlugin;
>> import org.eclipse.uml2.uml.resource.UMLResource;
>> import org.eclipse.uml2.uml.util.UMLUtil;
>>
>>
>> public class StaticProfile {
>>
>>
>> public static void main(String[] args){
>> try {
>> testProfile();
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>> }
>> private final static String workspace =
>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>> // private final static String runtime =
>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>> private final static String testModel =
>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>> private final static String umlJarLoc =
>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>> private final static String path2profile = workspace;
>>
>> // private final static String profileEPackageName = "myProf";
>> private final static String profileNS = MyProfPackage.eNS_URI;
>> //"http://www.my.org/Profile";
>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>
>> private static void testProfile() {
>> System.out.println(">>>>>>>>>>>>>");
>>
>> System.out.println();
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile+suffix));
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile));
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>> URI.createURI(path2profile+suffix));
>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>> URI.createURI(path2profile));
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile+suffix));
>>
>> // Map<String, URI> nsURI2ProfileMap =
>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>
>> // uml init
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>> UMLPackage.eINSTANCE);
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>> UMLResource.Factory.INSTANCE);
>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>> URI uri = URI.createURI(umlJarLoc);
>> 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(""));
>>
>> Map<String,Object> p2fMap =
>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>> // uml init ()
>> // Resource testResi =
>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>> // System.out.println("Content of TestResi");
>> // for(EObject obj : testResi.getContents()){
>> // System.out.println(obj);
>> // }
>>
>> Resource resi = resourceSet.createResource(URI.createFileURI(testModel));
>> Resource profileResi =
>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>> System.out.println("Content of ProfileResi");
>> for(EObject obj : profileResi.getContents()){
>> System.out.println(obj);
>> }
>>
>>
>> // uml bsp data
>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>> resi.getContents().add(package_);
>> package_.setName("MeinPacket");
>> Class clazz = UMLFactory.eINSTANCE.createClass();
>> clazz.setPackage(package_);
>> clazz.setName("MeineKlasse2");
>> // uml bsp data()
>>
>> Profile myProfile = UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>> if(myProfile==null){
>> System.out.println("myProfile==null");
>> } else{
>> System.out.println("myProfile: "+myProfile);
>> }
>>
>> try{
>> package_.applyProfile(myProfile);
>> } catch (Exception e) {
>> System.out.println("Profile could not be applied");
>> e.printStackTrace();
>> }
>>
>> System.out.println("\nStereotypes");
>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>> System.out.println(stereo);
>> }
>>
>>
>> // save
>> try {
>> resi.save(null);
>> } catch (IOException e) {
>> e.printStackTrace();
>> }
>> }
>> }
>>
>
>
Re: static profiles - not working ;) [message #476883 is a reply to message #476879] Mon, 28 January 2008 15:54 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Stefan,

I just tried it out and it is working for me. I think that something is not
quite setup properly in your configuration.
The UML2 editor does recognize them with the <<StereotypeName>> and the
properties sheet does show the additional meta-attributes.

I will send out a more detailed document explaining the end-to-end process
( with screen captures etc. ).

Cheers,

- James.


"SKuhn" <kuhn@oio.de> wrote in message
news:fn8khv$655$1@build.eclipse.org...
> no I wasn't. I decided to take a CPU expensive way and wait until it is
> supported. The best thing I could do is "apply" the stereotypes, but the
> tree-uml2 editor of eclipse didn't really recognized them as stereotypes.
> They were plain EMF instances attached to the uml model. Things like the
> reflection property sheet and the <<StereotypeName>> in front of the class
> didn't work.
>
> -stefan
>
>
> James Bruck wrote:
>> Hi,
>>
>> I was just wondering if you managed to get this working after all?
>>
>> Step 3 in the "Using your profile" section below can be replaced with
>> using the existing extension point to register your profile.
>> Apart from that, you should be able to use your profile as normal.
>>
>> - James.
>>
>>
>> "SKuhn" <kuhn@oio.de> wrote in message
>> news:fn4umc$q8s$1@build.eclipse.org...
>>> hi all,
>>>
>>> I've followed this tutorial:
>>> ----------- Create your Profile -------------
>>> 1. Create your uml profile as you would normally ( For example, create a
>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>> getting
>>> started article for details ). (Call it My.profile.uml for example)
>>> 2. ** don't do the "define" step ***
>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>> Ecore profile.
>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>
>>> ------- Generate code ---------
>>> 1. Create an EMF project as you would from any other .uml model to
>>> generate
>>> code from but specify your profile as the source ( My.profile.uml )
>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>
>>> ------- Using your profile ------
>>> Up to this point, things were pretty easy. Here comes the tricky
>>> part...
>>>
>>> 1. Move your previously generated code for your profile to your
>>> development
>>> environment.
>>> 2. Create a new plugin in your development environment ( say a JUnit
>>> plugin
>>> to get started with ).
>>> 3. In your JUnit plugin test, add the line:
>>>
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is
>>> the
>>> id of the profile in your model.
>>> 4. Create a resource set and load your My.profile.uml.
>>> 5. Next, Load your profile using..
>>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>> ... )
>>> from the already generated MyProfilePackage from the "Generate Code"
>>> step.
>>> 6. Next, obtain your stereotype with..
>>> Stereotype myStereotype =
>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>> 7. This is the interesting part ... Apply your stereotype as follows:
>>> MyExtendedClass myExtendedClass =
>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>> Notice how you do not get a stereotype application but rather a type
>>> of
>>> "MyExtendedClass".
>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>> etc.
>>> --- how cool is that ;) ----
>>>
>>>
>>> and couldn't get it running. The reason is that
>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>> not there (null).
>>>
>>> I've attached my test code and the .profile.uml.
>>>
>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>
>>> The result of the code is:
>>>
>>> Content of ProfileResi
>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>> visibility: <unset>) (visibility: public)
>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
>>> My, visibility: <unset>) (visibility: public)
>>> Profile could not be applied
>>> java.lang.IllegalArgumentException:
>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>> visibility: <unset>) (visibility: public)
>>> at
>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>> at
>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>
>>> Stereotypes
>>> at test.StaticProfile.main(StaticProfile.java:32
>>>
>>>
>>> What am I doing wrong?
>>> -stefan
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xmi:XMI xmi:version="2.1"
>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>> </packageImport>
>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>> </packageImport>
>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>> </packageImport>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>> isAbstract="true">
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>>> name="base_Class" visibility="private"
>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>>> name="name" visibility="public">
>>> <type xmi:type="uml:PrimitiveType"
>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>> _12_5_1_15200e0_1191951461747_586671_257">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>> name="UIContainerType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>> name="COMPOSITE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>> name="SECTION"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>> name="DIALOG"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>> name="WIZARD"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>> name="VIEW"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>> name="TABFOLDER"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>> name="GROUP"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>> name="SCREEN"/>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>>> name="base_Class" visibility="private"
>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>>> name="type" visibility="public"
>>> type="_12_5_1_15200e0_1191951577864_290094_283">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>> _12_5_1_15200e0_1191951692821_296714_323">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>>> isAbstract="true">
>>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>>> name="base_Class" visibility="private"
>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>> _12_5_1_15200e0_1191951767428_297656_375">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>> UIContainer->UIControl">
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>> _12_5_1_15200e0_1191952252681_709833_609">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>> name="UIComplexDataControlType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>> name="TABLE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>> name="TREE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>> name="LIST"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>> name="FORM"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>> name="EDITOR"/>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>> _12_5_1_15200e0_1191952555379_166950_678">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>> name="UIComplexDataControl">
>>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>>> name="base_Class" visibility="private"
>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>>> name="type" visibility="public"
>>> type="_12_5_1_15200e0_1191952434982_520771_645">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>> _12_5_1_15200e0_1191952645284_100915_760">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>> _12_5_1_15200e0_1191953028759_239041_941">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>> name="UIPrimitiveDataControl">
>>> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>>> name="base_Class" visibility="private"
>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>> name="type" visibility="public"
>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>> _12_5_1_15200e0_1191953116891_548625_967">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>> name="UIPrimitiveDataControlType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>> name="BUTTON"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>> name="TEXT"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>> name="LABEL"/>
>>> </packagedElement>
>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>> <references xmi:type="ecore:EPackage"
>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>> </eAnnotations>
>>> <appliedProfile
>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>> </profileApplication>
>>> </uml:Profile>
>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>> </xmi:XMI>
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>> package test;
>>> import java.io.IOException;
>>> import java.util.Map;
>>>
>>> import myProf.MyClass;
>>> import myProf.MyProfPackage;
>>>
>>> import org.eclipse.emf.common.EMFPlugin;
>>> import org.eclipse.emf.common.util.URI;
>>> import org.eclipse.emf.ecore.EObject;
>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>> import org.eclipse.emf.ecore.resource.Resource;
>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>> import org.eclipse.uml2.uml.Class;
>>> import org.eclipse.uml2.uml.Package;
>>> import org.eclipse.uml2.uml.Profile;
>>> import org.eclipse.uml2.uml.Stereotype;
>>> import org.eclipse.uml2.uml.UMLFactory;
>>> import org.eclipse.uml2.uml.UMLPackage;
>>> import org.eclipse.uml2.uml.UMLPlugin;
>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>
>>>
>>> public class StaticProfile {
>>>
>>>
>>> public static void main(String[] args){
>>> try {
>>> testProfile();
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> }
>>> }
>>> private final static String workspace =
>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>> // private final static String runtime =
>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>> private final static String testModel =
>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>> private final static String umlJarLoc =
>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>> private final static String path2profile = workspace;
>>>
>>> // private final static String profileEPackageName = "myProf";
>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>> //"http://www.my.org/Profile";
>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>
>>> private static void testProfile() {
>>> System.out.println(">>>>>>>>>>>>>");
>>>
>>> System.out.println();
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile+suffix));
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile));
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>> URI.createURI(path2profile+suffix));
>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>> URI.createURI(path2profile));
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile+suffix));
>>>
>>> // Map<String, URI> nsURI2ProfileMap =
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>
>>> // uml init
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>> UMLPackage.eINSTANCE);
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>> UMLResource.Factory.INSTANCE);
>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>> URI uri = URI.createURI(umlJarLoc);
>>> 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(""));
>>>
>>> Map<String,Object> p2fMap =
>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>> // uml init ()
>>> // Resource testResi =
>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>> // System.out.println("Content of TestResi");
>>> // for(EObject obj : testResi.getContents()){
>>> // System.out.println(obj);
>>> // }
>>>
>>> Resource resi =
>>> resourceSet.createResource(URI.createFileURI(testModel));
>>> Resource profileResi =
>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>> System.out.println("Content of ProfileResi");
>>> for(EObject obj : profileResi.getContents()){
>>> System.out.println(obj);
>>> }
>>>
>>>
>>> // uml bsp data
>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>> resi.getContents().add(package_);
>>> package_.setName("MeinPacket");
>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>> clazz.setPackage(package_);
>>> clazz.setName("MeineKlasse2");
>>> // uml bsp data()
>>>
>>> Profile myProfile =
>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>> if(myProfile==null){
>>> System.out.println("myProfile==null");
>>> } else{
>>> System.out.println("myProfile: "+myProfile);
>>> }
>>>
>>> try{
>>> package_.applyProfile(myProfile);
>>> } catch (Exception e) {
>>> System.out.println("Profile could not be applied");
>>> e.printStackTrace();
>>> }
>>>
>>> System.out.println("\nStereotypes");
>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>> System.out.println(stereo);
>>> }
>>>
>>>
>>> // save
>>> try {
>>> resi.save(null);
>>> } catch (IOException e) {
>>> e.printStackTrace();
>>> }
>>> }
>>> }
>>>
>>
Re: static profiles - not working ;) [message #476884 is a reply to message #476883] Mon, 28 January 2008 23:23 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
.... let me know if this gets you further...

Cheers,
- James


Re: static profiles - not working ;) [message #476885 is a reply to message #476883] Mon, 28 January 2008 23:27 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=205480 for a rough
word document explaining how to use static profiles.
( A cleaned up version to follow shortly ).

Let me know if this gets you further.

Cheers,

-James.


"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fnkts5$3jr$1@build.eclipse.org...
> Hi Stefan,
>
> I just tried it out and it is working for me. I think that something is
> not quite setup properly in your configuration.
> The UML2 editor does recognize them with the <<StereotypeName>> and the
> properties sheet does show the additional meta-attributes.
>
> I will send out a more detailed document explaining the end-to-end process
> ( with screen captures etc. ).
>
> Cheers,
>
> - James.
>
>
> "SKuhn" <kuhn@oio.de> wrote in message
> news:fn8khv$655$1@build.eclipse.org...
>> no I wasn't. I decided to take a CPU expensive way and wait until it is
>> supported. The best thing I could do is "apply" the stereotypes, but the
>> tree-uml2 editor of eclipse didn't really recognized them as stereotypes.
>> They were plain EMF instances attached to the uml model. Things like the
>> reflection property sheet and the <<StereotypeName>> in front of the
>> class didn't work.
>>
>> -stefan
>>
>>
>> James Bruck wrote:
>>> Hi,
>>>
>>> I was just wondering if you managed to get this working after all?
>>>
>>> Step 3 in the "Using your profile" section below can be replaced with
>>> using the existing extension point to register your profile.
>>> Apart from that, you should be able to use your profile as normal.
>>>
>>> - James.
>>>
>>>
>>> "SKuhn" <kuhn@oio.de> wrote in message
>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>> hi all,
>>>>
>>>> I've followed this tutorial:
>>>> ----------- Create your Profile -------------
>>>> 1. Create your uml profile as you would normally ( For example, create
>>>> a
>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>> getting
>>>> started article for details ). (Call it My.profile.uml for example)
>>>> 2. ** don't do the "define" step ***
>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>> Ecore profile.
>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>
>>>> ------- Generate code ---------
>>>> 1. Create an EMF project as you would from any other .uml model to
>>>> generate
>>>> code from but specify your profile as the source ( My.profile.uml )
>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>
>>>> ------- Using your profile ------
>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>> part...
>>>>
>>>> 1. Move your previously generated code for your profile to your
>>>> development
>>>> environment.
>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>> plugin
>>>> to get started with ).
>>>> 3. In your JUnit plugin test, add the line:
>>>>
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>>> is the
>>>> id of the profile in your model.
>>>> 4. Create a resource set and load your My.profile.uml.
>>>> 5. Next, Load your profile using..
>>>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>> ... )
>>>> from the already generated MyProfilePackage from the "Generate Code"
>>>> step.
>>>> 6. Next, obtain your stereotype with..
>>>> Stereotype myStereotype =
>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>> 7. This is the interesting part ... Apply your stereotype as
>>>> follows:
>>>> MyExtendedClass myExtendedClass =
>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>> Notice how you do not get a stereotype application but rather a
>>>> type of
>>>> "MyExtendedClass".
>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>> etc.
>>>> --- how cool is that ;) ----
>>>>
>>>>
>>>> and couldn't get it running. The reason is that
>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>> not there (null).
>>>>
>>>> I've attached my test code and the .profile.uml.
>>>>
>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>
>>>> The result of the code is:
>>>>
>>>> Content of ProfileResi
>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>> visibility: <unset>) (visibility: public)
>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>> (name:
>>>> My, visibility: <unset>) (visibility: public)
>>>> Profile could not be applied
>>>> java.lang.IllegalArgumentException:
>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>> visibility: <unset>) (visibility: public)
>>>> at
>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>> at
>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>
>>>> Stereotypes
>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>
>>>>
>>>> What am I doing wrong?
>>>> -stefan
>>>>
>>>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xmi:XMI xmi:version="2.1"
>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>> </packageImport>
>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>> </packageImport>
>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>> </packageImport>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>> isAbstract="true">
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>>>> name="base_Class" visibility="private"
>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>>>> name="name" visibility="public">
>>>> <type xmi:type="uml:PrimitiveType"
>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>> name="UIContainerType">
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>> name="COMPOSITE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>> name="SECTION"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>> name="DIALOG"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>> name="WIZARD"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>> name="VIEW"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>> name="TABFOLDER"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>> name="GROUP"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>> name="SCREEN"/>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>>>> name="base_Class" visibility="private"
>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>>>> name="type" visibility="public"
>>>> type="_12_5_1_15200e0_1191951577864_290094_283">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>>>> isAbstract="true">
>>>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>>>> name="base_Class" visibility="private"
>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>> UIContainer->UIControl">
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>> name="UIComplexDataControlType">
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>> name="TABLE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>> name="TREE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>> name="LIST"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>> name="FORM"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>> name="EDITOR"/>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>> name="UIComplexDataControl">
>>>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>>>> name="base_Class" visibility="private"
>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>>>> name="type" visibility="public"
>>>> type="_12_5_1_15200e0_1191952434982_520771_645">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>> name="UIPrimitiveDataControl">
>>>> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>>>> name="base_Class" visibility="private"
>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>>> name="type" visibility="public"
>>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>> name="UIPrimitiveDataControlType">
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>>> name="BUTTON"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>>> name="TEXT"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>>> name="LABEL"/>
>>>> </packagedElement>
>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>> <references xmi:type="ecore:EPackage"
>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>> </eAnnotations>
>>>> <appliedProfile
>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>> </profileApplication>
>>>> </uml:Profile>
>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>> </xmi:XMI>
>>>>
>>>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>> package test;
>>>> import java.io.IOException;
>>>> import java.util.Map;
>>>>
>>>> import myProf.MyClass;
>>>> import myProf.MyProfPackage;
>>>>
>>>> import org.eclipse.emf.common.EMFPlugin;
>>>> import org.eclipse.emf.common.util.URI;
>>>> import org.eclipse.emf.ecore.EObject;
>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>> import org.eclipse.uml2.uml.Class;
>>>> import org.eclipse.uml2.uml.Package;
>>>> import org.eclipse.uml2.uml.Profile;
>>>> import org.eclipse.uml2.uml.Stereotype;
>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>
>>>>
>>>> public class StaticProfile {
>>>>
>>>>
>>>> public static void main(String[] args){
>>>> try {
>>>> testProfile();
>>>> } catch (Exception e) {
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>> private final static String workspace =
>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>> // private final static String runtime =
>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>> private final static String testModel =
>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>> private final static String umlJarLoc =
>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>> private final static String path2profile = workspace;
>>>>
>>>> // private final static String profileEPackageName = "myProf";
>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>> //"http://www.my.org/Profile";
>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>
>>>> private static void testProfile() {
>>>> System.out.println(">>>>>>>>>>>>>");
>>>>
>>>> System.out.println();
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile+suffix));
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile));
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>> URI.createURI(path2profile+suffix));
>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>> URI.createURI(path2profile));
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile+suffix));
>>>>
>>>> // Map<String, URI> nsURI2ProfileMap =
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>
>>>> // uml init
>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>> UMLPackage.eINSTANCE);
>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>> UMLResource.Factory.INSTANCE);
>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>> URI uri = URI.createURI(umlJarLoc);
>>>> 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(""));
>>>>
>>>> Map<String,Object> p2fMap =
>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>> // uml init ()
>>>> // Resource testResi =
>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>> // System.out.println("Content of TestResi");
>>>> // for(EObject obj : testResi.getContents()){
>>>> // System.out.println(obj);
>>>> // }
>>>>
>>>> Resource resi =
>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>> Resource profileResi =
>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>> System.out.println("Content of ProfileResi");
>>>> for(EObject obj : profileResi.getContents()){
>>>> System.out.println(obj);
>>>> }
>>>>
>>>>
>>>> // uml bsp data
>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>> resi.getContents().add(package_);
>>>> package_.setName("MeinPacket");
>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>> clazz.setPackage(package_);
>>>> clazz.setName("MeineKlasse2");
>>>> // uml bsp data()
>>>>
>>>> Profile myProfile =
>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>> if(myProfile==null){
>>>> System.out.println("myProfile==null");
>>>> } else{
>>>> System.out.println("myProfile: "+myProfile);
>>>> }
>>>>
>>>> try{
>>>> package_.applyProfile(myProfile);
>>>> } catch (Exception e) {
>>>> System.out.println("Profile could not be applied");
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> System.out.println("\nStereotypes");
>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>> System.out.println(stereo);
>>>> }
>>>>
>>>>
>>>> // save
>>>> try {
>>>> resi.save(null);
>>>> } catch (IOException e) {
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>> }
>>>>
>>>
>
Re: static profiles - not working ;) [message #476888 is a reply to message #476885] Tue, 29 January 2008 07:20 Go to previous messageGo to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
thanks, I'll try it today. Can I use this profile standalone (like a
normal profile for other uml-tools), too?

-stefan


James Bruck wrote:
> Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=205480 for a rough
> word document explaining how to use static profiles.
> ( A cleaned up version to follow shortly ).
>
> Let me know if this gets you further.
>
> Cheers,
>
> -James.
>
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:fnkts5$3jr$1@build.eclipse.org...
>> Hi Stefan,
>>
>> I just tried it out and it is working for me. I think that something is
>> not quite setup properly in your configuration.
>> The UML2 editor does recognize them with the <<StereotypeName>> and the
>> properties sheet does show the additional meta-attributes.
>>
>> I will send out a more detailed document explaining the end-to-end process
>> ( with screen captures etc. ).
>>
>> Cheers,
>>
>> - James.
>>
>>
>> "SKuhn" <kuhn@oio.de> wrote in message
>> news:fn8khv$655$1@build.eclipse.org...
>>> no I wasn't. I decided to take a CPU expensive way and wait until it is
>>> supported. The best thing I could do is "apply" the stereotypes, but the
>>> tree-uml2 editor of eclipse didn't really recognized them as stereotypes.
>>> They were plain EMF instances attached to the uml model. Things like the
>>> reflection property sheet and the <<StereotypeName>> in front of the
>>> class didn't work.
>>>
>>> -stefan
>>>
>>>
>>> James Bruck wrote:
>>>> Hi,
>>>>
>>>> I was just wondering if you managed to get this working after all?
>>>>
>>>> Step 3 in the "Using your profile" section below can be replaced with
>>>> using the existing extension point to register your profile.
>>>> Apart from that, you should be able to use your profile as normal.
>>>>
>>>> - James.
>>>>
>>>>
>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>> hi all,
>>>>>
>>>>> I've followed this tutorial:
>>>>> ----------- Create your Profile -------------
>>>>> 1. Create your uml profile as you would normally ( For example, create
>>>>> a
>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>> getting
>>>>> started article for details ). (Call it My.profile.uml for example)
>>>>> 2. ** don't do the "define" step ***
>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>>> Ecore profile.
>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>
>>>>> ------- Generate code ---------
>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>> generate
>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>
>>>>> ------- Using your profile ------
>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>> part...
>>>>>
>>>>> 1. Move your previously generated code for your profile to your
>>>>> development
>>>>> environment.
>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>> plugin
>>>>> to get started with ).
>>>>> 3. In your JUnit plugin test, add the line:
>>>>>
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>>>> is the
>>>>> id of the profile in your model.
>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>> 5. Next, Load your profile using..
>>>>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>> ... )
>>>>> from the already generated MyProfilePackage from the "Generate Code"
>>>>> step.
>>>>> 6. Next, obtain your stereotype with..
>>>>> Stereotype myStereotype =
>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>> follows:
>>>>> MyExtendedClass myExtendedClass =
>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>> Notice how you do not get a stereotype application but rather a
>>>>> type of
>>>>> "MyExtendedClass".
>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>> etc.
>>>>> --- how cool is that ;) ----
>>>>>
>>>>>
>>>>> and couldn't get it running. The reason is that
>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>>> not there (null).
>>>>>
>>>>> I've attached my test code and the .profile.uml.
>>>>>
>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>
>>>>> The result of the code is:
>>>>>
>>>>> Content of ProfileResi
>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>> visibility: <unset>) (visibility: public)
>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>> (name:
>>>>> My, visibility: <unset>) (visibility: public)
>>>>> Profile could not be applied
>>>>> java.lang.IllegalArgumentException:
>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>> visibility: <unset>) (visibility: public)
>>>>> at
>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>> at
>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>
>>>>> Stereotypes
>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>
>>>>>
>>>>> What am I doing wrong?
>>>>> -stefan
>>>>>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <xmi:XMI xmi:version="2.1"
>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>> </packageImport>
>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>> </packageImport>
>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>> </packageImport>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>> isAbstract="true">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>>>>> name="name" visibility="public">
>>>>> <type xmi:type="uml:PrimitiveType"
>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>> name="UIContainerType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>> name="COMPOSITE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>> name="SECTION"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>> name="DIALOG"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>> name="WIZARD"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>> name="VIEW"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>> name="TABFOLDER"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>> name="GROUP"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>> name="SCREEN"/>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>>>>> isAbstract="true">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>> UIContainer->UIControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>> name="UIComplexDataControlType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>> name="TABLE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>> name="TREE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>> name="LIST"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>> name="FORM"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>> name="EDITOR"/>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>>> name="UIComplexDataControl">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191952434982_520771_645">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>>> name="UIPrimitiveDataControl">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>>> name="UIPrimitiveDataControlType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>>>> name="BUTTON"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>>>> name="TEXT"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>>>> name="LABEL"/>
>>>>> </packagedElement>
>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>> <references xmi:type="ecore:EPackage"
>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>> </eAnnotations>
>>>>> <appliedProfile
>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>> </profileApplication>
>>>>> </uml:Profile>
>>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>>> </xmi:XMI>
>>>>>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>> package test;
>>>>> import java.io.IOException;
>>>>> import java.util.Map;
>>>>>
>>>>> import myProf.MyClass;
>>>>> import myProf.MyProfPackage;
>>>>>
>>>>> import org.eclipse.emf.common.EMFPlugin;
>>>>> import org.eclipse.emf.common.util.URI;
>>>>> import org.eclipse.emf.ecore.EObject;
>>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>>> import org.eclipse.uml2.uml.Class;
>>>>> import org.eclipse.uml2.uml.Package;
>>>>> import org.eclipse.uml2.uml.Profile;
>>>>> import org.eclipse.uml2.uml.Stereotype;
>>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>>
>>>>>
>>>>> public class StaticProfile {
>>>>>
>>>>>
>>>>> public static void main(String[] args){
>>>>> try {
>>>>> testProfile();
>>>>> } catch (Exception e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>> }
>>>>> private final static String workspace =
>>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>>> // private final static String runtime =
>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>> private final static String testModel =
>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>> private final static String umlJarLoc =
>>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>> private final static String path2profile = workspace;
>>>>>
>>>>> // private final static String profileEPackageName = "myProf";
>>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>>> //"http://www.my.org/Profile";
>>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>>
>>>>> private static void testProfile() {
>>>>> System.out.println(">>>>>>>>>>>>>");
>>>>>
>>>>> System.out.println();
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile+suffix));
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile));
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>> URI.createURI(path2profile+suffix));
>>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>> URI.createURI(path2profile));
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile+suffix));
>>>>>
>>>>> // Map<String, URI> nsURI2ProfileMap =
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>>
>>>>> // uml init
>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>>> UMLPackage.eINSTANCE);
>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>>> UMLResource.Factory.INSTANCE);
>>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>>> URI uri = URI.createURI(umlJarLoc);
>>>>> 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(""));
>>>>>
>>>>> Map<String,Object> p2fMap =
>>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>>> // uml init ()
>>>>> // Resource testResi =
>>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>>> // System.out.println("Content of TestResi");
>>>>> // for(EObject obj : testResi.getContents()){
>>>>> // System.out.println(obj);
>>>>> // }
>>>>>
>>>>> Resource resi =
>>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>>> Resource profileResi =
>>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>>> System.out.println("Content of ProfileResi");
>>>>> for(EObject obj : profileResi.getContents()){
>>>>> System.out.println(obj);
>>>>> }
>>>>>
>>>>>
>>>>> // uml bsp data
>>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>>> resi.getContents().add(package_);
>>>>> package_.setName("MeinPacket");
>>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>>> clazz.setPackage(package_);
>>>>> clazz.setName("MeineKlasse2");
>>>>> // uml bsp data()
>>>>>
>>>>> Profile myProfile =
>>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>>> if(myProfile==null){
>>>>> System.out.println("myProfile==null");
>>>>> } else{
>>>>> System.out.println("myProfile: "+myProfile);
>>>>> }
>>>>>
>>>>> try{
>>>>> package_.applyProfile(myProfile);
>>>>> } catch (Exception e) {
>>>>> System.out.println("Profile could not be applied");
>>>>> e.printStackTrace();
>>>>> }
>>>>>
>>>>> System.out.println("\nStereotypes");
>>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>>> System.out.println(stereo);
>>>>> }
>>>>>
>>>>>
>>>>> // save
>>>>> try {
>>>>> resi.save(null);
>>>>> } catch (IOException e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>> }
>>>>> }
>>>>>
>
>
Re: static profiles - not working ;) [message #476892 is a reply to message #476888] Tue, 29 January 2008 14:24 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Yes you can use your static profile as you would any other profile (the key
thing to remember is to register your profile correctly).

Cheers,

- James


"SKuhn" <kuhn@oio.de> wrote in message
news:fnmkc2$tl7$2@build.eclipse.org...
> thanks, I'll try it today. Can I use this profile standalone (like a
> normal profile for other uml-tools), too?
>
> -stefan
>
>
> James Bruck wrote:
>> Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=205480 for a
>> rough word document explaining how to use static profiles.
>> ( A cleaned up version to follow shortly ).
>>
>> Let me know if this gets you further.
>>
>> Cheers,
>>
>> -James.
>>
>>
>> "James Bruck" <jbruck@ca.ibm.com> wrote in message
>> news:fnkts5$3jr$1@build.eclipse.org...
>>> Hi Stefan,
>>>
>>> I just tried it out and it is working for me. I think that something is
>>> not quite setup properly in your configuration.
>>> The UML2 editor does recognize them with the <<StereotypeName>> and the
>>> properties sheet does show the additional meta-attributes.
>>>
>>> I will send out a more detailed document explaining the end-to-end
>>> process ( with screen captures etc. ).
>>>
>>> Cheers,
>>>
>>> - James.
>>>
>>>
>>> "SKuhn" <kuhn@oio.de> wrote in message
>>> news:fn8khv$655$1@build.eclipse.org...
>>>> no I wasn't. I decided to take a CPU expensive way and wait until it is
>>>> supported. The best thing I could do is "apply" the stereotypes, but
>>>> the tree-uml2 editor of eclipse didn't really recognized them as
>>>> stereotypes. They were plain EMF instances attached to the uml model.
>>>> Things like the reflection property sheet and the <<StereotypeName>> in
>>>> front of the class didn't work.
>>>>
>>>> -stefan
>>>>
>>>>
>>>> James Bruck wrote:
>>>>> Hi,
>>>>>
>>>>> I was just wondering if you managed to get this working after all?
>>>>>
>>>>> Step 3 in the "Using your profile" section below can be replaced with
>>>>> using the existing extension point to register your profile.
>>>>> Apart from that, you should be able to use your profile as normal.
>>>>>
>>>>> - James.
>>>>>
>>>>>
>>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>>> hi all,
>>>>>>
>>>>>> I've followed this tutorial:
>>>>>> ----------- Create your Profile -------------
>>>>>> 1. Create your uml profile as you would normally ( For example,
>>>>>> create a
>>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>>> getting
>>>>>> started article for details ). (Call it My.profile.uml for example)
>>>>>> 2. ** don't do the "define" step ***
>>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>>> existing
>>>>>> Ecore profile.
>>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>>
>>>>>> ------- Generate code ---------
>>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>>> generate
>>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>>
>>>>>> ------- Using your profile ------
>>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>>> part...
>>>>>>
>>>>>> 1. Move your previously generated code for your profile to your
>>>>>> development
>>>>>> environment.
>>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>>> plugin
>>>>>> to get started with ).
>>>>>> 3. In your JUnit plugin test, add the line:
>>>>>>
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>>>>> is the
>>>>>> id of the profile in your model.
>>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>>> 5. Next, Load your profile using..
>>>>>> Profile myProfile =
>>>>>> UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>>> ... )
>>>>>> from the already generated MyProfilePackage from the "Generate
>>>>>> Code"
>>>>>> step.
>>>>>> 6. Next, obtain your stereotype with..
>>>>>> Stereotype myStereotype =
>>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>>> follows:
>>>>>> MyExtendedClass myExtendedClass =
>>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>>> Notice how you do not get a stereotype application but rather a
>>>>>> type of
>>>>>> "MyExtendedClass".
>>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>>> etc.
>>>>>> --- how cool is that ;) ----
>>>>>>
>>>>>>
>>>>>> and couldn't get it running. The reason is that
>>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>>>> not there (null).
>>>>>>
>>>>>> I've attached my test code and the .profile.uml.
>>>>>>
>>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>>
>>>>>> The result of the code is:
>>>>>>
>>>>>> Content of ProfileResi
>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>> visibility: <unset>) (visibility: public)
>>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>>> (instanceClassName: null) (abstract: false, interface: false))
>>>>>> (mixed:
>>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>>> (name:
>>>>>> My, visibility: <unset>) (visibility: public)
>>>>>> Profile could not be applied
>>>>>> java.lang.IllegalArgumentException:
>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>> visibility: <unset>) (visibility: public)
>>>>>> at
>>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>>> at
>>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>>
>>>>>> Stereotypes
>>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>>
>>>>>>
>>>>>> What am I doing wrong?
>>>>>> -stefan
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------ --------------------
>>>>>
>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <xmi:XMI xmi:version="2.1"
>>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>>> isAbstract="true">
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class"
>>>>>> visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name"
>>>>>> visibility="public">
>>>>>> <type xmi:type="uml:PrimitiveType"
>>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>>> name="UIContainerType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>>> name="COMPOSITE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>>> name="SECTION"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>>> name="DIALOG"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>>> name="WIZARD"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>>> name="VIEW"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>>> name="TABFOLDER"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>>> name="GROUP"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>>> name="SCREEN"/>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>>>> <generalization
>>>>>> xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class"
>>>>>> visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type"
>>>>>> visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>> name="UIDataControl" isAbstract="true">
>>>>>> <generalization
>>>>>> xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class"
>>>>>> visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>>> UIContainer->UIControl">
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>>> name="UIComplexDataControlType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>>> name="TABLE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>>> name="TREE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>>> name="LIST"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>>> name="FORM"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>>> name="EDITOR"/>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>> name="UIComplexDataControl">
>>>>>> <generalization
>>>>>> xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_114215_759" name="base_Class"
>>>>>> visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191952721352_812895_780" name="type"
>>>>>> visibility="public" type="_12_5_1_15200e0_1191952434982_520771_645">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>> name="UIPrimitiveDataControl">
>>>>>> <generalization
>>>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>> <ownedAttribute
>>>>>> xmi:id="_12_5_1_15200e0_1191953116891_548625_967" name="base_Class"
>>>>>> visibility="private"
>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>>>>> name="type" visibility="public"
>>>>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name=""
>>>>>> value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name=""
>>>>>> value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>>>> name="UIPrimitiveDataControlType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>>>>> name="BUTTON"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>>>>> name="TEXT"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>>>>> name="LABEL"/>
>>>>>> </packagedElement>
>>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>>> <references xmi:type="ecore:EPackage"
>>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>>> </eAnnotations>
>>>>>> <appliedProfile
>>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>>> </profileApplication>
>>>>>> </uml:Profile>
>>>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>>>> </xmi:XMI>
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------ --------------------
>>>>>
>>>>>
>>>>>> package test;
>>>>>> import java.io.IOException;
>>>>>> import java.util.Map;
>>>>>>
>>>>>> import myProf.MyClass;
>>>>>> import myProf.MyProfPackage;
>>>>>>
>>>>>> import org.eclipse.emf.common.EMFPlugin;
>>>>>> import org.eclipse.emf.common.util.URI;
>>>>>> import org.eclipse.emf.ecore.EObject;
>>>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>>>> import org.eclipse.uml2.uml.Class;
>>>>>> import org.eclipse.uml2.uml.Package;
>>>>>> import org.eclipse.uml2.uml.Profile;
>>>>>> import org.eclipse.uml2.uml.Stereotype;
>>>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>>>
>>>>>>
>>>>>> public class StaticProfile {
>>>>>>
>>>>>>
>>>>>> public static void main(String[] args){
>>>>>> try {
>>>>>> testProfile();
>>>>>> } catch (Exception e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> }
>>>>>> private final static String workspace =
>>>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>>>> // private final static String runtime =
>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>>> private final static String testModel =
>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>>> private final static String umlJarLoc =
>>>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>>> private final static String path2profile = workspace;
>>>>>>
>>>>>> // private final static String profileEPackageName = "myProf";
>>>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>>>> //"http://www.my.org/Profile";
>>>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>>>
>>>>>> private static void testProfile() {
>>>>>> System.out.println(">>>>>>>>>>>>>");
>>>>>>
>>>>>> System.out.println();
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile));
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>> URI.createURI(path2profile));
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>>
>>>>>> // Map<String, URI> nsURI2ProfileMap =
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>>>
>>>>>> // uml init
>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>>>> UMLPackage.eINSTANCE);
>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>>>> UMLResource.Factory.INSTANCE);
>>>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>>>> URI uri = URI.createURI(umlJarLoc);
>>>>>> 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(""));
>>>>>>
>>>>>> Map<String,Object> p2fMap =
>>>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>>>> // uml init ()
>>>>>> // Resource testResi =
>>>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>>>> // System.out.println("Content of TestResi");
>>>>>> // for(EObject obj : testResi.getContents()){
>>>>>> // System.out.println(obj);
>>>>>> // }
>>>>>>
>>>>>> Resource resi =
>>>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>>>> Resource profileResi =
>>>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>>>> System.out.println("Content of ProfileResi");
>>>>>> for(EObject obj : profileResi.getContents()){
>>>>>> System.out.println(obj);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> // uml bsp data
>>>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>>>> resi.getContents().add(package_);
>>>>>> package_.setName("MeinPacket");
>>>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>>>> clazz.setPackage(package_);
>>>>>> clazz.setName("MeineKlasse2");
>>>>>> // uml bsp data()
>>>>>>
>>>>>> Profile myProfile =
>>>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>>>> if(myProfile==null){
>>>>>> System.out.println("myProfile==null");
>>>>>> } else{
>>>>>> System.out.println("myProfile: "+myProfile);
>>>>>> }
>>>>>>
>>>>>> try{
>>>>>> package_.applyProfile(myProfile);
>>>>>> } catch (Exception e) {
>>>>>> System.out.println("Profile could not be applied");
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>>
>>>>>> System.out.println("\nStereotypes");
>>>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>>>> System.out.println(stereo);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> // save
>>>>>> try {
>>>>>> resi.save(null);
>>>>>> } catch (IOException e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>>
>>
Re: static profiles - not working ;) [message #625918 is a reply to message #476864] Tue, 22 January 2008 14:57 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Stefan,

In steps 3 and 4, you should have applied the <<ePackage>> stereotype to the
profile and set the value of the 'nsURI' tag:

3. On your profile, apply the <<ePackage>> stereotype from the existing
Ecore profile.
4. Set the nsURI to something ... say http://www.myOrg/MyProfile

This is the tag whose value is being obtained during look-up of the
profile's definition. If this look-up is failing, something else must be
going wrong... have you tried debugging the code?

Kenn

"SKuhn" <kuhn@oio.de> wrote in message
news:fn4umc$q8s$1@build.eclipse.org...
> hi all,
>
> I've followed this tutorial:
> ----------- Create your Profile -------------
> 1. Create your uml profile as you would normally ( For example, create a
> stereotype called MyExtendedClass that extends uml:Class ). (see the
> getting
> started article for details ). (Call it My.profile.uml for example)
> 2. ** don't do the "define" step ***
> 3. On your profile, apply the <<ePackage>> stereotype from the existing
> Ecore profile.
> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>
> ------- Generate code ---------
> 1. Create an EMF project as you would from any other .uml model to
> generate
> code from but specify your profile as the source ( My.profile.uml )
> 2. Select the "Process All" options when loading your My.profile.uml.
> 3. Generate code as you would normally from the resulting .genmodel.
>
> ------- Using your profile ------
> Up to this point, things were pretty easy. Here comes the tricky part...
>
> 1. Move your previously generated code for your profile to your
> development
> environment.
> 2. Create a new plugin in your development environment ( say a JUnit
> plugin
> to get started with ).
> 3. In your JUnit plugin test, add the line:
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is
> the
> id of the profile in your model.
> 4. Create a resource set and load your My.profile.uml.
> 5. Next, Load your profile using..
> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
> ... )
> from the already generated MyProfilePackage from the "Generate Code"
> step.
> 6. Next, obtain your stereotype with..
> Stereotype myStereotype =
> myProfile.getOwnedStereotype("MyExtendedClass");
> 7. This is the interesting part ... Apply your stereotype as follows:
> MyExtendedClass myExtendedClass =
> (MyExtendedClass)myClass.applyStereotype(myStereotype);
> Notice how you do not get a stereotype application but rather a type
> of
> "MyExtendedClass".
> 8. Now you have full access to setting variagbles to MyExtendedClass etc.
> --- how cool is that ;) ----
>
>
> and couldn't get it running. The reason is that
> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
> getDefinition(Profile profile). This calls getTaggedValue(package_,
> "Ecore" ... which -since I skipped the the define step (2)- is always
> not there (null).
>
> I've attached my test code and the .profile.uml.
>
> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>
> The result of the code is:
>
> >>>>>>>>>>>>>
>
> Content of ProfileResi
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
> visibility: <unset>) (visibility: public)
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
> packageName=myProf, nsURI=http://www.my.org/Profile])
> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
> My, visibility: <unset>) (visibility: public)
> Profile could not be applied
> java.lang.IllegalArgumentException:
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
> visibility: <unset>) (visibility: public)
> at
> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
> at
> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
> at test.StaticProfile.testProfile(StaticProfile.java:102)
>
> Stereotypes
> at test.StaticProfile.main(StaticProfile.java:32
>
>
> What am I doing wrong?
> -stefan
>


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


> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
> isAbstract="true">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951461742_136617_256">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
> name="name" visibility="public">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
> _12_5_1_15200e0_1191951461747_586671_257">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951461742_136617_256">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191951577864_290094_283" name="UIContainerType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
> name="COMPOSITE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
> name="SECTION"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
> name="DIALOG"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
> name="WIZARD"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
> name="VIEW"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
> name="TABFOLDER"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
> name="GROUP"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
> name="SCREEN"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951444711_532617_254"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951692820_933016_321">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191951577864_290094_283">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
> _12_5_1_15200e0_1191951692821_296714_323">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951692820_933016_321">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
> isAbstract="true">
> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951444711_532617_254"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191951767428_598809_373">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
> _12_5_1_15200e0_1191951767428_297656_375">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
> aggregation="composite"
> association="_12_5_1_15200e0_1191951767428_598809_373">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
> UIContainer->UIControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191952252680_904621_608">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
> _12_5_1_15200e0_1191952252681_709833_609">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952252680_904621_608">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
> name="UIComplexDataControlType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
> name="TABLE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
> name="TREE"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
> name="LIST"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
> name="FORM"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
> name="EDITOR"/>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
> name="dataControlChildren UIComplexDataControl->UIDataControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191952555379_305362_677">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
> _12_5_1_15200e0_1191952555379_166950_678">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952555379_305362_677">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
> name="UIComplexDataControl">
> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951761873_224879_371"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191952645284_484596_758">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191952434982_520771_645">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
> _12_5_1_15200e0_1191952645284_100915_760">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
> aggregation="composite"
> association="_12_5_1_15200e0_1191952645284_484596_758">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191953026669_238956_938" name="complexDataControl
> UIDataControl->UIComplexDataControl">
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
> name="base_Association" visibility="private"
> association="_12_5_1_15200e0_1191953028759_918634_940">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
> _12_5_1_15200e0_1191953028759_239041_941">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
> aggregation="composite"
> association="_12_5_1_15200e0_1191953028759_918634_940">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Stereotype"
> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
> name="UIPrimitiveDataControl">
> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
> isSubstitutable="false"
> general="_12_5_1_15200e0_1191951761873_224879_371"/>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
> name="base_Class" visibility="private"
> association="_12_5_1_15200e0_1191953116891_964982_966">
> <type xmi:type="uml:Class"
> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
> </ownedAttribute>
> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
> name="type" visibility="public"
> type="_12_5_1_15200e0_1191953126646_606954_989">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension"
> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
> _12_5_1_15200e0_1191953116891_548625_967">
> <ownedEnd xmi:type="uml:ExtensionEnd"
> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
> aggregation="composite"
> association="_12_5_1_15200e0_1191953116891_964982_966">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xmi:type="uml:Enumeration"
> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
> name="UIPrimitiveDataControlType">
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
> name="BUTTON"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
> name="TEXT"/>
> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
> name="LABEL"/>
> </packagedElement>
> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
> </eAnnotations>
> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
> </profileApplication>
> </uml:Profile>
> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
> packageName="guiProfile" nsPrefix="guiProfileNS"
> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
> </xmi:XMI>
>


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


> package test;
> import java.io.IOException;
> import java.util.Map;
>
> import myProf.MyClass;
> import myProf.MyProfPackage;
>
> import org.eclipse.emf.common.EMFPlugin;
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.emf.ecore.EPackage.Registry;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.util.EcoreUtil;
> import org.eclipse.uml2.uml.Class;
> import org.eclipse.uml2.uml.Package;
> import org.eclipse.uml2.uml.Profile;
> import org.eclipse.uml2.uml.Stereotype;
> import org.eclipse.uml2.uml.UMLFactory;
> import org.eclipse.uml2.uml.UMLPackage;
> import org.eclipse.uml2.uml.UMLPlugin;
> import org.eclipse.uml2.uml.resource.UMLResource;
> import org.eclipse.uml2.uml.util.UMLUtil;
>
>
> public class StaticProfile {
>
>
> public static void main(String[] args){
> try {
> testProfile();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> private final static String workspace =
> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
> // private final static String runtime =
> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
> private final static String testModel =
> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
> private final static String umlJarLoc =
> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
> private final static String path2profile = workspace;
>
> // private final static String profileEPackageName = "myProf";
> private final static String profileNS = MyProfPackage.eNS_URI;
> //"http://www.my.org/Profile";
> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>
> private static void testProfile() {
> System.out.println(">>>>>>>>>>>>>");
>
> System.out.println();
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile+suffix));
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile));
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
> URI.createURI(path2profile+suffix));
> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
> URI.createURI(path2profile));
> //
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
> URI.createURI(path2profile+suffix));
>
> // Map<String, URI> nsURI2ProfileMap =
> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>
> // uml init
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri = URI.createURI(umlJarLoc);
> 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(""));
>
> Map<String,Object> p2fMap =
> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
> // uml init ()
> // Resource testResi =
> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
> // System.out.println("Content of TestResi");
> // for(EObject obj : testResi.getContents()){
> // System.out.println(obj);
> // }
>
> Resource resi = resourceSet.createResource(URI.createFileURI(testModel));
> Resource profileResi =
> resourceSet.getResource(URI.createFileURI(path2profile), true);
> System.out.println("Content of ProfileResi");
> for(EObject obj : profileResi.getContents()){
> System.out.println(obj);
> }
>
>
> // uml bsp data
> Package package_ = UMLFactory.eINSTANCE.createPackage();
> resi.getContents().add(package_);
> package_.setName("MeinPacket");
> Class clazz = UMLFactory.eINSTANCE.createClass();
> clazz.setPackage(package_);
> clazz.setName("MeineKlasse2");
> // uml bsp data()
>
> Profile myProfile = UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
> if(myProfile==null){
> System.out.println("myProfile==null");
> } else{
> System.out.println("myProfile: "+myProfile);
> }
>
> try{
> package_.applyProfile(myProfile);
> } catch (Exception e) {
> System.out.println("Profile could not be applied");
> e.printStackTrace();
> }
>
> System.out.println("\nStereotypes");
> for(Stereotype stereo : clazz.getApplicableStereotypes()){
> System.out.println(stereo);
> }
>
>
> // save
> try {
> resi.save(null);
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }
>
Re: static profiles - not working ;) [message #625920 is a reply to message #476865] Tue, 22 January 2008 15:06 Go to previous message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
oh right, I haven't seen it in the UML Editor, and when I looked in the
..uml late at night didn't see it, but the annotation is there:

<profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
<eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
</eAnnotations>
<appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
</profileApplication>
---

I've tried debugging the code, but as I said, the eAnnotation was not
resolved. I'll try it again, now that I now it is there :)

-stefan



Kenn Hussey wrote:
> Stefan,
>
> In steps 3 and 4, you should have applied the <<ePackage>> stereotype to the
> profile and set the value of the 'nsURI' tag:
>
> 3. On your profile, apply the <<ePackage>> stereotype from the existing
> Ecore profile.
> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>
> This is the tag whose value is being obtained during look-up of the
> profile's definition. If this look-up is failing, something else must be
> going wrong... have you tried debugging the code?
>
> Kenn
>
> "SKuhn" <kuhn@oio.de> wrote in message
> news:fn4umc$q8s$1@build.eclipse.org...
>> hi all,
>>
>> I've followed this tutorial:
>> ----------- Create your Profile -------------
>> 1. Create your uml profile as you would normally ( For example, create a
>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>> getting
>> started article for details ). (Call it My.profile.uml for example)
>> 2. ** don't do the "define" step ***
>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>> Ecore profile.
>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>
>> ------- Generate code ---------
>> 1. Create an EMF project as you would from any other .uml model to
>> generate
>> code from but specify your profile as the source ( My.profile.uml )
>> 2. Select the "Process All" options when loading your My.profile.uml.
>> 3. Generate code as you would normally from the resulting .genmodel.
>>
>> ------- Using your profile ------
>> Up to this point, things were pretty easy. Here comes the tricky part...
>>
>> 1. Move your previously generated code for your profile to your
>> development
>> environment.
>> 2. Create a new plugin in your development environment ( say a JUnit
>> plugin
>> to get started with ).
>> 3. In your JUnit plugin test, add the line:
>>
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX is
>> the
>> id of the profile in your model.
>> 4. Create a resource set and load your My.profile.uml.
>> 5. Next, Load your profile using..
>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>> ... )
>> from the already generated MyProfilePackage from the "Generate Code"
>> step.
>> 6. Next, obtain your stereotype with..
>> Stereotype myStereotype =
>> myProfile.getOwnedStereotype("MyExtendedClass");
>> 7. This is the interesting part ... Apply your stereotype as follows:
>> MyExtendedClass myExtendedClass =
>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>> Notice how you do not get a stereotype application but rather a type
>> of
>> "MyExtendedClass".
>> 8. Now you have full access to setting variagbles to MyExtendedClass etc.
>> --- how cool is that ;) ----
>>
>>
>> and couldn't get it running. The reason is that
>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>> "Ecore" ... which -since I skipped the the define step (2)- is always
>> not there (null).
>>
>> I've attached my test code and the .profile.uml.
>>
>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>
>> The result of the code is:
>>
>> Content of ProfileResi
>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>> visibility: <unset>) (visibility: public)
>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>> packageName=myProf, nsURI=http://www.my.org/Profile])
>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
>> My, visibility: <unset>) (visibility: public)
>> Profile could not be applied
>> java.lang.IllegalArgumentException:
>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>> visibility: <unset>) (visibility: public)
>> at
>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>> at
>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>
>> Stereotypes
>> at test.StaticProfile.main(StaticProfile.java:32
>>
>>
>> What am I doing wrong?
>> -stefan
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>> </packageImport>
>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>> isAbstract="true">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951461742_136617_256">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>> name="name" visibility="public">
>> <type xmi:type="uml:PrimitiveType"
>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>> _12_5_1_15200e0_1191951461747_586671_257">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951461742_136617_256">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283" name="UIContainerType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>> name="COMPOSITE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>> name="SECTION"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>> name="DIALOG"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>> name="WIZARD"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>> name="VIEW"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>> name="TABFOLDER"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>> name="GROUP"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>> name="SCREEN"/>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951692820_933016_321">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191951577864_290094_283">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>> _12_5_1_15200e0_1191951692821_296714_323">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951692820_933016_321">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>> isAbstract="true">
>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191951767428_598809_373">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>> _12_5_1_15200e0_1191951767428_297656_375">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191951767428_598809_373">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>> UIContainer->UIControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191952252680_904621_608">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>> _12_5_1_15200e0_1191952252681_709833_609">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952252680_904621_608">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>> name="UIComplexDataControlType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>> name="TABLE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>> name="TREE"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>> name="LIST"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>> name="FORM"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>> name="EDITOR"/>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191952555379_305362_677">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>> _12_5_1_15200e0_1191952555379_166950_678">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952555379_305362_677">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>> name="UIComplexDataControl">
>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191952645284_484596_758">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191952434982_520771_645">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>> _12_5_1_15200e0_1191952645284_100915_760">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191952645284_484596_758">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938" name="complexDataControl
>> UIDataControl->UIComplexDataControl">
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>> name="base_Association" visibility="private"
>> association="_12_5_1_15200e0_1191953028759_918634_940">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>> _12_5_1_15200e0_1191953028759_239041_941">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191953028759_918634_940">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Stereotype"
>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>> name="UIPrimitiveDataControl">
>> <generalization xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>> isSubstitutable="false"
>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>> name="base_Class" visibility="private"
>> association="_12_5_1_15200e0_1191953116891_964982_966">
>> <type xmi:type="uml:Class"
>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>> </ownedAttribute>
>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>> name="type" visibility="public"
>> type="_12_5_1_15200e0_1191953126646_606954_989">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>> </ownedAttribute>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Extension"
>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>> _12_5_1_15200e0_1191953116891_548625_967">
>> <ownedEnd xmi:type="uml:ExtensionEnd"
>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>> aggregation="composite"
>> association="_12_5_1_15200e0_1191953116891_964982_966">
>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>> <lowerValue xmi:type="uml:LiteralInteger"
>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>> </ownedEnd>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Enumeration"
>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>> name="UIPrimitiveDataControlType">
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>> name="BUTTON"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>> name="TEXT"/>
>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>> name="LABEL"/>
>> </packagedElement>
>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>> </eAnnotations>
>> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>> </profileApplication>
>> </uml:Profile>
>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>> packageName="guiProfile" nsPrefix="guiProfileNS"
>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>> </xmi:XMI>
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> package test;
>> import java.io.IOException;
>> import java.util.Map;
>>
>> import myProf.MyClass;
>> import myProf.MyProfPackage;
>>
>> import org.eclipse.emf.common.EMFPlugin;
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.ecore.EObject;
>> import org.eclipse.emf.ecore.EPackage.Registry;
>> import org.eclipse.emf.ecore.resource.Resource;
>> import org.eclipse.emf.ecore.resource.ResourceSet;
>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>> import org.eclipse.emf.ecore.util.EcoreUtil;
>> import org.eclipse.uml2.uml.Class;
>> import org.eclipse.uml2.uml.Package;
>> import org.eclipse.uml2.uml.Profile;
>> import org.eclipse.uml2.uml.Stereotype;
>> import org.eclipse.uml2.uml.UMLFactory;
>> import org.eclipse.uml2.uml.UMLPackage;
>> import org.eclipse.uml2.uml.UMLPlugin;
>> import org.eclipse.uml2.uml.resource.UMLResource;
>> import org.eclipse.uml2.uml.util.UMLUtil;
>>
>>
>> public class StaticProfile {
>>
>>
>> public static void main(String[] args){
>> try {
>> testProfile();
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>> }
>> private final static String workspace =
>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>> // private final static String runtime =
>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>> private final static String testModel =
>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>> private final static String umlJarLoc =
>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>> private final static String path2profile = workspace;
>>
>> // private final static String profileEPackageName = "myProf";
>> private final static String profileNS = MyProfPackage.eNS_URI;
>> //"http://www.my.org/Profile";
>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>
>> private static void testProfile() {
>> System.out.println(">>>>>>>>>>>>>");
>>
>> System.out.println();
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile+suffix));
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile));
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>> URI.createURI(path2profile+suffix));
>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>> URI.createURI(path2profile));
>> //
>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>> URI.createURI(path2profile+suffix));
>>
>> // Map<String, URI> nsURI2ProfileMap =
>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>
>> // uml init
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>> UMLPackage.eINSTANCE);
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>> UMLResource.Factory.INSTANCE);
>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>> URI uri = URI.createURI(umlJarLoc);
>> 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(""));
>>
>> Map<String,Object> p2fMap =
>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>> // uml init ()
>> // Resource testResi =
>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>> // System.out.println("Content of TestResi");
>> // for(EObject obj : testResi.getContents()){
>> // System.out.println(obj);
>> // }
>>
>> Resource resi = resourceSet.createResource(URI.createFileURI(testModel));
>> Resource profileResi =
>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>> System.out.println("Content of ProfileResi");
>> for(EObject obj : profileResi.getContents()){
>> System.out.println(obj);
>> }
>>
>>
>> // uml bsp data
>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>> resi.getContents().add(package_);
>> package_.setName("MeinPacket");
>> Class clazz = UMLFactory.eINSTANCE.createClass();
>> clazz.setPackage(package_);
>> clazz.setName("MeineKlasse2");
>> // uml bsp data()
>>
>> Profile myProfile = UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>> if(myProfile==null){
>> System.out.println("myProfile==null");
>> } else{
>> System.out.println("myProfile: "+myProfile);
>> }
>>
>> try{
>> package_.applyProfile(myProfile);
>> } catch (Exception e) {
>> System.out.println("Profile could not be applied");
>> e.printStackTrace();
>> }
>>
>> System.out.println("\nStereotypes");
>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>> System.out.println(stereo);
>> }
>>
>>
>> // save
>> try {
>> resi.save(null);
>> } catch (IOException e) {
>> e.printStackTrace();
>> }
>> }
>> }
>>
>
>
Re: static profiles - not working ;) [message #625922 is a reply to message #476867] Tue, 22 January 2008 17:06 Go to previous message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
well, with a closer look in PackageOperations, ApplyProfile I found
following:

EPackage profileDefinition = profile.getDefinition();

if (profileDefinition == null) {
throw new IllegalArgumentException(String.valueOf(profile));
}

if (package_.getProfileApplication(profile) == null) {
package_.createProfileApplication().setAppliedProfile(profil e);
}


--
profile.getDefinition(); return null, and the eAnnotation which I found
in .profile.uml is used -later on- for getProfile Application.

So, because my Profile is not defined, I don't have an annotation for it
-help!

-stefan

SKuhn wrote:
> oh right, I haven't seen it in the UML Editor, and when I looked in the
> .uml late at night didn't see it, but the annotation is there:
>
> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
> </eAnnotations>
> <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
> </profileApplication>
> ---
>
> I've tried debugging the code, but as I said, the eAnnotation was not
> resolved. I'll try it again, now that I now it is there :)
>
> -stefan
>
>
>
> Kenn Hussey wrote:
>> Stefan,
>>
>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>> to the profile and set the value of the 'nsURI' tag:
>>
>> 3. On your profile, apply the <<ePackage>> stereotype from the
>> existing Ecore profile.
>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>
>> This is the tag whose value is being obtained during look-up of the
>> profile's definition. If this look-up is failing, something else must
>> be going wrong... have you tried debugging the code?
>>
>> Kenn
>>
>> "SKuhn" <kuhn@oio.de> wrote in message
>> news:fn4umc$q8s$1@build.eclipse.org...
>>> hi all,
>>>
>>> I've followed this tutorial:
>>> ----------- Create your Profile -------------
>>> 1. Create your uml profile as you would normally ( For example, create a
>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>> getting
>>> started article for details ). (Call it My.profile.uml for example)
>>> 2. ** don't do the "define" step ***
>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>> Ecore profile.
>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>
>>> ------- Generate code ---------
>>> 1. Create an EMF project as you would from any other .uml model to
>>> generate
>>> code from but specify your profile as the source ( My.profile.uml )
>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>
>>> ------- Using your profile ------
>>> Up to this point, things were pretty easy. Here comes the tricky
>>> part...
>>>
>>> 1. Move your previously generated code for your profile to your
>>> development
>>> environment.
>>> 2. Create a new plugin in your development environment ( say a JUnit
>>> plugin
>>> to get started with ).
>>> 3. In your JUnit plugin test, add the line:
>>>
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>
>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>> is the
>>> id of the profile in your model.
>>> 4. Create a resource set and load your My.profile.uml.
>>> 5. Next, Load your profile using..
>>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>> ... )
>>> from the already generated MyProfilePackage from the "Generate Code"
>>> step.
>>> 6. Next, obtain your stereotype with..
>>> Stereotype myStereotype =
>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>> 7. This is the interesting part ... Apply your stereotype as follows:
>>> MyExtendedClass myExtendedClass =
>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>> Notice how you do not get a stereotype application but rather a
>>> type of
>>> "MyExtendedClass".
>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>> etc.
>>> --- how cool is that ;) ----
>>>
>>>
>>> and couldn't get it running. The reason is that
>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>> not there (null).
>>>
>>> I've attached my test code and the .profile.uml.
>>>
>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>
>>> The result of the code is:
>>>
>>> Content of ProfileResi
>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>> visibility: <unset>) (visibility: public)
>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name:
>>> My, visibility: <unset>) (visibility: public)
>>> Profile could not be applied
>>> java.lang.IllegalArgumentException:
>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>> visibility: <unset>) (visibility: public)
>>> at
>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>
>>> at
>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>
>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>
>>> Stereotypes
>>> at test.StaticProfile.main(StaticProfile.java:32
>>>
>>>
>>> What am I doing wrong?
>>> -stefan
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xmi:XMI xmi:version="2.1"
>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>> </packageImport>
>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>> </packageImport>
>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>> <importedPackage xmi:type="uml:Model"
>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>> </packageImport>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>> isAbstract="true">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name"
>>> visibility="public">
>>> <type xmi:type="uml:PrimitiveType"
>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>> _12_5_1_15200e0_1191951461747_586671_257">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>> name="UIContainerType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>> name="COMPOSITE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>> name="SECTION"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>> name="DIALOG"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>> name="WIZARD"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>> name="VIEW"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>> name="TABFOLDER"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>> name="GROUP"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>> name="SCREEN"/>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type"
>>> visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>> _12_5_1_15200e0_1191951692821_296714_323">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371"
>>> name="UIDataControl" isAbstract="true">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>> _12_5_1_15200e0_1191951767428_297656_375">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>> UIContainer->UIControl">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>> _12_5_1_15200e0_1191952252681_709833_609">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>> name="UIComplexDataControlType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>> name="TABLE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>> name="TREE"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>> name="LIST"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>> name="FORM"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>> name="EDITOR"/>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>> _12_5_1_15200e0_1191952555379_166950_678">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>> name="UIComplexDataControl">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952645284_114215_759" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191952721352_812895_780" name="type"
>>> visibility="public" type="_12_5_1_15200e0_1191952434982_520771_645">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>> _12_5_1_15200e0_1191952645284_100915_760">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>> name="base_Association" visibility="private"
>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>> _12_5_1_15200e0_1191953028759_239041_941">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Stereotype"
>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>> name="UIPrimitiveDataControl">
>>> <generalization
>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>> isSubstitutable="false"
>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>> <ownedAttribute
>>> xmi:id="_12_5_1_15200e0_1191953116891_548625_967" name="base_Class"
>>> visibility="private"
>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>> <type xmi:type="uml:Class"
>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>> </ownedAttribute>
>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>> name="type" visibility="public"
>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>> </ownedAttribute>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Extension"
>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>> _12_5_1_15200e0_1191953116891_548625_967">
>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>> aggregation="composite"
>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>> <lowerValue xmi:type="uml:LiteralInteger"
>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>> </ownedEnd>
>>> </packagedElement>
>>> <packagedElement xmi:type="uml:Enumeration"
>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>> name="UIPrimitiveDataControlType">
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>> name="BUTTON"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>> name="TEXT"/>
>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>> name="LABEL"/>
>>> </packagedElement>
>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>> <references xmi:type="ecore:EPackage"
>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>
>>> </eAnnotations>
>>> <appliedProfile
>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>> </profileApplication>
>>> </uml:Profile>
>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>> </xmi:XMI>
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>
>>> package test;
>>> import java.io.IOException;
>>> import java.util.Map;
>>>
>>> import myProf.MyClass;
>>> import myProf.MyProfPackage;
>>>
>>> import org.eclipse.emf.common.EMFPlugin;
>>> import org.eclipse.emf.common.util.URI;
>>> import org.eclipse.emf.ecore.EObject;
>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>> import org.eclipse.emf.ecore.resource.Resource;
>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>> import org.eclipse.uml2.uml.Class;
>>> import org.eclipse.uml2.uml.Package;
>>> import org.eclipse.uml2.uml.Profile;
>>> import org.eclipse.uml2.uml.Stereotype;
>>> import org.eclipse.uml2.uml.UMLFactory;
>>> import org.eclipse.uml2.uml.UMLPackage;
>>> import org.eclipse.uml2.uml.UMLPlugin;
>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>
>>>
>>> public class StaticProfile {
>>>
>>>
>>> public static void main(String[] args){
>>> try {
>>> testProfile();
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> }
>>> }
>>> private final static String workspace =
>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>> // private final static String runtime =
>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>
>>> private final static String testModel =
>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>
>>> private final static String umlJarLoc =
>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>
>>> private final static String path2profile = workspace;
>>>
>>> // private final static String profileEPackageName = "myProf";
>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>> //"http://www.my.org/Profile";
>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>
>>> private static void testProfile() {
>>> System.out.println(">>>>>>>>>>>>>");
>>>
>>> System.out.println();
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile+suffix));
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile));
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>> URI.createURI(path2profile+suffix));
>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>> URI.createURI(path2profile));
>>> //
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>> URI.createURI(path2profile+suffix));
>>>
>>> // Map<String, URI> nsURI2ProfileMap =
>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>
>>> // uml init
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>> UMLPackage.eINSTANCE);
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>> UMLResource.Factory.INSTANCE);
>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>> URI uri = URI.createURI(umlJarLoc);
>>> 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(""));
>>>
>>> Map<String,Object> p2fMap =
>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>> // uml init ()
>>> // Resource testResi =
>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>> // System.out.println("Content of TestResi");
>>> // for(EObject obj : testResi.getContents()){
>>> // System.out.println(obj);
>>> // }
>>>
>>> Resource resi =
>>> resourceSet.createResource(URI.createFileURI(testModel));
>>> Resource profileResi =
>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>> System.out.println("Content of ProfileResi");
>>> for(EObject obj : profileResi.getContents()){
>>> System.out.println(obj);
>>> }
>>>
>>>
>>> // uml bsp data
>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>> resi.getContents().add(package_);
>>> package_.setName("MeinPacket");
>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>> clazz.setPackage(package_);
>>> clazz.setName("MeineKlasse2");
>>> // uml bsp data()
>>>
>>> Profile myProfile =
>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>> if(myProfile==null){
>>> System.out.println("myProfile==null");
>>> } else{
>>> System.out.println("myProfile: "+myProfile);
>>> }
>>>
>>> try{
>>> package_.applyProfile(myProfile);
>>> } catch (Exception e) {
>>> System.out.println("Profile could not be applied");
>>> e.printStackTrace();
>>> }
>>>
>>> System.out.println("\nStereotypes");
>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>> System.out.println(stereo);
>>> }
>>>
>>>
>>> // save
>>> try {
>>> resi.save(null);
>>> } catch (IOException e) {
>>> e.printStackTrace();
>>> }
>>> }
>>> }
>>>
>>
>>
Re: static profiles - not working ;) [message #625923 is a reply to message #476868] Tue, 22 January 2008 17:34 Go to previous message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
btw, I get the same error if I launch the test in the normal workspace


SKuhn wrote:
> well, with a closer look in PackageOperations, ApplyProfile I found
> following:
>
> EPackage profileDefinition = profile.getDefinition();
>
> if (profileDefinition == null) {
> throw new IllegalArgumentException(String.valueOf(profile));
> }
>
> if (package_.getProfileApplication(profile) == null) {
> package_.createProfileApplication().setAppliedProfile(profil e);
> }
>
>
> --
> profile.getDefinition(); return null, and the eAnnotation which I found
> in .profile.uml is used -later on- for getProfile Application.
>
> So, because my Profile is not defined, I don't have an annotation for it
> -help!
>
> -stefan
>
> SKuhn wrote:
>> oh right, I haven't seen it in the UML Editor, and when I looked in
>> the .uml late at night didn't see it, but the annotation is there:
>>
>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>> </eAnnotations>
>> <appliedProfile
>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>> </profileApplication>
>> ---
>>
>> I've tried debugging the code, but as I said, the eAnnotation was not
>> resolved. I'll try it again, now that I now it is there :)
>>
>> -stefan
>>
>>
>>
>> Kenn Hussey wrote:
>>> Stefan,
>>>
>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>> to the profile and set the value of the 'nsURI' tag:
>>>
>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>> existing Ecore profile.
>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>
>>> This is the tag whose value is being obtained during look-up of the
>>> profile's definition. If this look-up is failing, something else must
>>> be going wrong... have you tried debugging the code?
>>>
>>> Kenn
>>>
>>> "SKuhn" <kuhn@oio.de> wrote in message
>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>> hi all,
>>>>
>>>> I've followed this tutorial:
>>>> ----------- Create your Profile -------------
>>>> 1. Create your uml profile as you would normally ( For example,
>>>> create a
>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>> getting
>>>> started article for details ). (Call it My.profile.uml for example)
>>>> 2. ** don't do the "define" step ***
>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>> Ecore profile.
>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>
>>>> ------- Generate code ---------
>>>> 1. Create an EMF project as you would from any other .uml model to
>>>> generate
>>>> code from but specify your profile as the source ( My.profile.uml )
>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>
>>>> ------- Using your profile ------
>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>> part...
>>>>
>>>> 1. Move your previously generated code for your profile to your
>>>> development
>>>> environment.
>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>> plugin
>>>> to get started with ).
>>>> 3. In your JUnit plugin test, add the line:
>>>>
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>
>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where
>>>> XXX is the
>>>> id of the profile in your model.
>>>> 4. Create a resource set and load your My.profile.uml.
>>>> 5. Next, Load your profile using..
>>>> Profile myProfile = UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>> ... )
>>>> from the already generated MyProfilePackage from the "Generate Code"
>>>> step.
>>>> 6. Next, obtain your stereotype with..
>>>> Stereotype myStereotype =
>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>> 7. This is the interesting part ... Apply your stereotype as
>>>> follows:
>>>> MyExtendedClass myExtendedClass =
>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>> Notice how you do not get a stereotype application but rather a
>>>> type of
>>>> "MyExtendedClass".
>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>> etc.
>>>> --- how cool is that ;) ----
>>>>
>>>>
>>>> and couldn't get it running. The reason is that
>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>> not there (null).
>>>>
>>>> I've attached my test code and the .profile.uml.
>>>>
>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>
>>>> The result of the code is:
>>>>
>>>> Content of ProfileResi
>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>> visibility: <unset>) (visibility: public)
>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>> (name:
>>>> My, visibility: <unset>) (visibility: public)
>>>> Profile could not be applied
>>>> java.lang.IllegalArgumentException:
>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>> visibility: <unset>) (visibility: public)
>>>> at
>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>
>>>> at
>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>
>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>
>>>> Stereotypes
>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>
>>>>
>>>> What am I doing wrong?
>>>> -stefan
>>>>
>>>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xmi:XMI xmi:version="2.1"
>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>> </packageImport>
>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>> </packageImport>
>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>> <importedPackage xmi:type="uml:Model"
>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>> </packageImport>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>> isAbstract="true">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name"
>>>> visibility="public">
>>>> <type xmi:type="uml:PrimitiveType"
>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>> name="UIContainerType">
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>> name="COMPOSITE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>> name="SECTION"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>> name="DIALOG"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>> name="WIZARD"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>> name="VIEW"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>> name="TABFOLDER"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>> name="GROUP"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>> name="SCREEN"/>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type"
>>>> visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371"
>>>> name="UIDataControl" isAbstract="true">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>> UIContainer->UIControl">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>> name="UIComplexDataControlType">
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>> name="TABLE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>> name="TREE"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>> name="LIST"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>> name="FORM"/>
>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>> name="EDITOR"/>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>> name="UIComplexDataControl">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952645284_114215_759" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191952721352_812895_780" name="type"
>>>> visibility="public" type="_12_5_1_15200e0_1191952434982_520771_645">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>> name="base_Association" visibility="private"
>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Stereotype"
>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>> name="UIPrimitiveDataControl">
>>>> <generalization
>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>> isSubstitutable="false"
>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191953116891_548625_967" name="base_Class"
>>>> visibility="private"
>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>> <type xmi:type="uml:Class"
>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>> </ownedAttribute>
>>>> <ownedAttribute
>>>> xmi:id="_12_5_1_15200e0_1191953185029_1046_1014" name="type"
>>>> visibility="public" type="_12_5_1_15200e0_1191953126646_606954_989">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>> </ownedAttribute>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Extension"
>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>> aggregation="composite"
>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>> </ownedEnd>
>>>> </packagedElement>
>>>> <packagedElement xmi:type="uml:Enumeration"
>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>> name="UIPrimitiveDataControlType">
>>>> <ownedLiteral
>>>> xmi:id="_12_5_1_15200e0_1191953148501_880223_1008" name="BUTTON"/>
>>>> <ownedLiteral
>>>> xmi:id="_12_5_1_15200e0_1191953162205_626311_1010" name="TEXT"/>
>>>> <ownedLiteral
>>>> xmi:id="_12_5_1_15200e0_1191953167709_704400_1012" name="LABEL"/>
>>>> </packagedElement>
>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>> <references xmi:type="ecore:EPackage"
>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>
>>>> </eAnnotations>
>>>> <appliedProfile
>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>> </profileApplication>
>>>> </uml:Profile>
>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>> </xmi:XMI>
>>>>
>>>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>
>>>> package test;
>>>> import java.io.IOException;
>>>> import java.util.Map;
>>>>
>>>> import myProf.MyClass;
>>>> import myProf.MyProfPackage;
>>>>
>>>> import org.eclipse.emf.common.EMFPlugin;
>>>> import org.eclipse.emf.common.util.URI;
>>>> import org.eclipse.emf.ecore.EObject;
>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>> import org.eclipse.uml2.uml.Class;
>>>> import org.eclipse.uml2.uml.Package;
>>>> import org.eclipse.uml2.uml.Profile;
>>>> import org.eclipse.uml2.uml.Stereotype;
>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>
>>>>
>>>> public class StaticProfile {
>>>>
>>>>
>>>> public static void main(String[] args){
>>>> try {
>>>> testProfile();
>>>> } catch (Exception e) {
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>> private final static String workspace =
>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>> // private final static String runtime =
>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>
>>>> private final static String testModel =
>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>
>>>> private final static String umlJarLoc =
>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>
>>>> private final static String path2profile = workspace;
>>>>
>>>> // private final static String profileEPackageName = "myProf";
>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>> //"http://www.my.org/Profile";
>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>
>>>> private static void testProfile() {
>>>> System.out.println(">>>>>>>>>>>>>");
>>>>
>>>> System.out.println();
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile+suffix));
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile));
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>> URI.createURI(path2profile+suffix));
>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>> URI.createURI(path2profile));
>>>> //
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>> URI.createURI(path2profile+suffix));
>>>>
>>>> // Map<String, URI> nsURI2ProfileMap =
>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>
>>>> // uml init
>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>> UMLPackage.eINSTANCE);
>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>> UMLResource.Factory.INSTANCE);
>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>> URI uri = URI.createURI(umlJarLoc);
>>>> 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(""));
>>>>
>>>> Map<String,Object> p2fMap =
>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>> // uml init ()
>>>> // Resource testResi =
>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>> // System.out.println("Content of TestResi");
>>>> // for(EObject obj : testResi.getContents()){
>>>> // System.out.println(obj);
>>>> // }
>>>>
>>>> Resource resi =
>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>> Resource profileResi =
>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>> System.out.println("Content of ProfileResi");
>>>> for(EObject obj : profileResi.getContents()){
>>>> System.out.println(obj);
>>>> }
>>>>
>>>>
>>>> // uml bsp data
>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>> resi.getContents().add(package_);
>>>> package_.setName("MeinPacket");
>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>> clazz.setPackage(package_);
>>>> clazz.setName("MeineKlasse2");
>>>> // uml bsp data()
>>>>
>>>> Profile myProfile =
>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>> if(myProfile==null){
>>>> System.out.println("myProfile==null");
>>>> } else{
>>>> System.out.println("myProfile: "+myProfile);
>>>> }
>>>>
>>>> try{
>>>> package_.applyProfile(myProfile);
>>>> } catch (Exception e) {
>>>> System.out.println("Profile could not be applied");
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> System.out.println("\nStereotypes");
>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>> System.out.println(stereo);
>>>> }
>>>>
>>>>
>>>> // save
>>>> try {
>>>> resi.save(null);
>>>> } catch (IOException e) {
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>> }
>>>>
>>>
>>>
Re: static profiles - not working ;) [message #625926 is a reply to message #476869] Tue, 22 January 2008 18:43 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
.... but the definition of a static profile is obtained by looking it up in
the registry... are you sure that the URI you've put in the registry is
being resolved properly?

Kenn

"SKuhn" <kuhn@oio.de> wrote in message
news:fn59n9$rja$1@build.eclipse.org...
> btw, I get the same error if I launch the test in the normal workspace
>
>
> SKuhn wrote:
>> well, with a closer look in PackageOperations, ApplyProfile I found
>> following:
>>
>> EPackage profileDefinition = profile.getDefinition();
>>
>> if (profileDefinition == null) {
>> throw new IllegalArgumentException(String.valueOf(profile));
>> }
>>
>> if (package_.getProfileApplication(profile) == null) {
>>
>> package_.createProfileApplication().setAppliedProfile(profil e);
>> }
>>
>>
>> --
>> profile.getDefinition(); return null, and the eAnnotation which I found
>> in .profile.uml is used -later on- for getProfile Application.
>>
>> So, because my Profile is not defined, I don't have an annotation for
>> it -help!
>>
>> -stefan
>>
>> SKuhn wrote:
>>> oh right, I haven't seen it in the UML Editor, and when I looked in the
>>> .uml late at night didn't see it, but the annotation is there:
>>>
>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>> <references xmi:type="ecore:EPackage"
>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>> </eAnnotations>
>>> <appliedProfile
>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>> </profileApplication>
>>> ---
>>>
>>> I've tried debugging the code, but as I said, the eAnnotation was not
>>> resolved. I'll try it again, now that I now it is there :)
>>>
>>> -stefan
>>>
>>>
>>>
>>> Kenn Hussey wrote:
>>>> Stefan,
>>>>
>>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>>> to the profile and set the value of the 'nsURI' tag:
>>>>
>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>> Ecore profile.
>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>
>>>> This is the tag whose value is being obtained during look-up of the
>>>> profile's definition. If this look-up is failing, something else must
>>>> be going wrong... have you tried debugging the code?
>>>>
>>>> Kenn
>>>>
>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>> hi all,
>>>>>
>>>>> I've followed this tutorial:
>>>>> ----------- Create your Profile -------------
>>>>> 1. Create your uml profile as you would normally ( For example, create
>>>>> a
>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>> getting
>>>>> started article for details ). (Call it My.profile.uml for example)
>>>>> 2. ** don't do the "define" step ***
>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>> existing
>>>>> Ecore profile.
>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>
>>>>> ------- Generate code ---------
>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>> generate
>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>
>>>>> ------- Using your profile ------
>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>> part...
>>>>>
>>>>> 1. Move your previously generated code for your profile to your
>>>>> development
>>>>> environment.
>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>> plugin
>>>>> to get started with ).
>>>>> 3. In your JUnit plugin test, add the line:
>>>>>
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>>>> is the
>>>>> id of the profile in your model.
>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>> 5. Next, Load your profile using..
>>>>> Profile myProfile =
>>>>> UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>> ... )
>>>>> from the already generated MyProfilePackage from the "Generate
>>>>> Code"
>>>>> step.
>>>>> 6. Next, obtain your stereotype with..
>>>>> Stereotype myStereotype =
>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>> follows:
>>>>> MyExtendedClass myExtendedClass =
>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>> Notice how you do not get a stereotype application but rather a
>>>>> type of
>>>>> "MyExtendedClass".
>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>> etc.
>>>>> --- how cool is that ;) ----
>>>>>
>>>>>
>>>>> and couldn't get it running. The reason is that
>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>>> not there (null).
>>>>>
>>>>> I've attached my test code and the .profile.uml.
>>>>>
>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>
>>>>> The result of the code is:
>>>>>
>>>>> Content of ProfileResi
>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>> visibility: <unset>) (visibility: public)
>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>> (name:
>>>>> My, visibility: <unset>) (visibility: public)
>>>>> Profile could not be applied
>>>>> java.lang.IllegalArgumentException:
>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>> visibility: <unset>) (visibility: public)
>>>>> at
>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>> at
>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>
>>>>> Stereotypes
>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>
>>>>>
>>>>> What am I doing wrong?
>>>>> -stefan
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <xmi:XMI xmi:version="2.1"
>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>> </packageImport>
>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>> </packageImport>
>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>> <importedPackage xmi:type="uml:Model"
>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>> </packageImport>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>> isAbstract="true">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>>>>> name="name" visibility="public">
>>>>> <type xmi:type="uml:PrimitiveType"
>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>> name="UIContainerType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>> name="COMPOSITE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>> name="SECTION"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>> name="DIALOG"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>> name="WIZARD"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>> name="VIEW"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>> name="TABFOLDER"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>> name="GROUP"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>> name="SCREEN"/>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>>>>> isAbstract="true">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>> UIContainer->UIControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>> name="UIComplexDataControlType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>> name="TABLE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>> name="TREE"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>> name="LIST"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>> name="FORM"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>> name="EDITOR"/>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>>> name="UIComplexDataControl">
>>>>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191952434982_520771_645">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>>> name="base_Association" visibility="private"
>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>>> name="UIPrimitiveDataControl">
>>>>> <generalization
>>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>>> isSubstitutable="false"
>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>>>>> name="base_Class" visibility="private"
>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>> <type xmi:type="uml:Class"
>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>> </ownedAttribute>
>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>>>> name="type" visibility="public"
>>>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>>> </ownedAttribute>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Extension"
>>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>>> aggregation="composite"
>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>>> </ownedEnd>
>>>>> </packagedElement>
>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>>> name="UIPrimitiveDataControlType">
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>>>> name="BUTTON"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>>>> name="TEXT"/>
>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>>>> name="LABEL"/>
>>>>> </packagedElement>
>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>> <references xmi:type="ecore:EPackage"
>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>> </eAnnotations>
>>>>> <appliedProfile
>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>> </profileApplication>
>>>>> </uml:Profile>
>>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>>> </xmi:XMI>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>
>>>>> package test;
>>>>> import java.io.IOException;
>>>>> import java.util.Map;
>>>>>
>>>>> import myProf.MyClass;
>>>>> import myProf.MyProfPackage;
>>>>>
>>>>> import org.eclipse.emf.common.EMFPlugin;
>>>>> import org.eclipse.emf.common.util.URI;
>>>>> import org.eclipse.emf.ecore.EObject;
>>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>>> import org.eclipse.uml2.uml.Class;
>>>>> import org.eclipse.uml2.uml.Package;
>>>>> import org.eclipse.uml2.uml.Profile;
>>>>> import org.eclipse.uml2.uml.Stereotype;
>>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>>
>>>>>
>>>>> public class StaticProfile {
>>>>>
>>>>>
>>>>> public static void main(String[] args){
>>>>> try {
>>>>> testProfile();
>>>>> } catch (Exception e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>> }
>>>>> private final static String workspace =
>>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>>> // private final static String runtime =
>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>> private final static String testModel =
>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>> private final static String umlJarLoc =
>>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>> private final static String path2profile = workspace;
>>>>>
>>>>> // private final static String profileEPackageName = "myProf";
>>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>>> //"http://www.my.org/Profile";
>>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>>
>>>>> private static void testProfile() {
>>>>> System.out.println(">>>>>>>>>>>>>");
>>>>>
>>>>> System.out.println();
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile+suffix));
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile));
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>> URI.createURI(path2profile+suffix));
>>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>> URI.createURI(path2profile));
>>>>> //
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>> URI.createURI(path2profile+suffix));
>>>>>
>>>>> // Map<String, URI> nsURI2ProfileMap =
>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>>
>>>>> // uml init
>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>>> UMLPackage.eINSTANCE);
>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>>> UMLResource.Factory.INSTANCE);
>>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>>> URI uri = URI.createURI(umlJarLoc);
>>>>> 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(""));
>>>>>
>>>>> Map<String,Object> p2fMap =
>>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>>> // uml init ()
>>>>> // Resource testResi =
>>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>>> // System.out.println("Content of TestResi");
>>>>> // for(EObject obj : testResi.getContents()){
>>>>> // System.out.println(obj);
>>>>> // }
>>>>>
>>>>> Resource resi =
>>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>>> Resource profileResi =
>>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>>> System.out.println("Content of ProfileResi");
>>>>> for(EObject obj : profileResi.getContents()){
>>>>> System.out.println(obj);
>>>>> }
>>>>>
>>>>>
>>>>> // uml bsp data
>>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>>> resi.getContents().add(package_);
>>>>> package_.setName("MeinPacket");
>>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>>> clazz.setPackage(package_);
>>>>> clazz.setName("MeineKlasse2");
>>>>> // uml bsp data()
>>>>>
>>>>> Profile myProfile =
>>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>>> if(myProfile==null){
>>>>> System.out.println("myProfile==null");
>>>>> } else{
>>>>> System.out.println("myProfile: "+myProfile);
>>>>> }
>>>>>
>>>>> try{
>>>>> package_.applyProfile(myProfile);
>>>>> } catch (Exception e) {
>>>>> System.out.println("Profile could not be applied");
>>>>> e.printStackTrace();
>>>>> }
>>>>>
>>>>> System.out.println("\nStereotypes");
>>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>>> System.out.println(stereo);
>>>>> }
>>>>>
>>>>>
>>>>> // save
>>>>> try {
>>>>> resi.save(null);
>>>>> } catch (IOException e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>
>>>>
Re: static profiles - not working ;) [message #625927 is a reply to message #476872] Tue, 22 January 2008 18:48 Go to previous message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
I think otherwise UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_)
would return null. Is this correct?

-stefan


Kenn Hussey wrote:
> ... but the definition of a static profile is obtained by looking it up in
> the registry... are you sure that the URI you've put in the registry is
> being resolved properly?
>
> Kenn
>
> "SKuhn" <kuhn@oio.de> wrote in message
> news:fn59n9$rja$1@build.eclipse.org...
>> btw, I get the same error if I launch the test in the normal workspace
>>
>>
>> SKuhn wrote:
>>> well, with a closer look in PackageOperations, ApplyProfile I found
>>> following:
>>>
>>> EPackage profileDefinition = profile.getDefinition();
>>>
>>> if (profileDefinition == null) {
>>> throw new IllegalArgumentException(String.valueOf(profile));
>>> }
>>>
>>> if (
..getProfileApplication(profile) == null) {
>>>
>>> package_.createProfileApplication().setAppliedProfile(profil e);
>>> }
>>>
>>>
>>> --
>>> profile.getDefinition(); return null, and the eAnnotation which I found
>>> in .profile.uml is used -later on- for getProfile Application.
>>>
>>> So, because my Profile is not defined, I don't have an annotation for
>>> it -help!
>>>
>>> -stefan
>>>
>>> SKuhn wrote:
>>>> oh right, I haven't seen it in the UML Editor, and when I looked in the
>>>> .uml late at night didn't see it, but the annotation is there:
>>>>
>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>> <references xmi:type="ecore:EPackage"
>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>> </eAnnotations>
>>>> <appliedProfile
>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>> </profileApplication>
>>>> ---
>>>>
>>>> I've tried debugging the code, but as I said, the eAnnotation was not
>>>> resolved. I'll try it again, now that I now it is there :)
>>>>
>>>> -stefan
>>>>
>>>>
>>>>
>>>> Kenn Hussey wrote:
>>>>> Stefan,
>>>>>
>>>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>>>> to the profile and set the value of the 'nsURI' tag:
>>>>>
>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the existing
>>>>> Ecore profile.
>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>
>>>>> This is the tag whose value is being obtained during look-up of the
>>>>> profile's definition. If this look-up is failing, something else must
>>>>> be going wrong... have you tried debugging the code?
>>>>>
>>>>> Kenn
>>>>>
>>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>>> hi all,
>>>>>>
>>>>>> I've followed this tutorial:
>>>>>> ----------- Create your Profile -------------
>>>>>> 1. Create your uml profile as you would normally ( For example, create
>>>>>> a
>>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>>> getting
>>>>>> started article for details ). (Call it My.profile.uml for example)
>>>>>> 2. ** don't do the "define" step ***
>>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>>> existing
>>>>>> Ecore profile.
>>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>>
>>>>>> ------- Generate code ---------
>>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>>> generate
>>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>>> 2. Select the "Process All" options when loading your My.profile.uml.
>>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>>
>>>>>> ------- Using your profile ------
>>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>>> part...
>>>>>>
>>>>>> 1. Move your previously generated code for your profile to your
>>>>>> development
>>>>>> environment.
>>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>>> plugin
>>>>>> to get started with ).
>>>>>> 3. In your JUnit plugin test, add the line:
>>>>>>
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where XXX
>>>>>> is the
>>>>>> id of the profile in your model.
>>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>>> 5. Next, Load your profile using..
>>>>>> Profile myProfile =
>>>>>> UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>>> ... )
>>>>>> from the already generated MyProfilePackage from the "Generate
>>>>>> Code"
>>>>>> step.
>>>>>> 6. Next, obtain your stereotype with..
>>>>>> Stereotype myStereotype =
>>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>>> follows:
>>>>>> MyExtendedClass myExtendedClass =
>>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>>> Notice how you do not get a stereotype application but rather a
>>>>>> type of
>>>>>> "MyExtendedClass".
>>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>>> etc.
>>>>>> --- how cool is that ;) ----
>>>>>>
>>>>>>
>>>>>> and couldn't get it running. The reason is that
>>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>>> "Ecore" ... which -since I skipped the the define step (2)- is always
>>>>>> not there (null).
>>>>>>
>>>>>> I've attached my test code and the .profile.uml.
>>>>>>
>>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>>
>>>>>> The result of the code is:
>>>>>>
>>>>>> Content of ProfileResi
>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>> visibility: <unset>) (visibility: public)
>>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>>> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
>>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>>> (name:
>>>>>> My, visibility: <unset>) (visibility: public)
>>>>>> Profile could not be applied
>>>>>> java.lang.IllegalArgumentException:
>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>> visibility: <unset>) (visibility: public)
>>>>>> at
>>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>>> at
>>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>>
>>>>>> Stereotypes
>>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>>
>>>>>>
>>>>>> What am I doing wrong?
>>>>>> -stefan
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------ --------------------
>>>>>
>>>>>
>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <xmi:XMI xmi:version="2.1"
>>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>>> </packageImport>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>>> isAbstract="true">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951461747_586671_257"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951497116_308118_278"
>>>>>> name="name" visibility="public">
>>>>>> <type xmi:type="uml:PrimitiveType"
>>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>>> name="UIContainerType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>>> name="COMPOSITE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>>> name="SECTION"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>>> name="DIALOG"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>>> name="WIZARD"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>>> name="VIEW"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>>> name="TABFOLDER"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>>> name="GROUP"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>>> name="SCREEN"/>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319" name="UIContainer">
>>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951692820_263208_322"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951718334_382224_343"
>>>>>> name="type" visibility="public"
>>>>>> type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371" name="UIDataControl"
>>>>>> isAbstract="true">
>>>>>> <generalization xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191951767428_923400_374"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>>> UIContainer->UIControl">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>>> name="UIComplexDataControlType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>>> name="TABLE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>>> name="TREE"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>>> name="LIST"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>>> name="FORM"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>>> name="EDITOR"/>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555379_305362_677" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952555380_36450_679
>>>>>> _12_5_1_15200e0_1191952555379_166950_678">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_36450_679" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_894856_681" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952555380_129948_680" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>> name="UIComplexDataControl">
>>>>>> <generalization xmi:id="_12_5_1_15200e0_1191952806356_666989_789"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952645284_114215_759"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191952721352_812895_780"
>>>>>> name="type" visibility="public"
>>>>>> type="_12_5_1_15200e0_1191952434982_520771_645">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952793559_45663_787" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952793558_859189_786" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_484596_758" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191952645284_114215_759
>>>>>> _12_5_1_15200e0_1191952645284_100915_760">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_100915_760" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191952642401_691287_756"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191952645284_484596_758">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_649162_762" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191952645284_136129_761" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>> name="complexDataControl UIDataControl->UIComplexDataControl">
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953028759_239041_941"
>>>>>> name="base_Association" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_918634_940" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191953028759_804402_942
>>>>>> _12_5_1_15200e0_1191953028759_239041_941">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_804402_942" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191953026669_238956_938"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191953028759_918634_940">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_852543_944" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953028759_777965_943" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>> xmi:id="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>> name="UIPrimitiveDataControl">
>>>>>> <generalization
>>>>>> xmi:id="_12_5_1_15200e0_1191953338087_458822_1019"
>>>>>> isSubstitutable="false"
>>>>>> general="_12_5_1_15200e0_1191951761873_224879_371"/>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953116891_548625_967"
>>>>>> name="base_Class" visibility="private"
>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>> <type xmi:type="uml:Class"
>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>> </ownedAttribute>
>>>>>> <ownedAttribute xmi:id="_12_5_1_15200e0_1191953185029_1046_1014"
>>>>>> name="type" visibility="public"
>>>>>> type="_12_5_1_15200e0_1191953126646_606954_989">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_844377_1017" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953279608_801287_1016" name="" value="1"/>
>>>>>> </ownedAttribute>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116891_964982_966" name=""
>>>>>> memberEnd="_12_5_1_15200e0_1191953116892_385941_968
>>>>>> _12_5_1_15200e0_1191953116891_548625_967">
>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_385941_968" name="extension_"
>>>>>> visibility="private" type="_12_5_1_15200e0_1191953113254_841091_964"
>>>>>> aggregation="composite"
>>>>>> association="_12_5_1_15200e0_1191953116891_964982_966">
>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_279445_970" name="" value="1"/>
>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>> xmi:id="_12_5_1_15200e0_1191953116892_356906_969" name=""/>
>>>>>> </ownedEnd>
>>>>>> </packagedElement>
>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>> xmi:id="_12_5_1_15200e0_1191953126646_606954_989"
>>>>>> name="UIPrimitiveDataControlType">
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953148501_880223_1008"
>>>>>> name="BUTTON"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953162205_626311_1010"
>>>>>> name="TEXT"/>
>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191953167709_704400_1012"
>>>>>> name="LABEL"/>
>>>>>> </packagedElement>
>>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>>> <references xmi:type="ecore:EPackage"
>>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>>> </eAnnotations>
>>>>>> <appliedProfile
>>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>>> </profileApplication>
>>>>>> </uml:Profile>
>>>>>> <Ecore:EPackage xmi:id="_bRkbEMhrEdyBsvVY6aeXSQ"
>>>>>> base_Package="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>> packageName="guiProfile" nsPrefix="guiProfileNS"
>>>>>> nsURI="http://www.oio.de/mdsd/tools/guiModel/guiProfile"
>>>>>> basePackage="de.oio.mdsd.tools.guiModel" prefix="GUI_OIO"/>
>>>>>> </xmi:XMI>
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------ --------------------
>>>>>
>>>>>
>>>>>
>>>>>> package test;
>>>>>> import java.io.IOException;
>>>>>> import java.util.Map;
>>>>>>
>>>>>> import myProf.MyClass;
>>>>>> import myProf.MyProfPackage;
>>>>>>
>>>>>> import org.eclipse.emf.common.EMFPlugin;
>>>>>> import org.eclipse.emf.common.util.URI;
>>>>>> import org.eclipse.emf.ecore.EObject;
>>>>>> import org.eclipse.emf.ecore.EPackage.Registry;
>>>>>> import org.eclipse.emf.ecore.resource.Resource;
>>>>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>>>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>>>>> import org.eclipse.emf.ecore.util.EcoreUtil;
>>>>>> import org.eclipse.uml2.uml.Class;
>>>>>> import org.eclipse.uml2.uml.Package;
>>>>>> import org.eclipse.uml2.uml.Profile;
>>>>>> import org.eclipse.uml2.uml.Stereotype;
>>>>>> import org.eclipse.uml2.uml.UMLFactory;
>>>>>> import org.eclipse.uml2.uml.UMLPackage;
>>>>>> import org.eclipse.uml2.uml.UMLPlugin;
>>>>>> import org.eclipse.uml2.uml.resource.UMLResource;
>>>>>> import org.eclipse.uml2.uml.util.UMLUtil;
>>>>>>
>>>>>>
>>>>>> public class StaticProfile {
>>>>>>
>>>>>>
>>>>>> public static void main(String[] args){
>>>>>> try {
>>>>>> testProfile();
>>>>>> } catch (Exception e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> }
>>>>>> private final static String workspace =
>>>>>> "/home/qn/Coden/workspace-oAW/umlStatic/model/My.profile.uml ";
>>>>>> // private final static String runtime =
>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic/model/My. profile.uml ";
>>>>>> private final static String testModel =
>>>>>> " /home/qn/Coden/runtime-New_configuration/umlStatic.test/src/ test/model.uml ";
>>>>>> private final static String umlJarLoc =
>>>>>> " jar:file://home/qn/Coden/eclipse-oAW/plugins/org.eclipse.uml 2.uml.resources_2.1.0.v200706251652.jar!/";
>>>>>> private final static String path2profile = workspace;
>>>>>>
>>>>>> // private final static String profileEPackageName = "myProf";
>>>>>> private final static String profileNS = MyProfPackage.eNS_URI;
>>>>>> //"http://www.my.org/Profile";
>>>>>> private final static String suffix = "#_EVrQ0MicEdyuvNC82dJYdg";
>>>>>>
>>>>>> private static void testProfile() {
>>>>>> System.out.println(">>>>>>>>>>>>>");
>>>>>>
>>>>>> System.out.println();
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile));
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>> // UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile NS,
>>>>>> URI.createURI(path2profile));
>>>>>> //
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile EPackageName,
>>>>>> URI.createURI(path2profile+suffix));
>>>>>>
>>>>>> // Map<String, URI> nsURI2ProfileMap =
>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap();
>>>>>>
>>>>>> // uml init
>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>>>>>> UMLPackage.eINSTANCE);
>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>>>>> UMLResource.Factory.INSTANCE);
>>>>>> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
>>>>>> URI uri = URI.createURI(umlJarLoc);
>>>>>> 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(""));
>>>>>>
>>>>>> Map<String,Object> p2fMap =
>>>>>> resourceSet.getResourceFactoryRegistry().getProtocolToFactor yMap();
>>>>>> // uml init ()
>>>>>> // Resource testResi =
>>>>>> resourceSet.getResource(URI.createURI(path2profile+suffix), true);
>>>>>> // System.out.println("Content of TestResi");
>>>>>> // for(EObject obj : testResi.getContents()){
>>>>>> // System.out.println(obj);
>>>>>> // }
>>>>>>
>>>>>> Resource resi =
>>>>>> resourceSet.createResource(URI.createFileURI(testModel));
>>>>>> Resource profileResi =
>>>>>> resourceSet.getResource(URI.createFileURI(path2profile), true);
>>>>>> System.out.println("Content of ProfileResi");
>>>>>> for(EObject obj : profileResi.getContents()){
>>>>>> System.out.println(obj);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> // uml bsp data
>>>>>> Package package_ = UMLFactory.eINSTANCE.createPackage();
>>>>>> resi.getContents().add(package_);
>>>>>> package_.setName("MeinPacket");
>>>>>> Class clazz = UMLFactory.eINSTANCE.createClass();
>>>>>> clazz.setPackage(package_);
>>>>>> clazz.setName("MeineKlasse2");
>>>>>> // uml bsp data()
>>>>>>
>>>>>> Profile myProfile =
>>>>>> UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_);
>>>>>> if(myProfile==null){
>>>>>> System.out.println("myProfile==null");
>>>>>> } else{
>>>>>> System.out.println("myProfile: "+myProfile);
>>>>>> }
>>>>>>
>>>>>> try{
>>>>>> package_.applyProfile(myProfile);
>>>>>> } catch (Exception e) {
>>>>>> System.out.println("Profile could not be applied");
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>>
>>>>>> System.out.println("\nStereotypes");
>>>>>> for(Stereotype stereo : clazz.getApplicableStereotypes()){
>>>>>> System.out.println(stereo);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> // save
>>>>>> try {
>>>>>> resi.save(null);
>>>>>> } catch (IOException e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>>
>>>>>
>
>
Re: static profiles - not working ;) [message #625930 is a reply to message #476873] Wed, 23 January 2008 02:07 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Yes, if the URL that you've registered against the generated Ecore package
for the profile can't be resolved, that method will return null...

Kenn

"SKuhn" <kuhn@oio.de> wrote in message news:fn5e25$lp$1@build.eclipse.org...
>I think otherwise UMLUtil.getProfile(MyProfPackage.eINSTANCE,package_)
>would return null. Is this correct?
>
> -stefan
>
>
> Kenn Hussey wrote:
>> ... but the definition of a static profile is obtained by looking it up
>> in the registry... are you sure that the URI you've put in the registry
>> is being resolved properly?
>>
>> Kenn
>>
>> "SKuhn" <kuhn@oio.de> wrote in message
>> news:fn59n9$rja$1@build.eclipse.org...
>>> btw, I get the same error if I launch the test in the normal workspace
>>>
>>>
>>> SKuhn wrote:
>>>> well, with a closer look in PackageOperations, ApplyProfile I found
>>>> following:
>>>>
>>>> EPackage profileDefinition = profile.getDefinition();
>>>>
>>>> if (profileDefinition == null) {
>>>> throw new
>>>> IllegalArgumentException(String.valueOf(profile));
>>>> }
>>>>
>>>> if (
> .getProfileApplication(profile) == null) {
>>>>
>>>> package_.createProfileApplication().setAppliedProfile(profil e);
>>>> }
>>>>
>>>>
>>>> --
>>>> profile.getDefinition(); return null, and the eAnnotation which I found
>>>> in .profile.uml is used -later on- for getProfile Application.
>>>>
>>>> So, because my Profile is not defined, I don't have an annotation for
>>>> it -help!
>>>>
>>>> -stefan
>>>>
>>>> SKuhn wrote:
>>>>> oh right, I haven't seen it in the UML Editor, and when I looked in
>>>>> the .uml late at night didn't see it, but the annotation is there:
>>>>>
>>>>> <profileApplication xmi:id="_P9oBoMhrEdyBsvVY6aeXSQ">
>>>>> <eAnnotations xmi:id="_P-C4YMhrEdyBsvVY6aeXSQ"
>>>>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>>>>> <references xmi:type="ecore:EPackage"
>>>>> href=" pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA"/>
>>>>> </eAnnotations>
>>>>> <appliedProfile
>>>>> href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
>>>>> </profileApplication>
>>>>> ---
>>>>>
>>>>> I've tried debugging the code, but as I said, the eAnnotation was not
>>>>> resolved. I'll try it again, now that I now it is there :)
>>>>>
>>>>> -stefan
>>>>>
>>>>>
>>>>>
>>>>> Kenn Hussey wrote:
>>>>>> Stefan,
>>>>>>
>>>>>> In steps 3 and 4, you should have applied the <<ePackage>> stereotype
>>>>>> to the profile and set the value of the 'nsURI' tag:
>>>>>>
>>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>>> existing Ecore profile.
>>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>>
>>>>>> This is the tag whose value is being obtained during look-up of the
>>>>>> profile's definition. If this look-up is failing, something else must
>>>>>> be going wrong... have you tried debugging the code?
>>>>>>
>>>>>> Kenn
>>>>>>
>>>>>> "SKuhn" <kuhn@oio.de> wrote in message
>>>>>> news:fn4umc$q8s$1@build.eclipse.org...
>>>>>>> hi all,
>>>>>>>
>>>>>>> I've followed this tutorial:
>>>>>>> ----------- Create your Profile -------------
>>>>>>> 1. Create your uml profile as you would normally ( For example,
>>>>>>> create a
>>>>>>> stereotype called MyExtendedClass that extends uml:Class ). (see the
>>>>>>> getting
>>>>>>> started article for details ). (Call it My.profile.uml for
>>>>>>> example)
>>>>>>> 2. ** don't do the "define" step ***
>>>>>>> 3. On your profile, apply the <<ePackage>> stereotype from the
>>>>>>> existing
>>>>>>> Ecore profile.
>>>>>>> 4. Set the nsURI to something ... say http://www.myOrg/MyProfile
>>>>>>>
>>>>>>> ------- Generate code ---------
>>>>>>> 1. Create an EMF project as you would from any other .uml model to
>>>>>>> generate
>>>>>>> code from but specify your profile as the source ( My.profile.uml )
>>>>>>> 2. Select the "Process All" options when loading your
>>>>>>> My.profile.uml.
>>>>>>> 3. Generate code as you would normally from the resulting .genmodel.
>>>>>>>
>>>>>>> ------- Using your profile ------
>>>>>>> Up to this point, things were pretty easy. Here comes the tricky
>>>>>>> part...
>>>>>>>
>>>>>>> 1. Move your previously generated code for your profile to your
>>>>>>> development
>>>>>>> environment.
>>>>>>> 2. Create a new plugin in your development environment ( say a JUnit
>>>>>>> plugin
>>>>>>> to get started with ).
>>>>>>> 3. In your JUnit plugin test, add the line:
>>>>>>>
>>>>>>> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(http://www.myOrg.com/My
>>>>>>> Profile, URI.createURI( ... path to My.profile.uml#_XXX")); where
>>>>>>> XXX is the
>>>>>>> id of the profile in your model.
>>>>>>> 4. Create a resource set and load your My.profile.uml.
>>>>>>> 5. Next, Load your profile using..
>>>>>>> Profile myProfile =
>>>>>>> UMLUtil.getProfile(MyProfilePackage.eINSTANCE,
>>>>>>> ... )
>>>>>>> from the already generated MyProfilePackage from the "Generate
>>>>>>> Code"
>>>>>>> step.
>>>>>>> 6. Next, obtain your stereotype with..
>>>>>>> Stereotype myStereotype =
>>>>>>> myProfile.getOwnedStereotype("MyExtendedClass");
>>>>>>> 7. This is the interesting part ... Apply your stereotype as
>>>>>>> follows:
>>>>>>> MyExtendedClass myExtendedClass =
>>>>>>> (MyExtendedClass)myClass.applyStereotype(myStereotype);
>>>>>>> Notice how you do not get a stereotype application but rather a
>>>>>>> type of
>>>>>>> "MyExtendedClass".
>>>>>>> 8. Now you have full access to setting variagbles to MyExtendedClass
>>>>>>> etc.
>>>>>>> --- how cool is that ;) ----
>>>>>>>
>>>>>>>
>>>>>>> and couldn't get it running. The reason is that
>>>>>>> package_.applyProfile(myProfile); calls ProfileOperations: EPackage
>>>>>>> getDefinition(Profile profile). This calls getTaggedValue(package_,
>>>>>>> "Ecore" ... which -since I skipped the the define step (2)- is
>>>>>>> always
>>>>>>> not there (null).
>>>>>>>
>>>>>>> I've attached my test code and the .profile.uml.
>>>>>>>
>>>>>>> For online-viewing, see http://rafb.net/p/9BbS1L94.html
>>>>>>>
>>>>>>> The result of the code is:
>>>>>>>
>>>>>>> Content of ProfileResi
>>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>>> visibility: <unset>) (visibility: public)
>>>>>>> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@1afd9cc (eClass:
>>>>>>> org.eclipse.emf.ecore.impl.EClassImpl@3e926 (name: EPackage)
>>>>>>> (instanceClassName: null) (abstract: false, interface: false))
>>>>>>> (mixed:
>>>>>>> [], anyAttribute: [base_Package=_EVrQ0MicEdyuvNC82dJYdg,
>>>>>>> packageName=myProf, nsURI=http://www.my.org/Profile])
>>>>>>> myProfile: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc
>>>>>>> (name:
>>>>>>> My, visibility: <unset>) (visibility: public)
>>>>>>> Profile could not be applied
>>>>>>> java.lang.IllegalArgumentException:
>>>>>>> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1f195fc (name: My,
>>>>>>> visibility: <unset>) (visibility: public)
>>>>>>> at
>>>>>>> org.eclipse.uml2.uml.internal.operations.PackageOperations.a pplyProfile(PackageOperations.java:524)
>>>>>>> at
>>>>>>> org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile( PackageImpl.java:1051)
>>>>>>> at test.StaticProfile.testProfile(StaticProfile.java:102)
>>>>>>>
>>>>>>> Stereotypes
>>>>>>> at test.StaticProfile.main(StaticProfile.java:32
>>>>>>>
>>>>>>>
>>>>>>> What am I doing wrong?
>>>>>>> -stefan
>>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------ --------------------
>>>>>>
>>>>>>
>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <xmi:XMI xmi:version="2.1"
>>>>>>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/4"
>>>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>>>>>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>>>>>>> xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/4
>>>>>>> pathmap://UML_PROFILES/Ecore.profile.uml#_B7dOIMEREduRdatXod jBjA">
>>>>>>> <uml:Profile xmi:id="_12_5_1_15200e0_1191951371278_589868_232"
>>>>>>> name="GuiProfile" metamodelReference="_0metamodelReferenceGUI_OiO">
>>>>>>> <packageImport xmi:id="_0metamodelReferenceGUI_OiO">
>>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
>>>>>>> </packageImport>
>>>>>>> <packageImport xmi:id="_0primitiveTypesGUI_OiO">
>>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>>>>>>> </packageImport>
>>>>>>> <packageImport xmi:id="_0javaPrimitiveTypesGUI_OiO">
>>>>>>> <importedPackage xmi:type="uml:Model"
>>>>>>> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
>>>>>>> </packageImport>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951444711_532617_254" name="UIControl"
>>>>>>> isAbstract="true">
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461747_586671_257" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951497116_308118_278" name="name"
>>>>>>> visibility="public">
>>>>>>> <type xmi:type="uml:PrimitiveType"
>>>>>>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_812133_281" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951511530_782080_280" name=""
>>>>>>> value="1"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461742_136617_256" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191951461749_945624_258
>>>>>>> _12_5_1_15200e0_1191951461747_586671_257">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_945624_258" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191951444711_532617_254"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191951461742_136617_256">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461750_90795_260" name="" value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951461749_924987_259" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951577864_290094_283"
>>>>>>> name="UIContainerType">
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951609693_223765_302"
>>>>>>> name="COMPOSITE"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951633949_930543_304"
>>>>>>> name="SECTION"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951641341_712694_306"
>>>>>>> name="DIALOG"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951647549_41585_308"
>>>>>>> name="WIZARD"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951654389_673842_310"
>>>>>>> name="VIEW"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951660149_296674_312"
>>>>>>> name="TABFOLDER"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951669877_167411_314"
>>>>>>> name="GROUP"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191951677165_910462_316"
>>>>>>> name="SCREEN"/>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951690312_464217_319"
>>>>>>> name="UIContainer">
>>>>>>> <generalization
>>>>>>> xmi:id="_12_5_1_15200e0_1191951750360_472032_346"
>>>>>>> isSubstitutable="false"
>>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_263208_322" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951718334_382224_343" name="type"
>>>>>>> visibility="public" type="_12_5_1_15200e0_1191951577864_290094_283">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_789899_785" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952749590_588235_784" name=""
>>>>>>> value="1"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692820_933016_321" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191951692820_263208_322
>>>>>>> _12_5_1_15200e0_1191951692821_296714_323">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_296714_323" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191951690312_464217_319"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191951692820_933016_321">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_920088_325" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951692821_171918_324" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>>> name="UIDataControl" isAbstract="true">
>>>>>>> <generalization
>>>>>>> xmi:id="_12_5_1_15200e0_1191951789855_785392_447"
>>>>>>> isSubstitutable="false"
>>>>>>> general="_12_5_1_15200e0_1191951444711_532617_254"/>
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_923400_374" name="base_Class"
>>>>>>> visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_598809_373" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191951767428_923400_374
>>>>>>> _12_5_1_15200e0_1191951767428_297656_375">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767428_297656_375" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191951761873_224879_371"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191951767428_598809_373">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_574722_377" name=""
>>>>>>> value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191951767429_117114_376" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952240606_445519_606" name="children
>>>>>>> UIContainer->UIControl">
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_709833_609"
>>>>>>> name="base_Association" visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="pathmap://UML_METAMODELS/UML.metamodel.uml#Association"/>
>>>>>>> </ownedAttribute>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Extension"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252680_904621_608" name=""
>>>>>>> memberEnd="_12_5_1_15200e0_1191952252681_480707_610
>>>>>>> _12_5_1_15200e0_1191952252681_709833_609">
>>>>>>> <ownedEnd xmi:type="uml:ExtensionEnd"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_480707_610" name="extension_"
>>>>>>> visibility="private" type="_12_5_1_15200e0_1191952240606_445519_606"
>>>>>>> aggregation="composite"
>>>>>>> association="_12_5_1_15200e0_1191952252680_904621_608">
>>>>>>> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_30153_612" name="" value="1"/>
>>>>>>> <lowerValue xmi:type="uml:LiteralInteger"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952252681_804516_611" name=""/>
>>>>>>> </ownedEnd>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Enumeration"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952434982_520771_645"
>>>>>>> name="UIComplexDataControlType">
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952449406_918649_664"
>>>>>>> name="TABLE"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952466006_58192_666"
>>>>>>> name="TREE"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952472486_54160_668"
>>>>>>> name="LIST"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952480478_349858_670"
>>>>>>> name="FORM"/>
>>>>>>> <ownedLiteral xmi:id="_12_5_1_15200e0_1191952487294_895150_672"
>>>>>>> name="EDITOR"/>
>>>>>>> </packagedElement>
>>>>>>> <packagedElement xmi:type="uml:Stereotype"
>>>>>>> xmi:id="_12_5_1_15200e0_1191952552688_338708_675"
>>>>>>> name="dataControlChildren UIComplexDataControl->UIDataControl">
>>>>>>> <ownedAttribute
>>>>>>> xmi:id="_12_5_1_15200e0_1191952555379_166950_678"
>>>>>>> name="base_Association" visibility="private"
>>>>>>> association="_12_5_1_15200e0_1191952555379_305362_677">
>>>>>>> <type xmi:type="uml:Class"
>>>>>>> href="