Inspector | Message | Severity | Location |
---|---|---|---|
Java Inspector 048 | Copyrights information should be present in each file. | 1 | |
Java Inspector 083 | Do not use printStackTrace() for exception logging. | 2 | 66:66 |
Java Inspector 089 | Type is not documented | 2 | 37:1 |
Java Inspector 089 | Constructor is not properly documented | 2 | 43:9 |
Java Inspector 089 | Parameter remoteConsumer is not documented | 2 | 43:9 |
Java Inspector 089 | Undocumented constructor | 2 | 48:9 |
Java Inspector 089 | Undocumented method | 2 | 52:9 |
Java Inspector 089 | Undocumented method | 2 | 62:33 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 55:129 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 60:101 |
Java Inspector 026 | Avoid hardwired string literals. Allowed literals: [] | 3 | 64:102 |
Java Inspector 051 | It is good practice to call in any case super() in a constructor. | 3 | 48:9 |
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.metrics;
24
25import java.rmi.Naming;
26import java.rmi.RemoteException;
27
28import biz.hammurapi.config.Component;
29import biz.hammurapi.config.ConfigurationException;
30import biz.hammurapi.config.DomConfigurable;
31import biz.hammurapi.xml.dom.AbstractDomObject;
32
33
34/**
35 * @author Pavel Vlasov
36 */
37public class RemoteSlicingMeasurementCategoryFactory extends SlicingMeasurementCategoryFactory implements DomConfigurable, Component {
38 private RemoteSliceConsumer remoteSliceConsumer;
39
40 /**
41 * @param remoteConsumer
42 */
43 public RemoteSlicingMeasurementCategoryFactory(RemoteSliceConsumer remoteConsumer) {
44 super();
45 this.remoteSliceConsumer = remoteConsumer;
46 }
47
48 public RemoteSlicingMeasurementCategoryFactory() {
49
50 }
51
52 protected SliceConsumer createSliceConsumer() throws ConfigurationException {
53 try {
54 if (remoteSliceConsumer==null) {
55 remoteSliceConsumer=(RemoteSliceConsumer) Naming.lookup(AbstractDomObject.getElementText(configElement, "remote-slice-consumer"));
56 }
57
58 return new SliceConsumer() {
59
60 String rootCategory=AbstractDomObject.getElementText(configElement, "root-category");
61
62 public boolean consumeSlice(String category, Slice slice) {
63 try {
64 return remoteSliceConsumer.consumeSlice(rootCategory+"."+category, slice);
65 } catch (RemoteException e) {
66 e.printStackTrace();
67 return false;
68 }
69 }
70
71 };
72 } catch (Exception e) {
73 throw new ConfigurationException(e);
74 }
75 }
76}
77