Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java - oplogger server

hopper
hopper 


Using Eclipse: Create a Graphic User Interface(GUI) for the server module of OP_Logger. The interface should perform similar functions as the current text based menu with some minor changes. The functionality includes: 1.Notification of any incoming Operation Profile data. Just as the text based system does. 2.Choice of 1.Creating a text report of the data. Allow user to select a file name and the storage location of the file using a GUI device. Similar to a browse button on many applications. 2.Writing the data to the database. (separate event from creating text file) 3.Perform both actions listed in items 2.1 and 2.2 above, write to a file and the database. 4.Quitting the server. In addition as noted in item 2.2 above, creating a text report should be mutually exclusive from writing the profile data to the database. Currently if you create a text report it automatically writes the data to the database. The layout and style of the GUI is left up to the developers, however, a user-friendly, professional interface is expected. Specially buttons should be of a normal button size text areas should not be too large or too small etc oplogger.server.gui is what has been done so far. Attachments Tags Clarifications

Answers

OPLogger Server Gui

dickersonka
dickersonka 



...OPLogger server gui Attachments
oploggerservergui.zip (106 K) Download















































Preview
This class creates a Graphic User Interface to replace the text based user interface of the OPLogger Server. * * @author David Scholl * @version 1.0 */ public class OperationalProfileGraphicUserInterface { /** * Instance variable constants

Preview
string is in the format of an OPERATION message as * described in Appendix A, Table A1 of the SRS. * * @return a comma separated representation of this object. */ public String toString(){ String operation = "OPERATION," + operationName + "," +

Preview
(progID, serverName, serverPort ); break; case SEND_ONCE: errorStatus = sendOperationCounts( progID, serverName, serverPort ); opCountMap.clear(); if( !( returnStatus >= DISABLED && returnStatus <= SUCCESS ) ){ errorStatus = SEND_ERROR; } break; case DONT_SEND: opCountMap.clear();

Preview
private static void printUsage() { System.out.println("Usage: oplogger.OP_Client_Benchmark [INST|UNINST]"); } /** * main program */ public static void main(String [] args) { //final int REPETITIONS = 100000; final int REPETITIONS = 100; //used for smaller samples long startTime; long

Preview
e.getMessage()); } // try..catch(Exception) } // OP_Server(int) /* Methods */ /** * Starts the OP_Server. * * @param args OP_Server is designed to take a port number as its single * argument */ public static void main(String[] args) { int portNumber = 0;

Preview

Preview
public SendOptionDialog( SendSelection userPreference ){ //Strings used to initialize JButtons String neverString = "<html>" + "<p align=\"center\">" + "NEVER SEND" + "<br>" + "Don't ask me again!" + "</p>" + "</html>"; String dontSendString = "<html>" + "<p align=\"center\">" + "DON'T SEND"

Preview
int selection; /** * No argument constructor of class SendSelection. */ public SendSelection(){ selection = MIN; } /** * Sets the value of the variable selection. * * @param value An int representing a user selection. The

Preview
@author mwooten */ public abstract class ClientMessage { /* Methods */ /** * Returns the type of message the client sent. * * @return the type of message */ public abstract String

Preview
an OP_Client and OP_Server. * </p> * * @author mwooten */ public class EndMessage extends ClientMessage { /* Constants */ /** * The name of the EndMessage type. */ private static final

Preview
* @param operationTag the name of the operation * @param operationCount the number of times the operation was performed * * @throws NullPointerException operationTag is <code>null</code> * @throws IllegalArgumentException operationCount is negative */ public OperationMessage(String operationTag, int operationCount) { setOperationTag(operationTag); setOperationCount(operationCount); } // OperationMessage(String, int) /* Methods

Preview
* </p> * * <p> * The class provides a single method, <code>parse(String)</code>, which * subclasses should implement. Sublcasses should implement the parse method to * parse whatever format the OP_Client raw data is in. * </p> * * @see oplogger.server.clientmsg.ClientMessage * * @author mwooten */ public abstract

Preview
which returns an instance of a <code>ClientMessageParser</code>. The method * should be implemented by subclasses to return the * <code>ClientMessageParser</code> appropriate for the factory type. * </p> * * @see oplogger.server.clientmsg.parser.ClientMessageParser * * @author mwooten */ public abstract class ClientMessageParserFactory { /** * Returns an instance of a ClientMessageParser

Preview
client message in the raw format of comma * separated values. The class uses the <code>CommaSeparatedValueParser</code> * class to break of client messages. * <p> * * @see oplogger.util.csv.CommaSeparatedValueParser * * @author mwooten */ public class CsvClientMessageParser extends ClientMessageParser { /* Constants */ /** * The name of

Preview
/** * Returns a reference to the single instance of the * CsvClientMessageParserFactory. * * @return an instance of the CsvClientMessageParserFactory */ public static CsvClientMessageParserFactory getInstance() { return instance; } // CsvClientMessageParserFactory getInstance() /* Methods */ /* (non-Javadoc) * @see oplogger.server.clientmsg.parser.ClientMessageParserFactory#newClientMessageParser() */ public ClientMessageParser newClientMessageParser() {

Preview
ProgramMessage(String programId) { setProgramId(programId); } // ProgramMessage(String) /* Methods */ /* (non-Javadoc) * @see oplogger.server.clientmsg.ClientMessage#getMessageType() */ public String getMessageType() { return PROGRAM_MESSAGE_TYPE; } // String getMessageType() /** * Returns the name of the program that client messages are being sent for. * * @return the

Preview
private static final int FRAME_HEIGHT = 600; /** * The usage message displayed to the user when the incorrect number of * arguments is sent to OP_Server */ private static final String USAGE_MESSAGE = "Usage: java oplogger.server.gui.OperationalProfileGraphicUserInterface <port number>"; /**

Preview
return filePanel; } private JTextField createFilePathText() { final int TEXTBOX_WIDTH = 30; fileTextField = new JTextField(TEXTBOX_WIDTH); fileTextField.setText("This Box will populate with the file and path selected with the button"); return fileTextField; } private void saveReportToFile(){ JFileChooser chooser

Preview
initial numer of times the operation has been performed. * * @param name the name of the operation * @param count the initial number of times the operation has been performed * * @throws NullPointerException name is <code>null</code> * @throws IllegalArgumentException count is negative */ public Operation(String

Preview
@return the relative difference between this operational profile and the * one it was compared to */ public int compareTo(Object object) { OperationalProfile opProfile = (OperationalProfile) object; return programName.compareTo(opProfile.programName); } // int compareTo(Object) /** * Returns a String representation of the operational profile. * * @return a String

Preview
the profile to the // database. Display a success message when completed. if (message instanceof EndMessage) { profile.incrementNumberOfSamples(1); profileDatabase.addOperationalProfile(profile); display.displayMessage(generateSuccessString( profile.getProgramName(), profile.getNumberOfOperations())); display.displayLastPrompt(); } else { throw new Exception(NO_END_MESSAGE_ERROR_MESSAGE); } // if (message.getMessageType().equals("END") } catch (IOException ioe) { display.displayMe

Preview
operational profile to the database. If the profile already * exists in the database, the old profile is updated. * * @param profile the profile to add to the database * * @throws NullPointerException profile is <code>null</code> */ public synchronized void addOperationalProfile(OperationalProfile profile) { if

Preview
int portNumber) throws IOException { setProfileDatabase(profileDatabase); setDisplay(display); serverSocket = new ServerSocket(portNumber); clientConnectionThreads = new ThreadGroup( CLIENT_CONNECTIONS_THREAD_GROUP_NAME); serverRunning = Boolean.FALSE; } // OperationalProfileServer(Display) /* Methods */ /** * Starts the execution of the server. The server will wait for incoming * connections from OP_Clients and

Preview
* * @param database the database of operational profiles * * @return a String containing a formatted report of the operational * profiles */ public String generateReport(OperationalProfileDatabase database) { synchronized (database) { if (database.getNumberOfOperationalProfiles() == 0) { return NO_PROFILES_RECEIVED_REPORT; } else { database.toSQL(); return

Preview
static DbOperationalProfileReportGeneratorFactory instance = new DbOperationalProfileReportGeneratorFactory(); /* Variables */ private DbOperationalProfileReportGenerator reportGenerator; /* Constructors */ /** * The DbOperationalProfileReportGeneratorFactory constructor creates a * new DbOperationalProfileReportGenerator which will be returned on * requests for a new report generator. The constructor is private to *

Preview
creating reports * based on the contents of the database. * </p> * * @author mwooten * @author apinto */ public class FileOperationalProfileReportGenerator extends OperationalProfileReportGenerator { /* Constants */ /** * The report generated if the profile database is empty. */ private static final String NO_PROFILES_RECEIVED_REPORT =

Preview
of the FileOperationalProfileReportGenerator class. The class * implements the Singleton design pattern, as it is not necessary to have more * than one SimpleOperationalProfileReportGeneratorFactory. * </p> * * @see oplogger.server.reportgen.SimpleOperationalProfileReportGenerator * * @author mwooten */ public class FileOperationalProfileReportGeneratorFactory extends OperationalProfileReportGeneratorFactory { /* Static Variables */ private static

Preview
* OperationalProfileDatabase. * </p> * * @see oplogger.server.OperationalProfileDatabase * * @author mwooten */ public abstract class OperationalProfileReportGenerator { /* Methods */ /** * Generates a report based on the operational profiles contained in the * database. * * @param database the database of operational profiles *

Preview
OpLogger */ package oplogger.server.reportgen; /** * <p> * The OperationalProfileReportGeneratorFactory is designed to be used with the * Abstract Factory design pattern. The class defines a single method, * <code>newReportGenerator()</code>, which returns an instance of an *

Preview
java.io.FileWriter; import java.io.IOException; import oplogger.server.OperationalProfileDatabase; import oplogger.server.OperationalProfileServer; import oplogger.server.reportgen.OperationalProfileReportGenerator; import oplogger.server.reportgen.OperationalProfileReportGeneratorFactory; import oplogger.server.reportgen.FileOperationalProfileReportGeneratorFactory; /** * <p> * The AdministrationTerminal class represents the class that administrators * (users) of the server will interact w

Preview
*/ public void shutdownServer() { server.stopServer(); display.displayMessage("Shutdown server"); } // void shutdownServer() /** * Starts the AdministrationTerminal running as part of a Thread. */ public void run() { } // void run() /** * Associates the AdminstrationTerminal with the database of operational * profiles. * * @param

Preview
Display and associates it with an output stream. * * @param outputStream the stream the display will write to */ public Display(OutputStream outputStream) { displayStream = new PrintStream(outputStream); lastDisplayedPrompt = ""; } // Display(OutputStream) /* Methods */ /** * Displays a message to the output stream. *

Preview
a new UserInputManager and associates it with the InputStream * that it will receive user input from. * * @param inputStream the stream that user input will be received from */ public UserInputManager(InputStream inputStream) { inputReader = new BufferedReader(new InputStreamReader(inputStream)); } // UserInputManager(InputStream) /* Methods */ /**

Preview
The class provides one method, * <code>parse(String)</code>, which performs the task of splitting a CSV * formatted String into fields. The fields are returned as an array of Strings. * </p> * * <p> * Using the constructors of the class, the separator used to split the

Preview
import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; /** * This class creates the Server GU

Preview
profiles

Preview
2 2.00% TAG 209 2 2.00% TAG 854 1 1.00% TAG 108 1 1.00% TAG 852 1 1.00% TAG 263 1 1.00% TAG 657 1 1.00% TAG 654 1 1.00% TAG 36 1 1.00% TAG 453 1 1.00% TAG 942 1 1.00% TAG 848 1 1.00% TAG 357 1 1.00%

Preview
profiles

Preview
OPERATION TOTAL COUNT PERCENTAGE scanf 8 36.36%

Screenshots
Screenshot
Purchase Answer