Search in sources :

Example 1 with WebServiceProfileInfo

use of com.creditease.uav.profiling.handlers.webservice.WebServiceProfileInfo in project uavstack by uavorg.

the class ComponentProfileHandler method getDynInfoForWebService.

@SuppressWarnings("unchecked")
private void getDynInfoForWebService(String componentClassName, ProfileElementInstance inst, ProfileContext context, Map<String, Class<?>> annoAvailableClasses, FastClasspathScanner fcs) {
    if (!componentClassName.equals("javax.jws.WebService")) {
        return;
    }
    Class<?> annoClass = annoAvailableClasses.get(componentClassName);
    if (null == annoClass) {
        return;
    }
    List<String> coms = fcs.getNamesOfClassesWithAnnotation(annoClass);
    if (null == coms || coms.isEmpty()) {
        return;
    }
    // construct data "dyn" for webservice
    InterceptContext ic = context.get(InterceptContext.class);
    List<WebServiceProfileInfo> wsli = (ArrayList<WebServiceProfileInfo>) ic.get("webservice.profile.info");
    if (wsli == null || wsli.isEmpty()) {
        return;
    }
    for (WebServiceProfileInfo wslinfo : wsli) {
        String url = wslinfo.getUrl();
        String clazz = (wslinfo.getImpl() instanceof String) ? (String) wslinfo.getImpl() : wslinfo.getImpl().getClass().getName();
        if (coms.contains(clazz)) {
            Map<String, Object> dynInfos = new LinkedHashMap<String, Object>();
            Map<String, Object> info = (Map<String, Object>) inst.getValues().get(clazz);
            dynInfos.put("url", url);
            dynInfos.put("className", clazz);
            info.put("dyn", dynInfos);
            inst.getValues().put(clazz, info);
        }
    }
}
Also used : InterceptContext(com.creditease.monitor.interceptframework.spi.InterceptContext) ArrayList(java.util.ArrayList) WebServiceProfileInfo(com.creditease.uav.profiling.handlers.webservice.WebServiceProfileInfo) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) NamedNodeMap(org.w3c.dom.NamedNodeMap) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with WebServiceProfileInfo

use of com.creditease.uav.profiling.handlers.webservice.WebServiceProfileInfo in project uavstack by uavorg.

the class WebServiceListenerIT method obtainWsInfo.

public void obtainWsInfo(Object address, Object impl) {
    InterceptContext ic = InterceptSupport.instance().getThreadLocalContext(Event.WEBCONTAINER_STARTED);
    @SuppressWarnings("unchecked") List<WebServiceProfileInfo> list = (ArrayList<WebServiceProfileInfo>) ic.get("webservice.profile.info");
    if (null == list) {
        list = new ArrayList<WebServiceProfileInfo>();
        ic.put("webservice.profile.info", list);
    }
    setWsInfo(list, address, impl);
}
Also used : InterceptContext(com.creditease.monitor.interceptframework.spi.InterceptContext) ArrayList(java.util.ArrayList) WebServiceProfileInfo(com.creditease.uav.profiling.handlers.webservice.WebServiceProfileInfo)

Example 3 with WebServiceProfileInfo

use of com.creditease.uav.profiling.handlers.webservice.WebServiceProfileInfo in project uavstack by uavorg.

the class WebServiceListenerIT method setWsInfo.

private void setWsInfo(List<WebServiceProfileInfo> list, Object address, Object impl) {
    WebServiceProfileInfo wsli = new WebServiceProfileInfo();
    wsli.setImpl(impl);
    wsli.setUrl((String) address);
    list.add(wsli);
}
Also used : WebServiceProfileInfo(com.creditease.uav.profiling.handlers.webservice.WebServiceProfileInfo)

Aggregations

WebServiceProfileInfo (com.creditease.uav.profiling.handlers.webservice.WebServiceProfileInfo)3 InterceptContext (com.creditease.monitor.interceptframework.spi.InterceptContext)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 NamedNodeMap (org.w3c.dom.NamedNodeMap)1