Re: [xwiki-devs] Set the standard java.lang.Package fields in the MANIFEST

2016-04-07 Thread Sergiu Dumitriu
On 04/07/2016 03:40 AM, Thomas Mortagne wrote:
> Hi devs,
> 
> The is a very easy way to get information about a jar trough Package
> class. Unfortunately we did not configured Maven to set most of the
> standard fields that Package expect (Specification-* and
> Implementation-* fields).
> 
> Once enabled it mean you can get the version of your module (or the
> module of any class as easily) by doing
> 
> this.getClass().getPackage().getImplementationVersion().
> 
> See https://maven.apache.org/shared/maven-archiver/examples/manifest.html
> for more.
> 
> WDYT about enabling that in Maven Jar plugin ?
> 
> Here is my +1.
> 

+1.
-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs


Re: [xwiki-devs] Get xwiki version from rendering component

2016-04-07 Thread Thomas Mortagne
On Thu, Apr 7, 2016 at 9:34 AM, Thomas Mortagne
 wrote:
> So the question is do you want the version of your module or do you
> want the version of the product since those might not be in sync
> (anyone can do a product based on some version of XWiki platform).
> What you saw on
> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
> is the version of the product.
>
> If the goal is to set something like the version of "XWiki" then what
> is described on
> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
> is not what you want. What you need is the version of you own
> extension basically and you can do that by asking Extension Manager
> the version of the installed extension with the id of your module.
>
> @Inject
> private CoreExtensionRepository coreExtensionRepository;
> ...
> CoreExtension myself =
> this.coreExtensionRepository.getCoreExtension("org.xwiki.commons:xwiki-commons-somehttpmodule")
> Version version = myself.getId().getVersion()
>
> The import issue you have is probably because you are missing
> xwiki-commons-extension-api dependency in your pom.xml.
>
> Another more Java standard approach would be to get the version from
> the MANIFEST which would be much easier... if we did not forget to
> configure Maven to set the version in the MANIFEST (just noticed it).
> It would be something like
> this.getClass().getPackage().getSpecificationVersion(). I guess this
> would require a different discussion on the mailing list, will send a
> mail about that.
> Note that we have the version in the MANIFEST but in a custom field
> set by the bundle plugin (Bundle-Version) and I would really prefer
> using it in a more standard location.

See 
http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki81M2#HStandardjava.lang.Packageproperties.

>
> On Thu, Apr 7, 2016 at 12:41 AM, Sean Whalen  wrote:
>> To creat a proper user agent string.
>>
>> On Wed, Apr 6, 2016 at 4:41 AM, Thomas Mortagne 
>> wrote:
>>
>>> Why do you need to know the version to fix XWIKI-13284 ? Usually
>>> xwiki-platform modules are supposed to be written for a specific
>>> version of their dependencies.
>>>
>>> On Tue, Apr 5, 2016 at 11:19 PM, Sean Whalen  wrote:
>>> > Hello,
>>> >
>>> > I'm very close to having code to contribute for XWIKI-13284 Add support
>>> for
>>> > loading RSS feeds over HTTPS in the RSS Macro
>>> >
>>> > https://jira.xwiki.org/browse/XWIKI-13284
>>> >
>>> > I've looked over the code here
>>> >
>>> >
>>> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
>>> >
>>> > @Inject
>>> > private CoreExtensionRepository coreExtensionRepository;
>>> > ...
>>> > CoreExtension distributionExtension = this.coreExtensionRepository.
>>> > getEnvironmentExtension()
>>> > Version version = distributionExtension.getId().getVersion()
>>> >
>>> > But I can't seem to import
>>> > org.xwiki.extension.repository.CoreExtensionRepository from
>>> > org.xwiki.rendering.internal.macro.rss. org.xwiki.extention will not
>>> > resolve with org.xwiki.rendering.internal.macro.rss open in InteliJ. I'm
>>> > new to Java web development. What am I missing?
>>> > ___
>>> > devs mailing list
>>> > devs@xwiki.org
>>> > http://lists.xwiki.org/mailman/listinfo/devs
>>>
>>>
>>>
>>> --
>>> Thomas Mortagne
>>> ___
>>> devs mailing list
>>> devs@xwiki.org
>>> http://lists.xwiki.org/mailman/listinfo/devs
>>>
>> ___
>> devs mailing list
>> devs@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/devs
>
>
>
> --
> Thomas Mortagne



-- 
Thomas Mortagne
___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs


Re: [xwiki-devs] Get xwiki version from rendering component

2016-04-07 Thread Vincent Massol
Indeed it seems a good practice to use some version in the user agent: 
https://en.wikipedia.org/wiki/User_agent

We already have a lot of places setting a user agent.

I believe the best would be to create a UserAgentGenerator component that can 
be reused with one method, such as generate(String prefix).

Note that for non-human user-agent using a suffix of “bot” could be a good rule 
added by the generator in addition to the version.

