Swing JFrame을 확장하는 클래스가 있습니다. 이 클래스가 콜백을 수신하여이 클래스의 메소드를 호출하려면 클래스가 POA 클래스를 확장해야합니다. 어떻게해야할지 모르겠다. 다중 상속은 어떨까요? POA 클래스를 확장하는 다른 클래스를 만들어야합니까?Java Swing을 사용하여 CORBA 콜백 수신
코드
public final class JFSECorbaClient extends javax.swing.JFrame {
//
// init and other method
//
public static void main(final String args[]) throws ClassNotFoundException, IllegalAccessException, InstantiationException{
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
frame = new JFSECorbaClient().setVisible(true);
try {
//initialize orb
Properties props = System.getProperties();
props.put("org.omg.CORBA.ORBInitialPort", "1050");
props.put("org.omg.CORBA.ORBInitialHost", "localhost");
ORB orb = ORB.init(args, props);
System.out.println("Initialized ORB");
//Instantiate Servant and create reference
POA rootPOA = POAHelper.narrow(
orb.resolve_initial_references("RootPOA"));
rootPOA.activate_object(this.frame); //this.frame should extends jfseCallbackPOA
ref = jfseCallbackHelper.narrow(
rootPOA.servant_to_reference(callbackListener));
//Resolve MessageServer
jfseServer = jfseORBHelper.narrow(
orb.string_to_object("corbaname:iiop:[email protected]:1050#MessageServer"));
//Activate rootpoa
rootPOA.the_POAManager().activate();
//thread for receive callback in other class thread
JFSECorrbaListener th = new JFSECorrbaListener();
th.setOrb(orb);
th.start();
} catch (Exception e) {
System.out.println(e);
}
}
});
}
코드를 알려주십시오. 도움이 될거야 ... – andersoj