Return-Path: Delivered-To: apmail-ws-tuscany-dev-archive@locus.apache.org Received: (qmail 42164 invoked from network); 12 Dec 2007 10:10:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2007 10:10:39 -0000 Received: (qmail 68519 invoked by uid 500); 12 Dec 2007 10:10:28 -0000 Delivered-To: apmail-ws-tuscany-dev-archive@ws.apache.org Received: (qmail 68204 invoked by uid 500); 12 Dec 2007 10:10:27 -0000 Mailing-List: contact tuscany-dev-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: tuscany-dev@ws.apache.org Delivered-To: mailing list tuscany-dev@ws.apache.org Received: (qmail 68195 invoked by uid 99); 12 Dec 2007 10:10:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 02:10:27 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kelvingoodson@gmail.com designates 64.233.166.182 as permitted sender) Received: from [64.233.166.182] (HELO py-out-1112.google.com) (64.233.166.182) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 10:10:07 +0000 Received: by py-out-1112.google.com with SMTP id a25so491261pyi.13 for ; Wed, 12 Dec 2007 02:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; bh=aaFqJHr/0aj7YDTb66ahEqJT+3KCZry9imermpC/KoY=; b=IEjRi7dVgBIfSFjEgVNCSm+c51h5U4SKWtFQ1ZFNrV6Pz8IYuoVQ14aEI49E61fDUzKkLR0dQAucq8HlWr/3vJKWG2+jxKpbRXUZ8C2dMg+k2oTg8WaGK8XdiYcvTC1QnpityFwtTgvY/XG3YJ5Na8aADjJDLTkNUcku+oLNxFg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=JATA6KwpmOcS0kt7WWWvn5BsBzZNx7s+AatAupgdClLBGLeUrSQcJiZWvtshetH4eryBKeHnUjL7HkUIjjpsTlklA9fNIgxpVbh8UZKuMPIgs1cr3wcKUzRnL4ibZSvhzgVQJwK0N1cJTing0wKbc7WhxVPRGcZsZ3R/yJ8PVOA= Received: by 10.35.27.1 with SMTP id e1mr610333pyj.1.1197454209895; Wed, 12 Dec 2007 02:10:09 -0800 (PST) Received: by 10.35.31.8 with HTTP; Wed, 12 Dec 2007 02:10:09 -0800 (PST) Message-ID: <9deac9fd0712120210q5e5e5fb0x9ec47e7b802a18b8@mail.gmail.com> Date: Wed, 12 Dec 2007 10:10:09 +0000 From: "kelvin goodson" Sender: kelvingoodson@gmail.com To: tuscany-dev@ws.apache.org Subject: Re: [SDO] questions about support for Enumeration facet In-Reply-To: <9deac9fd0712120209y3a293742qa35db479cfe59fef@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_20909_30119018.1197454209885" References: <62dd6b650712110159g359fcafaj47022d3b7f9b99d5@mail.gmail.com> <9deac9fd0712110826k439c8713xd678ab765b30468@mail.gmail.com> <9deac9fd0712120209y3a293742qa35db479cfe59fef@mail.gmail.com> X-Google-Sender-Auth: f3072a18d09e293a X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_20909_30119018.1197454209885 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline By the way, until the wiki has been used to update the websitre then the FAQ can be seen at http://cwiki.apache.org/confluence/display/TUSCANY/Tuscany+SDO+Java+-+FAQ Kelvin. On 12/12/2007, kelvin goodson wrote: > > It occurred to me that there's a bit of a knack to debugging into EMF > code, so I just wrote an FAQ to describe how to do this. Comments are > welcome on its clarity or accuracy. > > Regards, Kelvin. > > On 11/12/2007, kelvin goodson wrote: > > > > Amita, > > > > It feels like option 1 is the easy way to do things, and option 2 is the > > right way given the introduction of instance properties on metadata provided > > for this purpose (but doesn't currently work). > > > > Here's the results of my digging around. Let's start with what I found > > last since it might prove to be the answer. It seems highly likely to be > > so, but there is more thinking to be done. So after quite a bit of digging > > to see how things are handled in EMF I saw the TODO in DataObjectUtil .... > > > > public static Object getMetaObjectInstanceProperty(EModelElement > > metaObject, Property property) > > { > > String value = EcoreUtil.getAnnotation(metaObject, > > property.getContainingType().getURI(), property.getName ()); > > //TODO if (property.isMany()) ... // create list of values from from > > string > > return SDOUtil.createFromString(property.getType(), value); > > } > > > > So there's a couple of things I haven't got my head round yet that > > perhaps you could take a look at since I must divert my attention for a > > while. The first is that the instance Property for the Type's enumeration > > is isMany = false. So even if we handled the TODO we wouldn't get the > > desired result. The second is that we must ensure a generic string > > tokenizer here, but I'm not yet confident that the tokenizing that we want > > to satisfy the current issue would be the same for all Properties. What I > > mean by this is that for the example you give, it starts with the separator > > "space" indicating that the first literal that should be returned from > > tokenizing is the empty string. Would this be true for all Property values, > > or is it the case that sometimes we would consider trimming leading white > > space? > > > > I had been going down a track of investigating storage and retrieval of > > the enumeration facets inside EMF, which may yet prove to be the way to fix > > this issue. The facets seem to be stored in two ways. Once as an > > annotation on the metadata artifact directly, in concatenated string form, > > and once as a vector on the extended metadata associated with the eDataType > > (See setEnumerationFacet(EDataType,List) of BasicExtendedMetaData. The bulk > > of code in setEnumerationFacet is devoted to concatenating the string > > literals and hanging the annotation on the eDataType (Type), but the last > > line then squirrels the original input vector of enumerations away on the > > extended metadata. > > > > Now there is a basicGetEnumerationFacet method on the nested class > > EDataTypeExtendedMetaDataImpl, which is contained in BasicExtendedMetaData > > which has all the reverse logic for unpacking the vector of enumerations > > from the concatenated string, but it never gets called in the scenario you > > described. Given the piece of code I included above, that wouldn't work > > anyway, given the EcoreUtil .getAnnotation returns a single String. > > > > I don't have a solution yet, but I'll think on it. Any suggestions you > > may have are welcome. > > > > Regards, Kelvin. > > > > > > > > > > > > On 11/12/2007, Amita Vadhavkar wrote: > > > > > > Hi, > > > I tried TUSCANY-1360 related to enumeration facet. Below is the > > > summary of > > > what was > > > discussed so far and a few questions. > > > ------------------------------------------------------------------------------------------------------------------------------------- > > > > > > 1) One way to do this is - > > > public static List getEnumerationFacet(Type type) { > > > return ExtendedMetaData.INSTANCE.getEnumerationFacet > > > ((EDataType)type); > > > } > > > > > > which works very straight forward and gives a list of enums. > > > > > > ------------------------------------------------------------------------------------------------------------------------------------- > > > 2) Another way is - > > > Do type.getInstanceProperties() and find the Property called > > > "enumeration". > > > > > > Where, getInstanceProperties() calls > > > DataObjectUtil.getMetaObjectInstanceProperties(EModelElement > > > metaObject) > > > in which for the given metaObject its annotations and details of each > > > annotations are traversed. Each > > > Annotation Detail is mapped to EStringToStringMapEntryImpl entry like > > > below > > > - > > > > > > EStringToStringMapEntryImpl entry = > > > (EStringToStringMapEntryImpl)iter.next(); //iter is Iterator over > > > current > > > Annotation's Details > > > String propertyName = entry.getTypedKey(); > > > > > > Property globalProperty = getGlobalProperty(hc, propertyURI, > > > propertyName); > > > if (globalProperty != null) > > > { > > > result.add(globalProperty); > > > } > > > > > > Result is a UniqueEList which is returned at the end. > > > > > > Here, when entry.getTypedKey() is "enumeration", entry.getTypedValue() > > > gives > > > a String having space separated enums > > > > > > e.g. for > > > > > > > > > > > > > > > > > > > > > > > > > > > it gives," Good Bad" > > > > > > As we see in Property globalProperty = getGlobalProperty(hc, > > > propertyURI, > > > propertyName); the TypedKey information is > > > used when forming Property with name "enumeration", but the TypedValue > > > information is not stored in the Property. > > > Same thing will be applicable for other facets like MinLenght, > > > MaxExclusive.... > > > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > > > > > Questions: > > > > > > Thus, the question I have is, in case of following 2), what will be > > > the way > > > to preserve the mapping (key-value) > > > information available about facets from EMF in the formed Property? > > > And what > > > will be better approach for TUSCANY-1360 > > > and as such for any other facets? > > > > > > Regards, > > > Amita > > > > > > > > ------=_Part_20909_30119018.1197454209885--