[jira] [Commented] (FELIX-2961) SCR & ConfigurationAdmin : service.pid resolution

2011-05-23 Thread Andrei Pozolotin (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038240#comment-13038240
 ] 

Andrei Pozolotin commented on FELIX-2961:
-

Felix:

since the "pid vs name problem" is decided;

I have only "small one" left: do you think there is a way SCR plugin could 
accept "component name"

// on target comonent:
@Component(name = PluginSpaceService.PID)
public class BucketPlugin implements PluginSpaceService { 

in such a way that it does not have to be a compile-time constant (required by 
annotation)?

say, similar to how you handle same problem for @Property

@Property(name = "service.pid")
protected static final String PID = "ZZZ"; 

thank you

Andrei


> SCR & ConfigurationAdmin : service.pid resolution
> -
>
> Key: FELIX-2961
> URL: https://issues.apache.org/jira/browse/FELIX-2961
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Andrei Pozolotin
>
> hello!
> when I use config admin to control instaniation of scr component services, I 
> use this pattern:
> // 1) in config source bundle:
>   Configuration config = 
> configAdmin.getConfiguration("ZZZ", null);
>   Dictionary props = 
> config.getProperties();
>   config.update(props);
> //  2) in config target bundle:
> @Service
> @Component(name = "AAA", policy = ConfigurationPolicy.REQUIRE, immediate = 
> true)
> public class BucketPlugin implements PluginSpaceService {
>   @Property(name = "service.pid")
>   protected static final String PID = "ZZZ";
> // 3) despite the fact service.pid "looks good" in xml for the tagret 
> compenent:
>  configuration-policy="require">
> 
> 
> 
> 
> 
> // 4) the scr fails to initialize the component; intitialzation works only 
> when 
> (scr.component.name == config.service.pid) and NOT when (config.service.pid 
> == scr.component.property.pid)
> // 5) if I look on the the config target in console (when I do manage to 
> inititialize it),
> it shows that again, actual service.pid comes from scr.component.name and not 
> from scr.component.property.service.pid
> thank you.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-2961) SCR & ConfigurationAdmin : service.pid resolution

2011-05-23 Thread Andrei Pozolotin (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038233#comment-13038233
 ] 

Andrei Pozolotin commented on FELIX-2961:
-

the osgi oracle spoke: (posted with his permission):



I am afraid I agree with Felix Meschberger. Any properties registered in the 
XML should not be interpreted. Setting the service.pid has no meaning (unless 
you provide the Managed Service (Factory)) interface. SCR does not use MS(F)s, 
it uses Configuration Listener.

So PID == component name.

If you still disagree, please file a bug on the public OSGi Bugzilla, it will 
then be discussed in CPEG.

Kind regards,

Peter Kriens

On 23 mei 2011, at 16:59, Andrei Pozolotin wrote:
> >*Peter, hello;*
> > 
> >Do you think you could shed some light here:
> >https://issues.apache.org/jira/browse/FELIX-2961
> >SCR & ConfigurationAdmin : service.pid resolution
> > 
> >Please  :-) 
> > 
> >Thank you,
> > 
> >Andrei
> > 
> > 


> SCR & ConfigurationAdmin : service.pid resolution
> -
>
> Key: FELIX-2961
> URL: https://issues.apache.org/jira/browse/FELIX-2961
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Andrei Pozolotin
>
> hello!
> when I use config admin to control instaniation of scr component services, I 
> use this pattern:
> // 1) in config source bundle:
>   Configuration config = 
> configAdmin.getConfiguration("ZZZ", null);
>   Dictionary props = 
> config.getProperties();
>   config.update(props);
> //  2) in config target bundle:
> @Service
> @Component(name = "AAA", policy = ConfigurationPolicy.REQUIRE, immediate = 
> true)
> public class BucketPlugin implements PluginSpaceService {
>   @Property(name = "service.pid")
>   protected static final String PID = "ZZZ";
> // 3) despite the fact service.pid "looks good" in xml for the tagret 
> compenent:
>  configuration-policy="require">
> 
> 
> 
> 
> 
> // 4) the scr fails to initialize the component; intitialzation works only 
> when 
> (scr.component.name == config.service.pid) and NOT when (config.service.pid 
> == scr.component.property.pid)
> // 5) if I look on the the config target in console (when I do manage to 
> inititialize it),
> it shows that again, actual service.pid comes from scr.component.name and not 
> from scr.component.property.service.pid
> thank you.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

2011-05-23 Thread Andrew Pimlott (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038180#comment-13038180
 ] 

Andrew Pimlott commented on FELIX-2962:
---

