• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #174

pending completion
#174

push

github-actions

web-flow
Add schedules API (#1776)

Add schedules API

1143 of 1143 new or added lines in 35 files covered. (100.0%)

18101 of 23284 relevant lines covered (77.74%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/temporal-sdk/src/main/java/io/temporal/client/schedules/ScheduleClientOptions.java
1
/*
2
 * Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved.
3
 *
4
 * Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
 *
6
 * Modifications copyright (C) 2017 Uber Technologies, Inc.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this material except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *   http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20

21
package io.temporal.client.schedules;
22

23
import io.temporal.common.context.ContextPropagator;
24
import io.temporal.common.converter.DataConverter;
25
import io.temporal.common.converter.GlobalDataConverter;
26
import java.lang.management.ManagementFactory;
27
import java.util.Collections;
28
import java.util.List;
29

30
/** Options for ScheduleClient configuration. */
31
public final class ScheduleClientOptions {
32

33
  public static ScheduleClientOptions.Builder newBuilder() {
34
    return new ScheduleClientOptions.Builder();
×
35
  }
36

37
  public static ScheduleClientOptions.Builder newBuilder(ScheduleClientOptions options) {
38
    return new ScheduleClientOptions.Builder(options);
×
39
  }
40

41
  public static ScheduleClientOptions getDefaultInstance() {
42
    return DEFAULT_INSTANCE;
×
43
  }
44

45
  public ScheduleClientOptions.Builder toBuilder() {
46
    return new ScheduleClientOptions.Builder(this);
×
47
  }
48

49
  private static final ScheduleClientOptions DEFAULT_INSTANCE;
50

51
  static {
52
    DEFAULT_INSTANCE = ScheduleClientOptions.newBuilder().build();
×
53
  }
×
54

55
  public static final class Builder {
56
    private static final String DEFAULT_NAMESPACE = "default";
57
    private static final List<ContextPropagator> EMPTY_CONTEXT_PROPAGATORS =
×
58
        Collections.emptyList();
×
59

60
    private String namespace;
61
    private DataConverter dataConverter;
62
    private String identity;
63
    private List<ContextPropagator> contextPropagators;
64

65
    private Builder() {}
66

67
    private Builder(ScheduleClientOptions options) {
×
68
      if (options == null) {
×
69
        return;
×
70
      }
71
      namespace = options.namespace;
×
72
      dataConverter = options.dataConverter;
×
73
      identity = options.identity;
×
74
      contextPropagators = options.contextPropagators;
×
75
    }
×
76

77
    /** Set the namespace this client will operate on. */
78
    public Builder setNamespace(String namespace) {
79
      this.namespace = namespace;
×
80
      return this;
×
81
    }
82

83
    /**
84
     * Overrides a data converter implementation used serialize workflow arguments and results.
85
     *
86
     * <p>Default is {@link DataConverter#getDefaultInstance()}.
87
     */
88
    public Builder setDataConverter(DataConverter dataConverter) {
89
      this.dataConverter = dataConverter;
×
90
      return this;
×
91
    }
92

93
    /** Override human-readable identity of the client. */
94
    public Builder setIdentity(String identity) {
95
      this.identity = identity;
×
96
      return this;
×
97
    }
98

99
    /**
100
     * Set the context propagators for this client.
101
     *
102
     * @param contextPropagators specifies the list of context propagators to use with the client.
103
     */
104
    public Builder setContextPropagators(List<ContextPropagator> contextPropagators) {
105
      this.contextPropagators = contextPropagators;
×
106
      return this;
×
107
    }
108

109
    public ScheduleClientOptions build() {
110
      String name = identity == null ? ManagementFactory.getRuntimeMXBean().getName() : identity;
×
111
      return new ScheduleClientOptions(
×
112
          namespace == null ? DEFAULT_NAMESPACE : namespace,
×
113
          dataConverter == null ? GlobalDataConverter.get() : dataConverter,
×
114
          name,
115
          contextPropagators == null ? EMPTY_CONTEXT_PROPAGATORS : contextPropagators);
×
116
    }
117
  }
118

119
  private final String namespace;
120
  private final DataConverter dataConverter;
121
  private final String identity;
122
  private final List<ContextPropagator> contextPropagators;
123

124
  private ScheduleClientOptions(
125
      String namespace,
126
      DataConverter dataConverter,
127
      String identity,
128
      List<ContextPropagator> contextPropagators) {
×
129
    this.namespace = namespace;
×
130
    this.dataConverter = dataConverter;
×
131
    this.identity = identity;
×
132
    this.contextPropagators = contextPropagators;
×
133
  }
×
134

135
  /**
136
   * Get the namespace this client will operate on.
137
   *
138
   * @return Client namespace
139
   */
140
  public String getNamespace() {
141
    return namespace;
×
142
  }
143

144
  /**
145
   * Get the data converters of this client
146
   *
147
   * @return The list of data converters to use with the client.
148
   */
149
  public DataConverter getDataConverter() {
150
    return dataConverter;
×
151
  }
152

153
  /**
154
   * Get the human-readable identity of the client.
155
   *
156
   * @return The identity of the client used on some requests.
157
   */
158
  public String getIdentity() {
159
    return identity;
×
160
  }
161

162
  /**
163
   * Get the context propagators of this client
164
   *
165
   * @return The list of context propagators to use with the client.
166
   */
167
  public List<ContextPropagator> getContextPropagators() {
168
    return contextPropagators;
×
169
  }
170
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc