本文整理汇总了Java中org.apache.axis2.context.ConfigurationContext类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContext类的具体用法?Java ConfigurationContext怎么用?Java ConfigurationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationContext类属于org.apache.axis2.context包,在下文中一共展示了ConfigurationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStubs
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
private Stubs getStubs(String serverUrl) throws Exception
{
final ConfigurationContext ctx = getConfiguration();
final HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.ProxyProperties();
final ProxyDetails proxy = configService.getProxyDetails();
if( proxy.isConfigured() && !proxy.isHostExcepted(new URL(serverUrl).getHost()) )
{
proxyProperties.setProxyName(proxy.getHost());
proxyProperties.setProxyPort(proxy.getPort());
ctx.setProperty(HTTPConstants.PROXY, proxyProperties);
}
ctx.setProperty(HTTPConstants.SO_TIMEOUT, 120000);
ctx.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 120000);
return new Stubs(ctx, serverUrl);
}
示例2: ApplicationManagementServiceClient
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
/**
* @param cookie
* @param backendServerURL
* @param configCtx
* @throws AxisFault
*/
public ApplicationManagementServiceClient(String cookie, String backendServerURL,
ConfigurationContext configCtx) throws AxisFault {
String serviceURL = backendServerURL + "IdentityApplicationManagementService";
String userAdminServiceURL = backendServerURL + "UserAdmin";
stub = new IdentityApplicationManagementServiceStub(configCtx, serviceURL);
userAdminStub = new UserAdminStub(configCtx, userAdminServiceURL);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
ServiceClient userAdminClient = userAdminStub._getServiceClient();
Options userAdminOptions = userAdminClient.getOptions();
userAdminOptions.setManageSession(true);
userAdminOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
if (debugEnabled) {
log.debug("Invoking service " + serviceURL);
}
}
示例3: verifyCertExistence
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
/**
* Check whether the certificate is available in the file system
*
* @param fileName file name
* @param configurationContext configuration context of the current message
*/
private static boolean verifyCertExistence(String fileName, ConfigurationContext configurationContext) {
String workDir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR);
String filePath = workDir + File.separator + "pub_certs" + File.separator + fileName;
File pubCert = new File(workDir + File.separator + "pub_certs" + File.separator + fileName);
//if cert is still available then exit
if (pubCert.exists()) {
Map fileResourcesMap = (Map) configurationContext.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
if (fileResourcesMap == null) {
fileResourcesMap = new Hashtable();
configurationContext.setProperty(WSO2Constants.FILE_RESOURCE_MAP, fileResourcesMap);
}
if (fileResourcesMap.get(fileName) == null) {
fileResourcesMap.put(fileName, filePath);
}
return true;
}
return false;
}
示例4: terminatingConfigurationContext
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
public void terminatingConfigurationContext(ConfigurationContext context) {
try {
org.wso2.carbon.user.api.UserRealm tenantRealm = CarbonContext
.getThreadLocalCarbonContext().getUserRealm();
RealmConfiguration realmConfig = tenantRealm.getRealmConfiguration();
AbstractUserStoreManager userStoreManager = (AbstractUserStoreManager) tenantRealm
.getUserStoreManager();
userStoreManager.clearAllSecondaryUserStores();
realmConfig.setSecondaryRealmConfig(null);
userStoreManager.setSecondaryUserStoreManager(null);
log.info("Unloaded all secondary user stores for tenant "
+ CarbonContext.getThreadLocalCarbonContext().getTenantId());
} catch (Exception ex) {
log.error(ex.getMessage());
}
}
示例5: UserProfileCient
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
public UserProfileCient(String cookie, String url,
ConfigurationContext configContext) throws java.lang.Exception {
try {
this.serviceEndPoint = url + "UserProfileMgtService";
stub = new UserProfileMgtServiceStub(configContext, serviceEndPoint);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
cookie);
} catch (java.lang.Exception e) {
log.error(e);
throw e;
}
}
示例6: loadTransportProperties
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
private static Properties loadTransportProperties() throws Exception {
transportProperties = new Properties();
try {
ConfigurationContext configContext = CarbonConfigurationContextFactory.getConfigurationContext();
AxisConfiguration axisConfig = configContext.getAxisConfiguration();
TransportOutDescription mailto = axisConfig.getTransportOut("mailto");
ArrayList<Parameter> parameters = mailto.getParameters();
for (Parameter parameter : parameters) {
String prop = parameter.getName();
String value = (String)parameter.getValue();
transportProperties.setProperty(prop, value);
}
}
catch (Exception e) {
throw e;
}
return transportProperties;
}
示例7: init
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
private void init() throws IOException {
String repositoryPath =
System.getProperty(ESBTestConstant.CARBON_HOME) + File.separator + "samples" + File.separator +
"axis2Client" + File.separator + DEFAULT_CLIENT_REPO;
File repository = new File(repositoryPath);
if (log.isDebugEnabled()) {
log.debug("Axis2 repository path: " + repository.getAbsolutePath());
}
ConfigurationContext configurationContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
repository.getCanonicalPath(), null);
serviceClient = new ServiceClient(configurationContext, null);
log.info("LoadBalanceSessionFullClient initialized successfully...");
}
示例8: main
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
String epr = "https://" + HOST_IP + ":" + HOST_HTTPS_PORT + "/services/samples/SecureDataService";
System.setProperty("javax.net.ssl.trustStore", (new File(CLIENT_JKS_PATH)).getAbsolutePath());
ConfigurationContext ctx = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(null, null);
SecureDataServiceStub stub = new SecureDataServiceStub(ctx, epr);
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
client.engageModule("rampart");
options.setUserName("admin");
options.setPassword("admin");
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(SECURITY_POLICY_PATH));
Office[] offices = stub.showAllOffices();
for (Office office : offices) {
System.out.println("\t-----------------------------");
System.out.println("\tOffice Code: " + office.getOfficeCode());
System.out.println("\tPhone: " + office.getPhone());
System.out.println("\tAddress Line 1: " + office.getAddressLine1());
System.out.println("\tAddress Line 2: " + office.getAddressLine2());
System.out.println("\tCity: " + office.getCity());
System.out.println("\tState: " + office.getState());
System.out.println("\tPostal Code: " + office.getPostalCode());
System.out.println("\tCountry: " + office.getCountry());
}
}
示例9: getStartedTenantWebapp
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
/**
* Get the details of a deployed webapp for tenants
*
* @param path URI path
* @return meta data for webapp
*/
public static WebApplication getStartedTenantWebapp(String tenantDomain, String path) {
ConfigurationContextService contextService = IntegratorComponent.getContextService();
ConfigurationContext configContext;
ConfigurationContext tenantContext;
if (null != contextService) {
// Getting server's configContext instance
configContext = contextService.getServerConfigContext();
tenantContext = TenantAxisUtils.getTenantConfigurationContext(tenantDomain, configContext);
Map<String, WebApplicationsHolder> webApplicationsHolderMap = WebAppUtils.getAllWebappHolders(tenantContext);
WebApplication matchedWebApplication;
for (WebApplicationsHolder webApplicationsHolder : webApplicationsHolderMap.values()) {
for (WebApplication webApplication : webApplicationsHolder.getStartedWebapps().values()) {
if (path.contains(webApplication.getContextName())) {
matchedWebApplication = webApplication;
return matchedWebApplication;
}
}
}
}
return null;
}
示例10: getTenantAxisService
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
/**
* Get the details of a deployed webapp for tenants
*
* @param serviceURL URI path
* @return meta data for webapp
*/
private static AxisService getTenantAxisService(String tenant, String serviceURL) throws AxisFault {
ConfigurationContextService contextService = IntegratorComponent.getContextService();
ConfigurationContext configContext;
ConfigurationContext tenantContext;
if (null != contextService) {
// Getting server's configContext instance
configContext = contextService.getServerConfigContext();
String[] urlparts = serviceURL.split("/");
//urlpart[0] is tenant domain
tenantContext = TenantAxisUtils.getTenantConfigurationContext(tenant, configContext);
AxisService tenantAxisService = tenantContext.getAxisConfiguration().getService(urlparts[1]);
if (tenantAxisService == null) {
AxisServiceGroup axisServiceGroup = tenantContext.getAxisConfiguration().getServiceGroup(urlparts[1]);
if (axisServiceGroup != null) {
return axisServiceGroup.getService(urlparts[2]);
} else {
// for dss samples
return tenantContext.getAxisConfiguration().getService(urlparts[2]);
}
} else {
return tenantAxisService;
}
}
return null;
}
示例11: init
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
/**
* init method in TransportListener
*
* @param axisConf
* @param transprtIn
* @throws AxisFault
*/
public void init(ConfigurationContext axisConf, TransportInDescription transprtIn)
throws AxisFault {
try {
this.configurationContext = axisConf;
// if (httpFactory == null) {
// httpFactory = new IheHttpFactory(configurationContext, actor.getConnection());
// }
//
// if (actor.getConnection().getHostname() != null) {
// hostAddress = actor.getConnection().getHostname();
// } else {
// hostAddress = httpFactory.getHostAddress();
// }
} catch (Exception e1) {
throw AxisFault.makeFault(e1);
}
}
示例12: doCreateStubs
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
private void doCreateStubs(@Nullable ConfigurationContext configContext,
String isccProvider,
String isccProvider4,
String download,
String upload,
String workItemService,
String groupSecurity) {
myDownloadUrl = download;
myUploadUrl = upload;
try {
if (configContext == null) {
configContext = WebServiceHelper.getStubConfigurationContext();
}
myRepository = new RepositoryStub(configContext, TfsUtil.appendPath(myServerUri, isccProvider));
myRepository4 = new RepositoryStub(configContext, TfsUtil.appendPath(myServerUri, isccProvider4));
myWorkItemTrackingClientService =
new ClientService2Stub(configContext, TfsUtil.appendPath(myServerUri, workItemService));
myGroupSecurityService =
new GroupSecurityServiceStub(configContext, TfsUtil.appendPath(myServerUri, groupSecurity));
}
catch (Exception e) {
LOG.error("Failed to initialize web service stub", e);
}
}
示例13: getNewConfigurationContext
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
public static ConfigurationContext getNewConfigurationContext(String repositry)
throws Exception {
final File file = new File(repositry);
boolean exists = exists(file);
if (!exists) {
throw new Exception("repository directory " + file.getAbsolutePath()
+ " does not exists");
}
File axis2xml = new File(file, "axis.xml");
String axis2xmlString = null;
if (exists(axis2xml)) {
axis2xmlString = axis2xml.getName();
}
String path = (String) org.apache.axis2.java.security.AccessController.doPrivileged(
new PrivilegedAction<String>() {
public String run() {
return file.getAbsolutePath();
}
}
);
return ConfigurationContextFactory
.createConfigurationContextFromFileSystem(path, axis2xmlString);
}
示例14: initializeRestClient
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
/**
* 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);
}
示例15: buildServiceGroup
import org.apache.axis2.context.ConfigurationContext; //导入依赖的package包/类
/**
* To build a AxisServiceGroup for a given services.xml
* You have to add the created group into AxisConfig
*
* @param servicesxml InputStream created from services.xml or equivalent
* @param classLoader ClassLoader to use
* @param serviceGroupName name of the service group
* @param configCtx the ConfigurationContext in which we're deploying
* @param archiveReader the ArchiveReader we're working with
* @param wsdlServices Map of existing WSDL services
* @return a fleshed-out AxisServiceGroup
* @throws AxisFault if there's a problem
*/
public static AxisServiceGroup buildServiceGroup(InputStream servicesxml,
ClassLoader classLoader,
String serviceGroupName,
ConfigurationContext configCtx,
ArchiveReader archiveReader,
HashMap wsdlServices) throws AxisFault {
DeploymentFileData currentDeploymentFile = new DeploymentFileData(null, null);
currentDeploymentFile.setClassLoader(classLoader);
AxisServiceGroup serviceGroup = new AxisServiceGroup();
serviceGroup.setServiceGroupClassLoader(classLoader);
serviceGroup.setServiceGroupName(serviceGroupName);
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
try {
ArrayList serviceList = archiveReader.buildServiceGroup(servicesxml,
currentDeploymentFile,
serviceGroup,
wsdlServices, configCtx);
fillServiceGroup(serviceGroup, serviceList, null, axisConfig);
return serviceGroup;
} catch (XMLStreamException e) {
throw AxisFault.makeFault(e);
}
}