EMMA Coverage Report (generated Fri Sep 15 10:32:43 EDT 2006)
[all classes][org.apache.pluto.driver]

COVERAGE SUMMARY FOR SOURCE FILE [PublishServlet.java]

nameclass, %method, %block, %line, %
PublishServlet.java0%   (0/1)0%   (0/3)0%   (0/55)0%   (0/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PublishServlet0%   (0/1)0%   (0/3)0%   (0/55)0%   (0/14)
PublishServlet (): void 0%   (0/1)0%   (0/3)0%   (0/1)
doGet (HttpServletRequest, HttpServletResponse): void 0%   (0/1)0%   (0/39)0%   (0/9)
doPublish (String): void 0%   (0/1)0%   (0/13)0%   (0/4)

1/*
2 * Copyright 2003,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.apache.pluto.driver;
17 
18import org.apache.pluto.driver.services.portal.admin.DriverAdministrationException;
19import org.apache.pluto.driver.services.portal.admin.PortletRegistryAdminService;
20import org.apache.pluto.driver.config.AdminConfiguration;
21 
22import javax.servlet.http.HttpServlet;
23import javax.servlet.http.HttpServletRequest;
24import javax.servlet.http.HttpServletResponse;
25import javax.servlet.ServletException;
26import java.io.IOException;
27 
28 
29/**
30 * Publishing administrative servlet.
31 * Allows external clients to connect and notify the portal
32 * of available portlet applications.
33 *
34 * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>:
35 * @version 1.0
36 * @since Nov 23, 2005
37 */
38public class PublishServlet extends HttpServlet {
39 
40    protected void doGet(HttpServletRequest req,
41                         HttpServletResponse res)
42    throws ServletException, IOException {
43 
44        String context = req.getParameter("context");
45        try {
46            doPublish(context);
47        }
48        catch(Throwable t) {
49            StringBuffer sb = new StringBuffer();
50            sb.append("Unable to publish portlet application bound to context '"+context+"'.");
51            sb.append("Reason: ").append(t.getMessage());
52            res.getWriter().println(sb.toString());
53        }
54    }
55 
56    private void doPublish(String context) throws DriverAdministrationException {
57        AdminConfiguration adminConfig = (AdminConfiguration)getServletContext()
58            .getAttribute(AttributeKeys.DRIVER_ADMIN_CONFIG);
59 
60        PortletRegistryAdminService admin = adminConfig.getPortletRegistryAdminService();
61 
62        admin.addPortletApplication(context);
63    }
64}

[all classes][org.apache.pluto.driver]
EMMA 2.0.5312 (C) Vladimir Roubtsov