/** * Create the root deployment context * * @param deployment the deployment * @param metaData the structure meta data * @return the deployment context * @throws Exception for any error */ protected DeploymentContext createRootDeploymentContext(Deployment deployment, StructureMetaData metaData) throws Exception { return createRootDeploymentContext(deployment); }
try prepareStructureMetaData(deployment, metaData); result = createRootDeploymentContext(deployment, metaData); if (result == null) throw new IllegalStateException("Root deployment context is null"); contextInfo = StructureMetaDataFactory.createContextInfo("", null); applyStructureMetaData(result, metaData); contextInfo.setPredeterminedManagedObjects(deployment.getPredeterminedManagedObjects()); applyContextInfo(result, contextInfo); populateContext(result, metaData);
prepareContextInfo(context, child); DeploymentContext childContext = createChildDeploymentContext(context, child); if (childContext == null) throw new IllegalStateException("Child deployment context is null"); applyContextInfo(childContext, child); populateContext(childContext, childStructure);
DeploymentContext childContext = createChildDeploymentContext(context, child); if (childContext == null) throw new IllegalStateException("Child deployment context is null"); childContext.setParent(context); applyContextInfo(childContext, child); populateContext(childContext, childStructure);
try result = createRootDeploymentContext(deployment); if (result == null) throw new IllegalStateException("Root deployment context is null"); contextInfo = StructureMetaDataFactory.createContextInfo("", null); contextInfo.setPredeterminedManagedObjects(deployment.getPredeterminedManagedObjects()); applyContextInfo(result, contextInfo); populateContext(result, metaData);
protected DeploymentContext createChildDeploymentContext(DeploymentContext parent, ContextInfo child) throws Exception { if (parent instanceof VFSDeploymentContext) { VFSDeploymentContext vfsParent = (VFSDeploymentContext) parent; String path = child.getPath(); try { VirtualFile parentFile = vfsParent.getRoot(); VirtualFile file = parentFile.findChild(path); // leaving the findChild usage return new AbstractVFSDeploymentContext(file, path); } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Unable to determine child " + path + " from parent " + vfsParent.getRoot().getName(), t); } } return super.createChildDeploymentContext(parent, child); }
protected void applyContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception super.applyContextInfo(context, contextInfo);
/** * Apply the context info. This transfers the PredeterminedManagedObjects * and TransientManagedObjects and other information from the ContextInfo to the DeploymentContext. * * @param context the context * @param contextInfo the contextInfo * @throws Exception for any error */ protected void applyContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception { Attachments attachments = contextInfo.getPredeterminedManagedObjects(); if (attachments != null) context.setPredeterminedManagedObjects(attachments); context.setRelativeOrder(contextInfo.getRelativeOrder()); applyComparator(context, contextInfo); }
protected DeploymentContext createChildDeploymentContext(DeploymentContext parent, ContextInfo child) throws Exception { if (parent instanceof VFSDeploymentContext) { VFSDeploymentContext vfsParent = (VFSDeploymentContext) parent; String path = child.getPath(); try { VirtualFile parentFile = vfsParent.getRoot(); VirtualFile file = parentFile.getChild(path); return new AbstractVFSDeploymentContext(applyModification(file.exists() ? file : null, child), path); } catch (RuntimeException t) { throw DeploymentException.rethrowAsDeploymentException("Unable to determine child " + path + " from parent " + vfsParent.getRoot().getName(), t); } } return super.createChildDeploymentContext(parent, child); }
@SuppressWarnings("deprecation") protected void applyContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception super.applyContextInfo(context, contextInfo);
/** * Apply the context info. This transfers the PredeterminedManagedObjects * and TransientManagedObjects and other information from the ContextInfo to the DeploymentContext. * * @param context the context * @param contextInfo the contextInfo * @throws Exception for any error */ protected void applyContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception { Attachments attachments = contextInfo.getPredeterminedManagedObjects(); if (attachments != null) context.setPredeterminedManagedObjects(attachments); context.setRelativeOrder(contextInfo.getRelativeOrder()); applyComparator(context, contextInfo); if (structureProcessor != null) structureProcessor.applyContextInfo(context, contextInfo); }
protected DeploymentContext createRootDeploymentContext(Deployment deployment) throws Exception { if (deployment instanceof VFSDeployment) { VFSDeployment vfsDeployment = (VFSDeployment) deployment; return new AbstractVFSDeploymentContext(vfsDeployment.getRoot(), ""); } return super.createRootDeploymentContext(deployment); }
protected DeploymentContext createRootDeploymentContext(Deployment deployment, StructureMetaData metaData) throws Exception { if (deployment instanceof VFSDeployment) { VFSDeployment vfsDeployment = (VFSDeployment) deployment; String name = deployment.getName(); String simpleName = deployment.getSimpleName(); VirtualFile root = applyModification(vfsDeployment.getRoot(), metaData.getContext("")); if (name == null) { return new AbstractVFSDeploymentContext(root, ""); } else { if (simpleName == null) return new AbstractVFSDeploymentContext(name, name, root, ""); else return new AbstractVFSDeploymentContext(name, simpleName, root, ""); } } return super.createRootDeploymentContext(deployment); }