本文整理汇总了Java中org.apache.axis2.engine.AxisConfiguration.addObservers方法的典型用法代码示例。如果您正苦于以下问题:Java AxisConfiguration.addObservers方法的具体用法?Java AxisConfiguration.addObservers怎么用?Java AxisConfiguration.addObservers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.engine.AxisConfiguration
的用法示例。
在下文中一共展示了AxisConfiguration.addObservers方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
protected void activate(ComponentContext ctxt) {
BundleContext bundleCtx = ctxt.getBundleContext();
// Publish the OSGi service
Dictionary props = new Hashtable();
props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName());
bundleCtx.registerService(AxisObserver.class.getName(), this, props);
PreAxisConfigurationPopulationObserver preAxisConfigObserver =
new PreAxisConfigurationPopulationObserver() {
public void createdAxisConfiguration(AxisConfiguration axisConfiguration) {
axisConfiguration.addObservers(new SystemStatisticsDeploymentInterceptor());
}
};
bundleCtx.registerService(PreAxisConfigurationPopulationObserver.class.getName(),
preAxisConfigObserver, null);
}
示例2: activate
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
protected void activate(ComponentContext ctxt) {
BundleContext bundleCtx = ctxt.getBundleContext();
// Publish the OSGi service
Dictionary props = new Hashtable();
props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName());
bundleCtx.registerService(AxisObserver.class.getName(), this, props);
PreAxisConfigurationPopulationObserver preAxisConfigObserver =
new PreAxisConfigurationPopulationObserver() {
public void createdAxisConfiguration(AxisConfiguration axisConfiguration) {
init(axisConfiguration);
axisConfiguration.addObservers(UrlMappingDeploymentInterceptor.this);
}
};
bundleCtx.registerService(PreAxisConfigurationPopulationObserver.class.getName(),
preAxisConfigObserver, null);
// Publish an OSGi service to listen tenant configuration context creation events
Dictionary properties = new Hashtable();
properties.put(CarbonConstants.AXIS2_CONFIG_SERVICE,
Axis2ConfigurationContextObserver.class.getName());
bundleCtx.registerService(Axis2ConfigurationContextObserver.class.getName(),
new UrlMappingServiceListener(), properties);
}
示例3: createdConfigurationContext
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
@Override
public void createdConfigurationContext(ConfigurationContext configCtx) {
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
//Register SecurityDeploymentInterceptor as an AxisObserver in tenant's AxisConfig.
SecurityDeploymentInterceptor secDeployInterceptor = new SecurityDeploymentInterceptor();
secDeployInterceptor.init(axisConfig);
axisConfig.addObservers(secDeployInterceptor);
//Store the policy resources in newly created tenant's config. registry
Map<String, Resource> policyResourceMap = SecurityServiceHolder.getPolicyResourceMap();
try {
Registry registry = SecurityServiceHolder.getRegistryService().getConfigSystemRegistry(
tenantId);
boolean transactionStarted = Transaction.isStarted();
if (!transactionStarted) {
registry.beginTransaction();
}
for (Map.Entry<String, Resource> resourceLocEntry : policyResourceMap.entrySet()) {
if (!registry.resourceExists(resourceLocEntry.getKey())) {
registry.put(resourceLocEntry.getKey(), resourceLocEntry.getValue());
}
}
if (!transactionStarted) {
registry.commitTransaction();
}
} catch (Exception e) {
String errorMsg = "Error when storing the policy resource in registry for tenant : " +
tenantId;
log.error(errorMsg, e);
}
}
示例4: createdConfigurationContext
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
@Override
public void createdConfigurationContext(ConfigurationContext configCtx) {
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
//Register SecurityDeploymentInterceptor as an AxisObserver in tenant's AxisConfig.
SecurityDeploymentInterceptor secDeployInterceptor = new SecurityDeploymentInterceptor();
secDeployInterceptor.init(axisConfig);
axisConfig.addObservers(secDeployInterceptor);
//Store the policy resources in newly created tenant's config. registry
Map<String, Resource> policyResourceMap = SecurityServiceHolder.getPolicyResourceMap();
try {
Registry registry = SecurityServiceHolder.getRegistryService().getConfigSystemRegistry(
tenantId);
boolean transactionStarted = Transaction.isStarted();
if (!transactionStarted) {
registry.beginTransaction();
}
for (String resourceLoc : policyResourceMap.keySet()) {
if (!registry.resourceExists(resourceLoc)) {
registry.put(resourceLoc, policyResourceMap.get(resourceLoc));
}
}
if (!transactionStarted) {
registry.commitTransaction();
}
} catch (Exception e) {
String errorMsg = "Error when storing the policy resource in registry for tenant : " +
tenantId;
log.error(errorMsg, e);
}
}
示例5: activate
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
* @param ctxt
*/
protected void activate(ComponentContext ctxt) {
if (log.isDebugEnabled()) {
log.info("Registry WS API bundle is activated");
}
try {
AxisConfiguration config = configContext.getAxisConfiguration();
WSDeploymentInterceptor interceptor = new WSDeploymentInterceptor();
interceptor.init(config);
config.addObservers(interceptor);
} catch (Throwable e) {
log.error("Error occured while updating Registry WS API service", e);
}
}
示例6: creatingConfigurationContext
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
public void creatingConfigurationContext(org.apache.axis2.context.ConfigurationContext configCtx) {
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
//Register UrlMappingDeploymentInterceptor as an AxisObserver in tenant's AxisConfig.
UrlMappingDeploymentInterceptor secDeployInterceptor = new UrlMappingDeploymentInterceptor();
secDeployInterceptor.init(axisConfig);
axisConfig.addObservers(secDeployInterceptor);
}
示例7: init
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
* This method will be executed in order to initialize the caching module and this
* will set the CacheManager object to the ConfigurationContext and also populates the
* CacheConfiguration according to the cache policy
*
* @param configContext - ConfigurationContext for the cache objects to be added
* @param module - AxisModule to be initialized
* @throws AxisFault if an error occured in the process of initializing
*/
public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault {
this.moduleName = module.getName();
CacheConfiguration cacheConfig = null;
CachingObserver cachingObserver = new CachingObserver();
AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
axisConfiguration.addObservers(cachingObserver);
PolicySubject policySubject = module.getPolicySubject();
if (policySubject != null) {
try {
cacheConfig = CachingPolicyProcessor.processCachingPolicy(policySubject);
} catch (CachingException e) {
handleException("Unable to initialize the caching module : " +
"Error in processing caching policy", e);
}
}
// it is a must to have a gloabl configuration
if (cacheConfig == null) {
if (log.isDebugEnabled()) {
log.debug("Using the default initializer for the CacheConfiguration");
}
cacheConfig = new CacheConfiguration();
}
configContext.getAxisConfiguration().addParameter(
CachingConstants.CACHE_CONFIGURATION, cacheConfig);
configContext.setNonReplicableProperty(CachingConstants.CACHE_MANAGER, new CacheManager());
}
示例8: activate
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
protected void activate(ComponentContext context) {
if (cfgCtx != null) {
AxisConfiguration axisConfig = cfgCtx.getAxisConfiguration();
DiscoveryProxyObserver observer = new DiscoveryProxyObserver();
observer.init(axisConfig);
axisConfig.addObservers(observer);
} else {
log.warn("ConfigurationContext is not available. Unable to register the " +
"DiscoveryProxyObserver.");
}
}
示例9: init
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
* initialize the module
*/
public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault {
this.configctx = configContext;
initDefaultPolicy();
initDefaultThrottle();
Throttle throttle;
ThrottleObserver observer = new ThrottleObserver(configctx, defaultThrottle);
AxisConfiguration axisConfiguration = configctx.getAxisConfiguration();
axisConfiguration.addObservers(observer);
/**
* Global policy can be configured through the axis2.xml as well. If it is configured, we
* give priority to that policy over the one coming from the module.xml.
* This is done to allow user to modify the global policy without editing the module.xml
* of the throttle module.
*/
PolicySubject policySubject =
ThrottleEnguageUtils.readExternalGlobalPolicy(axisConfiguration);
if (policySubject == null) {
policySubject = module.getPolicySubject();
}
if (policySubject != null) {
List list = new ArrayList(policySubject.getAttachedPolicyComponents());
Policy policy = PolicyUtil.getMergedPolicy(list, null);
if (policy != null) {
try {
throttle = ThrottleFactory.createModuleThrottle(policy);
}
catch (ThrottleException e) {
log.error("Error was occurred when initiating throttle" +
" module " + e.getMessage());
log.info("Throttling will occur using default module policy");
String id = policy.getId();
policySubject.detachPolicyComponent(id);
defaultPolicy.setId(id);
policySubject.attachPolicy(defaultPolicy);
throttle = defaultThrottle;
}
if (throttle != null) {
Map throttles =
(Map) configctx.getPropertyNonReplicable(
ThrottleConstants.THROTTLES_MAP);
if (throttles == null) {
throttles = new HashMap();
configctx.setNonReplicableProperty(ThrottleConstants.THROTTLES_MAP,
throttles);
}
throttle.setId(ThrottleConstants.GLOBAL_THROTTLE_ID);
throttles.put(ThrottleConstants.GLOBAL_THROTTLE_KEY, throttle);
ConcurrentAccessController cac = throttle.getConcurrentAccessController();
if (cac != null) {
String cacKey = ThrottleConstants.THROTTLE_PROPERTY_PREFIX
+ ThrottleConstants.GLOBAL_THROTTLE_ID +
ThrottleConstants.CAC_SUFFIX;
configctx.setProperty(cacKey, cac);
}
}
}
}
}
示例10: registerServiceObserver
import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
* Engage the TargetServiceObserver on the given AxisConfiguration. This will enable
* service discovery.
*
* @param axisConf AxisConfiguration instance
*/
public static void registerServiceObserver(AxisConfiguration axisConf) {
TargetServiceObserver targetServiceObserver = new TargetServiceObserver();
targetServiceObserver.init(axisConf);
axisConf.addObservers(targetServiceObserver);
}