Swing JFrame を拡張するクラスがあります。このクラスがコールバックを受け取り、このクラスのメソッドを呼び出すには、クラスが POA クラスを拡張する必要があります。私はそれを行う方法がわかりません。多重継承はどうですか?POA クラスを拡張する別のクラスを作成する必要がありますか?
コード
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:1.2@localhost: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);
}
}
});
}