org.xipki.util.Args.positive()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.xipki.util.Args.positive()方法的一些代码示例,展示了Args.positive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.positive()方法的具体详情如下:
包路径:org.xipki.util.Args
类名称:Args
方法名:positive

Args.positive介绍

暂无

代码示例

代码示例来源:origin: org.xipki/ca-mgmt-client

CaCertstoreDbExporter(DataSourceWrapper datasource, String baseDir, int numCertsInBundle,
  int numCertsPerSelect, boolean resume, AtomicBoolean stopMe)
    throws DataAccessException {
 super(datasource, baseDir, stopMe);
 this.numCertsInBundle = Args.positive(numCertsInBundle, "numCertsInBundle");
 this.numCertsPerSelect = Args.positive(numCertsPerSelect, "numCertsPerSelect");
 this.resume = resume;
}

代码示例来源:origin: org.xipki/security

public void setDefaultSignerParallelism(int defaultSignerParallelism) {
 this.defaultSignerParallelism = Args.positive(
   defaultSignerParallelism, "defaultSignerParallelism");
}

代码示例来源:origin: org.xipki/ca-api

public void setValidity(int validity) {
 this.validity = Args.positive(validity, "validity");
}

代码示例来源:origin: org.xipki/ocsp-client

public void setNonceLen(int nonceLen) {
 this.nonceLen = Args.positive(nonceLen, "nonceLen");
}

代码示例来源:origin: xipki/xipki

/**
 * TODO.
 * @param maxSize for caches that do not override {@link #sizeOf}, this is
 *     the maximum number of entries in the cache. For all other caches,
 *     this is the maximum sum of the sizes of the entries in this cache.
 */
public LruCache(int maxSize) {
 this.maxSize = Args.positive(maxSize, "maxSize");
 this.map = new LinkedHashMap<>(0, 0.75f, true);
}

代码示例来源:origin: org.xipki/util

/**
 * TODO.
 * @param maxSize for caches that do not override {@link #sizeOf}, this is
 *     the maximum number of entries in the cache. For all other caches,
 *     this is the maximum sum of the sizes of the entries in this cache.
 */
public LruCache(int maxSize) {
 this.maxSize = Args.positive(maxSize, "maxSize");
 this.map = new LinkedHashMap<>(0, 0.75f, true);
}

代码示例来源:origin: org.xipki/ca-mgmt-client

OcspCertstoreDbExporter(DataSourceWrapper datasource, String baseDir, int numCertsInBundle,
  int numCertsPerSelect, boolean resume, AtomicBoolean stopMe) throws Exception {
 super(datasource, baseDir, stopMe);
 this.numCertsInBundle = Args.positive(numCertsInBundle, "numCertsInBundle");
 this.numCertsPerSelect = Args.positive(numCertsPerSelect, "numCertsPerSelect");
 if (resume) {
  File processLogFile = new File(baseDir, PROCESS_LOG_FILENAME);
  if (!processLogFile.exists()) {
   throw new Exception("could not process with '--resume' option");
  }
 }
 this.resume = resume;
} // constructor

代码示例来源:origin: org.xipki/ca-api

public CertValidity(int validity, Unit unit) {
 this.validity = Args.positive(validity, "validity");
 this.unit = Args.notNull(unit, "unit");
}

代码示例来源:origin: org.xipki/ca-mgmt-client

CaCertstoreDbImporter(DataSourceWrapper datasource, String srcDir, int numCertsPerCommit,
  boolean resume, AtomicBoolean stopMe) throws Exception {
 super(datasource, srcDir, stopMe);
 this.numCertsPerCommit = Args.positive(numCertsPerCommit, "numCertsPerCommit");
 this.resume = resume;
 File processLogFile = new File(baseDir, DbPorter.IMPORT_PROCESS_LOG_FILENAME);
 if (resume) {
  if (!processLogFile.exists()) {
   throw new Exception("could not process with '--resume' option");
  }
 } else {
  if (processLogFile.exists()) {
   throw new Exception("please either specify '--resume' option or delete the file "
     + processLogFile.getPath() + " first");
  }
 }
}

代码示例来源:origin: org.xipki/ca-mgmt-client

