Author: alexsmirnov
Date: 2007-04-10 13:48:21 -0400 (Tue, 10 Apr 2007)
New Revision: 62
Added:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/EnumerationIterator.java
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextWrapper.java
Log:
Continue work for portlet integration
Added:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java
===================================================================
---
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java
(rev 0)
+++
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java 2007-04-10
17:48:21 UTC (rev 62)
@@ -0,0 +1,48 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.context;
+
+/**
+ * Abstract base class for all attributes/sessions/cookies maps in external contexts.
+ * @author asmirnov
+ *
+ */
+public abstract class ContextAttributesMap extends ContextMap {
+
+ public Object get(Object key) {
+ if(null == key){
+ throw new NullPointerException();
+ }
+ return getAttribute(key.toString());
+ }
+
+ public Object put(Object key, Object value) {
+ if(null == key){
+ throw new NullPointerException();
+ }
+ String stringKey = key.toString();
+ Object oldValue = getAttribute(stringKey);
+ setAttribute(stringKey, value);
+ return oldValue;
+ }
+
+ public Object remove(Object key) {
+ if(null == key){
+ throw new NullPointerException();
+ }
+ return removeAttribute(key.toString());
+ }
+
+
+ protected abstract Object getAttribute(String name);
+
+ protected abstract void setAttribute(String name, Object value);
+
+ protected Object removeAttribute(String name){
+ Object oldValue = getAttribute(name);
+ setAttribute(name, null);
+ return oldValue;
+ }
+
+}
Added:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/EnumerationIterator.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/EnumerationIterator.java
(rev 0)
+++
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/EnumerationIterator.java 2007-04-10
17:48:21 UTC (rev 62)
@@ -0,0 +1,37 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.context;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+class EnumerationIterator implements Iterator {
+
+ public EnumerationIterator(Enumeration enumeration) {
+
+ this.enumeration = enumeration;
+
+ }
+
+ private Enumeration enumeration;
+
+ public boolean hasNext() {
+
+ return enumeration.hasMoreElements();
+
+ }
+
+ public Object next() {
+
+ return enumeration.nextElement();
+
+ }
+
+ public void remove() {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+}
\ No newline at end of file
Added:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextWrapper.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextWrapper.java
(rev 0)
+++
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextWrapper.java 2007-04-10
17:48:21 UTC (rev 62)
@@ -0,0 +1,196 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.context;
+
+import java.util.Iterator;
+
+import javax.el.ELContext;
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseStream;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class FacesContextWrapper extends FacesContext {
+
+ private FacesContext _wrapped;
+
+ public FacesContextWrapper(FacesContext _wrapped) {
+ super();
+ this._wrapped = _wrapped;
+ setCurrentInstance(this);
+ }
+
+ /**
+ * @param clientId
+ * @param message
+ * @see javax.faces.context.FacesContext#addMessage(java.lang.String,
javax.faces.application.FacesMessage)
+ */
+ public void addMessage(String clientId, FacesMessage message) {
+ _wrapped.addMessage(clientId, message);
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getApplication()
+ */
+ public Application getApplication() {
+ return _wrapped.getApplication();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getClientIdsWithMessages()
+ */
+ public Iterator getClientIdsWithMessages() {
+ return _wrapped.getClientIdsWithMessages();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getELContext()
+ */
+ public ELContext getELContext() {
+ return _wrapped.getELContext();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getExternalContext()
+ */
+ public ExternalContext getExternalContext() {
+ return _wrapped.getExternalContext();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getMaximumSeverity()
+ */
+ public Severity getMaximumSeverity() {
+ return _wrapped.getMaximumSeverity();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getMessages()
+ */
+ public Iterator getMessages() {
+ return _wrapped.getMessages();
+ }
+
+ /**
+ * @param clientId
+ * @return
+ * @see javax.faces.context.FacesContext#getMessages(java.lang.String)
+ */
+ public Iterator getMessages(String clientId) {
+ return _wrapped.getMessages(clientId);
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getRenderKit()
+ */
+ public RenderKit getRenderKit() {
+ return _wrapped.getRenderKit();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getRenderResponse()
+ */
+ public boolean getRenderResponse() {
+ return _wrapped.getRenderResponse();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getResponseComplete()
+ */
+ public boolean getResponseComplete() {
+ return _wrapped.getResponseComplete();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getResponseStream()
+ */
+ public ResponseStream getResponseStream() {
+ return _wrapped.getResponseStream();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getResponseWriter()
+ */
+ public ResponseWriter getResponseWriter() {
+ return _wrapped.getResponseWriter();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.context.FacesContext#getViewRoot()
+ */
+ public UIViewRoot getViewRoot() {
+ return _wrapped.getViewRoot();
+ }
+
+ /**
+ *
+ * @see javax.faces.context.FacesContext#release()
+ */
+ public void release() {
+ _wrapped.release();
+ _wrapped = null;
+ }
+
+ /**
+ *
+ * @see javax.faces.context.FacesContext#renderResponse()
+ */
+ public void renderResponse() {
+ _wrapped.renderResponse();
+ }
+
+ /**
+ *
+ * @see javax.faces.context.FacesContext#responseComplete()
+ */
+ public void responseComplete() {
+ _wrapped.responseComplete();
+ }
+
+ /**
+ * @param responseStream
+ * @see
javax.faces.context.FacesContext#setResponseStream(javax.faces.context.ResponseStream)
+ */
+ public void setResponseStream(ResponseStream responseStream) {
+ _wrapped.setResponseStream(responseStream);
+ }
+
+ /**
+ * @param responseWriter
+ * @see
javax.faces.context.FacesContext#setResponseWriter(javax.faces.context.ResponseWriter)
+ */
+ public void setResponseWriter(ResponseWriter responseWriter) {
+ _wrapped.setResponseWriter(responseWriter);
+ }
+
+ /**
+ * @param root
+ * @see javax.faces.context.FacesContext#setViewRoot(javax.faces.component.UIViewRoot)
+ */
+ public void setViewRoot(UIViewRoot root) {
+ _wrapped.setViewRoot(root);
+ }
+
+}
Show replies by date