Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PortletWebActivator |
|
| 1.0;1 |
1 | // Copyright 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.tapestry.portlet; | |
16 | ||
17 | import java.util.List; | |
18 | ||
19 | import javax.portlet.PortletConfig; | |
20 | ||
21 | import org.apache.hivemind.util.Defense; | |
22 | import org.apache.tapestry.describe.DescriptionReceiver; | |
23 | import org.apache.tapestry.web.WebActivator; | |
24 | import org.apache.tapestry.web.WebUtils; | |
25 | ||
26 | /** | |
27 | * Adapts a {@link javax.portlet.PortletConfig} as | |
28 | * {@link org.apache.tapestry.web.WebActivator}. | |
29 | * | |
30 | * @author Howard M. Lewis Ship | |
31 | * @since 4.0 | |
32 | */ | |
33 | public class PortletWebActivator implements WebActivator | |
34 | { | |
35 | ||
36 | private final PortletConfig _config; | |
37 | ||
38 | public PortletWebActivator(PortletConfig config) | |
39 | 0 | { |
40 | 0 | Defense.notNull(config, "config"); |
41 | ||
42 | 0 | _config = config; |
43 | 0 | } |
44 | ||
45 | public String getActivatorName() | |
46 | { | |
47 | 0 | return _config.getPortletName(); |
48 | } | |
49 | ||
50 | public List getInitParameterNames() | |
51 | { | |
52 | 0 | return WebUtils.toSortedList(_config.getInitParameterNames()); |
53 | } | |
54 | ||
55 | public String getInitParameterValue(String name) | |
56 | { | |
57 | 0 | return _config.getInitParameter(name); |
58 | } | |
59 | ||
60 | public void describeTo(DescriptionReceiver receiver) | |
61 | { | |
62 | 0 | receiver.describeAlternate(_config); |
63 | 0 | } |
64 | ||
65 | } |