1 23 package com.sun.enterprise.admin.wsmgmt.lifecycle; 24 25 import com.sun.appserv.server.ServerLifecycle; 26 import com.sun.appserv.server.ServerLifecycleImpl; 27 import com.sun.appserv.server.ServerLifecycleException; 28 import com.sun.enterprise.server.ServerContext; 29 import com.sun.enterprise.deployment.backend.DeploymentEventManager; 30 import com.sun.enterprise.admin.wsmgmt.repository.impl.cache.AppServDELImpl; 31 32 import com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig; 33 import com.sun.enterprise.admin.wsmgmt.config.spi.Constants; 34 import com.sun.enterprise.admin.wsmgmt.filter.spi.Filter; 35 import com.sun.enterprise.admin.wsmgmt.filter.spi.FilterRegistry; 36 import com.sun.enterprise.admin.wsmgmt.filter.impl.AggregateStatsFilter; 37 import com.sun.enterprise.admin.wsmgmt.stats.spi.StatsProviderManager; 38 import com.sun.enterprise.admin.wsmgmt.stats.spi.WebServiceEndpointStatsProvider; 39 import com.sun.enterprise.admin.wsmgmt.stats.impl.WebServiceEndpointStatsProviderImpl; 40 import com.sun.enterprise.admin.wsmgmt.stats.impl.WebServiceEndpointStatsImpl; 41 import com.sun.enterprise.admin.wsmgmt.WebServiceMgrBackEnd; 42 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistrationException; 43 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistry; 44 import com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener; 45 import javax.management.j2ee.statistics.Stats ; 46 import 47 com.sun.appserv.management.monitor.statistics.WebServiceEndpointAggregateStats; 48 import com.sun.enterprise.server.ApplicationServer; 49 50 51 58 class EndpointRegistration { 59 60 70 public EndpointRegistration(String n, String modName, String cRoot, 71 boolean isSA, String v, String appName, boolean isEjb) { 72 73 name = n; 74 moduleName = modName; 75 this.ctxRoot = cRoot; 76 if ((ctxRoot != null) && (ctxRoot.length() > 0) && 77 (ctxRoot.charAt(0) != '/')) { 78 ctxRoot = "/" + ctxRoot; 79 } 80 if ("".equals(ctxRoot)) { 81 ctxRoot = "/"; 82 } 83 isStandAlone = isSA; 84 vs = v; 85 j2eeAppName = appName; 86 isEjbModule = isEjb; 87 endpoint = 88 WebServiceMgrBackEnd.getManager().getFullyQualifiedName( j2eeAppName, 89 moduleName, name); 90 91 } 92 93 100 public void enableLOW() throws MonitoringRegistrationException { 101 102 Filter f = new AggregateStatsFilter(); 103 FilterRegistry.getInstance().registerFilter( 104 Filter.PRE_PROCESS_REQUEST, endpoint, f); 105 FilterRegistry.getInstance().registerFilter( 106 Filter.POST_PROCESS_RESPONSE, endpoint, f); 107 108 WebServiceEndpointStatsProvider prov = new 110 WebServiceEndpointStatsProviderImpl(); 111 112 StatsProviderManager.getInstance(). 113 registerEndpointStatsProvider(endpoint, prov); 114 115 MonitoringLevelListener listener = new 116 WSMonitoringLevelListener(name, moduleName, ctxRoot, isStandAlone, 117 vs, j2eeAppName, isEjbModule); 118 Stats stats = new WebServiceEndpointStatsImpl(prov); 119 120 String appName = null; 121 if ( isStandAlone == true) { 122 appName = null; 123 } else { 124 appName = j2eeAppName; 125 } 126 127 if ( isEjbModule ) { 128 registry.registerWSAggregateStatsForEjb(stats, 129 name, moduleName, appName, listener); 130 } else { 131 registry.registerWSAggregateStatsForWeb(stats, 132 name, moduleName, ctxRoot, appName, vs, listener); 133 } 134 } 135 136 public void disableLOW() 137 throws MonitoringRegistrationException { 138 139 FilterRegistry.getInstance().unregisterFilterByName( 140 Filter.PRE_PROCESS_REQUEST, endpoint, 141 Constants.AGGREGATE_STATS_FILTER ); 142 FilterRegistry.getInstance().unregisterFilterByName( 143 Filter.POST_PROCESS_RESPONSE, endpoint, 144 Constants.AGGREGATE_STATS_FILTER ); 145 if ( isEjbModule ) { 146 registry.unregisterWSAggregateStatsForEjb( 147 name, moduleName, j2eeAppName); 148 } else { 149 registry.unregisterWSAggregateStatsForWeb( 150 name, moduleName, ctxRoot, j2eeAppName, vs); 151 } 152 StatsProviderManager.getInstance().unregisterEndpointStatsProvider( 153 endpoint); 154 } 155 156 private static MonitoringRegistry registry = ApplicationServer. 157 getServerContext().getMonitoringRegistry();; 158 159 private String ctxRoot = null; 161 String name = null; 162 String moduleName = null; 163 boolean isStandAlone = false; 164 String vs = null; 165 String j2eeAppName = null; 166 boolean isEjbModule = false; 167 String endpoint = null; 168 } 169 | Popular Tags |