com.joctopus.core
Class Util

java.lang.Object
  extended by com.joctopus.core.Util

public class Util
extends java.lang.Object

Defines static utility methods, and serves as repository for config and users data.

Since:
1.0

Field Summary
static java.util.Vector<Users> config
          stores applns config.
static Users me
          stores applns config.
static java.util.Vector<Users> users
          stores users object, based on each node in users.xml file
 
Constructor Summary
Util()
           
 
Method Summary
static double BytestoMB(double size)
          Converts file size in Bytes to MB.
static byte[] getBytes(java.lang.String ip)
          Converts given ipaddress to raw byte format suitable in InetAddress.getByAddress(..) method
static double MBtoBytes(double size)
          Converts file size in MB to Bytes.
static java.lang.String replace(java.lang.String pattern, java.lang.String replace, java.lang.String string)
           
static java.util.Vector<Users> searchByIPAddress(java.lang.String ipaddress, java.util.Vector userconfig)
           
static void showInformationDialog(java.awt.Window parent, boolean modal, java.lang.Object message, java.lang.String title, boolean exitAfterShow)
          Displays an information diaog to the user
static void showSaveDialogAndSaveToFile(java.lang.StringBuffer message, JOctopusConsole console, java.awt.Component parent)
           
static boolean showYesNoDialog(java.awt.Window parent, boolean modal, java.lang.Object message, java.lang.String title)
          Displays a yes/no (Confirm) dialog to user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

users

public static java.util.Vector<Users> users
stores users object, based on each node in users.xml file


config

public static java.util.Vector<Users> config
stores applns config.


me

public static Users me
stores applns config.

Constructor Detail

Util

public Util()
Method Detail

searchByIPAddress

public static java.util.Vector<Users> searchByIPAddress(java.lang.String ipaddress,
                                                        java.util.Vector userconfig)
Parameters:
ipaddress -
userconfig -
Returns:
Vector of users objects

getBytes

public static byte[] getBytes(java.lang.String ip)
Converts given ipaddress to raw byte format suitable in InetAddress.getByAddress(..) method

Parameters:
ip -
Returns:
byte[]

BytestoMB

public static double BytestoMB(double size)
Converts file size in Bytes to MB.

Parameters:
size -
Returns:
MB value

MBtoBytes

public static double MBtoBytes(double size)
Converts file size in MB to Bytes.

Parameters:
size -
Returns:
Byte value.

showInformationDialog

public static void showInformationDialog(java.awt.Window parent,
                                         boolean modal,
                                         java.lang.Object message,
                                         java.lang.String title,
                                         boolean exitAfterShow)
Displays an information diaog to the user

Parameters:
parent - the parent window, The parent should be of type Frame,Window,Dialog,JFrame,JDialog else parent window would not be set.
modal - wheather the dialog should be displayed as modal or non-modal
message - The message to be displayed on dialog (should be a Component object).
title - the title of dialog
exitAfterShow - wheather the system should exit after showing dialog.

showYesNoDialog

public static boolean showYesNoDialog(java.awt.Window parent,
                                      boolean modal,
                                      java.lang.Object message,
                                      java.lang.String title)
Displays a yes/no (Confirm) dialog to user.

Parameters:
parent - the parent window
modal - wheather the dialog should be displayed as modal or non-modal
message - The message to be displayed on dialog (should be a Component object).
title - the title of dialog
Returns:
true if "YES" button is selected other wise false.

showSaveDialogAndSaveToFile

public static void showSaveDialogAndSaveToFile(java.lang.StringBuffer message,
                                               JOctopusConsole console,
                                               java.awt.Component parent)
Parameters:
message -
console -
parent - message is text to be saved console is JOctopusConsole object parent is the parent window.

replace

public static java.lang.String replace(java.lang.String pattern,
                                       java.lang.String replace,
                                       java.lang.String string)
Parameters:
pattern -
replace -
string -
Returns:
altered string