Return-Path: Delivered-To: apmail-jakarta-avalon-dev-archive@apache.org Received: (qmail 15838 invoked from network); 1 Jul 2002 19:31:00 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by 209.66.108.5 with SMTP; 1 Jul 2002 19:31:00 -0000 Received: (qmail 12921 invoked by uid 97); 1 Jul 2002 19:31:12 -0000 Delivered-To: qmlist-jakarta-archive-avalon-dev@jakarta.apache.org Received: (qmail 12905 invoked by uid 97); 1 Jul 2002 19:31:12 -0000 Mailing-List: contact avalon-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon Developers List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-dev@jakarta.apache.org Received: (qmail 12893 invoked by uid 98); 1 Jul 2002 19:31:11 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) From: "Leo Sutic" To: "'Avalon Developers List'" Subject: RE: [Attn: Stephen] ***I Get It Now*** Date: Mon, 1 Jul 2002 21:31:28 +0200 Message-ID: <000701c22135$e644b140$0801a8c0@Lagrange> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal In-Reply-To: <3D20A9B1.3090102@osm.net> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-OriginalArrivalTime: 01 Jul 2002 19:31:00.0357 (UTC) FILETIME=[D498EB50:01C22135] X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N 1) How is end-of-life processing handled? If the service instance implements Disposable, when and how do I dispose of the service instance? 2) Suppose I have a component A that has a dependency on component B. When I call pipeline("A"), this will set up and instance of B and set up a ServiceManager for A so that A can get a reference to B. Correct? Now, suppose I call pipeline("B") first, and get a service instance of B. Can I force Merlin to use that instance to satisfy A's dependency? 3) In the case above, when B is instatiated as a result of A requiring it, will B be disposed along with A when A is disposed? 4) Where does Merlin keep references to B in the case (3)? MicroContainer does not return a service instance, but a proxy implementing all of the service instance's interfaces. When the proxy is GC'd or when it is passed to the MicroContainer.release() method, it handles disposal of the contained instance as well as all dependencies that are no longer used anywhere else. I would like to see something similar in Merlin. It also allows you to specify suppliers (the answer to question 2 is "yes" for MicroContainer): public static Composer getInstance( Supplier supplier ) { return (Composer) new MicroContainer( ComposerImpl.class ) .component( Supplier.ROLE, supplier ) // Specify supplier of service. // (The supplier must be another proxy.) .sharedInstance( true ) // Handling policy .create(); // Create the proxy instance with a // contained component instance. } I would love to see something similar in Merlin. /LS > -----Original Message----- > From: Stephen McConnell [mailto:mcconnell@osm.net] > Sent: den 1 juli 2002 21:13 > To: Avalon Developers List > Subject: Re: [Attn: Stephen] ***I Get It Now*** > > > > > Leo Sutic wrote: > > >Stephen, > > > >I looked over Merlin, and I think I'll ditch MicroContainer for it. > > > >In particular, it would appear as if I can keep just the > MicroContainer > >class (maybe move it over to Merlin). > > > >Let me explain: > > > > + Merlin uses the ServiceLoader class to start up a component. > > > > + Basically, you say "ServiceLoader, the components are in these JAR > >files, > > I want to use this component, load it." So I could use > ServiceLoader > >to > > get a DataSourceComponent and it would automatically > check all listed > > JAR files for the depndencies of the DataSourceComponent. > > > >But then, once Merlin has loaded the component, how do I get a > >reference to it? That is, after calling initialize() on the > >serviceLoader, what do I do then? > > > ServiceLoader is a compoent that implements the interface > PipelineService. The PipelineService interface contains the > operation > "pipeline" which is the directive to Merlin to load and process the > lifecycle of a target component given a classname. The pipeline > operation returns the component to the invoking client. Take > a look at > the > http://home.osm.net/doc/merlin/org/apache/excalibur/merlin/pac > kage-summary.html > and the javadoc for ServiceLoader for addition details. > > > > >In particular, suppose I have this: > > > >public void MyApp { > > > > public static void main(String[] args) throws Exception { > > // Do stuff > > > > ... > > > > // I want to use a DataSourceComponent right here. > > // The component I want to use is fully meta-enabled, and so is > > // all its dependencies. How? > > > > ... > > > > // Some other stuff > > } > > > >} > > > >Question: > > > > + Does Merlin *require* the use of external XML files for > >configuration? Or can > > a configuration be built programmatically and given to Merlin? > > > > > > Its desiged to be built programatically. No configuration is > "required". The functional parameters are passed under a > ServiceLoaderContext.Details of ServiceLoader in terms of the > contextualize and configure requirements are detiled in the > ServiceLoader javadoc. The optional configuration lets the client > override the default configuration of a component - but this > an area I > want to review as part of Merlin II (refer the excalibur assembly > package and the readme file for more details). What Merlin > does require > is that component structure is declared in an xinfo file - at > the moment > its a bick strict - and I think this could be generalized so that a > minimal component xinfo could be logically derived if not explicitly > declared - but that's more a Merlin II subject. Main changes between > current Merlin and Merlin II are (a) II builds extensively on > containerkit, (b) II introduces more structured approach to merlin > assembly defintions (an example is included in the Excalibur > asssembly > package), and (c) the overall design focussed on the ability > to create a > hierachy of merlin containers in service can be explicitly exported. > > Cheers, Steve. > > > >/LS > > > > > >-- > >To unsubscribe, e-mail: > unsubscribe@jakarta.apache.org> > >For > additional commands, > e-mail: > > > > > > > > > > -- > > Stephen J. McConnell > > OSM SARL > digital products for a global economy > mailto:mcconnell@osm.net > http://www.osm.net > > > > > -- > To unsubscribe, e-mail: > unsubscribe@jakarta.apache.org> > For > additional commands, > e-mail: > > -- To unsubscribe, e-mail: For additional commands, e-mail: