Package org.apache.wookie

Examples of org.apache.wookie.Messages


   */
  @Deprecated
  @SuppressWarnings("static-access")
  public String setPreferenceForKey(String id_key, String key, String value) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);  
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();  
    IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if (widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
    if(ContextListener.usePreferenceInstanceQueues){
      QueueManager.getInstance().queueSetPreferenceRequest(id_key, key, value);
    }
    else{
      PropertiesController.updatePreference(widgetInstance, key, value);
View Full Code Here


  /* (non-Javadoc)
   * @see org.apache.wookie.ajaxmodel.IWidgetAPI#state(java.lang.String)
   */
  public Map<String, String> state(String id_key) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    HashMap<String, String> state = new HashMap<String,String>();
    if(id_key==null){
      state.put("message", localizedMessages.getString("WidgetAPIImpl.0"));   //$NON-NLS-1$
      return state;
    }
    // check if instance is valid
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if (widgetInstance == null){
      state.put("message", localizedMessages.getString("WidgetAPIImpl.0"));   //$NON-NLS-1$
      return state;     
    }
    //
    for(ISharedData data : new SharedContext(widgetInstance).getSharedData()){
      state.put(data.getDkey(), data.getDvalue());
View Full Code Here

  public String getParticipants(String id_key) {
    SharedContext sharedContext = this.getSharedContext(id_key);
    if (sharedContext != null){
      return ParticipantHelper.createJSONParticipantsDocument(sharedContext.getParticipants())
    } else {
      Messages localizedMessages = LocaleHandler.localizeMessages(WebContextFactory.get().getHttpServletRequest());
      return localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
    }
  }
View Full Code Here

  public String getHosts(String id_key) {
    SharedContext sharedContext = this.getSharedContext(id_key);
    if (sharedContext != null){
      return ParticipantHelper.createJSONParticipantsDocument(sharedContext.getHosts())
    } else {
      Messages localizedMessages = LocaleHandler.localizeMessages(WebContextFactory.get().getHttpServletRequest());
      return localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
    }
  }
View Full Code Here

  public String getViewer(String id_key) {
    SharedContext sharedContext = this.getSharedContext(id_key);
    if (sharedContext != null){
      return ParticipantHelper.createJSONParticipantDocument(sharedContext.getViewer())
    } else {
      Messages localizedMessages = LocaleHandler.localizeMessages(WebContextFactory.get().getHttpServletRequest());
      return localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
    }
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.apache.wookie.feature.wave.IWaveAPI#submitDelta(java.lang.String, java.util.Map)
   */
  public String submitDelta(String id_key, Map<String,String>map){
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if(widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
    if(widgetInstance.isLocked()) return localizedMessages.getString("WidgetAPIImpl.2"); //$NON-NLS-1$
    //
    for (String key: map.keySet())
      new SharedContext(widgetInstance).updateSharedData(key, map.get(key), false);
    Notifier.notifySiblings(widgetInstance);
    return "okay"; //$NON-NLS-1$
View Full Code Here

   * DEPRECATED: This was replaced by the W3C Storage API
   */
  @Deprecated
  public String preferenceForKey(String id_key, String key) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    if(id_key == null) return localizedMessages.getString("WidgetAPIImpl.0");
    if(key == null)return localizedMessages.getString("WidgetAPIImpl.1");
    // check if instance is valid
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if (widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
    //
    IPreference preference = widgetInstance.getPreference(key);
    if (preference == null) return localizedMessages.getString("WidgetAPIImpl.1");
    return preference.getValue();
  }
View Full Code Here

   * DEPRECATED: This was replaced by the Wave Gadget API
   */
  @Deprecated
  public String sharedDataForKey(String id_key, String key) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    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

   */
  @Deprecated
  @SuppressWarnings("static-access")
  public String setSharedDataForKey(String id_key, String key, String value) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetInstance widgetInstance;//
    widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if(widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
    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);
View Full Code Here

   * (non-Javadoc)
   * @see org.apache.wookie.ajaxmodel.IWidgetAPI#lock(java.lang.String)
   */
  public String lock(String id_key) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if(widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
    //
    String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);
    WidgetInstancesController.lockWidgetInstance(widgetInstance);
    Notifier.callSiblings(widgetInstance,"Widget.onLocked(\""+sharedDataKey+"\");");//$NON-NLS-1$
        return "okay"; //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.apache.wookie.Messages

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.