/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @author Ken Cavanaugh
* @since JDK1.2
*/
public class ServerMain
{
/* TODO:
* 1. Rewrite all uses of ORB properties to use constants from someplace.
* The strings are scattered between here, the ORB classes, and
* ServerTableEntry.
* 2. Consider a more general log facility.
* 3. Remove ServerCallback from POAORB.
* 4. Needs to be merged with Harold's changes to support SSL.
* 5. Logs need to be internationalized.
*/
{
switch (result) {
case OK : return "Server terminated normally" ;
case MAIN_CLASS_NOT_FOUND : return "main class not found" ;
case NO_MAIN_METHOD : return "no main method" ;
case APPLICATION_ERROR : return "application error" ;
case NO_SERVER_ID : return "server ID not defined" ;
case REGISTRATION_FAILED: return "server registration failed" ;
default : return "unknown error" ;
}
}
private void redirectIOStreams()
{
// redirect out and err streams
try {
logInformation( "Server started" ) ;
}
/** Write a time-stamped message to the indicated PrintStream.
*/
{
}
/** Write information to standard out only.
*/
{
}
/** Write error message to standard out and standard err.
*/
{
}
/** Write final message to log(s) and then terminate by calling
* System.exit( code ). If code == OK, write a normal termination
* message to standard out, otherwise write an abnormal termination
* message to standard out and standard error.
*/
{
if (code == 0) {
} else {
}
}
{
try {
}
if (!isPublicStaticVoid( method ))
return method ;
}
{
// check modifiers: public static
return false ;
}
// check return type and exceptions
return false ;
}
return false ;
}
return true ;
}
{
try {
return null ;
}
if (!isPublicStaticVoid( method ))
return null ;
return method ;
}
{
try {
// determine the class loader to be used for loading the class
// since ServerMain is going to be in JDK and we need to have this
// class to load application classes, this is required here.
// determine the main class
try {
// determine the main class, try loading with current class loader
} catch (ClassNotFoundException ex) {
// eat the exception and try to load using SystemClassLoader
}
if (debug)
// get the main method
// This piece of code is required, to verify the server definition
// without launching it.
// verify the server
if (serverVerifyFlag) {
if (mainMethod == null)
else {
if (debug)
}
}
// build args to the main and call it
} catch (ClassNotFoundException e) {
} catch (Exception e) {
}
}
}
private static final boolean debug = false;
private int getServerId()
{
}
{
"com.sun.corba.se.impl.orb.ORBImpl" ) ;
// NOTE: Very important to pass this property, otherwise the
// Persistent Server registration will be unsucessfull.
int serverId = getServerId() ;
try {
}
}
}
class ServerCallback extends
{
{
this.installMethod = installMethod ;
this.uninstallMethod = uninstallMethod ;
this.shutdownMethod = shutdownMethod ;
}
{
try {
}
}
// shutdown the ORB and wait for completion
public void shutdown()
{
}
public void install()
{
}
public void uninstall()
{
}
}