Skip to content

Commit 73863ff

Browse files
committed
Add old methods for backward compatibility
1 parent 5a45200 commit 73863ff

File tree

2 files changed

+876
-0
lines changed

2 files changed

+876
-0
lines changed

schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoader.java

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,272 @@ private static void repairAll(
453453
}
454454
}
455455

456+
// For backward compatibility.
457+
458+
/**
459+
* Creates tables defined in the schema file. See {@link #load(Properties, Path, Map, boolean,
460+
* boolean)} for details.
461+
*
462+
* @param configProperties ScalarDB config properties.
463+
* @param schemaFilePath path to schema file.
464+
* @param options specific options for creating tables.
465+
* @param createCoordinatorTables create coordinator tables or not.
466+
* @throws SchemaLoaderException thrown when creating tables fails.
467+
*/
468+
public static void load(
469+
Properties configProperties,
470+
@Nullable Path schemaFilePath,
471+
Map<String, String> options,
472+
boolean createCoordinatorTables)
473+
throws SchemaLoaderException {
474+
load(configProperties, schemaFilePath, options, createCoordinatorTables, false);
475+
}
476+
477+
/**
478+
* Creates tables defined in the schema file. See {@link #load(Path, Path, Map, boolean, boolean)}
479+
* for details.
480+
*
481+
* @param configFilePath path to ScalarDB config file.
482+
* @param schemaFilePath path to schema file.
483+
* @param options specific options for creating tables.
484+
* @param createCoordinatorTables create coordinator tables or not.
485+
* @throws SchemaLoaderException thrown when creating tables fails.
486+
*/
487+
public static void load(
488+
Path configFilePath,
489+
@Nullable Path schemaFilePath,
490+
Map<String, String> options,
491+
boolean createCoordinatorTables)
492+
throws SchemaLoaderException {
493+
load(configFilePath, schemaFilePath, options, createCoordinatorTables, false);
494+
}
495+
496+
/**
497+
* Creates tables defined in the schema. See {@link #load(Properties, String, Map, boolean,
498+
* boolean)} for details.
499+
*
500+
* @param configProperties ScalarDB config properties.
501+
* @param serializedSchemaJson serialized json string schema.
502+
* @param options specific options for creating tables.
503+
* @param createCoordinatorTables create coordinator tables or not.
504+
* @throws SchemaLoaderException thrown when creating tables fails.
505+
*/
506+
public static void load(
507+
Properties configProperties,
508+
@Nullable String serializedSchemaJson,
509+
Map<String, String> options,
510+
boolean createCoordinatorTables)
511+
throws SchemaLoaderException {
512+
load(configProperties, serializedSchemaJson, options, createCoordinatorTables, false);
513+
}
514+
515+
/**
516+
* Creates tables defined in the schema. See {@link #load(Path, String, Map, boolean, boolean)}
517+
* for details.
518+
*
519+
* @param configFilePath path to ScalarDB config file.
520+
* @param serializedSchemaJson serialized json string schema.
521+
* @param options specific options for creating tables.
522+
* @param createCoordinatorTables create coordinator tables or not.
523+
* @throws SchemaLoaderException thrown when creating tables fails.
524+
*/
525+
public static void load(
526+
Path configFilePath,
527+
@Nullable String serializedSchemaJson,
528+
Map<String, String> options,
529+
boolean createCoordinatorTables)
530+
throws SchemaLoaderException {
531+
load(configFilePath, serializedSchemaJson, options, createCoordinatorTables, false);
532+
}
533+
534+
/**
535+
* Creates tables defined in the schema file. See {@link #load(Either, Either, Map, boolean,
536+
* boolean)} for details.
537+
*
538+
* @param config ScalarDB config.
539+
* @param schema schema definition.
540+
* @param options specific options for creating tables.
541+
* @param createCoordinatorTables create coordinator tables or not.
542+
* @throws SchemaLoaderException thrown when creating tables fails.
543+
*/
544+
private static void load(
545+
Either<Path, Properties> config,
546+
Either<Path, String> schema,
547+
Map<String, String> options,
548+
boolean createCoordinatorTables)
549+
throws SchemaLoaderException {
550+
load(config, schema, options, createCoordinatorTables, false);
551+
}
552+
553+
/**
554+
* Delete tables defined in the schema file. See {@link #unload(Properties, Path, boolean,
555+
* boolean)} for details.
556+
*
557+
* @param configProperties ScalarDB config properties.
558+
* @param schemaFilePath path to schema file.
559+
* @param deleteCoordinatorTables delete coordinator tables or not.
560+
* @throws SchemaLoaderException thrown when deleting tables fails.
561+
*/
562+
public static void unload(
563+
Properties configProperties, @Nullable Path schemaFilePath, boolean deleteCoordinatorTables)
564+
throws SchemaLoaderException {
565+
unload(configProperties, schemaFilePath, deleteCoordinatorTables, false);
566+
}
567+
568+
/**
569+
* Delete tables defined in the schema file. See {@link #unload(Path, Path, boolean, boolean)} for
570+
* details.
571+
*
572+
* @param configFilePath path to ScalarDB config file.
573+
* @param schemaFilePath path to schema file.
574+
* @param deleteCoordinatorTables delete coordinator tables or not.
575+
* @throws SchemaLoaderException thrown when deleting tables fails.
576+
*/
577+
public static void unload(
578+
Path configFilePath, @Nullable Path schemaFilePath, boolean deleteCoordinatorTables)
579+
throws SchemaLoaderException {
580+
unload(configFilePath, schemaFilePath, deleteCoordinatorTables, false);
581+
}
582+
583+
/**
584+
* Delete tables defined in the schema. See {@link #unload(Properties, String, boolean, boolean)}
585+
* for details.
586+
*
587+
* @param configProperties ScalarDB config properties.
588+
* @param serializedSchemaJson serialized json string schema.
589+
* @param deleteCoordinatorTables delete coordinator tables or not.
590+
* @throws SchemaLoaderException thrown when deleting tables fails.
591+
*/
592+
public static void unload(
593+
Properties configProperties,
594+
@Nullable String serializedSchemaJson,
595+
boolean deleteCoordinatorTables)
596+
throws SchemaLoaderException {
597+
unload(configProperties, serializedSchemaJson, deleteCoordinatorTables, false);
598+
}
599+
600+
/**
601+
* Delete tables defined in the schema. See {@link #unload(Path, String, boolean, boolean)} for
602+
* details.
603+
*
604+
* @param configFilePath path to ScalarDB config file.
605+
* @param serializedSchemaJson serialized json string schema.
606+
* @param deleteCoordinatorTables delete coordinator tables or not.
607+
* @throws SchemaLoaderException thrown when deleting tables fails.
608+
*/
609+
public static void unload(
610+
Path configFilePath, @Nullable String serializedSchemaJson, boolean deleteCoordinatorTables)
611+
throws SchemaLoaderException {
612+
unload(configFilePath, serializedSchemaJson, deleteCoordinatorTables, false);
613+
}
614+
615+
/**
616+
* Delete tables defined in the schema. See {@link #unload(Either, Either, boolean, boolean)} for
617+
* details.
618+
*
619+
* @param config ScalarDB config.
620+
* @param schema schema definition.
621+
* @param deleteCoordinatorTables delete coordinator tables or not.
622+
* @throws SchemaLoaderException thrown when deleting tables fails.
623+
*/
624+
private static void unload(
625+
Either<Path, Properties> config, Either<Path, String> schema, boolean deleteCoordinatorTables)
626+
throws SchemaLoaderException {
627+
unload(config, schema, deleteCoordinatorTables, false);
628+
}
629+
630+
/**
631+
* Repair namespaces and tables. See {@link #repairAll(Properties, String, Map, boolean, boolean)}
632+
* for details.
633+
*
634+
* @param configProperties ScalarDB config properties
635+
* @param serializedSchemaJson serialized json string schema.
636+
* @param options specific options for repairing.
637+
* @param repairCoordinatorTable repair coordinator tables or not.
638+
* @throws SchemaLoaderException thrown when repairing fails.
639+
*/
640+
public static void repairAll(
641+
Properties configProperties,
642+
String serializedSchemaJson,
643+
Map<String, String> options,
644+
boolean repairCoordinatorTable)
645+
throws SchemaLoaderException {
646+
repairAll(configProperties, serializedSchemaJson, options, repairCoordinatorTable, false);
647+
}
648+
649+
/**
650+
* Repair namespaces and tables. See {@link #repairAll(Path, String, Map, boolean, boolean)} for
651+
* details.
652+
*
653+
* @param configProperties ScalarDB properties.
654+
* @param schemaPath path to the schema file.
655+
* @param options specific options for repairing.
656+
* @param repairCoordinatorTable repair coordinator tables or not.
657+
* @throws SchemaLoaderException thrown when repairing fails.
658+
*/
659+
public static void repairAll(
660+
Properties configProperties,
661+
Path schemaPath,
662+
Map<String, String> options,
663+
boolean repairCoordinatorTable)
664+
throws SchemaLoaderException {
665+
repairAll(configProperties, schemaPath, options, repairCoordinatorTable, false);
666+
}
667+
668+
/**
669+
* Repair namespaces and tables. See {@link #repairAll(Path, String, Map, boolean, boolean)} for
670+
* details.
671+
*
672+
* @param configPath path to the ScalarDB config.
673+
* @param serializedSchemaJson serialized json string schema.
674+
* @param options specific options for repairing.
675+
* @param repairCoordinatorTable repair coordinator tables or not.
676+
* @throws SchemaLoaderException thrown when repairing fails.
677+
*/
678+
public static void repairAll(
679+
Path configPath,
680+
String serializedSchemaJson,
681+
Map<String, String> options,
682+
boolean repairCoordinatorTable)
683+
throws SchemaLoaderException {
684+
repairAll(configPath, serializedSchemaJson, options, repairCoordinatorTable, false);
685+
}
686+
687+
/**
688+
* Repair namespaces and tables. See {@link #repairAll(Path, Path, Map, boolean, boolean)} for
689+
* details.
690+
*
691+
* @param configPath path to the ScalarDB config.
692+
* @param schemaPath path to the schema file.
693+
* @param options specific options for repairing.
694+
* @param repairCoordinatorTable repair coordinator tables or not.
695+
* @throws SchemaLoaderException thrown when repairing fails.
696+
*/
697+
public static void repairAll(
698+
Path configPath, Path schemaPath, Map<String, String> options, boolean repairCoordinatorTable)
699+
throws SchemaLoaderException {
700+
repairAll(configPath, schemaPath, options, repairCoordinatorTable, false);
701+
}
702+
703+
/**
704+
* Repair namespaces and tables. See {@link #repairAll(Either, Either, Map, boolean, boolean)} for
705+
* details.
706+
*
707+
* @param config ScalarDB config
708+
* @param schema schema.
709+
* @param options specific options for repairing.
710+
* @param repairCoordinatorTable repair coordinator tables or not.
711+
* @throws SchemaLoaderException thrown when repairing fails.
712+
*/
713+
private static void repairAll(
714+
Either<Path, Properties> config,
715+
Either<Path, String> schema,
716+
Map<String, String> options,
717+
boolean repairCoordinatorTable)
718+
throws SchemaLoaderException {
719+
repairAll(config, schema, options, repairCoordinatorTable, false);
720+
}
721+
456722
/**
457723
* Alter the tables defined in the schema. Supported alter operations are:
458724
*

0 commit comments

Comments
 (0)