You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Will McGauley (JIRA)" <ji...@apache.org> on 2012/10/25 20:41:11 UTC

[jira] [Created] (SLING-2630) Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination

Will McGauley created SLING-2630:
------------------------------------

             Summary: Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination
                 Key: SLING-2630
                 URL: https://issues.apache.org/jira/browse/SLING-2630
             Project: Sling
          Issue Type: Bug
          Components: Extensions
    Affects Versions: Adapter 2.0.16
            Reporter: Will McGauley
             Fix For: Adapter 2.0.18
         Attachments: SLING-2630.patch

If you configure more than one AdapterFactory in the system which bears the same adapter / adaptable combinations only the AdapterFactory with the highest ranking is used.

Example:

ClassA extends MyInterface
classB extends MyInterface

AdapterFactoryA adapts Node to MyInterface  (hoping to return implementation ClassA under some circumstances)
AdapterFactoryB adapts Node to MyInterface  (hoping to return implementation ClassA under some other circumstances)

when adapting Node to MyInterface, only AdapterFactoryA is ever used, even if it returns null for a particular Node.

Expected:  If AdapterFactoryA returns null then any remaining AdapterFactories configured with that combination (in this case AdapterFactoryB) should be allowed the chance to adapt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (SLING-2630) Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler resolved SLING-2630.
-------------------------------------

    Resolution: Fixed
    
> Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination
> ----------------------------------------------------------------------------------------------
>
>                 Key: SLING-2630
>                 URL: https://issues.apache.org/jira/browse/SLING-2630
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Adapter 2.0.16
>            Reporter: Will McGauley
>            Assignee: Carsten Ziegeler
>              Labels: AdapterManager
>             Fix For: Adapter 2.0.18
>
>         Attachments: SLING-2630.patch
>
>
> If you configure more than one AdapterFactory in the system which bears the same adapter / adaptable combinations only the AdapterFactory with the highest ranking is used.
> Example:
> ClassA extends MyInterface
> classB extends MyInterface
> AdapterFactoryA adapts Node to MyInterface  (hoping to return implementation ClassA under some circumstances)
> AdapterFactoryB adapts Node to MyInterface  (hoping to return implementation ClassA under some other circumstances)
> when adapting Node to MyInterface, only AdapterFactoryA is ever used, even if it returns null for a particular Node.
> Expected:  If AdapterFactoryA returns null then any remaining AdapterFactories configured with that combination (in this case AdapterFactoryB) should be allowed the chance to adapt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (SLING-2630) Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler reassigned SLING-2630:
---------------------------------------

    Assignee: Carsten Ziegeler
    
> Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination
> ----------------------------------------------------------------------------------------------
>
>                 Key: SLING-2630
>                 URL: https://issues.apache.org/jira/browse/SLING-2630
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Adapter 2.0.16
>            Reporter: Will McGauley
>            Assignee: Carsten Ziegeler
>              Labels: AdapterManager
>             Fix For: Adapter 2.0.18
>
>         Attachments: SLING-2630.patch
>
>
> If you configure more than one AdapterFactory in the system which bears the same adapter / adaptable combinations only the AdapterFactory with the highest ranking is used.
> Example:
> ClassA extends MyInterface
> classB extends MyInterface
> AdapterFactoryA adapts Node to MyInterface  (hoping to return implementation ClassA under some circumstances)
> AdapterFactoryB adapts Node to MyInterface  (hoping to return implementation ClassA under some other circumstances)
> when adapting Node to MyInterface, only AdapterFactoryA is ever used, even if it returns null for a particular Node.
> Expected:  If AdapterFactoryA returns null then any remaining AdapterFactories configured with that combination (in this case AdapterFactoryB) should be allowed the chance to adapt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SLING-2630) Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination

Posted by "Will McGauley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will McGauley updated SLING-2630:
---------------------------------

    Attachment: SLING-2630.patch

Please find attached a patch which addresses this issue.  The basic idea behind the patch is to store a List of AdapterFactoryDescriptors for each combination instead of a single one - and to call all adapterFactories in order based on service ranking until the adapted value is not null.

There are tests included that cover this concept.

As an aside I also found a bug with respect to ranking AdapterFactories based on service ranking which I fixed --> around line 365 in AdapterManagerImpl.java the AdapterFactoryDescriptor classes are loaded into a HashSet, which loses all ordering of the descriptors.  I changed it to use an ArrayList which will preserve the order.
                
> Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination
> ----------------------------------------------------------------------------------------------
>
>                 Key: SLING-2630
>                 URL: https://issues.apache.org/jira/browse/SLING-2630
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Adapter 2.0.16
>            Reporter: Will McGauley
>              Labels: AdapterManager
>             Fix For: Adapter 2.0.18
>
>         Attachments: SLING-2630.patch
>
>
> If you configure more than one AdapterFactory in the system which bears the same adapter / adaptable combinations only the AdapterFactory with the highest ranking is used.
> Example:
> ClassA extends MyInterface
> classB extends MyInterface
> AdapterFactoryA adapts Node to MyInterface  (hoping to return implementation ClassA under some circumstances)
> AdapterFactoryB adapts Node to MyInterface  (hoping to return implementation ClassA under some other circumstances)
> when adapting Node to MyInterface, only AdapterFactoryA is ever used, even if it returns null for a particular Node.
> Expected:  If AdapterFactoryA returns null then any remaining AdapterFactories configured with that combination (in this case AdapterFactoryB) should be allowed the chance to adapt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SLING-2630) Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13484920#comment-13484920 ] 

Carsten Ziegeler commented on SLING-2630:
-----------------------------------------

Thanks for the patch, Will. Looks good to me, so I applied it.

And this also solves SLING-1960 :)
                
> Cannot have multiple Adapter Factories configured to have same adapter / adaptable combination
> ----------------------------------------------------------------------------------------------
>
>                 Key: SLING-2630
>                 URL: https://issues.apache.org/jira/browse/SLING-2630
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Adapter 2.0.16
>            Reporter: Will McGauley
>            Assignee: Carsten Ziegeler
>              Labels: AdapterManager
>             Fix For: Adapter 2.0.18
>
>         Attachments: SLING-2630.patch
>
>
> If you configure more than one AdapterFactory in the system which bears the same adapter / adaptable combinations only the AdapterFactory with the highest ranking is used.
> Example:
> ClassA extends MyInterface
> classB extends MyInterface
> AdapterFactoryA adapts Node to MyInterface  (hoping to return implementation ClassA under some circumstances)
> AdapterFactoryB adapts Node to MyInterface  (hoping to return implementation ClassA under some other circumstances)
> when adapting Node to MyInterface, only AdapterFactoryA is ever used, even if it returns null for a particular Node.
> Expected:  If AdapterFactoryA returns null then any remaining AdapterFactories configured with that combination (in this case AdapterFactoryB) should be allowed the chance to adapt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira