[jbossws-dev] [Design of JBoss Web Services] - Re: Deployment.types not propagated

adrian@jboss.org do-not-reply at jboss.com
Fri Nov 9 09:08:11 EST 2007


"thomas.diesler at jboss.com" wrote : With the current API it seems the attachments that I get from 
  | 
  | org.jboss.deployers.client.spi.Deployment.getPredeterminedManagedObjects()
  | 
  | are read only.
  | 
  | Please show me the correct usage of a client using attachments
  | 

They're not read-only in the implementations.

It's just that the Deployment interface assumes that they might be read only,
i.e. you could implement Deployment yourself in a way that the attachments
are immutable.

You can in fact downcast the Attachments to a MutableAttachments
in the provided implementations.

  | MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();
  | 

Or if you don't like the cast, you can create an
MutableAttachments yourself and set it on the deployment

  | VFSDeploymentFactory factory = new VFSDeploymentFactory();
  | VFSDeployment deployment = factory.createDeployment(virtualFile);
  | MutableAttachments attachments = new AttachmentsImpl();
  | attachments.addAttachment("blah", serializable);
  | deployment.setPredeterminedMangedObjects(myAttachments).
  | 

The latter is also method where you could replace AttachmentsImpl
with some form of immutable attachments implementation that loads
them using some other method.
e.g. the profile service might load them a database.

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

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



More information about the jbossws-dev mailing list