Java Code Examples for org.apache.axis2.context.ConfigurationContext#setProperty()
The following examples show how to use
org.apache.axis2.context.ConfigurationContext#setProperty() .
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: AbstractTracingHandler.java From carbon-commons with Apache License 2.0 | 6 votes |
/** * Appends SOAP message metadata to a message buffer * * @param configCtx The server ConfigurationContext * @param serviceName The service name * @param operationName The operation name * @param msgSeq The message sequence. Use -1 if unknown. */ protected void appendMessage(ConfigurationContext configCtx, String serviceName, String operationName, Long msgSeq) { CircularBuffer<MessageInfo> buffer = (CircularBuffer<MessageInfo>) configCtx.getProperty(TracerConstants.MSG_SEQ_BUFFER); if (buffer == null){ buffer = new CircularBuffer<MessageInfo>(TracerConstants.MSG_BUFFER_SZ); configCtx.setProperty(TracerConstants.MSG_SEQ_BUFFER, buffer); } GregorianCalendar cal = new GregorianCalendar(); cal.setTime(new Date()); MessageInfo messageInfo = new MessageInfo(); messageInfo.setMessageSequence(msgSeq); messageInfo.setOperationName(operationName); messageInfo.setServiceId(serviceName); messageInfo.setTimestamp(cal); buffer.append(messageInfo); }
Example 2
Source File: CoreServerInitializer.java From micro-integrator with Apache License 2.0 | 5 votes |
private ConfigurationContext getClientConfigurationContext() throws AxisFault { String clientRepositoryLocation = serverConfigurationService.getFirstProperty(CLIENT_REPOSITORY_LOCATION); String clientAxis2XmlLocationn = serverConfigurationService.getFirstProperty(CLIENT_AXIS2_XML_LOCATION); ConfigurationContext clientConfigContextToReturn = ConfigurationContextFactory .createConfigurationContextFromFileSystem(clientRepositoryLocation, clientAxis2XmlLocationn); MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); // Set the default max connections per host int defaultMaxConnPerHost = 500; Parameter defaultMaxConnPerHostParam = clientConfigContextToReturn.getAxisConfiguration() .getParameter("defaultMaxConnPerHost"); if (defaultMaxConnPerHostParam != null) { defaultMaxConnPerHost = Integer.parseInt((String) defaultMaxConnPerHostParam.getValue()); } params.setDefaultMaxConnectionsPerHost(defaultMaxConnPerHost); // Set the max total connections int maxTotalConnections = 15000; Parameter maxTotalConnectionsParam = clientConfigContextToReturn.getAxisConfiguration() .getParameter("maxTotalConnections"); if (maxTotalConnectionsParam != null) { maxTotalConnections = Integer.parseInt((String) maxTotalConnectionsParam.getValue()); } params.setMaxTotalConnections(maxTotalConnections); params.setSoTimeout(600000); params.setConnectionTimeout(600000); httpConnectionManager.setParams(params); clientConfigContextToReturn .setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, httpConnectionManager); clientConfigContextToReturn.setProperty(MicroIntegratorBaseConstants.WORK_DIR, serverWorkDir); return clientConfigContextToReturn; }
Example 3
Source File: ServerStatus.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Get the current server status * * @return The current server status * @throws AxisFault If an error occurs while getting the ConfigurationContext */ public static String getCurrentStatus() { ConfigurationContext configCtx = CarbonConfigurationContextFactory.getConfigurationContext(); String currentStatus = (String) configCtx.getProperty(CURRENT_SERVER_STATUS); if (currentStatus == null) { configCtx.setProperty(CURRENT_SERVER_STATUS, STATUS_STARTING); return STATUS_STARTING; } return currentStatus; }
Example 4
Source File: AutoscalerCloudControllerClient.java From attic-stratos with Apache License 2.0 | 5 votes |
private AutoscalerCloudControllerClient() { MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); params.setDefaultMaxConnectionsPerHost(AS_CC_CLIENT_MAX_CONNECTIONS_PER_HOST); params.setMaxTotalConnections(AS_CC_CLIENT_MAX_TOTAL_CONNECTIONS); multiThreadedHttpConnectionManager.setParams(params); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); try { ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); int port = conf.getInt("autoscaler.cloudController.port", AutoscalerConstants .CLOUD_CONTROLLER_DEFAULT_PORT); String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost"); String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX; int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000); stub = new CloudControllerServiceStub(ctx, epr); stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout); stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, cloudControllerClientTimeout); stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean .TRUE); } catch (Exception e) { log.error("Could not initialize cloud controller client", e); } }
Example 5
Source File: CloudControllerServiceClient.java From attic-stratos with Apache License 2.0 | 5 votes |
private CloudControllerServiceClient(String epr) throws AxisFault { MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); params.setDefaultMaxConnectionsPerHost(StratosConstants.CLOUD_CONTROLLER_CLIENT_MAX_CONNECTIONS_PER_HOST); params.setMaxTotalConnections(StratosConstants.CLOUD_CONTROLLER_CLIENT_MAX_TOTAL_CONNECTIONS); multiThreadedHttpConnectionManager.setParams(params); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); String ccSocketTimeout = System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT : System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT); String ccConnectionTimeout = System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT : System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT); try { stub = new CloudControllerServiceStub(ctx, epr); stub._getServiceClient().getOptions() .setProperty(HTTPConstants.SO_TIMEOUT, Integer.valueOf(ccSocketTimeout)); stub._getServiceClient().getOptions() .setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(ccConnectionTimeout)); stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean .TRUE); } catch (AxisFault axisFault) { String msg = "Could not initialize cloud controller service client"; log.error(msg, axisFault); throw new AxisFault(msg, axisFault); } }
Example 6
Source File: AutoscalerServiceClient.java From attic-stratos with Apache License 2.0 | 5 votes |
private AutoscalerServiceClient(String epr) throws AxisFault { MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); params.setDefaultMaxConnectionsPerHost(StratosConstants.AUTOSCALER_CLIENT_MAX_CONNECTIONS_PER_HOST); params.setMaxTotalConnections(StratosConstants.AUTOSCALER_CLIENT_MAX_TOTAL_CONNECTIONS); multiThreadedHttpConnectionManager.setParams(params); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); String autosclaerSocketTimeout = System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT : System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT); String autosclaerConnectionTimeout = System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT : System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT); try { stub = new AutoscalerServiceStub(ctx, epr); stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, Integer.valueOf(autosclaerSocketTimeout)); stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, Integer.valueOf(autosclaerConnectionTimeout)); stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean .TRUE); } catch (AxisFault axisFault) { String msg = "Could not initialize autoscaler service client"; log.error(msg, axisFault); throw new AxisFault(msg, axisFault); } }
Example 7
Source File: StratosManagerServiceClient.java From attic-stratos with Apache License 2.0 | 5 votes |
private StratosManagerServiceClient(String epr) throws AxisFault { MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); params.setDefaultMaxConnectionsPerHost(StratosConstants.STRATOS_MANAGER_CLIENT_MAX_CONNECTIONS_PER_HOST); params.setMaxTotalConnections(StratosConstants.STRATOS_MANAGER_CLIENT_MAX_TOTAL_CONNECTIONS); multiThreadedHttpConnectionManager.setParams(params); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); String ccSocketTimeout = System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_SOCKET_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT : System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_SOCKET_TIMEOUT); String ccConnectionTimeout = System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_CONNECTION_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT : System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_CONNECTION_TIMEOUT); try { stub = new StratosManagerServiceStub(ctx, epr); stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, Integer.valueOf (ccSocketTimeout)); stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, Integer.valueOf (ccConnectionTimeout)); stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean .TRUE); } catch (AxisFault axisFault) { String msg = "Could not initialize stratos manager service client"; log.error(msg, axisFault); throw new AxisFault(msg, axisFault); } }
Example 8
Source File: RegistryProviderUtil.java From product-es with Apache License 2.0 | 5 votes |
public WSRegistryServiceClient getWSRegistry (AutomationContext automationContext) throws Exception { System.setProperty("carbon.repo.write.mode", "true"); WSRegistryServiceClient registry = null; ConfigurationContext configContext; String axis2Repo = FrameworkPathUtil.getSystemResourceLocation() + File.separator + "client"; String axis2Conf = FrameworkPathUtil.getSystemResourceLocation() + "axis2config" + File.separator + "axis2_client.xml"; TestFrameworkUtils.setKeyStoreProperties(automationContext); try { configContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(axis2Repo, axis2Conf); configContext.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIME_OUT_VALUE); log.info("Group ConfigurationContext Timeout " + configContext.getServiceGroupContextTimeoutInterval()); registry = new WSRegistryServiceClient( automationContext.getContextUrls().getBackEndUrl(), automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword(), configContext); log.info("WS Registry Created - Login Successful"); } catch (Exception e) { handleException("Failed instantiate WSRegistry client instance ", e); } return registry; }
Example 9
Source File: ServerStatus.java From micro-integrator with Apache License 2.0 | 4 votes |
/** * Set server to running mode * * @throws AxisFault If an error occurs while getting the ConfigurationContext */ public static void setServerRunning() throws AxisFault { ConfigurationContext configCtx = CarbonConfigurationContextFactory.getConfigurationContext(); configCtx.setProperty(CURRENT_SERVER_STATUS, STATUS_RUNNING); }
Example 10
Source File: ServerStatus.java From micro-integrator with Apache License 2.0 | 4 votes |
/** * Set server to shutting-down mode * * @throws AxisFault If an error occurs while getting the ConfigurationContext */ public static void setServerShuttingDown() throws AxisFault { ConfigurationContext configCtx = CarbonConfigurationContextFactory.getConfigurationContext(); configCtx.setProperty(CURRENT_SERVER_STATUS, STATUS_SHUTTING_DOWN); }
Example 11
Source File: ServerStatus.java From micro-integrator with Apache License 2.0 | 4 votes |
/** * Set server to restarting-down mode * * @throws AxisFault If an error occurs while getting the ConfigurationContext */ public static void setServerRestarting() throws AxisFault { ConfigurationContext configCtx = CarbonConfigurationContextFactory.getConfigurationContext(); configCtx.setProperty(CURRENT_SERVER_STATUS, STATUS_RESTARTING); }
Example 12
Source File: ServerStatus.java From micro-integrator with Apache License 2.0 | 4 votes |
/** * Set server to maintenace mode * * @throws AxisFault If an error occurs while getting the ConfigurationContext */ public static void setServerInMaintenance() throws AxisFault { ConfigurationContext configCtx = CarbonConfigurationContextFactory.getConfigurationContext(); configCtx.setProperty(CURRENT_SERVER_STATUS, STATUS_IN_MAINTENANCE); }
Example 13
Source File: AttributeRequestProcessor.java From carbon-identity with Apache License 2.0 | 4 votes |
public ResponseToken process(RequestToken request) throws TrustException { MessageContext context = MessageContext.getCurrentMessageContext(); SAMLPassiveTokenIssuer issuer = null; WSHandlerResult handlerResults = null; WSSecurityEngineResult engineResult = null; WSUsernameTokenPrincipal principal = null; Vector<WSSecurityEngineResult> wsResults = null; ResponseToken reponseToken = null; Vector<WSHandlerResult> handlerResultsVector = null; OMElement rstr = null; try { if (request.getAttributes() == null || request.getAttributes().trim().length() == 0) { throw new TrustException("attributesMissing"); } principal = new WSUsernameTokenPrincipal(request.getUserName(), false); engineResult = new WSSecurityEngineResult(WSConstants.UT, principal, null, null, null); wsResults = new Vector<WSSecurityEngineResult>(); wsResults.add(engineResult); handlerResults = new WSHandlerResult("", wsResults); handlerResultsVector = new Vector<WSHandlerResult>(); handlerResultsVector.add(handlerResults); MessageContext.getCurrentMessageContext().setProperty(WSHandlerConstants.RECV_RESULTS, handlerResultsVector); MessageContext.getCurrentMessageContext().setProperty(RahasConstants.PASSIVE_STS_RST, getRST(request.getRealm(), request.getAttributes(), request.getDialect())); ConfigurationContext configurationContext = context.getConfigurationContext(); configurationContext.setProperty(TokenStorage.TOKEN_STORAGE_KEY, PassiveSTSUtil.getTokenStorage()); rahasData = new RahasData(context); issuer = new SAMLPassiveTokenIssuer(); issuer.setAudienceRestrictionCondition(request.getRealm()); issuer.setConfig(getSAMLTokenIssuerConfig(MessageContext.getCurrentMessageContext() .getAxisService(), true)); rstr = issuer.issuePassiveRSTR(rahasData); reponseToken = new ResponseToken(); reponseToken.setResults(rstr.toStringWithConsume()); } catch (Exception e) { throw new TrustException("errorWhileProcessingAttributeRequest", e); } return reponseToken; }