Forum: JRuby How to write this Java Abstract class in JRuby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6aa2708826a954ac390fc47cddd2aae5?d=identicon&s=25 Lysa GS (gs84)
on 2012-04-18 15:26
Hi everybody,

Can someone help me to rewrite this Java following code in JRuby.
I also want to get fields inheritance in my "VIHFClientHandler" class
because "VIHFClientHandler" class has got some other subclasses.
Also this class overrides the "handleMessage" method in which only the
type of the parameters are differents. So how can i manage this in my
JRuby class?


public abstract class VIHFClientHandler extends VIHFHandler implements
SOAPHandler<SOAPMessageContext> {

  protected boolean disableSignature = true;

  protected X509Certificate signatureCertificate;
  protected PrivateKey privateKey;
  protected Certificate[] signatureCertificationChain;

  /**
   * Constructeur
   */
  protected VIHFClientHandler(boolean disableSignature) {
    this.disableSignature = disableSignature;
  }

  private boolean handleMessage(VIHF vihf) {
    //some code
  }

  public boolean handleMessage(SOAPMessageContext smc) {
    //some code
    return true;
  }

       public abstract KeyStore getKeyStore();
}



One subclass of the "VIHFClientHandler" class

public class SoftwareCertificateClientHandler extends VIHFClientHandler
{
  private Pkcs12Impl softwareCertificate;

  public SoftwareCertificateClientHandler(
      Pkcs12Impl signatureSoftwareCertificate) {
    super(false);

   this.signatureCertificate=signatureSoftwareCertificate.getCertificate();
   this.privateKey = signatureSoftwareCertificate.getKey();

   this.signatureCertificationChain=
            signatureSoftwareCertificate.getCertificateChain();
   this.softwareCertificate = signatureSoftwareCertificate;
  }

  @Override
  public KeyStore getKeyStore() {
    return this.softwareCertificate.getCaKs();
  }
}


Thanks in advance for your help.
6aa2708826a954ac390fc47cddd2aae5?d=identicon&s=25 Lysa GS (gs84)
on 2012-04-20 17:12
Hi all,

Can someone give me a help to write this following code in Ruby

public abstract class VIHFClientHandler extends VIHFHandler implements
SOAPHandler<SOAPMessageContext> {}

I am using this Jruby code, but i don't know if it's correct or not

class VIHFClientHandler < VIHFHandler
      java_implements 'SOAPHandler'

    #....
end

Also in my getters and setters and my JRuby initialize methods, should i
use the variable with "self" or with "@" ?
Please can you give me some example from my first post ?

thanks for your help.
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2012-06-09 16:30
This topic is locked and can not be replied to.