Package com.stimulus.archiva.exception

Examples of com.stimulus.archiva.exception.ArchivaException


          }
          try {
            store.connect(server,port, username,password);
          } catch (AuthenticationFailedException e) {
            logger.error("cannot connect to mail server. authentication failed {"+props+"}");
              throw new ArchivaException ("unable to connect to mail server. could not authenticate. {"+props+"}",e,logger);
          } catch (IllegalStateException ise) {
            throw new ArchivaException ("attempt to connect mail server when it already connected. {"+props+"}",ise,logger);
          } catch (MessagingException me) {
            if (me.getMessage().contains("sun.security.validator.ValidatorException")) {
              throw new ArchivaException ("failed to authenticate TLS certificate. You must install the mail server's certificate as per the administration guide.",me,logger);
            } else if (connection.getConnectionMode()==MailboxConnections.ConnectionMode.FALLBACK &&
                   me.getMessage().contains("javax.net.ssl.SSLHandshakeException")) {
              logger.debug("cannot establish SSL handshake with mail server. falling back to insecure. {"+props+"}");
              connection.setConnectionMode(MailboxConnections.ConnectionMode.INSECURE);
            } else throw new ArchivaException ("failed to connect to mail server. "+me.getMessage()+". {"+props+"}",me,logger);
          }
          try {   
              inboxFolder = store.getDefaultFolder();
       } catch (Exception e) {
           throw new ArchivaException ("unable to get default folder. ",e,logger);
       }
       
          if (inboxFolder == null) {
              throw new ArchivaException ("there was no default POP inbox folder found.",logger);
          }   
    
          try {   
              inboxFolder = inboxFolder.getFolder("INBOX");
              if (inboxFolder == null) {
                  throw new ArchivaException ("the inbox folder does not exist.",logger);
              }
          } catch (Exception e) {
             throw new ArchivaException ("unable to get INBOX folder. ",e,logger);
          }
          try {
              inboxFolder.open(Folder.READ_WRITE);           
          } catch (Exception e) {
              throw new ArchivaException ("unable to open folder. ",e,logger);
          }   
          return;
    }
View Full Code Here


         return new MailArchivaPrincipal(username,"administrator",null);
       }
      
     int at = username.lastIndexOf('@');
       if (at<=0 || at>=username.length()-1) {
           throw new ArchivaException("invalid login name. must be username@domain",logger);
       }
      
       Iterator roleMapIterator = config.getBasicIdentity().getRoleMaps().iterator();
       int role = 0;
       while (roleMapIterator.hasNext()) {
         BasicIdentity.BasicRoleMap rm = (BasicIdentity.BasicRoleMap)roleMapIterator.next();
         logger.debug("find role {username='"+rm.getUsername()+"'}");
         logger.debug("username:'"+username+"'}");     
         if (rm.getUsername().equals(username) && rm.getLoginPassword().equals(password)) {
                 logger.debug("found matching user role for authenticated user {uname='"+username+"'}");
                       if (role<=rm.getRoleID())
                         role = rm.getRoleID();
        }
       }
    
       String roleStr = config.getADIdentity().getRoleFromID(role);
      
       if (role==0)
           throw new ArchivaException("failed to authenticate user as no role could be assigned {username='"+username+"',role='"+roleStr+"'}",logger);   
        else {
           logger.debug("auth user is assigned a role {uname='"+username+"',role='"+roleStr+"'}");
           List<String> emailAddresses = new ArrayList<String>();
           emailAddresses.add(username);
           return new MailArchivaPrincipal(username,config.getADIdentity().getRoleFromID(role),emailAddresses,null);
View Full Code Here

         return new MailArchivaPrincipal(username,"administrator",null,null);
       }
       ArrayList<AttributeValue> attributeValues = getADAttributes(identity, username, password);
       int userRole = getRole(identity,attributeValues);
       if (userRole==0)
          throw new ArchivaException("failed to authenticate user as no role could be assigned {username='"+username+"'}",logger);   
       else {
         List<String> emailAddresses = getEmailAddresses(identity,attributeValues);
         return new MailArchivaPrincipal(username,identity.getRoleFromID(userRole),emailAddresses);
       }
   }
View Full Code Here

       LoginContext serverLC   = null;
       BeanCallbackHandler beanCallbackHandler = null;
       String kdcAddress        =  identity.getKDCAddress();
       int at = username.lastIndexOf('@');
       if (at<=0 || at>=username.length()-1) {
           throw new ArchivaException("invalid login name. must be username@domain",logger);
       }
       uname = username.substring(0,at).toLowerCase(Locale.ENGLISH);
       domain = username.substring(at+1).toUpperCase(Locale.ENGLISH);
       String confFile = Config.getConfigurationPath()+ File.separatorChar + "login.conf";
       beanCallbackHandler = new BeanCallbackHandler(uname, password);
       System.setProperty("java.security.krb5.realm", domain);
       System.setProperty("java.security.krb5.kdc", kdcAddress);
       System.setProperty("java.security.auth.login.config", confFile);
       if (logger.isDebugEnabled())
         System.setProperty("sun.security.krb5.debug","true");
       System.setProperty("java.security.auth.login.config", confFile);
       try {
           serverLC = new LoginContext(confName, beanCallbackHandler);
           serverLC.login();  
       } catch (Exception e) {
           throw new ArchivaException("failed to login using kerberos server. "+e.getMessage()+" {realm='"+domain+"',kdcAddress='"+kdcAddress+"'}",e,logger);
       }
       try {
            return (ArrayList<AttributeValue>)Subject.doAs(serverLC.getSubject(), new ADAction(identity,uname, domain));
       } catch (Exception e) {
         throw new ArchivaException("failed to bind to ldap server {uname='"+uname+"',domain='"+domain+"'}",e,logger);
       }
   }
View Full Code Here

        return "volumepath='"+path+"',indexpath='"+indexPath+"',volumestatus='"+status+"',modified='"+modified+"',created='"+created+"'";
    }
   
     protected synchronized void setFreeSpace() throws ArchivaException {
       if (!new File(getIndexPath()).exists())
               throw new ArchivaException("cannot determine disk space (volume index path does not exist) {"+toString()+"}",logger);
          
           if (!new File(getPath()).exists())
               throw new ArchivaException("cannot determine disk space (volume store path does not exist) {"+toString()+"}",logger);
          
           long freeIndexSpace    = Long.MAX_VALUE / 2;
           long freeArchiveSpace = Long.MAX_VALUE / 2;
          
           try {
View Full Code Here

          }
          try {
            store.connect(server,port, username,password);
          } catch (AuthenticationFailedException e) {
            logger.error("cannot connect to mail server. authentication failed {"+props+"}");
              throw new ArchivaException ("unable to connect to mail server. could not authenticate. {"+props+"}",e,logger);
          } catch (IllegalStateException ise) {
            throw new ArchivaException ("attempt to connect mail server when it already connected. {"+props+"}",ise,logger);
          } catch (MessagingException me) {
            if (me.getMessage().contains("sun.security.validator.ValidatorException")) {
              throw new ArchivaException ("failed to authenticate TLS certificate. You must install the mail server's certificate as per the administration guide.",me,logger);
            } else if (connection.getConnectionMode()==MailboxConnections.ConnectionMode.FALLBACK &&
                   me.getMessage().contains("javax.net.ssl.SSLHandshakeException")) {
              logger.debug("cannot establish SSL handshake with mail server. falling back to insecure. {"+props+"}");
              connection.setConnectionMode(MailboxConnections.ConnectionMode.INSECURE);
            } else throw new ArchivaException ("failed to connect to mail server. "+me.getMessage()+". {"+props+"}",me,logger);
          } catch (Throwable e) {
            throw new ArchivaException ("unable to connect to mail server:"+e.getMessage(),e,logger);
          }
          try {   
              inboxFolder = store.getDefaultFolder();
       } catch (Throwable e) {
           throw new ArchivaException ("unable to get default folder. ",e,logger);
       }
       
          if (inboxFolder == null) {
              throw new ArchivaException ("there was no default POP inbox folder found.",logger);
          }   
    
          try {   
              inboxFolder = inboxFolder.getFolder("INBOX");
              if (inboxFolder == null) {
                  throw new ArchivaException ("the inbox folder does not exist.",logger);
              }
          } catch (Throwable e) {
             throw new ArchivaException ("unable to get INBOX folder. ",e,logger);
          }
          try {
              inboxFolder.open(Folder.READ_WRITE);           
          } catch (Throwable e) {
              throw new ArchivaException ("unable to open folder. ",e,logger);
          }   
          return;
    }
View Full Code Here

                      userDN = result.getNameInNamespace();
                      break;
                  }
                  ctx.close();
                  if (userDN==null) {
                    throw new ArchivaException("the user "+loginName+" does exist in the LDAP repository. is the login name or bind attribute correct?",logger,ChainedException.Level.WARN);
                  }
                  logger.debug("findUserDN() return {userdn='"+userDN+"'}");
                  return userDN;
                
      } catch (javax.naming.AuthenticationException ae) {
        throw new ArchivaException("failed to authenticate with LDAP service account. verify that the service DN and password is correct.",logger,ChainedException.Level.WARN);
      } catch (javax.naming.CommunicationException ce) {
        throw new ArchivaException("failed to connect to ldap server. verify that the server address and port is correct.",logger,ChainedException.Level.WARN);
      } catch (javax.naming.NameNotFoundException nnfe ) {
        throw new ArchivaException("could not lookup user in LDAP as the Base DN does not appear to be correct",logger,ChainedException.Level.WARN);
      } catch (javax.naming.PartialResultException pre) {
       } catch (ArchivaException e) {
         throw e;
      } catch (Exception e) {
        throw new ArchivaException("failed to lookup user using LDAP service account:"+e.getMessage(),logger,ChainedException.Level.DEBUG);
      }
      return null;
   }
View Full Code Here

      messageStore.initKeys();
  }
 
  public static Email getMessageByID(String volumeName, String uniqueId, boolean headersOnly) throws ArchivaException {
    if (volumeName == null || uniqueId == null)
          throw new ArchivaException("assertion failure: null emailId",logger);

    logger.debug("getMessageByID() {volumeName="+volumeName+",uniqueId='"+uniqueId+"'}");
    Volume volume = ConfigurationService.getConfig().getVolumes().getNewVolume(volumeName);
    EmailID emailID = EmailID.getEmailID(volume, uniqueId);
    return messageStore.retrieveMessage(emailID);
View Full Code Here

  protected static void assignEmailID(Email message,Volumes vols) throws ArchivaException {

      vols.readyActiveVolume();
      Volume activeVolume = vols.getActiveVolume();
      if (activeVolume==null)
        throw new ArchivaException("failed to archive message. there are no volumes available with sufficient diskspace. please configure one.",logger);
      EmailID emailID = EmailID.getEmailID(activeVolume, message);
      message.setEmailID(emailID)
  }
View Full Code Here

  }
 
 
  public static void indexVolume(Principal principal, int volumeIndex, IndexStatus status) throws ArchivaException {
      if (status == null )
        throw new ArchivaException("assertion failure: null status",logger);
      status.start();
      Volume volume = ConfigurationService.getConfig().getVolumes().getVolume(volumeIndex);
      audit.info("index volume {"+volume+", "+principal+"}");
    logger.debug("index volume {"+volume+", "+principal+"}");
      messageIndex.deleteIndex(volume);
View Full Code Here

TOP

Related Classes of com.stimulus.archiva.exception.ArchivaException

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.