Package org.apache.juddi.v3.error

Examples of org.apache.juddi.v3.error.ErrorMessage


      UddiEntityPublisher rootPublisher, String rootPartition, Configuration config)
  throws DispositionReportFaultMessage {

    // A supplied businessService can't be null
    if (bindingTemplate == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NullInput"));
 
    // A service key doesn't have to be provided, but if it is, it should match the parent service's key
    String parentKey = bindingTemplate.getServiceKey();
    if (parentKey != null && parentKey.length()> 0) {
      if (!parentKey.equalsIgnoreCase(parent.getServiceKey()))
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentServiceNotFound", parentKey));
    }
   
    // Retrieve the service's passed key
    String entityKey = bindingTemplate.getBindingKey();
    if (entityKey == null || entityKey.length() == 0) {
      entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID();
      bindingTemplate.setBindingKey(entityKey);
    }
    else {
      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      bindingTemplate.setBindingKey(entityKey);

      ValidateUDDIKey.validateUDDIv3Key(entityKey);
      String keyPartition = entityKey.substring(0, entityKey.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR));
      if (!rootPartition.equalsIgnoreCase(keyPartition))
        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
    }
   
    ValidatePublish validatePublish = new ValidatePublish(rootPublisher);
   
    validatePublish.validateCategoryBag(bindingTemplate.getCategoryBag(), config);
View Full Code Here


    try {
      Cryptor cryptor = (Cryptor) CryptorFactory.getCryptor();
      return cryptor.encrypt(str);
    } catch (InvalidKeyException e) {
      logger.error("Invalid Key Exception in crypting the password", e);
      throw new FatalErrorException(new ErrorMessage(
          "errors.auth.cryptor.InvalidKey", e.getMessage()));
    } catch (NoSuchPaddingException e) {
      logger.error("Padding Exception in crypting the password", e);
      throw new FatalErrorException(new ErrorMessage(
          "errors.auth.cryptor.Padding", e.getMessage()));
    } catch (NoSuchAlgorithmException e) {
      logger.error("Algorithm Exception in crypting the password", e);
      throw new FatalErrorException(new ErrorMessage(
          "errors.auth.cryptor.Algorithm", e.getMessage()));
    } catch (InvalidAlgorithmParameterException e) {
      logger.error("Algorithm parameter Exception in crypting the password",
          e);
      throw new FatalErrorException(new ErrorMessage(
          "errors.auth.cryptor.AlgorithmParam", e.getMessage()));
    } catch (IllegalBlockSizeException e) {
      logger.error("Block size Exception in crypting the password", e);
      throw new FatalErrorException(new ErrorMessage(
          "errors.auth.cryptor.BlockSize", e.getMessage()));
    } catch (BadPaddingException e) {
      logger.error("Bad Padding Exception in crypting the password", e);
      throw new FatalErrorException(new ErrorMessage(
          "errors.auth.cryptor.BadPadding", e.getMessage()));
    }
  }
View Full Code Here

   */
  private void preProcess(String userID, String credential)
  throws AuthenticationException {
    // a userID must be specified.
    if (userID == null) {
      throw new UnknownUserException(new ErrorMessage(
          "errors.auth.InvalidUserId", userID));
    }
    // credential (password) must be specified.
    if (credential == null) {
      throw new UnknownUserException(new ErrorMessage(
      "errors.auth.InvalidCredentials"));
    }
  }
View Full Code Here

  throws AuthenticationException {
    if (userTable.containsKey(userID)) {
      User user = (User) userTable.get(userID);
      if ((user.getPassword() == null)
          || (!encryptedCredential.equals(user.getPassword()))) {
        throw new UnknownUserException(new ErrorMessage(
            "errors.auth.InvalidCredentials", userID));
      }
    } else {
      throw new UnknownUserException(new ErrorMessage(
          "errors.auth.InvalidUserId", userID));
    }
    return userID;
  }
View Full Code Here

  public String authenticate(String userID,String credential)
  throws AuthenticationException, FatalErrorException
  {
    // a userID must be specified.
    if (userID == null)
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidUserId", userID));

    // credential (password) must be specified.
    if (credential == null)
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidCredentials"));

    if (userTable.containsKey(userID))
    {
      User user = (User)userTable.get(userID);
      if ((user.getPassword() == null) || (!credential.equals(user.getPassword())))
        throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidCredentials"));
    }
    else
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidUserId", userID));

    return userID;
  }
View Full Code Here

    EntityTransaction tx = em.getTransaction();
    try {
      tx.begin();
      Publisher publisher = em.find(Publisher.class, authorizedName);
      if (publisher == null)
        throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
     
      return publisher;
    } finally {
      if (tx.isActive()) {
        tx.rollback();
View Full Code Here

  public void validateDeleteBusiness(EntityManager em, DeleteBusiness body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getBusinessKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
     
      i++;
    }
  }
View Full Code Here

  public void validateDeleteService(EntityManager em, DeleteService body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getServiceKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
     
      i++;
    }
  }
View Full Code Here

  public void validateDeleteBinding(EntityManager em, DeleteBinding body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getBindingKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    // Checking for duplicates and existence
    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));

      i++;
    }
  }
View Full Code Here

 
  public void validateDeleteTModel(EntityManager em, DeleteTModel body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getTModelKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
     
      i++;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.juddi.v3.error.ErrorMessage

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.