org.apache.axis2.engine.AxisConfiguration Java Examples
The following examples show how to use
org.apache.axis2.engine.AxisConfiguration.
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: EventBrokerUtils.java From carbon-commons with Apache License 2.0 | 6 votes |
public static MessageContext createMessageContext(OMElement payload, OMElement topic, int tenantId) throws EventBrokerException { MessageContext mc = new MessageContext(); mc.setConfigurationContext(new ConfigurationContext(new AxisConfiguration())); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId); SOAPFactory soapFactory = new SOAP12Factory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); envelope.getBody().addChild(payload); if (topic != null) { envelope.getHeader().addChild(topic); } try { mc.setEnvelope(envelope); } catch (Exception e) { throw new EventBrokerException("Unable to generate event.", e); } return mc; }
Example #2
Source File: DataServiceCappDeployer.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Deploy the data service artifacts and add them to data services. * * @param carbonApp find artifacts from this CarbonApplication instance. * @param axisConfig AxisConfiguration of the current tenant. */ @Override public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException { if (log.isDebugEnabled()) { log.debug("Deploying data services of carbon application - " + carbonApp.getAppName()); } ApplicationConfiguration appConfig = carbonApp.getAppConfig(); List<Artifact.Dependency> dependencies = appConfig.getApplicationArtifact().getDependencies(); List<Artifact> artifacts = new ArrayList<>(); for (Artifact.Dependency dependency : dependencies) { if (dependency.getArtifact() != null) { artifacts.add(dependency.getArtifact()); } } deployDataSources(artifacts, axisConfig); }
Example #3
Source File: LoadBalancerServiceComponent.java From attic-stratos with Apache License 2.0 | 6 votes |
/** * Registers the Endpoint deployer. * * @param axisConfig AxisConfiguration to which this deployer belongs * @param synapseEnvironment SynapseEnvironment to which this deployer belongs */ private void registerDeployer(AxisConfiguration axisConfig, SynapseEnvironment synapseEnvironment) throws TenantAwareLoadBalanceEndpointException { SynapseConfiguration synCfg = synapseEnvironment .getSynapseConfiguration(); DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig .getConfigurator(); SynapseArtifactDeploymentStore deploymentStore = synCfg .getArtifactDeploymentStore(); String synapseConfigPath = ServiceBusUtils .getSynapseConfigAbsPath(synapseEnvironment .getServerContextInformation()); String endpointDirPath = synapseConfigPath + File.separator + MultiXMLConfigurationBuilder.ENDPOINTS_DIR; for (Endpoint ep : synCfg.getDefinedEndpoints().values()) { if (ep.getFileName() != null) { deploymentStore.addRestoredArtifact(endpointDirPath + File.separator + ep.getFileName()); } } deploymentEngine.addDeployer(new EndpointDeployer(), endpointDirPath, ServiceBusConstants.ARTIFACT_EXTENSION); }
Example #4
Source File: SynapseAppDeployer.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Performing the action of importing the given meidation library * * @param libName * @param packageName * @param axisConfig AxisConfiguration of the current tenant * @throws AxisFault */ public void addImport(String libName, String packageName, AxisConfiguration axisConfig) throws AxisFault { SynapseImport synImport = new SynapseImport(); synImport.setLibName(libName); synImport.setLibPackage(packageName); OMElement impEl = SynapseImportSerializer.serializeImport(synImport); if (impEl != null) { try { addImport(impEl.toString(), axisConfig); } catch (AxisFault axisFault) { handleException(log, "Could not add Synapse Import", axisFault); } } else { handleException(log, "Could not add Synapse Import. Invalid import params for libName : " + libName + " packageName : " + packageName, null); } }
Example #5
Source File: IdentityUtilTest.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Test(dataProvider = "getServerURLData") public void testGetServerURL(String host, int port, String proxyCtx, String ctxRoot, String endpoint, boolean addProxyContextPath, boolean addWebContextRoot, String expected) throws Exception { when(CarbonUtils.getTransportPort(any(AxisConfiguration.class), anyString())).thenReturn(9443); when(CarbonUtils.getTransportProxyPort(any(AxisConfiguration.class), anyString())).thenReturn(port); when(CarbonUtils.getManagementTransport()).thenReturn("https"); when(mockServerConfiguration.getFirstProperty(IdentityCoreConstants.HOST_NAME)).thenReturn(host); when(mockServerConfiguration.getFirstProperty(IdentityCoreConstants.WEB_CONTEXT_ROOT)).thenReturn(ctxRoot); when(mockServerConfiguration.getFirstProperty(IdentityCoreConstants.PROXY_CONTEXT_PATH)).thenReturn(proxyCtx); assertEquals(IdentityUtil.getServerURL(endpoint, addProxyContextPath, addWebContextRoot), expected, String .format("Generated server url doesn't match the expected for input: host = %s, " + "port = %d, proxyCtx = %s, ctxRoot = %s, endpoint = %s, addProxyContextPath = %b, " + "addWebContextRoot = %b", host, port, proxyCtx, ctxRoot, endpoint, addProxyContextPath, addWebContextRoot)); }
Example #6
Source File: UrlMappingDeploymentInterceptor.java From carbon-commons with Apache License 2.0 | 6 votes |
@Activate 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); }
Example #7
Source File: ServiceComponent.java From micro-integrator with Apache License 2.0 | 6 votes |
private void engagePoxSecurity() { try { AxisConfiguration axisConfig = DataHolder.getInstance().getConfigCtx().getAxisConfiguration(); Parameter passwordCallbackParam = new Parameter(); DefaultPasswordCallback passwordCallbackClass = new DefaultPasswordCallback(); passwordCallbackParam.setName("passwordCallbackRef"); passwordCallbackParam.setValue(passwordCallbackClass); axisConfig.addParameter(passwordCallbackParam); String enablePoxSecurity = CarbonServerConfigurationService.getInstance() .getFirstProperty("EnablePoxSecurity"); if (enablePoxSecurity == null || "true".equals(enablePoxSecurity)) { AxisConfiguration mainAxisConfig = DataHolder.getInstance().getConfigCtx().getAxisConfiguration(); // Check for the module availability if (mainAxisConfig.getModules().toString().contains(POX_SECURITY_MODULE)){ mainAxisConfig.engageModule(POX_SECURITY_MODULE); log.debug("UT Security is activated"); } else { log.error("UT Security is not activated UTsecurity.mar is not available"); } } else { log.debug("POX Security Disabled"); } } catch (Throwable e) { log.error("Failed to activate Micro Integrator UT security module ", e); } }
Example #8
Source File: DataSourceCappDeployer.java From carbon-commons with Apache License 2.0 | 6 votes |
/** * Deploy the data source artifacts and add them to datasources. * * @param carbonApp - store info in this object after deploying * @param axisConfig - AxisConfiguration of the current tenant */ @Override public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException { if (log.isDebugEnabled()) { log.debug("Deploying carbon application - " + carbonApp.getAppName()); } ApplicationConfiguration appConfig = carbonApp.getAppConfig(); List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies(); List<Artifact> artifacts = new ArrayList<Artifact>(); for (Artifact.Dependency dep : deps) { if (dep.getArtifact() != null) { artifacts.add(dep.getArtifact()); } } deployUnDeployDataSources(true, artifacts); }
Example #9
Source File: CappDeployer.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Undeploy the provided carbon App by sending it through the registered undeployment handler chain. * * @param carbonApp - CarbonApplication instance * @param axisConfig - AxisConfiguration of the current tenant */ private void undeployCarbonApp(CarbonApplication carbonApp, AxisConfiguration axisConfig) { log.info("Undeploying Carbon Application : " + carbonApp.getAppNameWithVersion() + "..."); // Call the undeployer handler chain try { for (AppDeploymentHandler handler : appDeploymentHandlers) { handler.undeployArtifacts(carbonApp, axisConfig); } // Remove the app from cAppMap list removeCarbonApp(carbonApp); // Remove the app from registry // removing the extracted CApp form tmp/carbonapps/ FileManipulator.deleteDir(carbonApp.getExtractedPath()); log.info("Successfully undeployed Carbon Application : " + carbonApp.getAppNameWithVersion() + AppDeployerUtils.getTenantIdLogString(AppDeployerUtils.getTenantId())); } catch (Exception e) { log.error("Error occurred while trying to unDeploy : " + carbonApp.getAppNameWithVersion(), e); } }
Example #10
Source File: StatisticsAxis2ConfigurationContextObserver.java From carbon-commons with Apache License 2.0 | 6 votes |
public void createdConfigurationContext(ConfigurationContext configurationContext) { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); try { if (axisConfig.getModule(StatisticsConstants.STATISTISTICS_MODULE_NAME) != null) { axisConfig.engageModule(StatisticsConstants.STATISTISTICS_MODULE_NAME); } } catch (Throwable e) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); String msg; if (carbonContext.getTenantDomain() != null) { msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME + " module to tenant " + carbonContext.getTenantDomain() + "[" + carbonContext.getTenantId() + "]"; } else { msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME + " module to super tenant "; } log.error(msg, e); } }
Example #11
Source File: MediationPersistenceManager.java From micro-integrator with Apache License 2.0 | 6 votes |
protected Lock getLock(AxisConfiguration axisConfig) { Parameter p = axisConfig.getParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK); if (p != null) { return (Lock) p.getValue(); } else { log.warn(ServiceBusConstants.SYNAPSE_CONFIG_LOCK + " is null, Recreating a new lock"); Lock lock = new ReentrantLock(); try { axisConfig.addParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK, lock); return lock; } catch (AxisFault axisFault) { log.error("Error while setting " + ServiceBusConstants.SYNAPSE_CONFIG_LOCK); } } return null; }
Example #12
Source File: StatisticsServiceComponent.java From carbon-commons with Apache License 2.0 | 6 votes |
protected void unsetConfigurationContextService(ConfigurationContextService contextService) { AxisConfiguration axisConf = configContext.getAxisConfiguration(); if (axisConf != null) { AxisModule statModule = axisConf.getModule(StatisticsConstants.STATISTISTICS_MODULE_NAME); if (statModule != null) { try { axisConf.disengageModule(statModule); } catch (AxisFault axisFault) { log.error("Failed disengage module: " + StatisticsConstants.STATISTISTICS_MODULE_NAME); } } this.configContext = null; } }
Example #13
Source File: StatisticsAdmin.java From carbon-commons with Apache License 2.0 | 6 votes |
private AxisService getAxisService(String serviceName) { AxisConfiguration axisConfiguration = getAxisConfig(); AxisService axisService = axisConfiguration.getServiceForActivation(serviceName); // Check if the service in in ghost list try { if (axisService == null && GhostDeployerUtils. getTransitGhostServicesMap(axisConfiguration).containsKey(serviceName)) { GhostDeployerUtils.waitForServiceToLeaveTransit(serviceName, getAxisConfig()); axisService = axisConfiguration.getServiceForActivation(serviceName); } } catch (AxisFault axisFault) { log.error("Error occurred while service : " + serviceName + " is " + "trying to leave transit", axisFault); } return axisService; }
Example #14
Source File: DataServiceResource.java From micro-integrator with Apache License 2.0 | 6 votes |
private void populateDataServiceList(MessageContext msgCtx) throws Exception { SynapseConfiguration configuration = msgCtx.getConfiguration(); AxisConfiguration axisConfiguration = configuration.getAxisConfiguration(); String[] dataServicesNames = DBUtils.getAvailableDS(axisConfiguration); // initiate list model DataServicesList dataServicesList = new DataServicesList(dataServicesNames.length); for (String dataServiceName : dataServicesNames) { DataService dataService = getDataServiceByName(msgCtx, dataServiceName); ServiceMetaData serviceMetaData = getServiceMetaData(dataService); // initiate summary model DataServiceSummary summary = null; if (serviceMetaData != null) { summary = new DataServiceSummary(serviceMetaData.getName(), serviceMetaData.getWsdlURLs()); } dataServicesList.addServiceSummary(summary); } org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) msgCtx) .getAxis2MessageContext(); String stringPayload = new Gson().toJson(dataServicesList); Utils.setJsonPayLoad(axis2MessageContext, new JSONObject(stringPayload)); }
Example #15
Source File: DataSourceCappDeployer.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Deploy the data source artifacts and add them to datasources. * * @param carbonApp - store info in this object after deploying * @param axisConfig - AxisConfiguration of the current tenant */ @Override public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException { if (log.isDebugEnabled()) { log.debug("Deploying carbon application - " + carbonApp.getAppName()); } ApplicationConfiguration appConfig = carbonApp.getAppConfig(); List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies(); List<Artifact> artifacts = new ArrayList<Artifact>(); for (Artifact.Dependency dep : deps) { if (dep.getArtifact() != null) { artifacts.add(dep.getArtifact()); } } deployUnDeployDataSources(true, artifacts); }
Example #16
Source File: DataSourceCappDeployer.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Un-deploy the data sources and remove them from datasources. * * @param carbonApp - all information about the existing artifacts are in this instance. * @param axisConfig - AxisConfiguration of the current tenant. */ @Override public void undeployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException { if (log.isDebugEnabled()) { log.debug("Un-Deploying carbon application - " + carbonApp.getAppName()); } ApplicationConfiguration appConfig = carbonApp.getAppConfig(); List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies(); List<Artifact> artifacts = new ArrayList<Artifact>(); for (Artifact.Dependency dep : deps) { if (dep.getArtifact() != null) { artifacts.add(dep.getArtifact()); } } deployUnDeployDataSources(false, artifacts); }
Example #17
Source File: AutoscalerContext.java From attic-stratos with Apache License 2.0 | 6 votes |
private AutoscalerContext() { // Check clustering status AxisConfiguration axisConfiguration = ServiceReferenceHolder.getInstance().getAxisConfiguration(); if ((axisConfiguration != null) && (axisConfiguration.getClusteringAgent() != null)) { clustered = true; } // Initialize distributed object provider distributedObjectProvider = ServiceReferenceHolder.getInstance().getDistributedObjectProvider(); if (applicationContextMap == null) { applicationContextMap = distributedObjectProvider.getMap(AS_APPLICATION_ID_TO_APPLICATION_CTX_MAP);//new ConcurrentHashMap<String, ApplicationContext>(); } setClusterMonitors(distributedObjectProvider.getMap(AS_CLUSTER_ID_TO_CLUSTER_MONITOR_MAP)); setApplicationMonitors(distributedObjectProvider.getMap(AS_APPLICATION_ID_TO_APPLICATION_MONITOR_MAP)); pendingApplicationMonitors = distributedObjectProvider.getList(AS_PENDING_APPLICATION_MONITOR_LIST);//new ArrayList<String>(); applicationIdToNetworkPartitionAlgorithmContextMap = distributedObjectProvider.getMap(AS_APPLICATIOIN_ID_TO_NETWORK_PARTITION_ALGO_CTX_MAP); }
Example #18
Source File: TestUtils.java From carbon-apimgt with Apache License 2.0 | 6 votes |
public static MessageContext getMessageContextWithOutAuthContext(String context, String version) { SynapseConfiguration synCfg = new SynapseConfiguration(); org.apache.axis2.context.MessageContext axisMsgCtx = new org.apache.axis2.context.MessageContext(); axisMsgCtx.setIncomingTransportName("http"); axisMsgCtx.setProperty(Constants.Configuration.TRANSPORT_IN_URL, Path.SEPARATOR+context+Path.SEPARATOR+version + Path.SEPARATOR+"search.atom"); AxisConfiguration axisConfig = new AxisConfiguration(); ConfigurationContext cfgCtx = new ConfigurationContext(axisConfig); MessageContext synCtx = new Axis2MessageContext(axisMsgCtx, synCfg, new Axis2SynapseEnvironment(cfgCtx, synCfg)); synCtx.setProperty(RESTConstants.REST_API_CONTEXT, context); synCtx.setProperty(RESTConstants.SYNAPSE_REST_API_VERSION, version); synCtx.setProperty(APIConstants.API_ELECTED_RESOURCE, "resource"); Map map = new TreeMap(); map.put("host","127.0.0.1"); map.put("X-FORWARDED-FOR", "127.0.0.1"); map.put("Authorization", "Bearer 123456789"); synCtx.setProperty(RESTConstants.REST_API_CONTEXT, context); synCtx.setProperty(RESTConstants.SYNAPSE_REST_API_VERSION,version); ((Axis2MessageContext) synCtx).getAxis2MessageContext() .setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS, map); return synCtx; }
Example #19
Source File: DBUtils.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * This method returns the available data services names. * * @param axisConfiguration Axis configuration * @return names of available data services * @throws AxisFault */ public static String[] getAvailableDS(AxisConfiguration axisConfiguration) throws AxisFault { List<String> serviceList = new ArrayList<>(); Map<String, AxisService> map = axisConfiguration.getServices(); Set<String> set = map.keySet(); for (String serviceName : set) { AxisService axisService = axisConfiguration.getService(serviceName); Parameter parameter = axisService.getParameter(DBConstants.AXIS2_SERVICE_TYPE); if (parameter != null) { if (DBConstants.DB_SERVICE_TYPE.equals(parameter.getValue().toString())) { serviceList.add(serviceName); } } } return serviceList.toArray(new String[serviceList.size()]); }
Example #20
Source File: AbstractWsdlProcessor.java From micro-integrator with Apache License 2.0 | 5 votes |
protected void printWSDL(ConfigurationContext configurationContext, String serviceName, CarbonHttpResponse response, WSDLPrinter wsdlPrinter) throws IOException { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); AxisService axisService = axisConfig.getServiceForActivation(serviceName); OutputStream outputStream = response.getOutputStream(); if (axisService != null) { if(!RequestProcessorUtil.canExposeServiceMetadata(axisService)){ response.setError(HttpStatus.SC_FORBIDDEN, "Access to service metadata for service: " + serviceName + " has been forbidden"); return; } if (!axisService.isActive()) { response.addHeader(HTTP.CONTENT_TYPE, "text/html"); outputStream.write(("<h4>Service " + serviceName + " is inactive. Cannot display WSDL document.</h4>").getBytes()); outputStream.flush(); } else { response.addHeader(HTTP.CONTENT_TYPE, "text/xml"); wsdlPrinter.printWSDL(axisService); } } else { response.addHeader(HTTP.CONTENT_TYPE, "text/html"); outputStream.write(("<h4>Service " + serviceName + " not found. Cannot display WSDL document.</h4>").getBytes()); response.setError(HttpStatus.SC_NOT_FOUND); outputStream.flush(); } }
Example #21
Source File: SecurityConfigAdmin.java From carbon-identity with Apache License 2.0 | 5 votes |
public SecurityConfigAdmin(AxisConfiguration config) throws SecurityConfigException { this.axisConfig = config; try { this.registry = SecurityServiceHolder.getRegistryService().getConfigSystemRegistry(); this.govRegistry = SecurityServiceHolder.getRegistryService().getGovernanceSystemRegistry(); } catch (Exception e) { String msg = "Error when retrieving a registry instance"; log.error(msg); throw new SecurityConfigException(msg, e); } }
Example #22
Source File: ClusterAdmin.java From carbon-commons with Apache License 2.0 | 5 votes |
private ClusteringAgent getClusteringAgent() throws AxisFault { AxisConfiguration axisConfig = MessageContext.getCurrentMessageContext(). getConfigurationContext().getAxisConfiguration(); ClusteringAgent clusterManager = axisConfig.getClusteringAgent(); if (clusterManager == null) { handleException("ClusteringAgent not enabled in axis2.xml file"); } return clusterManager; }
Example #23
Source File: SystemStatisticsUtil.java From carbon-commons with Apache License 2.0 | 5 votes |
public double getAvgSystemResponseTime(AxisConfiguration axisConfig) { Parameter processor = axisConfig.getParameter(StatisticsConstants.RESPONSE_TIME_PROCESSOR); if (processor != null) { Object value = processor.getValue(); if (value instanceof ResponseTimeProcessor) { return ((ResponseTimeProcessor) value).getAvgResponseTime(); } } return 0; }
Example #24
Source File: FileRegistryResourceDeployer.java From micro-integrator with Apache License 2.0 | 5 votes |
@Override public void undeployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfiguration) throws DeploymentException { ApplicationConfiguration appConfig = carbonApplication.getAppConfig(); List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies(); List<Artifact> artifacts = new ArrayList<Artifact>(); for (Artifact.Dependency dep : deps) { if (dep.getArtifact() != null) { artifacts.add(dep.getArtifact()); } } undeployRegistryArtifacts(artifacts, carbonApplication.getAppNameWithVersion()); }
Example #25
Source File: Axis2ConfigServiceListener.java From micro-integrator with Apache License 2.0 | 5 votes |
private void registerConfigServiceProcessors(AxisConfiguration axisConfig) { configServiceProcessorMap = new HashMap<String, ConfigurationServiceProcessor>(); //Putting config service processors /* configServiceProcessorMap.put(Deployer.class.getName(), new DeployerServiceProcessor(axisConfig, bundleContext)); configServiceProcessorMap.put(Axis2ConfigParameterProvider.class.getName(), new Axis2ConfigParameterProcessor(axisConfig, bundleContext)); configServiceProcessorMap.put(AxisObserver.class.getName(), new AxisObserverProcessor(axisConfig, bundleContext));*/ }
Example #26
Source File: DeviceTypeCAppDeployer.java From carbon-device-mgt with Apache License 2.0 | 5 votes |
protected void undeployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig, String fileType , String directory) throws DeploymentException { for (Artifact artifact : artifacts) { Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType); if (deployer != null && AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED.equals(artifact.getDeploymentStatus())) { undeploy(deployer, artifact); } } }
Example #27
Source File: MultipleCredentialsUserProxy.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private MultipleCredentialUserStoreManager getUserStoreManager() throws UserStoreException { if (userStoreManager == null) { synchronized (lock) { if (userStoreManager == null) { // read parameter from axis2.xml AxisConfiguration axisConfiguration = CarbonConfigurationContextFactory.getConfigurationContext() .getAxisConfiguration(); String multipleCredentialDomain = (String) axisConfiguration.getParameterValue(DOMAIN_PARAMETER); if (multipleCredentialDomain == null) { multipleCredentialDomain = MULTIPLE_CREDENTIAL_DOMAIN_NAME; } UserStoreManager storeManager = realm.getUserStoreManager(); UserStoreManager second = storeManager.getSecondaryUserStoreManager(multipleCredentialDomain); if (second != null) { storeManager = second; } if (!(storeManager instanceof MultipleCredentialUserStoreManager)) { String msg = "User store does not support multiple credentials."; MultipleCredentialsNotSupportedException e = new MultipleCredentialsNotSupportedException( msg); log.fatal(msg, e); throw e; } userStoreManager = (MultipleCredentialUserStoreManager) storeManager; } } } return userStoreManager; }
Example #28
Source File: SecurityConfigAdmin.java From carbon-identity with Apache License 2.0 | 5 votes |
public SecurityConfigAdmin(UserRealm realm, Registry registry, AxisConfiguration config) throws SecurityConfigException { this.axisConfig = config; this.registry = registry; this.realm = realm; try { this.govRegistry = SecurityServiceHolder.getRegistryService().getGovernanceSystemRegistry( ((UserRegistry) registry).getTenantId()); } catch (Exception e) { log.error("Error when obtaining the governance registry instance."); throw new SecurityConfigException( "Error when obtaining the governance registry instance.", e); } }
Example #29
Source File: APIAuthenticationHandlerTestCase.java From carbon-apimgt with Apache License 2.0 | 5 votes |
@Test public void testDestroy() { APIAuthenticationHandler apiAuthenticationHandler = new APIAuthenticationHandler(); apiAuthenticationHandler.destroy(); SynapseEnvironment synapseEnvironment = Mockito.mock(SynapseEnvironment.class); SynapseConfiguration synapseConfiguration = Mockito.mock(SynapseConfiguration.class); AxisConfiguration axisConfiguration = Mockito.mock(AxisConfiguration.class); Mockito.when(synapseEnvironment.getSynapseConfiguration()).thenReturn(synapseConfiguration); Mockito.when(synapseConfiguration.getAxisConfiguration()).thenReturn(axisConfiguration); PowerMockito.mockStatic(Util.class); PowerMockito.when(Util.getTenantDomain()).thenReturn("carbon.super"); apiAuthenticationHandler.init(synapseEnvironment); apiAuthenticationHandler.destroy(); }
Example #30
Source File: TargetServiceObserver.java From carbon-commons with Apache License 2.0 | 5 votes |
public void init(AxisConfiguration axisConfig) { this.axisConfiguration = axisConfig; // There may be services deployed already // We need to send Hello messages for such services // Services deployed later will be picked up by the serviceUpdate event Map<String, AxisService> services = axisConfig.getServices(); for (AxisService service : services.values()) { sendHello(service); } }