On Fri, Apr 2, 2010 at 22:52, Alasdair Nottingham <[email protected]> wrote:

> Hi,
>
> Some comments. I'm sure I'll have more once I've had a chance to catch up.
>
> Alasdair
>
> On 1 April 2010 00:42, Guillaume Nodet <[email protected]> wrote:
> > Renaming the subject of this thread.
> >
> >>> 5. Subsystem.getState().  I wonder if we should reinvent here.  Is
> >>> there any reason why we don't make the return type of int, and just
> >>> delegate this to the compositeBundle.getState().  Also, what if the
> >>> composite bundle and constituents have different states.  Does this
> >>> method only work when the states are consistent among these bundles?
> >>>
> >>
> >> My original idea was also to map closely to the composite state, so I
> don't
> >> have any problem
> >> using an int instead of an enum, though I think the state of composite
> is
> >> an int because a composite
> >> *is* a bundle and enums did not exist at the time the bundle interface
> has
> >> been created.
> >> However, Subsystem do not inherit the Bundle or CompositeBundle
> interface,
> >> so we could decide to
> >> use an enum (because the state is semantically an enum).
>
> I think we should stick with an enum. If the Bundle API had had enum's
> available
> when it was originally written it would have used enums. Let's not
> stick in the past.
>

Agreed.


>
> >>
> >> That being said, the question you raise about the constituents state is
> >> important.  We need to choose
> >> whether we want to represent the state of the subsystem as an aggregate
> of
> >> the constituents state or not.
> >> That would surely be interesting, because you would know the real state
> of
> >> your subsystem much more
> >> easily.   The problem is i'm not sure what would happen if one of the
> >> bundle can't start or is manually
> >> stopped by the user.  Would this leave the subsystem in the STARTING
> state
> >> until the start or stop
> >> method is called ?
> >>
>
> I do not see how it can represent the aggregate state. If we have 10
> bundles in a subsystem where
> half are started and half stopped what would the aggregate state be?
> In fact is this even a problem? Perhaps
> this is the normal state. I think that the first thing to decide is
> what does it mean to start and stop a subsystem.
> Once we know what that means we can decide if a relationship with the
> bundles in a subsystem makes sense.
>
> Well, imho, we already have the low level life cycle from the composites.
If we could go higher in the abstraction that would be nice.
So I would assume bundles from inside the subsystem could be marked somehow
has being started or not (I would also assume a default value of started).
When the subsystem is installed, those bundles would be started (well, not
really
started because the composite itself is not, but at least they would be
marked as
persistently started).   Starting the subsystem would start the composite
which in turns
would start the inner bundles. (we could also maybe handle start levels for
each bundle).
Now, I don't think having the bundles ACTIVE is sufficient to describe the
good health
of the subsystem.  But I also agree it might be difficult to understand that
the user mean
by started without custom code to check the health of individual bundles.



> >>
> >>> 6. Subsystem.start() or stop(), I think it should throw either
> >>> BundleException or SubsystemException.
> >>>
> >>
> >> Yeah, SubsystemException would be fine.  Currently I've defined
> >> SubsystemException as being
> >> a RuntimeException though ...
> >>
>
> I suspect this might be a dangerous question to ask, but why a
> RuntimeException :)?
>

Right, no real new arguments beyond the usual debat I suppose.
I'm not strong on that anyway.
However, would the OSGi Api be written again, it seems both Hargrave and
Kriens
agreed that using unchecked exceptions are more user friendly afaik
(see
http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-4966&yr=2009&track=javaee
).
Checked exceptions often lead to spurious code that just catch and wrap an
exception into a different exception...


>
> >>>
> >>> 7. The return type of Subsystem.getHeaders, do we want to use
> >>> Dictionary<String, String> or Dictionary to be consistent with
> >>> Bundle.getHeaders()?  when we implement this method, we can just
> >>> delegate to compositeBundle.getHeaders.
> >>>
> >>
> >> Two things here.  First, I'm not sure we would want to return the
> composite
> >> headers.
> >> First because composite headers can't be localized, and second because i
> >> was thinking
> >> about returning the headers from the subsystem manifest as it was
> >> installed, not of the
> >> underlying composite (which includes computed headers for package and
> >> service policies).
> >> So if we return directly the composite headers, it would surely make
> more
> >> sense to use the
> >> same type, but if we don't, i think using Map is more natural.  OSGi is
> >> really the only place
> >> that uses Dictionary instead of Map ;-)
> >>
>
> I would use Map. If Map had existed when the OSGi interfaces were first
> created
> it would have been used. I think we should stick with Map.
>

Agreed too.


>
> >>>
> >>> On Mon, Mar 29, 2010 at 6:34 PM, Guillaume Nodet <[email protected]>
> >>> wrote:
> >>> > FWIW, I've slightly updated the API with some feedback here and
> mostly
> >>> two
> >>> > other changes:
> >>> >  * moved some management methods from Subsystem to SubsystemAdmin
> >>> (update
> >>> > and uninstall)
> >>> >  * make SubsystemConstants a non instantiable class instead of an
> >>> interface
> >>> >
>
> Why move away from an interface?
>

Because this is an anti-pattern:
http://en.wikipedia.org/wiki/Constant_interface
<http://en.wikipedia.org/wiki/Constant_interface>And that's what all recent
osgi spec do too.

>
>
> --
> Alasdair Nottingham
> [email protected]
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to