Niclas Hedhman wrote:

Stephen,
I need to build the dependency model in memory, i.e.

component --- (dependsOn) ---> service

for the View to show, and the tool to assign (visually and in block.xml) a component that fullfils that service.

You must have this already in the server, so instead of re-doing the work, I should be able to re-use your code.

Starting simple, if I have grabbed the Type Descriptor, what is a reasonable entry point in your current code??


Lets assume that you have an Eclipse plugin and that you have aquired a reference to the root block (an empty block). At this point, you can programatically build a container that is a refection of the development environment. This would involve:


(a) creation of a ContainmentProfile [1]
(b) addition of the ContainmentProfile to the root block's ContainmentModel [2].


To construct a containment profile you need to create a ClassLoaderDirective which you would probably do using information from the Eclipse environment. When you add you new profile to the root block's model you get back a ContainmentModel which you can usee to programatically add sub-containers, component profiles, etc.

[1] http://avalon.apache.org/merlin/api/org/apache/avalon/composition/data/ContainmentProfile.html
[2] http://avalon.apache.org/merlin/api/org/apache/avalon/composition/model/ContainmentModel.html



With a ContainmentModel established, you have a lot of information available to you. Using operations on ContainmentModel you can get the ClassLoaderModel and from that get the TypeRepository and ProfileRepository which means that you have access to all of the types in scope, and all of the profiles for each type. To actually see a dependency graph, you need to assembly your container which is handled by classes at the activation package level. Using the kernel interface you can get the Block instance that is responsible for managing you container by invoking:


Block myBlock = getBlock( myContainmentModel );

You can then assemble your block by doing the following:

((Composite)myBlock).assemble();

To present the assembly graph, you would need to grab the type dependency list and for esch dependnecy, lookup the associated appliance using something like

Appliance appliance = myBlock.locate( aDependency ).

Naturally, a complete meta-model is available for every appliance using something like:

Model model = appliance.getModel();

You can then manipulate info based on the type of model returned (DeploymentModel, ContainmentModel, etc.).

Hope that helps.

Cheers, Steve.


Cheers, Niclas



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





--


Stephen J. McConnell
mailto:[EMAIL PROTECTED]




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



Reply via email to