[OLINGO-731] Added version information to MANIFEST.MF

This commit is contained in:
mibo 2015-08-10 20:09:46 +02:00
parent 1d88d9c986
commit dc44d7c998
2 changed files with 19 additions and 9 deletions

View File

@ -116,10 +116,11 @@
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId> <artifactId>maven-bundle-plugin</artifactId>
<version>${maven.bundle.plugin.version}</version> <version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<instructions> <instructions>
<Implementation-Version>${project.version}</Implementation-Version>
<Export-Package> <Export-Package>
org.apache.olingo.server.core org.apache.olingo.server.core
</Export-Package> </Export-Package>

View File

@ -46,9 +46,9 @@ import com.fasterxml.jackson.core.JsonGenerator;
public class DebugResponseHelperImpl implements DebugResponseHelper { public class DebugResponseHelperImpl implements DebugResponseHelper {
private static enum DebugFormat { private enum DebugFormat {
JSON, HTML, DOWNLOAD JSON, HTML, DOWNLOAD
}; }
private final DebugFormat requestedFormat; private final DebugFormat requestedFormat;
@ -150,12 +150,7 @@ public class DebugResponseHelperImpl implements DebugResponseHelper {
gen.writeFieldName("server"); gen.writeFieldName("server");
gen.writeStartObject(); gen.writeStartObject();
String version = DebugResponseHelperImpl.class.getPackage().getImplementationVersion(); gen.writeStringField("version", getVersion());
if (version != null) {
gen.writeStringField("version", version);
} else {
gen.writeNullField("version");
}
for (DebugTab part : parts.subList(2, parts.size())) { for (DebugTab part : parts.subList(2, parts.size())) {
gen.writeFieldName(part.getName().toLowerCase(Locale.ROOT)); gen.writeFieldName(part.getName().toLowerCase(Locale.ROOT));
part.appendJson(gen); part.appendJson(gen);
@ -169,6 +164,20 @@ public class DebugResponseHelperImpl implements DebugResponseHelper {
return csb.getInputStream(); return csb.getInputStream();
} }
/**
* Get version field information for response.
* Result is never null.
*
* @return version field information
*/
private String getVersion() {
final String version = DebugResponseHelperImpl.class.getPackage().getImplementationVersion();
if (version == null) {
return "Olingo";
}
return "Olingo " + version;
}
private InputStream wrapInHtml(final List<DebugTab> parts, String title) throws IOException { private InputStream wrapInHtml(final List<DebugTab> parts, String title) throws IOException {
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();