[jboss-dev-forums] [Design the new POJO MicroContainer] - Need cleanup of the attachments api

scott.stark@jboss.org do-not-reply at jboss.com
Fri Feb 23 11:10:39 EST 2007


As I have more metadata being stored off, its clear that the DeploymentUnit api is not sufficient/confusing. There are non-managed, non-serializable attachments showing up in the only used attachments contents. The current attachments api breakdown is:

DeploymentUnit
   .addAttachment
   .getTransientManagedObjects().addAttachment
   .getAttachment
   .getTransientManagedObjects().getAttachment

DeploymentContext
   .getPredeterminedManagedObjects().addAttachment/getAttachment
   .getTransientManagedObjects().addAttachment/getAttachment
   .getTransientAttachments().addAttachment/getAttachment

Right now when one does a DeploymentUnit.addAttachment this is going into the DeploymentContext.getTransientAttachments() contents. When one does a DeploymentUnit.getAttachment the DeploymentContext attachments are checked for a match in the order: getPredeterminedManagedObjects(), getTransientManagedObjects(), and getTransientAttachments().

The notion of the various attachments as I understand it and discussed elsewhere is:
getPredeterminedManagedObjects() - attachment overrides for use by things like the profileservice.
getTransientManagedObjects() - attachment overrides for use by things like the runtime aspects.
getTransientAttachments() - the general runtime attachments bucket for use by deployers, aspects.

The TransientManagedObjects is currently unused, and everything is going into TransientAttachments. This is not a sufficient separation of what is managed metadata that should be persisted vs metadata that is used for inter deployer/aspect communication.

I suggest the following change to cleanup the usage and allow for true transient/non-managed attachments:

1. Remove the Attachments interface from DeploymentUnit.
2. Mirror the Attachments api in DeploymentUnit with an enum that indicates what bucket is being accessed. The non-enum version of getAttachment follows the existing order of accessing the PredeterminedManagedObjects, TransientManagedObjects and TransientAttachments. The non-enum version of addAttachment would populate the TransientManagedObjects contents.
3. To populate a non-managed attachment, one would have to use the call that takes the enum targetting the TransientAttachments list.
4. Drop the getTransientManagedObjects access from DeploymentUnit.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021169#4021169

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021169



More information about the jboss-dev-forums mailing list