Package org.jboss.as.server.deployment
Class DeploymentOverlayDeploymentUnitProcessor
- java.lang.Object
-
- org.jboss.as.server.deployment.DeploymentOverlayDeploymentUnitProcessor
-
- All Implemented Interfaces:
DeploymentUnitProcessor
- Direct Known Subclasses:
DeferredDeploymentOverlayDeploymentUnitProcessor
public class DeploymentOverlayDeploymentUnitProcessor extends Object implements DeploymentUnitProcessor
Deployment unit processor that adds content overrides to the VFS filesystem. This is a two phase process. First any overlays that can be easily resolved are mounted, however we may not be able to mount all overlays because they may depend on VFS mounts that are set up by later structure processors (e.g. if there is an overlay for ear/lib/mylib.jar/com/acme/MyClass.class it can't be mounted until the ear structure processor has created the mount). These resource roots are identified and deferred to be processed at the end of the structure phase. Note that we can't just process everything at the end, as we may need to replace the archives that are mounted by these later processors- Author:
- Stuart Douglas
-
-
Field Summary
Fields Modifier and Type Field Description protected static AttachmentKey<Map<String,byte[]>>DEFERRED_OVERLAYSprotected static AttachmentKey<AttachmentList<Closeable>>MOUNTED_FILES
-
Constructor Summary
Constructors Constructor Description DeploymentOverlayDeploymentUnitProcessor(ContentRepository contentRepository)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidclose(Closeable closeable)protected static voidcopyFile(File src, File dest)protected static voidcopyFile(InputStream in, File dest)voiddeploy(DeploymentPhaseContext phaseContext)Perform a single step in processing the deployment phase.protected Map<String,byte[]>getDeferredAttachment(DeploymentUnit deploymentUnit)protected Map<String,MountedDeploymentOverlay>getMountsAttachment(DeploymentUnit deploymentUnit)protected Map<String,byte[]>getOverlays(DeploymentUnit deploymentUnit)protected voidhandleEntryWithFileParent(Map<String,byte[]> deferred, Map.Entry<String,byte[]> entry, String path, org.jboss.vfs.VirtualFile parent)protected voidhandleExplodedEntryWithDirParent(DeploymentUnit deploymentUnit, org.jboss.vfs.VirtualFile content, org.jboss.vfs.VirtualFile mountPoint, Map<String,MountedDeploymentOverlay> mounts, String overLayPath)voidundeploy(DeploymentUnit context)Undo the deployment processing.
-
-
-
Field Detail
-
MOUNTED_FILES
protected static final AttachmentKey<AttachmentList<Closeable>> MOUNTED_FILES
-
DEFERRED_OVERLAYS
protected static final AttachmentKey<Map<String,byte[]>> DEFERRED_OVERLAYS
-
-
Constructor Detail
-
DeploymentOverlayDeploymentUnitProcessor
public DeploymentOverlayDeploymentUnitProcessor(ContentRepository contentRepository)
-
-
Method Detail
-
deploy
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
Description copied from interface:DeploymentUnitProcessorPerform a single step in processing the deployment phase. The resulting state after executing this method should be that either the method completes normally and all changes are made, or an exception is thrown and all changes made in this method are reverted such that the original pre-invocation state is restored.Data stored on the phase context only exists until the end of the phase. The deployment unit context which is persistent is available via
context.getDeploymentUnitContext().- Specified by:
deployin interfaceDeploymentUnitProcessor- Parameters:
phaseContext- the deployment unit context- Throws:
DeploymentUnitProcessingException- if an error occurs during processing
-
handleEntryWithFileParent
protected void handleEntryWithFileParent(Map<String,byte[]> deferred, Map.Entry<String,byte[]> entry, String path, org.jboss.vfs.VirtualFile parent)
-
handleExplodedEntryWithDirParent
protected void handleExplodedEntryWithDirParent(DeploymentUnit deploymentUnit, org.jboss.vfs.VirtualFile content, org.jboss.vfs.VirtualFile mountPoint, Map<String,MountedDeploymentOverlay> mounts, String overLayPath) throws IOException
- Throws:
IOException
-
getDeferredAttachment
protected Map<String,byte[]> getDeferredAttachment(DeploymentUnit deploymentUnit)
-
getMountsAttachment
protected Map<String,MountedDeploymentOverlay> getMountsAttachment(DeploymentUnit deploymentUnit)
-
getOverlays
protected Map<String,byte[]> getOverlays(DeploymentUnit deploymentUnit)
-
undeploy
public void undeploy(DeploymentUnit context)
Description copied from interface:DeploymentUnitProcessorUndo the deployment processing. This method should undo any action taken bydeploy(); however, if thedeploy()method added services, they need not be removed here (they will automatically be removed).This method should avoid throwing exceptions; any exceptions thrown are logged and ignored. Implementations of this method cannot assume that the deployment process has (or has not) proceeded beyond the current processor, nor can they assume that the
undeploy()method will be called from the same thread as thedeploy()method.- Specified by:
undeployin interfaceDeploymentUnitProcessor- Parameters:
context- the deployment unit context
-
copyFile
protected static void copyFile(File src, File dest) throws IOException
- Throws:
IOException
-
copyFile
protected static void copyFile(InputStream in, File dest) throws IOException
- Throws:
IOException
-
close
protected static void close(Closeable closeable)
-
-