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