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.core.ivm;
17:
18: import javax.ejb.EJBHome;
19: import javax.ejb.EJBMetaData;
20: import javax.ejb.EJBObject;
21: import javax.ejb.Handle;
22: import javax.ejb.HomeHandle;
23:
24: import org.apache.openejb.ProxyInfo;
25:
26: public class IntraVmServer implements
27: org.apache.openejb.spi.ApplicationServer {
28:
29: public EJBMetaData getEJBMetaData(ProxyInfo pi) {
30: org.apache.openejb.DeploymentInfo di = pi.getDeploymentInfo();
31: IntraVmMetaData metaData = new IntraVmMetaData(di
32: .getHomeInterface(), di.getRemoteInterface(), di
33: .getComponentType());
34:
35: metaData.setEJBHome(getEJBHome(pi));
36: return metaData;
37: }
38:
39: public Handle getHandle(ProxyInfo pi) {
40: return new IntraVmHandle(getEJBObject(pi));
41: }
42:
43: public HomeHandle getHomeHandle(ProxyInfo pi) {
44: return new IntraVmHandle(getEJBHome(pi));
45: }
46:
47: public EJBObject getEJBObject(ProxyInfo pi) {
48: return (EJBObject) EjbObjectProxyHandler.createProxy(pi
49: .getDeploymentInfo(), pi.getPrimaryKey(), pi
50: .getInterfaceType(), pi.getInterfaces());
51: }
52:
53: public Object getBusinessObject(ProxyInfo pi) {
54: return EjbObjectProxyHandler.createProxy(
55: pi.getDeploymentInfo(), pi.getPrimaryKey(), pi
56: .getInterfaceType(), pi.getInterfaces());
57: }
58:
59: public EJBHome getEJBHome(ProxyInfo pi) {
60: return (EJBHome) EjbHomeProxyHandler.createHomeProxy(pi
61: .getDeploymentInfo(), pi.getInterfaceType());
62: }
63:
64: }
|