|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ElementsProxyList.java | 100% | 91.7% | 87.5% | 90.9% |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.hivemind.impl;
|
|
16 |
|
|
17 |
import java.util.AbstractList;
|
|
18 |
import java.util.List;
|
|
19 |
|
|
20 |
import org.apache.hivemind.HiveMind;
|
|
21 |
import org.apache.hivemind.events.RegistryShutdownListener;
|
|
22 |
|
|
23 |
/**
|
|
24 |
* The List implementation visible to the client code. It defers
|
|
25 |
* to another inner implementation of List; initially this is
|
|
26 |
* a {@link org.apache.hivemind.impl.ElementsInnerProxyList}, but the
|
|
27 |
* inner proxy replaces itself with a real List implementation containing
|
|
28 |
* the actual configuration elements.
|
|
29 |
*
|
|
30 |
* @author Howard Lewis Ship
|
|
31 |
*/
|
|
32 |
public final class ElementsProxyList extends AbstractList implements RegistryShutdownListener |
|
33 |
{ |
|
34 |
private List _inner;
|
|
35 |
private boolean _shutdown; |
|
36 |
|
|
37 | 89 |
public void registryDidShutdown() |
38 |
{ |
|
39 | 89 |
_shutdown = true;
|
40 | 89 |
_inner = null;
|
41 |
} |
|
42 |
|
|
43 | 4002 |
private void checkShutdown() |
44 |
{ |
|
45 | 4002 |
if (_shutdown)
|
46 | 1 |
throw HiveMind.createRegistryShutdownException();
|
47 |
} |
|
48 |
|
|
49 | 1783 |
public Object get(int index) |
50 |
{ |
|
51 | 1783 |
checkShutdown(); |
52 |
|
|
53 | 1783 |
return _inner.get(index);
|
54 |
} |
|
55 |
|
|
56 | 2219 |
public int size() |
57 |
{ |
|
58 | 2219 |
checkShutdown(); |
59 |
|
|
60 | 2218 |
return _inner.size();
|
61 |
} |
|
62 |
|
|
63 | 2 |
public String toString()
|
64 |
{ |
|
65 | 2 |
return _inner.toString();
|
66 |
} |
|
67 |
|
|
68 | 3 |
public boolean equals(Object o) |
69 |
{ |
|
70 | 3 |
return _inner.equals(o);
|
71 |
} |
|
72 |
|
|
73 | 0 |
public int hashCode() |
74 |
{ |
|
75 | 0 |
return _inner.hashCode();
|
76 |
} |
|
77 |
|
|
78 | 945 |
public void setInner(List list) |
79 |
{ |
|
80 | 945 |
_inner = list; |
81 |
} |
|
82 |
|
|
83 |
} |
|
84 |
|
|