qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fraser Adams <fraser.ad...@blueyonder.co.uk>
Subject Re: Java Broker plugin change - was Re: QPID C++ broker monitoring and management
Date Fri, 07 Mar 2014 13:52:23 GMT
Re my last message, I also noticed that if I did

     private final Broker<?> _broker; // Passed in by Plugin bootstrapping.

instead of

     private final Broker _broker; // Passed in by Plugin bootstrapping.

then
         for (VirtualHost vhost : _broker.getVirtualHosts())

seems to compile - I've got *no idea* what that's all about - would you 
be able to enlighten me?

Frase


On 07/03/14 13:43, Fraser Adams wrote:
> Hi again Rob,
> I'm a bit befuddled. I'm seeing a bunch of errors like:
>
>
>    [javac] 
> /home/fadams/qpid/qpid-trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/QmfManagementAgent.java:218:

> incompatible types
>     [javac] found   : java.lang.Object
>     [javac] required: org.apache.qpid.server.model.VirtualHost
>     [javac]         for (VirtualHost vhost : _broker.getVirtualHosts())
> [javac]                                                         ^
>     [javac] 
> /home/fadams/qpid/qpid-trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/QmfManagementAgent.java:226:

> incompatible types
>     [javac] found   : java.lang.Object
>     [javac] required: org.apache.qpid.server.model.Connection
>     [javac]             for (Connection connection : 
> vhost.getConnections())
> [javac] ^
>     [javac] 
> /home/fadams/qpid/qpid-trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/QmfManagementAgent.java:230:

> incompatible types
>     [javac] found   : java.lang.Object
>     [javac] required: org.apache.qpid.server.model.Session
>     [javac]                 for (Session session : 
> connection.getSessions())
>     [javac]
>
>
> In code that had previously worked.
>
> The first bit of code looks like:
>
>         for (VirtualHost vhost : _broker.getVirtualHosts())
>         {
>
> Which seems fairly reasonable - I grepped in the Java Broker for 
> getVirtualHosts() and I'm seeing
>
>         VirtualHost<?> vhost = null;
>
>         for(VirtualHost vh : getBroker().getVirtualHosts())
>         {
>             if(vh.getName().equals(vhostName))
>             {
>                 vhost = vh;
>                 break;
>             }
>         }
>
> in MessageContentServlet.java - which looks essentially the same as 
> mine. Looking at the Broker model class I see:
>
>     Collection < VirtualHost<?> > getVirtualHosts();
>
> Is the <?> bit something new and is that my problem? To be honest my 
> Java generics knowledge doesn't go down to the level of <?>
>
>
> If I change
>         for (VirtualHost vhost : _broker.getVirtualHosts())
>         {
> to
>
>         for (VirtualHost vhost : 
> (java.util.Collection<VirtualHost>)_broker.getVirtualHosts())
>         {
>
> It compiles (though I've no idea if it would work correctly) but it 
> doesn't feel right especially since you seem to have "for(VirtualHost 
> vh : getBroker().getVirtualHosts())" working.
>
>
> Any idea what I'd need to change, it's all a bit crytic to me I'm afraid.
>
> Cheers,
> Frase
>
>
> On 07/03/14 11:54, Rob Godfrey wrote:
>> On 7 March 2014 12:47, Fraser Adams <fraser.adams@blueyonder.co.uk> 
>> wrote:
>>
>>> On 07/03/14 11:38, Rob Godfrey wrote:
>>>
>>>> Hi Fraser,
>>>>
>>>> sorry - I had it on my list for today to look to see if any of the 
>>>> recent
>>>> changes had broken the build for the QMF plugin...
>>>>
>>>> we really need to see if we can integrate the QMF plugin into the 
>>>> Jenkins
>>>> builds or something so we get informed when it gets broken
>>>>
>>>> -- Rob
>>>>
>>>>   Hey Rob,
>>> I'm going through it now. I'm starting with the Statistics stuff which
>>> seems reasonably straightforward to sort out.
>>>
>>> I'll give you a yell if I tun into any issues - my first priority is to
>>> get the number of errors to a level where my eyes stop going fuzzy :-)
>>>
>>> There seems to be a change to the main plugin bit where there used 
>>> to be
>>> stuff relating to AVAILABLE_ATTRIBUTES I've not reached that bit 
>>> yet, but
>>> if you've got any pointers to the changes around there and what 
>>> needs to
>>> change that'd be a help.
>>>
>>>
>>>
>> So, if you are looking at a given instance of a ConfiguredObject you can
>> call Collection<String> getAttributeNames();
>>
>> If you want to know the available attributes for a given type of 
>> object you
>> can call     public static <X extends ConfiguredObject> 
>> Collection<String>
>> getAttributeNames(Class<X> clazz) on AbstractConfiguredObject,  so
>>
>> AbstractConfiguredObject.getAttributeNames(Queue.class);
>>
>> for instance.
>>
>> At some point in the near future there'll be sub-interfaces for 
>> different
>> types of things (e.g. PriorityQueue and LastValueQueue would have
>> additional attributes over Queue)...
>>
>> Apologies - I stupidly hadn't realised that your code was so 
>> dependent on
>> the constant String definitions of the attribute names
>>
>> -- Rob
>>
>>
>>
>>
>>> It'd be good to get it into Jenkins, though I really wouldn't know 
>>> where
>>> to begin with that.
>>> Frase
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>>> For additional commands, e-mail: users-help@qpid.apache.org
>>>
>>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message