Java Doc for NetworkServerControlImpl.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » drda » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.drda 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.drda.NetworkServerControlImpl

NetworkServerControlImpl
final public class NetworkServerControlImpl (Code)
NetworkServerControlImpl does all the work for NetworkServerControl
See Also:   NetworkServerControl
See Also:    for description


Field Summary
final protected static  StringATT_SRVNAM
    
final protected static  intCCSIDMBC
    
final protected static  intCCSIDSBC
    
final protected static  intDEFAULT_CCSID
    
final protected static  StringDEFAULT_ENCODING
    
final protected static  intINVALID_OR_NOTSET_SECURITYMECHANISM
    
final protected static  int[]MGR_LEVELS
    
final protected static  byteSPACE_CHAR
    
final public static  StringUNEXPECTED_ERR
    
protected static  Stringatt_extnam
    
protected static  Stringatt_srvclsnm
    
protected static  Stringatt_srvrlslv
    
public  StringclientLocale
    
protected  PrintWritercloudscapeLogWriter
    
protected  booleandebugOutput
    
 ArrayListlocalAddresses
    
protected  PrintWriterlogWriter
    
protected static  StringprdId
    
protected static  byte[]prdIdBytes_
    

Constructor Summary
public  NetworkServerControlImpl()
    
public  NetworkServerControlImpl(InetAddress address, int portNumber)
     Internal constructor for NetworkServerControl API.

Method Summary
 voidaddSession(Socket clientSocket)
     Add a session - for use by ClientThread.
public  voidblockingStart(PrintWriter consoleWriter)
     Start a network server
Parameters:
  consoleWriter - PrintWriter to which server console will be output.
public  StringbuildRuntimeInfo(LocalizedResource locallangUtil)
    
public  voidconsoleError(String msg)
    
public  voidconsoleExceptionPrint(Exception e)
     Write an exception to console output stream, but only if debugOutput is true.
public  voidconsoleExceptionPrintTrace(Throwable e)
     Write an exception (with trace) to console output stream.
public  voidconsoleMessage(String msg)
    
protected  voidconsolePropertyMessage(String msgProp)
    
protected  voidconsolePropertyMessage(String msgProp, String arg)
    
protected  voidconsolePropertyMessage(String msgProp, String[] args)
    
public  voiddirectShutdown()
    
public  voidexecuteWork(String args)
    
protected  AppRequestergetAppRequester(AppRequester appRequester)
    
public  PropertiesgetCurrentProperties()
    
protected static  DrivergetDriver()
    
protected  booleangetKeepAlive()
    
public  booleangetLogConnections()
    
protected  intgetManagerLevel(int manager)
    
protected  SessiongetNextSession(Session currentSession)
     Get the next session for the thread to work on Called from DRDAConnThread after session completes or timeslice exceeded.
protected  intgetSecurityMechanism()
     get the security mechanism (secmec value) that the server will accept connections from. the securitymechanism value.
protected  booleangetShutdown()
    
protected  ObjectgetShutdownSync()
    
protected  intgetTimeSlice()
    
protected  booleangetTraceAll()
    
protected  StringgetTraceDirectory()
    
protected static  booleanisCmd(String val)
    
public  booleanisServerStarted()
    
public  voidlogConnections(boolean on)
     Turn logging connections on or off.
public  voidnetSetMaxThreads(int max)
    
public  voidnetSetTimeSlice(int timeslice)
     Set network server connection timeslice parameter
Parameters:
  timeslice - amount of time given to each session before yielding to another session, if 0, never yield.
public  voidping()
    
protected synchronized  voidprocessCommands(DDMReader reader, DDMWriter writer, Session session)
     processCommands reads and processes NetworkServerControlImpl commands sent to the network server over the socket.
protected  voidremoveFromSessionTable(int sessionid)
    
 voidremoveThread(DRDAConnThread thread)
     Remove a thread from the thread list.
public  StringruntimeInfo()
    
public  voidsendSetTraceDirectory(String traceDirectory)
    
protected  voidsetClientLocale(String locale)
    
public  voidsetLogWriter(PrintWriter outWriter)
    
public static  voidsetUniqueThreadName(Thread thrd, String newName)
     Set a thread name to be something that is both meaningful and unique (primarily for debugging purposes). The received thread's name is set to a new string of the form [newName + "_n"], where 'n' is a unique thread id originally generated by the jvm Thread constructor.
public  voidshutdown()
    
public  voidstart(PrintWriter consoleWriter)
     Start a network server.
protected  voidstartNetworkServer()
     Load Cloudscape and save driver for future use.
protected  booleansupportsCCSID(int ccsid)
    
 booleansupportsEUSRIDPWD()
     This method returns whether EUSRIDPWD security mechanism is supported or not.
public  Stringsysinfo()
    
public  voidtrace(boolean on)
    
public  voidtrace(int connNum, boolean on)
    
public  voidusage()
    
protected  voidwriteString(String msg)
    

Field Detail
ATT_SRVNAM
final protected static String ATT_SRVNAM(Code)



CCSIDMBC
final protected static int CCSIDMBC(Code)



CCSIDSBC
final protected static int CCSIDSBC(Code)



DEFAULT_CCSID
final protected static int DEFAULT_CCSID(Code)



DEFAULT_ENCODING
final protected static String DEFAULT_ENCODING(Code)



INVALID_OR_NOTSET_SECURITYMECHANISM
final protected static int INVALID_OR_NOTSET_SECURITYMECHANISM(Code)



MGR_LEVELS
final protected static int[] MGR_LEVELS(Code)



SPACE_CHAR
final protected static byte SPACE_CHAR(Code)



UNEXPECTED_ERR
final public static String UNEXPECTED_ERR(Code)



att_extnam
protected static String att_extnam(Code)



att_srvclsnm
protected static String att_srvclsnm(Code)



att_srvrlslv
protected static String att_srvrlslv(Code)



clientLocale
public String clientLocale(Code)



cloudscapeLogWriter
protected PrintWriter cloudscapeLogWriter(Code)



debugOutput
protected boolean debugOutput(Code)



localAddresses
ArrayList localAddresses(Code)



logWriter
protected PrintWriter logWriter(Code)



prdId
protected static String prdId(Code)



prdIdBytes_
protected static byte[] prdIdBytes_(Code)




Constructor Detail
NetworkServerControlImpl
public NetworkServerControlImpl() throws Exception(Code)



NetworkServerControlImpl
public NetworkServerControlImpl(InetAddress address, int portNumber) throws Exception(Code)
Internal constructor for NetworkServerControl API.
Parameters:
  address - - InetAddress to listen on, May not be null. Throws NPE if null
Parameters:
  portNumber - - portNumber to listen on, -1 use propert or default.
throws:
  Exception - on error
See Also:   NetworkServerControl




Method Detail
addSession
void addSession(Socket clientSocket) throws Exception(Code)
Add a session - for use by ClientThread. Put the session into the session table and the run queue. Start a new DRDAConnThread if there are more sessions waiting than there are free threads, and the maximum number of threads is not exceeded.

addSession() should only be called from one thread at a time.
Parameters:
  clientSocket - the socket to read from and write to




blockingStart
public void blockingStart(PrintWriter consoleWriter) throws Exception(Code)
Start a network server
Parameters:
  consoleWriter - PrintWriter to which server console will be output. Null will disable console output.
exception:
  Exception - throws an exception if an error occurs



buildRuntimeInfo
public String buildRuntimeInfo(LocalizedResource locallangUtil)(Code)



consoleError
public void consoleError(String msg) throws Exception(Code)
Write an error message to console output stream and throw an exception for this error
Parameters:
  msg - error message
exception:
  Exception -



consoleExceptionPrint
public void consoleExceptionPrint(Exception e)(Code)
Write an exception to console output stream, but only if debugOutput is true.
Parameters:
  e - exception



consoleExceptionPrintTrace
public void consoleExceptionPrintTrace(Throwable e)(Code)
Write an exception (with trace) to console output stream.
Parameters:
  e - exception



consoleMessage
public void consoleMessage(String msg)(Code)
Write a message to console output stream
Parameters:
  msg - message



consolePropertyMessage
protected void consolePropertyMessage(String msgProp) throws Exception(Code)
Put property message on console
Parameters:
  msgProp - message property key
throws:
  Exception - if an error occurs



consolePropertyMessage
protected void consolePropertyMessage(String msgProp, String arg) throws Exception(Code)
Put property message on console
Parameters:
  msgProp - message property key
Parameters:
  arg - argument for message
throws:
  Exception - if an error occurs



consolePropertyMessage
protected void consolePropertyMessage(String msgProp, String[] args) throws Exception(Code)
Put property message on console
Parameters:
  msgProp - message property key
Parameters:
  args - argument array for message
throws:
  Exception - if an error occurs



directShutdown
public void directShutdown()(Code)



executeWork
public void executeWork(String args) throws Exception(Code)
Execute the command given on the command line
Parameters:
  args - array of arguments indicating command to be executed
exception:
  Exception - throws an exception if an error occurssee class comments for more information



getAppRequester
protected AppRequester getAppRequester(AppRequester appRequester)(Code)
Get the stored application requester or store if we haven't seen it yet
Parameters:
  appRequester - Application Requester to look for stored application requester