I can immediately offer (each line a complete example of a malformed XML file 
accepted by Felix SCR):





The XML 1.1 spec says that XML processors "must report violations of this 
specification's well-formedness constraints".  I would expect that if any of 
these were used as a Service-Component, I would get an exception about 
malformed XML from Bundle.start.

Beyond the correctness issue, quality of diagnostics is a key differentiator 
between implementations of OSGi, since they all follow the same spec.  I filed 
this issue because I got a totally misleading error message when I tried to 
start my bundle, where the root cause was malformed XML.  Worse, I want to 
write a program on top of Felix that accepts bundles.  If I can't provide 
accurate diagnostics to users about errors in their bundles, it hurts the 
quality of my program.

> SCR doesn't detect invalid XML
> --
>
> Key: FELIX-2962
> URL: https://issues.apache.org/jira/browse/FELIX-2962
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Andrew Pimlott
>  Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect 
> XML, even basic errors like mismatched start and end tags.  This makes 
> diagnosing component load errors very frustrating.  Please use a real XML 
> parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: How to find JDBC Driver class in a bundle?

2011-05-23 Thread Justin Edelson
You should never use Class.forName(). See
http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html

Justin

On Mon, May 23, 2011 at 12:15 PM, jie yan  wrote:
> With the help of some engineers in Karaf forum, I've wrapped an Oracle
> driver bundle.
>
> But I can't find the suitable way to create a JDBC driver in my Oracle
> client bundle.
>
> Attempt 1:
> 1) oracle.jdbc
> 2) Class.forName("oracle.jdbc.OracleDriver");
> Failed.
>
> Attempt 2:
> 1) oracle.jdbc
> 2) static{
>  DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
>  }
> Failed.
>
> How could I do?
>
> Regards,
> drhades
>


[jira] [Commented] (FELIX-2969) [Framework] Implement OSGi R4.3 framework wiring object

2011-05-23 Thread Richard S. Hall (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038092#comment-13038092
 ] 

Richard S. Hall commented on FELIX-2969:


I have committed an initial implementation, but I will keep this bug open for 
the time being because we are not passing the R4.3 CT for this yet. The 
failures appear somewhat unrelated to the implementation code and more related 
to the fact that we don't yet implement the new generic provide/require 
capability of R4.3. So, until we implement that and get the FrameworkWiring 
tests passing, I'll keep this issue open.

> [Framework] Implement OSGi R4.3 framework wiring object
> ---
>
> Key: FELIX-2969
> URL: https://issues.apache.org/jira/browse/FELIX-2969
> Project: Felix
>  Issue Type: New Feature
>  Components: Framework, Specification compliance
>Affects Versions: framework-3.2.2
>Reporter: Richard S. Hall
>Assignee: Richard S. Hall
> Fix For: framework-4.0.0
>
>
> The OSGi R4.3 spec introduces a new FrameworkWiring API available from the 
> system bundle adapt() method to replace the PackageAdmin service. We need to 
> implement it.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: How to find JDBC Driver class in a bundle?

2011-05-23 Thread Guillaume Nodet
You should have a look at the OSGi Enterprise specifications that has
a whole chapter targetted at using JDBC inside OSGi.
See http://www.osgi.org/Download/File?url=/download/r4v42/r4.enterprise.pdf

On Mon, May 23, 2011 at 18:15, jie yan  wrote:
> With the help of some engineers in Karaf forum, I've wrapped an Oracle
> driver bundle.
>
> But I can't find the suitable way to create a JDBC driver in my Oracle
> client bundle.
>
> Attempt 1:
> 1) oracle.jdbc
> 2) Class.forName("oracle.jdbc.OracleDriver");
> Failed.
>
> Attempt 2:
> 1) oracle.jdbc
> 2) static{
>  DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
>  }
> Failed.
>
> How could I do?
>
> Regards,
> drhades
>



-- 
Cheers,
Guillaume Nodet

Blog: http://gnodet.blogspot.com/

Open Source SOA
http://fusesource.com

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com/


How to find JDBC Driver class in a bundle?

2011-05-23 Thread jie yan
With the help of some engineers in Karaf forum, I've wrapped an Oracle
driver bundle.

But I can't find the suitable way to create a JDBC driver in my Oracle
client bundle.

Attempt 1:
1) oracle.jdbc
2) Class.forName("oracle.jdbc.OracleDriver");
Failed.

Attempt 2:
1) oracle.jdbc
2) static{
 DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
 }
Failed.

How could I do?

Regards,
drhades


[jira] [Created] (FELIX-2969) [Framework] Implement OSGi R4.3 framework wiring object

2011-05-23 Thread Richard S. Hall (JIRA)
[Framework] Implement OSGi R4.3 framework wiring object
---

 Key: FELIX-2969
 URL: https://issues.apache.org/jira/browse/FELIX-2969
 Project: Felix
  Issue Type: New Feature
  Components: Framework, Specification compliance
Affects Versions: framework-3.2.2
Reporter: Richard S. Hall
Assignee: Richard S. Hall
 Fix For: framework-4.0.0


The OSGi R4.3 spec introduces a new FrameworkWiring API available from the 
system bundle adapt() method to replace the PackageAdmin service. We need to 
implement it.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-2961) SCR & ConfigurationAdmin : service.pid resolution

2011-05-23 Thread Andrei Pozolotin (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037980#comment-13037980
 ] 

Andrei Pozolotin commented on FELIX-2961:
-

in other words, my interpretation of 112.7:

"The name of the component is used as the key for obtaining additional com-
ponent properties from Configuration Admin."

"name of the component" => really means :-)

if "service.pid" is present, then use it;
if "service.pid" is missing, set "service.pid"="name of the component"
finally, use "service.pid" as the key for Configuration Admin


> SCR & ConfigurationAdmin : service.pid resolution
> -
>
> Key: FELIX-2961
> URL: https://issues.apache.org/jira/browse/FELIX-2961
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Andrei Pozolotin
>
> hello!
> when I use config admin to control instaniation of scr component services, I 
> use this pattern:
> // 1) in config source bundle:
>   Configuration config = 
> configAdmin.getConfiguration("ZZZ", null);
>   Dictionary props = 
> config.getProperties();
>   config.update(props);
> //  2) in config target bundle:
> @Service
> @Component(name = "AAA", policy = ConfigurationPolicy.REQUIRE, immediate = 
> true)
> public class BucketPlugin implements PluginSpaceService {
>   @Property(name = "service.pid")
>   protected static final String PID = "ZZZ";
> // 3) despite the fact service.pid "looks good" in xml for the tagret 
> compenent:
>  configuration-policy="require">
> 
> 
> 
> 
> 
> // 4) the scr fails to initialize the component; intitialzation works only 
> when 
> (scr.component.name == config.service.pid) and NOT when (config.service.pid 
> == scr.component.property.pid)
> // 5) if I look on the the config target in console (when I do manage to 
> inititialize it),
> it shows that again, actual service.pid comes from scr.component.name and not 
> from scr.component.property.service.pid
> thank you.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-2961) SCR & ConfigurationAdmin : service.pid resolution

2011-05-23 Thread Andrei Pozolotin (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037970#comment-13037970
 ] 

Andrei Pozolotin commented on FELIX-2961:
-

Felix: thanks for looking into this.

re: "unless the component already sets this property itself. "

this is how I set this property myself:

@Property(name = "service.pid")
protected static final String PID = "ZZZ"; 

and it is confirmed by generated xml:

 

hence my suggestion is simple: 
for SCR runtime NOT to ignore property name="service.pid"
if it is present in xml.

and if it is missing (not set), your logic above is unchanged.

Andrei.


> SCR & ConfigurationAdmin : service.pid resolution
> -
>
> Key: FELIX-2961
> URL: https://issues.apache.org/jira/browse/FELIX-2961
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Andrei Pozolotin
>
> hello!
> when I use config admin to control instaniation of scr component services, I 
> use this pattern:
> // 1) in config source bundle:
>   Configuration config = 
> configAdmin.getConfiguration("ZZZ", null);
>   Dictionary props = 
> config.getProperties();
>   config.update(props);
> //  2) in config target bundle:
> @Service
> @Component(name = "AAA", policy = ConfigurationPolicy.REQUIRE, immediate = 
> true)
> public class BucketPlugin implements PluginSpaceService {
>   @Property(name = "service.pid")
>   protected static final String PID = "ZZZ";
> // 3) despite the fact service.pid "looks good" in xml for the tagret 
> compenent:
>  configuration-policy="require">
> 
> 
> 
> 
> 
> // 4) the scr fails to initialize the component; intitialzation works only 
> when 
> (scr.component.name == config.service.pid) and NOT when (config.service.pid 
> == scr.component.property.pid)
> // 5) if I look on the the config target in console (when I do manage to 
> inititialize it),
> it shows that again, actual service.pid comes from scr.component.name and not 
> from scr.component.property.service.pid
> thank you.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: NPE with felix framework 3.0.8

2011-05-23 Thread Richard S. Hall
If I recall, I don't think that should be null. It would be awesome if 
there was some way to reproduce it.


-> richard

On 5/23/11 6:05, Felix Meschberger wrote:

Hi,

A user of ours just reported this stack trace with 3.0.7:


org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
 
org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
 org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
org.apache.felix.framework.FelixFelixResolver.resolve(Felix.java:4066)
org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)

Looking at the code in question:



SortedSet  candidates = allCandidates.getCandidates(req);
 if (candidates.size()>  1)
 {

it seems like there is no candidates set for the requirement which
causes the candidates.size() method to throw .. This is still the same
code in 3.2.2.

The user in fact reports that after a restart everything works fine.

Regards
Felix

Am Mittwoch, den 02.02.2011, 22:37 + schrieb Richard S. Hall:

I don't think anything changed in that area for 3.0.8, but you could try
it on 3.0.7 to see.

If it is reproducible, then open a bug and tell me how and I'll look
into it.

->  richard

On 2/2/11 16:30, Guillaume Nodet wrote:

I just had this exception while testing with the latest 3.0.8

java.lang.NullPointerException
at 
org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4100)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)[org.apache.felix.framework-3.0.8.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_22]
at 
org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1612)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.findCompatibleNamespaceHandler(NamespaceHandlerRegistryImpl.java:369)[10:org.apache.aries.blueprint:0.3.0]
at 
org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.registerHandler(NamespaceHandlerRegistryImpl.java:325)[10:org.apache.aries.blueprint:0.3.0]
at 
org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.registerHandler(NamespaceHandlerRegistryImpl.java:135)[10:org.apache.aries.blueprint:0.3.0]
at 
org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.addingService(NamespaceHandlerRegistryImpl.java:97)[10:org.apache.aries.blueprint:0.3.0]
at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)[karaf.jar:]
at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)[karaf.jar:]
at 
org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)[karaf.jar:]
at 
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)[karaf.jar:]
at 
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3769)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.Felix.access$000(Felix.java:80)[org.apache.felix.framework-3.0.8.jar:]
at 
org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:722)[org.apache.felix.framework-3.0.8.jar:]
at 

[jira] [Updated] (FELIX-2968) Bind method of optional references can be called before bind methods of mandatory references

2011-05-23 Thread Guest (JIRA)

 [ 
https://issues.apache.org/jira/browse/FELIX-2968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guest updated FELIX-2968:
-

Description: 
Hi, 
i got the following problem.
I've some references to services, some of them are mandatory and some are 
optional. Well now osgi/scr waits to call the bind methods till all mandatory 
services are available. 
However when it starts to call the bind methods it seems that it doesn't care 
if those are mandatory or optional. This can result in a not expected behavior 
where optional dependencies are satisfied before the mandatory are. 
Consider you have a optional dynamic multiple service binding which you want to 
use with a mandatory service. There's as far as it looks to me no way to ensure 
that the mandatory binds are called before optional are allowed.

  was:
Hi, 
i got the following problem.
I've some references to services, some of them are mandatory and some are 
optional. Well now osgi/scr waits to call the bind methods till all mandatory 
services are available. 
However when it starts to call the bind methods it seams that it doesn't care 
if those are mandatory or optional. This can result in a not expected behavior 
where optional dependencies are satisfied before the mandatory are. 
Consider you have a optional dynamic multiple service binding which you want to 
use with a mandatory service. There's as far as it looks to me no way to ensure 
that the mandatory binds are called before optional are allowed.


> Bind method of optional references can be called before bind methods of 
> mandatory references
> 
>
> Key: FELIX-2968
> URL: https://issues.apache.org/jira/browse/FELIX-2968
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Guest
>  Labels: felix, scr
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Hi, 
> i got the following problem.
> I've some references to services, some of them are mandatory and some are 
> optional. Well now osgi/scr waits to call the bind methods till all mandatory 
> services are available. 
> However when it starts to call the bind methods it seems that it doesn't care 
> if those are mandatory or optional. This can result in a not expected 
> behavior where optional dependencies are satisfied before the mandatory are. 
> Consider you have a optional dynamic multiple service binding which you want 
> to use with a mandatory service. There's as far as it looks to me no way to 
> ensure that the mandatory binds are called before optional are allowed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (FELIX-2968) Bind method of optional references can be called before bind methods of mandatory references

2011-05-23 Thread Guest (JIRA)
Bind method of optional references can be called before bind methods of 
mandatory references


 Key: FELIX-2968
 URL: https://issues.apache.org/jira/browse/FELIX-2968
 Project: Felix
  Issue Type: Bug
  Components: Declarative Services (SCR)
Affects Versions:  scr-1.6.0
Reporter: Guest


Hi, 
i got the following problem.
I've some references to services, some of them are mandatory and some are 
optional. Well now osgi/scr waits to call the bind methods till all mandatory 
services are available. 
However when it starts to call the bind methods it seams that it doesn't care 
if those are mandatory or optional. This can result in a not expected behavior 
where optional dependencies are satisfied before the mandatory are. 
Consider you have a optional dynamic multiple service binding which you want to 
use with a mandatory service. There's as far as it looks to me no way to ensure 
that the mandatory binds are called before optional are allowed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: new feature request: iPOJO component-flow-composition

2011-05-23 Thread jie yan
 Thank Clement very much.

Regards,
drhades

On Mon, May 23, 2011 at 8:05 PM, Clement Escoffier <
clement.escoff...@gmail.com> wrote:

> Hi,
>
> On 23.05.11 09:16, "jie yan"  wrote:
>
> >On Mon, May 23, 2011 at 1:14 PM, Clement Escoffier <
> >clement.escoff...@gmail.com> wrote:
> >
> >>
> >>
> >> On 23.05.11 04:48, "jie yan"  wrote:
> >>
> >> >Thank Clement.
> >> >Cilia is quite close to what I want.
> >> >
> >> >Another question about iPOJO is, how to specify the @Requires service
> >>when
> >> >there are multi-implementation?
> >> >That may be another subject.
> >>
> >> If the injected field is an array or a collection, iPOJO automatically
> >> inject all providers.
> >> On @Bind method, you can specify aggregate="true".
> >>
> >> Sorry, I didn't express clearly.
> >
> >What I wondered is, for example:
> >Component-A requires service MyService;
> >While there are two implementations in the framework, MyServiceImpl-1 and
> >MyServiceImpl-2;
> >Is it possible to specify which implementation to be used in Component-A?
> >
> >The triggering scene is:
> >I have two web bundle, WB-1 serving /w1,and WB-2 serving /w2;
> >WB-1 and WB-2 have their own HttpContext implementations, that dispatch
> >the
> >requests into different directory;
> >These two HttpContext implementation have similar logic, but different
> >mapping directory;
> >So, I try to create two HttpContext service instance with different
> >property, and specify the required instance in WB-1 and WB-2;
> >Is it reasonable?
>
>
> You have the 'from' attribute allowing to select the instance providing
> the service you want:
> @Requires(from="instance-name")
>
> You just need to specify the instance name when creating your instance:
> @Instance(name="instance-name")
>
> Regards,
>
> Clement
>
> >
> >Regards,
> >drhades
> >
> >
> >> Regards,
> >>
> >> Clement
> >>
> >> >
> >> >Regards,
> >> >drhades
> >> >
> >> >On Thu, May 19, 2011 at 3:13 PM, Clement Escoffier <
> >> >clement.escoff...@gmail.com> wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> On 18.05.11 13:47, "jie yan"  wrote:
> >> >>
> >> >> >I enjoyed iPOJO very much, although just using it for 2 weeks.
> >> >> >
> >> >> >iPOJO provides a charming component runtime.
> >> >> >Is it convenient to extend iPOJO to support
> >> >>component-flow-composition?
> >> >> >
> >> >> >The imaginary flow-composition is data-driven, without loop
> >> >>flow-control.
> >> >> >Just think SPSS clementine, or Weka knowledge-flow.
> >> >>
> >> >> So, iPOJO provides an event-admin handler for asynchronous
> >> >>communications,
> >> >> but it's not really what you're looking for. You should have a look
> >>at
> >> >> Cilia (http://wikiadele.imag.fr/index.php/Cilia) which provides, on
> >>the
> >> >> top of iPOJO, something close to what you want.
> >> >>
> >> >> Regards,
> >> >>
> >> >> Clement
> >> >>
> >> >>
> >> >> >
> >> >> >Looking forward to some guidance.
> >> >> >
> >> >> >Best regards,
> >> >> >drhades
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>


Re: new feature request: iPOJO component-flow-composition

2011-05-23 Thread Clement Escoffier
Hi,

On 23.05.11 09:16, "jie yan"  wrote:

>On Mon, May 23, 2011 at 1:14 PM, Clement Escoffier <
>clement.escoff...@gmail.com> wrote:
>
>>
>>
>> On 23.05.11 04:48, "jie yan"  wrote:
>>
>> >Thank Clement.
>> >Cilia is quite close to what I want.
>> >
>> >Another question about iPOJO is, how to specify the @Requires service
>>when
>> >there are multi-implementation?
>> >That may be another subject.
>>
>> If the injected field is an array or a collection, iPOJO automatically
>> inject all providers.
>> On @Bind method, you can specify aggregate="true".
>>
>> Sorry, I didn't express clearly.
>
>What I wondered is, for example:
>Component-A requires service MyService;
>While there are two implementations in the framework, MyServiceImpl-1 and
>MyServiceImpl-2;
>Is it possible to specify which implementation to be used in Component-A?
>
>The triggering scene is:
>I have two web bundle, WB-1 serving /w1,and WB-2 serving /w2;
>WB-1 and WB-2 have their own HttpContext implementations, that dispatch
>the
>requests into different directory;
>These two HttpContext implementation have similar logic, but different
>mapping directory;
>So, I try to create two HttpContext service instance with different
>property, and specify the required instance in WB-1 and WB-2;
>Is it reasonable?


You have the 'from' attribute allowing to select the instance providing
the service you want:
@Requires(from="instance-name")

You just need to specify the instance name when creating your instance:
@Instance(name="instance-name")

Regards,

Clement

>
>Regards,
>drhades
>
>
>> Regards,
>>
>> Clement
>>
>> >
>> >Regards,
>> >drhades
>> >
>> >On Thu, May 19, 2011 at 3:13 PM, Clement Escoffier <
>> >clement.escoff...@gmail.com> wrote:
>> >
>> >> Hi,
>> >>
>> >> On 18.05.11 13:47, "jie yan"  wrote:
>> >>
>> >> >I enjoyed iPOJO very much, although just using it for 2 weeks.
>> >> >
>> >> >iPOJO provides a charming component runtime.
>> >> >Is it convenient to extend iPOJO to support
>> >>component-flow-composition?
>> >> >
>> >> >The imaginary flow-composition is data-driven, without loop
>> >>flow-control.
>> >> >Just think SPSS clementine, or Weka knowledge-flow.
>> >>
>> >> So, iPOJO provides an event-admin handler for asynchronous
>> >>communications,
>> >> but it's not really what you're looking for. You should have a look
>>at
>> >> Cilia (http://wikiadele.imag.fr/index.php/Cilia) which provides, on
>>the
>> >> top of iPOJO, something close to what you want.
>> >>
>> >> Regards,
>> >>
>> >> Clement
>> >>
>> >>
>> >> >
>> >> >Looking forward to some guidance.
>> >> >
>> >> >Best regards,
>> >> >drhades
>> >>
>> >>
>> >>
>>
>>
>>




[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

2011-05-23 Thread Felix Meschberger (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037870#comment-13037870
 ] 

Felix Meschberger commented on FELIX-2962:
--

Thanks for reporting.

We use a "real" parser since KXml is a fast, light-weight, real parser. Hence I 
do not consider replacing the parser at this point in time.

But, I admit, that error reporting my be improved and you could help us do that 
!

If you could provide invalid XML and state the expected behaviour (in terms of 
logging, I would assume), this would help use improving error reporting. Thanks 
alot !



> SCR doesn't detect invalid XML
> --
>
> Key: FELIX-2962
> URL: https://issues.apache.org/jira/browse/FELIX-2962
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Andrew Pimlott
>  Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect 
> XML, even basic errors like mismatched start and end tags.  This makes 
> diagnosing component load errors very frustrating.  Please use a real XML 
> parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-2961) SCR & ConfigurationAdmin : service.pid resolution

2011-05-23 Thread Felix Meschberger (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037869#comment-13037869
 ] 

Felix Meschberger commented on FELIX-2961:
--

Actually I disagree (even after reading the mail thread again).

The spec states that the Component Name is to be used to get the applicable 
configuration from Configuration Admin. In you sample this would be "AAA" and 
not your Service PID value of "ZZZ". Hence the code works as designed and the 
configuration required is for "AAA". See Section 112.7, Deployment, of the 
Declarative Services specification.

Actually, IIRC as a consequence of the thread you refer to, the SCR plugin 
automatically sets the service.pid property in the component descriptor unless 
the component already sets this property itself.

> SCR & ConfigurationAdmin : service.pid resolution
> -
>
> Key: FELIX-2961
> URL: https://issues.apache.org/jira/browse/FELIX-2961
> Project: Felix
>  Issue Type: Bug
>  Components: Declarative Services (SCR)
>Affects Versions:  scr-1.6.0
>Reporter: Andrei Pozolotin
>
> hello!
> when I use config admin to control instaniation of scr component services, I 
> use this pattern:
> // 1) in config source bundle:
>   Configuration config = 
> configAdmin.getConfiguration("ZZZ", null);
>   Dictionary props = 
> config.getProperties();
>   config.update(props);
> //  2) in config target bundle:
> @Service
> @Component(name = "AAA", policy = ConfigurationPolicy.REQUIRE, immediate = 
> true)
> public class BucketPlugin implements PluginSpaceService {
>   @Property(name = "service.pid")
>   protected static final String PID = "ZZZ";
> // 3) despite the fact service.pid "looks good" in xml for the tagret 
> compenent:
>  configuration-policy="require">
> 
> 
> 
> 
> 
> // 4) the scr fails to initialize the component; intitialzation works only 
> when 
> (scr.component.name == config.service.pid) and NOT when (config.service.pid 
> == scr.component.property.pid)
> // 5) if I look on the the config target in console (when I do manage to 
> inititialize it),
> it shows that again, actual service.pid comes from scr.component.name and not 
> from scr.component.property.service.pid
> thank you.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: [jira] [Created] (FELIX-2967) file-based log service wanted

2011-05-23 Thread Felix Meschberger
Hi,

You might also want to look into the Sling Commons Log bundle [1]: This
is a single bundle solution providing OSGi LogService, SLF4J, Log4J, and
commons logging APIs writing to files by default and configurable
through Configuration Admin (and with framework properties for basic
setup).

Regards
Felix

[1] http://sling.apache.org/site/logging.html

Am Montag, den 23.05.2011, 04:00 +0100 schrieb drhades (JIRA): 
> file-based log service wanted
> -
> 
>  Key: FELIX-2967
>  URL: https://issues.apache.org/jira/browse/FELIX-2967
>  Project: Felix
>   Issue Type: New Feature
>   Components: Log Service
> Reporter: drhades
> 
> 
> Log information is critical during debugging and maintenance.
> Now, the log service sub-project only provides memory-based implementation.
> And, the pax or other log implementations are quite difficult to be installed 
> and used.
> 
> Do people here have a plan to improve the current log service to support 
> file-logging?
> Really looking forward.
> 
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira




Re: NPE with felix framework 3.0.8

2011-05-23 Thread Felix Meschberger
Hi,

A user of ours just reported this stack trace with 3.0.7:

> org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
>  
> org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
>  
> org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
> org.apache.felix.framework.FelixFelixResolver.resolve(Felix.java:4066)
> org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)

Looking at the code in question:


> SortedSet candidates = allCandidates.getCandidates(req);
> if (candidates.size() > 1)
> {

it seems like there is no candidates set for the requirement which
causes the candidates.size() method to throw .. This is still the same
code in 3.2.2.

The user in fact reports that after a restart everything works fine.

Regards
Felix

> 
Am Mittwoch, den 02.02.2011, 22:37 + schrieb Richard S. Hall: 
> I don't think anything changed in that area for 3.0.8, but you could try 
> it on 3.0.7 to see.
> 
> If it is reproducible, then open a bug and tell me how and I'll look 
> into it.
> 
> -> richard
> 
> On 2/2/11 16:30, Guillaume Nodet wrote:
> > I just had this exception while testing with the latest 3.0.8
> >
> > java.lang.NullPointerException
> > at 
> > org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4100)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)[org.apache.felix.framework-3.0.8.jar:]
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_22]
> > at 
> > org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1612)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.findCompatibleNamespaceHandler(NamespaceHandlerRegistryImpl.java:369)[10:org.apache.aries.blueprint:0.3.0]
> > at 
> > org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.registerHandler(NamespaceHandlerRegistryImpl.java:325)[10:org.apache.aries.blueprint:0.3.0]
> > at 
> > org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.registerHandler(NamespaceHandlerRegistryImpl.java:135)[10:org.apache.aries.blueprint:0.3.0]
> > at 
> > org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.addingService(NamespaceHandlerRegistryImpl.java:97)[10:org.apache.aries.blueprint:0.3.0]
> > at 
> > org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)[karaf.jar:]
> > at 
> > org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)[karaf.jar:]
> > at 
> > org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)[karaf.jar:]
> > at 
> > org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)[karaf.jar:]
> > at 
> > org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3769)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.Felix.access$000(Felix.java:80)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:722)[org.apache.felix.framework-3.0.8.jar:]
> > at 
> > org.apache.

Re: Where can i find Bnd's source code

2011-05-23 Thread Peter Kriens
All source code is on Github ... https://github.com/bnd/bnd

Kind regards,

Peter Kriens

On 23 mei 2011, at 08:24, Tiger Gui wrote:

> Hi Peter,
> 
> Where can i get Bnd's source code or API document ? I want to use
> Tarjan's algorithm to analyse project's OSGi bundles, as we know, bnd
> supply this algorithm's implementation already, it is in ee
> aQute.libg.tarjan. In order to make clear how to use and improve this
> algorithm, i want to check Bnd's source code. But i can not find it in
> bnd's index page [1]. Where can i get it ? Thank you
> 
> 
> 
> [1] http://www.aqute.biz/Bnd/Bnd
> 
> -- 
> Best Regards
> 
> Tiger Gui [tigergui1...@gmail.com]



Re: [VOTE][RESULT] framework 3.2.2 and related subproject

2011-05-23 Thread Karl Pauls
Time to call the vote on the Felix framework 3.2.2 and related
subproject releases (take2).

* +1 votes from Marcel Offermans, Pierre De Rop, Carsten Ziegeler,
Jean-Baptiste Onofré,  Richard S. Hall, Rob Walker, Felix Meschberger,
and Karl Pauls.

* No other votes

The vote is successful. I will make the release artifacts available as
soon as possible


Re: [VOTE] framework 3.2.2 and related subproject

2011-05-23 Thread Karl Pauls
+1

regards,

Karl

On Thu, May 19, 2011 at 2:04 PM, Felix Meschberger  wrote:
> +1
>
> Regards
> Felix
>
> Am Dienstag, den 17.05.2011, 22:04 +0100 schrieb Karl Pauls:
>> I would like to call a vote on the following subproject releases:
>>
>> framework  3.2.2
>> main 3.2.2
>> main.distribution 3.2.2
>>
>> Staging repositories:
>> https://repository.apache.org/content/repositories/orgapachefelix-020/
>>
>> You can use this UNIX script to download the release and verify the 
>> signatures:
>> http://svn.apache.org/repos/asf/felix/trunk/check_staged_release.sh
>>
>> Usage:
>> sh check_staged_release.sh 020 /tmp/felix-staging
>>
>> Please vote to approve this release:
>>
>> [ ] +1 Approve the release
>> [ ] -1 Veto the release (please provide specific comments)
>
>
>



-- 
Karl Pauls
karlpa...@gmail.com


Re: new feature request: iPOJO component-flow-composition

2011-05-23 Thread jie yan
On Mon, May 23, 2011 at 1:14 PM, Clement Escoffier <
clement.escoff...@gmail.com> wrote:

