KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > portlet > PortletWebActivator


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 JavaDoc;
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 {@link org.apache.tapestry.web.WebActivator}.
28  *
29  * @author Howard M. Lewis Ship
30  * @since 4.0
31  */

32 public class PortletWebActivator implements WebActivator
33 {
34     private final PortletConfig _config;
35
36     public PortletWebActivator(PortletConfig config)
37     {
38         Defense.notNull(config, "config");
39
40         _config = config;
41     }
42
43     public String JavaDoc getActivatorName()
44     {
45         return _config.getPortletName();
46     }
47
48     public List JavaDoc getInitParameterNames()
49     {
50         return WebUtils.toSortedList(_config.getInitParameterNames());
51     }
52
53     public String JavaDoc getInitParameterValue(String JavaDoc name)
54     {
55         return _config.getInitParameter(name);
56     }
57
58     public void describeTo(DescriptionReceiver receiver)
59     {
60         receiver.describeAlternate(_config);
61     }
62
63 }
Popular Tags