Eike Stepper wrote:
the following code lines do not work:

    ContainmentModel containmentModel = kernel.getModel();
    ReferenceDescriptor reference = new 
ReferenceDescriptor(Identifiable.class.getName());
    ComponentModel componentModel = (ComponentModel) 
containmentModel.getModel(reference); // <===== EXCEPTIO


The following line returns the root container:

  ContainmentModel containmentModel = kernel.getModel();

However, you don't have your components in the root container - instead in your example they exist in the container named "econ" which is one level down from root (I should have thought about that).

The operation containmentModel.getModel(reference); is looking for a service in the container that the operation is invoked on. To set the correct scope you can do something like:

  ContainmentModel root = kernel.getModel();
  ContainmentModel econ =
     (ContainmentModel) root.getModel( "/econ" );

Now you reference the container you setup because you request is within the scope of the container containing a component implementing the Identifiable service interface.

  ReferenceDescriptor reference =
    new ReferenceDescriptor(Identifiable.class.getName());
  ComponentModel componentModel =
    (ComponentModel) containmentModel.getModel(reference);

Cheers, Steve.

--

|---------------------------------------|
| Magic by Merlin                       |
| Production by Avalon                  |
|                                       |
| http://avalon.apache.org              |
|---------------------------------------|

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



Reply via email to