jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaqu...@apache.org
Subject svn commit: r762297 - /incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java
Date Mon, 06 Apr 2009 11:59:22 GMT
Author: ajaquith
Date: Mon Apr  6 11:59:21 2009
New Revision: 762297

URL: http://svn.apache.org/viewvc?rev=762297&view=rev
Log:
[JSPWIKI-304] Changed all Workflow signatures so that all attribute values are now Serializable.
This has required some minor changes to WikiContext get/setAttribute, such that these must
also be Serializable too. In practice this is not a problem, because all attributes passed
to WikiContext were always Strings anyway. The net effect of this change is that we can now
make workflows persistent across engine restarts! (Coming later...)

Modified:
    incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java?rev=762297&r1=762296&r2=762297&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java Mon Apr  6 11:59:21
2009
@@ -114,13 +114,20 @@
     /* (non-Javadoc)
      * @see org.apache.wiki.WikiPage#getAttribute(java.lang.String)
      */
-    public Object getAttribute( String key )
+    public Serializable getAttribute( String key )
     {
         try
         {
             Property property = getJCRNode().getProperty( key );
-            
-            return getValue( property );
+            Object value = getValue( property );
+            if ( value instanceof Serializable )
+            {
+                return (Serializable)value;
+            }
+            else
+            {
+                throw new IllegalStateException( "The value returned by " + key + " was not
a Serializalble, as expected.");
+            }
         }
         catch( ItemNotFoundException e ) {}
         catch( RepositoryException e ) {} // FIXME: Should log this at least.
@@ -178,7 +185,7 @@
     /* (non-Javadoc)
      * @see org.apache.wiki.WikiPage#getAttributes()
      */
-    public Map getAttributes() 
+    public Map<String,Serializable> getAttributes() 
     {
         return null; // FIXME: m_attributes;
     }
@@ -186,16 +193,22 @@
     /* (non-Javadoc)
      * @see org.apache.wiki.WikiPage#removeAttribute(java.lang.String)
      */
-    public Object removeAttribute( String key )
+    public Serializable removeAttribute( String key )
     {
         try
         {
             Property p = getJCRNode().getProperty( key );
             
             Object value = getValue(p);
-            p.remove();
-        
-            return value;
+            if ( value instanceof Serializable )
+            {
+                p.remove();
+                return (Serializable)value;
+            }
+            else
+            {
+                throw new IllegalStateException( "The value returned by " + key + " was not
a Serializalble, as expected.");
+            }
         }
         catch(RepositoryException e) {}
         
@@ -546,7 +559,7 @@
     }
 
  
-    public void setAttribute( String key, Object attribute )
+    public void setAttribute( String key, Serializable attribute )
     {
         // TODO Auto-generated method stub
         



Mime
View raw message