|
|||||||||||||||||||
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 | |||||||||||||||
ServiceInterceptorContributionImpl.java | 50% | 100% | 100% | 97.2% |
|
1 |
// Copyright 2004 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.List;
|
|
18 |
|
|
19 |
import org.apache.hivemind.InterceptorStack;
|
|
20 |
import org.apache.hivemind.ServiceInterceptorFactory;
|
|
21 |
import org.apache.hivemind.internal.Module;
|
|
22 |
import org.apache.hivemind.internal.ServiceInterceptorContribution;
|
|
23 |
import org.apache.hivemind.internal.ServicePoint;
|
|
24 |
import org.apache.hivemind.schema.Schema;
|
|
25 |
import org.apache.hivemind.util.ToStringBuilder;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* Implementation of {@link org.apache.hivemind.internal.ServiceInterceptorContribution}.
|
|
29 |
*
|
|
30 |
* @author Howard Lewis Ship
|
|
31 |
*/
|
|
32 |
|
|
33 |
public final class ServiceInterceptorContributionImpl |
|
34 |
extends BaseLocatable
|
|
35 |
implements ServiceInterceptorContribution
|
|
36 |
{ |
|
37 |
private String _factoryServiceId;
|
|
38 |
private Module _contributingModule;
|
|
39 |
private List _parameters;
|
|
40 |
private List _convertedParameters;
|
|
41 |
private ServiceInterceptorFactory _factory;
|
|
42 |
private String _precedingInterceptorIds;
|
|
43 |
private String _followingInterceptorIds;
|
|
44 |
|
|
45 | 1 |
public String toString()
|
46 |
{ |
|
47 | 1 |
ToStringBuilder builder = new ToStringBuilder(this); |
48 | 1 |
builder.append("factoryServiceId", _factoryServiceId);
|
49 | 1 |
builder.append("parameters", _parameters);
|
50 | 1 |
builder.append("precedingInterceptorIds", _precedingInterceptorIds);
|
51 | 1 |
builder.append("followingInterceptorIds", _followingInterceptorIds);
|
52 |
|
|
53 | 1 |
return builder.toString();
|
54 |
} |
|
55 |
|
|
56 | 22 |
public String getFactoryServiceId()
|
57 |
{ |
|
58 | 22 |
return _factoryServiceId;
|
59 |
} |
|
60 |
|
|
61 | 30 |
public void setFactoryServiceId(String string) |
62 |
{ |
|
63 | 30 |
_factoryServiceId = string; |
64 |
} |
|
65 |
|
|
66 | 18 |
public void createInterceptor(InterceptorStack stack) |
67 |
{ |
|
68 | 18 |
setup(); |
69 |
|
|
70 | 15 |
_factory.createInterceptor(stack, _contributingModule, _convertedParameters); |
71 |
} |
|
72 |
|
|
73 | 18 |
private synchronized void setup() |
74 |
{ |
|
75 | 18 |
if (_factory == null) |
76 |
{ |
|
77 | 18 |
ServicePoint factoryPoint = _contributingModule.getServicePoint(_factoryServiceId); |
78 |
|
|
79 | 18 |
_factory = |
80 |
(ServiceInterceptorFactory) factoryPoint.getService( |
|
81 |
ServiceInterceptorFactory.class);
|
|
82 |
|
|
83 | 15 |
Schema schema = factoryPoint.getParametersSchema(); |
84 |
|
|
85 | 15 |
SchemaProcessorImpl processor = |
86 |
new SchemaProcessorImpl(
|
|
87 |
_contributingModule.getErrorHandler(), |
|
88 |
factoryPoint.getServiceLog(), |
|
89 |
schema); |
|
90 |
|
|
91 | 15 |
processor.process(_parameters, _contributingModule); |
92 |
|
|
93 | 15 |
_convertedParameters = processor.getElements(); |
94 |
} |
|
95 |
} |
|
96 |
|
|
97 | 30 |
public void setContributingModule(Module module) |
98 |
{ |
|
99 | 30 |
_contributingModule = module; |
100 |
} |
|
101 |
|
|
102 | 30 |
public void setParameters(List list) |
103 |
{ |
|
104 | 30 |
_parameters = list; |
105 |
} |
|
106 |
|
|
107 | 18 |
public String getFollowingInterceptorIds()
|
108 |
{ |
|
109 | 18 |
return _followingInterceptorIds;
|
110 |
} |
|
111 |
|
|
112 | 18 |
public String getPrecedingInterceptorIds()
|
113 |
{ |
|
114 | 18 |
return _precedingInterceptorIds;
|
115 |
} |
|
116 |
|
|
117 | 30 |
public void setFollowingInterceptorIds(String string) |
118 |
{ |
|
119 | 30 |
_followingInterceptorIds = string; |
120 |
} |
|
121 |
|
|
122 | 30 |
public void setPrecedingInterceptorIds(String string) |
123 |
{ |
|
124 | 30 |
_precedingInterceptorIds = string; |
125 |
} |
|
126 |
|
|
127 |
} |
|
128 |
|
|