Package org.rhq.core.util.updater

Examples of org.rhq.core.util.updater.DestinationComplianceMode


        File baseDir = getProject().getBaseDir();
        File handoverRemoteContentDownloadDirectory = null;
        try {
            boolean dryRun = getProject().isDryRun();

            DestinationComplianceMode complianceToUse = DestinationComplianceMode.instanceOrDefault(this.compliance);

            File deployDir = getProject().getDeployDir();
            @SuppressWarnings("unchecked")
            TemplateEngine templateEngine = createTemplateEngine(getProject().getProperties());
            int deploymentId = getProject().getDeploymentId();
            DeploymentProperties deploymentProps = new DeploymentProperties(deploymentId, getProject().getBundleName(),
                getProject().getBundleVersion(), getProject().getBundleDescription(), complianceToUse);

            if (this.preinstallTarget != null) {
                getProject().auditLog(AuditStatus.SUCCESS, "Pre-Install Started", "The pre install target will start",
                    "The pre install target named [" + this.preinstallTarget + "] will start", null);
                Target target = (Target) getProject().getTargets().get(this.preinstallTarget);
                if (target == null) {
                    try {
                        getProject().auditLog(
                            AuditStatus.FAILURE,
                            "Pre-Install Failure",
                            "The pre install target does not exist",
                            "The pre install target specified in the recipe [" + this.preinstallTarget
                                + "] does not exist.", null);
                    } catch (Throwable ignore) {
                        // swallow any errors that occur here, we want to throw the real build exception
                    }
                    throw new BuildException("Specified preinstall target (" + this.preinstallTarget
                        + ") does not exist.");
                }
                target.performTasks();
                getProject().auditLog(AuditStatus.SUCCESS, "Pre-Install Finished",
                    "The pre install target has finished", null, null);
            }

            boolean haveSomethingToDo = false;
            if (!this.files.isEmpty()) {
                haveSomethingToDo = true;
                log("Deploying files " + this.files + "...", Project.MSG_VERBOSE);
            }
            if (!this.urlFiles.isEmpty()) {
                haveSomethingToDo = true;
                log("Deploying files from URL " + this.urlFiles + "...", Project.MSG_VERBOSE);
            }
            if (!this.archives.isEmpty()) {
                haveSomethingToDo = true;
                log("Deploying archives " + this.archives + "...", Project.MSG_VERBOSE);
            }
            if (!this.urlArchives.isEmpty()) {
                haveSomethingToDo = true;
                log("Deploying archives from URL " + this.urlArchives + "...", Project.MSG_VERBOSE);
            }
            if (!this.contentToHandover.isEmpty()) {
                haveSomethingToDo = true;
                log("Handing over " + this.contentToHandover.size() + " file(s)/archive(s)...", Project.MSG_VERBOSE);
            }
            if (!haveSomethingToDo) {
                throw new BuildException(
                    "You must specify at least one file to deploy via nested file, archive, url-file, url-archive types in your recipe");
            }

            log("Destination compliance set to '" + complianceToUse + "'.", Project.MSG_VERBOSE);
            switch (complianceToUse) {
            case full:
                if (!dryRun) {
                    getProject()
                        .auditLog(
                            AuditStatus.INFO,
                            "Managing Top Level Deployment Directory",
                            "The top level deployment directory will be managed - files found there will be backed up and removed!",
                            "The bundle recipe has requested that the top level deployment directory be fully managed by RHQ."
                                + "This means any files currently located in the top level deployment directory will be removed and backed up",
                            null);
                }
                break;
            case filesAndDirectories:
                log("Files and directories in the destination directory not contained in the bundle will be kept intact.\n"
                    + "Note that the contents of the directories that ARE contained in the bundle will be synced with "
                    + "the contents as specified in the bundle. I.e. the subdirectories in the destination that are also "
                    + "contained in the bundle are made compliant with the bundle.", Project.MSG_VERBOSE);
                break;
            default:
                throw new IllegalStateException("Unhandled destination compliance mode: " + complianceToUse.toString());
            }

            Map<File, File> allArchives = new HashMap<File, File>(this.archives);
            Map<File, File> allFiles = new HashMap<File, File>(this.files);
            Map<File, Pattern> allArchiveReplacePatterns = new HashMap<File, Pattern>(this.archiveReplacePatterns);
View Full Code Here

TOP

Related Classes of org.rhq.core.util.updater.DestinationComplianceMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.