You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Prachi Damle <Pr...@citrix.com> on 2013/12/19 23:12:56 UTC

Loading order of Adapter components

Hi Darren,

I am trying to add a new implementation of SecurityChecker interface which is an Adapter.  I am adding  a plugin - RoleBasedChecker,  and I want to add it to the list of SecurityCheckers at first position.
However the new checker gets added to the list at the last position. The order specified as below is not getting followed when the components are  loaded.

Do you think I am missing anything to be changed?

Changes I did:


1)      I added my component in the global config:

'Advanced', 'DEFAULT', 'ExtensionRegistry', 'security.checkers.order', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', 'The order of precedence for the extensions', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', '2013-12-18 01:45:31', 'Global', '0'



2)      I added it to the spring-core-registry-core-context.xml under cloud-core
    <bean id="securityCheckersRegistry"
        class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
        <property name="orderConfigKey" value="security.checkers.order" />
        <property name="excludeKey" value="security.checkers.exclude" />
        <property name="orderConfigDefault"
            value="RoleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker" />
    </bean>



3)      The bean itself is defined in the spring-acl-role-based-access-checkers-context.xml under the plugin
<bean id="RoleBasedEntityAccessChecker" class="org.apache.cloudstack.acl.entity.RoleBasedEntityAccessChecker" />


Thanks,
Prachi

Re: Loading order of Adapter components

Posted by Darren Shepherd <da...@gmail.com>.
I think it's documented on the wiki but the name comes from the getName() of the class.  If getName isn't available the it's getClass().getSimpleName().  The default behavior of getName is to grab the class name, so for most practical cases it's the class name.  

Darren

> On Dec 19, 2013, at 3:41 PM, Prachi Damle <Pr...@citrix.com> wrote:
> 
> That worked. But initially I had tried with the small case bean id ‘roleBasedEntityAccessChecker’ that matched the DB entry and that did not load the order correctly.
>  
> So should it be the class name  and not the ‘id’ in the bean definition in the order config?
>  
> Thanks,
> Prachi
>  
> From: Darren Shepherd [mailto:darren.s.shepherd@gmail.com] 
> Sent: Thursday, December 19, 2013 2:30 PM
> To: Prachi Damle
> Cc: dev@cloudstack.apache.org
> Subject: Re: Loading order of Adapter components
>  
> The names are cases sensitive.  Is there a reason you put the name as lowercase in the global configuration?
> 
> Darren
> 
> On Dec 19, 2013, at 3:12 PM, "Prachi Damle" <Pr...@citrix.com> wrote:
> 
> Hi Darren,
>  
> I am trying to add a new implementation of SecurityChecker interface which is an Adapter.  I am adding  a plugin – RoleBasedChecker,  and I want to add it to the list of SecurityCheckers at first position.
> However the new checker gets added to the list at the last position. The order specified as below is not getting followed when the components are  loaded.
>  
> Do you think I am missing anything to be changed?
>  
> Changes I did:
>  
> 1)      I added my component in the global config:
>  
> 'Advanced', 'DEFAULT', 'ExtensionRegistry', 'security.checkers.order', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', 'The order of precedence for the extensions', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', '2013-12-18 01:45:31', 'Global', '0'
>  
>  
> 2)      I added it to the spring-core-registry-core-context.xml under cloud-core
>     <bean id="securityCheckersRegistry"
>         class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
>         <property name="orderConfigKey" value="security.checkers.order" />
>         <property name="excludeKey" value="security.checkers.exclude" />
>         <property name="orderConfigDefault"
>             value="RoleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker" />
>     </bean>
>  
>  
> 3)      The bean itself is defined in the spring-acl-role-based-access-checkers-context.xml under the plugin
> <bean id="RoleBasedEntityAccessChecker" class="org.apache.cloudstack.acl.entity.RoleBasedEntityAccessChecker" />
>  
>  
> Thanks,
> Prachi

RE: Loading order of Adapter components

Posted by Prachi Damle <Pr...@citrix.com>.
That worked. But initially I had tried with the small case bean id ‘roleBasedEntityAccessChecker’ that matched the DB entry and that did not load the order correctly.

So should it be the class name  and not the ‘id’ in the bean definition in the order config?

Thanks,
Prachi

From: Darren Shepherd [mailto:darren.s.shepherd@gmail.com]
Sent: Thursday, December 19, 2013 2:30 PM
To: Prachi Damle
Cc: dev@cloudstack.apache.org
Subject: Re: Loading order of Adapter components

The names are cases sensitive.  Is there a reason you put the name as lowercase in the global configuration?

Darren

On Dec 19, 2013, at 3:12 PM, "Prachi Damle" <Pr...@citrix.com>> wrote:
Hi Darren,

I am trying to add a new implementation of SecurityChecker interface which is an Adapter.  I am adding  a plugin – RoleBasedChecker,  and I want to add it to the list of SecurityCheckers at first position.
However the new checker gets added to the list at the last position. The order specified as below is not getting followed when the components are  loaded.

Do you think I am missing anything to be changed?

Changes I did:


1)      I added my component in the global config:

'Advanced', 'DEFAULT', 'ExtensionRegistry', 'security.checkers.order', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', 'The order of precedence for the extensions', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', '2013-12-18 01:45:31', 'Global', '0'



2)      I added it to the spring-core-registry-core-context.xml under cloud-core
    <bean id="securityCheckersRegistry"
        class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
        <property name="orderConfigKey" value="security.checkers.order" />
        <property name="excludeKey" value="security.checkers.exclude" />
        <property name="orderConfigDefault"
            value="RoleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker" />
    </bean>



3)      The bean itself is defined in the spring-acl-role-based-access-checkers-context.xml under the plugin
<bean id="RoleBasedEntityAccessChecker" class="org.apache.cloudstack.acl.entity.RoleBasedEntityAccessChecker" />


Thanks,
Prachi

Re: Loading order of Adapter components

Posted by Darren Shepherd <da...@gmail.com>.
The names are cases sensitive.  Is there a reason you put the name as lowercase in the global configuration?

Darren

> On Dec 19, 2013, at 3:12 PM, "Prachi Damle" <Pr...@citrix.com> wrote:
> 
> Hi Darren,
>  
> I am trying to add a new implementation of SecurityChecker interface which is an Adapter.  I am adding  a plugin – RoleBasedChecker,  and I want to add it to the list of SecurityCheckers at first position.
> However the new checker gets added to the list at the last position. The order specified as below is not getting followed when the components are  loaded.
>  
> Do you think I am missing anything to be changed?
>  
> Changes I did:
>  
> 1)      I added my component in the global config:
>  
> 'Advanced', 'DEFAULT', 'ExtensionRegistry', 'security.checkers.order', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', 'The order of precedence for the extensions', 'roleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker', '2013-12-18 01:45:31', 'Global', '0'
>  
>  
> 2)      I added it to the spring-core-registry-core-context.xml under cloud-core
>     <bean id="securityCheckersRegistry"
>         class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
>         <property name="orderConfigKey" value="security.checkers.order" />
>         <property name="excludeKey" value="security.checkers.exclude" />
>         <property name="orderConfigDefault"
>             value="RoleBasedEntityAccessChecker,AffinityGroupAccessChecker,DomainChecker" />
>     </bean>
>  
>  
> 3)      The bean itself is defined in the spring-acl-role-based-access-checkers-context.xml under the plugin
> <bean id="RoleBasedEntityAccessChecker" class="org.apache.cloudstack.acl.entity.RoleBasedEntityAccessChecker" />
>  
>  
> Thanks,
> Prachi