[jira] Commented: (OWB-435) What is the expected result for following 2 decorators?

2010-08-16 Thread Joe Bergmark (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12899050#action_12899050
 ] 

Joe Bergmark commented on OWB-435:
--

Had a chance to dig into #1 today and there does appear to be a bug here.  At 
least in my testing, the call to 
ownerCreationalContext.getDependentDecorator(decorator); always returns null, 
so we end up creating a new Decorator instance each time another method is 
called on the longer lived class.  I'll go ahead and open a JIRA issue for this 
and try to determine why that is the case.

 What is the expected result for following 2 decorators?
 ---

 Key: OWB-435
 URL: https://issues.apache.org/jira/browse/OWB-435
 Project: OpenWebBeans
  Issue Type: Question
  Components: Interceptor and Decorators
Reporter: YING WANG
Assignee: Gurkan Erdogdu
Priority: Minor

 While I am testing 2 decorators decorate the same getName() method of 
 UserBean, I found the result is:
 1. UserDecorator1(UserDecorator2(MYNAME))==  Did call 
 UserDecorator1.getName() first, but before it finishes, it recursively 
 invokes the UserDecorator2.getName() on the calling stack.
 2. or  should the result be:
 UserDecorator2(MYNAME)   should decorator2's result overwrite 
 decorator1's?
 3. or should the result be:
 UserDecorator2(UserDecorator1(MYNAME))  should decorator1's result 
 to the one used for decorator2?
 I prefer 3, but I am not sure which result is the correct one
 ===Userbean 
 public class UserBean implements UserInterface, Serializable 
 {
 public String getName()
 {
   return MYNAME;
 }
 }
 ===UserDecorator1 
 @Decorator
 public abstract class UserDecorator1 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator1( + ui.getName() + );
   }
 }
 ===UserDecorator2 
 @Decorator
 public abstract class UserDecorator2 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator2( + ui.getName() + );
   }
 }
 
 decorators
 classcom.jcdi.test.UserDecorator1/class
 classcom.jcdi.test.UserDecorator2/class
 /decorators

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OWB-435) What is the expected result for following 2 decorators?

2010-08-12 Thread YING WANG (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12897944#action_12897944
 ] 

YING WANG commented on OWB-435:
---

I know we did not break the spec ;)   But If I am a user who is not majored in 
computer science and bought 2 decorators from third parties to improve my 
current function X(),d1(X())  and  d2(X()),  I would expect if I add d1 
then d2 in the decorator list, the result should be something like d2(d1(X())). 
 I know if I change order in the beans.xml for the above test case, I could 
workaround and get the result I want. 

But for more complicated processing, changing order will not work. So are we 
saying users will never be able to get d2(d1(X())) result if they want  d1(X()) 
 and  d2(X()) work together?  

Just a few thoughts for fun ;))

 What is the expected result for following 2 decorators?
 ---

 Key: OWB-435
 URL: https://issues.apache.org/jira/browse/OWB-435
 Project: OpenWebBeans
  Issue Type: Question
  Components: Interceptor and Decorators
Reporter: YING WANG
Assignee: Gurkan Erdogdu
Priority: Minor

 While I am testing 2 decorators decorate the same getName() method of 
 UserBean, I found the result is:
 1. UserDecorator1(UserDecorator2(MYNAME))==  Did call 
 UserDecorator1.getName() first, but before it finishes, it recursively 
 invokes the UserDecorator2.getName() on the calling stack.
 2. or  should the result be:
 UserDecorator2(MYNAME)   should decorator2's result overwrite 
 decorator1's?
 3. or should the result be:
 UserDecorator2(UserDecorator1(MYNAME))  should decorator1's result 
 to the one used for decorator2?
 I prefer 3, but I am not sure which result is the correct one
 ===Userbean 
 public class UserBean implements UserInterface, Serializable 
 {
 public String getName()
 {
   return MYNAME;
 }
 }
 ===UserDecorator1 
 @Decorator
 public abstract class UserDecorator1 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator1( + ui.getName() + );
   }
 }
 ===UserDecorator2 
 @Decorator
 public abstract class UserDecorator2 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator2( + ui.getName() + );
   }
 }
 
 decorators
 classcom.jcdi.test.UserDecorator1/class
 classcom.jcdi.test.UserDecorator2/class
 /decorators

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OWB-435) What is the expected result for following 2 decorators?

2010-08-12 Thread YING WANG (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12898037#action_12898037
 ] 

YING WANG commented on OWB-435:
---

Two more questions, 

1. My UserBean is a session scope bean and my decorator has a counter to record 
times of invocations. However, the count is always 1. It seems a new 
UserDecorator1 will be created for each request.

2. Actually a new UserDecorator1 will be created whenever a UserBean's method 
is invoked, even though the method is not defined in the decorator, could we 
improve this?

@Decorator
public abstract class UserDecorator1 implements UserInterface, Serializable 
{
int count;

@Inject @Delegate @Any UserInterface ui;

public UserDecorator1() {
count = 0;
}

public String getName() {
count++;
return UserDecorator1( + ui.getName() + ). + count;
}
}


 What is the expected result for following 2 decorators?
 ---

 Key: OWB-435
 URL: https://issues.apache.org/jira/browse/OWB-435
 Project: OpenWebBeans
  Issue Type: Question
  Components: Interceptor and Decorators
Reporter: YING WANG
Assignee: Gurkan Erdogdu
Priority: Minor

 While I am testing 2 decorators decorate the same getName() method of 
 UserBean, I found the result is:
 1. UserDecorator1(UserDecorator2(MYNAME))==  Did call 
 UserDecorator1.getName() first, but before it finishes, it recursively 
 invokes the UserDecorator2.getName() on the calling stack.
 2. or  should the result be:
 UserDecorator2(MYNAME)   should decorator2's result overwrite 
 decorator1's?
 3. or should the result be:
 UserDecorator2(UserDecorator1(MYNAME))  should decorator1's result 
 to the one used for decorator2?
 I prefer 3, but I am not sure which result is the correct one
 ===Userbean 
 public class UserBean implements UserInterface, Serializable 
 {
 public String getName()
 {
   return MYNAME;
 }
 }
 ===UserDecorator1 
 @Decorator
 public abstract class UserDecorator1 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator1( + ui.getName() + );
   }
 }
 ===UserDecorator2 
 @Decorator
 public abstract class UserDecorator2 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator2( + ui.getName() + );
   }
 }
 
 decorators
 classcom.jcdi.test.UserDecorator1/class
 classcom.jcdi.test.UserDecorator2/class
 /decorators

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OWB-435) What is the expected result for following 2 decorators?

2010-08-12 Thread Eric Covener (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12898041#action_12898041
 ] 

Eric Covener commented on OWB-435:
--

#1 seems like very wrong behavior

 What is the expected result for following 2 decorators?
 ---

 Key: OWB-435
 URL: https://issues.apache.org/jira/browse/OWB-435
 Project: OpenWebBeans
  Issue Type: Question
  Components: Interceptor and Decorators
Reporter: YING WANG
Assignee: Gurkan Erdogdu
Priority: Minor

 While I am testing 2 decorators decorate the same getName() method of 
 UserBean, I found the result is:
 1. UserDecorator1(UserDecorator2(MYNAME))==  Did call 
 UserDecorator1.getName() first, but before it finishes, it recursively 
 invokes the UserDecorator2.getName() on the calling stack.
 2. or  should the result be:
 UserDecorator2(MYNAME)   should decorator2's result overwrite 
 decorator1's?
 3. or should the result be:
 UserDecorator2(UserDecorator1(MYNAME))  should decorator1's result 
 to the one used for decorator2?
 I prefer 3, but I am not sure which result is the correct one
 ===Userbean 
 public class UserBean implements UserInterface, Serializable 
 {
 public String getName()
 {
   return MYNAME;
 }
 }
 ===UserDecorator1 
 @Decorator
 public abstract class UserDecorator1 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator1( + ui.getName() + );
   }
 }
 ===UserDecorator2 
 @Decorator
 public abstract class UserDecorator2 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator2( + ui.getName() + );
   }
 }
 
 decorators
 classcom.jcdi.test.UserDecorator1/class
 classcom.jcdi.test.UserDecorator2/class
 /decorators

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OWB-435) What is the expected result for following 2 decorators?

2010-08-12 Thread Joe Bergmark (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12898074#action_12898074
 ] 

Joe Bergmark commented on OWB-435:
--

I agree that #1 sounds like a bug.  I'll try and take a look at it

#2 is probably just the way it has to work.  You can't know when the dependent 
Decorators are built up what method is going to be called. Even if you could, 
you don't know if another Decorator in the stack might have changed the method 
to one that later Decorator could have been involved with.

 What is the expected result for following 2 decorators?
 ---

 Key: OWB-435
 URL: https://issues.apache.org/jira/browse/OWB-435
 Project: OpenWebBeans
  Issue Type: Question
  Components: Interceptor and Decorators
Reporter: YING WANG
Assignee: Gurkan Erdogdu
Priority: Minor

 While I am testing 2 decorators decorate the same getName() method of 
 UserBean, I found the result is:
 1. UserDecorator1(UserDecorator2(MYNAME))==  Did call 
 UserDecorator1.getName() first, but before it finishes, it recursively 
 invokes the UserDecorator2.getName() on the calling stack.
 2. or  should the result be:
 UserDecorator2(MYNAME)   should decorator2's result overwrite 
 decorator1's?
 3. or should the result be:
 UserDecorator2(UserDecorator1(MYNAME))  should decorator1's result 
 to the one used for decorator2?
 I prefer 3, but I am not sure which result is the correct one
 ===Userbean 
 public class UserBean implements UserInterface, Serializable 
 {
 public String getName()
 {
   return MYNAME;
 }
 }
 ===UserDecorator1 
 @Decorator
 public abstract class UserDecorator1 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator1( + ui.getName() + );
   }
 }
 ===UserDecorator2 
 @Decorator
 public abstract class UserDecorator2 implements UserInterface, Serializable 
 {
   @Inject @Delegate @Any UserInterface ui;
   
   public String getName() {
   return UserDecorator2( + ui.getName() + );
   }
 }
 
 decorators
 classcom.jcdi.test.UserDecorator1/class
 classcom.jcdi.test.UserDecorator2/class
 /decorators

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.