From: Ray Lee Date: Fri, 3 May 2019 00:56:23 +0000 (-0700) Subject: DRYD-630: Show nuxeo properties in systeminfo. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=5ac67d52068e576965a64075315c261755e3bbb5;p=tmp%2Fjakarta-migration.git DRYD-630: Show nuxeo properties in systeminfo. --- diff --git a/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd b/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd index d35336f9e..9ee8518c0 100644 --- a/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd +++ b/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd @@ -2,14 +2,14 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -53,4 +54,17 @@ + + + + + + + + + + + + diff --git a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java index ecf56cbaf..85ddf090e 100644 --- a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java +++ b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/SystemInfoResource.java @@ -1,7 +1,11 @@ package org.collectionspace.services.systeminfo; import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Locale; +import java.util.Properties; import java.util.TimeZone; import javax.ws.rs.Consumes; @@ -19,11 +23,13 @@ import org.collectionspace.services.authorization.CSpaceResource; import org.collectionspace.services.authorization.URIResourceImpl; import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl; import org.collectionspace.services.common.CSWebApplicationException; +import org.collectionspace.services.common.ServiceMain; import org.collectionspace.services.common.UriInfoWrapper; import org.collectionspace.services.common.context.RemoteServiceContextFactory; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.context.ServiceContextFactory; import org.collectionspace.services.common.security.UnauthorizedException; +import org.nuxeo.runtime.api.Framework; @Path(SystemInfoClient.SERVICE_PATH) @Produces({"application/xml"}) @@ -46,18 +52,18 @@ public class SystemInfoResource extends AbstractCollectionSpaceResourceImpl ctx = createServiceContext(getServiceName(), ui); CSpaceResource res = new URIResourceImpl(ctx.getTenantId(), SystemInfoClient.SERVICE_NAME, HttpMethod.DELETE); if (AuthZ.get().isAccessAllowed(res)) { - result.setNuxeoVersionString("7.10-HF17"); - result.setHost(String.format("Architecture:%s Name:%s Version:%s", - System.getProperty("os.arch"), System.getProperty("os.name"), System.getProperty("os.version"))); - result.setJavaVersionString(System.getProperty("java.version")); - result.setPostgresVersionString("9.5.7"); + // TODO: Stop hardcoding this! + // result.setNuxeoVersionString("7.10-HF17"); + result.setHost(String.format("Architecture:%s Name:%s Version:%s", + System.getProperty("os.arch"), System.getProperty("os.name"), System.getProperty("os.version"))); + result.setJavaVersionString(System.getProperty("java.version")); + + // TODO: Stop hardcoding this! + // result.setPostgresVersionString("9.5.7"); + + Properties properties = Framework.getProperties(); + List names = new ArrayList(properties.stringPropertyNames()); + PropertyList nuxeoPropertyList = new PropertyList(); + + Collections.sort(names); + + for (String name : names) { + Property p = new Property(); + p.setKey(name); + p.setValue(properties.getProperty(name)); + + nuxeoPropertyList.getProperty().add(p); + } + + result.setNuxeoPropertyList(nuxeoPropertyList); } } catch (UnauthorizedException e) { e.printStackTrace(); @@ -93,7 +118,7 @@ public class SystemInfoResource extends AbstractCollectionSpaceResourceImpl getServiceContextFactory() { return (ServiceContextFactory) RemoteServiceContextFactory.get();