Package: GlobalRegion

GlobalRegion

nameinstructionbranchcomplexitylinemethod
GlobalRegion(String)
M: 12 C: 9
43%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
addBundle(Bundle)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
addBundle(long)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
connectRegion(Region, RegionFilter)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
contains(Bundle)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
contains(long)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
equals(Object)
M: 29 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getBundle(String, Version)
M: 0 C: 21
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getBundleIds()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEdges()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getName()
M: 6 C: 3
33%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getRegionDigraph()
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
hashCode()
M: 20 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
installBundle(String)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
installBundle(String, InputStream)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
installBundleAtLocation(String, InputStream)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
removeBundle(Bundle)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
removeBundle(long)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
toString()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
visitSubgraph(RegionDigraphVisitor)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011 VMware Inc.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * VMware Inc. - initial contribution
10: *******************************************************************************/
11:
12: package org.eclipse.virgo.kernel.osgi.region;
13:
14: import java.io.InputStream;
15: import java.util.HashSet;
16: import java.util.Set;
17:
18: import org.eclipse.equinox.region.Region;
19: import org.eclipse.equinox.region.RegionDigraph;
20: import org.eclipse.equinox.region.RegionDigraph.FilteredRegion;
21: import org.eclipse.equinox.region.RegionDigraphVisitor;
22: import org.eclipse.equinox.region.RegionFilter;
23: import org.eclipse.virgo.nano.serviceability.NonNull;
24: import org.osgi.framework.Bundle;
25: import org.osgi.framework.BundleException;
26: import org.osgi.framework.Version;
27:
28: /**
29: * {@link GlobalRegion} is an implementation of {@link Region} which acts as a place holder for all artifacts that are not bundles
30: * <p />
31: *
32: * <strong>Concurrent Semantics</strong><br />
33: * Thread safe.
34: */
35: final class GlobalRegion implements Region {
36:
37: private final String regionName;
38:
39: private static final String UNSUPPORTED_OPERATION_MESSAGE = "Bundle operations are not support on the Independent Region";
40:
41:
42: public GlobalRegion(String regionName) {
43: this.regionName = regionName;
44: }
45:
46: /**
47: * {@inheritDoc}
48: */
49: @Override
50: public String getName() {
51: return regionName;
52: }
53:
54: /**
55: * {@inheritDoc}
56: */
57: @Override
58: public void addBundle(Bundle bundle) throws BundleException {
59: throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
60: }
61:
62: /**
63: * {@inheritDoc}
64: */
65: @Override
66: public void addBundle(long bundleId) {
67: throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
68: }
69:
70: /**
71: * {@inheritDoc}
72: */
73: @Override
74: public Bundle installBundle(String location, InputStream input) throws BundleException {
75: throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
76: }
77:
78: /**
79: * {@inheritDoc}
80: */
81: @Override
82: public Bundle installBundle(String location) throws BundleException {
83: throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
84: }
85:
86: /**
87: * {@inheritDoc}
88: */
89: @Override
90: public Bundle getBundle(@NonNull String symbolicName, @NonNull Version version) {
91: throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
92: }
93:
94: /**
95: * {@inheritDoc}
96: */
97: @Override
98: public void connectRegion(Region headRegion, RegionFilter filter) throws BundleException {
99: throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
100: }
101:
102: /**
103: * {@inheritDoc}
104: */
105: @Override
106: public RegionDigraph getRegionDigraph(){
107: return null;
108: }
109:
110: /**
111: * {@inheritDoc}
112: */
113: @Override
114: public boolean contains(Bundle bundle) {
115: return false;
116: }
117:
118: /**
119: * {@inheritDoc}
120: */
121: @Override
122: public boolean contains(long bundleId) {
123: return false;
124: }
125:
126: /**
127: * {@inheritDoc}
128: */
129: @Override
130: public void removeBundle(Bundle bundle) {
131: //no-op
132: }
133:
134: /**
135: * {@inheritDoc}
136: */
137: @Override
138: public void removeBundle(long bundleId) {
139: //no-op
140: }
141:
142: /**
143: * {@inheritDoc}
144: */
145: @Override
146: public Set<Long> getBundleIds() {
147: return new HashSet<Long>();
148: }
149:
150: /**
151: * {@inheritDoc}
152: */
153: @Override
154: public Set<FilteredRegion> getEdges() {
155: return new HashSet<RegionDigraph.FilteredRegion>();
156: }
157:
158: /**
159: * {@inheritDoc}
160: */
161: @Override
162: public void visitSubgraph(RegionDigraphVisitor visitor) {
163: //no-op
164: }
165:
166: /**
167: * {@inheritDoc}
168: */
169: @Override
170: public String toString() {
171: return getName();
172: }
173:
174: /**
175: * {@inheritDoc}
176: */
177: @Override
178: public int hashCode() {
179: final int prime = 31;
180: int result = 1;
181: result = prime * result + regionName.hashCode();
182: return result;
183: }
184:
185: /**
186: * {@inheritDoc}
187: */
188: @Override
189: public boolean equals(Object obj) {
190:• if (this == obj) {
191: return true;
192: }
193:• if (obj == null) {
194: return false;
195: }
196:• if (!(obj instanceof GlobalRegion)) {
197: return false;
198: }
199: GlobalRegion other = (GlobalRegion) obj;
200: return this.regionName.equals(other.regionName);
201: }
202:
203:         @Override
204:         public Bundle installBundleAtLocation(String arg0, InputStream arg1)
205:                         throws BundleException {
206:                 throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
207:         }
208:
209: }