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

COVERAGE SUMMARY FOR SOURCE FILE [PortletWindowConfig.java]

nameclass, %method, %block, %line, %
PortletWindowConfig.java0%   (0/1)0%   (0/13)0%   (0/123)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PortletWindowConfig0%   (0/1)0%   (0/13)0%   (0/123)0%   (0/30)
PortletWindowConfig (): void 0%   (0/1)0%   (0/9)0%   (0/4)
createPortletId (String, String, String): String 0%   (0/1)0%   (0/15)0%   (0/1)
getContextPath (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getId (): String 0%   (0/1)0%   (0/8)0%   (0/1)
getPortletId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPortletName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getSeparatorIndex (String): int 0%   (0/1)0%   (0/33)0%   (0/6)
parseContextPath (String): String 0%   (0/1)0%   (0/8)0%   (0/2)
parsePortletInstanceId (String): String 0%   (0/1)0%   (0/10)0%   (0/2)
parsePortletName (String): String 0%   (0/1)0%   (0/19)0%   (0/5)
setContextPath (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setPortletId (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setPortletName (String): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/*
2 * Copyright 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.services.portal;
17 
18/**
19 * Configuration of a portlet window on the portal page.
20 * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
21 * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
22 */
23public class PortletWindowConfig {
24        
25        // Private Member Variables ------------------------------------------------
26        
27    /** The context path of the associated portlet. */
28    private String contextPath = null;
29    
30    /** The portlet name. */
31    private String portletName = null;
32    
33    // IU_MOD--START
34    /** The unique instance id of a portlet */
35    private String portletId;
36    // IU_MOD--END
37    
38    // Constructor -------------------------------------------------------------
39    
40    /**
41     * No-arg constructor.
42     */
43    public PortletWindowConfig() {
44    }
45    
46    
47    // Public Methods ----------------------------------------------------------
48    
49    public String getId() {
50        // IU_MOD--START
51        return createPortletId(contextPath, portletName, portletId);
52    }
53 
54    public String getContextPath() {
55        return contextPath;
56    }
57 
58    public void setContextPath(String contextPath) {
59        this.contextPath = contextPath;
60    }
61 
62    public String getPortletName() {
63        return portletName;
64    }
65 
66    public void setPortletName(String portletName) {
67        this.portletName = portletName;
68    }
69    
70    
71    // Public Static Methods ---------------------------------------------------
72    
73    /**
74     * Creates the portlet ID from context path and portlet name. The portlet ID
75     * is constructed by concatinating the context path and the portlet name
76     * using a dot ('.').
77     * @param contextPath  the portlet context path.
78     * @param portletName  the portlet name.
79     */
80    public static String createPortletId(String contextPath, String portletName, String id) {
81        // IU_MOD--START
82        return contextPath + "." + portletName + "_pwcid_" + id;
83    }
84    
85    /**
86     * Parses out the portlet context path from the portlet ID.
87     * @param portletId  the portlet ID to parse.
88     * @return the portlet context path.
89     */
90    public static String parseContextPath(String portletId) {
91            int index = getSeparatorIndex(portletId);
92        return portletId.substring(0, index);
93    }
94    
95    /**
96     * Parses out the portlet context path from the portlet ID.
97     * @param portletId  the portlet ID to parse.
98     * @return the portlet context path.
99     * @throws IllegalArgumentException  if portlet ID is invalid.
100     */
101    public static String parsePortletName(String portletId) {
102        // IU_MOD--START
103            int index = getSeparatorIndex(portletId);
104        int index2 = portletId.indexOf("_pwcid_");
105        if (index2 <= 0) {
106            index2 = portletId.length();
107        }
108        return portletId.substring(index + 1, index2);
109        // IU_MOD--END
110    }
111 
112    // IU_MOD--START
113    public static String parsePortletInstanceId(String portletId) {
114        int index = portletId.indexOf("_pwcid_") + 7;
115        return portletId.substring(index);
116    }
117    // IU_MOD--END
118 
119    // Private Static Method ---------------------------------------------------
120    
121    /**
122     * Parses the portlet ID and returns the separator (".") index. The portlet
123     * ID passed in should be a valid ID: not null, not starts with ".",
124     * not ends with ".", and contains ".".
125     * @param portletId  the portlet ID to parse.
126     * @return the separator index.
127     * @throws IllegalArgumentException  if portlet ID is null or invalid.
128     */
129    private static int getSeparatorIndex(String portletId)
130    throws IllegalArgumentException {
131            if (portletId == null) {
132                    throw new IllegalArgumentException("Invalid portlet ID: null");
133            }
134            int index = portletId.indexOf(".");
135            if (index <= 0 || index == portletId.length() - 1) {
136                    throw new IllegalArgumentException("Invalid portlet ID: " + portletId);
137            }
138            return index;
139    }
140 
141    // IU_MOD--START
142    public String getPortletId() {
143        return portletId;
144    }
145 
146 
147    public void setPortletId(String portletId) {
148        this.portletId = portletId;
149    }
150    // IU_MOD--END
151    
152}
153 

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