getCurrentProperties
public Properties getCurrentProperties() throws Exception(Code)
Get current properties Properties object containing properties
exception:
  Exception - throws an exception if an error occurs



getDriver
protected static Driver getDriver()(Code)



getKeepAlive
protected boolean getKeepAlive()(Code)
Get the current value of keepAlive to configure how long the server should keep the socket alive for a disconnected client



getLogConnections
public boolean getLogConnections()(Code)
Get the current value of logging connections true if logging connections is on; false otherwise



getManagerLevel
protected int getManagerLevel(int manager)(Code)
Get the server manager level for a given manager
Parameters:
  manager - codepoint for manager manager level



getNextSession
protected Session getNextSession(Session currentSession)(Code)
Get the next session for the thread to work on Called from DRDAConnThread after session completes or timeslice exceeded. If there is a waiting session, pick it up and put currentSession at the back of the queue if there is one.
Parameters:
  currentSession - session thread is currently working on next session to work on, could be same as current session



getSecurityMechanism
protected int getSecurityMechanism()(Code)
get the security mechanism (secmec value) that the server will accept connections from. the securitymechanism value. It is value that the derby.drda.securityMechanism was set to, if it is not set, thenit is equal to INVALID_OR_NOTSET_SECURITYMECHANISM
See Also:   Property.DRDA_PROP_SECURITYMECHANISM
See Also:   



getShutdown
protected boolean getShutdown()(Code)



getShutdownSync
protected Object getShutdownSync()(Code)



getTimeSlice
protected int getTimeSlice()(Code)
Get the current value of the time slice time slice value



getTraceAll
protected boolean getTraceAll()(Code)
Get the current value of whether to trace all the sessions true if tracing is on for all sessions; false otherwise



getTraceDirectory
protected String getTraceDirectory()(Code)
Get the current value of trace directory trace directory



isCmd
protected static boolean isCmd(String val)(Code)
Is this the command protocol
Parameters:
  val -



isServerStarted
public boolean isServerStarted() throws Exception(Code)



logConnections
public void logConnections(boolean on) throws Exception(Code)
Turn logging connections on or off. When logging is turned on a message is written to derby.log each time a connection is made.
Parameters:
  on - true to turn on, false to turn off
exception:
  Exception - throws an exception if an error occurs



netSetMaxThreads
public void netSetMaxThreads(int max) throws Exception(Code)
Connect to network server and set connection maxthread parameter
Parameters:
  max - maximum number of connections, if 0, connections created when no free connection availableif -1, use default
exception:
  Exception - throws an exception if an error occurs



netSetTimeSlice
public void netSetTimeSlice(int timeslice) throws Exception(Code)
Set network server connection timeslice parameter
Parameters:
  timeslice - amount of time given to each session before yielding to another session, if 0, never yield. if -1, use default.
exception:
  Exception - throws an exception if an error occurs



ping
public void ping() throws Exception(Code)



processCommands
protected synchronized void processCommands(DDMReader reader, DDMWriter writer, Session session) throws Throwable(Code)
processCommands reads and processes NetworkServerControlImpl commands sent to the network server over the socket. The protocol used is 4 bytes - String CMD: 2 bytes - Protocol version 1 byte - length of locale (0 for default) n bytes - locale 1 byte - length of codeset (0 for default) n bytes - codeset 1 byte - command n bytes - parameters for the command The server returns 4 bytes - String RPY: for most commands 1 byte - command result, 0 - OK, 1 - warning, 2 - error if warning or error 1 bytes - length of message key n bytes - message key 1 byte - number of parameters to message {2 bytes - length of parameter n bytes - parameter} for each parameter for sysinfo 1 byte - command result, 0 - OK, 1 - warning, 2 - error if OK 2 bytes - length of sysinfo n bytes - sysinfo Note, the 3rd byte of the command must not be 'D0' to distinquish it from DSS structures. The protocol for the parameters for each command follows: Command: trace {on | off} Protocol: 4 bytes - connection id - connection id of 0 means all sessions 1 byte - 0 off, 1 on Command: logConnections {on | off} Protocol: 1 byte - 0 off, 1 on Command: shutdown No parameters Command: sysinfo No parameters Command: dbstart Protocol: 2 bytes - length of database name n bytes - database name 2 bytes - length of boot password n bytes - boot password 2 bytes - length of encryption algorithm n bytes - encryption algorithm 2 bytes - length of encryption provider n bytes - encryption provider 2 bytes - length of user name n bytes - user name 2 bytes - length of password n bytes - password Command: dbshutdown Protocol: 2 bytes - length of database name n bytes - database name 2 bytes - length of user name n bytes - user name 2 bytes - length of password n bytes - password Command: connpool Protocol: 2 bytes - length of database name, if 0, default for all databases is set n bytes - database name 2 bytes - minimum number of connections, if 0, connection pool not used if value is -1 use default 2 bytes - maximum number of connections, if 0, connections are created as needed, if value is -1 use default Command: maxthreads Protocol: 2 bytes - maximum number of threads Command: timeslice Protocol: 4 bytes - timeslice value Command: tracedirectory Protocol: 2 bytes - length of directory name n bytes - directory name Command: test connection Protocol: 2 bytes - length of database name if 0, just the connection to the network server is tested and user name and password aren't sent n bytes - database name 2 bytes - length of user name (optional) n bytes - user name 2 bytes - length of password (optional) n bytes - password The calling routine is synchronized so that multiple threads don't clobber each other. This means that configuration commands will be serialized. This shouldn't be a problem since they should be fairly rare.
Parameters:
  reader - input reader for command
