1 22 package org.jboss.test.iiop.ejb; 23 24 import javax.ejb.EJBException ; 25 26 import org.jboss.test.util.ejb.SessionSupport; 27 import org.jboss.test.iiop.interfaces.Boo; 28 import org.jboss.test.iiop.interfaces.Foo; 29 import org.jboss.test.iiop.interfaces.IdlInterface; 30 import org.jboss.test.iiop.interfaces.NegativeArgumentException; 31 import org.jboss.test.iiop.interfaces.StatelessSession; 32 import org.jboss.test.iiop.interfaces.Zoo; 33 import org.jboss.test.iiop.util.Util; 34 35 39 public class StatelessSessionBean 40 extends SessionSupport 41 { 42 public String getString() 43 { 44 return Util.STRING; 45 } 46 47 public String testPrimitiveTypes(boolean flag, char c, byte b, 48 short s, int i, long l, float f, double d) 49 { 50 return Util.primitiveTypesToString(flag, c, b, s, i, l, f, d); 51 } 52 53 public String testString(String s) 54 { 55 return Util.echo(s); 56 } 57 58 public StatelessSession testStatelessSession(String s, StatelessSession t) 59 { 60 return t; 61 } 62 63 public java.rmi.Remote testRemote(String s, java.rmi.Remote t) 64 { 65 return t; 66 } 67 68 public Foo testSerializable(Foo foo) 69 { 70 return Util.echoFoo(foo); 71 } 72 73 public int[] testIntArray(int[] a) 74 { 75 for (int i = 0; i < a.length; i++) 76 a[i]++; 77 return a; 78 } 79 80 public Foo[] testValueArray(Foo[] a) 81 { 82 for (int i = 0; i < a.length; i++) 83 a[i] = Util.echoFoo(a[i]); 84 return a; 85 } 86 87 public String testException(int i) 88 throws NegativeArgumentException 89 { 90 if (i >= 0) 91 return "#" + i; 92 else 93 throw new NegativeArgumentException(i); 94 } 95 96 public Object fooValueToObject(Foo foo) 97 { 98 return Util.echoFoo(foo); 99 } 100 101 public Object booValueToObject(Boo boo) 102 { 103 return Util.echoBoo(boo); 104 } 105 106 public java.util.Vector valueArrayToVector(Foo[] a) 107 { 108 java.util.Vector v = new java.util.Vector (); 109 110 for (int i = 0; i < a.length; i++) 111 v.add(Util.echoFoo(a[i])); 112 return v; 113 } 114 115 public Foo[] vectorToValueArray(java.util.Vector v) 116 { 117 Foo a[] = new Foo[v.size()]; 118 119 for (int i = 0; i < a.length; i++) 120 a[i] = Util.echoFoo((Foo)v.elementAt(i)); 121 return a; 122 } 123 124 public Object getException() 125 { 126 Object obj = null; 127 try 128 { 129 NegativeArgumentException e = new NegativeArgumentException(-7777); 130 throw e; 131 } 132 catch (NegativeArgumentException e) 133 { 134 obj = e; 135 } 136 return obj; 137 } 138 139 public Object getZooValue() 140 { 141 return new Zoo("outer_zoo", 142 "returned by getZooValue", 143 new Zoo("inner_zoo", "inner")); 144 } 145 146 public Object [] testReferenceSharingWithinArray(Object [] a) 147 { 148 int n = a.length; 149 Object [] b = new Object [2 * n]; 150 for (int i = 0; i < n; i++) 151 b[i + n] = b[i] = a[i]; 152 return b; 153 } 154 155 public java.util.Collection testReferenceSharingWithinCollection( 156 java.util.Collection cin) 157 { 158 java.util.Collection cout = new java.util.ArrayList (cin); 159 java.util.Iterator i = cin.iterator(); 160 while (i.hasNext()) 161 cout.add(i.next()); 162 return cout; 163 } 164 165 public org.omg.CORBA.Object testCorbaObject(org.omg.CORBA.Object obj) 166 { 167 return obj; 168 } 169 170 public IdlInterface testIdlInterface(IdlInterface ref) 171 { 172 return ref; 173 } 174 175 } 176 | Popular Tags |