/*
Get the value of the Reliability field from the message header.

Javadoc description supplied by ControlMessage interface.
199587
public final Reliability getReliability() {
    /* Get the byte value and get the corresponding Reliability instance       */
    Byte rType = (Byte)jmo.getField(ControlAccess.RELIABILITY);
    return Reliability.getReliability(rType);
  }
20574
protected boolean processMessage(final SIBusMessage message) 
    {
      Reliability preInvokeMessageReliability = (Reliability)_reliabilityPreInvoke.get(message.getMessageHandle());
      boolean canDeleteMessage;
      if (preInvokeMessageReliability != null)
      {
        canDeleteMessage = (_unrecoverableReliability.compareTo(preInvokeMessageReliability) >= 0);
      }
      else  // if the pre invoke reliability is not in the map then go back to using the message which most of the time wil be fine
      {
        canDeleteMessage = (_unrecoverableReliability.compareTo(message.getReliability()) >= 0);
      }

      return !(_deleteUnrecoverableMessages && canDeleteMessage);

    }
965936
public SIMPRequestedValueMessageInfo getRequestedValueMessageInfo() throws SIMPRuntimeOperationFailedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getRequestedValueMessageInfo");

    SIMPRequestedValueMessageInfo requestedValueMessageInfo = null;
    try
    {
      TickRange tickRange = getTickRange();
      synchronized(tickRange)
      {
        if (State.VALUE.toString().equals(getState(tickRange)))
        {
          // This RemoteMessageRequest is in state request so lets get the info
          requestedValueMessageInfo = new RequestedValueMessageInfo((AIValueTick)tickRange.value);
        }
      }
    }
    catch(SIMPException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.runtime.RemoteMessageRequest.getRequestedValueMessageInfo",
        "1:456:1.34",
        this);

      SIMPRuntimeOperationFailedException e1 =
        new SIMPRuntimeOperationFailedException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
            new Object[] {"RemoteMessageRequest.getRequestedValueMessageInfo",
                          "1:464:1.34",
                          e,
                          _aiStream.getStreamId()},
            null), e);

      SibTr.exception(tc, e1);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRequestedValueMessageInfo", e1);
      throw e1;
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getRequestedValueMessageInfo", requestedValueMessageInfo);
    return requestedValueMessageInfo;
  }
1082
public String getHeaderField(int n) {
        try {
            getInputStream();
        } catch (Exception e) {
            return null;
        }
        MessageHeader props = properties;
        return props == null ? null : props.getValue(n);
    }
238001
@Override
    public Reliability getDefaultReliability()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getDefaultReliability");

        Reliability rel = _definition.getDefaultReliability();

        // A reliability of NONE signals use target value.
        if (rel.equals(Reliability.NONE))
        {
            rel = getTarget().getDefaultReliability();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getDefaultReliability", rel);

        return rel;
    }
93741
@Override public String getMessage() {
    String gaiName = OsConstants.gaiName(error);
    if (gaiName == null) {
      gaiName = "GAI_ error " + error;
    }
    String description = NetworkOs.gai_strerror(error);
    return functionName + " failed: " + gaiName + " (" + description + ")";
  }
607614
public Reliability getDefaultReliability()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getDefaultReliability");
    
    Reliability rel = aliasDest.getDefaultReliability();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getDefaultReliability", rel);
    
    return rel;
  }
960600
@Override
  public String getHeaderField(String key) {
    try {
      getResponse();
      return getHeaderFieldDoNotForceResponse(key);
    } catch(IOException e) {
      return null;
    }
  }
