@Override public boolean install() { if (projectConfiguration == null) { projectConfiguration = factory.getProjectConfig(getProject()); } return true; }
/** * Returns whether analytics is enabled or not * * @return */ boolean isEnabled() { return configuration.getBoolean(ANALYTICS_ENABLED, Boolean.FALSE); }
/** * Important: Use this method always to obtain the configuration. Do not invoke this inside a constructor since the * returned {@link Configuration} instance would not be the project scoped one. * * @return The project scoped {@link Configuration} instance */ private Configuration getProjectConfiguration() { if (this.configuration == null) { this.configuration = configurationFactory.getProjectConfig(project); } return this.configuration; } }
@Override public String getApplicationPath() { return getProjectConfiguration().getString(RestFacet.ROOTPATH); }
private void setLastRunDate(Date date) { SimpleDateFormat sdf = new SimpleDateFormat(ANALYTICS_DATE_MASK); configuration.setProperty(ANALYTICS_LAST_RUN, sdf.format(date)); }
@Override public boolean getBoolean(final String key, final boolean defaultValue) { for (Configuration config : delegates.values()) { Object property = config.getProperty(key); if (property != null) { return config.getBoolean(key); } } return defaultValue; }
@Override public Float getFloat(final String key, final Float defaultValue) { for (Configuration config : delegates.values()) { Object property = config.getProperty(key); if (property != null) { return config.getFloat(key); } } return defaultValue; }
@Override public long getLong(final String key, final long defaultValue) { for (Configuration config : delegates.values()) { Object property = config.getProperty(key); if (property != null) { return config.getLong(key); } } return defaultValue; }
@Override public double getDouble(final String key, final double defaultValue) { for (Configuration config : delegates.values()) { Object property = config.getProperty(key); if (property != null) { return config.getDouble(key); } } return defaultValue; }
@Override public short getShort(final String key, final short defaultValue) { for (Configuration config : delegates.values()) { Object property = config.getProperty(key); if (property != null) { return config.getShort(key); } } return defaultValue; }
@Override public boolean isEmpty() { for (Configuration config : delegates.values()) { if (!config.isEmpty()) { return false; } } return true; }
@Override public void clearProperty(final String key) { for (Configuration config : delegates.values()) { config.clearProperty(key); } }
@Override public boolean containsKey(final String key) { for (Configuration config : delegates.values()) { if (config.containsKey(key)) { return true; } } return false; }
@Override public void clear() { for (Configuration config : delegates.values()) { config.clear(); } }
@Override public void addProperty(final String key, final Object value) { getDelegate().addProperty(key, value); }
@Override public void setProperty(final String key, final Object value) { getDelegate().setProperty(key, value); }
/** * Important: Use this method always to obtain the configuration. Do not invoke this inside a constructor since the * returned {@link Configuration} instance would not be the project scoped one. * * @return The project scoped {@link Configuration} instance */ private Configuration getProjectConfiguration() { if (this.configuration == null) { this.configuration = configurationFactory.getProjectConfig(project); } return this.configuration; } }
@Override public float getFloat(final String key, final float defaultValue) { for (Configuration config : delegates.values()) { Object property = config.getProperty(key); if (property != null) { return config.getFloat(key); } } return defaultValue; }
@Override public Long getLong(final String key, final Long defaultValue) { for (Configuration config : delegates.values()) { Object property = config.getProperty(key); if (property != null) { return config.getLong(key); } } return defaultValue; }
/** * Important: Use this method always to obtain the configuration. Do not invoke this inside a constructor since the * returned {@link Configuration} instance would not be the project scoped one. * * @return The project scoped {@link Configuration} instance */ private Configuration getProjectConfiguration() { if (this.configuration == null) { this.configuration = configurationFactory.getProjectConfig(project); } return this.configuration; } }