You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by neykov <gi...@git.apache.org> on 2014/10/27 17:18:17 UTC

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

GitHub user neykov opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/274

    Fix rebinding to entities/policies living in OSGi bundles

    When an entity/policy is created from a catalog item we make a note of its related catalog item id. On rebind we use that information to get the class loading context from the corresponding catalog item so that classes from OSGi bundles referenced in the item config are accessible.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/neykov/incubator-brooklyn rebind-osgi

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/274.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #274
    
----
commit 2ca898ad1806b066fc7f9d4f97917ac5b5d5d304
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2014-10-27T16:16:55Z

    Fix rebinding to entities/policies living in OSGi bundles
    
    When an entity/policy is created from a catalog item we make a note of its related catalog item id. On rebind we use that information to get the class loading context from the corresponding catalog item so that classes from OSGi bundles referenced in the item config are accessible.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/274#issuecomment-60794665
  
    still have deserialization problem across entity boundaries.  options for solutions:
    
    1) read ancestor tags to get catalog item id
    2) try to set CatalogItemId explicitly on BrooklynObjectSpec + BO
    3) use a custom classloader with the CatalogItemId, serialize it near root of XML
    4) lookup and serialize bundle information
    
    1 is quick, we think 3 deserves a spike to see if it works.
    
    there is also a problem that the driver is not instantiated using the right classloader after deserialization


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/274#issuecomment-61256318
  
    The commits so far implement the following precedence of setting the catalog item ID:
     1. The user can always set/override the inferred catalog item id on specs.
     2. Creating from a catalog item - all items resolved during the creation of a spec from a catalog item receive the catalog item's ID as context.
     3. When using the Java API for creating specs get the catalog item ID from the context entity of the Tasks.current() task.
     4. Propagate the context catalog item ID to children, adjuncts if they don't have one already.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/274#issuecomment-60957516
  
    I've implemented option 1 from @ahgittin's comment and moved from using tags to an explicit property on the BOSpecs, BOs and Mementos.
    
    There are a couple of options I'd still like to explore before giving up on the classloader idea - creating an empty OSGi bundle for each catalog item and using it to resolve classes, investigate the composite bundles proposal.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/274#issuecomment-61256035
  
    re my last comment - The only way a classloader approach can work is if we introduce a 1:1 relationship between a catalog item and (a set of) classloader(s). This would mean that for each catalog item we load it's classes separately from the other catalog items' classes (with the exception of brooklyn provided classes). This will limit code loaded from different catalog items interoperating only through brooklyn provided APIs.
    This is not a behaviour we want at the moment so the approach taken in this PR is items 1+2 from @ahgittin's comment above.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/274#issuecomment-61271831
  
    sounds good
    
    could we (do we?) warn if 1+2 in your list not set, and there is a disagreement between 3+4 ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/274#issuecomment-61470728
  
    first draft of tests in last commit at https://github.com/ahgittin/incubator-brooklyn/commits/misc2 (the few others prior are the clean up)
    
    more tests to write (including some CAMP ones) but wanted to share these in case there are comments about the approach
    
    note they will need revisiting as #92 advances but should help with testing that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/274#issuecomment-61457413
  
    the warning is rather tedious to set, i think not worth it at this stage.  looks really good. i've done some minor code tweaks and am working on some tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix rebinding to entities/policie...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/274


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---