Package: CompoundDeployUriNormaliser

CompoundDeployUriNormaliser

nameinstructionbranchcomplexitylinemethod
CompoundDeployUriNormaliser(DeployUriNormaliser[])
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
normalise(URI)
M: 27 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2008, 2010 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.deployer.core.internal.uri;
13:
14: import java.net.URI;
15:
16: import org.eclipse.virgo.nano.deployer.api.core.DeployUriNormaliser;
17: import org.eclipse.virgo.nano.deployer.api.core.DeploymentException;
18: import org.eclipse.virgo.nano.serviceability.NonNull;
19:
20:
21:
22: /**
23: * A {@link DeployUriNormaliser} implementation that calls a list of delegate
24: * normalisers until the {@link URI} is normalised.
25: *
26: * <p />
27: *
28: * <strong>Concurrent Semantics</strong><br />
29: *
30: * As thread-safe as the delegates.
31: *
32: */
33: class CompoundDeployUriNormaliser implements DeployUriNormaliser {
34:
35: private final DeployUriNormaliser[] normalisers;
36:
37: public CompoundDeployUriNormaliser(@NonNull DeployUriNormaliser[] normalisers) {
38: this.normalisers = normalisers.clone();
39: }
40:
41: /**
42: * {@inheritDoc}
43: */
44: public URI normalise(URI uri) throws DeploymentException {
45:• for (DeployUriNormaliser normaliser : normalisers) {
46: URI normalised = normaliser.normalise(uri);
47:• if (normalised != null) {
48: return normalised;
49: }
50: }
51: return null;
52: }
53: }