Package org.apache.wookie.exceptions

Examples of org.apache.wookie.exceptions.InvalidParametersException


    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request)
    if(instance!=null){
      lockWidgetInstance(instance);
      Notifier.notifyWidgets(request.getSession(), instance, Notifier.STATE_UPDATED);
    }else{
      throw new InvalidParametersException();
    }
  }
View Full Code Here


    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if(instance!=null){
      unlockWidgetInstance(instance);
      Notifier.notifyWidgets(request.getSession(), instance, Notifier.STATE_UPDATED);
    }else{
      throw new InvalidParametersException();
    }
  }
View Full Code Here

    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);
    if(userId==null || sharedDataKey==null || (serviceType==null && widgetId==null)){
      throw new InvalidParametersException();
    }
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if(instance==null){
      throw new ResourceNotFoundException();
    }
View Full Code Here

   * @throws InvalidParametersException
   */
  public static void cloneSharedData(HttpServletRequest request) throws InvalidParametersException{
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request)
    if (instance == null){
      throw new InvalidParametersException();   
    }
    String sharedDataKey = request.getParameter("shareddatakey");   //$NON-NLS-1$; 
    String cloneSharedDataKey = request.getParameter("cloneshareddatakey");
    if (sharedDataKey == null || sharedDataKey.trim().equals("") || cloneSharedDataKey == null || cloneSharedDataKey.trim().equals("")){//$NON-NLS-1$ //$NON-NLS-2$
      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);
            persistenceManager.save(clone);
    }
    boolean ok = persistenceManager.save(widget);
    if (!ok) throw new InvalidParametersException();
  }
View Full Code Here

  protected boolean create(String resourceId, HttpServletRequest request, HttpServletResponse response)
      throws ResourceDuplicationException, InvalidParametersException,
      UnauthorizedAccessException {
    String value = request.getParameter("apikey");
    String email = request.getParameter("email");
    if (value == null || email == null || value.trim().length() ==0 || email.trim().length() == 0) throw new InvalidParametersException();
   
    try {
      ApiKeys.getInstance().addKey(value, email);
      _logger.info("New API key registered for "+email);
    } catch (Exception e) {
View Full Code Here

  public static boolean create(HttpServletRequest request)
      throws ResourceDuplicationException, InvalidParametersException,
      UnauthorizedAccessException {

    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$
    String participantDisplayName = request.getParameter("participant_display_name"); //$NON-NLS-1$
    String participantThumbnailUrl = request.getParameter("participant_thumbnail_url"); //$NON-NLS-1$
    String participantRole = request.getParameter("participant_role");
   
    // Check required params
    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, participantRole)){
      Notifier.notifyWidgets(session, instance, Notifier.PARTICIPANTS_UPDATED);
      _logger.debug("added user to widget instance: " + participantId);
View Full Code Here

  }
  public static boolean remove(HttpServletRequest request)
      throws ResourceNotFoundException, UnauthorizedAccessException,
      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;
View Full Code Here

      try {
        W3CWidgetFactory factory = W3CWidgetFactoryUtils.createW3CWidgetFactory(getServletContext());
        installUpdate(factory, widget, onlyUseHttps);
      } catch (IOException e) {
        _logger.warn("Problem updating "+resourceId+": widget couldn't be downloaded");
        throw new InvalidParametersException();
      } catch (InvalidContentTypeException e) {
        _logger.warn("Problem updating "+resourceId+": incorrect content type");
        throw new InvalidParametersException();
      } catch (BadWidgetZipFileException e) {
        _logger.warn("Problem updating "+resourceId+": update is an invalid widget package");
        throw new InvalidParametersException();
      } catch (BadManifestException e) {
        _logger.warn("Problem updating "+resourceId+": update has an invalid config.xml");
        throw new InvalidParametersException();
      } catch (Exception e) {
        _logger.warn("Problem updating "+resourceId+": "+e.getMessage());
        throw new InvalidParametersException();
      }
  }
View Full Code Here

        //
        // Construct a FlatpackFactory for the instance identified in the request
        // If no instance can be found, throw an exception
        //
      IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
      if (instance == null) throw new InvalidParametersException();
      FlatpackFactory fac = new FlatpackFactory(instance);
     
      //
      // Set the folder to save the flatpack to an appropriate location on this server
      //
      fac.setFlatpackFolder(new File(request.getSession().getServletContext().getRealPath(FlatpackFactory.DEFAULT_FLATPACK_FOLDER.getPath())));
     
      //
      // Pack the widget instance and get the resulting File
      //
      File flatpack = fac.pack();
     
            //
            // Construct the URL pointing to the exported .wgt file
            //  Note that the resource begins with the servlet path, typically "/wookie"
      //
            String resource = request.getSession().getServletContext().getContextPath() + "/" + FlatpackFactory.DEFAULT_FLATPACK_FOLDER + "/" + flatpack.getName();
            URL url =  getWookieServerURL(request, resource);
     
            //
            // Return the String version of the URL pointing to the exported .wgt file
            //
      path = url.toString();
     
    } catch (Exception e) {
      throw new InvalidParametersException();
    }
    return path;
  }
View Full Code Here

  protected void update(String resourceId, HttpServletRequest request, HttpServletResponse response)
  throws ResourceNotFoundException, InvalidParametersException,
  UnauthorizedAccessException {
    String requestId = request.getParameter("requestid"); //$NON-NLS-1$
    if (requestId == null || requestId.equals(""))
      throw new InvalidParametersException();
    if(requestId.equals("stopwidget")){ //$NON-NLS-1$
      doStopWidget(request);
    } else if(requestId.equals("resumewidget")){ //$NON-NLS-1$
      doResumeWidget(request);
    } else if(requestId.equals("clone")){ //$NON-NLS-1$
      cloneSharedData(request);
    } else {
      throw new InvalidParametersException();
    }

  }
View Full Code Here

TOP

Related Classes of org.apache.wookie.exceptions.InvalidParametersException

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.