You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by "Mridul Muralidharan (JIRA)" <be...@incubator.apache.org> on 2005/04/08 18:27:16 UTC

[jira] Created: (BEEHIVE-508) Control id related issue

Control id related issue
------------------------

         Key: BEEHIVE-508
         URL: http://issues.apache.org/jira/browse/BEEHIVE-508
     Project: Beehive
        Type: Bug
  Components: Controls  
    Versions: V1, V1Alpha, V1Beta    
 Environment: Win2k , x86
    Reporter: Mridul Muralidharan
    Priority: Critical


This is my mail to the alias.
I will try to attach a testcase soon - but the idea of the bug is explained below.

--

Hi all,

 I am observing some problems with control id's that get returned by the ControlBean.getControlID().
I will try to explain what I am trying :

 I have a nested control within another control's impl like this :

@ControlImplementation
public class SomeControlAImpl implements SomeControlA , Serializable{

 @Control
 SomeControlB controlB;

 .... // proper initialization of SomeControlAImplClientInitializer is done.
}

Within SomeControlB , when I invoke "context.getControlHandle().getControlID();" - it gives the proper path based id "instance/controlB".
Now , when this gets serialized and then deserialized , a lookup on for this bean succeeds (using : container.getBean(controlId)) , but the getControlID() on this bean instance which is returned gives me the id as "controlB" not "instance/controlB".
Because of this , event firing using control handle , etc fails.

After some digging , I suspect that is it 'cos of what is mentioned in "ControlBean.setControlID" -> "// TODO: The ID change needs to be propagated down to nested children".

Is this the case ? or am I missing something else here ?
And if it is indeed the case , then is this going to be fixed for beehive 1.0 release ?


Thanks and Regards,
Mridul 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (BEEHIVE-508) Control id related issue

Posted by "Kyle Marvin (JIRA)" <be...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-508?page=history ]
     
Kyle Marvin closed BEEHIVE-508:
-------------------------------


Mridul has verified the fix in his local env, so closing the issue.

> Control id related issue
> ------------------------
>
>          Key: BEEHIVE-508
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-508
>      Project: Beehive
>         Type: Bug
>   Components: Controls
>     Versions: V1Alpha, V1Beta, V1
>  Environment: Win2k , x86
>     Reporter: Mridul Muralidharan
>     Assignee: Kyle Marvin
>     Priority: Critical
>      Fix For: V1

>
> This is my mail to the alias.
> I will try to attach a testcase soon - but the idea of the bug is explained below.
> --
> Hi all,
>  I am observing some problems with control id's that get returned by the ControlBean.getControlID().
> I will try to explain what I am trying :
>  I have a nested control within another control's impl like this :
> @ControlImplementation
> public class SomeControlAImpl implements SomeControlA , Serializable{
>  @Control
>  SomeControlB controlB;
>  .... // proper initialization of SomeControlAImplClientInitializer is done.
> }
> Within SomeControlB , when I invoke "context.getControlHandle().getControlID();" - it gives the proper path based id "instance/controlB".
> Now , when this gets serialized and then deserialized , a lookup on for this bean succeeds (using : container.getBean(controlId)) , but the getControlID() on this bean instance which is returned gives me the id as "controlB" not "instance/controlB".
> Because of this , event firing using control handle , etc fails.
> After some digging , I suspect that is it 'cos of what is mentioned in "ControlBean.setControlID" -> "// TODO: The ID change needs to be propagated down to nested children".
> Is this the case ? or am I missing something else here ?
> And if it is indeed the case , then is this going to be fixed for beehive 1.0 release ?
> Thanks and Regards,
> Mridul 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (BEEHIVE-508) Control id related issue

Posted by "Kyle Marvin (JIRA)" <be...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-508?page=comments#action_62670 ]
     
Kyle Marvin commented on BEEHIVE-508:
-------------------------------------

I've extended the 'composition' test that is part of the controls checkin test to add one that tests that controlIDs have expected values that line up w/ the composition relationship.  This includes a serialize/deserialize test, which repros the problem.

Working on the fix now...

> Control id related issue
> ------------------------
>
>          Key: BEEHIVE-508
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-508
>      Project: Beehive
>         Type: Bug
>   Components: Controls
>     Versions: V1, V1Alpha, V1Beta
>  Environment: Win2k , x86
>     Reporter: Mridul Muralidharan
>     Assignee: Kyle Marvin
>     Priority: Critical

