Examples of BackupContext


Examples of org.platformlayer.ops.backups.BackupContext

    // 1) pg_dumpall doesn't support binary dumping (?)
    // 2) pg_dumpall wouldn't let us split the dump into different files (?)

    List<String> databases = listDatabases(target);

    BackupContext backupContext = backups.getContext();

    String baseName = UUID.randomUUID().toString();

    PostgresqlServer server = OpsContext.get().getInstance(PostgresqlServer.class);

    backupContext.add(new BackupItem(server.getKey(), FORMAT, baseName));

    {
      Command dumpAll = Command.build("su postgres -c \"pg_dumpall --globals-only\"");
      Backup request = new Backup();
      request.target = target;
      request.objectName = baseName + "/pgdump_meta";
      backupContext.uploadStream(request, dumpAll);
    }

    for (String database : databases) {
      // template0 cannot be backed up
      if (database.equals("template0")) {
        continue;
      }

      // template1 can be backed up, even though it isn't typically very useful

      String fileName = "pgdump_db_" + database;
      Backup request = new Backup();
      request.target = target;
      request.objectName = baseName + "/" + fileName;

      Command dumpDatabase = Command.build("su postgres -c \"pg_dump --oids -Fc --verbose {0}\"", database);
      backupContext.uploadStream(request, dumpDatabase);
    }
  }
View Full Code Here

Examples of org.platformlayer.ops.backups.BackupContext

            if (action instanceof DeleteAction) {
              newState = ManagedItemState.DELETED;
            }

            if (action instanceof BackupAction) {
              BackupContext backupContext = scope.getInstance(BackupContext.class);
              backupContext.writeDescriptor();
            }

            return newState;
          }

          private void addActionScopeItems(Action action, ItemBase item, List<Object> scopeItems)
              throws OpsException {
            if (action instanceof BackupAction) {
              // TODO: Don't hard-code this
              BackupHelpers backupHelpers = opsSystem.getInjector().getInstance(BackupHelpers.class);
              BackupContext backupContext = backupHelpers.createBackupContext(item);
              scopeItems.add(backupContext);
            }
          }
        });
      } catch (Throwable e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.