本文整理汇总了Java中org.apache.axis2.context.ConfigurationContextFactory类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContextFactory类的具体用法?Java ConfigurationContextFactory怎么用?Java ConfigurationContextFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationContextFactory类属于org.apache.axis2.context包,在下文中一共展示了ConfigurationContextFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
@Override
public void init(PublisherDataHolder propertyHolder) throws EntitlementException {
PublisherPropertyDTO[] propertyDTOs = propertyHolder.getPropertyDTOs();
for (PublisherPropertyDTO dto : propertyDTOs) {
if ("subscriberURL".equals(dto.getId())) {
serverUrl = dto.getValue();
} else if ("subscriberUserName".equals(dto.getId())) {
serverUserName = dto.getValue();
} else if ("subscriberPassword".equals(dto.getId())) {
serverPassword = dto.getValue();
}
}
try {
configCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
} catch (AxisFault axisFault) {
log.error("Error while initializing module", axisFault);
throw new EntitlementException("Error while initializing module", axisFault);
}
}
示例2: AxisOperationClient
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
public AxisOperationClient() {
String repositoryPath = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
"samples" + File.separator + "axis2Server" + File.separator + "repository";
File repository = new File(repositoryPath);
log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());
try {
cfgCtx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository.getCanonicalPath(),
null);
serviceClient = new ServiceClient(cfgCtx, null);
log.info("Sample clients initialized successfully...");
} catch (Exception e) {
log.error("Error while initializing the Operational Client", e);
}
}
示例3: init
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的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...");
}
示例4: LoadbalanceFailoverClient
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
public LoadbalanceFailoverClient() {
String repositoryPath = System.getProperty(ESBTestConstant.CARBON_HOME) + File.separator + "samples" + File.separator + "axis2Client" +
File.separator + "client_repo";
File repository = new File(repositoryPath);
log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());
try {
cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
repository.getCanonicalPath(), null);
serviceClient = new ServiceClient(cfgCtx, null);
log.info("Sample clients initialized successfully...");
} catch (Exception e) {
log.error("Error while initializing the StockQuoteClient", e);
}
}
示例5: SampleAxis2Server
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
public SampleAxis2Server(String axis2xmlFile) {
repositoryPath = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
"samples" + File.separator + "axis2Server" + File.separator + "repository";
File repository = new File(repositoryPath);
log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());
try {
File axis2xml = copyResourceToFileSystem(axis2xmlFile, "axis2.xml");
if (axis2xml == null) {
log.error("Error while copying the test axis2.xml to the file system");
return;
}
log.info("Loading axis2.xml from: " + axis2xml.getAbsolutePath());
cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
repository.getAbsolutePath(), axis2xml.getAbsolutePath());
} catch (Exception e) {
log.error("Error while initializing the configuration context", e);
}
}
示例6: Axis2ServerManager
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
public Axis2ServerManager(String axis2xmlFile) {
repositoryPath = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
"samples" + File.separator + "axis2Server" + File.separator + "repository";
File repository = new File(repositoryPath);
log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());
try {
File axis2xml = copyResourceToFileSystem(axis2xmlFile, "axis2.xml");
if (!axis2xml.exists()) {
log.error("Error while copying the test axis2.xml to the file system");
return;
}
log.info("Loading axis2.xml from: " + axis2xml.getAbsolutePath());
cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
repository.getAbsolutePath(), axis2xml.getAbsolutePath());
} catch (Exception e) {
log.error("Error while initializing the configuration context", e);
}
}
示例7: main
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的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());
}
}
示例8: RemoteAppManagerConnector
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
public RemoteAppManagerConnector(AppManagementConfig appManagementConfig, DeviceManagementRepository pluginRepository) {
IdentityConfigurations identityConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig().
getDeviceManagementConfigRepository().getIdentityConfigurations();
this.authenticator =
new ServiceAuthenticator(identityConfig.getAdminUsername(), identityConfig.getAdminPassword());
this.oAuthAdminServiceUrl =
identityConfig.getServerUrl() + DeviceManagementConstants.AppManagement.OAUTH_ADMIN_SERVICE;
try {
this.configCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
} catch (AxisFault e) {
throw new IllegalArgumentException("Error occurred while initializing Axis2 Configuration Context. " +
"Please check if an appropriate axis2.xml is provided", e);
}
this.pluginRepository = pluginRepository;
}
示例9: main
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
public static void main(String[] args) throws AuthenticationException, AiravataSecurityException, AxisFault {
String accessToken = authenticate("[email protected]", "master").getAccess_token();
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
DefaultOAuthClient defaultOAuthClient = new DefaultOAuthClient(hostName+"/services/",username,password, configContext);
OAuth2TokenValidationResponseDTO tokenValidationRequestDTO = defaultOAuthClient.validateAccessToken(accessToken);
String authorizedUser = tokenValidationRequestDTO.getAuthorizedUser();
AuthzToken authzToken = new AuthzToken();
authzToken.setAccessToken(accessToken);
Map<String, String> claimsMap = new HashMap<>();
claimsMap.put(Constants.USER_NAME, "scigap_admin");
claimsMap.put(Constants.API_METHOD_NAME, "/airavata/getAPIVersion");
authzToken.setClaimsMap(claimsMap);
DefaultXACMLPEP defaultXACMLPEP = new DefaultXACMLPEP(hostName+"/services/",username,password,configContext);
HashMap<String, String> metaDataMap = new HashMap();
boolean result = defaultXACMLPEP.getAuthorizationDecision(authzToken, metaDataMap);
System.out.println(result);
}
示例10: init
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
@Override
public void init(ServletConfig config) throws EntitlementCacheUpdateServletException {
EntitlementCacheUpdateServletDataHolder.getInstance().setServletConfig(config);
try {
EntitlementCacheUpdateServletDataHolder.getInstance().setConfigCtx(ConfigurationContextFactory
.createConfigurationContextFromFileSystem(null, null));
} catch (AxisFault e) {
log.error("Error while initializing Configuration Context", e);
throw new EntitlementCacheUpdateServletException("Error while initializing Configuration Context", e);
}
EntitlementCacheUpdateServletDataHolder.getInstance().setHttpsPort(config.getInitParameter(EntitlementConstants.HTTPS_PORT));
EntitlementCacheUpdateServletDataHolder.getInstance().setAuthentication(config.getInitParameter(EntitlementConstants.AUTHENTICATION));
EntitlementCacheUpdateServletDataHolder.getInstance().setRemoteServiceUrl(config.getServletContext().getInitParameter(EntitlementConstants.REMOTE_SERVICE_URL));
EntitlementCacheUpdateServletDataHolder.getInstance().setRemoteServiceUserName(config.getServletContext().getInitParameter(EntitlementConstants.USERNAME));
EntitlementCacheUpdateServletDataHolder.getInstance().setRemoteServicePassword(config.getServletContext().getInitParameter(EntitlementConstants.PASSWORD));
EntitlementCacheUpdateServletDataHolder.getInstance().setAuthenticationPage(config.getInitParameter(EntitlementConstants.AUTHENTICATION_PAGE));
EntitlementCacheUpdateServletDataHolder.getInstance().setAuthenticationPageURL(config.getInitParameter(EntitlementConstants.AUTHENTICATION_PAGE_URL));
}
示例11: authenticate
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
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);
}
AuthenticationAdminStub authAdmin = new AuthenticationAdminStub(configurationContext,
serverUrl);
boolean isAuthenticated = authAdmin.login(userName, password, "localhost");
cookie = (String) authAdmin._getServiceClient().getServiceContext()
.getProperty(HTTPConstants.COOKIE_STRING);
authAdmin._getServiceClient().cleanupTransport();
return isAuthenticated;
}
示例12: initConfigurationContext
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
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);
}
}
}
示例13: setUp
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
//Setup the MockAttachment-Server
try {
ConfigurationContext context =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_XML_FILE_PATH, "axis2.xml");
ConfigurationContextService service = new ConfigurationContextService(context, null);
AttachmentServerHolder.getInstance().setConfigurationContextService(service);
}catch (Exception e) {
}
server = new MockAttachmentServer();
attachmentServerHolder = AttachmentServerHolder.getInstance();
attachmentServerHolder.setAttachmentServer(server);
server.init();
}
示例14: Axis2ServerManager
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
public Axis2ServerManager(String axis2xmlFile) {
repositoryPath = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
"samples" + File.separator + "axis2Server" + File.separator + "repository";
File repository = new File(repositoryPath);
log.info("Using the Axis2 repository path: " + repository.getAbsolutePath());
try {
File axis2xml = copyResourceToFileSystem(axis2xmlFile, "axis2.xml");
if (!axis2xml.exists()) {
log.error("Error while copying the test axis2.xml to the file system");
return;
}
log.info("Loading axis2.xml from: " + axis2xml.getAbsolutePath());
cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
repository.getAbsolutePath(), axis2xml.getAbsolutePath());
} catch (Exception e) {
log.error("Error while initializing the configuration context", e);
}
}
示例15: setUp
import org.apache.axis2.context.ConfigurationContextFactory; //导入依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
System.setProperty("javax.net.ssl.trustStore", CARBON_HOME + "/resources/security/wso2carbon.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
System.setProperty("javax.net.ssl.trustStoreType","JKS");
try {
configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(axis2Repo, axis2Conf);
authenticate(configContext, serverURL);
registry = new WSRegistryServiceClient(serverURL, "admin", "admin", configContext);
registry.addSecurityOptions(policyPath, CARBON_HOME + "/resources/security/wso2carbon.jks",username,password);
} catch (Exception e) {
e.printStackTrace();
fail("Failed to authenticate the client. Caused by: " + e.getMessage());
}
}