>
> This is my mail to the alias.
> I will try to attach a testcase soon - but the idea of the bug is explained below.
> --
> Hi all,
>  I am observing some problems with control id's that get returned by the ControlBean.getControlID().
> I will try to explain what I am trying :
>  I have a nested control within another control's impl like this :
> @ControlImplementation
> public class SomeControlAImpl implements SomeControlA , Serializable{
>  @Control
>  SomeControlB controlB;
>  .... // proper initialization of SomeControlAImplClientInitializer is done.
> }
> Within SomeControlB , when I invoke "context.getControlHandle().getControlID();" - it gives the proper path based id "instance/controlB".
> Now , when this gets serialized and then deserialized , a lookup on for this bean succeeds (using : container.getBean(controlId)) , but the getControlID() on this bean instance which is returned gives me the id as "controlB" not "instance/controlB".
> Because of this , event firing using control handle , etc fails.
> After some digging , I suspect that is it 'cos of what is mentioned in "ControlBean.setControlID" -> "// TODO: The ID change needs to be propagated down to nested children".
> Is this the case ? or am I missing something else here ?
> And if it is indeed the case , then is this going to be fixed for beehive 1.0 release ?
> Thanks and Regards,
> Mridul 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (BEEHIVE-508) Control id related issue

Posted by "Kyle Marvin (JIRA)" <be...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-508?page=history ]
     
Kyle Marvin resolved BEEHIVE-508:
---------------------------------

     Resolution: Fixed
    Fix Version: V1

This is resolved by svn revision 161092.  Mridul, I ended up taking a slightly different path than the proposed patch, but appreciate the effort you put into identifying and analyzing the problem.   In the end, it seemed easier to guarantee maintainability, consistency, and efficiency to manage the composite control ID values in one place (the context) instead of spreading responsibility between the bean and the context.  Individual beans are responsible for knowing only their context-relative ID.

> Control id related issue
> ------------------------
>
>          Key: BEEHIVE-508
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-508
>      Project: Beehive
>         Type: Bug
>   Components: Controls
>     Versions: V1Alpha, V1Beta, V1
>  Environment: Win2k , x86
>     Reporter: Mridul Muralidharan
>     Assignee: Kyle Marvin
>     Priority: Critical
>      Fix For: V1

>
> This is my mail to the alias.
> I will try to attach a testcase soon - but the idea of the bug is explained below.
> --
> Hi all,
>  I am observing some problems with control id's that get returned by the ControlBean.getControlID().
> I will try to explain what I am trying :
>  I have a nested control within another control's impl like this :
> @ControlImplementation
> public class SomeControlAImpl implements SomeControlA , Serializable{
>  @Control
>  SomeControlB controlB;
>  .... // proper initialization of SomeControlAImplClientInitializer is done.
> }
> Within SomeControlB , when I invoke "context.getControlHandle().getControlID();" - it gives the proper path based id "instance/controlB".
> Now , when this gets serialized and then deserialized , a lookup on for this bean succeeds (using : container.getBean(controlId)) , but the getControlID() on this bean instance which is returned gives me the id as "controlB" not "instance/controlB".
> Because of this , event firing using control handle , etc fails.
> After some digging , I suspect that is it 'cos of what is mentioned in "ControlBean.setControlID" -> "// TODO: The ID change needs to be propagated down to nested children".
> Is this the case ? or am I missing something else here ?
> And if it is indeed the case , then is this going to be fixed for beehive 1.0 release ?
> Thanks and Regards,
> Mridul 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (BEEHIVE-508) Control id related issue

Posted by "Kyle Marvin (JIRA)" <be...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-508?page=history ]

Kyle Marvin reassigned BEEHIVE-508:
-----------------------------------

    Assign To: Kyle Marvin

> Control id related issue
> ------------------------
>
>          Key: BEEHIVE-508
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-508
>      Project: Beehive
>         Type: Bug
>   Components: Controls
>     Versions: V1, V1Alpha, V1Beta
>  Environment: Win2k , x86
>     Reporter: Mridul Muralidharan
>     Assignee: Kyle Marvin
>     Priority: Critical

