You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Robert Munteanu <ro...@apache.org> on 2016/02/16 22:33:27 UTC

Naming a new support bundle

Hi,

In the light of SLING-3605 [0] which will bring the Eclipse tooling the
ability to automagically configure debugging to use the sources of the
bundles deployed on a Sling instance, I will need to create a new
tooling/support bundle.

For now, this bundle will expose a servlet which returns a list of all
bundles installed in a Sling runtime, together with source lookup
hints.

The only source lookup hints that I have at the moment are the Maven
GAV coordinates. These are located inside the bundle in a file named
/META-INF/maven/${artifactId}/pom.properties.

I did not see a way to retrieve this using existing HTTP APIs or the
web console so I'm going to create my own.

Two questions:

a) Is there already a way to retrieve this info that I missed?
b) What would be a good bundle symbolic name for this bundle?

For b) I am considering org.apache.sling.tooling.support.introspection
or org.apache.sling.tooling.support.info , but maybe someone has a
better suggestion :-)

Thanks,

Robert


[0]: https://issues.apache.org/jira/browse/SLING-3605

Re: Naming a new support bundle

Posted by Julian Sedding <js...@gmail.com>.
Hi

I wrote a small bundle a few years ago that exposed all bundles
installed in a Felix instance as a maven repository (provided they
contain the necessary meta data). There should be significant overlap
in the functionality. The most useful entry point is probably[0]. Feel
free to use any parts of the code as you see fit. Note that
DependencyInspector#getBundleFile(final Bundle bundle) relies on Felix
implementation details, not sure if the same can be done in a more
portable way.

Konrad wrote:
> Also I would think that such a servlet may also be useful to
> create a dependency management section within a pom [...]

The "Artifx" implementation is a webconsole plugin, exposed at
/system/console/artifx and can be used as a maven repository. In
addition it generates a pom containing all dependency information
ready to include in another pom with scope=import. Each dependency is
annotated with it's exported packages in an XML comment for
convenience. Unfortunately this pom is a bit hidden, you find it under
/system/console/artifx/local/generated-pom/{hash of dependencies}/.

Regards
Julian

[0] https://github.com/code-distillery/artifx/blob/master/src/main/java/net/distilledcode/artifx/impl/DependencyInspector.java

On Fri, Feb 19, 2016 at 9:13 AM, Grigore Zsolt
<gr...@gmail.com> wrote:
> Hi Konrad,
>
> Also I would think that such a servlet may also be useful to create a
>> dependency management section within a pom (for depending on the version of
>> the dependency which is actually used in Sling). I would prefer to have
>> that  servlet at Felix in the form of another web console.
>> Konrad
>>
>> I have something similar implemented in [0]. It is part of a small tooling
> bundle for dependency generation, although it is not a web console tab.
> Feel free to use it.
>
> Regards,
> Zsolt
>
> [0]:
> https://github.com/zsoltgrigore/sling-depgen/blob/master/src/main/java/org/konzult/sling/utils/depgen/impl/handler/POMGeneratorImpl.java

Re: Naming a new support bundle

Posted by Grigore Zsolt <gr...@gmail.com>.
Hi Konrad,

Also I would think that such a servlet may also be useful to create a
> dependency management section within a pom (for depending on the version of
> the dependency which is actually used in Sling). I would prefer to have
> that  servlet at Felix in the form of another web console.
> Konrad
>
> I have something similar implemented in [0]. It is part of a small tooling
bundle for dependency generation, although it is not a web console tab.
Feel free to use it.

Regards,
Zsolt

[0]:
https://github.com/zsoltgrigore/sling-depgen/blob/master/src/main/java/org/konzult/sling/utils/depgen/impl/handler/POMGeneratorImpl.java

Re: Naming a new support bundle

Posted by Robert Munteanu <ro...@apache.org>.
Hi Konrad,

On Wed, 2016-02-17 at 07:46 +0100, Konrad Windszus wrote:
> Hi Robert,
> as far as I know for retrieving the GAVs there is only the web
> console plugin at
> https://github.com/apache/felix/blob/trunk/webconsole-
> plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugin
> s/packageadmin/internal/WebConsolePlugin.java#L280, which is looking
> up the GAV for one specific package.

