Search in sources :

Example 6 with PathsType

use of org.voltdb.compiler.deploymentfile.PathsType in project voltdb by VoltDB.

the class CatalogUtil method updateRuntimeDeploymentPaths.

/**
     * Get a deployment view that represents what needs to be displayed to VMC, which
     * reflects the paths that are used by this cluster member and the actual number of
     * hosts that belong to this cluster whether or not it was elastically expanded
     * @param deployment
     * @return adjusted deployment
     */
public static DeploymentType updateRuntimeDeploymentPaths(DeploymentType deployment) {
    deployment = CatalogUtil.shallowClusterAndPathsClone(deployment);
    PathsType paths = deployment.getPaths();
    if (paths.getVoltdbroot() == null) {
        PathsType.Voltdbroot root = new PathsType.Voltdbroot();
        root.setPath(VoltDB.instance().getVoltDBRootPath());
        paths.setVoltdbroot(root);
    } else {
        paths.getVoltdbroot().setPath(VoltDB.instance().getVoltDBRootPath());
    }
    //snapshot
    if (paths.getSnapshots() == null) {
        PathsType.Snapshots snap = new PathsType.Snapshots();
        snap.setPath(VoltDB.instance().getSnapshotPath());
        paths.setSnapshots(snap);
    } else {
        paths.getSnapshots().setPath(VoltDB.instance().getSnapshotPath());
    }
    if (paths.getCommandlog() == null) {
        //cl
        PathsType.Commandlog cl = new PathsType.Commandlog();
        cl.setPath(VoltDB.instance().getCommandLogPath());
        paths.setCommandlog(cl);
    } else {
        paths.getCommandlog().setPath(VoltDB.instance().getCommandLogPath());
    }
    if (paths.getCommandlogsnapshot() == null) {
        //cl snap
        PathsType.Commandlogsnapshot clsnap = new PathsType.Commandlogsnapshot();
        clsnap.setPath(VoltDB.instance().getCommandLogSnapshotPath());
        paths.setCommandlogsnapshot(clsnap);
    } else {
        paths.getCommandlogsnapshot().setPath(VoltDB.instance().getCommandLogSnapshotPath());
    }
    if (paths.getExportoverflow() == null) {
        //export overflow
        PathsType.Exportoverflow exp = new PathsType.Exportoverflow();
        exp.setPath(VoltDB.instance().getExportOverflowPath());
        paths.setExportoverflow(exp);
    } else {
        paths.getExportoverflow().setPath(VoltDB.instance().getExportOverflowPath());
    }
    if (paths.getDroverflow() == null) {
        //dr overflow
        final PathsType.Droverflow droverflow = new PathsType.Droverflow();
        droverflow.setPath(VoltDB.instance().getDROverflowPath());
        paths.setDroverflow(droverflow);
    } else {
        paths.getDroverflow().setPath(VoltDB.instance().getDROverflowPath());
    }
    return deployment;
}
Also used : PathsType(org.voltdb.compiler.deploymentfile.PathsType)

Example 7 with PathsType

use of org.voltdb.compiler.deploymentfile.PathsType in project voltdb by VoltDB.

the class CatalogUtil method shallowClusterAndPathsClone.

/**
     * Creates a shallow clone of {@link DeploymentType} where all its
     * children references are copied except for {@link ClusterType}, and
     * {@link PathsType} which are newly instantiated
     * @param o
     * @return a shallow clone of {@link DeploymentType}
     */
public static DeploymentType shallowClusterAndPathsClone(DeploymentType o) {
    DeploymentType clone = new DeploymentType();
    clone.setPartitionDetection(o.getPartitionDetection());
    clone.setHeartbeat(o.getHeartbeat());
    clone.setHttpd(o.getHttpd());
    clone.setSnapshot(o.getSnapshot());
    clone.setExport(o.getExport());
    clone.setUsers(o.getUsers());
    clone.setCommandlog(o.getCommandlog());
    clone.setSystemsettings(o.getSystemsettings());
    clone.setSecurity(o.getSecurity());
    clone.setDr(o.getDr());
    clone.setImport(o.getImport());
    clone.setConsistency(o.getConsistency());
    ClusterType other = o.getCluster();
    ClusterType cluster = new ClusterType();
    cluster.setHostcount(other.getHostcount());
    cluster.setSitesperhost(other.getSitesperhost());
    cluster.setKfactor(other.getKfactor());
    cluster.setId(other.getId());
    cluster.setElastic(other.getElastic());
    cluster.setSchema(other.getSchema());
    clone.setCluster(cluster);
    PathsType prev = o.getPaths();
    PathsType paths = new PathsType();
    paths.setVoltdbroot(prev.getVoltdbroot());
    paths.setSnapshots(prev.getSnapshots());
    paths.setExportoverflow(prev.getExportoverflow());
    paths.setDroverflow(prev.getDroverflow());
    paths.setCommandlog(prev.getCommandlog());
    paths.setCommandlogsnapshot(prev.getCommandlogsnapshot());
    clone.setPaths(paths);
    clone.setSsl(o.getSsl());
    clone.setSnmp(o.getSnmp());
    return clone;
}
Also used : PathsType(org.voltdb.compiler.deploymentfile.PathsType) DeploymentType(org.voltdb.compiler.deploymentfile.DeploymentType) ClusterType(org.voltdb.compiler.deploymentfile.ClusterType)

Aggregations

PathsType (org.voltdb.compiler.deploymentfile.PathsType)7 ClusterType (org.voltdb.compiler.deploymentfile.ClusterType)3 CommandLogType (org.voltdb.compiler.deploymentfile.CommandLogType)3 DeploymentType (org.voltdb.compiler.deploymentfile.DeploymentType)3 HttpdType (org.voltdb.compiler.deploymentfile.HttpdType)3 PartitionDetectionType (org.voltdb.compiler.deploymentfile.PartitionDetectionType)3 SecurityType (org.voltdb.compiler.deploymentfile.SecurityType)3 SnapshotType (org.voltdb.compiler.deploymentfile.SnapshotType)3 SslType (org.voltdb.compiler.deploymentfile.SslType)3 ImmutableList (com.google_voltpatches.common.collect.ImmutableList)2 File (java.io.File)2 JAXBContext (javax.xml.bind.JAXBContext)2 Marshaller (javax.xml.bind.Marshaller)2 DrType (org.voltdb.compiler.deploymentfile.DrType)2 ExportType (org.voltdb.compiler.deploymentfile.ExportType)2 HeartbeatType (org.voltdb.compiler.deploymentfile.HeartbeatType)2 Jsonapi (org.voltdb.compiler.deploymentfile.HttpdType.Jsonapi)2 Voltdbroot (org.voltdb.compiler.deploymentfile.PathsType.Voltdbroot)2 SecurityProviderString (org.voltdb.compiler.deploymentfile.SecurityProviderString)2 SystemSettingsType (org.voltdb.compiler.deploymentfile.SystemSettingsType)2