|
|||||||||||||||||||
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 | |||||||||||||||
ElementsProxyMap.java | 50% | 60% | 57.1% | 57.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.AbstractMap;
|
|
18 |
import java.util.Map;
|
|
19 |
import java.util.Set;
|
|
20 |
|
|
21 |
import org.apache.hivemind.HiveMind;
|
|
22 |
import org.apache.hivemind.events.RegistryShutdownListener;
|
|
23 |
|
|
24 |
/**
|
|
25 |
* The Map implementation visible to the client code. It defers to another inner implementation of
|
|
26 |
* Map; initially this is a {@link org.apache.hivemind.impl.ElementsInnerProxyMap}, but the inner
|
|
27 |
* proxy replaces itself with a real Map implementation containing the actual configuration
|
|
28 |
* elements.
|
|
29 |
*
|
|
30 |
* @author Knut Wannheden
|
|
31 |
* @since 1.1
|
|
32 |
*/
|
|
33 |
public final class ElementsProxyMap extends AbstractMap implements RegistryShutdownListener |
|
34 |
{ |
|
35 |
private Map _inner;
|
|
36 |
|
|
37 |
private boolean _shutdown; |
|
38 |
|
|
39 | 18 |
public void registryDidShutdown() |
40 |
{ |
|
41 | 18 |
_shutdown = true;
|
42 | 18 |
_inner = null;
|
43 |
} |
|
44 |
|
|
45 | 108 |
private void checkShutdown() |
46 |
{ |
|
47 | 108 |
if (_shutdown)
|
48 | 0 |
throw HiveMind.createRegistryShutdownException();
|
49 |
} |
|
50 |
|
|
51 | 108 |
public Set entrySet()
|
52 |
{ |
|
53 | 108 |
checkShutdown(); |
54 |
|
|
55 | 108 |
return _inner.entrySet();
|
56 |
} |
|
57 |
|
|
58 | 0 |
public String toString()
|
59 |
{ |
|
60 | 0 |
return _inner.toString();
|
61 |
} |
|
62 |
|
|
63 | 0 |
public boolean equals(Object o) |
64 |
{ |
|
65 | 0 |
return _inner.equals(o);
|
66 |
} |
|
67 |
|
|
68 | 0 |
public int hashCode() |
69 |
{ |
|
70 | 0 |
return _inner.hashCode();
|
71 |
} |
|
72 |
|
|
73 | 207 |
public void setInner(Map map) |
74 |
{ |
|
75 | 207 |
_inner = map; |
76 |
} |
|
77 |
|
|
78 |
} |
|