[ create a new paste ] login | about

Link: http://codepad.org/JaUuw40q    [ raw code | fork ]

Plain Text, pasted on Mar 12:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package uk.co.solong.backpack.finder;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.EnumSet;

/**
 *
 * @author Terabyte
 */
public class Application {
    private BackpackInserter backpackInserter;
    private DatabaseSchema databaseSchema;
    public Application(){
        //create all work objects
         backpackInserter = new BackpackInserter();
         databaseSchema = new DatabaseSchema();
    }
    public void execute(){
        InputStream resourceAsStream = ClassLoader.getResourceAsStream("uk/co/solong/backpack/config/config.xml");
        while (true) {
            System.out.println("-=Menu=-");
            System.out.println("1) Start inserting backpacks");
            System.out.println("2) Stop inserting backpacks");
            System.out.println("9) Reset Schema");
            String action = "";
            InputStreamReader input = new InputStreamReader(System.in);
            BufferedReader reader = new BufferedReader(input); 
            try{
                action = reader.readLine(); 
                if (action.equalsIgnoreCase("1")){
                    backpackInserter.setCurrentBackpack("76561197971384027");
                    backpackInserter.execute();
                } else if (action.equalsIgnoreCase("2")){     
                    backpackInserter.setActive(false);
                } else if (action.equalsIgnoreCase("9")){     
                    databaseSchema.setControl(EnumSet.of(SchemaControlFlags.DELETE,SchemaControlFlags.CREATE));
                    databaseSchema.execute();
                }
            } catch(Exception e){
                System.out.println("@An exception occured reading your menu input.");
            }            
        }
    }
}



Create a new paste based on this one


Comments: