⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atmdemoserverapp.java

📁 java初学者适用的源码一共分成15章每章都有配套源码,简单易用
💻 JAVA
字号:

/**
 * Copyright (c) 2001
 * Template File
 *   ServerApp.java.template
 * IDL Object
 *   atmserver.ATMDemo
 * Generation Date
 *   2001年12月18日 上午10时23分33秒
 * IDL Source File
 *   E:/ATMServer/src/atmserver/ATMDemo.idl
 * Abstract
 *   CORBA server application.
 * @version 1.0
 */

package atmserver;

import atmserver.ATMDemo.server.*;
import javax.swing.UIManager;
import java.awt.*;
import org.omg.PortableServer.*;

public class ATMDemoServerApp {

  boolean packFrame = false;


  public ATMDemoServerApp() {
    ServerFrame frame = new ServerFrame();

    if (packFrame)
      frame.pack();
    else
      frame.validate();

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height)
      frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width)
      frameSize.width = screenSize.width;
    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    frame.setVisible(true);
  }

  public static void main(String[] args) {
    try  {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
      //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
      //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
      //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    }
    catch (Exception ex) {
    }
    new ATMDemoServerApp();

    try {
      java.util.ResourceBundle res = java.util.ResourceBundle.getBundle("atmserver.ATMDemo.server.ServerResources");
      String name;

      //(debug support)System.getProperties().put("vbroker.agent.debug", "true");
      //(debug support)System.getProperties().put("vbroker.orb.warn", "2");
      if (System.getProperties().get("vbroker.agent.port") == null) {
        System.getProperties().put("vbroker.agent.port", "14000");
      }
      if (System.getProperties().get("org.omg.CORBA.ORBClass") == null) {
        System.getProperties().put("org.omg.CORBA.ORBClass", "com.inprise.vbroker.orb.ORB");
      }
      if (System.getProperties().get("org.omg.CORBA.ORBSingletonClass") == null) {
        System.getProperties().put("org.omg.CORBA.ORBSingletonClass", "com.inprise.vbroker.orb.ORB");
      }

      org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, System.getProperties());

      POA poaRoot = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

      name = "ATMServer";
      org.omg.CORBA.Policy[] ATMServerPolicies = { 
        poaRoot.create_lifespan_policy(LifespanPolicyValue.PERSISTENT) 
      };
      POA poaATMServer = poaRoot.create_POA(name + "_poa",
                                        poaRoot.the_POAManager(), 
                                        ATMServerPolicies);
      poaATMServer.activate_object_with_id(name.getBytes(), new ATMServerImpl());   
      ServerMonitor.log(ServerResources.format(res.getString("created"), "ATMDemoServerApp.java ATMServer"));

      poaRoot.the_POAManager().activate();
      ServerMonitor.log(ServerResources.format(res.getString("isReady"), "ATMDemoServerApp.java ATMDemo"));
      orb.run();
    }
    catch(Exception ex) {
      System.err.println(ex);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -