Examples of PayloadData


Examples of org.apache.stratos.manager.payload.PayloadData

            // set cluster domain
            cluster.setClusterDomain(generateClusterId(alias, cartridgeInfo.getType()));
            // set hostname
            cluster.setHostName(generateHostName(alias, cartridgeInfo.getHostName()));

            PayloadData serviceLevelLbPayloadData = createPayload(cartridgeInfo, subscriptionKey, subscriber, cluster,
                    repository, alias, customPayloadEntries);

            // add payload entry for load balanced service type
            serviceLevelLbPayloadData.add(CartridgeConstants.LOAD_BALANCED_SERVICE_TYPE, getLoadBalancedServiceType());
            return serviceLevelLbPayloadData;
        }
    }
View Full Code Here

Examples of org.apache.stratos.manager.payload.PayloadData

        //Create the payload
        BasicPayloadData basicPayloadData = CartridgeSubscriptionUtils.createBasicPayload(cartridgeInfo, subscriptionKey, cluster, repository, alias, subscriber);
        //Populate the basic payload details
        basicPayloadData.populatePayload();

        PayloadData payloadData = PayloadFactory.getPayloadDataInstance(cartridgeInfo.getProvider(),
                cartridgeInfo.getType(), basicPayloadData);

        // get the payload parameters defined in the cartridge definition file for this cartridge type
        if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length != 0) {

            for (Property property : cartridgeInfo.getProperties()) {
                // check if a property is related to the payload. Currently this is done by checking if the
                // property name starts with 'payload_parameter.' suffix. If so the payload param name will
                // be taken as the substring from the index of '.' to the end of the property name.
                if (property.getName()
                        .startsWith(CartridgeConstants.CUSTOM_PAYLOAD_PARAM_NAME_PREFIX)) {
                    String payloadParamName = property.getName();
                    payloadData.add(payloadParamName.substring(payloadParamName.indexOf(".") + 1), property.getValue());
                }
            }
        }

        //check if there are any custom payload entries defined
        if (customPayloadEntries != null) {
            //add them to the payload
            Set<Map.Entry<String,String>> entrySet = customPayloadEntries.entrySet();
            for (Map.Entry<String, String> entry : entrySet) {
                payloadData.add(entry.getKey(), entry.getValue());
            }
        }

        return payloadData;
    }
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

    public void onCommunicationUp(Association association, int maxInboundStreams, int maxOutboundStreams) {
      System.out.println(this + " onCommunicationUp");

      clientAssocUp = true;

      PayloadData payloadData = new PayloadData(CLIENT_MESSAGE.length, CLIENT_MESSAGE, true, false, 3, 1);

      try {
        association.send(payloadData);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

    public void onCommunicationUp(Association association, int maxInboundStreams, int maxOutboundStreams) {
      System.out.println(this + " onCommunicationUp");

      serverAssocUp = true;

      PayloadData payloadData = new PayloadData(SERVER_MESSAGE.length, SERVER_MESSAGE, true, false, 3, 1);

      try {
        association.send(payloadData);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

     
      clientMaxInboundStreams = maxInboundStreams;
      clientMaxOutboundStreams = maxOutboundStreams;
      clientAssocUp = true;

      PayloadData payloadData = new PayloadData(CLIENT_MESSAGE.length, CLIENT_MESSAGE, true, false, 3, 1);

      try {
        association.send(payloadData);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

      serverAssocUp = true;
      serverMaxInboundStreams = maxInboundStreams;
      serverMaxOutboundStreams = maxOutboundStreams;
         

      PayloadData payloadData = new PayloadData(SERVER_MESSAGE.length, SERVER_MESSAGE, true, false, 3, 1);

      try {
        association.send(payloadData);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

  }

  protected void read() {

    try {
      PayloadData payload;
      if (this.ipChannelType == IpChannelType.SCTP)
        payload = this.doReadSctp();
      else
        payload = this.doReadTcp();
      if (payload == null)
        return;

      if (logger.isDebugEnabled()) {
        logger.debug(String.format("Rx : Ass=%s %s", this.name, payload));
      }

      if (this.management.isSingleThread()) {
        // If single thread model the listener should be called in the
        // selector thread itself
        try {
          this.associationListener.onPayload(this, payload);
        } catch (Exception e) {
          logger.error(String.format("Error while calling Listener for Association=%s.Payload=%s", this.name,
              payload), e);
        }
      } else {
        Worker worker = new Worker(this, this.associationListener, payload);

//        System.out.println("payload.getStreamNumber()=" + payload.getStreamNumber()
//            + " this.workerThreadTable[payload.getStreamNumber()]"
//            + this.workerThreadTable[payload.getStreamNumber()]);

        ExecutorService executorService = this.management.getExecutorService(this.workerThreadTable[payload
            .getStreamNumber()]);
        try {
          executorService.execute(worker);
        } catch (RejectedExecutionException e) {
          logger.error(String.format("Rejected %s as Executors is shutdown", payload), e);
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

    rxBuffer.flip();
    byte[] data = new byte[len];
    rxBuffer.get(data);
    rxBuffer.clear();

    PayloadData payload = new PayloadData(len, data, messageInfo.isComplete(), messageInfo.isUnordered(),
        messageInfo.payloadProtocolID(), messageInfo.streamNumber());

    return payload;
  }
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

    rxBuffer.flip();
    byte[] data = new byte[len];
    rxBuffer.get(data);
    rxBuffer.clear();

    PayloadData payload = new PayloadData(len, data, true, false, 0, 0);

    return payload;
  }
View Full Code Here

Examples of org.mobicents.protocols.api.PayloadData

      if (!txQueue.isEmpty() && !txBuffer.hasRemaining()) {
        while (!txQueue.isEmpty()) {
          // Lets read all the messages in txQueue and send

          txBuffer.clear();
          PayloadData payloadData = txQueue.poll();

          if (logger.isDebugEnabled()) {
            logger.debug(String.format("Tx : Ass=%s %s", this.name, payloadData));
          }

          // load ByteBuffer
          // TODO: BufferOverflowException ?
          txBuffer.put(payloadData.getData());

          if (this.ipChannelType == IpChannelType.SCTP) {
            int seqControl = payloadData.getStreamNumber();

            if (seqControl < 0 || seqControl >= this.associationHandler.getMaxOutboundStreams()) {
              try {
                // TODO : calling in same Thread. Is this ok? or
                // dangerous?
                this.associationListener.inValidStreamId(payloadData);
              } catch (Exception e) {

              }
              txBuffer.clear();
              txBuffer.flip();
              continue;
            }

            msgInfo = MessageInfo.createOutgoing(this.peerSocketAddress, seqControl);
            msgInfo.payloadProtocolID(payloadData.getPayloadProtocolId());
            msgInfo.complete(payloadData.isComplete());
            msgInfo.unordered(payloadData.isUnordered());
          }

          txBuffer.flip();

          this.doSend();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.