Package org.apache.wookie

Examples of org.apache.wookie.Messages


        String apiKey = request.getParameter("api_key"); //$NON-NLS-1$
    String serviceType = request.getParameter("servicetype"); //$NON-NLS-1$
    String widgetId = request.getParameter("widgetid"); //$NON-NLS-1$
        sharedDataKey = SharedDataHelper.getInternalSharedDataKey(apiKey, widgetId, sharedDataKey);
    HttpSession session = request.getSession(true);           
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
         
    if(userId==null || sharedDataKey==null || (serviceType==null && widgetId==null)){
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }
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 : SharedDataHelper.findSharedData(widgetInstance)){
      state.put(data.getDkey(), data.getDvalue());
View Full Code Here

  /* (non-Javadoc)
   * @see org.apache.wookie.feature.wave.IWaveAPI#getParticipants(java.lang.String)
   */
  public String getParticipants(String id_key) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    if(id_key == null) return localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
    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);
    return ParticipantHelper.createJSONParticipantsDocument(participants);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.apache.wookie.feature.wave.IWaveAPI#getViewer(java.lang.String)
   */
  public String getViewer(String id_key) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    if(id_key == null) return localizedMessages.getString("WidgetAPIImpl.0"); //$NON-NLS-1$
        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);
    if (participant != null) return ParticipantHelper.createJSONParticipantDocument(participant); //$NON-NLS-1$
    return null; // no viewer i.e. widget is anonymous
  }
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())
       PropertiesController.updateSharedDataEntry(widgetInstance, key, map.get(key), false);
    Notifier.notifySiblings(widgetInstance);
    return "okay"; //$NON-NLS-1$
View Full Code Here

       /*
        * Initialise the locale handler
        */
       LocaleHandler.getInstance().initialize(configuration);
      final Locale locale = new Locale(configuration.getString("widget.default.locale"));
      final Messages localizedMessages = LocaleHandler.getInstance().getResourceBundle(locale);
      
       /*
       *  load the opensocial.properties file and put it into this context
       *  as an attribute 'opensocial' available to all resources
       */
      File localOpenSocialPropsFile = new File(System.getProperty("user.dir") + File.separator + "local.opensocial.properties");
            PropertiesConfiguration localOpenSocialConfiguration = new PropertiesConfiguration(localOpenSocialPropsFile);
            CompositeConfiguration opensocialConfiguration = new CompositeConfiguration();
            opensocialConfiguration.addConfiguration(localOpenSocialConfiguration);
            opensocialConfiguration.addConfiguration(new PropertiesConfiguration("opensocial.properties"));
      context.setAttribute("opensocial", (Configuration) opensocialConfiguration);
     
      /*
       * Load installed features
       */
      Features.loadFeatures(context);
     
      /*
       * Run diagnostics
       */
      Diagnostics.run(context, configuration);
     
      /*
       * Start hot-deploy widget watcher
       */
       if (configuration.getBoolean("widget.hot_deploy")) {
         startWatcher(context, configuration, localizedMessages);
       } else {
         _logger.info(localizedMessages.getString("WidgetHotDeploy.0"));
       }
    }
    catch (ConfigurationException ex) {
      _logger.error("ConfigurationException thrown: "+ ex.toString());
    }         
View Full Code Here

   */
  @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#preferenceForKey(java.lang.String, java.lang.String)
   */
  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.getDvalue();
  }
View Full Code Here

   * (non-Javadoc)
   * @see org.apache.wookie.ajaxmodel.IWidgetAPI#sharedDataForKey(java.lang.String, java.lang.String)
   */
  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 = widgetInstance.getSharedData(key);
    if (data == null) return localizedMessages.getString("WidgetAPIImpl.1");
    return data.getDvalue();
  }
View Full Code Here

   * (non-Javadoc)
   * @see org.apache.wookie.ajaxmodel.IWidgetAPI#setPreferenceForKey(java.lang.String, java.lang.String, java.lang.String)
   */
  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");
    //
    PropertiesController.updatePreference(widgetInstance, key, value);
    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.