OcspCertstoreDbImporter(DataSourceWrapper datasource, String srcDir, int numCertsPerCommit,
  boolean resume, AtomicBoolean stopMe) throws Exception {
 super(datasource, srcDir, stopMe);
 this.numCertsPerCommit = Args.positive(numCertsPerCommit, "numCertsPerCommit");
 File processLogFile = new File(baseDir, DbPorter.IMPORT_PROCESS_LOG_FILENAME);
 if (resume) {
  if (!processLogFile.exists()) {
   throw new Exception("could not process with '--resume' option");
  }
 } else {
  if (processLogFile.exists()) {
   throw new Exception("please either specify '--resume' option or delete the file "
     + processLogFile.getPath() + " first");
  }
 }
 this.resume = resume;
}

代码示例来源:origin: org.xipki/util

/**
 * Sets the size of the cache.
 *
 * @param maxSize the new maximum size.
 */
public void resize(int maxSize) {
 synchronized (this) {
  this.maxSize = Args.positive(maxSize, "maxSize");
 }
 trimToSize(maxSize);
}

代码示例来源:origin: xipki/xipki

/**
 * Sets the size of the cache.
 *
 * @param maxSize the new maximum size.
 */
public void resize(int maxSize) {
 synchronized (this) {
  this.maxSize = Args.positive(maxSize, "maxSize");
 }
 trimToSize(maxSize);
}

代码示例来源:origin: org.xipki/ca-mgmt-client

OcspCertStoreFromCaDbImporter(DataSourceWrapper datasource,  String srcDir, String publisherName,
  int numCertsPerCommit, boolean resume, AtomicBoolean stopMe) throws Exception {
 super(datasource, srcDir, stopMe);
 this.publisherName = Args.toNonBlankLower(publisherName, "publisherName");;
 this.numCertsPerCommit = Args.positive(numCertsPerCommit, "numCertsPerCommit");
 File processLogFile = new File(baseDir, DbPorter.IMPORT_TO_OCSP_PROCESS_LOG_FILENAME);
 if (resume) {
  if (!processLogFile.exists()) {
   throw new Exception("could not process with '--resume' option");
  }
 } else {
  if (processLogFile.exists()) {
   throw new Exception("please either specify '--resume' or delete the file "
     + processLogFile.getPath() + " first");
  }
 }
 this.resume = resume;
}

代码示例来源:origin: org.xipki/ca-api

public Ca(NameId ident, int serialNoBitLen, long nextCrlNumber, String signerType,
  String signerConf, CaUris caUris, int numCrls, int expirationPeriod) {
 this.ident = Args.notNull(ident, "ident");
 this.signerType = Args.toNonBlankLower(signerType, "signerType");
 this.expirationPeriod = Args.notNegative(expirationPeriod, "expirationPeriod");
 this.signerConf = Args.notBlank(signerConf, "signerConf");
 this.numCrls = Args.positive(numCrls, "numCrls");
 this.serialNoBitLen = Args.range(serialNoBitLen, "serialNoBitLen", 63, 159);
 this.nextCrlNumber = Args.positive(nextCrlNumber, "nextCrlNumber");
 this.caUris = (caUris == null) ? CaUris.EMPTY_INSTANCE : caUris;
}

代码示例来源:origin: org.xipki/ca-server

public List<SerialWithId> getSerialNumbers(NameId ca,  long startId, int numEntries,
  boolean onlyRevoked) throws OperationException {
 Args.notNull(ca, "ca");
 Args.positive(numEntries, "numEntries");
 final String sql = getSqlSerials(numEntries, onlyRevoked);
 ResultSet rs = null;
 PreparedStatement ps = borrowPreparedStatement(sql);
 try {
  ps.setLong(1, startId - 1);
  ps.setInt(2, ca.getId());
  rs = ps.executeQuery();
  List<SerialWithId> ret = new ArrayList<>();
  while (rs.next() && ret.size() < numEntries) {
   long id = rs.getLong("ID");
   String serial = rs.getString("SN");
   ret.add(new SerialWithId(id, new BigInteger(serial, 16)));
  }
  return ret;
 } catch (SQLException ex) {
  throw new OperationException(DATABASE_FAILURE, datasource.translate(sql, ex).getMessage());
 } finally {
  datasource.releaseResources(ps, rs);
 }
} // method getSerialNumbers

代码示例来源:origin: org.xipki/ca-server