>
> This is my mail to the alias.
> I will try to attach a testcase soon - but the idea of the bug is explained below.
> --
> Hi all,
>  I am observing some problems with control id's that get returned by the ControlBean.getControlID().
> I will try to explain what I am trying :
>  I have a nested control within another control's impl like this :
> @ControlImplementation
> public class SomeControlAImpl implements SomeControlA , Serializable{
>  @Control
>  SomeControlB controlB;
>  .... // proper initialization of SomeControlAImplClientInitializer is done.
> }
> Within SomeControlB , when I invoke "context.getControlHandle().getControlID();" - it gives the proper path based id "instance/controlB".
> Now , when this gets serialized and then deserialized , a lookup on for this bean succeeds (using : container.getBean(controlId)) , but the getControlID() on this bean instance which is returned gives me the id as "controlB" not "instance/controlB".
> Because of this , event firing using control handle , etc fails.
> After some digging , I suspect that is it 'cos of what is mentioned in "ControlBean.setControlID" -> "// TODO: The ID change needs to be propagated down to nested children".
> Is this the case ? or am I missing something else here ?
> And if it is indeed the case , then is this going to be fixed for beehive 1.0 release ?
> Thanks and Regards,
> Mridul 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (BEEHIVE-508) Control id related issue

Posted by "Mridul Muralidharan (JIRA)" <be...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/BEEHIVE-508?page=comments#action_62468 ]
     
Mridul Muralidharan commented on BEEHIVE-508:
---------------------------------------------

This is the diff from the fix that I did locally - it passed all the drt tests and worked to fix my issue too.
This a hack at best - so please use with care.

-- Start diff
Index: src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
===================================================================
--- src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java	(revision 160583)
+++ src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java	(working copy)
@@ -615,6 +615,14 @@
         _id = id;
 
         // TODO: The ID change needs to be propagated down to nested children
+         if (!settingControlId){
+             settingControlId = true;
+             try{
+                 getControlBeanContext().setControlID(id);
+             }finally{
+                 settingControlId = false;
+             }
+         }
     }
 
     /**
@@ -1053,6 +1061,8 @@
      */
     private Class _controlIntf;
 
+    private boolean settingControlId = false;
+
     /**
      * This field manages the register listener list(s) associated with event set interfaces
      * for the ControlBean.  The value objects are either UnicastEventNotifier or EventNotifier
Index: src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
===================================================================
--- src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java	(revision 160583)
+++ src/runtime/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java	(working copy)
@@ -203,6 +203,27 @@
         }
     }
 
+     public void setControlID(String id){
+
+         if (null == id || id.length() == 0){
+             return;
+         }
+
+         if (ControlBean.IDSeparator != id.charAt(id.length() - 1)){
+            id = id + ControlBean.IDSeparator;
+         }
+         Iterator<Object> iter = _childMap.values().iterator();
+         while (iter.hasNext()){
+             Object val = iter.next();
+             if (val instanceof ControlBean){
+                 ControlBean cb = (ControlBean)val;
+                 cb.setControlID(id + cb.getLocalID()
+                     //cb.getControlID()
+                     );
+             }
+         }
+     }
+
     /**
      * The NameGenerator class is a simple helper class that creates new unique names based
      * upon a base prefix and an incrementing counter
-- End diff

Not sure whether to go with "cb.getLocalID()" or with "cb.getControlID()" in ControlBeanContext.setControlID().

Thanks
Mridul

> Control id related issue
> ------------------------
>
>          Key: BEEHIVE-508
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-508
>      Project: Beehive
>         Type: Bug
>   Components: Controls
>     Versions: V1, V1Alpha, V1Beta
>  Environment: Win2k , x86
>     Reporter: Mridul Muralidharan
>     Assignee: Kyle Marvin
>     Priority: Critical

>
> This is my mail to the alias.
> I will try to attach a testcase soon - but the idea of the bug is explained below.
> --
> Hi all,
>  I am observing some problems with control id's that get returned by the ControlBean.getControlID().
> I will try to explain what I am trying :
>  I have a nested control within another control's impl like this :
> @ControlImplementation
> public class SomeControlAImpl implements SomeControlA , Serializable{
>  @Control
>  SomeControlB controlB;
>  .... // proper initialization of SomeControlAImplClientInitializer is done.
> }
> Within SomeControlB , when I invoke "context.getControlHandle().getControlID();" - it gives the proper path based id "instance/controlB".
> Now , when this gets serialized and then deserialized , a lookup on for this bean succeeds (using : container.getBean(controlId)) , but the getControlID() on this bean instance which is returned gives me the id as "controlB" not "instance/controlB".
> Because of this , event firing using control handle , etc fails.
> After some digging , I suspect that is it 'cos of what is mentioned in "ControlBean.setControlID" -> "// TODO: The ID change needs to be propagated down to nested children".
> Is this the case ? or am I missing something else here ?
> And if it is indeed the case , then is this going to be fixed for beehive 1.0 release ?
> Thanks and Regards,
> Mridul 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira