or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

configuration.mdconnectors.mdcore-functions.mddatastream-traditional.mddatastream-v2.mdindex.mdstate-management.mdtable-api.mdwindowing.md

configuration.mddocs/

0

# Configuration & Utilities

1

2

Configuration system and utility classes for program execution, memory management, parameter handling, and system integration.

3

4

## Capabilities

5

6

### Configuration System

7

8

Key-value configuration system for Flink applications.

9

10

```java { .api }

11

/**

12

* Key-value configuration container

13

*/

14

class Configuration {

15

/**

16

* Create empty configuration

17

*/

18

public Configuration();

19

20

/**

21

* Get configuration value

22

* @param option Configuration option

23

* @param <T> Value type

24

* @return Configuration value

25

*/

26

public <T> T get(ConfigOption<T> option);

27

28

/**

29

* Set configuration value

30

* @param option Configuration option

31

* @param value Value to set

32

* @param <T> Value type

33

*/

34

public <T> void set(ConfigOption<T> option, T value);

35

36

/**

37

* Set string value

38

* @param key Configuration key

39

* @param value String value

40

*/

41

public void setString(String key, String value);

42

43

/**

44

* Get string value

45

* @param key Configuration key

46

* @param defaultValue Default value

47

* @return String value

48

*/

49

public String getString(String key, String defaultValue);

50

51

/**

52

* Set integer value

53

* @param key Configuration key

54

* @param value Integer value

55

*/

56

public void setInteger(String key, int value);

57

58

/**

59

* Get integer value

60

* @param key Configuration key

61

* @param defaultValue Default value

62

* @return Integer value

63

*/

64

public int getInteger(String key, int defaultValue);

65

66

/**

67

* Set boolean value

68

* @param key Configuration key

69

* @param value Boolean value

70

*/

71

public void setBoolean(String key, boolean value);

72

73

/**

74

* Get boolean value

75

* @param key Configuration key

76

* @param defaultValue Default value

77

* @return Boolean value

78

*/

79

public boolean getBoolean(String key, boolean defaultValue);

80

81

/**

82

* Add all from other configuration

83

* @param other Other configuration

84

*/

85

public void addAll(Configuration other);

86

87

/**

88

* Check if key exists

89

* @param key Configuration key

90

* @return true if key exists

91

*/

92

public boolean containsKey(String key);

93

94

/**

95

* Get all keys

96

* @return Set of all keys

97

*/

98

public Set<String> keySet();

99

}

100

101

/**

102

* Configuration option with metadata

103

* @param <T> Option value type

104

*/

105

class ConfigOption<T> {

106

/**

107

* Get option key

108

* @return Option key

109

*/

110

public String key();

111

112

/**

113

* Get default value

114

* @return Default value

115

*/

116

public T defaultValue();

117

118

/**

119

* Check if option has default value

120

* @return true if has default

121

*/

122

public boolean hasDefaultValue();

123

124

/**

125

* Get option description

126

* @return Option description

127

*/

128

public String description();

129

}

130

131

/**

132

* Builder for configuration options

133

*/

134

class ConfigOptions {

135

/**

136

* Create string option key

137

* @param key Option key

138

* @return String option builder

139

*/

140

public static OptionBuilder key(String key);

141

142

/**

143

* Option builder

144

*/

145

public static class OptionBuilder {

146

/**

147

* Set option as string type

148

* @return String option builder

149

*/

150

public StringConfigOptionBuilder stringType();

151

152

/**

153

* Set option as integer type

154

* @return Integer option builder

155

*/

156

public IntConfigOptionBuilder intType();

157

158

/**

159

* Set option as boolean type

160

* @return Boolean option builder

161

*/

162

public BooleanConfigOptionBuilder booleanType();

163

164

/**

165

* Set option as long type

166

* @return Long option builder

167

*/

168

public LongConfigOptionBuilder longType();

169

170

/**

171

* Set option as duration type

172

* @return Duration option builder

173

*/

174

public DurationConfigOptionBuilder durationType();

175

176

/**

177

* Set option as memory size type

178

* @return Memory size option builder

179

*/

180

public MemorySizeConfigOptionBuilder memorySizeType();

181

}

182

}

183

```

184

185

### Memory Management

186

187

Utility classes for memory size specifications and management.

188

189

```java { .api }

190

/**

191

* Utility class for memory size specifications

192

*/

193

class MemorySize {

194

/**

195

* Parse memory size from string

196

* @param text Memory size text (e.g., "128mb", "1gb")

197

* @return MemorySize instance

198

*/

199

public static MemorySize parse(String text);

200

201

/**

202

* Create memory size from bytes

203

* @param bytes Number of bytes

204

* @return MemorySize instance

205

*/

206

public static MemorySize ofBytes(long bytes);

207

208

/**

209

* Create memory size from kilobytes

210

* @param kilobytes Number of kilobytes

211

* @return MemorySize instance

212

*/

213

public static MemorySize ofKibiBytes(long kilobytes);

214

215

/**

216

* Create memory size from megabytes

217

* @param megabytes Number of megabytes

218

* @return MemorySize instance

219

*/

220

public static MemorySize ofMebiBytes(long megabytes);

221

222

/**

223

* Create memory size from gigabytes

224

* @param gigabytes Number of gigabytes

225

* @return MemorySize instance

226

*/

227

public static MemorySize ofGibiBytes(long gigabytes);

228

229

/**

230

* Get size in bytes

231

* @return Size in bytes

232

*/

233

public long getBytes();

234

235

/**

236

* Get size in kilobytes

237

* @return Size in kilobytes

238

*/

239

public long getKibiBytes();

240

241

/**

242

* Get size in megabytes

243

* @return Size in megabytes

244

*/

245

public long getMebiBytes();

246

247

/**

248

* Get size in gigabytes

249

* @return Size in gigabytes

250

*/

251

public long getGibiBytes();

252

253

/**

254

* Add memory sizes

255

* @param other Other memory size

256

* @return Sum of memory sizes

257

*/

258

public MemorySize add(MemorySize other);

259

260

/**

261

* Subtract memory sizes

262

* @param other Other memory size

263

* @return Difference of memory sizes

264

*/

265

public MemorySize subtract(MemorySize other);

266

267

/**

268

* Multiply memory size

269

* @param multiplier Multiplier

270

* @return Multiplied memory size

271

*/

272

public MemorySize multiply(double multiplier);

273

274

/**

275

* Divide memory size

276

* @param divisor Divisor

277

* @return Divided memory size

278

*/

279

public MemorySize divide(long divisor);

280

}

281

```

282

283

### Parameter Utilities

284

285

Utility for handling command line parameters and program arguments.

286

287

```java { .api }

288

/**

289

* Utility for handling command line parameters

290

*/

291

class ParameterTool {

292

/**

293

* Create from program arguments

294

* @param args Program arguments

295

* @return ParameterTool instance

296

*/

297

public static ParameterTool fromArgs(String[] args);

298

299

/**

300

* Create from properties file

301

* @param file Properties file

302

* @return ParameterTool instance

303

* @throws IOException

304

*/

305

public static ParameterTool fromPropertiesFile(String file) throws IOException;

306

307

/**

308

* Create from properties file

309

* @param file Properties file

310

* @return ParameterTool instance

311

* @throws IOException

312

*/

313

public static ParameterTool fromPropertiesFile(File file) throws IOException;

314

315

/**

316

* Create from system properties

317

* @return ParameterTool instance

318

*/

319

public static ParameterTool fromSystemProperties();

320

321

/**

322

* Create from map

323

* @param map Parameter map

324

* @return ParameterTool instance

325

*/

326

public static ParameterTool fromMap(Map<String, String> map);

327

328

/**

329

* Get parameter value

330

* @param key Parameter key

331

* @return Parameter value or null

332

*/

333

public String get(String key);

334

335

/**

336

* Get parameter value with default

337

* @param key Parameter key

338

* @param defaultValue Default value

339

* @return Parameter value or default

340

*/

341

public String get(String key, String defaultValue);

342

343

/**

344

* Get required parameter

345

* @param key Parameter key

346

* @return Parameter value

347

* @throws RuntimeException if key not found

348

*/

349

public String getRequired(String key);

350

351

/**

352

* Get integer parameter

353

* @param key Parameter key

354

* @param defaultValue Default value

355

* @return Integer parameter value

356

*/

357

public int getInt(String key, int defaultValue);

358

359

/**

360

* Get long parameter

361

* @param key Parameter key

362

* @param defaultValue Default value

363

* @return Long parameter value

364

*/

365

public long getLong(String key, long defaultValue);

366

367

/**

368

* Get boolean parameter

369

* @param key Parameter key

370

* @param defaultValue Default value

371

* @return Boolean parameter value

372

*/

373

public boolean getBoolean(String key, boolean defaultValue);

374

375

/**

376

* Check if parameter exists

377

* @param key Parameter key

378

* @return true if parameter exists

379

*/

380

public boolean has(String key);

381

382

/**

383

* Get all parameters as properties

384

* @return Properties object

385

*/

386

public Properties getProperties();

387

388

/**

389

* Convert to configuration

390

* @return Configuration object

391

*/

392

public Configuration getConfiguration();

393

394

/**

395

* Merge with other parameter tool

396

* @param other Other parameter tool

397

* @return Merged parameter tool

398

*/

399

public ParameterTool mergeWith(ParameterTool other);

400

}

401

```

402

403

### File System Utilities

404

405

File system abstraction and utilities.

406

407

```java { .api }

408

/**

409

* Abstract file system for various backends

410

*/

411

abstract class FileSystem {

412

/**

413

* Get file system for path

414

* @param uri File system URI

415

* @return File system instance

416

* @throws IOException

417

*/

418

public static FileSystem get(URI uri) throws IOException;

419

420

/**

421

* Get local file system

422

* @return Local file system

423

* @throws IOException

424

*/

425

public static FileSystem getLocalFileSystem() throws IOException;

426

427

/**

428

* Open file for reading

429

* @param f File path

430

* @return Input stream

431

* @throws IOException

432

*/

433

public abstract FSDataInputStream open(Path f) throws IOException;

434

435

/**

436

* Create file for writing

437

* @param f File path

438

* @param overwrite Whether to overwrite existing file

439

* @return Output stream

440

* @throws IOException

441

*/

442

public abstract FSDataOutputStream create(Path f, boolean overwrite) throws IOException;

443

444

/**

445

* Delete file or directory

446

* @param path Path to delete

447

* @param recursive Whether to delete recursively

448

* @return true if successfully deleted

449

* @throws IOException

450

*/

451

public abstract boolean delete(Path path, boolean recursive) throws IOException;

452

453

/**

454

* List files in directory

455

* @param path Directory path

456

* @return Array of file statuses

457

* @throws IOException

458

*/

459

public abstract FileStatus[] listStatus(Path path) throws IOException;

460

461

/**

462

* Get file status

463

* @param path File path

464

* @return File status

465

* @throws IOException

466

*/

467

public abstract FileStatus getFileStatus(Path path) throws IOException;

468

469

/**

470

* Check if path exists

471

* @param path Path to check

472

* @return true if exists

473

* @throws IOException

474

*/

475

public boolean exists(Path path) throws IOException;

476

477

/**

478

* Create directory

479

* @param path Directory path

480

* @return true if created

481

* @throws IOException

482

*/

483

public abstract boolean mkdirs(Path path) throws IOException;

484

}

485

486

/**

487

* File path representation

488

*/

489

class Path {

490

/**

491

* Create path from string

492

* @param pathString Path string

493

*/

494

public Path(String pathString);

495

496

/**

497

* Create path from URI

498

* @param uri Path URI

499

*/

500

public Path(URI uri);

501

502

/**

503

* Create path with parent

504

* @param parent Parent path

505

* @param child Child path

506

*/

507

public Path(Path parent, String child);

508

509

/**

510

* Get path name

511

* @return Path name

512

*/

513

public String getName();

514

515

/**

516

* Get parent path

517

* @return Parent path

518

*/

519

public Path getParent();

520

521

/**

522

* Get path suffix

523

* @param suffix Suffix to add

524

* @return Path with suffix

525

*/

526

public Path suffix(String suffix);

527

528

/**

529

* Convert to URI

530

* @return Path URI

531

*/

532

public URI toUri();

533

534

/**

535

* Get path string

536

* @return Path string

537

*/

538

public String getPath();

539

540

/**

541

* Check if path is absolute

542

* @return true if absolute

543

*/

544

public boolean isAbsolute();

545

}

546

```

547

548

### Time Utilities

549

550

Time-related utility classes and duration handling.

551

552

```java { .api }

553

/**

554

* Time utility class

555

*/

556

class Time {

557

/**

558

* Create time from milliseconds

559

* @param milliseconds Milliseconds

560

* @return Time instance

561

*/

562

public static Time milliseconds(long milliseconds);

563

564

/**

565

* Create time from seconds

566

* @param seconds Seconds

567

* @return Time instance

568

*/

569

public static Time seconds(long seconds);

570

571

/**

572

* Create time from minutes

573

* @param minutes Minutes

574

* @return Time instance

575

*/

576

public static Time minutes(long minutes);

577

578

/**

579

* Create time from hours

580

* @param hours Hours

581

* @return Time instance

582

*/

583

public static Time hours(long hours);

584

585

/**

586

* Create time from days

587

* @param days Days

588

* @return Time instance

589

*/

590

public static Time days(long days);

591

592

/**

593

* Get time in milliseconds

594

* @return Milliseconds

595

*/

596

public long toMilliseconds();

597

598

/**

599

* Get time size

600

* @return Time size

601

*/

602

public long getSize();

603

604

/**

605

* Get time unit

606

* @return Time unit

607

*/

608

public TimeUnit getUnit();

609

}

610

```