Inspector | Message | Severity | Location |
---|---|---|---|
Java Inspector 048 | Copyrights information should be present in each file. | 1 | |
Java Inspector 089 | Undocumented method | 2 | 43:9 |
Java Inspector 089 | Undocumented method | 2 | 47:9 |
Java Inspector 089 | Undocumented method | 2 | 55:9 |
Java Inspector 089 | Undocumented method | 2 | 59:9 |
Java Inspector 089 | Undocumented method | 2 | 63:9 |
Java Inspector 089 | Undocumented method | 2 | 70:9 |
Java Inspector 025 | Avoid hardwired numeric literals. Allowed literals: [1, -1, 0] | 3 | 40:26 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 51:58 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 65:37 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 66:63 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 74:65 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 74:91 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 76:65 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 76:91 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 78:65 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 78:91 |
1/*
2 * hgcommons 9
3 * Hammurapi Group Common Library
4 * Copyright (C) 2003 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.biz/hammurapi-biz/ef/xmenu/hammurapi-group/products/products/hgcommons/index.html
21 * e-Mail: support@hammurapi.biz
22 */
23package biz.hammurapi.config;
24
25import java.rmi.AccessException;
26import java.rmi.NotBoundException;
27import java.rmi.RemoteException;
28import java.rmi.registry.LocateRegistry;
29import java.rmi.registry.Registry;
30
31import org.w3c.dom.Element;
32import org.w3c.dom.Node;
33
34/**
35 * Wrapper for RMI registry
36 * @author Pavel Vlasov
37 * @revision $Revision$
38 */
39public class RmiRegistryComponent extends ComponentBase implements Wrapper, DomConfigurable {
40 private int port=1099;
41 private Registry master;
42
43 public Object getMaster() {
44 return master;
45 }
46
47 public void start() throws ConfigurationException {
48 try {
49 master=LocateRegistry.createRegistry(port);
50 } catch (RemoteException e) {
51 throw new ConfigurationException("Could not create RMI registry: "+e, e);
52 }
53 }
54
55 public void stop() {
56 // Nothing to do.
57 }
58
59 public void setOwner(Object owner) {
60 this.owner=owner;
61 }
62
63 public void configure(Node configNode, Context context, ClassLoader classLoader) {
64 Element ce = (Element) configNode;
65 if (ce.hasAttribute("port")) {
66 port=Integer.parseInt(ce.getAttribute("port"));
67 }
68 }
69
70 protected Object getChild(String name) {
71 try {
72 return master.lookup(name);
73 } catch (AccessException e) {
74 throw new RuntimeConfigurationException("Could not lookup '"+name+"' - "+e, e);
75 } catch (RemoteException e) {
76 throw new RuntimeConfigurationException("Could not lookup '"+name+"' - "+e, e);
77 } catch (NotBoundException e) {
78 throw new RuntimeConfigurationException("Could not lookup '"+name+"' - "+e, e);
79 }
80 }
81
82}
83