KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > knowgate > http > portlets > HipergatePortletContext


1 /*
2   Copyright (C) 2003-2006 Know Gate S.L. All rights reserved.
3                            C/Oņa, 107 1š2 28050 Madrid (Spain)
4
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions
7   are met:
8
9   1. Redistributions of source code must retain the above copyright
10      notice, this list of conditions and the following disclaimer.
11
12   2. The end-user documentation included with the redistribution,
13      if any, must include the following acknowledgment:
14      "This product includes software parts from hipergate
15      (http://www.hipergate.org/)."
16      Alternately, this acknowledgment may appear in the software itself,
17      if and wherever such third-party acknowledgments normally appear.
18
19   3. The name hipergate must not be used to endorse or promote products
20      derived from this software without prior written permission.
21      Products derived from this software may not be called hipergate,
22      nor may hipergate appear in their name, without prior written
23      permission.
24
25   This library is distributed in the hope that it will be useful,
26   but WITHOUT ANY WARRANTY; without even the implied warranty of
27   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28
29   You should have received a copy of hipergate License with this code;
30   if not, visit http://www.hipergate.org or mail to info@hipergate.org
31 */

32
33 package com.knowgate.http.portlets;
34
35 import java.io.InputStream JavaDoc;
36
37 import java.net.URL JavaDoc;
38
39 import java.util.Set JavaDoc;
40 import java.util.Hashtable JavaDoc;
41 import java.util.Properties JavaDoc;
42 import java.util.Enumeration JavaDoc;
43
44 import javax.portlet.PortletContext;
45 import javax.portlet.PortletRequestDispatcher;
46
47 import com.knowgate.debug.*;
48
49 /**
50  * @author Sergio Montoro Ten
51  * @version 0.1
52  */

53
54 public class HipergatePortletContext implements PortletContext {
55
56   private Hashtable JavaDoc oAttribs;
57   private Properties JavaDoc oParams;
58
59   public HipergatePortletContext() {
60     oAttribs = new Hashtable JavaDoc();
61     oParams = new Properties JavaDoc();
62   }
63
64   public Object JavaDoc getAttribute (String JavaDoc sAttributeName) {
65     return oAttribs.get(sAttributeName);
66   }
67
68   public Enumeration JavaDoc getAttributeNames () {
69     return oAttribs.keys();
70   }
71
72   public String JavaDoc getInitParameter(String JavaDoc sParameterName) {
73     return oParams.getProperty(sParameterName);
74   }
75
76   public Enumeration JavaDoc getInitParameterNames() {
77     return oParams.keys();
78   }
79
80   public int getMajorVersion() {
81     return 1;
82   }
83
84   public int getMinorVersion() {
85     return 0;
86   }
87
88   public String JavaDoc getMimeType(String JavaDoc sFile) {
89     throw new UnsupportedOperationException JavaDoc("Method getMimeType() not implemented by HipergatePortletContext");
90   }
91
92   public PortletRequestDispatcher getNamedDispatcher(String JavaDoc sName) {
93     throw new UnsupportedOperationException JavaDoc("Method getNamedDispatcher() not implemented by HipergatePortletContext");
94   }
95
96   public PortletRequestDispatcher getRequestDispatcher(String JavaDoc sPath) {
97     throw new UnsupportedOperationException JavaDoc("Method getRequestDispatcher() not implemented by HipergatePortletContext");
98   }
99
100   public String JavaDoc getPortletContextName() {
101     throw new UnsupportedOperationException JavaDoc("Method getPortletContextName() not implemented by HipergatePortletContext");
102   }
103
104   public String JavaDoc getRealPath(String JavaDoc sPath) {
105     throw new UnsupportedOperationException JavaDoc("Method getRealPath() not implemented by HipergatePortletContext");
106   }
107
108   public URL JavaDoc getResource(String JavaDoc sPath) {
109     throw new UnsupportedOperationException JavaDoc("Method getResource() not implemented by HipergatePortletContext");
110   }
111
112   public Set JavaDoc getResourcePaths (String JavaDoc sPath) {
113     throw new UnsupportedOperationException JavaDoc("Method getResourcePaths() not implemented by HipergatePortletContext");
114   }
115
116   public InputStream JavaDoc getResourceAsStream(String JavaDoc sPath) {
117     throw new UnsupportedOperationException JavaDoc("Method getResourceAsStream() not implemented by HipergatePortletContext");
118   }
119
120   public String JavaDoc getServerInfo() {
121     return "hipergate Portlet Container Emulator";
122   }
123
124   public void log (String JavaDoc sMsg) {
125     DebugFile.writeln(sMsg);
126   }
127
128   public void log (String JavaDoc sMsg, Throwable JavaDoc oXcpt) {
129     DebugFile.writeln(sMsg);
130     new ErrorHandler(oXcpt);
131   }
132
133   public void removeAttribute (String JavaDoc sName) {
134     oAttribs.remove(sName);
135   }
136
137   public void setAttribute (String JavaDoc sName, Object JavaDoc oAttr) {
138     oAttribs.put(sName, oAttr);
139   }
140 }
141
Popular Tags