You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Marc Speck <ma...@gmail.com> on 2008/07/31 15:35:42 UTC
Atom format and stuffing library into bundle
Hi folks,
I'm just getting to know Sling and have a few questions. These are rather
"user" than devl questions but there seems to be no mailing list for dumb
user yet.
1. Do I understand your roadmap correctly: Integrating the Atom syndication
format is an issue but for priority reasons, it won't be considered for the
next 6 months?
1.1 Offering APP is even further away?
2. I'm new to OSGi, Felix, maven-bundle-plugin and bnd and I could not
figure out how to package the Apache Abdera library into a bundle. For the
start, I do not want to export anything of the library. I added the
following to sling\samples\simple-demo\pom.xml
...
<repositories>
<repository>
<id>apache-incubating</id>
<name>Apache Incubating Repository</name>
<url>
http://people.apache.org/repo/m2-incubating-repository/
</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-core</artifactId>
<version>0.4.0-incubating</version>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-parser</artifactId>
<version>0.4.0-incubating</version>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-server</artifactId>
<version>0.4.0-incubating</version>
</dependency>
...
and to
sling\samples\simple-demo\src\main\java\org\apache\sling\sample\Navigation.java
private Abdera abdera = Abdera.getInstance();
and the log tells me "Unresolved package in bundle 41: package;
(package=org.apache.abdera)". Then I started to fiddle around with
Embed-Dependency, Embed-Transitive and DynamicImport-Package without really
understanding how this (=bnd?) works. Well, I thought I would but it hasn't
worked so far... any help appreciated.
3. Is it really correct that I see under
http://localhost:8888/system/console/configMgr about 8 different
configurations that are related to debugging? Some of them are duplicates
like "Sling Logging Writer Configuration"?
4. When setting "Sling Logging Logger Configuration" to debug, the
[Repository Pinger] fills up the log. Is there an easy way to shut it up?
and by the way, keep the direction you're heading to with Sling: I like it!
Marc
Re: Atom format and stuffing library into bundle
Posted by Marc Speck <ma...@gmail.com>.
Your comments are very valuable, Christopher! After setting the scope of
abdera-i18n from runtime to compile, everything works. Thanks all for
helping going through this extremely painful process.
Re: Atom format and stuffing library into bundle
Posted by Christopher Elkins <ch...@esha.com>.
On Aug 4, 2008, at 3:25 AM, Marc Speck wrote:
>>
>> I have to admit, this starts looking very nasty. For a starter you
>> might
>> just do something like this:
>>
>> <Import-Package>*;resolution:=optional</Import-Package>
>
>
> Well, that's one thing out of 1000 I've already tried. It deploys
> without
> grumbling but as soon as I use
> org.apache.abdera.parser.stax.util.PrettyWriter, I get an error:
> "javax.xml.stream.FactoryConfigurationError: Requested factory
> com.ctc.wstx.stax.WstxOutputFactory cannot be located. Classloader
> =ContextLoader@Sling Launchpad Web Application"
This is a separate issue. Even though you've embedded the appropriate
dependency (wstx-asl) in your bundle, Abdera's classloading magic
isn't finding it. I've found the easiest thing to do is wrap Abdera
calls in some code like the following:
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
Thread
.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
// Do Abdera stuff
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
Reference: http://markmail.org/message/5ot4rlsclk4irhbx
--
Christopher Elkins
Re: Atom format and stuffing library into bundle
Posted by Marc Speck <ma...@gmail.com>.
>
> I have to admit, this starts looking very nasty. For a starter you might
> just do something like this:
>
> <Import-Package>*;resolution:=optional</Import-Package>
Well, that's one thing out of 1000 I've already tried. It deploys without
grumbling but as soon as I use
org.apache.abdera.parser.stax.util.PrettyWriter, I get an error:
"javax.xml.stream.FactoryConfigurationError: Requested factory
com.ctc.wstx.stax.WstxOutputFactory cannot be located. Classloader
=ContextLoader@Sling Launchpad Web Application"
On this path, I also gave a try to something like this:
<Import-Package>
javax.jcr.*,
javax.servlet.*;version=2.4,
javax.xml.*,
org.apache.sling.api.*,
org.xml.sax.*,
javax.el,
org.apache.sling.jcr.ocm.*,
org.apache.sling.scripting.jsp.jasper.runtime.*,
org.apache.sling.scripting.jsp.taglib.*,
org.slf4j,
*;resolution:=optional
</Import-Package>
The errors in the console were the same as shown in a previous mail.
> This causes the bnd tool to mark each and every import as optional. This
> should at least get you a starter.
>
>
>
>> On a general note, I have serious doubts about this approach of OSGi. I
>> mean, we are talking here only about using a single library! I wonder how
>> cumbersome really complicate things get?
>>
>
> The problem is not OSGi by itself. Or as another developer stated: "I
> always thought I would develop modular libraries until I started doing OSGi
> bundles".
>
> The problem really are legacy libraries providing support/bindings for tons
> of other libraries. Mixing and matching these things is a horrible and
> sometimes timeconsuming task. Because not all bindings are always needed.
>
> So in your use case I would start like that:
>
> (1) Embed the Abdera libraries plus commons-code in a bundle
> (2) Create the bundle
> (3) Dump the headers of the bundle by just feeding the
> bundle to the bnd tool:
> $ java -jar bnd.jar my.bundle.jar
> (4) Look at the import statements and decide what to do:
> -> accept some (mostly stuff available from sling)
> -> decide required ones: add to the embed list and start
> over at step (2)
> -> decide unneeded ones (probably com.sun.* ?): mark as
> optional and start over at step (2)
>
>
> Marking a dependency optional comes in two ways: (1) You may set the
> resolution optional by declaring the resolution:=optional directive in the
> Import-Package element/header or (2) you may list the package (wildcards
> allowed) in the DynamicImport-Package element header.
>
> For example to dynamically resolve any com.sun package you could say:
>
> <DynamicImport-Package>com.sun.*</DynamicImport-Package>
I appreciate your explanation and I will go that way even though I have gone
through a similar process before. What bothers me most is the fact that I
don't know what is going on. Guessing has in my opinion nothing to do with
engineering. If it was something super high techy, I could accept it but
hey, we are talking about using one single library!
Re: Atom format and stuffing library into bundle
Posted by Felix Meschberger <fm...@gmail.com>.
Hi,
Marc Speck schrieb:
> Thanks for your time, Carsten and Christopher. I used Christopher's pom.xml
> for the sling.samples.simple-demo as described above. This gives me still
> errors in the console, see pom and output below.
I have to admit, this starts looking very nasty. For a starter you might
just do something like this:
<Import-Package>*;resolution:=optional</Import-Package>
This causes the bnd tool to mark each and every import as optional. This
should at least get you a starter.
>
> On a general note, I have serious doubts about this approach of OSGi. I
> mean, we are talking here only about using a single library! I wonder how
> cumbersome really complicate things get?
The problem is not OSGi by itself. Or as another developer stated: "I
always thought I would develop modular libraries until I started doing
OSGi bundles".
The problem really are legacy libraries providing support/bindings for
tons of other libraries. Mixing and matching these things is a horrible
and sometimes timeconsuming task. Because not all bindings are always
needed.
So in your use case I would start like that:
(1) Embed the Abdera libraries plus commons-code in a bundle
(2) Create the bundle
(3) Dump the headers of the bundle by just feeding the
bundle to the bnd tool:
$ java -jar bnd.jar my.bundle.jar
(4) Look at the import statements and decide what to do:
-> accept some (mostly stuff available from sling)
-> decide required ones: add to the embed list and start
over at step (2)
-> decide unneeded ones (probably com.sun.* ?): mark as
optional and start over at step (2)
Marking a dependency optional comes in two ways: (1) You may set the
resolution optional by declaring the resolution:=optional directive in
the Import-Package element/header or (2) you may list the package
(wildcards allowed) in the DynamicImport-Package element header.
For example to dynamically resolve any com.sun package you could say:
<DynamicImport-Package>com.sun.*</DynamicImport-Package>
Hope this helps a bit further ... and looking forward to hearing more
about your experiences turning Abdera into OSGi-bundles.
Regards
Felix
Re: Atom format and stuffing library into bundle
Posted by Marc Speck <ma...@gmail.com>.
Thanks for your time, Carsten and Christopher. I used Christopher's pom.xml
for the sling.samples.simple-demo as described above. This gives me still
errors in the console, see pom and output below.
On a general note, I have serious doubts about this approach of OSGi. I
mean, we are talking here only about using a single library! I wonder how
cumbersome really complicate things get?
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
<version>4-incubator-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
<groupId>org.apache.sling.samples</groupId>
<artifactId>org.apache.sling.samples.simple-demo</artifactId>
<version>2.0.3-incubator-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Sling - Sample Sling Application</name>
<description>
This bundle provides a simple Sling Application to show some of
the features and functionalities of Sling, such as node type
definition, content mapping, running JSPs off the repository and
the bundle.
</description>
<scm>
<connection>scm:svn:
http://svn.apache.org/repos/asf/incubator/sling/trunk/samples/simple-demo
</connection>
<developerConnection>scm:svn:
https://svn.apache.org/repos/asf/incubator/sling/trunk/samples/simple-demo
</developerConnection>
<url>
http://svn.apache.org/viewvc/incubator/sling/trunk/samples/simple-demo</url>
</scm>
<build>
<plugins>
<!-- Handle the @ocm JavaDoc tags to generate the mapping
descriptors -->
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-jcrocm-plugin</artifactId>
<version>2.0.2-incubator</version>
<executions>
<execution>
<id>generate-JCR-OCM-descriptor</id>
<goals>
<goal>ocm</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Compile JSP scripts into the bundle -->
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-jspc-plugin</artifactId>
<version>2.0.2-incubator</version>
<executions>
<execution>
<id>compile-jsp</id>
<goals>
<goal>jspc</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Generation of SCR descriptors -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<!-- Bundling the sample project -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- we have to export for the classes to be visible
-->
<Export-Package>
org.apache.sling.sample;
org.apache.jsp.*;version=${pom.version}
</Export-Package>
<!-- node types to be created -->
<Sling-Nodetypes>
SLING-INF/nodetypes/test.cnd
</Sling-Nodetypes>
<!-- initial content to be loaded on bundle
installation -->
<Sling-Initial-Content>
SLING-INF/content
</Sling-Initial-Content>
<!-- Bundle supplied resource prefixes -->
<Include-Resource>
{maven-resources},src/main/scripts
</Include-Resource>
<Sling-Bundle-Resources>
/apps/sling/sample,
/classes/org/apache/jsp/apps/sling/sample
</Sling-Bundle-Resources>
<Import-Package>
javax.el.*,
org.apache.sling.jcr.ocm.*,
org.apache.sling.scripting.jsp.jasper.runtime.*,
org.apache.sling.scripting.jsp.taglib.*,
org.slf4j.*,
com.sun.msv.*;resolution:=optional,
javax.jcr.*,
javax.mail.*;resolution:=optional,
javax.servlet.*;version=2.4,
javax.xml.*,
nu.xom.*;resolution:=optional,
org.apache.sling.api.*,
org.dom4j.*;resolution:=optional,
org.jdom.*;resolution:=optional,
org.relaxng.*;resolution:=optional,
org.xml.sax.*
</Import-Package>
<Embed-Dependency>
abdera-core,
abdera-i18n,
abdera-parser,
axiom-api,
axiom-impl,
commons-codec,
commons-logging-api,
geronimo-activation_1.1_spec,
geronimo-stax-api_1.0_spec,
jaxen,
wstx-asl
</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- No javadocs -->
<excludePackageNames>
org.apache.sling
</excludePackageNames>
</configuration>
</plugin>
</plugins>
</reporting>
<repositories>
<repository>
<id>apache-incubating</id>
<name>Apache Incubating Repository</name>
<url>
http://people.apache.org/repo/m2-incubating-repository/
</url>
</repository>
</repositories>
<dependencies>
<!-- start of abdera dependencies -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>1.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-core</artifactId>
<version>0.5.0-incubating-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-i18n</artifactId>
<version>0.5.0-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-parser</artifactId>
<version>0.5.0-incubating-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-activation_1.1_spec</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
<version>1.0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.1</version>
<scope>runtime</scope>
</dependency>
<!-- end of abdera dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.0.2-incubator</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.resource</artifactId>
<version>2.0.2-incubator</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.ocm</artifactId>
<version>2.0.2-incubator</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.engine</artifactId>
<version>2.0.2-incubator</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.scripting.jsp.taglib</artifactId>
<version>2.0.2-incubator</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
</dependencies>
</project>
Symbolic Nameorg.apache.sling.samples.simple-demo
Version2.0.3.incubator-SNAPSHOT
Locationinputstream:org.apache.sling.samples.simple-demo-2.0.3-incubator-SNAPSHOT.jar
Last ModificationMon Aug 04 10:29:07 CEST 2008
VendorThe Apache Software Foundation
DescriptionThis bundle provides a simple Sling Application to show some of
the features and functionalities of Sling, such as node type definition,
content mapping, running JSPs off the repository and the bundle.
Start Level20
Exported
Packagesorg.apache.jsp.apps.sling.sample,version=2.0.3.incubator-SNAPSHOT
org.apache.sling.sample,version=2.0.3.incubator-SNAPSHOT
Imported Packages!! com.sun.msv.grammar,version=0.0.0 from -- Cannot be
resolved
!! com.sun.msv.grammar.trex,version=0.0.0 from -- Cannot be resolved
!! com.sun.msv.reader,version=0.0.0 from -- Cannot be resolved
!! com.sun.msv.reader.trex.ng,version=0.0.0 from -- Cannot be resolved
!! com.sun.msv.reader.util,version=0.0.0 from -- Cannot be resolved
!! com.sun.msv.util,version=0.0.0 from -- Cannot be resolved
!! com.sun.msv.verifier,version=0.0.0 from -- Cannot be resolved
!! com.sun.msv.verifier.regexp,version=0.0.0 from -- Cannot be resolved
javax.el,version=2.1.0 from org.apache.sling.scripting.jsp (35)
javax.jcr,version=1.0.0 from org.apache.sling.jcr.api (21)
!! javax.mail,version=0.0.0 from -- Cannot be resolved
!! javax.mail.internet,version=0.0.0 from -- Cannot be resolved
javax.servlet,version=2.4.0 from System Bundle (0)
javax.servlet.http,version=2.4.0 from System Bundle (0)
!! javax.servlet.jsp,version=2.4.0 from -- Cannot be resolved
!! javax.servlet.jsp.tagext,version=2.4.0 from -- Cannot be resolved
javax.xml.namespace,version=0.0.0 from System Bundle (0)
javax.xml.parsers,version=0.0.0 from System Bundle (0)
javax.xml.transform,version=0.0.0 from System Bundle (0)
javax.xml.transform.dom,version=0.0.0 from System Bundle (0)
javax.xml.transform.sax,version=0.0.0 from System Bundle (0)
javax.xml.transform.stream,version=0.0.0 from System Bundle (0)
!! nu.xom,version=0.0.0 from -- Cannot be resolved
org.apache.sling.api,version=2.0.2.incubator from org.apache.sling.api (2)
org.apache.sling.api.resource,version=2.0.2.incubator from
org.apache.sling.api (2)
org.apache.sling.api.scripting,version=2.0.2.incubator from
org.apache.sling.api (2)
org.apache.sling.api.servlets,version=2.0.2.incubator from
org.apache.sling.api (2)
org.apache.sling.jcr.ocm,version=2.0.2.incubator from
org.apache.sling.jcr.ocm (24)
org.apache.sling.scripting.jsp.jasper.runtime,version=2.0.2.incubator from
org.apache.sling.scripting.jsp (35)
org.apache.sling.scripting.jsp.taglib,version=2.0.2.incubator from
org.apache.sling.scripting.jsp.taglib (29)
!! org.dom4j,version=0.0.0 from -- Cannot be resolved
!! org.dom4j.io,version=0.0.0 from -- Cannot be resolved
!! org.jdom,version=0.0.0 from -- Cannot be resolved
!! org.jdom.input,version=0.0.0 from -- Cannot be resolved
!! org.relaxng.datatype,version=0.0.0 from -- Cannot be resolved
org.slf4j,version=0.0.0 from org.apache.sling.commons.log (1)
org.xml.sax,version=0.0.0 from System Bundle (0)
org.xml.sax.ext,version=0.0.0 from System Bundle (0)
org.xml.sax.helpers,version=0.0.0 from System Bundle (0)
Re: Atom format and stuffing library into bundle
Posted by Christopher Elkins <ch...@esha.com>.
On Jul 31, 2008, at 12:43 PM, Marc Speck wrote:
> After this, some error have gone but there are still 8 errors left,
> so I'm
> sure that I totally misunderstood here something. This cannot be the
> way to
> simply add a library to a bundle. What am I doing wrong?
As someone who recently started down this path too, I can confirm that
there's some black magic involved. I recommend making liberal use of
the "resolution:=optional" attribute.
FWIW, here's a scrubbed version of the POM for an Abdera-Sling bundle
I'm working on:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-abdera-sling-app</artifactId>
<packaging>bundle</packaging>
<version>1.0-SNAPSHOT</version>
<name>My Abdera Sling App</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Private-Package>
com.example.sling.*
</Private-Package>
<Import-Package>
com.sun.msv.*;resolution:=optional,
javax.jcr.*,
javax.mail.*;resolution:=optional,
javax.servlet.*;version=2.4,
javax.xml.*,
nu.xom.*;resolution:=optional,
org.apache.sling.api.*,
org.dom4j.*;resolution:=optional,
org.jdom.*;resolution:=optional,
org.relaxng.*;resolution:=optional,
org.xml.sax.*
</Import-Package>
<Embed-Dependency>
abdera-core,
abdera-i18n,
abdera-parser,
axiom-api,
axiom-impl,
commons-codec,
commons-logging-api,
geronimo-activation_1.1_spec,
geronimo-stax-api_1.0_spec,
jaxen,
wstx-asl
</Embed-Dependency>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.0.6</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>1.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-core</artifactId>
<version>0.5.0-incubating-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-i18n</artifactId>
<version>0.5.0-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-parser</artifactId>
<version>0.5.0-incubating-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-activation_1.1_spec</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
<version>1.0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.0.3-incubator-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.6</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
--
Christopher Elkins
Re: Atom format and stuffing library into bundle
Posted by Carsten Ziegeler <cz...@apache.org>.
Marc Speck wrote:
> Thanks for your help, Carsten. I left the private-package path and I'm
> riding now again the embedded way: I looked at the missing packages, guessed
> their artifactId, guessed their version and added the dependencies. Here we
> go:
>
> <Embed-Dependency>
> abdera-core,
> abdera-parser,
> abdera-server,
>
> commons-codec,
> abdera-i18n,
> axiom-impl,
> axiom-dom,
> axiom-api
> </Embed-Dependency>
>
> <dependencies>
> <dependency>
> <groupId>org.apache.ws.commons.axiom</groupId>
> <artifactId>axiom-impl</artifactId>
> <version>1.2.7</version>
> </dependency>
> <dependency>
> <groupId>org.apache.ws.commons.axiom</groupId>
> <artifactId>axiom-dom</artifactId>
> <version>1.2.7</version>
> </dependency>
> <dependency>
> <groupId>org.apache.ws.commons.axiom</groupId>
> <artifactId>axiom-api</artifactId>
> <version>1.2.7</version>
> </dependency>
>
> <dependency>
> <groupId>commons-codec</groupId>
> <artifactId>commons-codec</artifactId>
> <version>1.3</version>
> </dependency>
> <dependency>
> <groupId>org.apache.abdera</groupId>
> <artifactId>abdera-i18n</artifactId>
> <version>0.4.0-incubating</version>
> </dependency>
>
>
> After this, some error have gone but there are still 8 errors left, so I'm
> sure that I totally misunderstood here something. This cannot be the way to
> simply add a library to a bundle. What am I doing wrong?
>
:) Actually this is the way to go - BUT the amount of work you have to
do depends on the structure of the library you want to include. For
instance, if you want to include some commons-* lib, you just need to
add this one as a dependency.
If you have a complex lib, well, you have to take care of all of its
dependencies and depending on the complexity of the library there can be
a lot of dependencies.
Therefore it would be great if most libs would already be osgi aware and
provide the additional meta information. Then the libs could be used as
bundles without any additional work. Some of the commons libs are
already osgi bundles (commons codec is not yet).
Can you show us your whole pom? Then I can have a look at it.
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: Atom format and stuffing library into bundle
Posted by Marc Speck <ma...@gmail.com>.
On Thu, Jul 31, 2008 at 7:06 PM, Carsten Ziegeler <cz...@apache.org>wrote:
> Marc Speck wrote
>
>>
>> ok, let's walk that path. One state I reached was for example with adding
>> the following to the pom (besides the dependencies and rep mentioned
>> above):
>>
>> <Private-Package>
>> org.apache.abdera,
>> org.apache.abdera.factory,
>> org.apache.abdera.i18n.iri,
>> org.apache.abdera.model,
>> org.apache.abdera.parser,
>> org.apache.abdera.util,
>> org.apache.abdera.writer,
>> org.apache.abdera.xpath,
>> org.apache.abdera.filter,
>> org.apache.abdera.i18n.rfc4646,
>> org.apache.abdera.i18n.text,
>> org.apache.abdera.i18n.text.data,
>> org.apache.abdera.i18n.text.io,
>> org.apache.abdera.i18n.rfc4646.enums,
>> org.apache.commons.codec.binary
>> </Private-Package>
>> <DynamicImport-Package>*</DynamicImport-Package>
>>
>>
>>
>> Using <Private-Package>org.apache.abdera.*</Private-Package> was even
>> less
>> promising.
>>
>> Thanks for 3. and 4.
>> Marc
>>
>> If you want to include whole jars just use <Embed-Dependency>. It's a lot
> easier as bnd will create the private package statements for you.
> It seems that you have to include the commons codec lib as well. The embed
> dependency directive uses the artifact id, so something like
> <Embed-Dependency>commons-codec, abdera-foo,abdera-bar</Embed-Dependency>
>
> It might be that you need to include some additional libs.
> After running maven, you can have a look at the manifest and see the
> required imports. So you'll see what is missing.
>
Thanks for your help, Carsten. I left the private-package path and I'm
riding now again the embedded way: I looked at the missing packages, guessed
their artifactId, guessed their version and added the dependencies. Here we
go:
<Embed-Dependency>
abdera-core,
abdera-parser,
abdera-server,
commons-codec,
abdera-i18n,
axiom-impl,
axiom-dom,
axiom-api
</Embed-Dependency>
<dependencies>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-dom</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.abdera</groupId>
<artifactId>abdera-i18n</artifactId>
<version>0.4.0-incubating</version>
</dependency>
After this, some error have gone but there are still 8 errors left, so I'm
sure that I totally misunderstood here something. This cannot be the way to
simply add a library to a bundle. What am I doing wrong?
Re: Atom format and stuffing library into bundle
Posted by Carsten Ziegeler <cz...@apache.org>.
Marc Speck wrote
>
> ok, let's walk that path. One state I reached was for example with adding
> the following to the pom (besides the dependencies and rep mentioned above):
>
> <Private-Package>
> org.apache.abdera,
> org.apache.abdera.factory,
> org.apache.abdera.i18n.iri,
> org.apache.abdera.model,
> org.apache.abdera.parser,
> org.apache.abdera.util,
> org.apache.abdera.writer,
> org.apache.abdera.xpath,
> org.apache.abdera.filter,
> org.apache.abdera.i18n.rfc4646,
> org.apache.abdera.i18n.text,
> org.apache.abdera.i18n.text.data,
> org.apache.abdera.i18n.text.io,
> org.apache.abdera.i18n.rfc4646.enums,
> org.apache.commons.codec.binary
> </Private-Package>
> <DynamicImport-Package>*</DynamicImport-Package>
>
>
>
> Using <Private-Package>org.apache.abdera.*</Private-Package> was even less
> promising.
>
> Thanks for 3. and 4.
> Marc
>
If you want to include whole jars just use <Embed-Dependency>. It's a
lot easier as bnd will create the private package statements for you.
It seems that you have to include the commons codec lib as well. The
embed dependency directive uses the artifact id, so something like
<Embed-Dependency>commons-codec, abdera-foo,abdera-bar</Embed-Dependency>
It might be that you need to include some additional libs.
After running maven, you can have a look at the manifest and see the
required imports. So you'll see what is missing.
HTH
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: Atom format and stuffing library into bundle
Posted by Marc Speck <ma...@gmail.com>.
Hi Bertrand
Thanks for the very quick answer.
On Thu, Jul 31, 2008 at 4:30 PM, Bertrand Delacretaz <bdelacretaz@apache.org
> wrote:
> Hi Marc,
>
> On Thu, Jul 31, 2008 at 3:35 PM, Marc Speck <ma...@gmail.com> wrote:
> > ...I'm just getting to know Sling and have a few questions. These are
> rather
> > "user" than devl questions but there seems to be no mailing list for dumb
> > user yet....
>
> Perfectly fine, as an incubating project with a small community we
> have just this list for now.
>
> > ...1. Do I understand your roadmap correctly: Integrating the Atom
> syndication
> > format is an issue but for priority reasons, it won't be considered for
> the
> > next 6 months?
> > 1.1 Offering APP is even further away?...
>
> I don't think we have a roadmap in terms of months - some of us would
> like Atom and APP to happen, but I don't think any committer has an
> urgent need for that, so that would rather happen when it happens.
> It's more a (very) nice to have than a requirement for me at the
> moment, and I guess for other Sling people as well.
That's what I thought.
>
>
> But if you need this and are willing to contribute, I'm sure we'd find
> some cycles to test and integrate it.
Well, don't expect anything soon from my side as I still struggle with
simply bundling a library...
>
>
> > ...2. I'm new to OSGi, Felix, maven-bundle-plugin and bnd and I could not
> > figure out how to package the Apache Abdera library into a bundle. For
> the
> > start, I do not want to export anything of the library. ...
>
> If you want to embed the Abdera code in your bundle, you need a
> Private-Package statement in the pom, in addition to your dependency
> statements which look ok. See for example how the
> scripting/javascript/pom.xml embeds the rhino dependency using
>
> <Private-Package>
> org.apache.sling.scripting.javascript.*,
> org.mozilla.classfile,
> !org.mozilla.javascript.xml.impl.xmlbeans,
> org.mozilla.javascript.*
> </Private-Package>
ok, let's walk that path. One state I reached was for example with adding
the following to the pom (besides the dependencies and rep mentioned above):
<Private-Package>
org.apache.abdera,
org.apache.abdera.factory,
org.apache.abdera.i18n.iri,
org.apache.abdera.model,
org.apache.abdera.parser,
org.apache.abdera.util,
org.apache.abdera.writer,
org.apache.abdera.xpath,
org.apache.abdera.filter,
org.apache.abdera.i18n.rfc4646,
org.apache.abdera.i18n.text,
org.apache.abdera.i18n.text.data,
org.apache.abdera.i18n.text.io,
org.apache.abdera.i18n.rfc4646.enums,
org.apache.commons.codec.binary
</Private-Package>
<DynamicImport-Package>*</DynamicImport-Package>
Then, the compiler is fine except for this warning:
[WARNING] Warning building bundle
org.apache.sling.samples:org.apache.sling.samples.simple-demo:bundle:2.0.3-incubator-SNAPSHOT
: Instructions for Private-Package that are never used:
org\.apache\.commons\.codec\.binary
And not surprising, Sling complains about it:
Symbolic Name org.apache.sling.samples.simple-demo
Version 2.0.3.incubator-SNAPSHOT
Location
inputstream:org.apache.sling.samples.simple-demo-2.0.3-incubator-SNAPSHOT.jar
Last Modification Thu Jul 31 17:09:36 CEST 2008
Vendor The Apache Software Foundation
Description This bundle provides a simple Sling Application to show some
of the features and functionalities of Sling, such as node type definition,
content mapping, running JSPs off the repository and the bundle.
Start Level 20
Exported Packages
org.apache.jsp.apps.sling.sample,version=2.0.3.incubator-SNAPSHOT
org.apache.sling.sample,version=2.0.3.incubator-SNAPSHOT
Imported Packages !! javax.activation,version=0.0.0 from -- Cannot be
resolved
javax.el,version=2.1.0 from org.apache.sling.scripting.jsp (35)
javax.jcr,version=1.0.0 from org.apache.sling.jcr.api (21)
javax.servlet,version=0.0.0 from System Bundle (0)
javax.servlet.http,version=0.0.0 from System Bundle (0)
javax.servlet.jsp,version=2.1.0 from org.apache.sling.scripting.jsp (35)
javax.servlet.jsp.tagext,version=2.1.0 from org.apache.sling.scripting.jsp
(35)
javax.xml.namespace,version=0.0.0 from System Bundle (0)
javax.xml.transform,version=0.0.0 from System Bundle (0)
javax.xml.transform.stream,version=0.0.0 from System Bundle (0)
!! org.apache.commons.codec.binary,version=0.0.0 from -- Cannot be resolved
org.apache.sling.api,version=2.0.2.incubator from org.apache.sling.api (2)
org.apache.sling.api.resource,version=2.0.2.incubator from
org.apache.sling.api (2)
org.apache.sling.api.scripting,version=2.0.2.incubator from
org.apache.sling.api (2)
org.apache.sling.api.servlets,version=2.0.2.incubator from
org.apache.sling.api (2)
org.apache.sling.jcr.ocm,version=2.0.2.incubator from
org.apache.sling.jcr.ocm (24)
org.apache.sling.scripting.jsp.jasper.runtime,version=2.0.2.incubator from
org.apache.sling.scripting.jsp (35)
org.apache.sling.scripting.jsp.taglib,version=2.0.2.incubator from
org.apache.sling.scripting.jsp.taglib (29)
org.slf4j,version=0.0.0 from org.apache.sling.commons.log (1)
Using <Private-Package>org.apache.abdera.*</Private-Package> was even less
promising.
Thanks for 3. and 4.
Marc
Re: Atom format and stuffing library into bundle
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Marc,
On Thu, Jul 31, 2008 at 3:35 PM, Marc Speck <ma...@gmail.com> wrote:
> ...I'm just getting to know Sling and have a few questions. These are rather
> "user" than devl questions but there seems to be no mailing list for dumb
> user yet....
Perfectly fine, as an incubating project with a small community we
have just this list for now.
> ...1. Do I understand your roadmap correctly: Integrating the Atom syndication
> format is an issue but for priority reasons, it won't be considered for the
> next 6 months?
> 1.1 Offering APP is even further away?...
I don't think we have a roadmap in terms of months - some of us would
like Atom and APP to happen, but I don't think any committer has an
urgent need for that, so that would rather happen when it happens.
It's more a (very) nice to have than a requirement for me at the
moment, and I guess for other Sling people as well.
But if you need this and are willing to contribute, I'm sure we'd find
some cycles to test and integrate it.
> ...2. I'm new to OSGi, Felix, maven-bundle-plugin and bnd and I could not
> figure out how to package the Apache Abdera library into a bundle. For the
> start, I do not want to export anything of the library. ...
If you want to embed the Abdera code in your bundle, you need a
Private-Package statement in the pom, in addition to your dependency
statements which look ok. See for example how the
scripting/javascript/pom.xml embeds the rhino dependency using
<Private-Package>
org.apache.sling.scripting.javascript.*,
org.mozilla.classfile,
!org.mozilla.javascript.xml.impl.xmlbeans,
org.mozilla.javascript.*
</Private-Package>
This will embed the corresponding classes in the bundle jar, that's
easy to check.
Embed-Dependency should work as well, but I haven't tried that yet.
> ...3. Is it really correct that I see under
> http://localhost:8888/system/console/configMgr about 8 different
> configurations that are related to debugging? Some of them are duplicates
> like "Sling Logging Writer Configuration"?...
Yes, there's a mix between factories and single configs in the list
(which IIUC has been fixed in the Apache Felix console now), and the
as-yet-undocumented granular logging features of SLING-526 explain the
rest.
> ..4. When setting "Sling Logging Logger Configuration" to debug, the
> [Repository Pinger] fills up the log. Is there an easy way to shut it up?..
Yes, fix SLING-505 ;-)
Seriously, I just tried today to use Chainsaw
(http://logging.apache.org/chainsaw/index.html) to filter out the
logs, and that works quite nicely. I configured Chainsaw to read my
Sling log file directly, see below, a socket would be faster but I
haven't had time to explore that yet.
> ...and by the way, keep the direction you're heading to with Sling: I like it!...
Thanks!
-Bertrand
Experimental Chainsaw config to read the Sling log. To use this,
change the log file path inside, configure the Sling logger to output
only LEVEL LOGGER MESSAGE at the debug level, and open this file when
starting Chainsaw,
Reading the Sling log file is just a hack for now, the proper way
would be to add remote socket logging capabilities to Sling.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<appender name="A2" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>
<plugin name="SocketReceiver"
class="org.apache.log4j.net.SocketReceiver">
<param name="Port" value="8090"/>
</plugin>
<plugin name="LogFileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
<param name="fileURL"
value="file:///FULL_PATH_TO_/sling/launchpad/testing/target/sling/logs/error.log"/>
<param name="timestampFormat" value="yyyy-MM-dd HH:mm:ss,SSS"/>
<param name="logFormat" value="LEVEL LOGGER MESSAGE"/>
<param name="name" value="sampleLogFileReceiver"/>
<param name="tailing" value="true"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>