public static void publishDelta()

in plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java [393:449]


    public static void publishDelta(IModuleResourceDelta delta, IPath publishPath, List<IStatus> statusList) {
        IModuleResource resource = delta.getModuleResource();
        int kind = delta.getKind();

        if (resource instanceof IModuleFile) {
            // it's a file        
            IPath filePath = publishPath.append(resource.getModuleRelativePath()).append(resource.getName());
            File file = filePath.toFile();
            if (kind == IModuleResourceDelta.REMOVED) {
                if (file.exists() && !file.delete()) {
                    statusList.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Unable to delete file: " + file.getAbsolutePath(), null));
                }
            } else {
                File parentFile = file.getParentFile();
                if (parentFile != null && !parentFile.exists()) {
                    if (!parentFile.mkdirs()) {
                        statusList.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Unable to create parent directory: " + parentFile.getAbsolutePath(), null));
                        return;
                    }
                }
                
                IModuleFile moduleFile = (IModuleFile) resource;
                try {
                    copyFile(moduleFile, file);
                } catch (CoreException e) {
                    statusList.add(e.getStatus());
                } catch (IOException e) {
                    statusList.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error copying file " + file.getAbsolutePath(), e));
                }
            }
        } else if (resource instanceof IModuleFolder) {
            // it's directory
            if (kind == IModuleResourceDelta.ADDED) {
                IPath filePath = publishPath.append(resource.getModuleRelativePath()).append(resource.getName());
                File file = filePath.toFile();
                if (!file.exists() && !file.mkdirs()) {
                    statusList.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Unable to create directory: " + file.getAbsolutePath(), null));
                    return;
                }
            }

            IModuleResourceDelta[] childDeltas = delta.getAffectedChildren();
            if (childDeltas != null) {
                for (IModuleResourceDelta childDelta : childDeltas) {
                    publishDelta(childDelta, publishPath, statusList);
                }
            }

            if (kind == IModuleResourceDelta.REMOVED) {
                IPath filePath = publishPath.append(resource.getModuleRelativePath()).append(resource.getName());
                File file = filePath.toFile();
                if (file.exists() && !file.delete()) {
                    statusList.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Unable to delete directory: " + file.getAbsolutePath(), null));
                }
            }
        }
    }