/** * Return the URI associated to this backend, using the factory to generate it from the path. * * @return URI to this backend's rrd. */ public URI getUri() { return factory.getUri(path); }
/** * <p>Sets path to RRD.</p> * <p>The will be transformed internally to an URI using the default backend factory.</p> * * @param path path to new RRD. */ public void setPath(String path) { this.uri = RrdBackendFactory.getDefaultFactory().getUri(path); }
/** * Returns the number of usage for a RRD. * * @param path RRD's path for which informations is needed. * @return the number of request for this file * @throws java.io.IOException if any. */ public int getOpenCount(String path) throws IOException { return getOpenCount(defaultFactory.getUri(path)); }
/** * <p>Requests a RrdDb reference for the given RRD file path.</p> * <ul> * <li>If the file is already open, previously returned RrdDb reference will be returned. Its usage count * will be incremented by one. * <li>If the file is not already open and the number of already open RRD files is less than * {@link #INITIAL_CAPACITY}, the file will be open and a new RrdDb reference will be returned. * If the file is not already open and the number of already open RRD files is equal to * {@link #INITIAL_CAPACITY}, the method blocks until some RRD file is closed. * </ul> * <p>The path is transformed internally to URI using the default factory, that is the reference that will * be used elsewhere.</p> * * @param path Path to existing RRD file * @return reference for the give RRD file * @throws java.io.IOException Thrown in case of I/O error * @deprecated Use the {@link org.rrd4j.core.RrdDb.Builder} instead. */ @Deprecated public RrdDb requestRrdDb(String path) throws IOException { return requestRrdDb(defaultFactory.getUri(path), defaultFactory); }
/** * <p>Requests a RrdDb reference for the given path. The file will be created from * external data (from XML dump or RRDTool's binary RRD file).</p> * <ul> * <li>If the file with the path specified is already open, * the method blocks until the file is closed. * <li>If the file is not already open and the number of already open RRD files is less than * {@link #INITIAL_CAPACITY}, a new RRD file will be created and a its RrdDb reference will be returned. * If the file is not already open and the number of already open RRD files is equal to * {@link #INITIAL_CAPACITY}, the method blocks until some RRD file is closed. * </ul> * <p>The path is transformed internally to URI using the default factory, that is the reference that will * be used elsewhere.</p> * * @param path Path to RRD file which should be created * @param sourcePath Path to external data which is to be converted to Rrd4j's native RRD file format * @return Reference to the newly created RRD file * @throws java.io.IOException Thrown in case of I/O error * @deprecated Use the {@link org.rrd4j.core.RrdDb.Builder} instead. */ @Deprecated public RrdDb requestRrdDb(String path, String sourcePath) throws IOException { URI uri = RrdBackendFactory.getDefaultFactory().getUri(path); RrdBackendFactory backend = RrdBackendFactory.getDefaultFactory(); return requestRrdDb(RrdDb.getBuilder().setExternalPath(sourcePath), uri, backend); }