Java Code Examples for org.wso2.carbon.utils.ConfigurationContextService#getServerConfigContext()
The following examples show how to use
org.wso2.carbon.utils.ConfigurationContextService#getServerConfigContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractApi.java From attic-stratos with Apache License 2.0 | 6 votes |
protected ConfigurationContext getConfigContext() { // If a tenant has been set, then try to get the ConfigurationContext of that tenant PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); ConfigurationContextService configurationContextService = (ConfigurationContextService) carbonContext.getOSGiService(ConfigurationContextService.class); ConfigurationContext mainConfigContext = configurationContextService.getServerConfigContext(); String domain = carbonContext.getTenantDomain(); if (domain != null && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(domain)) { return TenantAxisUtils.getTenantConfigurationContext(domain, mainConfigContext); } else if (carbonContext.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) { return mainConfigContext; } else { throw new UnsupportedOperationException("Tenant domain unidentified. " + "Upstream code needs to identify & set the tenant domain & tenant ID. " + " The TenantDomain SOAP header could be set by the clients or " + "tenant authentication should be carried out."); } }
Example 2
Source File: ServiceUtils.java From product-private-paas with Apache License 2.0 | 6 votes |
private static ConfigurationContext getConfigContext() { // If a tenant has been set, then try to get the ConfigurationContext of that tenant PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); ConfigurationContextService configurationContextService = (ConfigurationContextService) carbonContext .getOSGiService(ConfigurationContextService.class); ConfigurationContext mainConfigContext = configurationContextService.getServerConfigContext(); String domain = carbonContext.getTenantDomain(); if (domain != null && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(domain)) { return TenantAxisUtils.getTenantConfigurationContext(domain, mainConfigContext); } else if (carbonContext.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) { return mainConfigContext; } else { throw new UnsupportedOperationException("Tenant domain unidentified. " + "Upstream code needs to identify & set the tenant domain & tenant ID. " + " The TenantDomain SOAP header could be set by the clients or " + "tenant authentication should be carried out."); } }
Example 3
Source File: AbstractAdmin.java From product-private-paas with Apache License 2.0 | 6 votes |
protected ConfigurationContext getConfigContext() { // If a tenant has been set, then try to get the ConfigurationContext of that tenant PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); ConfigurationContextService configurationContextService = (ConfigurationContextService) carbonContext .getOSGiService(ConfigurationContextService.class); ConfigurationContext mainConfigContext = configurationContextService.getServerConfigContext(); String domain = carbonContext.getTenantDomain(); if (domain != null && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(domain)) { return TenantAxisUtils.getTenantConfigurationContext(domain, mainConfigContext); } else if (carbonContext.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) { return mainConfigContext; } else { throw new UnsupportedOperationException("Tenant domain unidentified. " + "Upstream code needs to identify & set the tenant domain & tenant ID. " + " The TenantDomain SOAP header could be set by the clients or " + "tenant authentication should be carried out."); } }
Example 4
Source File: IdentityProviderServiceComponent.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * @param contextService */ protected void setConfigurationContextService(ConfigurationContextService contextService) { if (log.isDebugEnabled()) { log.debug("ConfigurationContextService set in Identity Provider bundle"); } configContext = contextService.getServerConfigContext(); }
Example 5
Source File: IdentitySTSMgtServiceComponent.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * @param contextService */ protected void setConfigurationContextService(ConfigurationContextService contextService) { if (log.isDebugEnabled()) { log.info("ConfigurationContextService set in Identity STS Mgt bundle"); } this.configContext = contextService.getServerConfigContext(); }
Example 6
Source File: StatisticsServiceComponent.java From carbon-commons with Apache License 2.0 | 5 votes |
@Reference( name = "config.context.service", service = org.wso2.carbon.utils.ConfigurationContextService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService contextService) { this.configContext = contextService.getServerConfigContext(); }
Example 7
Source File: RemoteTaskManager.java From carbon-commons with Apache License 2.0 | 5 votes |
private ClusteringAgent getClusteringAgent() throws TaskException { ConfigurationContextService configCtxService = TasksDSComponent .getConfigurationContextService(); if (configCtxService == null) { throw new TaskException("ConfigurationContextService not available " + "for notifying the cluster", Code.UNKNOWN); } ConfigurationContext configCtx = configCtxService.getServerConfigContext(); ClusteringAgent agent = configCtx.getAxisConfiguration().getClusteringAgent(); if (log.isDebugEnabled()) { log.debug("Clustering Agent: " + agent); } return agent; }
Example 8
Source File: SharedMemoryCacheUtil.java From carbon-commons with Apache License 2.0 | 5 votes |
/** * This is to send clusterMessage to inform other nodes about subscription added to the system, so that everyone can add new one. * @param topicName * @param subsciptionID * @param tenantID * @param tenantName * @throws ClusteringFault */ public static void sendAddSubscriptionClusterMessage(String topicName,String subsciptionID, int tenantID, String tenantName) throws ClusteringFault{ ConfigurationContextService configContextService = (ConfigurationContextService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(ConfigurationContextService.class); ConfigurationContext configContext = configContextService.getServerConfigContext(); ClusteringAgent agent = configContext.getAxisConfiguration().getClusteringAgent(); agent.sendMessage(new SubscriptionClusterMessage(topicName,subsciptionID,tenantID, tenantName), false); }
Example 9
Source File: VirtualHostClusterServiceComponent.java From carbon-commons with Apache License 2.0 | 5 votes |
@Reference( name = "config.context.service", service = org.wso2.carbon.utils.ConfigurationContextService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService ccService) { ConfigurationContext serverCtx = ccService.getServerConfigContext(); AxisConfiguration serverConfig = serverCtx.getAxisConfiguration(); LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(serverConfig); LocalTransportReceiver.CONFIG_CONTEXT.setServicePath("services"); LocalTransportReceiver.CONFIG_CONTEXT.setContextRoot("local:/"); DataHolder.getInstance().setConfigurationContextService(ccService); }