cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r365629 - in /cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal: coplet/ event/impl/ layout/ pluto/ pluto/adapter/
Date Tue, 03 Jan 2006 13:42:00 GMT
Author: cziegeler
Date: Tue Jan  3 05:41:50 2006
New Revision: 365629

URL: http://svn.apache.org/viewcvs?rev=365629&view=rev
Log:
Add comments and finish TCK support

Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java Tue
Jan  3 05:41:50 2006
@@ -39,6 +39,7 @@
      * @param id The unique id of the object.
      */
     public CopletBaseData(String id) {
+        // TODO - Check for valid id's
         this.id = id;
     }
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java Tue Jan
 3 05:41:50 2006
@@ -51,6 +51,7 @@
      * @param id The unique id of the object.
      */
     public CopletData(String id) {
+        // TODO - Check for valid id's
         this.id = id;
     }
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
Tue Jan  3 05:41:50 2006
@@ -72,6 +72,7 @@
      * @param id The unique id of the object.
 	 */
 	public CopletInstanceData(String id) {
+        // TODO - Check for valid id's
         this.id = id;
 	}
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
Tue Jan  3 05:41:50 2006
@@ -132,10 +132,13 @@
      * @see org.apache.cocoon.portal.event.EventConverter#decode(java.lang.String)
      */
     public Event decode(String value) {
+try {
         if (value != null) {
+            System.out.println("Decoding: " + value);
             // Is this a convertable event?
             int pos = value.indexOf(':');
             if ( pos > 1 ) {
+                System.out.println("Convertable");
                 final String hashKey = value.substring(0, pos);
                 final String data = value.substring(pos+1);
                 Object o = this.factories.get(hashKey);
@@ -152,14 +155,18 @@
                     try {
                         return (Event)c.newInstance(new Object[] {this.portalService, data});
                     } catch (InstantiationException ie) {
+                        ie.printStackTrace();
                         // we ignore this
                     } catch (InvocationTargetException ite) {
+                        ite.printStackTrace();
                         // we ignore this                    
                     } catch (IllegalAccessException iae) {
+                        iae.printStackTrace();
                         // we ignore this                    
                     }
                 }
             }
+            System.out.println("Search in list");
             List list = (List)this.portalService.getAttribute(EVENT_LIST);
             if ( null != list ) {
                 int index = new Integer(value).intValue();
@@ -167,7 +174,11 @@
                     return (Event)list.get(index);
                 }
             }
+            System.out.println("NOT FOUND");
         }
+} catch (Exception any) {
+    any.printStackTrace();
+}
         return null;
     }
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java Tue
Jan  3 05:41:50 2006
@@ -63,6 +63,7 @@
      * @param name The name of the layout.
      */
     public AbstractLayout(String id, String name) {
+        // TODO - Check for valid id's
         this.id = id;
         this.name = name;
     }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java Tue Jan  3
05:41:50 2006
@@ -18,7 +18,13 @@
 import java.util.Map;
 
 /**
- * 
+ * TODO - Convert this in an abstract class which all implementations
+ * have to extend (we can use AbstractLayout for this).
+ *
+ * A layout describes a graphical element on the portal page. This can
+ * be an element containing others ({@link CompositeLayout}) or a final
+ * element, like a window for a coplet.
+ *
  * Parameters and temporary attributes:
  * A parameter is a key-value pair consisting of strings for
  * both key and value. While the parameters are persisted,

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/TestProfileManager.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
Tue Jan  3 05:41:50 2006
@@ -21,10 +21,15 @@
 
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.event.user.UserEvent;
+import org.apache.cocoon.portal.event.user.UserIsAccessingEvent;
 import org.apache.cocoon.portal.layout.CompositeLayout;
 import org.apache.cocoon.portal.layout.Item;
+import org.apache.cocoon.portal.layout.LayoutException;
 import org.apache.cocoon.portal.layout.impl.CompositeLayoutImpl;
 import org.apache.cocoon.portal.layout.impl.CopletLayout;
 import org.apache.cocoon.portal.profile.PortalUser;
@@ -83,10 +88,11 @@
                 final CopletData cd = (CopletData)i.next();
                 // check for portlets
                 if ( "portlet".equals(cd.getCopletBaseData().getCopletAdapterName()) ) {
+                    final String id = StringUtils.replaceChars(cd.getId() + "-1", '_', '-');
+                    final CopletInstanceData cid = new CopletInstanceData(id);
+                    cid.setCopletData(cd);
+                    instances.add(cid);
                     if ( portletNames.size() == 0 || portletNames.contains(cd.getId())) {
-                        final CopletInstanceData cid = new CopletInstanceData(cd.getId()
+ "-1");
-                        cid.setCopletData(cd);
-                        instances.add(cid);
                         final CopletLayout copletLayout = new CopletLayout(null, "coplet");
                         copletLayout.setCopletInstanceData(cid);
                         copletLayout.setLayoutRendererName("portlet-window");
@@ -106,6 +112,51 @@
             return profile;
         } else {
             return super.loadProfile(layoutKey);
+        }
+    }
+
+    /**
+     * Receives any user related event and invokes login, logout etc.
+     * @see Receiver
+     */
+    public void inform(UserEvent event, PortalService service) {
+        super.inform(event, service);
+        if ( event instanceof UserIsAccessingEvent ) {
+            if ( "test".equals(event.getPortalUser().getUserName()) ) {
+                final List portletNames = new ArrayList();
+                final Request r = ObjectModelHelper.getRequest(this.portalService.getObjectModel());
+                final String[] values = r.getParameterValues("portletName");
+                if ( values != null && values.length > 0 ) {
+                    for(int i=0; i<values.length; i++) {
+                        portletNames.add(StringUtils.replaceChars(values[i], '/', '.'));
+                    }
+                }
+                if ( portletNames.size() > 0 ) {
+                    final CompositeLayout rootLayout = (CompositeLayout)this.getPortalLayout(null,
null);
+                    // we only remove items and their layout but not the coplet instances
+                    while ( rootLayout.getItems().size() > 0 ) {
+                        rootLayout.removeItem(rootLayout.getItem(0));
+                    }
+                    // create new set
+                    final Iterator i = this.getCopletInstanceDatas().iterator();
+                    while ( i.hasNext() ) {
+                        final CopletInstanceData cid = (CopletInstanceData)i.next();
+                        if ( portletNames.contains(cid.getCopletData().getId())) {
+                            final CopletLayout copletLayout = new CopletLayout(null, "coplet");
+                            copletLayout.setCopletInstanceData(cid);
+                            copletLayout.setLayoutRendererName("portlet-window");
+                            final Item item = new Item();
+                            item.setLayout(copletLayout);
+                            rootLayout.addItem(item);
+                            try {
+                                 this.prepareObject(copletLayout);
+                            } catch (LayoutException le) {
+                                // ignore this
+                            }
+                        }
+                    }
+                }
+            }
         }
     }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java?rev=365629&r1=365628&r2=365629&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
Tue Jan  3 05:41:50 2006
@@ -79,7 +79,7 @@
 public class PortletAdapter 
     extends AbstractCopletAdapter
     implements PortalManagerAspect, Receiver, Parameterizable {
-	
+
     /** The servlet configuration for pluto. */
     protected ServletConfig servletConfig;
 
@@ -314,7 +314,6 @@
         }
         objectModel.put("portlet-response",  res);
         objectModel.put("portlet-request", req);        
-
         if ( event.isAction() ) {
             // This means we can only have ONE portlet event per request!
             objectModel.put("portlet-event", event);



Mime
View raw message