Example usage for java.net InetAddress getLocalHost

List of usage examples for java.net InetAddress getLocalHost

Introduction

In this page you can find the example usage for java.net InetAddress getLocalHost.

Prototype

public static InetAddress getLocalHost() throws UnknownHostException 

Source Link

Document

Returns the address of the local host.

Usage

From source file:examples.unix.finger.java

public static void main(String[] args) {
    boolean longOutput = false;
    int arg = 0, index;
    String handle, host;//from   w  ww  . j  a  v a 2s  .c o  m
    FingerClient finger;
    InetAddress address = null;

    // Get flags.  If an invalid flag is present, exit with usage message.
    while (arg < args.length && args[arg].startsWith("-")) {
        if (args[arg].equals("-l")) {
            longOutput = true;
        } else {
            System.err.println("usage: finger [-l] [[[handle][@<server>]] ...]");
            System.exit(1);
        }
        ++arg;
    }

    finger = new FingerClient();
    // We want to timeout if a response takes longer than 60 seconds
    finger.setDefaultTimeout(60000);

    if (arg >= args.length) {
        // Finger local host

        try {
            address = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            System.err.println("Error unknown host: " + e.getMessage());
            System.exit(1);
        }

        try {
            finger.connect(address);
            System.out.print(finger.query(longOutput));
            finger.disconnect();
        } catch (IOException e) {
            System.err.println("Error I/O exception: " + e.getMessage());
            System.exit(1);
        }

        return;
    }

    // Finger each argument
    while (arg < args.length) {

        index = args[arg].lastIndexOf("@");

        if (index == -1) {
            handle = args[arg];
            try {
                address = InetAddress.getLocalHost();
            } catch (UnknownHostException e) {
                System.err.println("Error unknown host: " + e.getMessage());
                System.exit(1);
            }
        } else {
            handle = args[arg].substring(0, index);
            host = args[arg].substring(index + 1);

            try {
                address = InetAddress.getByName(host);
                System.out.println("[" + address.getHostName() + "]");
            } catch (UnknownHostException e) {
                System.err.println("Error unknown host: " + e.getMessage());
                System.exit(1);
            }
        }

        try {
            finger.connect(address);
            System.out.print(finger.query(longOutput, handle));
            finger.disconnect();
        } catch (IOException e) {
            System.err.println("Error I/O exception: " + e.getMessage());
            System.exit(1);
        }

        ++arg;
        if (arg != args.length) {
            System.out.print("\n");
        }
    }
}

From source file:SendMail.java

public static void main(String[] args) {
    try {/*from   w  ww  . j ava  2  s  .  c o m*/
        // If the user specified a mailhost, tell the system about it.
        if (args.length >= 1)
            System.getProperties().put("mail.host", args[0]);

        // A Reader stream to read from the console
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        // Ask the user for the from, to, and subject lines
        System.out.print("From: ");
        String from = in.readLine();
        System.out.print("To: ");
        String to = in.readLine();
        System.out.print("Subject: ");
        String subject = in.readLine();

        // Establish a network connection for sending mail
        URL u = new URL("mailto:" + to); // Create a mailto: URL
        URLConnection c = u.openConnection(); // Create its URLConnection
        c.setDoInput(false); // Specify no input from it
        c.setDoOutput(true); // Specify we'll do output
        System.out.println("Connecting..."); // Tell the user
        System.out.flush(); // Tell them right now
        c.connect(); // Connect to mail host
        PrintWriter out = // Get output stream to host
                new PrintWriter(new OutputStreamWriter(c.getOutputStream()));

        // We're talking to the SMTP server now.
        // Write out mail headers. Don't let users fake the From address
        out.print("From: \"" + from + "\" <" + System.getProperty("user.name") + "@"
                + InetAddress.getLocalHost().getHostName() + ">\r\n");
        out.print("To: " + to + "\r\n");
        out.print("Subject: " + subject + "\r\n");
        out.print("\r\n"); // blank line to end the list of headers

        // Now ask the user to enter the body of the message
        System.out.println("Enter the message. " + "End with a '.' on a line by itself.");
        // Read message line by line and send it out.
        String line;
        for (;;) {
            line = in.readLine();
            if ((line == null) || line.equals("."))
                break;
            out.print(line + "\r\n");
        }

        // Close (and flush) the stream to terminate the message
        out.close();
        // Tell the user it was successfully sent.
        System.out.println("Message sent.");
    } catch (Exception e) { // Handle any exceptions, print error message.
        System.err.println(e);
        System.err.println("Usage: java SendMail [<mailhost>]");
    }
}

From source file:com.pivotal.gemfire.tools.pulse.testbed.driver.TomcatHelper.java

public static void main(String[] args) throws Exception {
    String host = InetAddress.getLocalHost().getHostAddress();
    int port = 8080;
    String path = "/tushark1/code-checkout/tools/Pulse/trunk/build-artifacts/linux/dist/pulse-7.0.1.RC1.war";
    String context = "/pulse";
    System.setProperty("pulse.propMockDataUpdaterClass",
            "com.pivotal.gemfire.tools.pulse.testbed.PropMockDataUpdater");
    Tomcat tomcat = TomcatHelper.startTomcat("localhost", port, context, path);
    Thread.sleep(30000);/*from w w  w  .j  av  a2 s.  c  o  m*/
    System.out.println("Sleep completed");
    System.out.println("Exiting ....");
    tomcat.stop();
    tomcat.destroy();
}

From source file:com.pivotal.gemfire.tools.pulse.tests.TomcatHelper.java

public static void main(String[] args) throws Exception {
    String host = InetAddress.getLocalHost().getHostAddress();
    int port = 9090;
    String path = "D:/springsource/springsourceWS/VMware-Pulse-cheetah-dev-jun13/build-artifacts/win/dist/pulse-7.0.1.war";
    String context = "/pulse";
    System.setProperty("pulse.propMockDataUpdaterClass",
            "com.pivotal.gemfire.tools.pulse.testbed.PropMockDataUpdater");
    Tomcat tomcat = TomcatHelper.startTomcat("localhost", port, context, path);
    Thread.sleep(30000);//w ww. ja va 2 s  .  com
    System.out.println("Sleep completed");
    System.out.println("Exiting ....");
    tomcat.stop();
    tomcat.destroy();
}

From source file:com.pinterest.pinlater.PinLaterServer.java

public static void main(String[] args) {
    try {//from w ww.  j  av a 2  s .  com
        String serverHostName = InetAddress.getLocalHost().getHostName();
        PinLaterQueueConfig queueConfig = new PinLaterQueueConfig(CONFIGURATION);
        queueConfig.initialize();
        String backend = CONFIGURATION.getString("PINLATER_BACKEND");
        PinLaterBackendIface backendIFace = getBackendIface(backend, serverHostName);
        PinLaterServiceImpl serviceImpl = new PinLaterServiceImpl(backendIFace, queueConfig);
        PinLater.Service service = new PinLater.Service(serviceImpl, new TBinaryProtocol.Factory());
        ServiceShutdownHook.register(ServerBuilder.safeBuild(service,
                ServerBuilder.get().name("PinLaterService").codec(ThriftServerFramedCodec.get())
                        .hostConnectionMaxIdleTime(Duration.fromTimeUnit(
                                CONFIGURATION.getInt("SERVER_CONN_MAX_IDLE_TIME_MINUTES"), TimeUnit.MINUTES))
                        .maxConcurrentRequests(CONFIGURATION.getInt("MAX_CONCURRENT_REQUESTS"))
                        .reportTo(new OstrichStatsReceiver(Stats.get("")))
                        .bindTo(new InetSocketAddress(CONFIGURATION.getInt("THRIFT_PORT")))));
        new OstrichAdminService(CONFIGURATION.getInt("OSTRICH_PORT")).start();

        LOG.info("\n#######################################" + "\n#      Ready To Serve Requests.       #"
                + "\n#######################################");
    } catch (Exception e) {
        LOG.error("Failed to start the pinlater server", e);
        System.exit(1);
    }
}

From source file:implementation.java

public static void main(String[] args) throws IOException {
    // Network Variables
    KUSOCKET ClientSocket = new KUSOCKET();
    ENDPOINT ClientAddress = new ENDPOINT("0.0.0.0", 0);
    ENDPOINT BroadcastAddress = new ENDPOINT("255.255.255.255", TokenAccess.SERVER_PORT_NUMBER);
    ENDPOINT AnyAddress = new ENDPOINT("0.0.0.0", 0);

    ENDPOINT ServerAddress = new ENDPOINT();
    MESSAGE OutgoingMessage = new MESSAGE();
    MESSAGE IncomingMessage = new MESSAGE();

    // Output variables         
    int CommentLength = TokenAccess.COMMENT_LENGTH;
    String Comment = new String();

    // Protocol variables
    Timer firstnode = new Timer();
    Timer tokentimer = new Timer();
    Timer tokenlost = new Timer();
    Timer exit = new Timer();
    int DialogueNumber = 0;
    int numRetries = 0;
    Integer addressIP[] = new Integer[2];
    int trigger = 0;
    String lanAddress = "192.168.1.67";
    // Create socket and await connection ///////////////////////////////////////

    // --------------------------------------------------------------------------
    // FINITE STATE MACHINE
    // --------------------------------------------------------------------------

    System.err.println("FSM Started ===================" + '\n');

    // FSM variables
    TokenAccess.STATES state = TokenAccess.STATES.STATE_INITIAL; // Initial STATE
    TokenAccess.STATES lastState = state; // Last STATE
    boolean bContinueEventWait = false;
    boolean bContinueStateLoop = true;
    String last = null;/*from   ww w .j a  v a 2 s . c  o  m*/
    ClientSocket.CreateUDPSocket(ClientAddress);
    while (bContinueStateLoop) {

        switch (state) {
        case STATE_INITIAL:

            firstnode.Start(TokenAccess.firstnode);
            state = TokenAccess.STATES.STATE_STARTED;
            bContinueEventWait = false; // Stop Events loop
            break;

        case STATE_STARTED:

            ClientSocket.MakeConnection(AnyAddress);

            if (firstnode.isExpired()) {
                tokentimer.Start(TokenAccess.tokentimer);

                System.out.println("implementation.main()");
                // adding  local host ip to array
                String t = InetAddress.getLocalHost().getHostAddress();
                String[] split = t.split("\\.");
                addressIP[0] = Integer.parseInt(split[3]);
                System.out.println(split[3]);
                state = TokenAccess.STATES.STATE_TOKENED;
                bContinueEventWait = false;// Stop Events loop

            }
            boolean isMessageQueued = false;

            isMessageQueued = ClientSocket.RetrieveQueuedMessage(TokenAccess.READ_INTERVAL, IncomingMessage,
                    ServerAddress);

            if (isMessageQueued && (IncomingMessage.Type == TokenAccess.PDU_CONNECT)) {
                System.out.println("ring exists");
                //pdu_connect used instead of ring exisits 
                state = TokenAccess.STATES.STATE_tokenLess;
                bContinueEventWait = false;

            }

        case STATE_tokenLess:
            ClientSocket.MakeConnection(AnyAddress);
            while (state == TokenAccess.STATES.STATE_tokenLess) {
                // Instructs the socket to accept

                // building ip address message
                OutgoingMessage.BuildMessage(++DialogueNumber, TokenAccess.PDU_CONNECT,
                        InetAddress.getLocalHost().getHostAddress(),
                        InetAddress.getLocalHost().getHostAddress().length());
                //broadcasting ip address
                ClientSocket.DeliverMessage(OutgoingMessage, BroadcastAddress);
                //     System.out.println("broadcasting address");

                isMessageQueued = ClientSocket.RetrieveQueuedMessage(TokenAccess.READ_INTERVAL, IncomingMessage,
                        ServerAddress);

                //will trigger if used on a 192 network i didnt know how to use regex for any number and a dot
                if (isMessageQueued == true && (IncomingMessage.Type == TokenAccess.PDU_CLOSE)) {
                    System.out.println("pdu close");
                    String ipaddress = IncomingMessage.Buffer;

                    for (int n : addressIP) {
                        if (addressIP[n] == Integer.parseInt(ipaddress)) {
                            String a;
                            a = Integer.toString(addressIP[n]);
                            OutgoingMessage.BuildMessage(++DialogueNumber, TokenAccess.PDU_ACK,
                                    InetAddress.getLocalHost().getHostAddress(),
                                    InetAddress.getLocalHost().getHostAddress().length());
                            ENDPOINT exitAddress = new ENDPOINT(a, TokenAccess.SERVER_PORT_NUMBER);

                            ClientSocket.DeliverMessage(OutgoingMessage, exitAddress);
                            addressIP = ArrayUtils.removeElement(addressIP, n);
                        }

                    }
                }

                if (last != null && tokenlost.bRunning == false) {
                    tokenlost.Start(TokenAccess.tokenlost);
                    last = null;
                    System.out.println("token lost timer started");
                }

                if (isMessageQueued == true && (IncomingMessage.Type == TokenAccess.CMD_CONNECT)) {
                    System.out.println("token lost timer stopped");
                    tokenlost.Stop();
                }

                if (tokenlost.isExpired()) {

                    System.out.println("token lost");

                    for (int n = 0; n < addressIP.length; n++) {
                        String ipaddress = InetAddress.getLocalHost().toString();
                        int lastdot = ipaddress.lastIndexOf(".") + 1;
                        ipaddress = ipaddress.substring(lastdot, ipaddress.length());
                        System.out.println(n);
                        if (addressIP[n] == null) {

                        } else {
                            if (addressIP[n] == Integer.parseInt(ipaddress)) {

                                String a;
                                a = Integer.toString(addressIP[n]);
                                System.out.println("variable a " + a);
                                OutgoingMessage.BuildMessage(++DialogueNumber, TokenAccess.PDU_ACK,
                                        InetAddress.getLocalHost().getHostAddress(),
                                        InetAddress.getLocalHost().getHostAddress().length());
                                ENDPOINT exitAddress = new ENDPOINT(lanAddress, TokenAccess.SERVER_PORT_NUMBER);

                                ClientSocket.DeliverMessage(OutgoingMessage, exitAddress);

                                OutgoingMessage.BuildMessage(++DialogueNumber, TokenAccess.PDU_TOKEN,
                                        InetAddress.getLocalHost().getHostAddress(),
                                        InetAddress.getLocalHost().getHostAddress().length());
                                String b = Integer.toString(addressIP[n]);
                                b = lanAddress;
                                System.out.println(b);

                                ENDPOINT exitAddresss = new ENDPOINT(b, TokenAccess.SERVER_PORT_NUMBER);
                                ClientSocket.DeliverMessage(OutgoingMessage, exitAddresss);

                            }
                        }
                    }

                }

                if (exit.isExpired()) {
                    OutgoingMessage.BuildMessage(++DialogueNumber, TokenAccess.PDU_CLOSE,
                            InetAddress.getLocalHost().getHostAddress(),
                            InetAddress.getLocalHost().getHostAddress().length());
                    exit.Start(30);
                }

                if (isMessageQueued && (IncomingMessage.Type == TokenAccess.PDU_TOKEN)) {
                    tokenlost.Stop();
                    System.out.println(IncomingMessage.Type);
                    state = TokenAccess.STATES.STATE_TOKENED;
                    tokentimer.Start(TokenAccess.tokentimer);
                    break;
                }

            }

        case STATE_TOKENED:
            while (state == TokenAccess.STATES.STATE_TOKENED) {

                //send data
                OutgoingMessage.BuildMessage(0, 0, "ALIVE", CommentLength);
                ClientSocket.DeliverMessage(OutgoingMessage, BroadcastAddress);
                tokenlost.Stop();
                while (trigger == 0) {
                    System.out.println("TOKENED");
                    trigger++;
                }

                if (tokentimer.isExpired()) {
                    trigger = 0;
                    System.out.println("token expired");
                    String ipaddress = InetAddress.getLocalHost().toString();
                    //  System.out.println( "System name : "+ipaddress);

                    for (int n = 0; n < addressIP.length; n++) {
                        // System.out.println(n);
                        int lastdot = ipaddress.lastIndexOf(".") + 1;
                        ipaddress = ipaddress.substring(lastdot, ipaddress.length());
                        // System.out.println("IP address: "+ipaddress);
                        int address1 = Integer.parseInt(ipaddress);

                        System.out.println("made it to line 214");
                        System.out.println(n);
                        System.out.println(addressIP[0]);

                        if (addressIP[n] == address1) {
                            String a;
                            a = Integer.toString(addressIP[n]);
                            System.out.println("variable a = " + a);

                            String ip = InetAddress.getLocalHost().getHostAddress();
                            System.out.println("line 226");
                            System.out.println(ip);

                            OutgoingMessage.BuildMessage(++DialogueNumber, TokenAccess.PDU_TOKEN,
                                    InetAddress.getLocalHost().getHostAddress(),
                                    InetAddress.getLocalHost().getHostAddress().length());
                            String b;

                            System.out.println("line 222");
                            if (n + 1 >= addressIP.length) {
                                b = (ip);
                                //   System.out.println(b);
                            } else {
                                b = ip;

                            }

                            System.out.println(b);

                            //b = InetAddress.getLocalHost().toString().substring(0, lastdot); 
                            // int slash =   b.indexOf("/");
                            System.out.println(b);
                            ENDPOINT exitAddresss = new ENDPOINT(b, TokenAccess.SERVER_PORT_NUMBER);
                            ClientSocket.DeliverMessage(OutgoingMessage, exitAddresss);
                            System.out.println("exiting tokened state");
                            state = TokenAccess.STATES.STATE_tokenLess;
                            last = "1";
                        }
                        break;
                    }
                }
            }

        case STATE_EXIT:
            while (state == TokenAccess.STATES.STATE_EXIT) {
                System.exit(0);

            }

        }

    }

}

From source file:fi.helsinki.opintoni.Application.java

/**
 * Main method, used to run the application.
 *//*from  www  . ja  v  a  2  s .  c o  m*/
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(Application.class);
    app.setBannerMode(Banner.Mode.OFF);

    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);

    // Check if the selected profile has been set as argument.
    // if not the development profile will be added
    addDefaultProfile(app, source);
    addLiquibaseScanPackages();
    Environment env = app.run(args).getEnvironment();
    log.info(
            "Access URLs:\n----------------------------------------------------------\n\t"
                    + "Local: \t\thttp://127.0.0.1:{}\n\t"
                    + "External: \thttp://{}:{}\n----------------------------------------------------------",
            env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(),
            env.getProperty("server.port"));

}

From source file:com.aan.girsang.client.launcher.ClientLauncher.java

public static void main(String[] args) throws Exception {

    BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow;
    org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF();
    UIManager.put("RootPane.setupButtonVisible", Boolean.FALSE);

    try {// w  w  w.jav a2  s.  co m
        AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("clientContext.xml");
        ctx.registerShutdownHook();

        constantService = (ConstantService) ctx.getBean("constantServiceRemote");
        securityService = (SecurityService) ctx.getBean("securityServiceRemote");
        masterService = (MasterService) ctx.getBean("masterServiceRemote");
        transaksiService = (TransaksiService) ctx.getBean("transaksiServiceRemote");
        reportService = (ReportService) ctx.getBean("reportServiceRemote");
        String computerName = InetAddress.getLocalHost().getHostName();

        constantService.clientOnline(computerName);
    } catch (RemoteConnectFailureException ex) {
        String status = "Server Offline";
        ex.printStackTrace();
        log.info(ex.getMessage());
        JOptionPane.showMessageDialog(null, status);
        System.exit(0);
    }
    log.info("Client Online");

    java.awt.EventQueue.invokeLater(() -> {
        FrameUtama fu = new FrameUtama();
        fu.setExtendedState(JFrame.MAXIMIZED_BOTH);
        fu.setVisible(true);
        fu.jam();
    });
}

