Package org.apache.wookie.exceptions

Examples of org.apache.wookie.exceptions.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) {
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      ws = persistenceManager.newInstance(IWidgetService.class);
      ws.setServiceName(resourceId);
      return persistenceManager.save(ws);
View Full Code Here


    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){
      throw new ResourceDuplicationException();
    }
   
    IApiKey apiKey = persistenceManager.newInstance(IApiKey.class);
    apiKey.setValue(value);
    apiKey.setEmail(email);
View Full Code Here

    if (url == null || url.trim().length() == 0) throw new InvalidParametersException();
    if (!IRIValidator.isValidIRI(url)) throw new InvalidParametersException();
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    // Check for duplicates
    IWhitelist[] matches = persistenceManager.findByValue(IWhitelist.class, "fUrl", url);
    if (matches.length != 0) throw new ResourceDuplicationException();
    IWhitelist entry = persistenceManager.newInstance(IWhitelist.class);
    entry.setfUrl(url);
    return persistenceManager.save(entry);
  }
View Full Code Here

  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) {
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      ws = persistenceManager.newInstance(IWidgetService.class);
      ws.setServiceName(resourceId);
      return persistenceManager.save(ws);
View Full Code Here

   
    try {
      ApiKeys.getInstance().addKey(value, email);
      _logger.info("New API key registered for "+email);
    } catch (Exception e) {
      throw new ResourceDuplicationException()
    }
   
    return true;
  }
View Full Code Here

          properties.save();
        } finally {
          lock.unlock();
        }
      } else {
        throw new ResourceDuplicationException();
      }
    } catch (ConfigurationException e) {
      logger.error("Problem with keys properties configuration", e);
    }
  }
View Full Code Here

TOP

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

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.