-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from keeps/bf-beta7.3-dev
version 2.0.0, release candidate 1
- Loading branch information
Showing
36 changed files
with
482 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
dbptk-model/src/main/java/com/databasepreservation/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.databasepreservation; | ||
|
||
/** | ||
* @author Bruno Ferreira <bferreira@keep.pt> | ||
*/ | ||
public class Constants { | ||
public static final String VERSION_INFO_FILE = "dbptk-version.json"; | ||
|
||
public static final String PROPERTY_KEY_HOME = "dbptk.home"; | ||
|
||
public static final String DEFAULT_HOME_DIRECTORY = "./dbptk"; | ||
|
||
public static final String SUBDIRECTORY_LOG = "log"; | ||
public static final String LOGBACK_FILE_NAME = "logback_manual.xml"; | ||
|
||
public static final String SUBDIRECTORY_MODULES = "modules"; | ||
|
||
public static final String SUBDIRECTORY_REPORTS = "reports"; | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
dbptk-model/src/main/java/com/databasepreservation/common/ModuleObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.databasepreservation.common; | ||
|
||
import com.databasepreservation.model.structure.DatabaseStructure; | ||
import com.databasepreservation.model.structure.SchemaStructure; | ||
import com.databasepreservation.model.structure.TableStructure; | ||
|
||
/** | ||
* Receives notifications about changes in modules | ||
* | ||
* @author Bruno Ferreira <bferreira@keep.pt> | ||
*/ | ||
public interface ModuleObserver { | ||
void notifyOpenDatabase(); | ||
|
||
void notifyStructureObtained(DatabaseStructure structure); | ||
|
||
void notifyOpenSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas, | ||
long completedTablesInSchema); | ||
|
||
void notifyOpenTable(DatabaseStructure structure, TableStructure table, long completedSchemas, | ||
long completedTablesInSchema); | ||
|
||
/** | ||
* Notify about progress in converting a table. Delta between 2 reports may be | ||
* more than a single row. | ||
*/ | ||
void notifyTableProgress(DatabaseStructure structure, TableStructure table, long completedRows, long totalRows); | ||
|
||
void notifyCloseTable(DatabaseStructure structure, TableStructure table, long completedSchemas, | ||
long completedTablesInSchema); | ||
|
||
void notifyCloseSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas, | ||
long completedTablesInSchema); | ||
|
||
void notifyCloseDatabase(DatabaseStructure structure); | ||
} |
91 changes: 91 additions & 0 deletions
91
dbptk-model/src/main/java/com/databasepreservation/common/ObservableModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package com.databasepreservation.common; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.databasepreservation.model.structure.DatabaseStructure; | ||
import com.databasepreservation.model.structure.SchemaStructure; | ||
import com.databasepreservation.model.structure.TableStructure; | ||
|
||
/** | ||
* Updates ModuleObservers about conversion events (e.g. progress) | ||
* | ||
* @author Bruno Ferreira <bferreira@keep.pt> | ||
*/ | ||
public abstract class ObservableModule { | ||
private final List<ModuleObserver> observers; | ||
|
||
public ObservableModule() { | ||
super(); | ||
this.observers = new ArrayList<>(); | ||
} | ||
|
||
public void addModuleObserver(ModuleObserver observer) { | ||
observers.add(observer); | ||
} | ||
|
||
public void removeModuleObserver(ModuleObserver observer) { | ||
observers.remove(observer); | ||
} | ||
|
||
/************************************************************************** | ||
* Events notification | ||
*/ | ||
|
||
public void notifyOpenDatabase() { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyOpenDatabase(); | ||
} | ||
} | ||
|
||
public void notifyStructureObtained(DatabaseStructure structure) { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyStructureObtained(structure); | ||
} | ||
} | ||
|
||
public void notifyOpenSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas, | ||
long completedTablesInSchema) { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyOpenSchema(structure, schema, completedSchemas, completedTablesInSchema); | ||
} | ||
} | ||
|
||
public void notifyOpenTable(DatabaseStructure structure, TableStructure table, long completedSchemas, | ||
long completedTablesInSchema) { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyOpenTable(structure, table, completedSchemas, completedTablesInSchema); | ||
} | ||
} | ||
|
||
/** | ||
* Notify about progress in converting a table. Delta between 2 reports may be | ||
* more than a single row. | ||
*/ | ||
public void notifyTableProgress(DatabaseStructure structure, TableStructure table, long completedRows, long totalRows) { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyTableProgress(structure, table, completedRows, totalRows); | ||
} | ||
} | ||
|
||
public void notifyCloseTable(DatabaseStructure structure, TableStructure table, long completedSchemas, | ||
long completedTablesInSchema) { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyCloseTable(structure, table, completedSchemas, completedTablesInSchema); | ||
} | ||
} | ||
|
||
public void notifyCloseSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas, | ||
long completedTablesInSchema) { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyCloseSchema(structure, schema, completedSchemas, completedTablesInSchema); | ||
} | ||
} | ||
|
||
public void notifyCloseDatabase(DatabaseStructure structure) { | ||
for (ModuleObserver observer : observers) { | ||
observer.notifyCloseDatabase(structure); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.