Hi,

As said by Richard, iPOJO provides an introspection mechanism collection
data about created instances. This introspection mechanism gives information
about service dependency resolution, used service providers... Of course,
you can have information about the instance state (valid or invalid), and so
be able to detect errors thrown during the activation.

During the instance creation, iPOJO throws exceptions (logged in the log
service) if something wrong happens. If the instances is declared in an
iPOJO descriptor, you can't catch the exception as iPOJO creates instances
asynchronously as in DS. However, you can create instances by using the API
(and the Factory services). In this case the instance is created
synchronously. So, you can catch both configuration and activation
exceptions.

Regards,

Clement 

-----Original Message-----
From: Richard S. Hall [mailto:[EMAIL PROTECTED] 
Sent: jeudi 24 juillet 2008 22:54
To: [email protected]
Subject: Re: Exceptions and Declarative Services

I don't think this is easily achievable with DS. However, if you are not 
tied to DS, but just want similar functionality, then you might be able 
to get it from iPOJO. I do know that iPOJO has a reflection mechanism so 
you can inspect the state of all dependencies of component instances, 
for example.

-> richard

Rubén Barroso wrote:
> Hi all,
>
> I have a bundle which is activated through Declarative Services and when I
> perform a bundle.start(), the component defining the activate(...) method
> raised an exception, but I can only see following in the logs:
>
> Declarative Services got exception when invoking "activate" in component
> myeventlistener.eventlistener-1.0.0
> (java.lang.reflect.InvocationTargetException)
>
> What I want is the code doing bundle.start() to be notified of such
failure,
> so can stop the process.From the specs:
>
> "If the activate method throws an exception, SCR must log an error message
> containing the exception with the Log Service, if present, and the
component
> configuration is not activated."
>
> I know I could use a BundleActivator approach instead, but I wouldn't want
> to lose other benefits DS offers to me. Is anyone aware of some pattern I
> could use to accomplish this?
>
> Thanks in advance.
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to