コード例 #1
0
  /**
   * Create a Channel for sending messages to a GridMaster.
   *
   * @param refId the ReferenceId for the Channel.
   * @param topic The topic for the JMSCommInfo.
   * @param routerIp The Host for the JMSCommInfo.
   * @param signCert The UID of the Certificate to use to sign messages sending to the GridMaster.
   */
  private void createGridMasterChannel(String refId, String topic, String routerIp, Long signCert)
      throws Throwable {
    ConnectionSetupProperties props = DelegateHelper.getProperties();

    //  create comminfo with refId, topic, routerIp
    CommInfo commInfo =
        DelegateHelper.createCommInfo(
            DelegateHelper.createCommInfo(
                refId,
                routerIp,
                props.getGmChannelCommPort().intValue(),
                topic,
                _ctx.getGridNodeID().toString(),
                props.getGmChannelCommPassword(),
                props.getGmChannelCommName(),
                props.getGmChannelCommDesc()));

    //  create packaginginfo with refId
    PackagingInfo pkgInfo =
        (PackagingInfo)
            DelegateHelper.createPackagingInfo(
                DelegateHelper.createPackagingInfo(
                    refId, props.getGmChannelPkgName(), props.getGmChannelPkgDesc()));

    //  create securityinfo with refId, signCert, encryptCert=gmcert
    SecurityInfo secInfo =
        (SecurityInfo)
            DelegateHelper.createSecurityInfo(
                DelegateHelper.createSecurityInfo(
                    refId,
                    _ctx.getEncryptionCert(),
                    signCert,
                    props.getGmChannelSecName(),
                    props.getGmChannelSecDesc()));

    //  create channelinfo with refId, commInfo, securityinfo, packagingInfo
    ChannelInfo channel =
        DelegateHelper.createChannelInfo(refId, props.getGmChannelName(), props.getGmChannelDesc());

    channel.setIsPartner(false);
    channel.setIsMaster(false);
    channel.setIsRelay(true);

    channel.setTptCommInfo(commInfo);
    channel.setPackagingProfile(pkgInfo);
    channel.setSecurityProfile(secInfo);
    channel = (ChannelInfo) DelegateHelper.createChannelInfo(channel);
  }