use of org.openremote.manager.persistence.ManagerPersistenceService in project openremote by openremote.
the class Main method main.
public static void main(String[] args) throws Exception {
List<ContainerService> services = new ArrayList<ContainerService>() {
{
addAll(Arrays.asList(new TimerService(), new ManagerExecutorService(), new I18NService(), new ManagerPersistenceService(), new MessageBrokerSetupService(), new ManagerIdentityService(), new SetupService(), new ClientEventService(), new RulesetStorageService(), new RulesService(), new AssetStorageService(), new AssetDatapointService(), new AssetAttributeLinkingService(), new AssetProcessingService(), new MessageBrokerService()));
ServiceLoader.load(Protocol.class).forEach(this::add);
addAll(Arrays.asList(new AgentService(), new SimulatorService(), new MapService(), new NotificationService(), new ConsoleAppService(), new ManagerWebService()));
}
};
new Container(services).startBackground();
}
use of org.openremote.manager.persistence.ManagerPersistenceService in project openremote by openremote.
the class SchemaExporter method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
throw new IllegalArgumentException("Missing target file path argument");
}
File schemaFile = new File(args[0]);
Container container = new Container(new ManagerExecutorService(), new ManagerPersistenceService() {
@Override
protected void openDatabase(Container container, Database database) {
// Ignore, we don't want to connect to the database when exporting schema
}
@Override
public void start(Container container) throws Exception {
Map<String, Object> createSchemaProperties = new HashMap<>(persistenceUnitProperties);
createSchemaProperties.put("javax.persistence.schema-generation.scripts.action", "create");
createSchemaProperties.put("javax.persistence.schema-generation.scripts.create-target", schemaFile.getAbsolutePath());
if (schemaFile.exists()) {
LOG.info("Deleting existing schema file: " + schemaFile.getAbsolutePath());
schemaFile.delete();
}
LOG.info("Exporting database schema for persistence unit: " + persistenceUnitName);
Persistence.generateSchema(persistenceUnitName, createSchemaProperties);
LOG.fine("Schema export complete: " + schemaFile.getAbsolutePath());
}
});
container.start();
}
Aggregations