Package org.apache.wookie.exceptions

Examples of org.apache.wookie.exceptions.ResourceNotFoundException


      UnauthorizedAccessException, IOException {
    // attempt to get specific widget by id; note that this is the internal
    // widget integer ID and not the widget URI
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
    if (widget == null) throw new ResourceNotFoundException();
    // redirect to the UDD
    if (widget.getUpdateLocation() ==  null) throw new ResourceNotFoundException();
    response.sendRedirect(widget.getUpdateLocation());
  }
View Full Code Here


      throws ResourceNotFoundException, InvalidParametersException,
      UnauthorizedAccessException {
      // attempt to get specific widget by id
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
      if (widget == null) throw new ResourceNotFoundException();
      // FIXME localize error messages
      try {
        W3CWidgetFactory factory  = getFactory(request.getSession().getServletContext());
        installUpdate(factory, widget, false);
      } catch (IOException e) {
View Full Code Here

   * @return true if successfully deleted
   * @throws ResourceNotFoundException
   */
  public static boolean remove(String resourceId) throws ResourceNotFoundException {
    IWidgetService service = getWidgetService(resourceId);
    if (service == null) throw new ResourceNotFoundException();
    String serviceName = service.getServiceName();
   
    // if exists, remove from widget default table
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetDefault[] widgetDefaults = persistenceManager.findByValue(IWidgetDefault.class, "widgetContext", serviceName);
View Full Code Here

  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

   * service name or service id
   * @param resourceId
   * @return
   */
  private static IWidgetService getWidgetService(String resourceId) throws ResourceNotFoundException{
    if (resourceId == null) throw new ResourceNotFoundException();
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetService ws = persistenceManager.findById(IWidgetService.class, resourceId);
    if (ws == null) {
      IWidgetService[] wsa = persistenceManager.findByValue(IWidgetService.class, "serviceName", resourceId);
      if (wsa != null && wsa.length == 1) ws = wsa[0];
    }
    if (ws == null) throw new ResourceNotFoundException();
    return ws;
  }
View Full Code Here

   */
  @Override
  protected void show(String resourceId, HttpServletRequest request, HttpServletResponse response) throws ResourceNotFoundException, UnauthorizedAccessException, IOException {
     IWidgetInstance instance = WidgetInstancesController.getLocalizedWidgetInstance(request);
     if (instance == null){
       throw new ResourceNotFoundException();
     } else {
       // Check the API key matches
       String apiKey = request.getParameter("api_key");
       if (!instance.getApiKey().equals(apiKey)) throw new UnauthorizedAccessException();
       // Return the response XML
View Full Code Here

  protected boolean remove(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException, UnauthorizedAccessException,
      InvalidParametersException {
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IApiKey apiKey = persistenceManager.findById(IApiKey.class, resourceId);
    if (apiKey == null) throw new ResourceNotFoundException();
    persistenceManager.delete(apiKey);
    _logger.info("API key deleted for "+apiKey.getEmail());
    return true;
  }
View Full Code Here

  // Implementation
 
  @Override
  public void show(String resourceId,HttpServletRequest request, HttpServletResponse response) throws UnauthorizedAccessException,ResourceNotFoundException, IOException{
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new ResourceNotFoundException();
    IParticipant[] participants = new SharedContext(instance).getParticipants();
    returnXml(ParticipantHelper.createXMLParticipantsDocument(participants), response);
  }
View Full Code Here

    String participantId = request.getParameter("participant_id"); //$NON-NLS-1$
    if(new SharedContext(instance).removeParticipant(participantId)){
      Notifier.notifyWidgets(session, instance, Notifier.PARTICIPANTS_UPDATED);
      return true;
    }else{
      throw new ResourceNotFoundException();       
    }
  }
View Full Code Here

            returnXml(WidgetHelper.createXMLWidgetsDocument(widgets, getLocalPath(request), getLocales(request)),response);
            return;
        }
    }
    // return widget result
    if (widget == null) throw new ResourceNotFoundException();
    returnXml(WidgetHelper.createXMLWidgetsDocument(widget, getLocalPath(request), getLocales(request)),response);
 
View Full Code Here

TOP

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

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.