Author: scottbw
Date: Sun Oct 30 16:49:22 2011
New Revision: 1195191

URL: http://svn.apache.org/viewvc?rev=1195191&view=rev
Log:
Refactored several of the methods from "SharedDataHelper", 
"PropertiesController" and "ParticipantsController" into a single model facade 
class, SharedContext, encapsulating the concerns of participants and shared 
data. As well as removing some odd dependencies (e.g. between controllers) and 
a further abstraction from the persistence layer, this provides a means for 
handling storage of shared data differently from other types of data (e.g. 
using nosql and/or cloud storage) and I think makes it a bit easier to 
understand the Wookie domain model.

Added:
    incubator/wookie/trunk/src/org/apache/wookie/beans/SharedContext.java
Modified:
    
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
    
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/beans/AbstractPersistenceTest.java
    
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java
    
incubator/wookie/trunk/src/org/apache/wookie/beans/util/IPersistenceManager.java
    
incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java
    
incubator/wookie/trunk/src/org/apache/wookie/controller/PropertiesController.java
    
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
    incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java
    incubator/wookie/trunk/src/org/apache/wookie/feature/wave/WaveAPIImpl.java
    incubator/wookie/trunk/src/org/apache/wookie/helpers/SharedDataHelper.java
    incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java
    
incubator/wookie/trunk/src/org/apache/wookie/queues/impl/SharedDataQueueConsumer.java

Modified: 
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
 (original)
+++ 
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/JCRPersistenceManager.java
 Sun Oct 30 16:49:22 2011
@@ -14,8 +14,6 @@
 
 package org.apache.wookie.beans.jcr;
 
-import java.io.File;
-import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Array;
 import java.util.ArrayList;
@@ -34,13 +32,11 @@ import javax.jcr.SimpleCredentials;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.naming.Context;
 import javax.naming.InitialContext;
-import javax.naming.NamingException;
 
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.pool.BasePoolableObjectFactory;
 import org.apache.commons.pool.PoolableObjectFactory;
 import org.apache.commons.pool.impl.GenericObjectPool;
-import org.apache.jackrabbit.core.TransientRepository;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
 import 
org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.DefaultAtomicTypeConverterProvider;
@@ -98,7 +94,6 @@ import org.apache.wookie.beans.jcr.impl.
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceCommitException;
 
-import org.mortbay.jetty.plus.naming.Resource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -829,67 +824,6 @@ public class JCRPersistenceManager imple
     }
 
     /* (non-Javadoc)
-     * @see 
org.apache.wookie.beans.util.IPersistenceManager#findParticipants(org.apache.wookie.beans.IWidgetInstance)
-     */
-    public IParticipant[] findParticipants(IWidgetInstance widgetInstance)
-    {
-        // validate object content manager transaction
-        if (ocm == null)
-        {
-            throw new IllegalStateException("Transaction not initiated or 
already closed");
-        }
-
-        // get participants for widget instance
-        if (widgetInstance != null)
-        {
-            try
-            {
-                Map<String, Object> values = new HashMap<String, Object>();
-                values.put("sharedDataKey", widgetInstance.getSharedDataKey());
-                return findByValues(IParticipant.class, values);
-            }
-            catch (Exception e)
-            {
-                logger.error("Unexpected exception: "+e, e);
-            }
-        }
-        return new IParticipant[0];
-    }
-
-    /* (non-Javadoc)
-     * @see 
org.apache.wookie.beans.util.IPersistenceManager#findParticipantViewer(org.apache.wookie.beans.IWidgetInstance)
-     */
-    public IParticipant findParticipantViewer(IWidgetInstance widgetInstance)
-    {
-        // validate object content manager transaction
-        if (ocm == null)
-        {
-            throw new IllegalStateException("Transaction not initiated or 
already closed");
-        }
-
-        // get participant viewer for widget instance
-        if (widgetInstance != null)
-        {
-            try
-            {
-                Map<String, Object> values = new HashMap<String, Object>();
-                values.put("sharedDataKey", widgetInstance.getSharedDataKey());
-                values.put("participantId", widgetInstance.getUserId());
-                IParticipant [] participantViewer = 
findByValues(IParticipant.class, values);
-                if (participantViewer.length == 1)
-                {
-                    return participantViewer[0];
-                }
-            }
-            catch (Exception e)
-            {
-                logger.error("Unexpected exception: "+e, e);
-            }
-        }
-        return null;
-    }
-
-    /* (non-Javadoc)
      * @see 
org.apache.wookie.beans.util.IPersistenceManager#findWidgetByGuid(java.lang.String)
      */
     public IWidget findWidgetByGuid(String guid)

Modified: 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/beans/AbstractPersistenceTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/beans/AbstractPersistenceTest.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/beans/AbstractPersistenceTest.java
 (original)
+++ 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/beans/AbstractPersistenceTest.java
 Sun Oct 30 16:49:22 2011
@@ -29,6 +29,7 @@ import org.apache.wookie.beans.IWidget;
 import org.apache.wookie.beans.IWidgetDefault;
 import org.apache.wookie.beans.IWidgetInstance;
 import org.apache.wookie.beans.IWidgetService;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
 
@@ -276,18 +277,12 @@ public abstract class AbstractPersistenc
         //
         // Get the participant created in the previous transaction by widget 
instance
         //
-        IParticipant [] participants = 
persistenceManager.findParticipants(widgetInstance0);
+       
+        IParticipant [] participants =  new 
SharedContext(widgetInstance0).getParticipants();
         assertNotNull(participants);
         assertEquals(1, participants.length);
         
         //
-        // Get the participant created in the previous transaction by finding 
the viewer
-        //
-        participant = 
persistenceManager.findParticipantViewer(widgetInstance0);
-        assertNotNull(participant);
-        assertEquals(participants[0], participant);
-        
-        //
         // Get the access request created in the previous transaction
         //
         IAccessRequest [] accessRequests = 
persistenceManager.findAll(IAccessRequest.class);

Added: incubator/wookie/trunk/src/org/apache/wookie/beans/SharedContext.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/SharedContext.java?rev=1195191&view=auto
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/beans/SharedContext.java 
(added)
+++ incubator/wookie/trunk/src/org/apache/wookie/beans/SharedContext.java Sun 
Oct 30 16:49:22 2011
@@ -0,0 +1,283 @@
+/*
+ * 
+ * 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.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+package org.apache.wookie.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.wookie.beans.util.IPersistenceManager;
+import org.apache.wookie.beans.util.PersistenceManagerFactory;
+import org.apache.wookie.helpers.SharedDataHelper;
+
+/**
+ * Represents the shared context for a set of widget instances
+ * and the data objects that share that context (participants and data).
+ * 
+ * Instances of this class are (currently) a "virtual" object rather than 
persisted, 
+ * and are used to tie together the common objects of the shared context at
+ * a higher level of abstraction than specific data queries. 
+ * 
+ * In future this class could be used to reference other types of data 
associated 
+ * with a shared context, for example to handle host/owner (see WOOKIE-66) or
+ * could allow us to have a storage model for shared data that is completely
+ * separate from the persistence model for the rest of Wookie, for example a
+ * tuple store or distributed keystore
+ */
+public class SharedContext {
+  
+  private String sharedDataKey;
+  
+  public SharedContext(String sharedDataKey){
+    this.sharedDataKey = sharedDataKey; 
+  }
+  
+  public SharedContext(IWidgetInstance widgetInstance){
+    //
+    // Use the internal shared data key of the instance
+    //
+    this.sharedDataKey = 
SharedDataHelper.getInternalSharedDataKey(widgetInstance);
+  }
+  
+  /**
+   * get the shared data belonging to this shared context
+   * @return an array of SharedData instances, or null if no shared data exists
+   */
+  public ISharedData[] getSharedData(){
+    //
+    // Obtain a persistence manager and return the results of executing a 
query of SharedData objects matching the sharedDataKey
+    //
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    return (ISharedData[]) persistenceManager.findByValue(ISharedData.class, 
"sharedDataKey", this.sharedDataKey);
+  }
+  
+  /**
+   * Find a specific shared data object for a given Widget Instance and object 
key
+   * @param instance the widget instance
+   * @param key the key of the shared data object, i.e. the tuple key not the 
shared data key
+   * @return a SharedData object, or null if no matches are found
+   */
+  public ISharedData getSharedData(String key){
+    
+    //
+    // Obtain a persistence manager and construct a query of SharedData 
objects matching the sharedDataKey and dkey
+    //
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    HashMap<String, Object> params = new HashMap<String, Object>();
+    params.put("sharedDataKey", this.sharedDataKey);
+    params.put("dkey", key);
+    
+    //
+    // Execute the query and obtain array of results
+    // We assert that there are never duplicates.
+    //
+    ISharedData[] results = (ISharedData[]) 
persistenceManager.findByValues(ISharedData.class, params);
+    assert(results.length <= 1);
+    
+    //
+    // If the result contains a single item, return it, otherwise return null.
+    //
+    if (results.length != 0) return results[0];
+    return null;
+  }
+  
+  /**
+   * Remove a single Shared Data Object
+   * @param name the name (key) of the data object
+   * @return true if a shared data object was located and deleted, false if no 
match was found
+   */
+  public boolean removeSharedData(String name){
+    //
+    // Find a matching item
+    //
+    ISharedData sharedData = this.getSharedData(name);
+    
+    //
+    // If a match is found, delete it and return true; 
+    // otherwise return false
+    //
+    if (sharedData == null) return false;
+    this.removeSharedData(sharedData);
+    return true;
+  }
+  
+  /**
+   * Removes (deletes) the shared data object
+   * @param sharedData
+   */
+  private void removeSharedData(ISharedData sharedData){
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    persistenceManager.delete(sharedData);
+  }
+  
+  /**
+   * Creates a new shared data object in this shared context
+   * @param name
+   * @param value
+   */
+  private void addSharedData(String name, String value){
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    ISharedData sharedData = persistenceManager.newInstance(ISharedData.class);
+    sharedData.setSharedDataKey(this.sharedDataKey);
+    sharedData.setDkey(name);
+    sharedData.setDvalue(value);
+    persistenceManager.save(sharedData);
+  }
+  
+  /**
+   * Update a single Shared Data object
+   * @param name the name (key) of the data object
+   * @param value the value to set, or null to clear the entry
+   * @param append set to true to append the value to the current value
+   * @return true if the value was updated, false if a new object was created
+   */
+  public boolean updateSharedData(String name, String value, boolean append){
+    boolean found=false;
+    ISharedData sharedData = this.getSharedData(name);
+    
+    //
+    // An existing object is found, so either update or delete
+    //
+    if (sharedData != null) {
+      
+      //
+      // If the value is set to Null, remove the object
+      //
+      if(value==null || value.equalsIgnoreCase("null")) {
+        this.removeSharedData(sharedData);
+      } else {  
+        
+        //
+        // Either append the new value to the old, or overwrite it
+        //
+        if(append) {
+          sharedData.setDvalue(sharedData.getDvalue() + value);
+        } else {
+          sharedData.setDvalue(value);
+        }
+      }
+      found=true;
+    }
+    
+    //
+    // No matching object exists, so create a new object
+    //
+    if(!found && value != null && !value.equalsIgnoreCase("null")){  
+        addSharedData(name, value);
+    }
+    return found;
+  }
+  
+  /**
+   * get the participants belonging to this shared context
+   * @return an arry of Participant instances, or null if there are no 
participants
+   */
+  public IParticipant[] getParticipants(){
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    return persistenceManager.findByValue(IParticipant.class, "sharedDataKey", 
this.sharedDataKey);
+  }
+  
+  /**
+   * Add a participant to a shared context
+   * @param participantId the id property of the participant to add
+   * @param participantDisplayName the display name property of the 
participant to add
+   * @param participantThumbnailUrl the thumbnail url property of the 
participant to add
+   * @return true if the participant was successfully added, otherwise false
+   */
+  public boolean addParticipant(String participantId, String 
participantDisplayName, String participantThumbnailUrl) {
+
+    //
+    // Does participant already exist?
+    //
+    IParticipant participant = this.getParticipant(participantId);
+    if (participant != null) return false;
+    
+    //
+    // Add participant
+    //
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    participant = persistenceManager.newInstance(IParticipant.class);
+    participant.setParticipantId(participantId);
+    participant.setParticipantDisplayName(participantDisplayName);
+    participant.setParticipantThumbnailUrl(participantThumbnailUrl);
+    participant.setSharedDataKey(this.sharedDataKey);
+    persistenceManager.save(participant);
+    return true;
+  }
+
+  /**
+   * Remove a participant from the shared context
+   * @param participant
+   */
+  public void removeParticipant(IParticipant participant){
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    persistenceManager.delete(participant);
+  }
+  
+  /**
+   * Removes a participant from a widget instance
+   * @param participantId the id property of the participant
+   * @return true if the participant is successfully removed, otherwise false
+   */
+  public boolean removeParticipant(String participantId) {
+
+    //
+    // Does participant exist?
+    //
+    IParticipant participant = this.getParticipant(participantId);
+    if (participant != null){
+     
+      //
+      // Remove participant
+      //
+      removeParticipant(participant);
+      return true;
+    } else {
+      return false;
+    }
+  }
+  
+  /**
+   * Get a participant by ID from this shared context
+   * @param participantId
+   * @return the participant, or null if there is no participant with the 
given id in the context
+   */
+  public IParticipant getParticipant(String participantId){
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    Map<String, Object> map = new HashMap<String, Object>();
+    map.put("sharedDataKey", this.sharedDataKey);//$NON-NLS-1$
+    map.put("participantId", participantId);//$NON-NLS-1$
+    IParticipant[] participants = 
persistenceManager.findByValues(IParticipant.class, map);
+    if (participants.length == 1) return participants[0];
+    return null;     
+  }
+  
+  /**
+   * Get the participant associated with the widget instance as the viewer
+   * @param widgetInstance
+   * @return the IParticipant representing the viewer, or null if no match is 
found
+   */
+  public IParticipant getViewer(IWidgetInstance widgetInstance){
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    Map<String, Object> map = new HashMap<String, Object>();
+    map.put("sharedDataKey", this.sharedDataKey);//$NON-NLS-1$
+    map.put("participantId", widgetInstance.getUserId());//$NON-NLS-1$
+    IParticipant [] participants = 
persistenceManager.findByValues(IParticipant.class, map);
+    if(participants != null && participants.length == 1) return 
participants[0];
+    return null;
+  }
+}

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java
 (original)
+++ 
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java
 Sun Oct 30 16:49:22 2011
@@ -92,7 +92,6 @@ import org.apache.wookie.beans.jpa.impl.
 import org.apache.wookie.beans.jpa.impl.WidgetTypeImpl;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceCommitException;
-import org.apache.wookie.helpers.SharedDataHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -667,74 +666,6 @@ public class JPAPersistenceManager imple
     }
 
     /* (non-Javadoc)
-     * @see 
org.apache.wookie.beans.util.IPersistenceManager#findParticipants(org.apache.wookie.beans.IWidgetInstance)
-     */
-    @SuppressWarnings("unchecked")
-    public IParticipant[] findParticipants(IWidgetInstance widgetInstance)
-    {
-        // validate entity manager transaction
-        if (entityManager == null)
-        {
-            throw new IllegalStateException("Transaction not initiated or 
already closed");
-        }        
-
-        // get participants for widget instance using custom query
-        if (widgetInstance != null)
-        {
-            try
-            {
-                String sharedDataKey = 
SharedDataHelper.getInternalSharedDataKey(widgetInstance);
-                Query query = entityManager.createNamedQuery("PARTICIPANTS");
-                query.setParameter("sharedDataKey", sharedDataKey);
-                List<IParticipant> participantsList = query.getResultList();
-                if ((participantsList != null) && !participantsList.isEmpty())
-                {
-                    return participantsList.toArray(new 
IParticipant[participantsList.size()]);
-                }
-            }
-            catch (Exception e)
-            {
-                logger.error("Unexpected exception: "+e, e);
-            }
-        }
-        return new IParticipant[0];
-    }
-
-    /* (non-Javadoc)
-     * @see 
org.apache.wookie.beans.util.IPersistenceManager#findParticipantViewer(org.apache.wookie.beans.IWidgetInstance)
-     */
-    public IParticipant findParticipantViewer(IWidgetInstance widgetInstance)
-    {
-        // validate entity manager transaction
-        if (entityManager == null)
-        {
-            throw new IllegalStateException("Transaction not initiated or 
already closed");
-        }        
-
-        // get participant viewer for widget instance using custom query
-        if (widgetInstance != null)
-        {
-            try
-            {
-                String sharedDataKey = 
SharedDataHelper.getInternalSharedDataKey(widgetInstance);
-                String userId = widgetInstance.getUserId();
-                Query query = 
entityManager.createNamedQuery("PARTICIPANT_VIEWER");
-                query.setParameter("sharedDataKey", sharedDataKey);
-                query.setParameter("userId", userId);
-                return (IParticipant)query.getSingleResult();
-            }
-            catch (NoResultException nre)
-            {
-            }
-            catch (Exception e)
-            {
-                logger.error("Unexpected exception: "+e, e);
-            }
-        }
-        return null;
-    }
-
-    /* (non-Javadoc)
      * @see 
org.apache.wookie.beans.util.IPersistenceManager#findWidgetByGuid(java.lang.String)
      */
     public IWidget findWidgetByGuid(String guid)

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/beans/util/IPersistenceManager.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/util/IPersistenceManager.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src/org/apache/wookie/beans/util/IPersistenceManager.java
 (original)
+++ 
incubator/wookie/trunk/src/org/apache/wookie/beans/util/IPersistenceManager.java
 Sun Oct 30 16:49:22 2011
@@ -18,7 +18,6 @@ import java.util.Map;
 
 import org.apache.wookie.beans.IAccessRequest;
 import org.apache.wookie.beans.IBean;
-import org.apache.wookie.beans.IParticipant;
 import org.apache.wookie.beans.IWidget;
 import org.apache.wookie.beans.IWidgetInstance;
 
@@ -198,22 +197,6 @@ public interface IPersistenceManager
     IWidgetInstance findWidgetInstanceByIdKey(String idKey);
     
     /**
-     * Custom widget instance IParticipant query.
-     * 
-     * @param widgetInstance widget instance query value
-     * @return retrieved matching IParticipant beans array or empty array if 
none found
-     */
-    IParticipant [] findParticipants(IWidgetInstance widgetInstance);
-    
-    /**
-     * Custom widget instance viewer IParticipant query.
-     * 
-     * @param widgetInstance widget instance query value
-     * @return retrieved IParticipant bean instance or null if not found
-     */
-    IParticipant findParticipantViewer(IWidgetInstance widgetInstance);
-    
-    /**
      * Custom name IAccessRequest query.
      * 
      * @param widget widget query value

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java
 (original)
+++ 
incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java
 Sun Oct 30 16:49:22 2011
@@ -15,8 +15,6 @@
 package org.apache.wookie.controller;
 
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -26,15 +24,13 @@ import javax.servlet.http.HttpSession;
 import org.apache.log4j.Logger;
 import org.apache.wookie.beans.IParticipant;
 import org.apache.wookie.beans.IWidgetInstance;
-import org.apache.wookie.beans.util.IPersistenceManager;
-import org.apache.wookie.beans.util.PersistenceManagerFactory;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.exceptions.InvalidParametersException;
 import org.apache.wookie.exceptions.ResourceDuplicationException;
 import org.apache.wookie.exceptions.ResourceNotFoundException;
 import org.apache.wookie.exceptions.UnauthorizedAccessException;
 import org.apache.wookie.helpers.Notifier;
 import org.apache.wookie.helpers.ParticipantHelper;
-import org.apache.wookie.helpers.SharedDataHelper;
 import org.apache.wookie.helpers.WidgetKeyManager;
 
 /**
@@ -77,8 +73,7 @@ public class ParticipantsController exte
                if (!WidgetKeyManager.isValidRequest(request)) throw new 
UnauthorizedAccessException();
                IWidgetInstance instance = 
WidgetInstancesController.findWidgetInstance(request);
                if (instance == null) throw new ResourceNotFoundException();
-               IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-               IParticipant[] participants = 
persistenceManager.findParticipants(instance);
+               IParticipant[] participants = new 
SharedContext(instance).getParticipants();
                
returnXml(ParticipantHelper.createXMLParticipantsDocument(participants), 
response);
        }
 
@@ -117,7 +112,7 @@ public class ParticipantsController exte
                        throw new InvalidParametersException();
                }
 
-               if (addParticipantToWidgetInstance(instance, participantId, 
participantDisplayName, participantThumbnailUrl)){
+               if (new SharedContext(instance).addParticipant(participantId, 
participantDisplayName, participantThumbnailUrl)){
                        Notifier.notifyWidgets(session, instance, 
Notifier.PARTICIPANTS_UPDATED);
                        _logger.debug("added user to widget instance: " + 
participantId);
                        return true;
@@ -141,61 +136,11 @@ public class ParticipantsController exte
                if (instance == null) throw new InvalidParametersException();
                HttpSession session = request.getSession(true);                 
                        
                String participantId = request.getParameter("participant_id"); 
//$NON-NLS-1$
-               if(removeParticipantFromWidgetInstance(instance, 
participantId)){
+               if(new 
SharedContext(instance).removeParticipant(participantId)){
                        Notifier.notifyWidgets(session, instance, 
Notifier.PARTICIPANTS_UPDATED);
                        return true;
                }else{
                        throw new ResourceNotFoundException();                  
        
                }
        }
-
-       /**
-        * Add a participant to a widget instance
-        * @param instance the widget instance
-        * @param participantId the id property of the participant to add
-        * @param participantDisplayName the display name property of the 
participant to add
-        * @param participantThumbnailUrl the thumbnail url property of the 
participant to add
-        * @return true if the participant was successfully added, otherwise 
false
-        */
-       public static boolean addParticipantToWidgetInstance(IWidgetInstance 
instance,
-                       String participantId, String participantDisplayName,
-                       String participantThumbnailUrl) {
-
-               // Does participant already exist?
-        IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-               Map<String, Object> map = new HashMap<String, Object>();
-               map.put("sharedDataKey", 
SharedDataHelper.getInternalSharedDataKey(instance));//$NON-NLS-1$
-               map.put("participantId", participantId);//$NON-NLS-1$
-               if (persistenceManager.findByValues(IParticipant.class, 
map).length != 0) return false;         
-
-               // Add participant
-               IParticipant participant = 
persistenceManager.newInstance(IParticipant.class);
-               participant.setParticipantId(participantId);
-               participant.setParticipantDisplayName(participantDisplayName);
-               participant.setParticipantThumbnailUrl(participantThumbnailUrl);
-               
participant.setSharedDataKey(SharedDataHelper.getInternalSharedDataKey(instance));
-               persistenceManager.save(participant);
-               return true;
-       }
-
-       /**
-        * Removes a participant from a widget instance
-        * @param instance the instance from which to remove the participant
-        * @param participantId the id property of the participant
-        * @return true if the participant is successfully removed, otherwise 
false
-        */
-       private static boolean 
removeParticipantFromWidgetInstance(IWidgetInstance instance,
-                       String participantId) {
-               IParticipant[] participants;
-               // Does participant exist?
-        IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-               Map<String, Object> map = new HashMap<String, Object>();
-               map.put("sharedDataKey", 
SharedDataHelper.getInternalSharedDataKey(instance));//$NON-NLS-1$
-               map.put("participantId", participantId);//$NON-NLS-1$
-               participants = 
persistenceManager.findByValues(IParticipant.class, map);
-               if (participants.length != 1) return false;     
-               // Remove participant
-               persistenceManager.delete(participants[0]);
-               return true;
-       }
 }
\ No newline at end of file

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/controller/PropertiesController.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/PropertiesController.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src/org/apache/wookie/controller/PropertiesController.java
 (original)
+++ 
incubator/wookie/trunk/src/org/apache/wookie/controller/PropertiesController.java
 Sun Oct 30 16:49:22 2011
@@ -24,8 +24,8 @@ import javax.servlet.http.HttpServletRes
 import org.apache.log4j.Logger;
 import org.apache.wookie.beans.IPreference;
 import org.apache.wookie.beans.ISharedData;
-import org.apache.wookie.beans.IWidget;
 import org.apache.wookie.beans.IWidgetInstance;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
 import org.apache.wookie.exceptions.InvalidParametersException;
@@ -33,7 +33,6 @@ import org.apache.wookie.exceptions.Reso
 import org.apache.wookie.exceptions.ResourceNotFoundException;
 import org.apache.wookie.exceptions.UnauthorizedAccessException;
 import org.apache.wookie.helpers.Notifier;
-import org.apache.wookie.helpers.SharedDataHelper;
 import org.apache.wookie.helpers.WidgetKeyManager;
 
 /**
@@ -92,7 +91,7 @@ public class PropertiesController extend
                // We let the shared data values override.
                IPreference pref = instance.getPreference(name);
                if (pref != null) value = pref.getDvalue();
-               ISharedData data = SharedDataHelper.findSharedData(instance, 
name);
+               ISharedData data = new 
SharedContext(instance).getSharedData(name);
                if (data != null) value = data.getDvalue();
                if (value == null) throw new ResourceNotFoundException();
                PrintWriter out = response.getWriter();
@@ -111,7 +110,7 @@ public class PropertiesController extend
                
                boolean found = false;
                if (isPublic(request)){ 
-                       found = updateSharedDataEntry(instance, name, null, 
false);
+                       found = new 
SharedContext(instance).removeSharedData(name);
                        Notifier.notifyWidgets(request.getSession(), instance, 
Notifier.STATE_UPDATED);
                } else {
                        found = updatePreference(instance, name, null);
@@ -151,7 +150,7 @@ public class PropertiesController extend
                if (name == null || name.trim().equals("")) throw new 
InvalidParametersException();
                
                if (isPublic(request)){ 
-                       updateSharedDataEntry(instance, name, value, false);
+                 new SharedContext(instance).updateSharedData(name, value, 
false);
                        Notifier.notifyWidgets(request.getSession(), instance, 
Notifier.STATE_UPDATED);
                } else {
                        updatePreference(instance, name, value);
@@ -189,48 +188,6 @@ public class PropertiesController extend
         persistenceManager.save(widgetInstance);
         return found;
        }
-       
-       /**
-        * Update a shared data entry
-        * @param widgetInstance
-        * @param name
-        * @param value
-        * @param append
-        * @return
-        */
-       public synchronized static boolean 
updateSharedDataEntry(IWidgetInstance widgetInstance, String name, String 
value, boolean append){
-               IWidget widget = widgetInstance.getWidget();
-        IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-        boolean found=false;
-        ISharedData sharedData = 
SharedDataHelper.findSharedData(widgetInstance, name);
-        if (sharedData != null)
-        {
-            if(value==null || value.equalsIgnoreCase("null")){ 
-               persistenceManager.delete(sharedData);
-            }
-            else{    
-                if(append){
-                    sharedData.setDvalue(sharedData.getDvalue() + value);
-                }
-                else{
-                    sharedData.setDvalue(value);
-                }
-            }
-            found=true;
-        }
-               if(!found){     
-                       if(value!=null){
-                               String sharedDataKey = 
SharedDataHelper.getInternalSharedDataKey(widgetInstance);               
-                               sharedData = 
persistenceManager.newInstance(ISharedData.class);
-                               sharedData.setSharedDataKey(sharedDataKey);
-                               sharedData.setDkey(name);
-                               sharedData.setDvalue(value);
-                               persistenceManager.save(sharedData);
-                       }
-               }
-        persistenceManager.save(widget);
-        return found;
-       }
 
        /// Utilities
        

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
 (original)
+++ 
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
 Sun Oct 30 16:49:22 2011
@@ -33,6 +33,7 @@ import org.apache.wookie.beans.ISharedDa
 import org.apache.wookie.beans.IStartFile;
 import org.apache.wookie.beans.IWidget;
 import org.apache.wookie.beans.IWidgetInstance;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
 import org.apache.wookie.exceptions.InvalidParametersException;
@@ -264,7 +265,7 @@ public class WidgetInstancesController e
                String cloneKey = 
SharedDataHelper.getInternalSharedDataKey(instance, cloneSharedDataKey);
         IWidget widget = instance.getWidget();
         IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-               for (ISharedData sharedData : 
SharedDataHelper.findSharedData(instance))
+               for (ISharedData sharedData : new 
SharedContext(instance).getSharedData())
                {
                    ISharedData clone = 
persistenceManager.newInstance(ISharedData.class);
             clone.setDkey(sharedData.getDkey());
@@ -277,17 +278,17 @@ public class WidgetInstancesController e
        }
        
        public synchronized static void lockWidgetInstance(IWidgetInstance 
instance){
-               PropertiesController.updateSharedDataEntry(instance, 
"isLocked", "true", false);//$NON-NLS-1$ //$NON-NLS-2$
+         new SharedContext(instance).updateSharedData("isLocked", "true", 
false); //$NON-NLS-1$ //$NON-NLS-2$
                instance.setLocked(true);
-        IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-        persistenceManager.save(instance);
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    persistenceManager.save(instance);
        }
 
        public synchronized static void unlockWidgetInstance(IWidgetInstance 
instance){
-               PropertiesController.updateSharedDataEntry(instance, 
"isLocked", "false", false);//$NON-NLS-1$ //$NON-NLS-2$
+         new SharedContext(instance).updateSharedData("isLocked", "false", 
false); //$NON-NLS-1$ //$NON-NLS-2$
                instance.setLocked(false);
-        IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-        persistenceManager.save(instance);
+    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
+    persistenceManager.save(instance);
        }
        
        // Utility methods

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java 
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java 
Sun Oct 30 16:49:22 2011
@@ -24,9 +24,9 @@ import org.apache.wookie.Messages;
 import org.apache.wookie.beans.IPreference;
 import org.apache.wookie.beans.ISharedData;
 import org.apache.wookie.beans.IWidgetInstance;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
-import org.apache.wookie.controller.PropertiesController;
 import org.apache.wookie.controller.WidgetInstancesController;
 import org.apache.wookie.helpers.Notifier;
 import org.apache.wookie.helpers.SharedDataHelper;
@@ -81,7 +81,7 @@ public class WookieAPIImpl implements IW
         IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
         IWidgetInstance widgetInstance = 
persistenceManager.findWidgetInstanceByIdKey(id_key);
     if (widgetInstance == null) return 
localizedMessages.getString("WidgetAPIImpl.0");
-    ISharedData data = SharedDataHelper.findSharedData(widgetInstance, key);
+    ISharedData data = new SharedContext(widgetInstance).getSharedData(key);
     if (data == null) return localizedMessages.getString("WidgetAPIImpl.1");
     return data.getDvalue();
   }
@@ -106,7 +106,7 @@ public class WookieAPIImpl implements IW
       QueueManager.getInstance().queueSetSharedDataRequest(id_key, 
SharedDataHelper.getInternalSharedDataKey(widgetInstance), key, value, false);
     }
     else{
-      PropertiesController.updateSharedDataEntry(widgetInstance, key, value, 
false);
+      new SharedContext(widgetInstance).updateSharedData(key, value, false);
     }
     Notifier.notifySiblings(widgetInstance);
     return "okay"; //$NON-NLS-1$
@@ -210,7 +210,7 @@ public class WookieAPIImpl implements IW
       QueueManager.getInstance().queueSetSharedDataRequest(id_key, 
SharedDataHelper.getInternalSharedDataKey(widgetInstance), key, value, true);
     }
     else{
-      PropertiesController.updateSharedDataEntry(widgetInstance, key, value, 
true);
+      new SharedContext(widgetInstance).updateSharedData(key, value, true);
     }
     Notifier.notifySiblings(widgetInstance);
     return "okay"; //$NON-NLS-1$

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/feature/wave/WaveAPIImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/feature/wave/WaveAPIImpl.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/feature/wave/WaveAPIImpl.java 
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/feature/wave/WaveAPIImpl.java 
Sun Oct 30 16:49:22 2011
@@ -23,13 +23,12 @@ import org.apache.wookie.Messages;
 import org.apache.wookie.beans.IParticipant;
 import org.apache.wookie.beans.ISharedData;
 import org.apache.wookie.beans.IWidgetInstance;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
-import org.apache.wookie.controller.PropertiesController;
 import org.apache.wookie.feature.IFeature;
 import org.apache.wookie.helpers.Notifier;
 import org.apache.wookie.helpers.ParticipantHelper;
-import org.apache.wookie.helpers.SharedDataHelper;
 import org.apache.wookie.server.LocaleHandler;
 import org.directwebremoting.WebContextFactory;
 
@@ -94,7 +93,7 @@ public class WaveAPIImpl implements IFea
                        return state;                   
                }
                //
-               for(ISharedData data : 
SharedDataHelper.findSharedData(widgetInstance)){
+               for(ISharedData data : new 
SharedContext(widgetInstance).getSharedData()){
                        state.put(data.getDkey(), data.getDvalue());
                }
                return state;
@@ -110,7 +109,7 @@ public class WaveAPIImpl implements IFea
                IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
                IWidgetInstance widgetInstance = 
persistenceManager.findWidgetInstanceByIdKey(id_key);
                if(widgetInstance==null) return 
localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
-               IParticipant[] participants = 
persistenceManager.findParticipants(widgetInstance);
+               IParticipant[] participants = new 
SharedContext(widgetInstance).getParticipants();
                return 
ParticipantHelper.createJSONParticipantsDocument(participants);
        }
        
@@ -124,7 +123,7 @@ public class WaveAPIImpl implements IFea
         IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
         IWidgetInstance widgetInstance = 
persistenceManager.findWidgetInstanceByIdKey(id_key);
                if(widgetInstance == null) return 
localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
-        IParticipant participant = 
persistenceManager.findParticipantViewer(widgetInstance);
+               IParticipant participant = new 
SharedContext(widgetInstance).getViewer(widgetInstance);
                if (participant != null) return 
ParticipantHelper.createJSONParticipantDocument(participant); //$NON-NLS-1$
                return null; // no viewer i.e. widget is anonymous
        }
@@ -141,7 +140,7 @@ public class WaveAPIImpl implements IFea
                if(widgetInstance.isLocked()) return 
localizedMessages.getString("WidgetAPIImpl.2"); //$NON-NLS-1$
                //
                for (String key: map.keySet())
-                       
PropertiesController.updateSharedDataEntry(widgetInstance, key, map.get(key), 
false);
+                 new SharedContext(widgetInstance).updateSharedData(key, 
map.get(key), false);
                Notifier.notifySiblings(widgetInstance);
                return "okay"; //$NON-NLS-1$
        }

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/helpers/SharedDataHelper.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/helpers/SharedDataHelper.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/helpers/SharedDataHelper.java 
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/helpers/SharedDataHelper.java 
Sun Oct 30 16:49:22 2011
@@ -13,12 +13,8 @@
  */
 package org.apache.wookie.helpers;
 
-import java.util.HashMap;
-
-import org.apache.wookie.beans.ISharedData;
 import org.apache.wookie.beans.IWidgetInstance;
-import org.apache.wookie.beans.util.IPersistenceManager;
-import org.apache.wookie.beans.util.PersistenceManagerFactory;
+
 
 /**
  * Service facade for managing SharedDataKeys in a consistent fashion.
@@ -72,60 +68,5 @@ public class SharedDataHelper {
            String key = externalSharedDataKey + ":" + apiKey + ":" + widgetUri;
            return String.valueOf(key.hashCode());
          }
-       
-        /**
-         * Find shared data for a Widget Instance
-         * @param instance the widget instance
-         * @return an array of SharedData objects for the widget instance
-         */
-       public static ISharedData[] findSharedData(IWidgetInstance instance){
-         
-         //
-    // Use the internal shared data key of the instance for one index of the 
query
-    //
-    String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(instance);
-    
-    //
-    // Obtain a persistence manager and return the results of executing a 
query of SharedData objects matching the sharedDataKey
-    //
-    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-    return (ISharedData[]) persistenceManager.findByValue(ISharedData.class, 
"sharedDataKey", sharedDataKey);
-       }
-       
-       /**
-        * Find a specific shared data object for a given Widget Instance and 
object key
-        * @param instance the widget instance
-        * @param key the key of the shared data object, i.e. the tuple key not 
the shared data key
-        * @return a SharedData object, or null if no matches are found
-        */
-       public static ISharedData findSharedData(IWidgetInstance instance, 
String key){
-         
-         //
-         // Use the internal shared data key of the instance for one index of 
the query
-         //
-    String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(instance);
-    
-    //
-    // Obtain a persistence manager and construct a query of SharedData 
objects matching the sharedDataKey and dkey
-    //
-    IPersistenceManager persistenceManager = 
PersistenceManagerFactory.getPersistenceManager();
-    HashMap<String, Object> params = new HashMap<String, Object>();
-    params.put("sharedDataKey", sharedDataKey);
-    params.put("dkey", key);
-    
-    //
-    // Execute the query and obtain array of results
-    // We assert that there are never duplicates.
-    //
-    ISharedData[] results = (ISharedData[]) 
persistenceManager.findByValues(ISharedData.class, params);
-    assert(results.length <= 1);
-    
-    //
-    // If the result contains a single item, return it, otherwise return null.
-    //
-
-    if (results.length != 0) return results[0];
-    return null;
-       }       
 
 }

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java 
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java Sun 
Oct 30 16:49:22 2011
@@ -33,6 +33,7 @@ import org.apache.wookie.beans.IWidgetDe
 import org.apache.wookie.beans.IWidgetIcon;
 import org.apache.wookie.beans.IWidgetInstance;
 import org.apache.wookie.beans.IWidgetType;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
 import org.apache.wookie.w3c.IAccessEntity;
@@ -293,9 +294,9 @@ public class WidgetFactory {
                        // Note also that we have to use the instance as the 
hook for removing participants as there is no
                        // specific query for getting participants for a widget.
                        //                                              
-                       IParticipant[] participants = 
persistenceManager.findParticipants(instance);
+                       IParticipant[] participants = new 
SharedContext(instance).getParticipants();
                        persistenceManager.delete(participants);
-               ISharedData[] sharedData =  
SharedDataHelper.findSharedData(instance);
+               ISharedData[] sharedData = new 
SharedContext(instance).getSharedData();
                persistenceManager.delete(sharedData);
                
                        // remove any preferences

Modified: 
incubator/wookie/trunk/src/org/apache/wookie/queues/impl/SharedDataQueueConsumer.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/queues/impl/SharedDataQueueConsumer.java?rev=1195191&r1=1195190&r2=1195191&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src/org/apache/wookie/queues/impl/SharedDataQueueConsumer.java
 (original)
+++ 
incubator/wookie/trunk/src/org/apache/wookie/queues/impl/SharedDataQueueConsumer.java
 Sun Oct 30 16:49:22 2011
@@ -17,9 +17,9 @@ import java.util.concurrent.BlockingQueu
 
 import org.apache.log4j.Logger;
 import org.apache.wookie.beans.IWidgetInstance;
+import org.apache.wookie.beans.SharedContext;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
-import org.apache.wookie.controller.PropertiesController;
 import org.apache.wookie.queues.beans.IQueuedBean;
 /**
  * Implementation of the shareddata Queue consumer
@@ -48,7 +48,7 @@ public class SharedDataQueueConsumer ext
                persistenceManager.begin();
                IWidgetInstance widgetInstance = 
persistenceManager.findWidgetInstanceByIdKey(bean.getId_key());
                if (widgetInstance != null){
-                       
PropertiesController.updateSharedDataEntry(widgetInstance, bean.getKey(), 
bean.getValue(), bean.append());
+                 new 
SharedContext(widgetInstance).updateSharedData(bean.getKey(), bean.getValue(), 
bean.append());
                        persistenceManager.commit();
                }
        } 


Reply via email to