public int getOperationRequestCount(AxisOperation axisOperation) throws AxisFault { Parameter parameter = axisOperation.getParameter(StatisticsConstants.IN_OPERATION_COUNTER); if (parameter != null) { return ((AtomicInteger) parameter.getValue()).get(); } return 0; }
public int getOperationResponseCount(AxisOperation axisOperation) throws AxisFault { Parameter parameter = axisOperation.getParameter(StatisticsConstants.OUT_OPERATION_COUNTER); if (parameter != null) { return ((AtomicInteger) parameter.getValue()).get(); } return 0; }
private long getResponseTime(AxisOperation axisOp) { Parameter responseTimeParameter = axisOp.getParameter( StatisticsConstants.OPERATION_RESPONSE_TIME); if (responseTimeParameter != null) { Object value = responseTimeParameter.getValue(); if (value instanceof Long) { return (Long) value; } } return 0; }
public int getOperationFaultCount(AxisOperation axisOperation) throws AxisFault { Parameter parameter = axisOperation.getParameter(StatisticsConstants.OPERATION_FAULT_COUNTER); if (parameter != null) { return ((AtomicInteger) parameter.getValue()).get(); } return 0; }
public int getServiceResponseCount(AxisService axisService) throws AxisFault { int count = 0; for (Iterator opIter = axisService.getOperations(); opIter.hasNext();) { AxisOperation axisOp = (AxisOperation) opIter.next(); Parameter parameter = axisOp.getParameter(StatisticsConstants.OUT_OPERATION_COUNTER); if (parameter != null) { count += ((AtomicInteger) parameter.getValue()).get(); } } return count; }
public int getServiceRequestCount(AxisService axisService) throws AxisFault { int count = 0; for (Iterator opIter = axisService.getOperations(); opIter.hasNext();) { AxisOperation axisOp = (AxisOperation) opIter.next(); Parameter parameter = axisOp.getParameter(StatisticsConstants.IN_OPERATION_COUNTER); if (parameter != null) { count += ((AtomicInteger) parameter.getValue()).get(); } } return count; }
public int getServiceFaultCount(AxisService axisService) throws AxisFault { int count = 0; for (Iterator opIter = axisService.getOperations(); opIter.hasNext();) { AxisOperation axisOp = (AxisOperation) opIter.next(); Parameter parameter = axisOp.getParameter(StatisticsConstants.OPERATION_FAULT_COUNTER); if (parameter != null) { count += ((AtomicInteger) parameter.getValue()).get(); } } return count; }
/** * Extract the parameter representing the Anonymous flag from the AxisOperation * and return the String value. Return the default of "optional" if not specified. * * @param axisOperation */ public static String getInvocationPatternParameterValue(AxisOperation axisOperation) { String value = ""; if (axisOperation != null) { value = Utils.getParameterValue( axisOperation.getParameter(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME)); if(value !=null){ value = value.trim(); } if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug("getInvocationPatternParameterValue: value: '" + value + "'"); } } if (value == null || "".equals(value)) { value = AddressingConstants.WSAM_INVOCATION_PATTERN_BOTH; } return value; }
public long getMinOperationResponseTime(AxisOperation axisOperation) throws AxisFault { long min = 0; Parameter parameter = axisOperation.getParameter(StatisticsConstants.OPERATION_RESPONSE_TIME_PROCESSOR); if (parameter != null) { min = ((ResponseTimeProcessor) parameter.getValue()).getMinResponseTime(); } if (min == -1) { min = 0; } return min; }
public long getMaxOperationResponseTime(AxisOperation axisOperation) throws AxisFault { long max = 0; Parameter parameter = axisOperation.getParameter(StatisticsConstants.OPERATION_RESPONSE_TIME_PROCESSOR); if (parameter != null) { max = ((ResponseTimeProcessor) parameter.getValue()).getMaxResponseTime(); } return max; }
public double getAvgOperationResponseTime(AxisOperation axisOperation) throws AxisFault { double avg = 0; Parameter parameter = axisOperation.getParameter(StatisticsConstants.OPERATION_RESPONSE_TIME_PROCESSOR); if (parameter != null) { avg = ((ResponseTimeProcessor) parameter.getValue()).getAvgResponseTime(); } return avg; }
/** * extract the http method from services xml related to given operation * @param operation * @return */ public static String getHTTPMethodFromServicesXML(AxisOperation operation) { Parameter methodParam = operation.getParameter(Constants.Configuration.REST_METHOD_PARAM); if (methodParam != null && methodParam.getValue() != null && methodParam.getValue() instanceof String) { String method = ((String) methodParam.getValue()).trim(); if (method.equals("")) { return null; } else if (method.equals(Constants.Configuration.HTTP_METHOD_GET) || method.equals(Constants.Configuration.HTTP_METHOD_POST) || method.equals(Constants.Configuration.HTTP_METHOD_PUT) || method.equals(Constants.Configuration.HTTP_METHOD_DELETE)) { return method; } else if (method.equals(Constants.Configuration.HTTP_METHOD_HEAD)) { log.warn("Axis2 doesn't support httpMethod HEAD "); return null; } else { log.warn("cannot identify the HTTP method"); return null; } } else return null; }
/** * extract the http location from services xml related to given operation * @param operation * @return */ public static String getHTTPLoacationFromServicesXML(AxisOperation operation) { Parameter locationParam = operation.getParameter(Constants.Configuration.REST_LOCATION_PARAM); if (locationParam != null && locationParam.getValue() != null && locationParam.getValue() instanceof String) { String location = ((String) locationParam.getValue()).trim(); if (location.equals("")) { return null; } else{ if(location.startsWith("/")){ location= location.substring(1); } return location; } } else return null; }
/** * extract the http location from services xml related to given operation * @param operation * @return */ public static String getHTTPLoacationFromServicesXML(AxisOperation operation) { Parameter locationParam = operation.getParameter(Constants.Configuration.REST_LOCATION_PARAM); if (locationParam != null && locationParam.getValue() != null && locationParam.getValue() instanceof String) { String location = ((String) locationParam.getValue()).trim(); if (location.equals("")) { return null; } else{ if(location.startsWith("/")){ location= location.substring(1); } return location; } } else return null; }
/** * get http output mime type from the services xml * @param operation * @return */ public static String getHTTPOutputSerializationFromservicesXML(AxisOperation operation) { Parameter outputSerializationParam = operation.getParameter(Constants.Configuration.REST_OUTPUTSERIALIZE_PARAM); if (outputSerializationParam != null && outputSerializationParam.getValue() != null && outputSerializationParam.getValue() instanceof String) { String outputSerialization = ((String) outputSerializationParam.getValue()).trim(); if (outputSerialization.equals("")) { return null; } else { String[] array = outputSerialization.split(","); if (array.length > 1) { log.warn("WSDL2 supports only one input-serialization"); return array[0]; } else { return array[0]; } } } else return null; }
/** * get http input mime type from the services xml * @param operation * @return */ public static String getHTTPInputSerializationFromServicesXML(AxisOperation operation) { Parameter inputSerializationParam = operation.getParameter(Constants.Configuration.REST_INPUTSERIALIZE_PARAM); if (inputSerializationParam != null && inputSerializationParam.getValue() != null && inputSerializationParam.getValue() instanceof String) { String inputSerialization = ((String) inputSerializationParam.getValue()).trim(); if (inputSerialization.equals("")) { return null; } else { String[] array = inputSerialization.split(","); if (array.length > 1) { log.warn("WSDL2 supports only one input-serialization"); return array[0]; } else { return array[0]; } } } else return null; }
public static boolean isForbidMixedEPRsOnSequence(MessageContext mc) { if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Entry: SandeshaUtil::isForbidMixedEPRsOnSequence"); boolean result = false; //look at the msg ctx first String auto = (String) mc.getProperty(SandeshaClientConstants.FORBID_MIXED_EPRS_ON_SEQUENCE); if ("true".equals(auto)) { if (log.isDebugEnabled()) log.debug("Mixed EPRs forbidden on message context"); result = true; } if(!result) { //look at the operation if (mc.getAxisOperation() != null) { Parameter mixedParam = mc.getAxisOperation().getParameter(SandeshaClientConstants.FORBID_MIXED_EPRS_ON_SEQUENCE); if (null != mixedParam && "true".equals(mixedParam.getValue())) { if (log.isDebugEnabled()) log.debug("mixed EPRs forbidden on operation"); result = true; } } } if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Exit: SandeshaUtil::isForbidMixedEPRsOnSequence, " + result); return result; }
public static boolean isAutoStartNewSequence(MessageContext mc){ if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Entry: SandeshaUtil::isAutoStartNewSequence"); boolean result = false; //look at the msg ctx first String auto = (String) mc.getProperty(SandeshaClientConstants.AUTO_START_NEW_SEQUENCE); if ("true".equals(auto)) { if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Autostart message context"); result = true; } if(!result) { //look at the operation if (mc.getAxisOperation() != null) { Parameter autoParam = mc.getAxisOperation().getParameter(SandeshaClientConstants.AUTO_START_NEW_SEQUENCE); if (null != autoParam && "true".equals(autoParam.getValue())) { if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("autostart operation"); result = true; } } } if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Exit: SandeshaUtil::isAutoStartNewSequence, " + result); return result; }
public boolean isParameterLocked(String parameterName) { // checking the locked value of parent boolean locked = false; if (getParent() != null) { locked = getParent().isParameterLocked(parameterName); } if (locked) { return true; } else { Parameter parameter = getParameter(parameterName); return (parameter != null) && parameter.isLocked(); } }
public boolean isParameterLocked(String parameterName) { // checking the locked value of parent boolean locked = false; if (getParent() != null) { locked = getParent().isParameterLocked(parameterName); } if (locked) { return true; } else { Parameter parameter = getParameter(parameterName); return (parameter != null) && parameter.isLocked(); } }