Examples of Backup


Examples of co.paralleluniverse.galaxy.core.Message.BACKUP

                            final Channel channel = entry.getKey();
                            final Iterator<BACKUP> iter = entry.getValue();

                            for (int i = 0; i < 10; i++) {
                                if (iter.hasNext()) {
                                    final BACKUP backup = iter.next();
                                    LOG.debug("Replicating {} to channel {}", backup, channel);
                                    channel.write(backup);
                                } else {
                                    channel.write(Message.BACKUP(-1, -1, null)); // marks the end of the stream
                                    LOG.debug("Finished replicating to channel {}", channel);
View Full Code Here

Examples of co.paralleluniverse.galaxy.core.Message.BACKUP

                            final Channel channel = entry.getKey();
                            final Iterator<BACKUP> iter = entry.getValue();

                            for (int i = 0; i < 10; i++) {
                                if (iter.hasNext()) {
                                    final BACKUP backup = iter.next();
                                    LOG.debug("Replicating {} to channel {}", backup, channel);
                                    channel.write(backup);
                                } else {
                                    channel.write(Message.BACKUP(-1, -1, null)); // marks the end of the stream
                                    LOG.debug("Finished replicating to channel {}", channel);
View Full Code Here

Examples of com.groupon.odo.proxylib.models.backup.Backup

     *
     * @return
     * @throws Exception
     */
    public Backup getBackupData() throws Exception {
        Backup backupData = new Backup();

        backupData.setGroups(getGroups());
        backupData.setProfiles(getProfiles());
        ArrayList<Script> scripts = new ArrayList<Script>();
        Collections.addAll(scripts, ScriptService.getInstance().getScripts());
        backupData.setScripts(scripts);

        return backupData;
    }
View Full Code Here

Examples of com.groupon.odo.proxylib.models.backup.Backup

        java.util.Scanner s = new java.util.Scanner(streamData).useDelimiter("\\A");
        String data = s.hasNext() ? s.next() : "";

        // parse JSON
        ObjectMapper mapper = new ObjectMapper();
        Backup backupData = null;
        try {
            backupData = mapper.readValue(data, Backup.class);
        } catch (Exception e) {
            logger.error("Could not parse input data: {}, {}", e.getClass(), e.getMessage());
            return false;
        }

        // TODO: validate json against a schema for safety

        // GROUPS
        try {
            logger.info("Number of groups: {}", backupData.getGroups().size());

            for (Group group : backupData.getGroups()) {
                // determine if group already exists.. if not then add it
                Integer groupId = PathOverrideService.getInstance().getGroupIdFromName(group.getName());
                if (groupId == null)
                    groupId = PathOverrideService.getInstance().addGroup(group.getName());

                // get all methods from the group.. we are going to remove ones that don't exist in the new configuration
                List<Method> originalMethods = EditService.getInstance().getMethodsFromGroupId(groupId, null);

                for (Method originalMethod : originalMethods) {
                    Boolean matchInImportGroup = false;

                    int importCount = 0;
                    for (Method importMethod : group.getMethods()) {
                        if (originalMethod.getClassName().equals(importMethod.getClassName()) &&
                                originalMethod.getMethodName().equals(importMethod.getMethodName())) {
                            matchInImportGroup = true;
                            break;
                        }
                        importCount++;
                    }

                    if (!matchInImportGroup) {
                        // remove it from current database since it is a delta to the current import
                        PathOverrideService.getInstance().removeOverride(originalMethod.getId());
                    } else {
                        // remove from import list since it already exists
                        group.getMethods().remove(importCount);
                    }
                }

                // add methods to groups
                for (Method method : group.getMethods()) {
                    PathOverrideService.getInstance().createOverride(groupId, method.getMethodName(), method.getClassName());
                }
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        // PROFILES
        try {
            logger.info("Number of profiles: {}", backupData.getProfiles().size());

            // remove all servers
            // don't care about deltas here.. we'll just recreate them all
            // removed default servers (belong to group id=0)
            ServerRedirectService.getInstance().deleteServerGroup(0);

            for (com.groupon.odo.proxylib.models.backup.Profile profile : backupData.getProfiles()) {
                // see if a profile with this name already exists
                Integer profileId = ProfileService.getInstance().getIdFromName(profile.getName());
                com.groupon.odo.proxylib.models.Profile newProfile;
                if (profileId == null) {
                    // create new profile
                    newProfile = ProfileService.getInstance().add(profile.getName());
                } else {
                    // get the existing profile
                    newProfile = ProfileService.getInstance().findProfile(profileId);
                }

                // add new servers
                if (profile.getServers() != null) {
                    for (ServerRedirect server : profile.getServers()) {
                        ServerRedirectService.getInstance().addServerRedirect(server.getRegion(), server.getSrcUrl(), server.getDestUrl(), server.getHostHeader(), newProfile.getId(), 0);
                    }
                }

                // remove all server groups
                for (ServerGroup group : ServerRedirectService.getInstance().tableServerGroups(newProfile.getId())) {
                    ServerRedirectService.getInstance().deleteServerGroup(group.getId());
                }

                // add new server groups
                if (profile.getServerGroups() != null) {
                    for (ServerGroup group : profile.getServerGroups()) {
                        int groupId = ServerRedirectService.getInstance().addServerGroup(group.getName(), newProfile.getId());
                        for (ServerRedirect server : group.getServers()) {
                            ServerRedirectService.getInstance().addServerRedirect(server.getRegion(), server.getSrcUrl(), server.getDestUrl(), server.getHostHeader(), newProfile.getId(), groupId);
                        }
                    }
                }

                // remove all paths
                // don't care about deltas here.. we'll just recreate them all
                for (EndpointOverride path : PathOverrideService.getInstance().getPaths(newProfile.getId(), Constants.PROFILE_CLIENT_DEFAULT_ID, null)) {
                    PathOverrideService.getInstance().removePath(path.getPathId());
                }

                // add new paths
                if (profile.getPaths() != null) {
                    for (EndpointOverride path : profile.getPaths()) {
                        int pathId = PathOverrideService.getInstance().addPathnameToProfile(newProfile.getId(), path.getPathName(), path.getPath());

                        PathOverrideService.getInstance().setContentType(pathId, path.getContentType());
                        PathOverrideService.getInstance().setRequestType(pathId, path.getRequestType());
                        PathOverrideService.getInstance().setGlobal(pathId, path.getGlobal());

                        // add groups to path
                        for (String groupName : path.getGroupNames()) {
                            int groupId = PathOverrideService.getInstance().getGroupIdFromName(groupName);
                            PathOverrideService.getInstance().AddGroupByNumber(newProfile.getId(), pathId, groupId);
                        }
                    }
                }

                // set active
                ClientService.getInstance().updateActive(newProfile.getId(), Constants.PROFILE_CLIENT_DEFAULT_ID, profile.getActive());
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        // SCRIPTS
        try {
            // delete all scripts
            for (Script script : ScriptService.getInstance().getScripts()) {
                ScriptService.getInstance().removeScript(script.getId());
            }

            // add scripts
            for (Script script : backupData.getScripts()) {
                ScriptService.getInstance().addScript(script.getName(), script.getScript());
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

Examples of com.groupon.odo.proxylib.models.backup.Backup

    @ResponseBody
    String getBackup(Model model, HttpServletResponse response) throws Exception {
        response.addHeader("Content-Disposition", "attachment; filename=backup.json");
        response.setContentType("application/json");

        Backup backup = BackupService.getInstance().getBackupData();
        ObjectMapper objectMapper = new ObjectMapper();
        ObjectWriter writer = objectMapper.defaultPrettyPrintingWriter();

        return writer.withView(ViewFilters.Default.class).writeValueAsString(backup);
    }
View Full Code Here

Examples of net.datacrow.core.backup.Backup

    }
   
    private void backup() {
        File directory = fileFieldTarget.getFile();
        if (directory != null) {
            Backup bck = new Backup(this, fileFieldTarget.getFile(), textComment.getText().trim());
            bck.start();
        } else {
            DcSwingUtilities.displayWarningMessage("msgSelectOutputDir");
        }
    }
View Full Code Here

Examples of org.apache.derbyTesting.system.mailjdbc.tasks.Backup

      Thread.sleep(sleep_time);
      t.start();
      MailJdbc.logAct.logMsg(LogFile.INFO + "Started: " + t.getName());
      userThreads.add(t);
      //Starting Backup Thread
      t = new Backup("Backup Thread");
      t.start();
      MailJdbc.logAct.logMsg(LogFile.INFO + "Started: " + t.getName());
      userThreads.add(t);
      sleep_time = (int) (Math.random() * 15000);
      Thread.sleep(sleep_time);
 
View Full Code Here

Examples of org.apache.derbyTesting.system.mailjdbc.tasks.Backup

      Thread.sleep(sleep_time);
      t.start();
      MailJdbc.logAct.logMsg(LogFile.INFO + "Started: " + t.getName() + " with 150000 sleep time");
      userThreads.add(t);
      //Starting Backup Thread
      t = new Backup("Backup Thread");
      t.start();
      MailJdbc.logAct.logMsg(LogFile.INFO + "Started: " + t.getName());
      userThreads.add(t);
      sleep_time = (int) (Math.random() * 15000);
      Thread.sleep(sleep_time);
 
View Full Code Here

Examples of org.apache.derbyTesting.system.mailjdbc.tasks.Backup

      Thread.sleep(sleep_time);
      t.start();
      MailJdbc.logAct.logMsg(LogFile.INFO + "Started: " + t.getName() + " with 150000 sleep time");
      userThreads.add(t);
      //Starting Backup Thread
      t = new Backup("Backup Thread");
      t.start();
      MailJdbc.logAct.logMsg(LogFile.INFO + "Started: " + t.getName());
      userThreads.add(t);
      sleep_time = (int) (Math.random() * 15000);
      Thread.sleep(sleep_time);
 
View Full Code Here

Examples of org.exist.backup.Backup

        registerDatabase();
        log( "Creating backup of collection: " + uri );
        log( "Backup directory: " + dir );

        try {
            final Backup backup = new Backup( user, password, dir, XmldbURI.create( uri ) );
            backup.backup( false, null );

        }
        catch( final Exception e ) {
            e.printStackTrace();
            final String msg = "Exception during backup: " + e.getMessage();
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.