summaryrefslogtreecommitdiffstats
path: root/config-application-package/src/main/java/com/yahoo/config/model/application/provider/DeployData.java
blob: 344035745f83eeb47cbae8dd815dee2e0383768c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.application.provider;

import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.TenantName;

/**
 * Data generated or computed during deployment
 *
 * @author hmusum
 */
public class DeployData {

    /** Which user deployed */
    private final String deployedByUser;

    private final ApplicationId applicationId;

    /** The absolute path to the directory holding the application */
    private final String deployedFromDir;

    /** Timestamp when a deployment was made */
    private final long deployTimestamp;

    /** Whether this is an internal redeploy, not caused by an application package change */
    private final boolean internalRedeploy;

    /* Application generation. Incremented by one each time an application is deployed. */
    private final long generation;
    private final long currentlyActiveGeneration;

    // TODO: Remove after September 2019
    public DeployData(String deployedByUser,
                      String deployedFromDir,
                      String applicationName,
                      Long deployTimestamp,
                      boolean internalRedeploy,
                      Long generation,
                      long currentlyActiveGeneration) {
        this(deployedByUser,
             deployedFromDir,
             ApplicationId.from(TenantName.defaultName(), ApplicationName.from(applicationName), InstanceName.from("default")),
             deployTimestamp,
             internalRedeploy,
             generation, currentlyActiveGeneration);
    }

    public DeployData(String deployedByUser,
                      String deployedFromDir,
                      ApplicationId applicationId,
                      Long deployTimestamp,
                      boolean internalRedeploy,
                      Long generation,
                      long currentlyActiveGeneration) {
        this.deployedByUser = deployedByUser;
        this.deployedFromDir = deployedFromDir;
        this.applicationId = applicationId;
        this.deployTimestamp = deployTimestamp;
        this.internalRedeploy = internalRedeploy;
        this.generation = generation;
        this.currentlyActiveGeneration = currentlyActiveGeneration;
    }

    public String getDeployedByUser() { return deployedByUser; }

    public String getDeployedFromDir() { return deployedFromDir; }

    public long getDeployTimestamp() { return deployTimestamp; }

    public boolean isInternalRedeploy() { return internalRedeploy; }

    public long getGeneration() { return generation; }

    public long getCurrentlyActiveGeneration() { return currentlyActiveGeneration; }

    public ApplicationId getApplicationId() { return applicationId; }

    // TODO: remove after September 2019
    public String getApplicationName() { return applicationId.application().toString(); }

}