From source file:awskinesis.AmazonKinesisApplicationSample.java

public static void main(String[] args) throws Exception {
    init();/*from   w  w  w.ja  va2s  .c o m*/

    if (args.length == 1 && "delete-resources".equals(args[0])) {
        deleteResources();
        return;
    }

    String workerId = InetAddress.getLocalHost().getCanonicalHostName() + ":" + UUID.randomUUID();
    KinesisClientLibConfiguration kinesisClientLibConfiguration = new KinesisClientLibConfiguration(
            SAMPLE_APPLICATION_NAME, SAMPLE_APPLICATION_STREAM_NAME, credentialsProvider, workerId)
                    .withRegionName("cn-north-1");
    kinesisClientLibConfiguration.withInitialPositionInStream(SAMPLE_APPLICATION_INITIAL_POSITION_IN_STREAM);

    IRecordProcessorFactory recordProcessorFactory = new AmazonKinesisApplicationRecordProcessorFactory();
    final Worker worker = new Worker(recordProcessorFactory, kinesisClientLibConfiguration);

    System.out.printf("Running %s to process stream %s as worker %s...\n", SAMPLE_APPLICATION_NAME,
            SAMPLE_APPLICATION_STREAM_NAME, workerId);

    int exitCode = 0;
    try {
        worker.run();
    } catch (Throwable t) {
        System.err.println("Caught throwable while processing data.");
        t.printStackTrace();
        exitCode = 1;
    }

    // add a shutdown hook to stop the server
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        @Override
        public void run() {
            LOG.info("########### shoutdown begin....");
            worker.shutdown();

            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            LOG.info("########### shoutdown end....");
        }
    }));

    System.exit(exitCode);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwingHttpCLI.CFAsteriskSwingHttpCLI.java

public static void main(String args[]) {
    final String S_ProcName = "CFAsteriskSwingHttpCLI.main() ";
    initConsoleLog();// w  w  w .  ja  v a 2s .  co m
    boolean fastExit = false;

    String homeDirName = System.getProperty("HOME");
    if (homeDirName == null) {
        homeDirName = System.getProperty("user.home");
        if (homeDirName == null) {
            log.message(S_ProcName + "ERROR: Home directory not set");
            return;
        }
    }
    File homeDir = new File(homeDirName);
    if (!homeDir.exists()) {
        log.message(S_ProcName + "ERROR: Home directory \"" + homeDirName + "\" does not exist");
        return;
    }
    if (!homeDir.isDirectory()) {
        log.message(S_ProcName + "ERROR: Home directory \"" + homeDirName + "\" is not a directory");
        return;
    }

    CFAsteriskClientConfigurationFile cFAsteriskClientConfig = new CFAsteriskClientConfigurationFile();
    String cFAsteriskClientConfigFileName = homeDir.getPath() + File.separator + ".cfasteriskclientrc";
    cFAsteriskClientConfig.setFileName(cFAsteriskClientConfigFileName);
    File cFAsteriskClientConfigFile = new File(cFAsteriskClientConfigFileName);
    if (!cFAsteriskClientConfigFile.exists()) {
        String cFAsteriskKeyStoreFileName = homeDir.getPath() + File.separator + ".msscfjceks";
        cFAsteriskClientConfig.setKeyStore(cFAsteriskKeyStoreFileName);
        InetAddress localHost;
        try {
            localHost = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            localHost = null;
        }
        if (localHost == null) {
            log.message(S_ProcName + "ERROR: LocalHost is null");
            return;
        }
        String hostName = localHost.getHostName();
        if ((hostName == null) || (hostName.length() <= 0)) {
            log.message("ERROR: LocalHost.HostName is null or empty");
            return;
        }
        String userName = System.getProperty("user.name");
        if ((userName == null) || (userName.length() <= 0)) {
            log.message("ERROR: user.name is null or empty");
            return;
        }
        String deviceName = hostName.replaceAll("[^\\w]", "_").toLowerCase() + "-"
                + userName.replaceAll("[^\\w]", "_").toLowerCase();
        cFAsteriskClientConfig.setDeviceName(deviceName);
        cFAsteriskClientConfig.save();
        log.message(S_ProcName + "INFO: Created CFAsterisk client configuration file "
                + cFAsteriskClientConfigFileName);
        fastExit = true;
    }
    if (!cFAsteriskClientConfigFile.isFile()) {
        log.message(S_ProcName + "ERROR: Proposed client configuration file " + cFAsteriskClientConfigFileName
                + " is not a file.");
        fastExit = true;
    }
    if (!cFAsteriskClientConfigFile.canRead()) {
        log.message(S_ProcName + "ERROR: Permission denied attempting to read client configuration file "
                + cFAsteriskClientConfigFileName);
        fastExit = true;
    }
    cFAsteriskClientConfig.load();

    if (fastExit) {
        return;
    }

    // Configure logging
    Properties sysProps = System.getProperties();
    sysProps.setProperty("log4j.rootCategory", "WARN");
    sysProps.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger");

    Logger httpLogger = Logger.getLogger("org.apache.http");
    httpLogger.setLevel(Level.WARN);

    // The Invoker and it's implementation
    CFAsteriskXMsgClientHttpSchema invoker = new CFAsteriskXMsgClientHttpSchema();

    // And now for the client side cache implementation that invokes it
    ICFAsteriskSchemaObj clientSchemaObj = new CFAsteriskSchemaObj() {
        public void logout() {
            CFAsteriskXMsgClientHttpSchema invoker = (CFAsteriskXMsgClientHttpSchema) getBackingStore();
            try {
                invoker.logout(getAuthorization());
            } catch (RuntimeException e) {
            }
            setAuthorization(null);
        }
    };
    clientSchemaObj.setBackingStore(invoker);
    // And stitch the response handler to reference our client instance
    invoker.setResponseHandlerSchemaObj(clientSchemaObj);
    // And now we can stitch together the CLI to the SAX loader code
    CFAsteriskSwingHttpCLI cli = new CFAsteriskSwingHttpCLI();
    cli.setXMsgClientHttpSchema(invoker);
    cli.setSchema(clientSchemaObj);
    ICFAsteriskSwingSchema swing = cli.getSwingSchema();
    swing.setClientConfigurationFile(cFAsteriskClientConfig);
    swing.setSchema(clientSchemaObj);
    swing.setClusterName("system");
    swing.setTenantName("system");
    swing.setSecUserName("system");
    JFrame jframe = cli.getDesktop();
    jframe.setVisible(true);
    jframe.toFront();
}