Package org.apache.wookie.beans

Examples of org.apache.wookie.beans.SharedContext


      throw new InvalidParametersException();
    }
    String cloneKey = SharedDataHelper.getInternalSharedDataKey(instance, cloneSharedDataKey);
        IWidget widget = instance.getWidget();
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    for (ISharedData sharedData : new SharedContext(instance).getSharedData())
    {
        ISharedData clone = persistenceManager.newInstance(ISharedData.class);
            clone.setDkey(sharedData.getDkey());
            clone.setDvalue(sharedData.getDvalue());
            clone.setSharedDataKey(cloneKey);
View Full Code Here


    boolean ok = persistenceManager.save(widget);
    if (!ok) throw new InvalidParametersException();
  }
 
  public synchronized static void lockWidgetInstance(IWidgetInstance instance){
    new SharedContext(instance).updateSharedData("isLocked", "true", false); //$NON-NLS-1$ //$NON-NLS-2$
    instance.setLocked(true);
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    persistenceManager.save(instance);
  }
View Full Code Here

    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    persistenceManager.save(instance);
  }

  public synchronized static void unlockWidgetInstance(IWidgetInstance instance){
    new SharedContext(instance).updateSharedData("isLocked", "false", false); //$NON-NLS-1$ //$NON-NLS-2$
    instance.setLocked(false);
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    persistenceManager.save(instance);
  }
View Full Code Here

    String value = null;
    // Note that preferences and shared data keys may be the same!
    // We let the shared data values override.
    IPreference pref = instance.getPreference(name);
    if (pref != null) value = pref.getDvalue();
    ISharedData data = new SharedContext(instance).getSharedData(name);
    if (data != null) value = data.getDvalue();
    if (value == null) throw new ResourceNotFoundException();
    PrintWriter out = response.getWriter();
    out.write(value);
  }
View Full Code Here

    if (instance == null) throw new InvalidParametersException();
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
   
    boolean found = false;
    if (isPublic(request)){
      found = new SharedContext(instance).removeSharedData(name);
      Notifier.notifyWidgets(request.getSession(), instance, Notifier.STATE_UPDATED);
    } else {
      found = updatePreference(instance, name, null);
    }
    if (!found) throw new ResourceNotFoundException();
View Full Code Here

    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
   
    if (isPublic(request)){
      new SharedContext(instance).updateSharedData(name, value, false);
      Notifier.notifyWidgets(request.getSession(), instance, Notifier.STATE_UPDATED);
    } else {
      updatePreference(instance, name, value);
    }
  }
View Full Code Here

    if(id_key==null) return localizedMessages.getString("WidgetAPIImpl.0");
    if(key==null) return localizedMessages.getString("WidgetAPIImpl.1");
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if (widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
    ISharedData data = new SharedContext(widgetInstance).getSharedData(key);
    if (data == null) return localizedMessages.getString("WidgetAPIImpl.1");
    return data.getDvalue();
  }
View Full Code Here

    if(widgetInstance.isLocked()) return localizedMessages.getString("WidgetAPIImpl.2");
    if(ContextListener.useSharedDataInstanceQueues){// 
      QueueManager.getInstance().queueSetSharedDataRequest(id_key, SharedDataHelper.getInternalSharedDataKey(widgetInstance), key, value, false);
    }
    else{
      new SharedContext(widgetInstance).updateSharedData(key, value, false);
    }
    Notifier.notifySiblings(widgetInstance);
    return "okay"; //$NON-NLS-1$
  }
View Full Code Here

    if(widgetInstance.isLocked()) return localizedMessages.getString("WidgetAPIImpl.2");
    if(ContextListener.useSharedDataInstanceQueues){//
      QueueManager.getInstance().queueSetSharedDataRequest(id_key, SharedDataHelper.getInternalSharedDataKey(widgetInstance), key, value, true);
    }
    else{
      new SharedContext(widgetInstance).updateSharedData(key, value, true);
    }
    Notifier.notifySiblings(widgetInstance);
    return "okay"; //$NON-NLS-1$
  }
View Full Code Here

TOP

Related Classes of org.apache.wookie.beans.SharedContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.