use of password.pwm.PwmAboutProperty in project pwm by pwm-project.
the class DatabaseService method updateDebugProperties.
private void updateDebugProperties(final Connection connection) {
if (connection != null) {
try {
final Map<PwmAboutProperty, String> returnObj = new LinkedHashMap<>();
final DatabaseMetaData databaseMetaData = connection.getMetaData();
returnObj.put(PwmAboutProperty.database_driverName, databaseMetaData.getDriverName());
returnObj.put(PwmAboutProperty.database_driverVersion, databaseMetaData.getDriverVersion());
returnObj.put(PwmAboutProperty.database_databaseProductName, databaseMetaData.getDatabaseProductName());
returnObj.put(PwmAboutProperty.database_databaseProductVersion, databaseMetaData.getDatabaseProductVersion());
debugInfo.clear();
debugInfo.putAll(Collections.unmodifiableMap(returnObj));
} catch (SQLException e) {
LOGGER.error("error reading jdbc meta data: " + e.getMessage());
}
}
}
use of password.pwm.PwmAboutProperty in project pwm by pwm-project.
the class AppDashboardData method makeAboutJavaData.
private static List<DisplayElement> makeAboutJavaData(final PwmApplication pwmApplication, final Locale locale) {
final Map<PwmAboutProperty, String> aboutMap = PwmAboutProperty.makeInfoBean(pwmApplication);
final List<DisplayElement> javaInfo = new ArrayList<>();
final String notApplicable = Display.getLocalizedMessage(locale, Display.Value_NotApplicable, pwmApplication.getConfig());
{
final List<PwmAboutProperty> interestedProperties = Arrays.asList(PwmAboutProperty.java_vmName, PwmAboutProperty.java_vmVendor, PwmAboutProperty.java_vmVersion, PwmAboutProperty.java_runtimeVersion, PwmAboutProperty.java_vmLocation, PwmAboutProperty.java_appServerInfo, PwmAboutProperty.java_osName, PwmAboutProperty.java_osVersion, PwmAboutProperty.java_osArch, PwmAboutProperty.java_memoryFree, PwmAboutProperty.java_memoryAllocated, PwmAboutProperty.java_memoryMax, PwmAboutProperty.java_threadCount);
for (final PwmAboutProperty property : interestedProperties) {
javaInfo.add(new DisplayElement(property.name(), DisplayElement.Type.string, property.getLabel(), aboutMap.getOrDefault(property, notApplicable)));
}
}
{
final PwmNumberFormat numberFormat = PwmNumberFormat.forLocale(locale);
final String display = numberFormat.format(pwmApplication.getResourceServletService().itemsInCache()) + "items (" + numberFormat.format(pwmApplication.getResourceServletService().bytesInCache()) + " bytes)";
javaInfo.add(new DisplayElement("resourceFileServletCacheSize", DisplayElement.Type.string, "ResourceFileServlet Cache", display));
}
javaInfo.add(new DisplayElement("resourceFileServletCacheHitRatio", DisplayElement.Type.string, "ResourceFileServlet Cache Hit Ratio", pwmApplication.getResourceServletService().cacheHitRatio().pretty(2)));
{
final Map<SessionTrackService.DebugKey, String> debugInfoMap = pwmApplication.getSessionTrackService().getDebugData();
javaInfo.add(new DisplayElement("sessionTotalSize", DisplayElement.Type.string, "Estimated Session Total Size", debugInfoMap.get(SessionTrackService.DebugKey.HttpSessionTotalSize)));
javaInfo.add(new DisplayElement("sessionAverageSize", DisplayElement.Type.string, "Estimated Session Average Size", debugInfoMap.get(SessionTrackService.DebugKey.HttpSessionAvgSize)));
}
return Collections.unmodifiableList(javaInfo);
}
use of password.pwm.PwmAboutProperty in project pwm by pwm-project.
the class TelemetryService method generatePublishableBean.
public TelemetryPublishBean generatePublishableBean() throws URISyntaxException, IOException, PwmUnrecoverableException {
final StatisticsBundle bundle = pwmApplication.getStatisticsManager().getStatBundleForKey(StatisticsManager.KEY_CUMULATIVE);
final Configuration config = pwmApplication.getConfig();
final Map<PwmAboutProperty, String> aboutPropertyStringMap = PwmAboutProperty.makeInfoBean(pwmApplication);
final Map<String, String> statData = new TreeMap<>();
for (final Statistic loopStat : Statistic.values()) {
statData.put(loopStat.getKey(), bundle.getStatistic(loopStat));
}
final List<String> configuredSettings = new ArrayList<>();
for (final PwmSetting pwmSetting : config.nonDefaultSettings()) {
if (!pwmSetting.getCategory().hasProfiles() && !config.isDefaultValue(pwmSetting)) {
configuredSettings.add(pwmSetting.getKey());
}
}
String ldapVendorName = null;
for (final LdapProfile ldapProfile : config.getLdapProfiles().values()) {
if (ldapVendorName == null) {
try {
final DirectoryVendor directoryVendor = ldapProfile.getProxyChaiProvider(pwmApplication).getDirectoryVendor();
final PwmLdapVendor pwmLdapVendor = PwmLdapVendor.fromChaiVendor(directoryVendor);
if (pwmLdapVendor != null) {
ldapVendorName = pwmLdapVendor.name();
}
} catch (Exception e) {
LOGGER.trace(SessionLabel.TELEMETRY_SESSION_LABEL, "unable to read ldap vendor type for stats publication: " + e.getMessage());
}
}
}
final Map<String, String> aboutStrings = new TreeMap<>();
{
for (final Map.Entry<PwmAboutProperty, String> entry : aboutPropertyStringMap.entrySet()) {
final PwmAboutProperty pwmAboutProperty = entry.getKey();
aboutStrings.put(pwmAboutProperty.name(), entry.getValue());
}
aboutStrings.remove(PwmAboutProperty.app_instanceID.name());
aboutStrings.remove(PwmAboutProperty.app_siteUrl.name());
}
final TelemetryPublishBean.TelemetryPublishBeanBuilder builder = TelemetryPublishBean.builder();
builder.timestamp(Instant.now());
builder.id(makeId(pwmApplication));
builder.instanceHash(pwmApplication.getSecureService().hash(pwmApplication.getInstanceID()));
builder.installTime(pwmApplication.getInstallTime());
builder.siteDescription(config.readSettingAsString(PwmSetting.PUBLISH_STATS_SITE_DESCRIPTION));
builder.versionBuild(PwmConstants.BUILD_NUMBER);
builder.versionVersion(PwmConstants.BUILD_VERSION);
builder.ldapVendorName(ldapVendorName);
builder.statistics(Collections.unmodifiableMap(statData));
builder.configuredSettings(Collections.unmodifiableList(configuredSettings));
builder.about(aboutStrings);
return builder.build();
}
use of password.pwm.PwmAboutProperty in project pwm by pwm-project.
the class DatabaseService method serviceInfo.
@Override
public ServiceInfoBean serviceInfo() {
final Map<String, String> debugProperties = new LinkedHashMap<>();
for (final Map.Entry<PwmAboutProperty, String> entry : debugInfo.entrySet()) {
final PwmAboutProperty pwmAboutProperty = entry.getKey();
debugProperties.put(pwmAboutProperty.name(), entry.getValue());
}
if (status() == STATUS.OPEN) {
return new ServiceInfoBean(Collections.singletonList(DataStorageMethod.DB), debugProperties);
} else {
return new ServiceInfoBean(Collections.emptyList(), debugProperties);
}
}
Aggregations