geronimo-xbean-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: svn commit: r908295 - /geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/context/impl/XBeanNamespaceHandler.java
Date Wed, 10 Feb 2010 18:02:02 GMT

On Feb 10, 2010, at 2:57 AM, Jacek Laskowski wrote:

> On Wed, Feb 10, 2010 at 1:32 AM,  <djencks@apache.org> wrote:
>> Author: djencks
>> Date: Wed Feb 10 00:32:13 2010
>> New Revision: 908295
> ...
>> +    private boolean equals(NonNullMetadata key1, NonNullMetadata  
>> key2) {
>> +        if (key1 == key2) return true;
>> +        if (key1.getClass() != key2.getClass()) return false;
>> +        if (key1 instanceof RefMetadata) return ((RefMetadata)  
>> key1).getComponentId().equals(((RefMetadata) key2).getComponentId());
>> +        if (key1 instanceof ReferenceMetadata) {
>> +            if (((ReferenceMetadata) key1).getTimeout() !=  
>> ((ReferenceMetadata) key2).getTimeout()) return false;
>> +        }
>> +        if (key1 instanceof ServiceReferenceMetadata) {
>> +            ServiceReferenceMetadata sr1 =  
>> (ServiceReferenceMetadata) key1;
>> +            ServiceReferenceMetadata sr2 =  
>> (ServiceReferenceMetadata) key2;
>> +            return sr1.getAvailability() == sr2.getAvailability()
>> +                    && sr1.getInterface().equals(sr2.getInterface())
>> +                    &&  
>> sr1.getComponentName().equals(sr2.getComponentName())
>> +                    && sr1.getFilter().equals(sr2.getFilter())
>> +                    &&  
>> sr1.getReferenceListeners().equals(sr2.getReferenceListeners())
>> +
>> +                    && sr1.getId().equals(sr2.getId())
>> +                    && sr1.getActivation() == sr2.getActivation()
>> +                    &&  
>> sr1.getDependsOn().equals(sr2.getDependsOn());
>> +        }
>> +        if (key1 instanceof ValueMetadata) {
>> +            ValueMetadata v1 = (ValueMetadata) key1;
>> +            ValueMetadata v2 = (ValueMetadata) key2;
>> +            if (v1.getStringValue() != null ?  
>> v1.getStringValue().equals(v2.getStringValue()) :  
>> v2.getStringValue() == null
>> +                    && v1.getType() != null ?  
>> v1.getType().equals(v2.getType()) : v2.getType() == null) {
>> +                return true;
>> +            }
>> +        }
>> +        return false;
>> +    }
>> +
>
> Hi Dave,
>
> I wonder if it wasn't clearer to introduce proper equals method in
> ServiceReferenceMetadata and ValueMetadata classes, and delegate its
> calls to them?

Hi Jacek,

That was my original approach, see https://issues.apache.org/jira/browse/ARIES-110

However, as someone pointed out on the aries list.... one hopes that  
eventually rfc 155 will be completed and there will be a standard for  
blueprint namespace handlers.  Should this occur, then we'd need the  
blueprint spec to require these equals methods so this namespace  
handler will work on all blueprint implementations, not just aries  
blueprint which we can influence.  I'm going to suggest that, but I  
don't expect that it will be accepted.

thanks
david jencks

>
> Jacek
>
> -- 
> Jacek Laskowski
> Notatnik Projektanta Java EE - http://wszystkojawne.pl
> p.s. Szukam speca/firmy od grafiki/CSS/HTML


Mime
View raw message