jboynes 2004/05/30 11:58:59
Modified: modules/assembly/src/plan system-plan.xml
Added: modules/system/src/java/org/apache/geronimo/system
RMIRegistryService.java
Log:
GBean to expose an RMI Registry
In system as it is too small for its own module and has no dependencies -
might change this later
Revision Changes Path
1.7 +5 -0
incubator-geronimo/modules/assembly/src/plan/system-plan.xml
Index: system-plan.xml
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/assembly/src/plan/system-plan.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- system-plan.xml 23 Apr 2004 03:08:28 -0000 1.6
+++ system-plan.xml 30 May 2004 18:58:59 -0000 1.7
@@ -73,4 +73,9 @@
<attribute name="MaxFileSize"
type="java.lang.String">10MB</attribute>
<reference
name="ServerInfo">geronimo.system:role=ServerInfo</reference>
</gbean>
+
+ <!-- RMI Registry -->
+ <gbean name="geronimo.server:role=RMIRegistry"
class="org.apache.geronimo.system.RMIRegistryService">
+ <attribute name="Port" type="int">1099</attribute>
+ </gbean>
</configuration>
1.1
incubator-geronimo/modules/system/src/java/org/apache/geronimo/system/RMIRegistryService.java
Index: RMIRegistryService.java
===================================================================
/**
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.geronimo.system;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import org.apache.geronimo.gbean.GBean;
import org.apache.geronimo.gbean.GBeanContext;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
import org.apache.geronimo.gbean.WaitingException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Thin GBean wrapper around the RMI Registry.
*
* @version $Revision: 1.1 $ $Date: 2004/05/30 18:58:59 $
*/
public class RMIRegistryService implements GBean {
private int port = Registry.REGISTRY_PORT;
private Registry registry;
private Log log;
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public void setGBeanContext(GBeanContext context) {
if (context != null) {
log = LogFactory.getLog(RMIRegistryService.class);
} else {
log = null;
}
}
public void doStart() throws WaitingException, Exception {
registry = LocateRegistry.createRegistry(port);
log.info("Started RMI Registry on port " + port);
}
public void doStop() throws WaitingException, Exception {
UnicastRemoteObject.unexportObject(registry, true);
log.info("Stopped RMI Registry");
}
public void doFail() {
try {
doStop();
} catch (Exception e) {
log.warn("RMI Registry failed");
}
}
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(RMIRegistryService.class);
infoFactory.addAttribute("Port", true);
GBEAN_INFO = infoFactory.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
}
}