>
>
> On 23.05.11 04:48, "jie yan"  wrote:
>
> >Thank Clement.
> >Cilia is quite close to what I want.
> >
> >Another question about iPOJO is, how to specify the @Requires service when
> >there are multi-implementation?
> >That may be another subject.
>
> If the injected field is an array or a collection, iPOJO automatically
> inject all providers.
> On @Bind method, you can specify aggregate="true".
>
> Sorry, I didn't express clearly.

What I wondered is, for example:
Component-A requires service MyService;
While there are two implementations in the framework, MyServiceImpl-1 and
MyServiceImpl-2;
Is it possible to specify which implementation to be used in Component-A?

The triggering scene is:
I have two web bundle, WB-1 serving /w1,and WB-2 serving /w2;
WB-1 and WB-2 have their own HttpContext implementations, that dispatch the
requests into different directory;
These two HttpContext implementation have similar logic, but different
mapping directory;
So, I try to create two HttpContext service instance with different
property, and specify the required instance in WB-1 and WB-2;
Is it reasonable?

Regards,
drhades


> Regards,
>
> Clement
>
> >
> >Regards,
> >drhades
> >
> >On Thu, May 19, 2011 at 3:13 PM, Clement Escoffier <
> >clement.escoff...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> On 18.05.11 13:47, "jie yan"  wrote:
> >>
> >> >I enjoyed iPOJO very much, although just using it for 2 weeks.
> >> >
> >> >iPOJO provides a charming component runtime.
> >> >Is it convenient to extend iPOJO to support
> >>component-flow-composition?
> >> >
> >> >The imaginary flow-composition is data-driven, without loop
> >>flow-control.
> >> >Just think SPSS clementine, or Weka knowledge-flow.
> >>
> >> So, iPOJO provides an event-admin handler for asynchronous
> >>communications,
> >> but it's not really what you're looking for. You should have a look at
> >> Cilia (http://wikiadele.imag.fr/index.php/Cilia) which provides, on the
> >> top of iPOJO, something close to what you want.
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >>
> >> >
> >> >Looking forward to some guidance.
> >> >
> >> >Best regards,
> >> >drhades
> >>
> >>
> >>
>
>
>