Parameters:
  writer - output writer for command
Parameters:
  session - session information
exception:
  Throwable - throws an exception if an error occurs



removeFromSessionTable
protected void removeFromSessionTable(int sessionid)(Code)
Remove session from session table
Parameters:
  sessionid - id of session to be removed



removeThread
void removeThread(DRDAConnThread thread)(Code)
Remove a thread from the thread list. Should be called when a DRDAConnThread has been closed.
Parameters:
  thread - the closed thread



runtimeInfo
public String runtimeInfo() throws Exception(Code)

See Also:   NetworkServerControl.getRuntimeInfo



sendSetTraceDirectory
public void sendSetTraceDirectory(String traceDirectory) throws Exception(Code)

See Also:   NetworkServerControl.setTraceDirectory



setClientLocale
protected void setClientLocale(String locale)(Code)



setLogWriter
public void setLogWriter(PrintWriter outWriter)(Code)
Set the output stream for console messages If this is set to null, no messages will be written to the console
Parameters:
  outWriter - output stream for console messages



setUniqueThreadName
public static void setUniqueThreadName(Thread thrd, String newName)(Code)
Set a thread name to be something that is both meaningful and unique (primarily for debugging purposes). The received thread's name is set to a new string of the form [newName + "_n"], where 'n' is a unique thread id originally generated by the jvm Thread constructor. If the default name of the thread has been changed before getting here, then nothing is done.
Parameters:
  thrd - An instance of a Thread object that still has its defaultthread name (as generated by the jvm Thread constructor). This shouldalways be of the form "Thread-N", where N is a unique thread idgenerated by the jvm. Ex. "Thread-0", "Thread-1", etc.



shutdown
public void shutdown() throws Exception(Code)
Shutdown a network server
exception:
  Exception - throws an exception if an error occurs



start
public void start(PrintWriter consoleWriter) throws Exception(Code)
Start a network server. Launches a separate thread with DRDAServerStarter. Want to use Monitor.startModule, so it can all get shutdown when cloudscape shuts down, but can't get it working right now.
Parameters:
  consoleWriter - PrintWriter to which server console will be output. Null will disable console output.
exception:
  Exception - throws an exception if an error occurs



startNetworkServer
protected void startNetworkServer() throws Exception(Code)
Load Cloudscape and save driver for future use. We can't call Driver Manager when the client connects, because they might be holding the DriverManager lock.



supportsCCSID
protected boolean supportsCCSID(int ccsid)(Code)
Check whether a CCSID code page is supported
Parameters:
  ccsid - CCSID to check true if supported; false otherwise



supportsEUSRIDPWD
boolean supportsEUSRIDPWD()(Code)
This method returns whether EUSRIDPWD security mechanism is supported or not. See class static block for more info. true if EUSRIDPWD is supported, false otherwise



sysinfo
public String sysinfo() throws Exception(Code)

See Also:   NetworkServerControl.getSysinfo



trace
public void trace(boolean on) throws Exception(Code)
Turn tracing on or off for all sessions
Parameters:
  on - true to turn tracing on, false to turn tracing off
exception:
  Exception - throws an exception if an error occurs



trace
public void trace(int connNum, boolean on) throws Exception(Code)
Turn tracing on or off for one session or all sessions
Parameters:
  connNum - the connNum of the session, 0 if all sessions
Parameters:
  on - true to turn tracing on, false to turn tracing off
exception:
  Exception - throws an exception if an error occurs



usage
public void usage()(Code)
Display usage information



writeString
protected void writeString(String msg) throws Exception(Code)
Write string
Parameters:
  msg - String to write



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.