Ack, thanks for the info.


> Just pay attention that:
> a) OSGi bundles not created by the maven-bundle-plugin will not carry
> the pom.properties files
> b) One bundle may contain several GAVs (by embedding other artifacts)

Understood. There may be more ways of referencing source code in the
future, e.g. Eclipse-SourceBundle headers or or sources placed under
OSGI-opt/src so I'll keep this open.

> 
> Also I would think that such a servlet may also be useful to create a
> dependency management section within a pom (for depending on the
> version of the dependency which is actually used in Sling). I would
> prefer to have that  servlet at Felix in the form of another web
> console.

Yes, I was thinking about that as well, providing a way to
'materialize' a Sling runtime as a Maven project with all dependencies
set.

As for the Felix submission, I will probably delay this a bit until we
have all the details ironed out, but overall I think it's a good idea.

Thanks,

Robert

> Konrad
> 
> 
> > Am 16.02.2016 um 22:33 schrieb Robert Munteanu <ro...@apache.org>
> > :
> > 
> > Hi,
> > 
> > In the light of SLING-3605 [0] which will bring the Eclipse tooling
> > the
> > ability to automagically configure debugging to use the sources of
> > the
> > bundles deployed on a Sling instance, I will need to create a new
> > tooling/support bundle.
> > 
> > For now, this bundle will expose a servlet which returns a list of
> > all
> > bundles installed in a Sling runtime, together with source lookup
> > hints.
> > 
> > The only source lookup hints that I have at the moment are the
> > Maven
> > GAV coordinates. These are located inside the bundle in a file
> > named
> > /META-INF/maven/${artifactId}/pom.properties.
> > 
> > I did not see a way to retrieve this using existing HTTP APIs or
> > the
> > web console so I'm going to create my own.
> > 
> > Two questions:
> > 
> > a) Is there already a way to retrieve this info that I missed?
> > b) What would be a good bundle symbolic name for this bundle?
> > 
> > For b) I am considering
> > org.apache.sling.tooling.support.introspection
> > or org.apache.sling.tooling.support.info , but maybe someone has a
> > better suggestion :-)
> > 
> > Thanks,
> > 
> > Robert
> > 
> > 
> > [0]: https://issues.apache.org/jira/browse/SLING-3605
> 


Re: Naming a new support bundle

Posted by Konrad Windszus <ko...@gmx.de>.
Hi Robert,
as far as I know for retrieving the GAVs there is only the web console plugin at https://github.com/apache/felix/blob/trunk/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/WebConsolePlugin.java#L280, which is looking up the GAV for one specific package.
Just pay attention that:
a) OSGi bundles not created by the maven-bundle-plugin will not carry the pom.properties files
b) One bundle may contain several GAVs (by embedding other artifacts)

Also I would think that such a servlet may also be useful to create a dependency management section within a pom (for depending on the version of the dependency which is actually used in Sling). I would prefer to have that  servlet at Felix in the form of another web console.
Konrad


> Am 16.02.2016 um 22:33 schrieb Robert Munteanu <ro...@apache.org>:
> 
> Hi,
> 
> In the light of SLING-3605 [0] which will bring the Eclipse tooling the
> ability to automagically configure debugging to use the sources of the
> bundles deployed on a Sling instance, I will need to create a new
> tooling/support bundle.
> 
> For now, this bundle will expose a servlet which returns a list of all
> bundles installed in a Sling runtime, together with source lookup
> hints.
> 
> The only source lookup hints that I have at the moment are the Maven
> GAV coordinates. These are located inside the bundle in a file named
> /META-INF/maven/${artifactId}/pom.properties.
> 
> I did not see a way to retrieve this using existing HTTP APIs or the
> web console so I'm going to create my own.
> 
> Two questions:
> 
> a) Is there already a way to retrieve this info that I missed?
> b) What would be a good bundle symbolic name for this bundle?
> 
> For b) I am considering org.apache.sling.tooling.support.introspection
> or org.apache.sling.tooling.support.info , but maybe someone has a
> better suggestion :-)
> 
> Thanks,
> 
> Robert
> 
> 
> [0]: https://issues.apache.org/jira/browse/SLING-3605


