1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.linecorp.centraldogma.server.mirror;
18
19 import static java.util.Objects.requireNonNull;
20
21 import java.net.URI;
22
23 import javax.annotation.Nullable;
24
25 import com.cronutils.model.Cron;
26 import com.google.common.base.MoreObjects;
27
28 import com.linecorp.centraldogma.server.storage.repository.Repository;
29
30
31
32
33 public final class MirrorContext {
34
35 private final Cron schedule;
36 private final MirrorDirection direction;
37 private final MirrorCredential credential;
38 private final Repository localRepo;
39 private final String localPath;
40 private final URI remoteUri;
41 @Nullable
42 private final String gitignore;
43
44
45
46
47 public MirrorContext(Cron schedule, MirrorDirection direction, MirrorCredential credential,
48 Repository localRepo, String localPath, URI remoteUri, @Nullable String gitignore) {
49 this.schedule = requireNonNull(schedule, "schedule");
50 this.direction = requireNonNull(direction, "direction");
51 this.credential = requireNonNull(credential, "credential");
52 this.localRepo = requireNonNull(localRepo, "localRepo");
53 this.localPath = requireNonNull(localPath, "localPath");
54 this.remoteUri = requireNonNull(remoteUri, "remoteUri");
55 this.gitignore = gitignore;
56 }
57
58
59
60
61 public Cron schedule() {
62 return schedule;
63 }
64
65
66
67
68 public MirrorDirection direction() {
69 return direction;
70 }
71
72
73
74
75 public MirrorCredential credential() {
76 return credential;
77 }
78
79
80
81
82 public Repository localRepo() {
83 return localRepo;
84 }
85
86
87
88
89 public String localPath() {
90 return localPath;
91 }
92
93
94
95
96 public URI remoteUri() {
97 return remoteUri;
98 }
99
100
101
102
103 @Nullable
104 public String gitignore() {
105 return gitignore;
106 }
107
108 @Override
109 public String toString() {
110 return MoreObjects.toStringHelper(this).omitNullValues()
111 .add("schedule", schedule)
112 .add("direction", direction)
113 .add("credential", credential)
114 .add("localRepo", localRepo)
115 .add("localPath", localPath)
116 .add("remoteUri", remoteUri)
117 .add("gitignore", gitignore)
118 .toString();
119 }
120 }