Search in sources :

Example 1 with FilesystemCasStore

use of org.platformlayer.ops.cas.filesystem.FilesystemCasStore in project platformlayer by platformlayer.

the class OpsCasObjectBase method copyTo.

@Override
public void copyTo(CasTarget destTarget, File destPath, CasStore stagingStore) throws OpsException {
    CasLocation srcLocation = getLocation();
    CasLocation destLocation = destTarget.getLocation();
    int distance = srcLocation.estimateDistance(destLocation);
    log.info("Estimated distance from " + srcLocation + " to " + destLocation + " => " + distance);
    if (distance == 0) {
        log.info("Distance was zero; copying directly");
        this.copyTo0(OpsCasTarget.getTarget(destTarget), destPath);
        return;
    }
    if (stagingStore != null) {
        log.info("Staging object " + this + " to " + stagingStore);
        FilesystemCasObject staged = ((FilesystemCasStore) stagingStore).copyToStaging(this);
        staged.copyTo(destTarget, destPath, null);
    } else {
        log.info("Copying object from " + this + " to " + destTarget);
        this.copyTo0(OpsCasTarget.getTarget(destTarget), destPath);
    }
}
Also used : FilesystemCasStore(org.platformlayer.ops.cas.filesystem.FilesystemCasStore) FilesystemCasObject(org.platformlayer.ops.cas.filesystem.FilesystemCasObject) CasLocation(org.platformlayer.cas.CasLocation)

Example 2 with FilesystemCasStore

use of org.platformlayer.ops.cas.filesystem.FilesystemCasStore in project platformlayer by platformlayer.

the class DirectHostController method getCasStore.

@Override
public CasStore getCasStore() throws OpsException {
    // TODO: Getting the IP like this is evil
    NetworkPoint targetAddress;
    // if (host.getIpv6() != null) {
    // IpRange ipv6Range = IpV6Range.parse(host.getIpv6());
    // targetAddress = NetworkPoint.forPublicHostname(ipv6Range.getGatewayAddress());
    // } else {
    targetAddress = NetworkPoint.forPublicHostname(model.host);
    // }
    Machine machine = new OpaqueMachine(targetAddress);
    OpsTarget machineTarget = machine.getTarget(sshKeys.findOtherServiceKey(new ServiceType("machines-direct")));
    CasStoreInfo casStoreOptions = new CasStoreInfo(true);
    FilesystemCasStore store = new FilesystemCasStore(casStoreOptions, new OpsCasTarget(machineTarget));
    return store;
}
Also used : CasStoreInfo(org.platformlayer.cas.CasStoreInfo) OpsTarget(org.platformlayer.ops.OpsTarget) FilesystemCasStore(org.platformlayer.ops.cas.filesystem.FilesystemCasStore) ServiceType(org.platformlayer.ids.ServiceType) OpaqueMachine(org.platformlayer.ops.OpaqueMachine) OpsCasTarget(org.platformlayer.ops.cas.OpsCasTarget) NetworkPoint(org.platformlayer.ops.networks.NetworkPoint) Machine(org.platformlayer.ops.Machine) OpaqueMachine(org.platformlayer.ops.OpaqueMachine)

Example 3 with FilesystemCasStore

use of org.platformlayer.ops.cas.filesystem.FilesystemCasStore in project platformlayer by platformlayer.

the class CasStoreHelper method getCasStoreMap.

public CasStoreMap getCasStoreMap(OpsTarget target) throws OpsException {
    // TODO: Reintroduce (some) caching?
    // if (this.casStores == null) {
    CasStoreMap casStores = new CasStoreMap();
    FilesystemCasStore filesystemCasStore = new FilesystemCasStore(new CasStoreInfo(false), new OpsCasTarget(target));
    casStores.addPrimary(filesystemCasStore);
    // TODO: Don't hard-code
    casStores.addSecondary(buildJenkins("http://192.168.131.14:8080/"));
    for (ProviderOf<CasStoreProvider> casStoreProvider : providers.listItemsProviding(CasStoreProvider.class)) {
        CasStore casStore = casStoreProvider.get().getCasStore();
        casStores.addSecondary(casStore);
        if (casStore.getOptions().isStaging()) {
            // Use this as a staging store i.e. we can upload files to here instead of to the VM
            casStores.addStagingStore(casStore);
        }
    }
    // }
    return casStores;
}
Also used : CasStoreMap(org.platformlayer.cas.CasStoreMap) CasStoreInfo(org.platformlayer.cas.CasStoreInfo) FilesystemCasStore(org.platformlayer.ops.cas.filesystem.FilesystemCasStore) JenkinsCasStore(org.platformlayer.ops.cas.jenkins.JenkinsCasStore) CasStore(org.platformlayer.cas.CasStore) FilesystemCasStore(org.platformlayer.ops.cas.filesystem.FilesystemCasStore)

Aggregations

FilesystemCasStore (org.platformlayer.ops.cas.filesystem.FilesystemCasStore)3 CasStoreInfo (org.platformlayer.cas.CasStoreInfo)2 CasLocation (org.platformlayer.cas.CasLocation)1 CasStore (org.platformlayer.cas.CasStore)1 CasStoreMap (org.platformlayer.cas.CasStoreMap)1 ServiceType (org.platformlayer.ids.ServiceType)1 Machine (org.platformlayer.ops.Machine)1 OpaqueMachine (org.platformlayer.ops.OpaqueMachine)1 OpsTarget (org.platformlayer.ops.OpsTarget)1 OpsCasTarget (org.platformlayer.ops.cas.OpsCasTarget)1 FilesystemCasObject (org.platformlayer.ops.cas.filesystem.FilesystemCasObject)1 JenkinsCasStore (org.platformlayer.ops.cas.jenkins.JenkinsCasStore)1 NetworkPoint (org.platformlayer.ops.networks.NetworkPoint)1