Right now I see for example that the link checker just sets:
httpClientBuilder.setUserAgent("XWikiLinkChecker”);

Thanks
-Vincent

> On 07 Apr 2016, at 09:34, Thomas Mortagne  wrote:
> 
> So the question is do you want the version of your module or do you
> want the version of the product since those might not be in sync
> (anyone can do a product based on some version of XWiki platform).
> What you saw on
> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
> is the version of the product.
> 
> If the goal is to set something like the version of "XWiki" then what
> is described on
> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
> is not what you want. What you need is the version of you own
> extension basically and you can do that by asking Extension Manager
> the version of the installed extension with the id of your module.
> 
> @Inject
> private CoreExtensionRepository coreExtensionRepository;
> ...
> CoreExtension myself =
> this.coreExtensionRepository.getCoreExtension("org.xwiki.commons:xwiki-commons-somehttpmodule")
> Version version = myself.getId().getVersion()
> 
> The import issue you have is probably because you are missing
> xwiki-commons-extension-api dependency in your pom.xml.
> 
> Another more Java standard approach would be to get the version from
> the MANIFEST which would be much easier... if we did not forget to
> configure Maven to set the version in the MANIFEST (just noticed it).
> It would be something like
> this.getClass().getPackage().getSpecificationVersion(). I guess this
> would require a different discussion on the mailing list, will send a
> mail about that.
> Note that we have the version in the MANIFEST but in a custom field
> set by the bundle plugin (Bundle-Version) and I would really prefer
> using it in a more standard location.
> 
> On Thu, Apr 7, 2016 at 12:41 AM, Sean Whalen  wrote:
>> To creat a proper user agent string.
>> 
>> On Wed, Apr 6, 2016 at 4:41 AM, Thomas Mortagne 
>> wrote:
>> 
>>> Why do you need to know the version to fix XWIKI-13284 ? Usually
>>> xwiki-platform modules are supposed to be written for a specific
>>> version of their dependencies.
>>> 
>>> On Tue, Apr 5, 2016 at 11:19 PM, Sean Whalen  wrote:
 Hello,
 
 I'm very close to having code to contribute for XWIKI-13284 Add support
>>> for
 loading RSS feeds over HTTPS in the RSS Macro
 
 https://jira.xwiki.org/browse/XWIKI-13284
 
 I've looked over the code here
 
 
>>> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
 
 @Inject
 private CoreExtensionRepository coreExtensionRepository;
 ...
 CoreExtension distributionExtension = this.coreExtensionRepository.
 getEnvironmentExtension()
 Version version = distributionExtension.getId().getVersion()
 
 But I can't seem to import
 org.xwiki.extension.repository.CoreExtensionRepository from
 org.xwiki.rendering.internal.macro.rss. org.xwiki.extention will not
 resolve with org.xwiki.rendering.internal.macro.rss open in InteliJ. I'm
 new to Java web development. What am I missing?
___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs


Re: [xwiki-devs] Set the standard java.lang.Package fields in the MANIFEST

2016-04-07 Thread Vincent Massol

> On 07 Apr 2016, at 10:01, Vincent Massol  wrote:
> 
>> On 07 Apr 2016, at 09:40, Thomas Mortagne  wrote:
>> 
>> Hi devs,
>> 
>> The is a very easy way to get information about a jar trough Package
>> class. Unfortunately we did not configured Maven to set most of the
>> standard fields that Package expect (Specification-* and
>> Implementation-* fields).
>> 
>> Once enabled it mean you can get the version of your module (or the
>> module of any class as easily) by doing
>> 
>>   this.getClass().getPackage().getImplementationVersion().
>> 
>> See https://maven.apache.org/shared/maven-archiver/examples/manifest.html
>> for more.
>> 
>> WDYT about enabling that in Maven Jar plugin ?
>> 
>> Here is my +1.
> 
> Ok for me, I don’t see any negative aspect. I imagine that you have a use 
> case?

Ok just saw the other mail you answered :)

Thanks
-Vincent

> Thanks
> -Vincent

___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs


Re: [xwiki-devs] Set the standard java.lang.Package fields in the MANIFEST

2016-04-07 Thread Vincent Massol
> On 07 Apr 2016, at 09:40, Thomas Mortagne  wrote:
> 
> Hi devs,
> 
> The is a very easy way to get information about a jar trough Package
> class. Unfortunately we did not configured Maven to set most of the
> standard fields that Package expect (Specification-* and
> Implementation-* fields).
> 
> Once enabled it mean you can get the version of your module (or the
> module of any class as easily) by doing
> 
>this.getClass().getPackage().getImplementationVersion().
> 
> See https://maven.apache.org/shared/maven-archiver/examples/manifest.html
> for more.
> 
> WDYT about enabling that in Maven Jar plugin ?
> 
> Here is my +1.

Ok for me, I don’t see any negative aspect. I imagine that you have a use case?

