Inspector | Message | Severity | Location |
---|---|---|---|
Java Inspector 048 | Copyrights information should be present in each file. | 1 | |
Java Inspector 089 | Undocumented method | 2 | 50:9 |
Java Inspector 089 | Undocumented method | 2 | 62:9 |
Java Inspector 089 | Undocumented method | 2 | 66:9 |
Java Inspector 089 | Undocumented method | 2 | 71:9 |
Java Inspector 089 | Undocumented method | 2 | 78:9 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 54:58 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 54:83 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 56:58 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 56:83 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 58:58 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 58:81 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 73:37 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 82:52 |
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.util;
24
25import java.io.Serializable;
26import java.net.MalformedURLException;
27import java.rmi.Naming;
28import java.rmi.NotBoundException;
29import java.rmi.RemoteException;
30
31import javax.rmi.PortableRemoteObject;
32
33import org.w3c.dom.Element;
34import org.w3c.dom.Node;
35
36import biz.hammurapi.RuntimeException;
37import biz.hammurapi.config.ConfigurationException;
38import biz.hammurapi.config.Context;
39
40
41/**
42 * Unwraps remote worker
43 * @author Pavel Vlasov
44 * @revision $Revision$
45 */
46public class RemoteWorkerComponent implements Worker {
47 private RemoteWorker master;
48 private String url;
49
50 public void start() throws ConfigurationException {
51 try {
52 master=(RemoteWorker) PortableRemoteObject.narrow(Naming.lookup(url), RemoteWorker.class);
53 } catch (MalformedURLException e) {
54 throw new ConfigurationException("Could not lookup '"+url+"' - "+e, e);
55 } catch (RemoteException e) {
56 throw new ConfigurationException("Could not lookup '"+url+"' - "+e, e);
57 } catch (NotBoundException e) {
58 throw new ConfigurationException("Could not bind '"+url+"' - "+e, e);
59 }
60 }
61
62 public void stop() throws ConfigurationException {
63 // Nothing
64 }
65
66 public void setOwner(Object owner) {
67 // nothing
68
69 }
70
71 public void configure(Node configNode, Context context) throws ConfigurationException {
72 Element ce = (Element) configNode;
73 url=ce.getAttribute("worker-url");
74 }
75
76
77
78 public boolean post(Runnable job) {
79 try {
80 return job instanceof Serializable && master.post(job);
81 } catch (RemoteException e) {
82 throw new RuntimeException("Could not post job to remote worker: "+e, e);
83 }
84 }
85
86}
87