All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.trueupdate.installer.cargo.CargoUpdateInstaller Maven / Gradle / Ivy

Go to download

Provides an update installer for applications running in a container which is supported by the generic Cargo API.

There is a newer version: 0.8.1
Show newest version
/*
 * Copyright (C) 2013 Schlichtherle IT Services & Stimulus Software.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.trueupdate.installer.cargo;

import java.io.File;
import java.net.URI;
import javax.annotation.concurrent.Immutable;

import net.java.trueupdate.installer.core.UpdateParameters;
import net.java.trueupdate.installer.core.CoreUpdateInstaller;
import net.java.trueupdate.manager.spec.UpdateContext;
import net.java.trueupdate.manager.spec.tx.Transaction;

/**
 * Installs updates for applications running in a container which is supported
 * by Cargo.
 *
 * @author Christian Schlichtherle
 */
@Immutable
public final class CargoUpdateInstaller extends CoreUpdateInstaller {

    @Override
    protected UpdateParameters updateParameters(final UpdateContext uc)
    throws Exception {

        final CargoContext ccc = new CargoContext(new URI(uc.currentLocation()));
        final File cpath = ccc.deployablePath();

        final CargoContext ucc = new CargoContext(new URI(uc.updateLocation()));
        final File upath = ucc.deployablePath();

        class ResolvedDescriptor implements UpdateParameters {

            @Override public File currentPath() { return cpath; }

            @Override public Transaction undeploymentTransaction() {
                return ccc.undeploymentTransaction();
            }

            @Override public File updatePath() { return upath; }

            @Override public Transaction deploymentTransaction() {
                return ucc.deploymentTransaction();
            }
        } // ResolvedDescriptor

        return new ResolvedDescriptor();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy