Package org.apache.wookie.exceptions

Examples of org.apache.wookie.exceptions.InvalidParametersException


    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

  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

      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

  @Override
  protected boolean remove(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException,UnauthorizedAccessException,InvalidParametersException {
    if (!WidgetKeyManager.isValidRequest(request)) throw new UnauthorizedAccessException();
    if (request.getParameter("value") != null) throw new InvalidParametersException();//$NON-NLS-1$
    String name = request.getParameter("propertyname"); //$NON-NLS-1$
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
   
    boolean found = false;
    if (isPublic(request)){
      found = updateSharedDataEntry(instance, name, null, false);
      Notifier.notifyWidgets(request.getSession(), instance, Notifier.STATE_UPDATED);
View Full Code Here

  throws InvalidParametersException,UnauthorizedAccessException {
    if (!WidgetKeyManager.isValidRequest(request)) throw new UnauthorizedAccessException();
    String name = request.getParameter("propertyname"); //$NON-NLS-1$
    String value = request.getParameter("propertyvalue"); //$NON-NLS-1$
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
   
    if (isPublic(request)){
      updateSharedDataEntry(instance, name, value, false);
      Notifier.notifyWidgets(request.getSession(), instance, Notifier.STATE_UPDATED);
    } else {
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.