You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by cz...@apache.org on 2007/07/24 10:22:24 UTC

svn commit: r558958 - in /portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver: ConsumerConfiguredPortletImpl.java PortletImpl.java ProducerOfferedPortletImpl.java

Author: cziegeler
Date: Tue Jul 24 01:22:23 2007
New Revision: 558958

URL: http://svn.apache.org/viewvc?view=rev&rev=558958
Log:
Fix ConsumerConfiguredPortletImpl#clone method - add comment do ProducerOfferedPortletImpl as this seems wrong, too.

Modified:
    portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ConsumerConfiguredPortletImpl.java
    portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/PortletImpl.java
    portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ProducerOfferedPortletImpl.java

Modified: portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ConsumerConfiguredPortletImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ConsumerConfiguredPortletImpl.java?view=diff&rev=558958&r1=558957&r2=558958
==============================================================================
--- portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ConsumerConfiguredPortletImpl.java (original)
+++ portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ConsumerConfiguredPortletImpl.java Tue Jul 24 01:22:23 2007
@@ -1,12 +1,12 @@
 /*
  * Copyright 2003-2005 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,14 +26,14 @@
  * @see     ConsumerConfiguredPortlet PortletImpl
  * @version $Id$
  */
-public class ConsumerConfiguredPortletImpl extends PortletImpl 
+public class ConsumerConfiguredPortletImpl extends PortletImpl
         implements ConsumerConfiguredPortlet {
-    
+
     /**
      * Portlet handle of the parent ProducerOfferedPortlet object
      */
     private String parentHandle = "";
-    
+
     /**
      * Sets the portlet handle of the parent ProducerOfferedPortlet.
      *
@@ -41,20 +41,20 @@
      *               parent ProducerOfferedPortlet.
      */
     public void setParentHandle(String handle) {
-        parentHandle = handle;
+        this.parentHandle = handle;
     }
-    
+
     /**
-     * Returns the portlet handle of the corresponding parent 
+     * Returns the portlet handle of the corresponding parent
      * ProducerOfferedPortlet.
      *
-     * @return String representing the portlet handle of the corresponding 
+     * @return String representing the portlet handle of the corresponding
      * parent ProducerOfferedPortlet.
      */
     public String getParentHandle() {
-        return parentHandle;
+        return this.parentHandle;
     }
-    
+
     /**
      * Redefines the clone-method of the Cloneable-interface. This is necessary
      * as the clone-method is declared protected in the Object class.
@@ -62,9 +62,9 @@
      * @return    Object representing the cloned object.
      */
     public Object clone() {
-        ConsumerConfiguredPortlet clone = new ConsumerConfiguredPortletImpl();
-        clone.setParentHandle(parentHandle);
+        ConsumerConfiguredPortlet clone = (ConsumerConfiguredPortletImpl)super.clone();
+        clone.setParentHandle(this.parentHandle);
         return clone;
     }
-    
+
 }

Modified: portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/PortletImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/PortletImpl.java?view=diff&rev=558958&r1=558957&r2=558958
==============================================================================
--- portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/PortletImpl.java (original)
+++ portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/PortletImpl.java Tue Jul 24 01:22:23 2007
@@ -31,10 +31,10 @@
  * @see     ProducerOfferedPortlet
  * @version $Id$
  */
-public abstract class PortletImpl implements Portlet, Serializable {
-    
+public abstract class PortletImpl implements Portlet, Serializable, Cloneable {
+
     private String handle = "";
-    
+
     /**
      * Returns the portletHandle.
      *
@@ -43,7 +43,7 @@
     public String getPortletHandle() {
         return this.handle;
     }
-    
+
     /**
      * Sets the portletHandle to enable identification of the portlet.
      *
@@ -52,13 +52,19 @@
     public void setPortletHandle(String portletHandle) {
         this.handle = portletHandle;
     }
-    
+
     /**
      * Redefines the clone-method of the Cloneable-interface. This is necessary
      * as the clone-method is declared protected in the Object class.
      *
      * @return    Object representing the cloned object.
      */
-    public abstract Object clone();
-    
+    public Object clone() {
+        try {
+            return super.clone();
+        } catch (CloneNotSupportedException ignore) {
+            return null;
+        }
+    }
+
 }

Modified: portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ProducerOfferedPortletImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ProducerOfferedPortletImpl.java?view=diff&rev=558958&r1=558957&r2=558958
==============================================================================
--- portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ProducerOfferedPortletImpl.java (original)
+++ portals/wsrp4j/trunk/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ProducerOfferedPortletImpl.java Tue Jul 24 01:22:23 2007
@@ -1,12 +1,12 @@
 /*
  * Copyright 2003-2005 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,25 +30,25 @@
  * @see     ProducerOfferedPortlet
  * @version $Id$
  */
-public class ProducerOfferedPortletImpl extends PortletImpl 
+public class ProducerOfferedPortletImpl extends PortletImpl
         implements ProducerOfferedPortlet {
-    
+
     // handle ID
     private String handle = "";
-    
+
     // boolean, if registration is required or not
     private boolean requiresRegistration = false;
-    
+
     // list of clone handles for this ProducerOfferedPortlet
     public LinkedList cloneHandles;
-    
+
     /**
      * constructor
      */
     public ProducerOfferedPortletImpl() {
-        cloneHandles = new LinkedList();
+        this.cloneHandles = new LinkedList();
     }
-    
+
     /**
      * Returns the portletHandle.
      *
@@ -57,7 +57,7 @@
     public String getPortletHandle() {
         return this.handle;
     }
-    
+
     /**
      * Returns a flag indicating whether registration is required or not.
      *
@@ -66,7 +66,7 @@
     public boolean isRegistrationRequired() {
         return this.requiresRegistration;
     }
-    
+
     /**
      * Sets the flag indicating whether registration is required or not.
      *
@@ -75,7 +75,7 @@
     public void setRegistrationRequired(boolean required) {
         this.requiresRegistration = required;
     }
-    
+
     /**
      * Sets the portletHandle to enable identification of the portlet.
      *
@@ -84,15 +84,15 @@
     public void setPortletHandle(String portletHandle) {
         this.handle = portletHandle;
     }
-    
+
     /**
      * Adds a clone referencing a ConsumerConfiguredPortlet.
      *
      */
     public void addClone(ConsumerConfiguredPortlet cce) {
-        cloneHandles.add(cce);
+        this.cloneHandles.add(cce);
     }
-    
+
     /**
      * Deletes a clone referencing a ConsumerConfiguredPortlet.
      *
@@ -100,18 +100,18 @@
      *                 corresponding ConsumerConfiguredPortlet.
      */
     public void deleteClone(ConsumerConfiguredPortlet cce) {
-        cloneHandles.remove(cce);
+        this.cloneHandles.remove(cce);
     }
-    
+
     /**
      * Returns an iterator containing all clone-handles.
      *
      * @return  Iterator
      */
     public Iterator getClones() {
-        return cloneHandles.iterator();
+        return this.cloneHandles.iterator();
     }
-    
+
     /**
      * Redefines the clone-method of the Cloneable-interface. This is necessary
      * as the clone-method is declared protected in the Object class.
@@ -119,12 +119,12 @@
      * @return    Object representing the cloned object.
      */
     public Object clone() {
-        
+        // TODO: Is it correct to construct a ConsumerConfiguredPortlet?
         ConsumerConfiguredPortlet clone = new ConsumerConfiguredPortletImpl();
-        
-        clone.setParentHandle(handle);
-        
+
+        clone.setParentHandle(this.handle);
+
         return clone;
     }
-    
+
 }