KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > interop > rmi > iiop > server > RmiIiopServerGBean


1 /**
2  *
3  * Copyright 2004-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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  *
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.geronimo.interop.rmi.iiop.server;
19
20 import java.net.Socket JavaDoc;
21 import java.util.ArrayList JavaDoc;
22 import java.util.Properties JavaDoc;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26 import org.apache.geronimo.gbean.GBeanInfo;
27 import org.apache.geronimo.gbean.GBeanInfoBuilder;
28 import org.apache.geronimo.interop.adapter.AdapterManager;
29
30 //public class RmiIiopServerGBean implements ServerService {
31
public class RmiIiopServerGBean {
32
33     private final Log log = LogFactory.getLog(RmiIiopServerGBean.class);
34
35     private MessageHandler msgHandler;
36     private ArrayList JavaDoc args = new ArrayList JavaDoc();
37     private Properties JavaDoc props = new Properties JavaDoc();
38     private boolean simpleIDL = false;
39     private boolean writeSystemExceptionStackTrace = false;
40     private AdapterManager adapterManager;
41
42     public RmiIiopServerGBean(AdapterManager adapterManager, ArrayList JavaDoc args, Properties JavaDoc props,
43                               boolean simpleIDL, boolean writeSystemExceptionStackTrace ) {
44         this.adapterManager = adapterManager;
45         this.args = args;
46         this.props = props;
47         this.simpleIDL = simpleIDL;
48         this.writeSystemExceptionStackTrace = writeSystemExceptionStackTrace;
49         this.msgHandler = new MessageHandler( this.adapterManager, this.simpleIDL,
50                                               this.writeSystemExceptionStackTrace );
51
52     }
53
54     public RmiIiopServerGBean() throws Exception JavaDoc {
55         this.adapterManager = null;
56         this.args = null;
57         this.props = null;
58         this.simpleIDL = false;
59         this.writeSystemExceptionStackTrace = false;
60         this.msgHandler = null;
61     }
62
63     public void service(Socket JavaDoc socket) throws Exception JavaDoc {
64         log.debug( "RmiIiopServerGBean.service(): socket = " + socket );
65         msgHandler.service(socket);
66     }
67
68     public void init(Properties JavaDoc properties) throws Exception JavaDoc
69     {
70         //To change body of implemented methods use File | Settings | File Templates.
71
}
72
73     public void start() throws Exception JavaDoc {
74         log.debug( "RmiIiopServerGBean.start(): " );
75     }
76
77     public void stop() throws Exception JavaDoc {
78         log.debug( "RmiIiopServerGBean.stop(): " );
79     }
80
81     public String JavaDoc getName() {
82         return "rmiiiopd";
83     }
84
85     /*
86     public void setArgs( ArrayList args )
87     {
88         this.args = args;
89     }
90
91     public ArrayList getArgs() {
92         return args;
93     }
94
95     public void setProps( Properties props )
96     {
97         this.props = props;
98     }
99
100     public Properties getProps() {
101         return props;
102     }
103     */

104
105     /*
106      * The following methods are from ServerService...
107      * getPort() and getIP() ... Do we need them??
108      */

109
110     private int port;
111     private String JavaDoc ip;
112
113     public void setPort( int port )
114     {
115         log.debug( "RmiIiopServerGBean.setPort(): port = " + port );
116         this.port = port;
117     }
118
119     public int getPort() {
120         return port;
121     }
122
123     public void setIP( String JavaDoc ip )
124     {
125         log.debug( "RmiIiopServerGBean.setIP(): ip = " + ip );
126         this.ip = ip;
127     }
128
129     public String JavaDoc getIP() {
130         return "";
131     }
132
133     public static final GBeanInfo GBEAN_INFO;
134
135     static {
136         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(RmiIiopServerGBean.class);
137
138         //infoFactory.addInterface(SocketService.class);
139

140         infoFactory.addAttribute("args", ArrayList JavaDoc.class, true);
141         infoFactory.addAttribute("props", Properties JavaDoc.class, true);
142         infoFactory.addAttribute("simpleIDL", boolean.class, true);
143         infoFactory.addAttribute("writeSystemExceptionStackTrace", boolean.class, true);
144         infoFactory.addReference("adapterManager", AdapterManager.class);
145
146         infoFactory.setConstructor(new String JavaDoc[]{"adapterManager", "args", "props", "simpleIDL", "writeSystemExceptionStackTrace"});
147
148         GBEAN_INFO = infoFactory.getBeanInfo();
149     }
150
151     public static GBeanInfo getGBeanInfo() {
152         return GBEAN_INFO;
153     }
154 }
155
156
Popular Tags