You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Stephen McConnell <mc...@apache.org> on 2004/04/10 12:58:10 UTC

Re: Merlin:: How to create/add new components dynamically

Aseem Bansal wrote:

> Hi, 
> 
> I am facing some problem in creating/adding new components in Merlin. 
> 
> I have a component named Mycomponent which is already deployed in the container and wants to create/add new components dynamically. I guess the only way to add is to use the merlin composition APIs. (In case there is some other approach, let us know)
> 
> Here are the steps which i am trying to do in my MyComponent. 
> 
> - Get the Containment model from the container.  (using context.get("urn:composition:containment.model" ))
> 
> - Create a Component Model 
> 
>     - Create an instance of DefaultComponentModel. But the problem is i don't how to create it should it. :)
> 

It's much simpler than that.

You need to invoke ContainmentModel.addModel( ... ).  This operation

        ComponentProfile profile =
          new ComponentProfile(name,Myclass.class.getName());
        DeploymentModel model =
          m_containmentModel.addModel( profile );

Cheers, Stephen.

-- 

|------------------------------------------------|
| Magic by Merlin                                |
| Production by Avalon                           |
|                                                |
| http://avalon.apache.org/merlin                |
| http://dpml.net/merlin/distributions/latest    |
|------------------------------------------------|

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