KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > portal > information > ResourceURLProviderIG


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23 package org.infoglue.deliver.portal.information;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27 import org.apache.pluto.om.window.PortletWindow;
28 import org.apache.pluto.services.information.ResourceURLProvider;
29
30 /**
31  *
32  * @author jand
33  *
34  */

35 public class ResourceURLProviderIG implements ResourceURLProvider {
36     private static final Log log = LogFactory.getLog(ResourceURLProviderIG.class);
37
38     //private DynamicInformationProviderIG provider;
39
private String JavaDoc stringUrl = "";
40     private String JavaDoc base = "";
41
42     public ResourceURLProviderIG(DynamicInformationProviderIG provider, PortletWindow window) {
43         //this.provider = provider;
44
this.base =
45             window
46                 .getPortletEntity()
47                 .getPortletDefinition()
48                 .getServletDefinition()
49                 .getWebApplicationDefinition()
50                 .getContextRoot();
51         log.debug("window context base: " + this.base);
52     }
53
54     // ResourceURLProvider implementation.
55

56     public void setAbsoluteURL(String JavaDoc path) {
57         // TODO what the h*ll is this anyway?
58
log.debug("setAbsoluteURL(): " + path);
59         stringUrl = path;
60     }
61
62     public void setFullPath(String JavaDoc path) {
63         //TODO what the h*ll is this anyway?
64
log.debug("setFullPath(): " + path);
65         //stringUrl = base + path;
66
stringUrl = path;
67     }
68
69     public String JavaDoc toString() {
70         log.debug("Generated resourceURL: " + stringUrl);
71         return stringUrl;
72         /*
73             URL url = null;
74             if (!"".equals(stringUrl)) {
75             try {
76                 url = new URL(stringUrl);
77             } catch (MalformedURLException e) {
78                 throw new java.lang.IllegalArgumentException("A malformed URL has occured");
79             }
80         }
81         
82         return ((url == null) ? "" : url.toString());
83         */

84     }
85
86 }
87
Popular Tags