| java.lang.Object org.datashare.SessionUtilities
SessionUtilities | public class SessionUtilities (Code) | | This is the repository for the methods that represent common activities for
Rendezvous. All methods/attributes in that class are static.
author: Charles Wood version: 1.0 |
Method Summary | |
protected static void | addChannel(DefaultObjectInfo doi, DefaultMutableTreeNode sessionNode, DefaultTreeModel model, String clientClass) | protected static void | addConsumer(DefaultObjectInfo consumer, DefaultMutableTreeNode sessionNode, DefaultTreeModel model, String myClientClass) | protected static void | addSession(DefaultObjectInfo doi, DefaultMutableTreeNode sessionNode, DefaultTreeModel model, String myClientClass) | protected static void | addSpecialClient(DefaultObjectInfo doi, DefaultMutableTreeNode clientNode, DefaultTreeModel model, String myClientClass) | public static byte[] | convertObjectToByteArray(Object object) Serializes an object on the client side, avoids the problem we had of trying to
send a true object through the server if the server did not have a classpath to the object.
This way, the server only has to know that it is a byte[]. | public static void | delay(int milliseconds) | public static String | findClientName(String clientKey, DefaultMutableTreeNode clientNode) | public static DefaultMutableTreeNode[] | getAllChannelsInSession(String sessionKeyValue, DefaultMutableTreeNode sessionNode) finds all Channels in the parentSession. | public static String | getAllSessionsHelpString() | public static Applet | getApplet() | public static DataShareConnection | getCommandStatusConnection() | public static int | getEnterpriseID() | public static int | getHeight() | public static ImageIcon | getImageIcon(Container container, String name) returns an imageIcon (from the jar file if called from an applet)
Note that the image name should be an absolute filename, for example:
/com/ball/ads/hc/images/my.gif, and that the FILE NAMES ARE CASE SENSITIVE. | public static ImageIcon | getImageIcon(Frame frame, String name) returns an imageIcon (from the jar file if called from an applet)
Note that the image name should be an absolute filename, for example:
/com/ball/ads/hc/images/my.gif, and that the FILE NAMES ARE CASE SENSITIVE. | public static boolean | getIsApplication() | public static LoggingInterface | getLoggingInterface() returns the logging interface that we will use instead of doing System.out calls. | public static Image | getMyImage(Container container, String imageName) this method will load an image from jar files (and possibly other resources
that the classloader knows about). | public static Frame | getParentFrame(Container container) finds the first Frame going back through a Container's ancestry, returns null if
no Frame is found. | public static String | getServerIP() | public static String | getServername() | public static String | getShortTimeString(Date date) | public static int | getTCPSocketReadTimeout() | public static String | getTimeString(Date date) returns a string for time that looks good!
Symbol Meaning Presentation Example
------ ------- ------------ -------
G era designator (Text) AD
y year (Number) 1996
M month in year (Text & Number) July & 07
d day in month (Number) 10
h hour in am/pm (1~12) (Number) 12
H hour in day (0~23) (Number) 0
m minute in hour (Number) 30
s second in minute (Number) 55
S millisecond (Number) 978
E day in week (Text) Tuesday
D day in year (Number) 189
F day of week in month (Number) 2 (2nd Wed in July)
w week in year (Number) 27
W week in month (Number) 2
a am/pm marker (Text) PM
k hour in day (1~24) (Number) 24
K hour in am/pm (0~11) (Number) 0
z time zone (Text) Pacific Standard Time
' escape for text (Delimiter)
'' single quote (Literal) '
The count of pattern letters determine the format.
(Text): 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists.
(Number): the minimum number of digits. | public static String | getUserFullName() | public static int | getUserID() | public static Image | getUserImage(String clientName) | public static String | getUserImageURL(String clientName) | public static String | getUserName() | public static boolean | getVerbose() | public static int | getWidth() | public static void | insertNode(DefaultObjectInfo doi, DefaultMutableTreeNode sessionNode, DefaultMutableTreeNode clientNode, DefaultTreeModel model, String myClientClass) determines what type of object is to be inserted, then inserts it at as the last
child at the appropriate place. | protected static void | insertNodeInto(DefaultMutableTreeNode node, DefaultMutableTreeNode parentNode, int index, DefaultTreeModel model) | public static boolean | isConsumerInSession(DefaultMutableTreeNode sessionNode, String consumerKey) | protected static void | removeChannel(DefaultObjectInfo doi, DefaultMutableTreeNode sessionNode, DefaultTreeModel model) | protected static void | removeConsumer(DefaultObjectInfo doi, DefaultMutableTreeNode sessionNode, DefaultTreeModel model) | public static void | removeNode(DefaultObjectInfo doi, DefaultMutableTreeNode sessionNode, DefaultMutableTreeNode clientNode, DefaultTreeModel model, String myClientClass) | protected static void | removeSession(DefaultObjectInfo doi, DefaultMutableTreeNode sessionNode, DefaultTreeModel model) removes a Session from our treeNode. | protected static void | removeSpecialClient(DefaultObjectInfo doi, DefaultMutableTreeNode clientNode, DefaultTreeModel model) removes a specialClient from our treeNode. | public static Object | retrieveObject(byte[] objectBytes) Converts a byte[] back to an object. | public static void | scrollPaneDroppingsFixer(JScrollPane scrollPane) This method will allow any JScrollPane to repaint 250 mseconds after scrollBar adjustments
made by a user have stopped. | public static DefaultMutableTreeNode | searchForChannelInTree(String sessionKeyValue, String channelKeyValue, DefaultMutableTreeNode sessionNode) finds a Channel with the same keyValue as the one specified by looking in the
Session with the same keyValue as the one specified as the parentSession. | protected static DefaultMutableTreeNode | searchForClientInTree(String clientKeyValue, DefaultMutableTreeNode clientNode) finds a Client with the same keyValue as the one specified,
returns null otherwise. | public static DefaultMutableTreeNode | searchForConsumerInTree(String sessionKeyValue, String channelKeyValue, String consumerKeyValue, DefaultMutableTreeNode sessionNode) finds a Consumer with the same keyValue as the one specified by looking in the
Session with the same keyValue as the one specified by the sessionKeyValue
and the Channel with the same keyValue as the one specified by the enteKeyValue. | public static DefaultMutableTreeNode | searchForSessionInTree(String sessionKeyValue, DefaultMutableTreeNode sessionNode) finds a Session with the same keyValue as the one specified,
returns null otherwise. | public static void | setApplet(Applet applet) | public static void | setCommandStatusConnection(DataShareConnection thisCommandStatusConnection) | public static void | setEnterpriseID(int newEnterpriseID) | public static void | setFrameIcon(Frame frame) | public static void | setHeight(int newHeight) | public static void | setIsApplication(boolean newValue) | public static void | setLoggingInterface(LoggingInterface loggingInterface) sets the logging interface that we will use instead of doing System.out calls. | public static void | setServerIP(String newServerIP) Sets the server IP address; this should be used by the class that reads the
command line parameters (for applications) or the applet code to set this
value so that all other classes will be able to use getServerIP() when the
server name is needed. | public static void | setServername(String newServername) Sets the server name; this should be used by the class that reads the
command line parameters (for applications) or the applet code to set this
value so that all other classes will be able to use getServername() when the
server name is needed. | public static void | setTCPSocketReadTimeout(int newTimeoutValue) | public static void | setUserFullName(String newUserFullName) | public static void | setUserID(int newUserID) | public static void | setUserImageURL(String clientUniqueName, String clientName, String url) | public static void | setUserName(String newUserName) | public static void | setVerbose(boolean newValue) | public static void | setWidth(int newWidth) |
SocketRcvCmdPriority | public static int SocketRcvCmdPriority(Code) | | |
SocketRcvDataPriority | public static int SocketRcvDataPriority(Code) | | |
SocketXmtRelativePriority | public static int SocketXmtRelativePriority(Code) | | |
imageRoot | public static String imageRoot(Code) | | default location for HC images,
should be prepended to the image name prior to retrieval.
|
missingPersonURL | public static URL missingPersonURL(Code) | | this is where we save a reference to the image to use when we cannot find a user's image.
A URL was choosen because the image can then be loaded like all the other user images.
|
convertObjectToByteArray | public static byte[] convertObjectToByteArray(Object object) throws IOException(Code) | | Serializes an object on the client side, avoids the problem we had of trying to
send a true object through the server if the server did not have a classpath to the object.
This way, the server only has to know that it is a byte[]. Convert back to an object
via the retrieveObject() method.
|
delay | public static void delay(int milliseconds)(Code) | | utility method, allows the calling method to delay the specified number of milliseconds
Parameters: milliseconds - number of milliseconds to delay |
findClientName | public static String findClientName(String clientKey, DefaultMutableTreeNode clientNode)(Code) | | finds clientName from clientKey
Parameters: clientKey - the clientKeyValue of a client Parameters: clientNode - the node that contains all SpecialClients the clientName that corresponds to the specified clientKeyValue, or empty string if not found |
getAllChannelsInSession | public static DefaultMutableTreeNode[] getAllChannelsInSession(String sessionKeyValue, DefaultMutableTreeNode sessionNode)(Code) | | finds all Channels in the parentSession.
returns null otherwise.
Parameters: sessionKeyValue - key value for the Session Parameters: sessionNode - treeNode that contains all the Sessions the channelKeyValues for all Channels in the Session |
getAllSessionsHelpString | public static String getAllSessionsHelpString()(Code) | | |
getApplet | public static Applet getApplet()(Code) | | accessor for the main applet instance
the main applet instance |
getCommandStatusConnection | public static DataShareConnection getCommandStatusConnection()(Code) | | Retreives the command status connection for this client
|
getEnterpriseID | public static int getEnterpriseID()(Code) | | accessor for the enterpriseID value (Client's enterprise ID number)
the enterpriseID value |
getHeight | public static int getHeight()(Code) | | accessor for the height value (a generic attribute)
the height value |
getImageIcon | public static ImageIcon getImageIcon(Container container, String name)(Code) | | returns an imageIcon (from the jar file if called from an applet)
Note that the image name should be an absolute filename, for example:
/com/ball/ads/hc/images/my.gif, and that the FILE NAMES ARE CASE SENSITIVE.
Parameters: container - a container that is loaded so it's class loader can be used toretrieve the image Parameters: name - the filename of the image the specified imageIcon |
getImageIcon | public static ImageIcon getImageIcon(Frame frame, String name)(Code) | | returns an imageIcon (from the jar file if called from an applet)
Note that the image name should be an absolute filename, for example:
/com/ball/ads/hc/images/my.gif, and that the FILE NAMES ARE CASE SENSITIVE.
Parameters: frame - a frame that is loaded so it's class loader can be used toretrieve the image Parameters: name - the filename of the image the specified imageIcon |
getIsApplication | public static boolean getIsApplication()(Code) | | accessor for the isApplication flag
false if instance started as an applet, true if started as anapplication |
getLoggingInterface | public static LoggingInterface getLoggingInterface()(Code) | | returns the logging interface that we will use instead of doing System.out calls.
|
getMyImage | public static Image getMyImage(Container container, String imageName)(Code) | | this method will load an image from jar files (and possibly other resources
that the classloader knows about). Note that the image name should be an
absolute filename, for example: /com/ball/ads/hc/images/my.gif
Parameters: container - used to load a resource Parameters: imageName - the file name of the image the specified image |
getParentFrame | public static Frame getParentFrame(Container container)(Code) | | finds the first Frame going back through a Container's ancestry, returns null if
no Frame is found. Useful when we need a modal dialog and have no reference to a parent frame.
|
getServerIP | public static String getServerIP()(Code) | | accessor for the server machine IP address
IP address for the server machine |
getServername | public static String getServername()(Code) | | accessor for the server machine name
name for the server machine |
getTCPSocketReadTimeout | public static int getTCPSocketReadTimeout()(Code) | | accessor for TCPSocketReadTimeout
current timeout value in milliseconds |
getTimeString | public static String getTimeString(Date date)(Code) | | returns a string for time that looks good!
Symbol Meaning Presentation Example
------ ------- ------------ -------
G era designator (Text) AD
y year (Number) 1996
M month in year (Text & Number) July & 07
d day in month (Number) 10
h hour in am/pm (1~12) (Number) 12
H hour in day (0~23) (Number) 0
m minute in hour (Number) 30
s second in minute (Number) 55
S millisecond (Number) 978
E day in week (Text) Tuesday
D day in year (Number) 189
F day of week in month (Number) 2 (2nd Wed in July)
w week in year (Number) 27
W week in month (Number) 2
a am/pm marker (Text) PM
k hour in day (1~24) (Number) 24
K hour in am/pm (0~11) (Number) 0
z time zone (Text) Pacific Standard Time
' escape for text (Delimiter)
'' single quote (Literal) '
The count of pattern letters determine the format.
(Text): 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists.
(Number): the minimum number of digits. Shorter numbers are zero-padded to this amount.
Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits.
(Text & Number): 3 or over, use text, otherwise use number.
Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be
treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the
resulting time text even they are not embraced within single quotes.
|
getUserFullName | public static String getUserFullName()(Code) | | accessor for the userFullName parameter value
userFullName value |
getUserID | public static int getUserID()(Code) | | accessor for the userID value (Client's unique ID number)
the userID value |
getUserImage | public static Image getUserImage(String clientName)(Code) | | used to retrieve the Image of a client, we must have had the client in our tree and they
must have an imgage loaded on the server;
|
getUserImageURL | public static String getUserImageURL(String clientName)(Code) | | used to retrieve the URL for a client's image, we must have had the client in our tree
and they must have an image loaded on the server;
URL string for image or empty string if URL not available |
getUserName | public static String getUserName()(Code) | | accessor for the userName parameter value
userName value |
getVerbose | public static boolean getVerbose()(Code) | | accessor for the verbose flag
false if user wants fewer console printouts, true otherwise |
getWidth | public static int getWidth()(Code) | | accessor for the width value (a generic attribute)
the width value |
insertNodeInto | protected static void insertNodeInto(DefaultMutableTreeNode node, DefaultMutableTreeNode parentNode, int index, DefaultTreeModel model)(Code) | | inserts the specified node into the specified parent node at the specified index
Parameters: node - node to be inserted Parameters: parentNode - node which will receive the node Parameters: index - location in parentNode at which to insert the new node |
isConsumerInSession | public static boolean isConsumerInSession(DefaultMutableTreeNode sessionNode, String consumerKey)(Code) | | returns true if Consumer is found in any Channel in this Session
|
retrieveObject | public static Object retrieveObject(byte[] objectBytes) throws IOException, ClassNotFoundException(Code) | | Converts a byte[] back to an object. This method should only be used on objects that were
previously converted to the byte[] by the convertObjectToByteArray() method.
|
scrollPaneDroppingsFixer | public static void scrollPaneDroppingsFixer(JScrollPane scrollPane)(Code) | | This method will allow any JScrollPane to repaint 250 mseconds after scrollBar adjustments
made by a user have stopped. This is done so that the artifacts of scrolling (garbled text/images)
gets cleaned up after every scroll pane is moved (adjusted)
|
searchForChannelInTree | public static DefaultMutableTreeNode searchForChannelInTree(String sessionKeyValue, String channelKeyValue, DefaultMutableTreeNode sessionNode)(Code) | | finds a Channel with the same keyValue as the one specified by looking in the
Session with the same keyValue as the one specified as the parentSession.
returns null otherwise.
Parameters: sessionKeyValue - key value for the Session for this Channel Parameters: channelKeyValue - key value for the Channel the node for the requested Channel |
searchForClientInTree | protected static DefaultMutableTreeNode searchForClientInTree(String clientKeyValue, DefaultMutableTreeNode clientNode)(Code) | | finds a Client with the same keyValue as the one specified,
returns null otherwise.
Parameters: clientKeyValue - the key value for the Client the node for the requested Client |
searchForConsumerInTree | public static DefaultMutableTreeNode searchForConsumerInTree(String sessionKeyValue, String channelKeyValue, String consumerKeyValue, DefaultMutableTreeNode sessionNode)(Code) | | finds a Consumer with the same keyValue as the one specified by looking in the
Session with the same keyValue as the one specified by the sessionKeyValue
and the Channel with the same keyValue as the one specified by the enteKeyValue.
returns null otherwise.
Parameters: sessionKeyValue - key value for the Session to look in Parameters: channelKeyValue - key value for the Channel to look in Parameters: consumerKeyValue - key value for the Consumer to find the node for the requested Consumer |
searchForSessionInTree | public static DefaultMutableTreeNode searchForSessionInTree(String sessionKeyValue, DefaultMutableTreeNode sessionNode)(Code) | | finds a Session with the same keyValue as the one specified,
returns null otherwise.
Parameters: sessionKeyValue - key value for the Session, all Session names must be unique Parameters: sessionNode - the top level of all Sessions, used as the starting point for the search the node that corresponds to the requested Session |
setApplet | public static void setApplet(Applet applet)(Code) | | sets the main applet instance
Parameters: applet - a reference to the main applet instance |
setCommandStatusConnection | public static void setCommandStatusConnection(DataShareConnection thisCommandStatusConnection)(Code) | | Sets the command status connection for this client (used to communicate with
the server)
|
setEnterpriseID | public static void setEnterpriseID(int newEnterpriseID)(Code) | | sets the enterpriseID value
Parameters: newEnterpriseID - enterpriseID value |
setFrameIcon | public static void setFrameIcon(Frame frame)(Code) | | sets the frame's Icon to our standard Icon
Parameters: frame - |
setHeight | public static void setHeight(int newHeight)(Code) | | sets the height value
Parameters: newHeight - height value |
setIsApplication | public static void setIsApplication(boolean newValue)(Code) | | sets the isApplication attribute
Parameters: newValue - newValue to be set into the isApplication flag |
setLoggingInterface | public static void setLoggingInterface(LoggingInterface loggingInterface)(Code) | | sets the logging interface that we will use instead of doing System.out calls. this
will provide more control over what actually gets to the console without having to
remove all the System.out calls.
|
setServerIP | public static void setServerIP(String newServerIP)(Code) | | Sets the server IP address; this should be used by the class that reads the
command line parameters (for applications) or the applet code to set this
value so that all other classes will be able to use getServerIP() when the
server name is needed.
Parameters: newServername - IP address of the server |
setServername | public static void setServername(String newServername)(Code) | | Sets the server name; this should be used by the class that reads the
command line parameters (for applications) or the applet code to set this
value so that all other classes will be able to use getServername() when the
server name is needed.
Parameters: newServername - the name or IP address of the server |
setTCPSocketReadTimeout | public static void setTCPSocketReadTimeout(int newTimeoutValue)(Code) | | sets the TCPSocketReadTimeout attribute
Parameters: newTimeoutValue - set into TCPSocketReadTimeout |
setUserFullName | public static void setUserFullName(String newUserFullName)(Code) | | sets the userFullName value
Parameters: newUserFullName - userFullName value |
setUserID | public static void setUserID(int newUserID)(Code) | | sets the userID value
Parameters: newUserID - userID value |
setUserImageURL | public static void setUserImageURL(String clientUniqueName, String clientName, String url)(Code) | | used when an image for a user is to be saved
|
setUserName | public static void setUserName(String newUserName)(Code) | | sets the userName value
Parameters: newUserName - userName value |
setVerbose | public static void setVerbose(boolean newValue)(Code) | | sets the verbose attribute
Parameters: newValue - set to true to select lots of details on the console, false otherwise |
setWidth | public static void setWidth(int newWidth)(Code) | | sets the width value
Parameters: newWidth - width value |
|
|