222217
@SuppressWarnings({ "unchecked", "rawtypes" })
    public static Object get(TBase<?, ?> struct, TFieldIdEnum field) {
        final Object value = ((TBase) struct).getFieldValue(field);
        if (value instanceof byte[]) {
            return ByteBuffer.wrap((byte[]) value);
        } else {
            return value;
        }
    }

    /**
     * Sets the value of the specified struct field.
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static void set(TBase<?, ?> struct, TFieldIdEnum field, Object value) {
        ((TBase) struct).setFieldValue(field, value);
    }

    /**
     * Tells whether the specified struct field is set or not.
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static boolean isSet(TBase<?, ?> struct, TFieldIdEnum field) {
        return ((TBase) struct).isSet(field);
    }

    private ThriftFieldAccess() {}
}
414517
public String getResponseHeaderValue(String name, String defaultVal) {
        if (m_response.containsHeader(name)) {
            return m_response.getFirstHeader(name).getValue();
        } else {
            return defaultVal;
        }
    }
823773
@Nullable
  public static Descriptor getMapValueMessageType(FieldDescriptor mapField) {
    FieldDescriptor valueDesc = mapField.getMessageType().findFieldByName("value");
    if (valueDesc.getType() == FieldDescriptor.Type.MESSAGE) {
      return valueDesc.getMessageType();
    } else {
      return null;
    }
  }
983809
protected Reliability getReliability()
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "getReliability");
    if (tc.isEntryEnabled()) 
      SibTr.exit(tc, "getReliability", reliability);  
    
    return reliability;
  }
634402
public static String getFailureDescriptionAsString(final ModelNode result) {
        if (isSuccessfulOutcome(result)) {
            return "";
        }
        final String msg;
        if (result.hasDefined(ClientConstants.FAILURE_DESCRIPTION)) {
            if (result.hasDefined(ClientConstants.OP)) {
                msg = String.format("Operation '%s' at address '%s' failed: %s", result.get(ClientConstants.OP), result.get(ClientConstants.OP_ADDR), result
                        .get(ClientConstants.FAILURE_DESCRIPTION));
            } else {
                msg = String.format("Operation failed: %s", result.get(ClientConstants.FAILURE_DESCRIPTION));
            }
        } else {
            msg = String.format("An unexpected response was found checking the deployment. Result: %s", result);
        }
        return msg;
    }
284993
@Override
	protected int retrieveMessagePriority(int handle) throws JMSException
    {
    	// Only read the first header bytes of the message to read the priority field
    	byte[] msgHeader = ((AbstractBlockBasedDataStore)dataStore).retrieveHeader(handle, 2);    	
    	return msgHeader[1] & 0x0F;
    }
897618
Object getValue(
      MatchSpaceKey msg,
      Object contextValue)
  throws MatchingException, BadMessageFormatMatchingException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(
        cclass,
        "getValue",
        "msg: " + msg + "contextValue: " + contextValue);    
    // The value which we'll return    
    Boolean resultBool = Boolean.FALSE; 

    // May need to call MFP multiple times, if our context has multiple nodes
    if(contextValue != null)
    {
      // Currently this must be a list of nodes
      if (contextValue instanceof SetValEvaluationContext)
      {
        SetValEvaluationContext evalContext = (SetValEvaluationContext)contextValue;
        
        // Get the node list
        ArrayList wrappedParentList = evalContext.getWrappedNodeList();
        // If the list is empty, then we have yet to get the document root
        if(wrappedParentList.isEmpty())
        {
    	    //Set up a root (document) context for evaluation
        	Object docRoot = Matching.getEvaluator().getDocumentRoot(msg);
            
          // Create an object to hold the wrapped node
          WrappedNodeResults wrapper = new WrappedNodeResults(docRoot);
          // Set the root into the evaluation context
          evalContext.addNode(wrapper);
        } 
        
        // Iterate over the nodes
        Iterator iter = wrappedParentList.iterator();

        while(iter.hasNext())
        {
          WrappedNodeResults nextWrappedNode = (WrappedNodeResults)iter.next();       
          Object nextParentNode = nextWrappedNode.getNode();
          
          String debugString = ""; 
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            tc.debug(this,cclass, "getValue", "Evaluation context node: " + nextWrappedNode);  
          
          // If no cached value we'll need to call MFP
          Boolean tempBool = nextWrappedNode.getEvalBoolResult(id.getName());
            
          if(tempBool == null)
          {
            // Call MFP to get the results for this node
            tempBool = (Boolean) msg.getIdentifierValue(id,
                                                        false,
                                                        nextParentNode, 
                                                        false); // false means dont return a list

            // Add result to cache for next time
            nextWrappedNode.addEvalBoolResult(id.getName(), tempBool);
            
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
              debugString = "Result from MFP ";            
          }
          else
          {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
              debugString = "Result from Cache ";        
          }   
          
          // Useful debug
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          {
            String asString = ", type: Boolean - <" + tempBool + ">";

            tc.debug(this,cclass, "getValue", debugString + "for identifier " + id.getName() + asString);
          }   
          
          if(tempBool.booleanValue())
          {
            resultBool = Boolean.TRUE;
            break;
          }     
 
        } // eof while
      } // eof instanceof XPathEvaluationContext
    } // eof contextValue not null
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(this,cclass, "getValue", resultBool);
    return resultBool;
  }
353120
@Override
	public Constant getVal(String fldName) {
		if (ts.hasField(fldName))
			return ts.getVal(fldName);
		else
			return s.getVal(fldName);
	}
435567
public NameValue[] getNameValueArray(BaseMessageHeader header)
    {
        Object[][] mxString = header.getNameValueTree();
        NameValue[] rgNodes = new NameValue[10];
        rgNodes[0] = this;
        int i = 0;
        if (mxString != null)
        {
            for (; i < mxString.length; i++)
            {
                rgNodes[i + 1] = rgNodes[i].getNameValueNode((String)mxString[i][MessageConstants.NAME], mxString[i][MessageConstants.VALUE], false);
                if (rgNodes[i + 1] == null)
                    break;
            }
        }
        NameValue[] rgNodesNew = new NameValue[i + 1];
        for (int j = 0; j <= i; j++)
        {
            rgNodesNew[j] = rgNodes[j];
        }
        return rgNodesNew;
    }