public List<BigInteger> getExpiredSerialNumbers(NameId ca, long expiredAt, int numEntries)
  throws OperationException {
 Args.notNull(ca, "ca");
 Args.positive(numEntries, "numEntries");
 final String sql = getSqlExpiredSerials(numEntries);
 ResultSet rs = null;
 PreparedStatement ps = borrowPreparedStatement(sql);
 try {
  ps.setInt(1, ca.getId());
  ps.setLong(2, expiredAt);
  rs = ps.executeQuery();
  List<BigInteger> ret = new ArrayList<>();
  while (rs.next() && ret.size() < numEntries) {
   String serial = rs.getString("SN");
   ret.add(new BigInteger(serial, 16));
  }
  return ret;
 } catch (SQLException ex) {
  throw new OperationException(DATABASE_FAILURE, datasource.translate(sql, ex).getMessage());
 } finally {
  datasource.releaseResources(ps, rs);
 }
} // method getExpiredSerialNumbers

代码示例来源:origin: org.xipki/ca-server

public List<BigInteger> getSuspendedCertSerials(NameId ca, long latestLastUpdate, int numEntries)
  throws OperationException {
 Args.notNull(ca, "ca");
 Args.positive(numEntries, "numEntries");
 final String sql = getSqlSuspendedSerials(numEntries);
 ResultSet rs = null;
 PreparedStatement ps = borrowPreparedStatement(sql);
 try {
  ps.setInt(1, ca.getId());
  ps.setLong(2, latestLastUpdate + 1);
  ps.setInt(3, CrlReason.CERTIFICATE_HOLD.getCode());
  rs = ps.executeQuery();
  List<BigInteger> ret = new ArrayList<>();
  while (rs.next() && ret.size() < numEntries) {
   String str = rs.getString("SN");
   ret.add(new BigInteger(str, 16));
  }
  return ret;
 } catch (SQLException ex) {
  throw new OperationException(DATABASE_FAILURE, datasource.translate(sql, ex).getMessage());
 } finally {
  datasource.releaseResources(ps, rs);
 }
} // method getSuspendedCertIds

代码示例来源:origin: org.xipki/security

public ConcurrentContentSigner createSigner(AlgorithmIdentifier signatureAlgId, int parallelism)
  throws XiSecurityException, P11TokenException {
 Args.positive(parallelism, "parallelism");
 List<XiContentSigner> signers = new ArrayList<>(parallelism);
 for (int i = 0; i < parallelism; i++) {
  XiContentSigner signer = new P11ContentSigner.Mac(cryptService, identityId, signatureAlgId);
  signers.add(signer);
 } // end for
 final boolean mac = true;
 DfltConcurrentContentSigner concurrentSigner;
 try {
  concurrentSigner = new DfltConcurrentContentSigner(mac, signers, null);
 } catch (NoSuchAlgorithmException ex) {
  throw new XiSecurityException(ex.getMessage(), ex);
 }
 try {
  byte[] sha1HashOfKey = cryptService.getIdentity(identityId).digestSecretKey(
    PKCS11Constants.CKM_SHA_1);
  concurrentSigner.setSha1DigestOfMacKey(sha1HashOfKey);
 } catch (P11TokenException | XiSecurityException ex) {
  LogUtil.warn(LOG, ex, "could not compute the digest of secret key " + identityId);
 }
 return concurrentSigner;
} // method createSigner

代码示例来源:origin: org.xipki/ca-server

CertRepublisher(NameId ca, X509Cert caCert, CaIdNameMap caIdNameMap, CertStore certstore,
  List<IdentifiedCertPublisher> publishers, boolean onlyRevokedCerts, int numThreads) {
 this.ca = Args.notNull(ca, "ca");
 this.caCert = Args.notNull(caCert, "caCert");
 this.caIdNameMap = Args.notNull(caIdNameMap, "caIdNameMap");
 this.certstore = Args.notNull(certstore, "certstore");
 this.publishers = Args.notEmpty(publishers, "publishers");
 this.onlyRevokedCerts = onlyRevokedCerts;
 this.numThreads = Args.positive(numThreads, "numThreads");
}

代码示例来源:origin: org.xipki/ca-server

@Override
public void republishCertificates(String caName, List<String> publisherNames, int numThreads)
  throws CaMgmtException {
 caName = Args.toNonBlankLower(caName, "caName");
 Args.positive(numThreads, "numThreads");
 asssertMasterMode();
 X509Ca ca = x509cas.get(caName);
 if (ca == null) {
  throw new CaMgmtException(concat("could not find CA named ", caName));
 }
 publisherNames = CollectionUtil.toLowerCaseList(publisherNames);
 if (!ca.republishCerts(publisherNames, numThreads)) {
  throw new CaMgmtException(concat("republishing certificates of CA ", caName, " failed"));
 }
} // method republishCertificates

相关文章