protected static String expandFilepath(final String path) { return IoUtil.expandFilepath(path); }
protected static File expandFilepath(final File file) { return IoUtil.expandFilepath(file); }
public static X509Certificate parseCert(final File file) throws IOException, CertificateException { ParamUtil.requireNonNull("file", file); FileInputStream in = new FileInputStream(IoUtil.expandFilepath(file)); try { return parseCert(in); } finally { in.close(); } }
public static X509Certificate parseCert(final String fileName) throws IOException, CertificateException { ParamUtil.requireNonNull("fileName", fileName); return parseCert(new File(IoUtil.expandFilepath(fileName))); }
public static X509CRL parseCrl(final String file) throws IOException, CertificateException, CRLException { ParamUtil.requireNonBlank("file", file); return parseCrl(new FileInputStream(IoUtil.expandFilepath(file))); }
public CaDbImportWorker(final DataSourceFactory datasourceFactory, final PasswordResolver passwordResolver, final String dbConfFile, final boolean resume, final String srcFolder, final int batchEntriesPerCommit, final boolean evaluateOnly) throws DataAccessException, PasswordResolverException, IOException, JAXBException { ParamUtil.requireNonNull("datasourceFactory", datasourceFactory); Properties props = DbPorter.getDbConfProperties( new FileInputStream(IoUtil.expandFilepath(dbConfFile))); this.datasource = datasourceFactory.createDataSource("ds-" + dbConfFile, props, passwordResolver); JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class); unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(DbPorter.retrieveSchema("/xsd/dbi-ca.xsd")); this.resume = resume; this.srcFolder = IoUtil.expandFilepath(srcFolder); this.batchEntriesPerCommit = batchEntriesPerCommit; this.evaluateOnly = evaluateOnly; }
public OcspDbImportWorker(final DataSourceFactory datasourceFactory, final PasswordResolver passwordResolver, final String dbConfFile, final boolean resume, final String srcFolder, final int batchEntriesPerCommit, final boolean evaluateOnly) throws DataAccessException, PasswordResolverException, IOException, JAXBException { ParamUtil.requireNonNull("datasourceFactory", datasourceFactory); ParamUtil.requireNonNull("dbConfFile", dbConfFile); Properties props = DbPorter.getDbConfProperties( new FileInputStream(IoUtil.expandFilepath(dbConfFile))); this.datasource = datasourceFactory.createDataSource("ds-" + dbConfFile, props, passwordResolver); JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class); unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(DbPorter.retrieveSchema("/xsd/dbi-ocsp.xsd")); this.resume = resume; this.srcFolder = IoUtil.expandFilepath(srcFolder); this.batchEntriesPerCommit = batchEntriesPerCommit; this.evaluateOnly = evaluateOnly; }
public OcspFromCaDbImportWorker(final DataSourceFactory datasourceFactory, final PasswordResolver passwordResolver, final String dbConfFile, final String publisherName, final boolean resume, final String srcFolder, final int batchEntriesPerCommit, final boolean evaluateOnly) throws DataAccessException, PasswordResolverException, IOException, JAXBException { ParamUtil.requireNonNull("dbConfFile", dbConfFile); ParamUtil.requireNonNull("datasourceFactory", datasourceFactory); Properties props = DbPorter.getDbConfProperties( new FileInputStream(IoUtil.expandFilepath(dbConfFile))); this.datasource = datasourceFactory.createDataSource("ds-" + dbConfFile, props, passwordResolver); JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class); unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(DbPorter.retrieveSchema("/xsd/dbi-ca.xsd")); this.publisherName = publisherName; this.resume = resume; this.srcFolder = IoUtil.expandFilepath(srcFolder); this.batchEntriesPerCommit = batchEntriesPerCommit; this.evaluateOnly = evaluateOnly; }
public DbDigestExportWorker(final DataSourceFactory datasourceFactory, final PasswordResolver passwordResolver, final String dbConfFile, final String destFolder, final int numCertsPerSelect, final int numThreads) throws DataAccessException, PasswordResolverException, IOException, JAXBException { ParamUtil.requireNonNull("datasourceFactory", datasourceFactory); ParamUtil.requireNonNull("dbConfFile", dbConfFile); this.destFolder = ParamUtil.requireNonNull("destFolder", destFolder); File file = new File(destFolder); if (!file.exists()) { file.mkdirs(); } else { if (!file.isDirectory()) { throw new IOException(destFolder + " is not a folder"); } if (!file.canWrite()) { throw new IOException(destFolder + " is not writable"); } } String[] children = file.list(); if (children != null && children.length > 0) { throw new IOException(destFolder + " is not empty"); } Properties props = DbPorter.getDbConfProperties( new FileInputStream(IoUtil.expandFilepath(dbConfFile))); this.datasource = datasourceFactory.createDataSource("ds-" + dbConfFile, props, passwordResolver); this.numCertsPerSelect = numCertsPerSelect; this.numThreads = numThreads; } // constructor
new FileInputStream(IoUtil.expandFilepath(dbConfFile))); this.datasource = datasourceFactory.createDataSource("ds-" + dbConfFile, props, passwordResolver);
new FileInputStream(IoUtil.expandFilepath(dbConfFile))); this.datasource = datasourceFactory.createDataSource("ds-" + dbConfFile, props, passwordResolver); this.refDirname = null; Properties refProps = DbPorter.getDbConfProperties( new FileInputStream(IoUtil.expandFilepath(refDbConfFile))); this.refDatasource = datasourceFactory.createDataSource( "ds-" + refDbConfFile, refProps, passwordResolver);
public DbToolBase(final DataSourceWrapper datasource, final String baseDir, final AtomicBoolean stopMe) throws DataAccessException { super(); ParamUtil.requireNonBlank("baseDir", baseDir); this.stopMe = ParamUtil.requireNonNull("stopMe", stopMe); this.datasource = ParamUtil.requireNonNull("datasource", datasource); this.connection = datasource.getConnection(); try { this.connectionAutoCommit = connection.getAutoCommit(); } catch (SQLException ex) { throw datasource.translate(null, ex); } this.baseDir = IoUtil.expandFilepath(baseDir); }
File baseDir = new File(IoUtil.expandFilepath(modulePath.substring(PREFIX.length()))); File[] children = baseDir.listFiles();
public CaDbExportWorker(final DataSourceFactory datasourceFactory, final PasswordResolver passwordResolver, final String dbConfFile, final String destFolder, final boolean resume, final int numCertsInBundle, final int numCertsPerSelect, final boolean evaluateOnly) throws DataAccessException, PasswordResolverException, IOException, JAXBException { ParamUtil.requireNonBlank("dbConfFile", dbConfFile); ParamUtil.requireNonBlank("destFolder", destFolder); ParamUtil.requireNonNull("datasourceFactory", datasourceFactory); Properties props = DbPorter.getDbConfProperties( new FileInputStream(IoUtil.expandFilepath(dbConfFile))); this.datasource = datasourceFactory.createDataSource("ds-" + dbConfFile, props, passwordResolver); this.marshaller = getMarshaller(); this.unmarshaller = getUnmarshaller(); this.destFolder = IoUtil.expandFilepath(destFolder); this.resume = resume; this.numCertsInBundle = numCertsInBundle; this.numCertsPerSelect = numCertsPerSelect; this.evaluateOnly = evaluateOnly; checkDestFolder(); }
private DbDigestDiff(final String refDir, final DataSourceWrapper refDatasource, final DataSourceWrapper targetDatasource, final String reportDirName, final boolean revokedOnly, final AtomicBoolean stopMe, final int numPerSelect, final NumThreads numThreads) throws IOException, DataAccessException { if (refDir == null && refDatasource == null) { throw new IllegalArgumentException("refDir and refDatasource must not be both null"); } else if (refDir != null && refDatasource != null) { throw new IllegalArgumentException( "refDir and refDatasource must not be both non-null"); } this.revokedOnly = revokedOnly; this.refDirname = (refDir == null) ? null : IoUtil.expandFilepath(refDir); this.refDatasource = refDatasource; this.targetDatasource = ParamUtil.requireNonNull("targetDatasource", targetDatasource); this.reportDirName = ParamUtil.requireNonNull("reportDirName", reportDirName); this.stopMe = ParamUtil.requireNonNull("stopMe", stopMe); this.numPerSelect = ParamUtil.requireMin("numPerSelect", numPerSelect, 1); DbSchemaType dbSchemaType = DbDigestExportWorker.detectDbSchemaType(targetDatasource); this.targetDbControl = new XipkiDbControl(dbSchemaType); // number of threads this.numTargetThreads = Math.min(numThreads.numTargetThreads(), targetDatasource.maximumPoolSize() - 1); if (this.numTargetThreads != numThreads.numTargetThreads()) { LOG.info("reduce the numTargetThreads from {} to {}", numTargetThreads, this.numTargetThreads); } } // constuctor
String fn = str.substring("file:".length()); try { keystoreStream = new FileInputStream(IoUtil.expandFilepath(fn)); } catch (FileNotFoundException ex) { throw new ObjectCreationException("file not found: " + fn);