public Java2WSDLBuilder() { try { ConfigurationContext configCtx = ConfigurationContextFactory .createDefaultConfigurationContext(); axisConfig = configCtx.getAxisConfiguration(); } catch (Exception e) { throw new RuntimeException(e); } }
public Java2WSDLBuilder(OutputStream out, String className, ClassLoader classLoader) { try { ConfigurationContext configCtx = ConfigurationContextFactory .createDefaultConfigurationContext(); axisConfig = configCtx.getAxisConfiguration(); this.out = out; this.className = className; this.classLoader = classLoader; } catch (Exception e) { throw new RuntimeException(e); } }
public Java2WSDLBuilder() { try { ConfigurationContext configCtx = ConfigurationContextFactory .createDefaultConfigurationContext(); axisConfig = configCtx.getAxisConfiguration(); } catch (Exception e) { throw new RuntimeException(e); } }
public Java2WSDLBuilder(OutputStream out, String className, ClassLoader classLoader) { try { ConfigurationContext configCtx = ConfigurationContextFactory .createDefaultConfigurationContext(); axisConfig = configCtx.getAxisConfiguration(); this.out = out; this.className = className; this.classLoader = classLoader; } catch (Exception e) { throw new RuntimeException(e); } }
public static String getHostWithHTTP(){ String host = ""; try { host += "http://" + NetworkUtils.getLocalHostname() + ":" + CarbonUtils.getTransportPort(ConfigurationContextFactory.createDefaultConfigurationContext(), "http"); } catch (Exception e) { log.error("Error occurred while getting host", e); } return host; } }
public static String getHost(String abbr){ String host = ""; if("%http%".equals(abbr)){ try { host += "http://" + NetworkUtils.getLocalHostname() + ":" + CarbonUtils.getTransportPort(ConfigurationContextFactory.createDefaultConfigurationContext(), "http"); } catch (Exception e) { log.error("Error occurred while getting host", e); log.debug("Error: " + e); } }else if("%https%".equals(abbr)){ try { host += "https://" + NetworkUtils.getLocalHostname() + ":" + CarbonUtils.getTransportPort(ConfigurationContextFactory.createDefaultConfigurationContext(), "https"); } catch (Exception e) { log.error("Error occurred while getting host", e); } }else{ host = abbr; } return host; }
private EntitlementServiceStub getEntitlementStub(String serverUrl) throws Exception { if (entitlementStub.containsKey(serverUrl)) { return entitlementStub.get(serverUrl); } EntitlementServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementServiceStub(configurationContext, serverUrl + "EntitlementService"); entitlementStub.put(serverUrl, stub); return stub; }
private EntitlementServiceStub getEntitlementStub(String serverUrl) throws Exception { if (entitlementStub.containsKey(serverUrl)) { return entitlementStub.get(serverUrl); } EntitlementServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementServiceStub(configurationContext, serverUrl + "EntitlementService"); entitlementStub.put(serverUrl, stub); return stub; }
private EntitlementPolicyAdminServiceStub getEntitlementAdminStub(String serverUrl) throws Exception { if (policyAdminStub.containsKey(serverUrl)) { return policyAdminStub.get(serverUrl); } EntitlementPolicyAdminServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementPolicyAdminServiceStub(configurationContext, serverUrl + "EntitlementPolicyAdminService"); policyAdminStub.put(serverUrl, stub); return stub; }
private EntitlementPolicyAdminServiceStub getEntitlementAdminStub(String serverUrl) throws Exception { if (policyAdminStub.containsKey(serverUrl)) { return policyAdminStub.get(serverUrl); } EntitlementPolicyAdminServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementPolicyAdminServiceStub(configurationContext, serverUrl + "EntitlementPolicyAdminService"); policyAdminStub.put(serverUrl, stub); return stub; }
private void initConfigurationContext() throws Exception { HttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); File configFile = new File(DEFAULT_AXIS2_XML); if (!configFile.exists()) { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); configurationContext.setProperty(HTTPConstants.DEFAULT_MAX_CONNECTIONS_PER_HOST, MAX_CONNECTIONS_PER_HOST); } else { configurationContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(DEFAULT_CLIENT_REPO, DEFAULT_AXIS2_XML); } configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); configurationContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE); Map<String, TransportOutDescription> transportsOut = configurationContext.getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { if (Constants.TRANSPORT_HTTP.equals(transportOutDescription.getName()) || Constants.TRANSPORT_HTTPS.equals(transportOutDescription.getName())) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } } }
private void initConfigurationContext() throws Exception { HttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); File configFile = new File(DEFAULT_AXIS2_XML); if (!configFile.exists()) { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); configurationContext.setProperty(HTTPConstants.DEFAULT_MAX_CONNECTIONS_PER_HOST, MAX_CONNECTIONS_PER_HOST); } else { configurationContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(DEFAULT_CLIENT_REPO, DEFAULT_AXIS2_XML); } configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); configurationContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE); Map<String, TransportOutDescription> transportsOut = configurationContext.getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { if (Constants.TRANSPORT_HTTP.equals(transportOutDescription.getName()) || Constants.TRANSPORT_HTTPS.equals(transportOutDescription.getName())) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } } }
/** * @param realmConfig * @param properties * @throws Exception */ public CarbonRemoteUserStoreManger(RealmConfiguration realmConfig, Map properties) throws Exception { ConfigurationContext configurationContext = ConfigurationContextFactory .createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } String[] serverUrls = realmConfig.getUserStoreProperty(SERVER_URLS).split(","); for (int i = 0; i < serverUrls.length; i++) { remoteUserStore = new WSUserStoreManager( realmConfig.getUserStoreProperty(REMOTE_USER_NAME), realmConfig.getUserStoreProperty(PASSWORD), serverUrls[i], configurationContext); if (log.isDebugEnabled()) { log.debug("Remote Servers for User Management : " + serverUrls[i]); } remoteServers.put(serverUrls[i], remoteUserStore); } this.realmConfig = realmConfig; domainName = realmConfig.getUserStoreProperty(UserStoreConfigConstants.DOMAIN_NAME); }
private boolean authenticate() throws Exception { ConfigurationContext configurationContext; configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } boolean isAuthenticated = false; if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) { //if authorized cookie is not available authorize using credentials AuthenticationAdminStub authAdmin = new AuthenticationAdminStub(configurationContext, serverUrl); isAuthenticated = authAdmin.login(userName, password, "localhost"); cookie = (String) authAdmin._getServiceClient().getServiceContext() .getProperty(HTTPConstants.COOKIE_STRING); authAdmin._getServiceClient().cleanupTransport(); } else if (StringUtils.isNotEmpty(authorizedCookie)) { //when authorized cookie is available assign it to local variable isAuthenticated = true; cookie = authorizedCookie; } return isAuthenticated; }
private boolean authenticate() throws Exception { ConfigurationContext configurationContext; configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } boolean isAuthenticated = false; if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) { //if authorized cookie is not available authorize using credentials AuthenticationAdminStub authAdmin = new AuthenticationAdminStub(configurationContext, serverUrl); isAuthenticated = authAdmin.login(userName, password, "localhost"); cookie = (String) authAdmin._getServiceClient().getServiceContext() .getProperty(HTTPConstants.COOKIE_STRING); authAdmin._getServiceClient().cleanupTransport(); } else if (StringUtils.isNotEmpty(authorizedCookie)) { //when authorized cookie is available assign it to local variable isAuthenticated = true; cookie = authorizedCookie; } return isAuthenticated; }
@Init public void start() throws Exception { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); configurationContext.setServicePath(servicePath);
/** * Initialize the rest client and set username and password of the user * * @param serverURL server URL * @param username username * @param password password * @throws AxisFault */ private void initializeRestClient(String serverURL, String username, String password) throws AxisFault { HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator(); authenticator.setUsername(username); authenticator.setPassword(password); authenticator.setPreemptiveAuthentication(true); ConfigurationContext configurationContext; try { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); } catch (Exception e) { String msg = "Backend error occurred. Please contact the service admins!"; throw new AxisFault(msg, e); } HashMap<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } this.restClient = new RestClient(serverURL, username, password); }