Re: Naming a new support bundle

Posted by Robert Munteanu <ro...@apache.org>.
Hi Stefan,

On Wed, 2016-02-17 at 13:51 +0100, Stefan Egli wrote:
> Hi Robert,
> 
> Very useful feature indeed! I was wondering, how does m2eclipse do
> 'download source', perhaps we can follow a similar approach?

Yes, that's the general idea - use the m2e way. There might be other
ways in the future, but that's bound to get us the best result now.

Robert

> 
> Cheers,
> Stefan
> 
> On 16/02/16 22:33, "Robert Munteanu" <ro...@apache.org> wrote:
> 
> > Hi,
> > 
> > In the light of SLING-3605 [0] which will bring the Eclipse tooling
> > the
> > ability to automagically configure debugging to use the sources of
> > the
> > bundles deployed on a Sling instance, I will need to create a new
> > tooling/support bundle.
> > 
> > For now, this bundle will expose a servlet which returns a list of
> > all
> > bundles installed in a Sling runtime, together with source lookup
> > hints.
> > 
> > The only source lookup hints that I have at the moment are the
> > Maven
> > GAV coordinates. These are located inside the bundle in a file
> > named
> > /META-INF/maven/${artifactId}/pom.properties.
> > 
> > I did not see a way to retrieve this using existing HTTP APIs or
> > the
> > web console so I'm going to create my own.
> > 
> > Two questions:
> > 
> > a) Is there already a way to retrieve this info that I missed?
> > b) What would be a good bundle symbolic name for this bundle?
> > 
> > For b) I am considering
> > org.apache.sling.tooling.support.introspection
> > or org.apache.sling.tooling.support.info , but maybe someone has a
> > better suggestion :-)
> > 
> > Thanks,
> > 
> > Robert
> > 
> > 
> > [0]: https://issues.apache.org/jira/browse/SLING-3605
> 
> 


Re: Naming a new support bundle

Posted by Stefan Egli <st...@apache.org>.
Hi Robert,

Very useful feature indeed! I was wondering, how does m2eclipse do
'download source', perhaps we can follow a similar approach?

Cheers,
Stefan

On 16/02/16 22:33, "Robert Munteanu" <ro...@apache.org> wrote:

>Hi,
>
>In the light of SLING-3605 [0] which will bring the Eclipse tooling the
>ability to automagically configure debugging to use the sources of the
>bundles deployed on a Sling instance, I will need to create a new
>tooling/support bundle.
>
>For now, this bundle will expose a servlet which returns a list of all
>bundles installed in a Sling runtime, together with source lookup
>hints.
>
>The only source lookup hints that I have at the moment are the Maven
>GAV coordinates. These are located inside the bundle in a file named
>/META-INF/maven/${artifactId}/pom.properties.
>
>I did not see a way to retrieve this using existing HTTP APIs or the
>web console so I'm going to create my own.
>
>Two questions:
>
>a) Is there already a way to retrieve this info that I missed?
>b) What would be a good bundle symbolic name for this bundle?
>
>For b) I am considering org.apache.sling.tooling.support.introspection
>or org.apache.sling.tooling.support.info , but maybe someone has a
>better suggestion :-)
>
>Thanks,
>
>Robert
>
>
>[0]: https://issues.apache.org/jira/browse/SLING-3605



Re: Naming a new support bundle

Posted by Robert Munteanu <ro...@apache.org>.
On Tue, 2016-02-16 at 23:33 +0200, Robert Munteanu wrote:
> For b) I am considering
> org.apache.sling.tooling.support.introspection
> or org.apache.sling.tooling.support.info , but maybe someone has a
> better suggestion :-)

I went in the end with org.apache.sling.tooling.support.source since
it's all about discovering sources for deployed artifacts.

Tracked under

  https://issues.apache.org/jira/browse/SLING-5528

Robert