org.objectweb.easybeans.tests.enhancer.interceptors.business.bean
Class StatelessBean

java.lang.Object
  extended by org.objectweb.easybeans.tests.enhancer.interceptors.business.bean.StatelessBean
All Implemented Interfaces:
StatelessLocalBisItf, StatelessLocalItf, StatelessRemoteItf

public class StatelessBean
extends java.lang.Object
implements StatelessRemoteItf, StatelessLocalItf, StatelessLocalBisItf

Simple class for testing interceptors.

Author:
Florent Benoit

Field Summary
private  int counter
          Counter of intercepted methods.
private  int otherInterceptorCounter
          Counter of intercepted methods by an external interceptor.
private  int singleMethodInterceptedCounter
          Counter of intercepted calls on singleMethodIntercepted.
 
Constructor Summary
StatelessBean()
           
 
Method Summary
 int addInt(int i, int j)
          Adds two int.
 void excludedInterceptorsMethod()
          Test that no interceptors are called on this method.
 boolean getBoolean(boolean b)
          Test method on boolean.
 boolean[] getBooleans(boolean[] booleans)
          Test method on boolean.
 byte getByte(byte i)
          Test method on byte.
 byte[] getBytes(byte[] bytes)
          Test method on byte.
 char getChar(char c)
          Test method on char.
 char[] getChars(char[] chars)
          Test method on char.
 int getCounter()
           
 double getDouble(double d)
          Test method on double.
 double[] getDoubles(double[] doubles)
          Test method on double.
 float getFloat(float f)
          Test method on float.
 float[] getFloats(float[] floats)
          Test method on float.
 int getIncrementSingleMethodInterceptedCounter()
           
 int getInt(int i)
          Test method on int.
 int[] getInts(int[] ints)
          Test method on int.
 long getLong(long l)
          Test method on long.
 long[] getLongs(long[] longs)
          Test method on long.
 int getOtherInterceptorCounter()
           
 java.lang.Object[] getPrimitive(boolean flag, byte b, char c, double d, float f, int i, long l, java.lang.Object o)
          Test method on primitive.
 short getShort(short s)
          Test method on short.
 short[] getShorts(short[] shorts)
          Test method on short.
 void incrementOtherInterceptorCounter()
          Increment the value of the counter used by other interceptors.
 void incrementSingleMethodInterceptedCounter()
          Increment the value of the counter used by single method interceptor.
 java.lang.Object intercepted(javax.ejb.InvocationContext invocationContext)
          Do some stuff while intercepting methods.
 void methodNotInAllInterface()
          -----------------------------------------.
 void singleMethodIntercepted()
          Test interceptor which is applied only on a single method.
 void someCustomizedExceptions()
          Throws a user defined exception.
 void someCustomizedExceptions2(int value)
          Throws user defined exceptions.
 void someCustomizedExceptions3(int value)
          Throws user defined exceptions.
 void throwExceptionByInterceptor()
          Method do nothing but the interceptor will throw an exception.
 int valueDoubledByInterceptor(int i)
          Change the return value by the interceptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

counter

private int counter
Counter of intercepted methods.


otherInterceptorCounter

private int otherInterceptorCounter
Counter of intercepted methods by an external interceptor.


singleMethodInterceptedCounter

private int singleMethodInterceptedCounter
Counter of intercepted calls on singleMethodIntercepted.

Constructor Detail

StatelessBean

public StatelessBean()
Method Detail

getBoolean

public boolean getBoolean(boolean b)
Test method on boolean.

Specified by:
getBoolean in interface StatelessLocalItf
Parameters:
b - value to return
Returns:
given value

getBooleans

public boolean[] getBooleans(boolean[] booleans)
Test method on boolean.

Specified by:
getBooleans in interface StatelessLocalItf
Parameters:
booleans - array to return
Returns:
given value

getByte

public byte getByte(byte i)
Test method on byte.

Specified by:
getByte in interface StatelessLocalItf
Parameters:
i - value to return
Returns:
given value

getBytes

public byte[] getBytes(byte[] bytes)
Test method on byte.

Specified by:
getBytes in interface StatelessLocalItf
Parameters:
bytes - array to return
Returns:
given value

getChar

public char getChar(char c)
Test method on char.

Specified by:
getChar in interface StatelessLocalItf
Parameters:
c - value to return
Returns:
given value

getChars

public char[] getChars(char[] chars)
Test method on char.

Specified by:
getChars in interface StatelessLocalItf
Parameters:
chars - array to return
Returns:
given value

getDouble

public double getDouble(double d)
Test method on double.

Specified by:
getDouble in interface StatelessLocalItf
Parameters:
d - value to return
Returns:
given value

getDoubles

public double[] getDoubles(double[] doubles)
Test method on double.

Specified by:
getDoubles in interface StatelessLocalItf
Parameters:
doubles - array to return
Returns:
given value

getFloat

public float getFloat(float f)
Test method on float.

Specified by:
getFloat in interface StatelessLocalItf
Parameters:
f - value to return
Returns:
given value

getFloats

public float[] getFloats(float[] floats)
Test method on float.

Specified by:
getFloats in interface StatelessLocalItf
Parameters:
floats - array to return
Returns:
given value

getInt

public int getInt(int i)
Test method on int.

Specified by:
getInt in interface StatelessLocalItf
Parameters:
i - value to return
Returns:
given value

addInt

public int addInt(int i,
                  int j)
Adds two int.

Specified by:
addInt in interface StatelessLocalItf
Parameters:
i - first value
j - second value
Returns:
given value

getInts

public int[] getInts(int[] ints)
Test method on int.

Specified by:
getInts in interface StatelessLocalItf
Parameters:
ints - array to return
Returns:
given value

getLong

public long getLong(long l)
Test method on long.

Specified by:
getLong in interface StatelessLocalItf
Parameters:
l - value to return
Returns:
given value

getLongs

public long[] getLongs(long[] longs)
Test method on long.

Specified by:
getLongs in interface StatelessLocalItf
Parameters:
longs - array to return
Returns:
given value

getShort

public short getShort(short s)
Test method on short.

Specified by:
getShort in interface StatelessLocalItf
Parameters:
s - value to return
Returns:
given value

getShorts

public short[] getShorts(short[] shorts)
Test method on short.

Specified by:
getShorts in interface StatelessLocalItf
Parameters:
shorts - array to return
Returns:
given value

getPrimitive

public java.lang.Object[] getPrimitive(boolean flag,
                                       byte b,
                                       char c,
                                       double d,
                                       float f,
                                       int i,
                                       long l,
                                       java.lang.Object o)
Test method on primitive.

Specified by:
getPrimitive in interface StatelessLocalItf
Parameters:
flag - value to return
b - value to return
c - value to return
d - value to return
f - value to return
i - value to return
l - value to return
o - value to return
Returns:
given values

methodNotInAllInterface

public void methodNotInAllInterface()
-----------------------------------------. - Method from another interface --- -----------------------------------------

Specified by:
methodNotInAllInterface in interface StatelessLocalBisItf

someCustomizedExceptions

public void someCustomizedExceptions()
                              throws TestException
Throws a user defined exception.

Specified by:
someCustomizedExceptions in interface StatelessLocalItf
Throws:
TestException - an user defined exception

someCustomizedExceptions2

public void someCustomizedExceptions2(int value)
                               throws TestException,
                                      TestException2
Throws user defined exceptions.

Specified by:
someCustomizedExceptions2 in interface StatelessLocalItf
Parameters:
value - depending of the value, throw different exceptions.
Throws:
TestException - an user defined exception
TestException2 - another user defined exception

someCustomizedExceptions3

public void someCustomizedExceptions3(int value)
                               throws java.lang.Exception
Throws user defined exceptions.

Specified by:
someCustomizedExceptions3 in interface StatelessLocalItf
Parameters:
value - depending of the value, throw different exceptions
Throws:
java.lang.Exception - another exception

throwExceptionByInterceptor

public void throwExceptionByInterceptor()
Method do nothing but the interceptor will throw an exception.

Specified by:
throwExceptionByInterceptor in interface StatelessLocalItf

valueDoubledByInterceptor

public int valueDoubledByInterceptor(int i)
Change the return value by the interceptor.

Specified by:
valueDoubledByInterceptor in interface StatelessLocalItf
Parameters:
i - value to be add twice.
Returns:
a value (mult * 2) of the given value

intercepted

public java.lang.Object intercepted(javax.ejb.InvocationContext invocationContext)
                             throws java.lang.Exception
Do some stuff while intercepting methods.

Parameters:
invocationContext - contains attributes of invocation
Returns:
method's invocation result
Throws:
java.lang.Exception - if invocation fails

getCounter

public int getCounter()
Returns:
the counter (should be incremented by interceptor)

getOtherInterceptorCounter

public int getOtherInterceptorCounter()
Returns:
a counter used by other interceptors.

incrementOtherInterceptorCounter

public void incrementOtherInterceptorCounter()
Increment the value of the counter used by other interceptors.


singleMethodIntercepted

public void singleMethodIntercepted()
Test interceptor which is applied only on a single method.

Specified by:
singleMethodIntercepted in interface StatelessLocalItf

incrementSingleMethodInterceptedCounter

public void incrementSingleMethodInterceptedCounter()
Increment the value of the counter used by single method interceptor.


getIncrementSingleMethodInterceptedCounter

public int getIncrementSingleMethodInterceptedCounter()
Returns:
the value of the counter used by single method interceptor.

excludedInterceptorsMethod

public void excludedInterceptorsMethod()
Test that no interceptors are called on this method.

Specified by:
excludedInterceptorsMethod in interface StatelessLocalItf