/** * Initializes the object * * @param bag bag of pegasus objects */ public void initialize(PegasusBag bag) { String value = System.getenv(COLLECT_METRICS_ENV_VARIABLE); mSendMetricsToServer = Boolean.parse(value, true); value = System.getenv(PRIMARY_METRICS_SERVER_URL_ENV_VARIABLE); if (value != null) { String[] urls = value.split(","); for (int i = 0; i < urls.length; i++) { mMetricsServers.add(urls[i]); } } else { mMetricsServers.add(METRICS_SERVER_DEFAULT_URL); } value = System.getenv(SECONDARY_METRICS_SERVER_URL_ENV_VARIABLE); if (value != null) { String[] urls = value.split(","); for (int i = 0; i < urls.length; i++) { mMetricsServers.add(urls[i]); } } // intialize the logger defensively if (bag != null) { mLogger = bag.getLogger(); } if (mLogger == null) { mLogger = LogManagerFactory.loadSingletonInstance(); } }
/** * Establishes a connection to the database from the properties. You will need to specify a "file" * property to point to the location of the on-disk instance. If the property "quote" is set to a * true value, LFNs and PFNs are always quoted. By default, and if false, LFNs and PFNs are only * quoted as necessary. * * @param props is the property table with sufficient settings to establish a link with the * database. * @return true if connected, false if failed to connect. * @throws Error subclasses for runtime errors in the class loader. */ public boolean connect(Properties props) { // update the m_writeable flag if specified if (props.containsKey(Directory.FLAT_LFN_PROPERTY_KEY)) { mConstructFlatLFN = Boolean.parse(props.getProperty(Directory.FLAT_LFN_PROPERTY_KEY), false); } String value = props.getProperty(Directory.SITE_PROPERTY_KEY); if (value != null) { this.mSiteHandle = value; } value = props.getProperty(Directory.URL_PRFIX_PROPERTY_KEY); if (value != null) { this.mURLPrefix = value; } if (props.containsKey(Directory.DIRECTORY_PROPERTY_KEY)) { return connect(props.getProperty("directory")); } return false; }