Inspector | Message | Severity | Location |
---|---|---|---|
Java Inspector 048 | Copyrights information should be present in each file. | 1 | |
Java Inspector 089 | Undocumented field | 2 | 44:9 |
Java Inspector 089 | Undocumented constructor | 2 | 46:9 |
Java Inspector 089 | Undocumented method | 2 | 50:9 |
Java Inspector 089 | Undocumented method | 2 | 61:9 |
Java Inspector 089 | Undocumented method | 2 | 77:9 |
Java Inspector 089 | Undocumented method | 2 | 81:9 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 51:28 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 51:48 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 55:58 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 55:94 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 57:58 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 57:94 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 68:66 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 68:105 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 70:66 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 70:101 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 72:66 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 72:101 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 83:37 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 84:63 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 87:38 |
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.net.MalformedURLException;
26import java.rmi.Naming;
27import java.rmi.NotBoundException;
28import java.rmi.RemoteException;
29import java.rmi.server.UnicastRemoteObject;
30
31import org.w3c.dom.Element;
32import org.w3c.dom.Node;
33
34 /**
35 * Base class for components exposed through RMI
36 * @author Pavel Vlasov
37 * @revision $Revision$
38 */
39public class RmiComponent extends UnicastRemoteObject implements Component, DomConfigurable {
40
41 private int port;
42 private String name;
43 private String bindName;
44 protected Object owner;
45
46 public RmiComponent() throws RemoteException {
47 super();
48 }
49
50 public void start() throws ConfigurationException {
51 bindName = "//localhost:"+port+"/"+name;
52 try {
53 Naming.rebind(bindName, this);
54 } catch (RemoteException e) {
55 throw new ConfigurationException("Could not bind to name '"+bindName+"' - "+e, e);
56 } catch (MalformedURLException e) {
57 throw new ConfigurationException("Could not bind to name '"+bindName+"' - "+e, e);
58 }
59 }
60
61 public void stop() throws ConfigurationException {
62 if (bindName!=null) {
63 try {
64 Naming.unbind(bindName);
65 unexportObject(this, false);
66 bindName=null;
67 } catch (RemoteException e) {
68 throw new ConfigurationException("Could not unbind/unexport '"+bindName+"' - "+e, e);
69 } catch (MalformedURLException e) {
70 throw new ConfigurationException("Could not unbind name '"+bindName+"' - "+e, e);
71 } catch (NotBoundException e) {
72 throw new ConfigurationException("Could not unbind name '"+bindName+"' - "+e, e);
73 }
74 }
75 }
76
77 public void setOwner(Object owner) {
78 this.owner=owner;
79 }
80
81 public void configure(Node configNode, Context context, ClassLoader classLoader) {
82 Element ce = (Element) configNode;
83 if (ce.hasAttribute("port")) {
84 port=Integer.parseInt(ce.getAttribute("port"));
85 }
86
87 name=ce.getAttribute("name");
88 }
89
90}
91