@Deprecated Def(String name, String rrdPath, String dsName, ConsolFun consolFun, String backend) { super(name); this.rrdPath = rrdPath; this.dsName = dsName; this.consolFun = consolFun; this.backend = RrdBackendFactory.getFactory(backend); }
/** * Defines virtual datasource. This datasource can then be used * in other methods like {@link #datasource(String, String)} or * {@link #gprint(String, ConsolFun, String)}. * * @param name Source name * @param rrdPath Path to RRD file * @param dsName Datasource name in the specified RRD file * @param consolFun Consolidation function (AVERAGE, MIN, MAX, LAST) * @param backend Backend to be used while fetching data from a RRD file. * * @deprecated Uses {@link #datasource(String, String, String, ConsolFun, RrdBackendFactory)} instead */ @Deprecated public void datasource(String name, String rrdPath, String dsName, ConsolFun consolFun, String backend) { sources.add(new Def(name, rrdPath, dsName, consolFun, RrdBackendFactory.getFactory(backend))); }
/** * Replaces the default backend factory with a new one. This method must be called before * the first RRD gets created. <p> * * @param factoryName Name of the default factory. Out of the box, Rrd4j supports four * different RRD backends: "FILE" (java.io.* based), "SAFE" (java.io.* based - use this * backend if RRD files may be accessed from several JVMs at the same time), * "NIO" (java.nio.* based) and "MEMORY" (byte[] based). */ public static void setDefaultFactory(String factoryName) { // We will allow this only if no RRDs are created if (!RrdBackend.isInstanceCreated()) { defaultFactory = getFactory(factoryName); } else { throw new IllegalStateException("Could not change the default backend factory. " + "This method must be called before the first RRD gets created"); } }
/** * <p>Adds simple source (<b>DEF</b>). Source <code>name</code> can be used:</p> * <ul> * <li>To specify sources for line, area and stack plots.</li> * <li>To define complex sources * </ul> * * @param name Source name. * @param file Path to RRD file. * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD * file ("AVERAGE", "MIN", "MAX" or "LAST" - these string constants are conveniently defined * in the {@link org.rrd4j.ConsolFun ConsolFun} class). * @param backend Name of the RrdBackendFactory that should be used for this RrdDb. * @deprecated uses {@link #addDatasource(String, String, String, ConsolFun, RrdBackendFactory)} instead */ @Deprecated public void addDatasource(String name, String file, String dsName, ConsolFun consolFunc, String backend) { Def def = new Def(name, file, dsName, consolFunc, RrdBackendFactory.getFactory(backend)); sources.put(name, def); }
/** * Replaces the default backend factory with a new one. This method must be called before * the first RRD gets created. * <p> * It also clear the list of actives factories and set it to the default factory. * <p> * * @deprecated Uses active factory instead * @param factoryName Name of the default factory.. */ @Deprecated public static synchronized void setDefaultFactory(String factoryName) { // We will allow this only if no RRDs are created if (!RrdBackend.isInstanceCreated()) { activeFactories.clear(); activeFactories.add(getFactory(factoryName)); } else { throw new IllegalStateException( "Could not change the default backend factory. " + "This method must be called before the first RRD gets created"); } }
RrdDatabase(RrdDef def, String backendFactory) throws IOException { if (backendFactory != null) rrdDb = new RrdDb(def, RrdBackendFactory.getFactory(backendFactory)); else rrdDb = new RrdDb(def); }
RrdDatabase(String path, String backendFactory, boolean readOnly) throws IOException { if (backendFactory != null) { rrdDb = new RrdDb(path, readOnly, RrdBackendFactory.getFactory(backendFactory)); } else { rrdDb = new RrdDb(path, readOnly); } }
public static final void prepare(String backend) { usepool = false; if(backend != null) { StoreOpener.backend = RrdBackendFactory.getFactory(backend); logger.trace(Util.delayedFormatString("Store backend set to %s", backend)); } else StoreOpener.backend = RrdBackendFactory.getDefaultFactory(); logger.debug(Util.delayedFormatString("Store backend used is %s", StoreOpener.backend.getName())); logger.debug(Util.delayedFormatString("use pool: %b", usepool)); }
backendFactory = factoryClass.getConstructor().newInstance(); try { RrdBackendFactory.getFactory(backendFactory.getName()); } catch (IllegalArgumentException e) { RrdBackendFactory.registerFactory(backendFactory); backendFactory = RrdBackendFactory.getFactory(backendName);
private RrdDb getRrd(Def def) throws IOException { String path = def.getPath(), backend = def.getBackend(); if (poolUsed && backend == null) { return RrdDbPool.getInstance().requestRrdDb(path); } else if (backend != null) { return new RrdDb(path, true, RrdBackendFactory.getFactory(backend)); } else { return new RrdDb(path, true); } }