[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avalon-dev
Subject:    Re: ComponentInfo can now be loaded from Serialized object
From:       Nicola Ken Barozzi <nicolaken () apache ! org>
Date:       2002-06-28 7:00:19
[Download RAW message or body]


Stephen McConnell wrote:
> 
> 
> Peter Donald wrote:
> 
>> At 04:04 AM 6/28/2002 +0200, you wrote:
>>
>>>>> Keeping in mind that that the compoent in question can provide 
>>>>> service information based on static declarations in an assembly 
>>>>> file - I need to figure out how this information can be made 
>>>>> available to another container without supplying a .xinfo file.
>>>>
>>>>
>>>> I am not sure it is possible unless we start defining Factorys for 
>>>> Avalon components. For a factory you pass in a implementation key 
>>>> (usually classname) and aquire an instance of type. The factory 
>>>> would also expose the MetaInfo associated with type.
>>>
>>>
>>> No - I'm still at meta-land, no component instantiation.
>>
>> Read above again - no need to instantiate type to instantiate types 
>> metadata.
>>
>>>   The action of ComponentInfo (dependecies, services, etc.) creation 
>>> is the point I want to intercept as part of a "standard" containerkit 
>>> meta loading/validation process.  This is needed to be able to plug 
>>> the component into something like SimpleServiceKernel and everything 
>>> will just work fine because the .xinfo for my component will declare 
>>> the ComponentInfo handler - using this information the kernel can 
>>> delegate the ComponentInfo creation to the handler.  The kernel just 
>>> gets back the ComponentInfo and continues on as normal.
>>>
>>> E.g.
>>>
>>>    interface InfoProvider
>>>    {
>>>        ComponentInfo getComponentInfo( Class class );
>>>    }
>>>
>>> And in the .xinfo:
>>>
>>>    <component-info factory="MyInfoProvider"/>
>>
>>
>>
>> What I prposed was more along the lines of
>>
>> interface ComponentFactory
>> {
>>   Object createComponent(String implKey);
>>   ComponentInfo createComponentInfo(String implKey);
>> }
>>
>> When "registering" a type into the system you register a coresponding 
>> factory and all is good. You can do what you want and plenty more.
>>
> 
> This would work for me.

In commons-sandbox we are starting a commons-patterns package.
There will be Factory in it.

IMHO we could use that for non-core interface concepts (ie not
tied to a container or to a lifecycle).

What about (Factory invented)

  interface ComponentFactory
              org.apache.commons.patterns.Factory
  {
    Object newinstance(String implKey);
  }

  interface ComponentInfoFactory extends
              org.apache.commons.patterns.Factory
  {
    Object newinstance(String implKey);
  }


-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic