Java Code Examples for org.apache.axis2.engine.AxisConfiguration#getService()
The following examples show how to use
org.apache.axis2.engine.AxisConfiguration#getService() .
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: 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 2
Source File: STSConfigAdmin.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Override WSAS callback handler to be able to auth users with usermanager. * * @param axisConfig * @throws AxisFault */ public static void overrideCallbackHandler(AxisConfiguration axisConfig, String service) throws AxisFault { AxisService sts = axisConfig.getService(service); Parameter cbHandlerParam = sts.getParameter(WSHandlerConstants.PW_CALLBACK_REF); if (cbHandlerParam != null) { sts.removeParameter(cbHandlerParam); if (log.isDebugEnabled()) { log.debug("removedParameter"); } } Parameter param = getPasswordCallBackRefParameter(); sts.addParameter(param); if (log.isDebugEnabled()) { log.debug("addedParameter"); } }
Example 3
Source File: IWADeploymentInterceptor.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Updates RelyingPartyService with Crypto information * * @param config AxisConfiguration * @throws Exception */ public static void populateRampartConfig(AxisConfiguration config) throws Exception { AxisService service; // Get the RelyingParty Service to update security policy with keystore information service = config.getService(IWA_SERVICE_NAME); if (service == null) { String msg = IWA_SERVICE_NAME + " is not available in the Configuration Context"; log.error(msg); } // Create a Rampart Config with default crypto information //Policy rampartConfig = IdentityBaseUtil.getDefaultRampartConfig(); Policy rampartConfig = IdentityBaseUtil.getDefaultRampartConfig(); // Add the RampartConfig to service policy service.getPolicySubject().attachPolicy(rampartConfig); }
Example 4
Source File: ComponentStartUpSynchronizerImpl.java From attic-stratos with Apache License 2.0 | 6 votes |
/** * Wait for a web service to be activated. * * @param axisServiceName * @throws AxisFault */ @Override public void waitForAxisServiceActivation(Component owner, String axisServiceName) throws AxisFault { if (!componentStartUpSynchronizerEnabled) { log.info(String.format("Component activation check is disabled, did not wait for %s to be activated.", axisServiceName)); return; } AxisConfiguration axisConfiguration = CarbonConfigurationContextFactory.getConfigurationContext() .getAxisConfiguration(); AxisService axisService = axisConfiguration.getService(axisServiceName); log.info(String.format("%s is set to wait for %s Axis service to be activated.", owner, axisServiceName)); if (!axisService.isActive()) { while (!axisService.isActive()) { log.info(String.format("%s is waiting for %s Axis service to be activated...", owner, axisServiceName)); try { Thread.sleep(componentActivationCheckInterval); } catch (InterruptedException ignore) { return; } } log.info(String.format("%s Axis service activated.", axisServiceName)); } }
Example 5
Source File: AbstractTransportService.java From micro-integrator with Apache License 2.0 | 5 votes |
public TransportParameter[] getServiceLevelTransportParameters( String service, boolean listener, AxisConfiguration axisConfig) throws Exception { if (axisConfig.getService(service) == null) { throw new CarbonException("No service exists by the name : " + service); } return getGlobalTransportParameters(listener, axisConfig); }
Example 6
Source File: AbstractTransportService.java From micro-integrator with Apache License 2.0 | 5 votes |
public void updateServiceLevelTransportParameters(String service, TransportParameter[] params, boolean listener, ConfigurationContext cfgCtx) throws Exception { AxisConfiguration axisConfig = cfgCtx.getAxisConfiguration(); if (axisConfig.getService(service) == null) { throw new CarbonException("No service exists by the name : " + service); } updateGlobalTransportParameters(params, listener, cfgCtx); }
Example 7
Source File: AxisConfigAdminService.java From carbon-commons with Apache License 2.0 | 5 votes |
/** * @param serviceId * @param operationId * @return Axis config data for the given axis operation */ public AxisConfigData getOperationAxisConfigData(String serviceId, String operationId) throws AxisFault { log.debug("Getting handler details for service " + serviceId + " operation " + operationId); AxisConfigData axisConfigData = new AxisConfigData(); AxisConfiguration axisConfiguration = getAxisConfig(); AxisService axisService = axisConfiguration.getService(serviceId); AxisOperation axisOperation = axisService.getOperation(new QName(operationId)); // adding phases to axis config data object axisConfigData. setInflowPhaseOrder(getPhaseOrderData(axisConfiguration.getInFlowPhases(), axisOperation.getRemainingPhasesInFlow(), false)); axisConfigData. setOutflowPhaseOrder(getPhaseOrderData(axisOperation.getPhasesOutFlow(), axisConfiguration.getOutFlowPhases(), true)); axisConfigData. setInfaultflowPhaseOrder(getPhaseOrderData(axisConfiguration.getInFaultFlowPhases(), axisOperation.getPhasesInFaultFlow(), false)); axisConfigData. setOutfaultPhaseOrder(getPhaseOrderData(axisOperation.getPhasesOutFaultFlow(), axisConfiguration.getOutFaultFlowPhases(), true)); return axisConfigData; }
Example 8
Source File: ServiceHTMLProcessor.java From micro-integrator with Apache License 2.0 | 4 votes |
public static String printServiceHTML(String serviceName, ConfigurationContext configurationContext) { StringBuffer temp = new StringBuffer(); try { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); AxisService axisService = axisConfig.getService(serviceName); if (axisService != null) { if (!axisService.isActive()) { temp.append("<b>Service ").append(serviceName). append(" is inactive. Cannot display service information.</b>"); } else { temp.append("<h3>").append(axisService.getName()).append("</h3>"); temp.append("<a href=\"").append(axisService.getName()).append("?wsdl\">wsdl</a> : "); temp.append("<a href=\"").append(axisService.getName()).append("?xsd\">schema</a> : "); temp.append("<a href=\"").append(axisService.getName()).append("?policy\">policy</a><br/>"); temp.append("<i>Service Description : "). append(axisService.getDocumentation()).append("</i><br/><br/>"); for (Iterator pubOpIter = axisService.getPublishedOperations().iterator(); pubOpIter.hasNext();) { temp.append("Published operations <ul>"); for (; pubOpIter.hasNext();) { AxisOperation axisOperation = (AxisOperation) pubOpIter.next(); temp.append("<li>"). append(axisOperation.getName().getLocalPart()).append("</li>"); } temp.append("</ul>"); } } } else { temp.append("<b>Service ").append(serviceName). append(" not found. Cannot display service information.</b>"); } return "<html><head><title>Service Information</title></head>" + "<body>" + temp + "</body></html>"; } catch (AxisFault axisFault) { return "<html><head><title>Error Occurred</title></head>" + "<body>" + "<hr><h2><font color=\"blue\">" + axisFault.getMessage() + "</font></h2></body></html>"; } }
Example 9
Source File: STSConfigAdmin.java From carbon-identity with Apache License 2.0 | 4 votes |
public static void configureService(AxisConfiguration config, Registry registry) throws IdentityProviderException { AxisConfiguration axisConfig = IdentitySTSMgtServiceComponent.getConfigurationContext().getAxisConfiguration(); try { ServerConfiguration serverConfig = ServerConfiguration.getInstance(); String ksName = serverConfig.getFirstProperty(STSMgtConstants.ServerConfigProperty.SECURITY_KEYSTORE_LOCATION); ksName = ksName.substring(ksName.lastIndexOf("/") + 1); SecurityConfigAdmin admin = new SecurityConfigAdmin(config, registry, new IPPasswordCallbackHandler()); if (log.isDebugEnabled()) { log.debug("Applying identity security policy for Identity STS services"); } if (IdentityProviderUtil.isIntial()) { if (axisConfig.getService(IdentityConstants.SERVICE_NAME_STS_UT) != null) { admin.applySecurity(IdentityConstants.SERVICE_NAME_STS_UT, STSMgtConstants.Policy.POLICY_SCENARIO19, null, null, null, null); } if (axisConfig.getService(IdentityConstants.OpenId.SERVICE_NAME_STS_OPENID) != null) { admin.applySecurity(IdentityConstants.OpenId.SERVICE_NAME_STS_OPENID, STSMgtConstants.Policy.POLICY_SCENARIO19, null, null, null, null); } if (axisConfig.getService(IdentityConstants.SERVICE_NAME_STS_IC) != null) { admin.applySecurity(IdentityConstants.SERVICE_NAME_STS_IC, STSMgtConstants.Policy.POLICY_SCENARIO18, null, new String[] { ksName }, ksName, null); } if (axisConfig.getService(IdentityConstants.OpenId.SERVICE_NAME_STS_IC_OPENID) != null) { admin.applySecurity(IdentityConstants.OpenId.SERVICE_NAME_STS_IC_OPENID, STSMgtConstants.Policy.POLICY_SCENARIO18, null, new String[] { ksName }, ksName, null); } if (axisConfig.getService(IdentityConstants.SERVICE_NAME_STS_UT_SYMM) != null) { admin.applySecurity(IdentityConstants.SERVICE_NAME_STS_UT_SYMM, STSMgtConstants.Policy.POLICY_SCENARIO18, null, new String[] { ksName }, ksName, null); } if (axisConfig.getService(IdentityConstants.SERVICE_NAME_STS_IC_SYMM) != null) { admin.applySecurity(IdentityConstants.SERVICE_NAME_STS_IC_SYMM, STSMgtConstants.Policy.POLICY_SCENARIO18, null, new String[] { ksName }, ksName, null); } } if (axisConfig.getService(IdentityConstants.SERVICE_NAME_STS_UT) != null) { overrideCallbackHandler(axisConfig, IdentityConstants.SERVICE_NAME_STS_UT); } if (axisConfig.getService(IdentityConstants.SERVICE_NAME_STS_UT_SYMM) != null) { overrideCallbackHandler(axisConfig, IdentityConstants.SERVICE_NAME_STS_UT_SYMM); } if (axisConfig.getService(IdentityConstants.OpenId.SERVICE_NAME_STS_OPENID) != null) { overrideCallbackHandler(axisConfig, IdentityConstants.OpenId.SERVICE_NAME_STS_OPENID); } if (axisConfig.getService(IdentityConstants.SERVICE_NAME_STS_IC) != null) { overrideCallbackHandler(axisConfig, IdentityConstants.SERVICE_NAME_STS_IC); } } catch (Exception e) { log.error("errorInChangingSecurityConfiguration", e); throw new IdentityProviderException("errorInChangingSecurityConfiguration", e); } }
Example 10
Source File: WSDL2FormGenerator.java From carbon-commons with Apache License 2.0 | 4 votes |
private synchronized void updateMockProxyServiceGroup(AxisService axisService, ConfigurationContext configCtx, AxisConfiguration axisConfig) throws AxisFault { /*axisService.addParameter("supportSingleOperation", Boolean.TRUE); AxisOperation singleOP = new InOutAxisOperation(new QName("invokeTryItProxyService")); singleOP.setDocumentation("This operation is a 'passthrough' for all operations in " + " TryIt proxy service."); axisService.addOperation(singleOP);*/ ProxyMessageReceiver receiver = new ProxyMessageReceiver(configCtx); PhasesInfo phaseInfo = axisConfig.getPhasesInfo(); for (Iterator i = axisService.getOperations(); i.hasNext();) { AxisOperation op = (AxisOperation) i.next(); op.setMessageReceiver(receiver); phaseInfo.setOperationPhases(op); } AxisServiceGroup serviceGroup; synchronized (axisConfig) { serviceGroup = axisConfig.getServiceGroup(TRYIT_SG_NAME); if (serviceGroup == null) { serviceGroup = new AxisServiceGroup(); serviceGroup.setServiceGroupName(TRYIT_SG_NAME); serviceGroup.addParameter("DoAuthentication", "false"); serviceGroup.addParameter("adminService", "true"); } // resolving Axis service name conflicts. AxisService testService = axisConfig.getService(axisService.getName()); if (testService != null) { for (int loop = 1; ; loop++) { String testName = axisService.getName() + "_" + loop; if (axisConfig.getService(testName) == null) { axisService.setName(testName); break; } } } serviceGroup.addService(axisService); axisConfig.addServiceGroup(serviceGroup); axisService.addParameter(LAST_TOUCH_TIME, System.currentTimeMillis()); axisService.addParameter("modifyUserWSDLPortAddress", "false"); // Set the timer. Parameter parameter = axisConfig.getParameter(PROXY_TIMER); if (parameter == null) { Timer timer = new Timer(); timer.scheduleAtFixedRate(new ProxyTimerTask(axisConfig), PERIOD, PERIOD); parameter = new Parameter(PROXY_TIMER, timer); axisConfig.addParameter(parameter); } } }