01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.client;
17:
18: import java.lang.reflect.Method;
19: import java.rmi.RemoteException;
20:
21: public class StatelessEJBObjectHandler extends EJBObjectHandler {
22:
23: public Object registryId;
24:
25: public StatelessEJBObjectHandler() {
26: }
27:
28: public StatelessEJBObjectHandler(EJBMetaDataImpl ejb,
29: ServerMetaData server, ClientMetaData client) {
30: super (ejb, server, client);
31: }
32:
33: public StatelessEJBObjectHandler(EJBMetaDataImpl ejb,
34: ServerMetaData server, ClientMetaData client,
35: Object primaryKey) {
36: super (ejb, server, client, primaryKey);
37: }
38:
39: public static Object createRegistryId(Object primKey,
40: Object deployId, String containerID) {
41: return "" + deployId + containerID;
42: }
43:
44: public Object getRegistryId() {
45: return this .ejb.deploymentID;
46: }
47:
48: protected Object getPrimaryKey(Method method, Object[] args,
49: Object proxy) throws Throwable {
50: throw new RemoteException(
51: "Session objects are private resources and do not have primary keys");
52: }
53:
54: protected Object isIdentical(Method method, Object[] args,
55: Object proxy) throws Throwable {
56:
57: Object arg = (args.length == 1) ? args[0] : null;
58:
59: if (arg == null || !(arg instanceof EJBObjectProxy))
60: return Boolean.FALSE;
61: EJBObjectProxy proxy2 = (EJBObjectProxy) arg;
62: EJBObjectHandler that = proxy2.getEJBObjectHandler();
63: return this .ejb.deploymentID.equals(that.ejb.deploymentID);
64: }
65:
66: protected Object equals(Method method, Object[] args, Object proxy)
67: throws Throwable {
68: return isIdentical(method, args, proxy);
69: }
70:
71: protected void invalidateReference() {
72: }
73:
74: protected Object remove(Method method, Object[] args, Object proxy)
75: throws Throwable {
76: // you can't really remove a stateless handle
77: return null;
78: }
79:
80: }
|