Package org.apache.wookie.exceptions

Examples of org.apache.wookie.exceptions.InvalidParametersException


      try {
        W3CWidgetFactory factory  = getFactory(request.getSession().getServletContext());
        installUpdate(factory, widget, false);
      } 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


   * @param resourceId
   * @return
   * @throws ResourceDuplicationException
   */
  public static boolean create(String resourceId) throws ResourceDuplicationException,InvalidParametersException{
    if (resourceId == null || resourceId.trim().equals("")) throw new InvalidParametersException();
    IWidgetService ws;
    try {
      ws = getWidgetService(resourceId);
      throw new ResourceDuplicationException();
    } catch (ResourceNotFoundException e) {
View Full Code Here

   */
  @Override
  protected void update(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException,InvalidParametersException {
    String name = request.getParameter("name");
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
    IWidgetService ws = getWidgetService(resourceId);
    if (ws == null) throw new ResourceNotFoundException();
    ws.setServiceName(name);
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    persistenceManager.save(ws);
View Full Code Here

  protected void update(String resourceId, HttpServletRequest request)
  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

    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

   * @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)
      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();
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    Map<String, Object> values = new HashMap<String, Object>();
    values.put("value", value);
    values.put("email", email);
    if (persistenceManager.findByValues(IApiKey.class, values).length > 0){
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$
   
    // 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)){
      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

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.