Thanks
-Vincent

___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs


Re: [xwiki-devs] Set the standard java.lang.Package fields in the MANIFEST

2016-04-07 Thread Marius Dumitru Florea
+1

Thanks,
Marius

On Thu, Apr 7, 2016 at 10:40 AM, Thomas Mortagne 
wrote:

> Hi devs,
>
> The is a very easy way to get information about a jar trough Package
> class. Unfortunately we did not configured Maven to set most of the
> standard fields that Package expect (Specification-* and
> Implementation-* fields).
>
> Once enabled it mean you can get the version of your module (or the
> module of any class as easily) by doing
>
> this.getClass().getPackage().getImplementationVersion().
>
> See https://maven.apache.org/shared/maven-archiver/examples/manifest.html
> for more.
>
> WDYT about enabling that in Maven Jar plugin ?
>
> Here is my +1.
>
> --
> Thomas Mortagne
> ___
> devs mailing list
> devs@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs
>
___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs


[xwiki-devs] Set the standard java.lang.Package fields in the MANIFEST

2016-04-07 Thread Thomas Mortagne
Hi devs,

The is a very easy way to get information about a jar trough Package
class. Unfortunately we did not configured Maven to set most of the
standard fields that Package expect (Specification-* and
Implementation-* fields).

Once enabled it mean you can get the version of your module (or the
module of any class as easily) by doing

this.getClass().getPackage().getImplementationVersion().

See https://maven.apache.org/shared/maven-archiver/examples/manifest.html
for more.

WDYT about enabling that in Maven Jar plugin ?

Here is my +1.

-- 
Thomas Mortagne
___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs


Re: [xwiki-devs] Get xwiki version from rendering component

2016-04-07 Thread Thomas Mortagne
So the question is do you want the version of your module or do you
want the version of the product since those might not be in sync
(anyone can do a product based on some version of XWiki platform).
What you saw on
https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
is the version of the product.

If the goal is to set something like the version of "XWiki" then what
is described on
https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
is not what you want. What you need is the version of you own
extension basically and you can do that by asking Extension Manager
the version of the installed extension with the id of your module.

@Inject
private CoreExtensionRepository coreExtensionRepository;
...
CoreExtension myself =
this.coreExtensionRepository.getCoreExtension("org.xwiki.commons:xwiki-commons-somehttpmodule")
Version version = myself.getId().getVersion()

The import issue you have is probably because you are missing
xwiki-commons-extension-api dependency in your pom.xml.

Another more Java standard approach would be to get the version from
the MANIFEST which would be much easier... if we did not forget to
configure Maven to set the version in the MANIFEST (just noticed it).
It would be something like
this.getClass().getPackage().getSpecificationVersion(). I guess this
would require a different discussion on the mailing list, will send a
mail about that.
Note that we have the version in the MANIFEST but in a custom field
set by the bundle plugin (Bundle-Version) and I would really prefer
using it in a more standard location.

On Thu, Apr 7, 2016 at 12:41 AM, Sean Whalen  wrote:
> To creat a proper user agent string.
>
> On Wed, Apr 6, 2016 at 4:41 AM, Thomas Mortagne 
> wrote:
>
>> Why do you need to know the version to fix XWIKI-13284 ? Usually
>> xwiki-platform modules are supposed to be written for a specific
>> version of their dependencies.
>>
>> On Tue, Apr 5, 2016 at 11:19 PM, Sean Whalen  wrote:
>> > Hello,
>> >
>> > I'm very close to having code to contribute for XWIKI-13284 Add support
>> for
>> > loading RSS feeds over HTTPS in the RSS Macro
>> >
>> > https://jira.xwiki.org/browse/XWIKI-13284
>> >
>> > I've looked over the code here
>> >
>> >
>> https://www.xwiki.org/xwiki/bin/view/FAQ/How+can+I+find+the+version+of+XWiki+I'm+running
>> >
>> > @Inject
>> > private CoreExtensionRepository coreExtensionRepository;
>> > ...
>> > CoreExtension distributionExtension = this.coreExtensionRepository.
>> > getEnvironmentExtension()
>> > Version version = distributionExtension.getId().getVersion()
>> >
>> > But I can't seem to import
>> > org.xwiki.extension.repository.CoreExtensionRepository from
>> > org.xwiki.rendering.internal.macro.rss. org.xwiki.extention will not
>> > resolve with org.xwiki.rendering.internal.macro.rss open in InteliJ. I'm
>> > new to Java web development. What am I missing?
>> > ___
>> > devs mailing list
>> > devs@xwiki.org
>> > http://lists.xwiki.org/mailman/listinfo/devs
>>
>>
>>
>> --
>> Thomas Mortagne
>> ___
>> devs mailing list
>> devs@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/devs
>>
> ___
> devs mailing list
> devs@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs



-- 
Thomas Mortagne
___
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs