Examples of CAAdminSessionLocal


Examples of org.ejbca.core.ejb.ca.caadmin.CAAdminSessionLocal

   *
   * @see org.ejbca.core.model.services.IWorker#work()
   */
  public void work(Map<Class<?>, Object> ejbs) throws ServiceExecutionFailedException {
    log.trace(">Worker started");
        final CAAdminSessionLocal caAdminSession = ((CAAdminSessionLocal)ejbs.get(CAAdminSessionLocal.class));
   
    // Find CAs with expire date that is less than configured number of days
    // ahead in the future   
    long millistoexpire = getTimeBeforeExpire();
    long now = new Date().getTime();
    long expiretime = now + millistoexpire;

    // Renew these CAs using the CAAdminSessionBean   
    // Check the "Generate new keys" checkbox so we can pass the correct parameter to CAAdminSessionBean
    Collection<Integer> caids = getCAIdsToCheck(false);
    log.debug("Checking renewal for "+caids.size()+" CAs");
    Iterator<Integer> iter = caids.iterator();
    while (iter.hasNext()) {
      Integer caid = iter.next();
      CAInfo info = caAdminSession.getCAInfo(getAdmin(), caid.intValue());
      String caname = null;
      if (info != null) {
        caname = info.getName();
        Date expire = info.getExpireTime();
        log.debug("CA "+caname+" expires on "+expire);
        if (expire.before(new Date(expiretime))) {
          try {
            // Only try to renew active CAs
            // There should be other monitoring available to check if CAs that should not be off-line are off-line (HealthCheck)
            CATokenInfo tokeninfo = info.getCATokenInfo();
            log.debug("CA status is "+info.getStatus()+", CA token status is "+tokeninfo.getCATokenStatus());
            if ( (info.getStatus() == SecConst.CA_ACTIVE) && (tokeninfo.getCATokenStatus() == ICAToken.STATUS_ACTIVE) ) {
              caAdminSession.renewCA(getAdmin(), info.getCAId(), null, isRenewKeys());         
            } else {
              log.debug("Not trying to renew CA because CA and token status are not on-line.");
            }
          } catch (CADoesntExistsException e) {
            log.error("Error renewing CA: ", e);
View Full Code Here

Examples of org.ejbca.core.ejb.ca.caadmin.CAAdminSessionLocal

     *
     * @see org.ejbca.core.model.services.IWorker#work()
     */
    public void work(Map<Class<?>, Object> ejbs) throws ServiceExecutionFailedException {
        log.trace(">CertificateExpirationNotifierWorker.work started");
        final CAAdminSessionLocal caAdminSession = ((CAAdminSessionLocal)ejbs.get(CAAdminSessionLocal.class));
        certificateStoreSession = ((CertificateStoreSessionLocal)ejbs.get(CertificateStoreSessionLocal.class));
        final UserAdminSessionLocal userAdminSession = ((UserAdminSessionLocal)ejbs.get(UserAdminSessionLocal.class));

        ArrayList<EmailCertData> userEmailQueue = new ArrayList<EmailCertData>();
        ArrayList<EmailCertData> adminEmailQueue = new ArrayList<EmailCertData>();

        // Build Query
        String cASelectString = "";
        Collection<Integer> ids = getCAIdsToCheck(false);
        if (ids.size() > 0) {
            Iterator<Integer> iter = ids.iterator();
            while (iter.hasNext()) {
                Integer caid = iter.next();
                CAInfo caInfo = caAdminSession.getCAInfo(getAdmin(), caid);
                if (caInfo == null) {
                    String msg = intres.getLocalizedMessage("services.errorworker.errornoca", caid, null);
                    log.info(msg);
                    continue;
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.