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 void init(ConfigurationContext configContext, AxisModule module) throws AxisFault { AxisConfiguration axiConfiguration = configContext.getAxisConfiguration(); Counter globalRequestCounter = new Counter(); Parameter globalRequestCounterParameter = new Parameter(); globalRequestCounterParameter.setName(MetricsConstants.GLOBAL_REQUEST_COUNTER); globalRequestCounterParameter.setValue(globalRequestCounter); axiConfiguration.addParameter(globalRequestCounterParameter); }
public void setParameters(MessageContext msgCtx) { for (Parameter p : parameters) { msgCtx.setProperty(p.getName(), p.getValue()); } } }
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 void updateStatistics(MessageContext outMsgContext) throws AxisFault { // Process System Request count Parameter globalRequestCounter = outMsgContext.getParameter(StatisticsConstants.GLOBAL_REQUEST_COUNTER); ((AtomicInteger) globalRequestCounter.getValue()).incrementAndGet(); // Process System Response count Parameter globalResponseCounter = outMsgContext.getParameter(StatisticsConstants.GLOBAL_RESPONSE_COUNTER); ((AtomicInteger) globalResponseCounter.getValue()).incrementAndGet(); updateCurrentInvocationGlobalStatistics(outMsgContext); // Calculate response times ResponseTimeCalculator.calculateResponseTimes(outMsgContext); }
private int getSystemStatisticsCount(AxisConfiguration axisConfig, String parameterName) { Parameter globalCounter = axisConfig.getParameter(parameterName); return ((AtomicInteger) globalCounter.getValue()).get(); }
private void setCountersAndProcessors(AxisOperation op){ // IN operation counter Parameter inOpCounter = new Parameter(); inOpCounter.setName(StatisticsConstants.IN_OPERATION_COUNTER); inOpCounter.setValue(new AtomicInteger(0)); try { op.addParameter(inOpCounter); } catch (AxisFault ignored) { // will not occur } // OUT operation counter Parameter outOpCounter = new Parameter(); outOpCounter.setName(StatisticsConstants.OUT_OPERATION_COUNTER); outOpCounter.setValue(new AtomicInteger(0)); try { op.addParameter(outOpCounter); } catch (AxisFault ignored) { // will not occur } // Operation response time processor Parameter responseTimeProcessor = new Parameter(); responseTimeProcessor.setName(StatisticsConstants.OPERATION_RESPONSE_TIME_PROCESSOR); responseTimeProcessor.setValue(new ResponseTimeProcessor()); try { op.addParameter(responseTimeProcessor); } catch (AxisFault axisFault) { // will not occur } }
public static AxisService createSimpleService(QName serviceName, MessageReceiver messageReceiver, String className, QName opName) throws AxisFault { AxisService service = new AxisService(serviceName.getLocalPart()); service.setClassLoader(getContextClassLoader_DoPriv()); service.addParameter(new Parameter(Constants.SERVICE_CLASS, className)); AxisOperation axisOp = new InOutAxisOperation(opName); axisOp.setMessageReceiver(messageReceiver); axisOp.setStyle(WSDLConstants.STYLE_RPC); service.addOperation(axisOp); service.mapActionToOperation(Constants.AXIS2_NAMESPACE_URI + "/" + opName.getLocalPart(), axisOp); return service; }
private static void updateCurrentInvocationStatistic(MessageContext messageContext, long responseTime) throws AxisFault { messageContext.setProperty(StatisticsConstants.GLOBAL_CURRENT_INVOCATION_RESPONSE_TIME,responseTime); if (messageContext.getAxisOperation() != null) { Parameter operationResponseTimeParam = new Parameter(); operationResponseTimeParam.setName(StatisticsConstants.OPERATION_RESPONSE_TIME); operationResponseTimeParam.setValue(responseTime); messageContext.getAxisOperation().addParameter(operationResponseTimeParam); } if (messageContext.getAxisService() != null) { Parameter serviceResponseTimeParam = new Parameter(); serviceResponseTimeParam.setName(StatisticsConstants.SERVICE_RESPONSE_TIME); serviceResponseTimeParam.setValue(responseTime); messageContext.getAxisService().addParameter(serviceResponseTimeParam); } } }
private String getRequestElementSuffix() { String requestElementSuffix = null; Parameter param = service.getParameter(Java2WSDLConstants.REQUEST_ELEMENT_SUFFIX_OPTION_LONG); if (param != null) { requestElementSuffix = (String) param.getValue(); } return requestElementSuffix; }
private static QName getWrapperQName(MessageContext msgContext) { QName wrapperQName = BaseConstants.DEFAULT_TEXT_WRAPPER; if (msgContext.getAxisService() != null) { Parameter wrapperParam = msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM); if (wrapperParam != null) { wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue()); } } return wrapperQName; }
private static SynapseConfiguration getSynapseConfiguration( org.apache.axis2.context.MessageContext axisMsgCtx) { AxisConfiguration axisCfg = axisMsgCtx.getConfigurationContext().getAxisConfiguration(); Parameter param = axisCfg.getParameter(SynapseConstants.SYNAPSE_CONFIG); if (param != null) { return (SynapseConfiguration) param.getValue(); } return null; }
/** * Retrieves the ContextRoot * * @return The ContextRoot */ public String getContextRoot() { if (contextRoot == null) { contextRoot = (String) axisConfiguration.getParameter("contextRoot").getValue(); } return contextRoot; }
private void addToAxisService() { // Add a reference to this EndpointDescription object to the AxisService if (axisService != null) { Parameter parameter = new Parameter(); parameter.setName(EndpointDescription.AXIS_SERVICE_PARAMETER); parameter.setValue(this); try { axisService.addParameter(parameter); } catch (AxisFault e) { throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr5", EndpointDescription.AXIS_SERVICE_PARAMETER), e); } } }
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { msgContext .setProperty(MetricsConstants.REQUEST_RECEIVED_TIME, System.currentTimeMillis()); // global increment ((Counter) msgContext.getParameter(MetricsConstants.GLOBAL_REQUEST_COUNTER).getValue()) .increment(); return InvocationResponse.CONTINUE; } }
public void serviceUpdate(AxisEvent axisEvent, AxisService axisService) { try { if (axisEvent.equals(AxisEvent.SERVICE_DEPLOY) && axisService.getName().equals("ServiceAdmin")){ AxisOperation operation = axisService.getOperation(new QName("listServiceGroups")); ArrayList<Parameter> params = operation.getParameters(); for(Parameter param: params) { operation.removeParameter(param); } Parameter authAction = new Parameter("AuthorizationAction", "/permission/admin/manage/monitor/service"); operation.addParameter(authAction); } } catch (AxisFault axisFault) { axisFault.printStackTrace(); } }
private AxisServiceGroup createServiceGroupForService(AxisService svc) throws AxisFault { AxisServiceGroup svcGroup = new AxisServiceGroup(); svcGroup.setServiceGroupName(svc.getName()); svcGroup.addService(svc); // Checking configured using files param is not a good solution. We must figure out a way to handle this // at Carbon persistence manager layer. if (svc.getParameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM) != null && svc.getParameter(BusinessProcessConstants.CONFIGURED_USING_BPEL_PKG_CONFIG_FILES) == null) { svcGroup.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true")); } return svcGroup; }
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; }