Examples of SharedContext


Examples of org.apache.wookie.beans.SharedContext

 
  @Override
  public void show(String resourceId,HttpServletRequest request, HttpServletResponse response) throws UnauthorizedAccessException,ResourceNotFoundException, IOException{
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new ResourceNotFoundException();
    IParticipant[] participants = new SharedContext(instance).getParticipants();
    switch (format(request)) {
       case XML: returnXml(ParticipantHelper.createXMLParticipantsDocument(participants),response);break;
       case JSON: returnJson(ParticipantHelper.createJSONParticipantsDocument(participants),response);break;
       default: returnXml(ParticipantHelper.createXMLParticipantsDocument(participants),response);break;
    }
View Full Code Here

Examples of org.apache.wookie.beans.SharedContext

    if (participantId == null || participantId.trim().equals("")) {
      _logger.error("participant_id parameter cannot be null");
      throw new InvalidParametersException();
    }

    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;
    } else {
      // No need to create a new participant, it already existed
View Full Code Here

Examples of org.apache.wookie.beans.SharedContext

      InvalidParametersException {
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
    HttpSession session = request.getSession(true);           
    String participantId = request.getParameter("participant_id"); //$NON-NLS-1$
    if(new SharedContext(instance).removeParticipant(participantId)){
      Notifier.notifyWidgets(session, instance, Notifier.PARTICIPANTS_UPDATED);
      return true;
    }else{
      throw new ResourceNotFoundException();       
    }
View Full Code Here

Examples of org.apache.wookie.beans.SharedContext

      // not just the one being deleted.
      //
      // 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 = new SharedContext(instance).getParticipants();
      persistenceManager.delete(participants);
          ISharedData[] sharedData = new SharedContext(instance).getSharedData();
          persistenceManager.delete(sharedData);
         
      // remove any preferences
      IPreference[] preferences = instance.getPreferences().toArray(new IPreference[instance.getPreferences().size()]);// persistenceManager.findByValue(IPreference.class, "widgetInstance", instance);
      persistenceManager.delete(preferences);
View Full Code Here

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

Examples of org.apache.wookie.beans.SharedContext

    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

Examples of org.apache.wookie.beans.SharedContext

    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

Examples of org.apache.wookie.beans.SharedContext

       
        //
        // Get the participant created in the previous transaction by widget instance
        //
      
        IParticipant [] participants =  new SharedContext(widgetInstance0).getParticipants();
        assertNotNull(participants);
        assertEquals(1, participants.length);
       
        //
        // Get the participant created in the previous transaction by widget instance
        //
        participant =  new SharedContext(widgetInstance0).getViewer(widgetInstance0);
        assertNotNull(participant);
       
        //
        // delete all the test objects
        //
View Full Code Here

Examples of org.apache.wookie.beans.SharedContext

      // not just the one being deleted.
      //
      // 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 = new SharedContext(instance).getParticipants();
      persistenceManager.delete(participants);
          ISharedData[] sharedData = new SharedContext(instance).getSharedData();
          persistenceManager.delete(sharedData);
         
      // remove any preferences
      IPreference[] preferences = instance.getPreferences().toArray(new IPreference[instance.getPreferences().size()]);// persistenceManager.findByValue(IPreference.class, "widgetInstance", instance);
      persistenceManager.delete(preferences);
View Full Code Here

Examples of org.apache.wookie.beans.SharedContext

    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.getValue();
    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
TOP
Copyright © 2018 www.massapi.com. 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.