/* * BEGIN_HEADER - DO NOT EDIT * * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html. * See the License for the specific language governing * permissions and limitations under the License. * * When distributing Covered Code, include this CDDL * HEADER in each file and include the License file at * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html. * If applicable add the following below this CDDL HEADER, * with the fields enclosed by brackets "[]" replaced with * your own identifying information: Portions Copyright * [year] [name of copyright owner] */ /* * @(#)HttpSoapPerformanceMeasurement.java * * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved. * * END_HEADER - DO NOT EDIT */ package com.sun.jbi.httpsoapbc; import javax.management.MBeanException; import javax.management.openmbean.TabularData; import javax.management.openmbean.OpenDataException; import net.java.hulp.measure.Group; import com.sun.jbi.eManager.provider.PerformanceMeasurement; /** * * */ public class HttpSoapPerformanceMeasurement implements PerformanceMeasurement { public static final String HTTP_SOAP_BC_SOURCE_FILTER = ".*httpsoapbc.*"; /** * Retrieves the performance insturmentation measurement for the specified endpoint. * @param endpoint The endpoint name qualified by service name. * @return An instance of TabularData which holds the performance instrumentation measurement for the specified endpoint. * @throws OpenDataException if there's an error related to the openmbean data. * @throws MBeanException if the endpoint does not exist for the component. */ public TabularData getPerformanceInstrumentationMeasurement(String endpoint) throws OpenDataException, MBeanException { Group gr = Group.createGroup(); gr.addPattern(HTTP_SOAP_BC_SOURCE_FILTER, endpoint, getPerfCatFilter()); return gr.fetchData(); } /** * Resets the performance measurements on the endpoint. * @param endpoint The endpoint name qualified by service name. * @throws MBeanException if the endpoint does not exist for the component. */ public void clearPeformaceInstrumentationMeasurement (String endpoint) throws MBeanException { Group gr = Group.createGroup(); gr.addPattern(HTTP_SOAP_BC_SOURCE_FILTER, endpoint, getPerfCatFilter()); gr.clearData(); } private String getPerfCatFilter() { StringBuffer perfCatFilter = new StringBuffer(); for (int i=0; i < HttpSoapBindingLifeCycle.HTTPSOAPBC_PERF_CATEGORIES.length; i++) { perfCatFilter.append(HttpSoapBindingLifeCycle.HTTPSOAPBC_PERF_CATEGORIES[i]); if (i < HttpSoapBindingLifeCycle.HTTPSOAPBC_PERF_CATEGORIES.length-1) { perfCatFilter.append('|'); } } return perfCatFilter.toString(); } }