Petals CDK

The version of the component should be logged on installation

Details

  • Type: Improvement Request Improvement Request
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 5.0.3
  • Fix Version/s: 5.1.1
  • Component/s: runtime
  • Security Level: Public
  • Description:
    Hide

    An information message about the component version should be added during the installation phase.

    The version should be read from Maven metadata (META-INF/maven/${groupId}/${artifactId}/pom.properties) embedded into the JAR of the component embedded into the component JBI archive

    Show
    An information message about the component version should be added during the installation phase. The version should be read from Maven metadata (META-INF/maven/${groupId}/${artifactId}/pom.properties) embedded into the JAR of the component embedded into the component JBI archive
  • Environment:
    -

Issue Links

Activity

Hide
Mathieu Carrolle added a comment - Fri, 8 Oct 2010 - 17:32:20 +0200

The pom parent of the component need to be petals-components-sls-parent (version > 3)

Show
Mathieu Carrolle added a comment - Fri, 8 Oct 2010 - 17:32:20 +0200 The pom parent of the component need to be petals-components-sls-parent (version > 3)
Hide
Christophe DENEUX added a comment - Thu, 7 Oct 2010 - 19:08:27 +0200

To read the version from the manifest, you can use the following source code with a class name defined in the JBI descriptor of the component

String pathToThisClass = Main.class.getResource("/foo/bar/MyClass.class").toString();
String manifestPath = pathToGlazedLists.substring(0, pathToGlazedLists.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
Manifest manifest = new Manifest(new URL(manifestPath).openStream());

Attributes attr = manifest.getMainAttributes();

String CREATED_BY = attr.getValue("Created-by");
String SOFTWARE_VERSION = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
String SOFTWARE_VENDOR = attr.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
String SOFTWARE_VENDOR_TITLE = attr.getValue(Attributes.Name.IMPLEMENTATION_TITLE);

Note: don't forget to close stream.

On the component side, just add the maven-jar-plugin to customize the Manifest

Show
Christophe DENEUX added a comment - Thu, 7 Oct 2010 - 19:08:27 +0200 To read the version from the manifest, you can use the following source code with a class name defined in the JBI descriptor of the component
String pathToThisClass = Main.class.getResource("/foo/bar/MyClass.class").toString();
String manifestPath = pathToGlazedLists.substring(0, pathToGlazedLists.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
Manifest manifest = new Manifest(new URL(manifestPath).openStream());

Attributes attr = manifest.getMainAttributes();

String CREATED_BY = attr.getValue("Created-by");
String SOFTWARE_VERSION = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
String SOFTWARE_VENDOR = attr.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
String SOFTWARE_VENDOR_TITLE = attr.getValue(Attributes.Name.IMPLEMENTATION_TITLE);
Note: don't forget to close stream. On the component side, just add the maven-jar-plugin to customize the Manifest
Hide
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 12:28:44 +0200

Agree with that. With this solution we will be able to differentiate specific customer versions for example.

Show
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 12:28:44 +0200 Agree with that. With this solution we will be able to differentiate specific customer versions for example.
Hide
Christophe DENEUX added a comment - Mon, 30 Aug 2010 - 12:20:48 +0200

I prefer:

  • First, use the version in the manifest of the jar built by Maven
  • If no version available, use the identification extension that is not mandatory.
  • If no version available, use a defautlt value 'No version set'

So, only an upgrade version of the CDK is needed to integrate this improvment in our components.
The version can be changed by users using the identification extension. To add it just use the goal 'jbi:configure' of the maven-petals-plugin (an issue should be created for this evolution of the maven-petals-plugin)

Show
Christophe DENEUX added a comment - Mon, 30 Aug 2010 - 12:20:48 +0200 I prefer:
  • First, use the version in the manifest of the jar built by Maven
  • If no version available, use the identification extension that is not mandatory.
  • If no version available, use a defautlt value 'No version set'
So, only an upgrade version of the CDK is needed to integrate this improvment in our components. The version can be changed by users using the identification extension. To add it just use the goal 'jbi:configure' of the maven-petals-plugin (an issue should be created for this evolution of the maven-petals-plugin)
Hide
Roland Naudin added a comment - Mon, 30 Aug 2010 - 11:58:05 +0200 - edited

I was speaking about that with mathieu.
And we come to that:
-For the current version of the CDK 5.x, we think that using the version in the manifest of the jar built by the JAR maven plugin is the easiest way at runtime to get the version.
-For a futur CDK (6), maybe using the extension of the identification, depends on how we will decide that we handle the conf on that version.

-> The Version will be handled (print, expose to the admin channel) only by the CDK.
is it interesting to get the version at the component specific level? i'm not sure.

Show
Roland Naudin added a comment - Mon, 30 Aug 2010 - 11:58:05 +0200 - edited I was speaking about that with mathieu. And we come to that: -For the current version of the CDK 5.x, we think that using the version in the manifest of the jar built by the JAR maven plugin is the easiest way at runtime to get the version. -For a futur CDK (6), maybe using the extension of the identification, depends on how we will decide that we handle the conf on that version. -> The Version will be handled (print, expose to the admin channel) only by the CDK. is it interesting to get the version at the component specific level? i'm not sure.
Hide
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 11:53:49 +0200

Of course, we need to ass a method in the API, for now we try to select the best solution to retrieve the information.

Show
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 11:53:49 +0200 Of course, we need to ass a method in the API, for now we try to select the best solution to retrieve the information.
Hide
Vincent Zurczak added a comment - Mon, 30 Aug 2010 - 11:45:24 +0200

Or we could just add an abstract method in the AbstractComponent class:

String getComponentVersion();

The CDK would use it to get the component version and display this information.

Show
Vincent Zurczak added a comment - Mon, 30 Aug 2010 - 11:45:24 +0200 Or we could just add an abstract method in the AbstractComponent class: String getComponentVersion(); The CDK would use it to get the component version and display this information.
Hide
Mathieu Carrolle added a comment - Mon, 30 Aug 2010 - 11:20:28 +0200

We can use the node identification in the jbi descriptor. This node could be extended.
The result could be :

<component type="binding-component">
<identification>
<name>petals-bc-ftp</name>
<description>fhdhdfh</description>
<cdk:VersionInfo component-version="1.0"/>
</identification>

Show
Mathieu Carrolle added a comment - Mon, 30 Aug 2010 - 11:20:28 +0200 We can use the node identification in the jbi descriptor. This node could be extended. The result could be : <component type="binding-component"> <identification> <name>petals-bc-ftp</name> <description>fhdhdfh</description> <cdk:VersionInfo component-version="1.0"/> </identification>
Hide
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 11:07:49 +0200

Why not? Why not using standard thing such as a Version class? This is generally the standard way to provide a version (or the most used in the java world)

Show
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 11:07:49 +0200 Why not? Why not using standard thing such as a Version class? This is generally the standard way to provide a version (or the most used in the java world)
Hide
Christophe DENEUX added a comment - Mon, 30 Aug 2010 - 11:02:32 +0200

And why ?

Show
Christophe DENEUX added a comment - Mon, 30 Aug 2010 - 11:02:32 +0200 And why ?
Hide
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 10:11:02 +0200

Some will say that we can not rely on maven for such thing...

Show
Christophe Hamerling added a comment - Mon, 30 Aug 2010 - 10:11:02 +0200 Some will say that we can not rely on maven for such thing...

People

Dates

  • Created:
    Fri, 27 Aug 2010 - 19:58:31 +0200
    Updated:
    Tue, 2 Nov 2010 - 17:03:12 +0100
    Resolved:
    Fri, 8 Oct 2010 - 17:26:24 +0200