com.sun.corba.se.impl.orbutil.CorbaResourceUtil Java Examples

The following examples show how to use com.sun.corba.se.impl.orbutil.CorbaResourceUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NameServer.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example #2
Source File: ServerTool.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
void printAvailableCommands()
{
    CommandHandler handler;

    // print short help
    System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));

    for (int i=0; i < handlers.size(); i++) {
        handler = (CommandHandler) handlers.elementAt(i);
        System.out.print("\t" + handler.getCommandName());
        for (int j=handler.getCommandName().length();
             j < maxNameLen; j++) System.out.print(" ");
        System.out.print(" - ");
        handler.printCommandHelp(System.out,
                                 CommandHandler.shortHelp);
    }

    System.out.println();
}
 
Example #3
Source File: ServerTool.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void printAvailableCommands()
{
    CommandHandler handler;

    // print short help
    System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));

    for (int i=0; i < handlers.size(); i++) {
        handler = (CommandHandler) handlers.elementAt(i);
        System.out.print("\t" + handler.getCommandName());
        for (int j=handler.getCommandName().length();
             j < maxNameLen; j++) System.out.print(" ");
        System.out.print(" - ");
        handler.printCommandHelp(System.out,
                                 CommandHandler.shortHelp);
    }

    System.out.println();
}
 
Example #4
Source File: ServerTool.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void printAvailableCommands()
{
    CommandHandler handler;

    // print short help
    System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));

    for (int i=0; i < handlers.size(); i++) {
        handler = (CommandHandler) handlers.elementAt(i);
        System.out.print("\t" + handler.getCommandName());
        for (int j=handler.getCommandName().length();
             j < maxNameLen; j++) System.out.print(" ");
        System.out.print(" - ");
        handler.printCommandHelp(System.out,
                                 CommandHandler.shortHelp);
    }

    System.out.println();
}
 
Example #5
Source File: ServerTool.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
void printAvailableCommands()
{
    CommandHandler handler;

    // print short help
    System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));

    for (int i=0; i < handlers.size(); i++) {
        handler = (CommandHandler) handlers.elementAt(i);
        System.out.print("\t" + handler.getCommandName());
        for (int j=handler.getCommandName().length();
             j < maxNameLen; j++) System.out.print(" ");
        System.out.print(" - ");
        handler.printCommandHelp(System.out,
                                 CommandHandler.shortHelp);
    }

    System.out.println();
}
 
Example #6
Source File: NameServer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example #7
Source File: ServerTool.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean processCommand( String[] cmdArgs, ORB orb, PrintStream out )
{
    if ((cmdArgs.length == 2) && cmdArgs[0].equals( "-applicationName" )) {
        String str = (String)cmdArgs[1] ;

        try {
            Repository repository = RepositoryHelper.narrow(
                orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

            try {
                int result = repository.getServerID( str ) ;
                out.println() ;
                out.println(CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
                out.println() ;
            } catch (ServerNotRegistered e) {
                out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
            }
        } catch (Exception ex) {
            ex.printStackTrace() ;
        }

        return commandDone ;
    } else
        return parseError ;
}
 
Example #8
Source File: ServerTool.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public boolean processCommand( String[] cmdArgs, ORB orb, PrintStream out )
{
    if ((cmdArgs.length == 2) && cmdArgs[0].equals( "-applicationName" )) {
        String str = (String)cmdArgs[1] ;

        try {
            Repository repository = RepositoryHelper.narrow(
                orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

            try {
                int result = repository.getServerID( str ) ;
                out.println() ;
                out.println(CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
                out.println() ;
            } catch (ServerNotRegistered e) {
                out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
            }
        } catch (Exception ex) {
            ex.printStackTrace() ;
        }

        return commandDone ;
    } else
        return parseError ;
}
 
Example #9
Source File: NameServer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example #10
Source File: NameServer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example #11
Source File: ServerTool.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void printAvailableCommands()
{
    CommandHandler handler;

    // print short help
    System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));

    for (int i=0; i < handlers.size(); i++) {
        handler = (CommandHandler) handlers.elementAt(i);
        System.out.print("\t" + handler.getCommandName());
        for (int j=handler.getCommandName().length();
             j < maxNameLen; j++) System.out.print(" ");
        System.out.print(" - ");
        handler.printCommandHelp(System.out,
                                 CommandHandler.shortHelp);
    }

    System.out.println();
}
 
Example #12
Source File: ServerTool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.quit"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.quit1"));
    }
}
 
Example #13
Source File: ServerTool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.register"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.register1"));
    }
}
 
Example #14
Source File: ServerTool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.help"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.help1"));
    }
}
 
Example #15
Source File: ServerTool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.shutdown"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.shutdown1"));
    }
}
 
Example #16
Source File: ServerTool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.startserver"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.startserver1"));
    }
}
 
Example #17
Source File: ServerTool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.locate"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.locate1"));
    }
}
 
Example #18
Source File: ServerTool.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
String[] readCommand(BufferedReader in)
{
    System.out.print(toolName + " > ");

    try {
        int i = 0;
        String cmd[] = null;

        String cmdLine = in.readLine();

        if (cmdLine != null) {
            StringTokenizer st = new StringTokenizer(cmdLine);
            if (st.countTokens() != 0) {
                cmd = new String[st.countTokens()];
                while (st.hasMoreTokens()) cmd[i++] = st.nextToken();
            }
        }

        return cmd;
    } catch (Exception ex) {
        System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
        System.out.println();
        ex.printStackTrace();
    }

    return null;
}
 
Example #19
Source File: ServerTool.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
static void printServerDef(ServerDef serverDef, int serverId,
                           PrintStream out)
{
    out.println(CorbaResourceUtil.getText("servertool.appname", serverDef.applicationName));
    out.println(CorbaResourceUtil.getText("servertool.name", serverDef.serverName));
    out.println(CorbaResourceUtil.getText("servertool.classpath", serverDef.serverClassPath));
    out.println(CorbaResourceUtil.getText("servertool.args", serverDef.serverArgs));
    out.println(CorbaResourceUtil.getText("servertool.vmargs", serverDef.serverVmArgs));
    out.println(CorbaResourceUtil.getText("servertool.serverid", serverId));
}
 
Example #20
Source File: ServerTool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp( PrintStream out, boolean helpType )
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.getserverid"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.getserverid1"));
    }
}
 
Example #21
Source File: ServerTool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.locateorb"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.locateorb1"));
    }
}
 
Example #22
Source File: ServerTool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static void printServerDef(ServerDef serverDef, int serverId,
                           PrintStream out)
{
    out.println(CorbaResourceUtil.getText("servertool.appname", serverDef.applicationName));
    out.println(CorbaResourceUtil.getText("servertool.name", serverDef.serverName));
    out.println(CorbaResourceUtil.getText("servertool.classpath", serverDef.serverClassPath));
    out.println(CorbaResourceUtil.getText("servertool.args", serverDef.serverArgs));
    out.println(CorbaResourceUtil.getText("servertool.vmargs", serverDef.serverVmArgs));
    out.println(CorbaResourceUtil.getText("servertool.serverid", serverId));
}
 
Example #23
Source File: ServerTool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.locateorb"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.locateorb1"));
    }
}
 
Example #24
Source File: ServerTool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.orbidmap"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.orbidmap1"));
    }
}
 
Example #25
Source File: ServerTool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.quit"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.quit1"));
    }
}
 
Example #26
Source File: ServerTool.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
{
    ServerDef serverDef;

    // process the list active servers command
    try {
        Repository repository = RepositoryHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

        Activator activator = ActivatorHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));

        int[] servers = activator.getActiveServers();

        out.println(CorbaResourceUtil.getText("servertool.list2"));

        ListServers.sortServers(servers);
        for (int i=0; i < servers.length; i++) {
            try {
                serverDef = repository.getServer(servers[i]);
                out.println("\t   " + servers[i] + "\t\t" +
                            serverDef.serverName + "\t\t" +
                            serverDef.applicationName);
            } catch (ServerNotRegistered e) {}
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    return commandDone;
}
 
Example #27
Source File: ServerTool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.shutdown"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.shutdown1"));
    }
}
 
Example #28
Source File: ServerTool.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.quit"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.quit1"));
    }
}
 
Example #29
Source File: ServerTool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void printCommandHelp(PrintStream out, boolean helpType)
{
    if (helpType == longHelp) {
        out.println(CorbaResourceUtil.getText("servertool.listappnames"));
    } else {
        out.println(CorbaResourceUtil.getText("servertool.listappnames1"));
    }
}
 
Example #30
Source File: ServerTool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
{
    ServerDef serverDef;

    // process the list active servers command
    try {
        Repository repository = RepositoryHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

        Activator activator = ActivatorHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));

        int[] servers = activator.getActiveServers();

        out.println(CorbaResourceUtil.getText("servertool.list2"));

        ListServers.sortServers(servers);
        for (int i=0; i < servers.length; i++) {
            try {
                serverDef = repository.getServer(servers[i]);
                out.println("\t   " + servers[i] + "\t\t" +
                            serverDef.serverName + "\t\t" +
                            serverDef.applicationName);
            } catch (ServerNotRegistered e) {}
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    return commandDone;
}