当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationContextFactory.createDefaultConfigurationContext方法代码示例

本文整理汇总了Java中org.apache.axis2.context.ConfigurationContextFactory.createDefaultConfigurationContext方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContextFactory.createDefaultConfigurationContext方法的具体用法?Java ConfigurationContextFactory.createDefaultConfigurationContext怎么用?Java ConfigurationContextFactory.createDefaultConfigurationContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.context.ConfigurationContextFactory的用法示例。


在下文中一共展示了ConfigurationContextFactory.createDefaultConfigurationContext方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;

}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:18,代码来源:Authenticator.java

示例2: 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);
        }
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:27,代码来源:BasicAuthEntitlementServiceClient.java

示例3: testVersion

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public void testVersion() {
    XMLUnit.setIgnoreWhitespace(true);
    File testResourceFile = new File(wsdlLocation);
    try {
        WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
                new FileInputStream(testResourceFile));
        AxisService axisService = builder.populateService();
        ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
        axisConfig.addService(axisService);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        axisService.printWSDL(baos);
        assertXMLEqual(new FileReader(testResourceFile), new StringReader(new String(baos.toByteArray())));
    } catch (Exception e) {
        System.out.println("Error in WSDL : " + testResourceFile.getName());
        System.out.println("Exception: " + e.toString());
        fail("Caught exception " + e.toString());
    } finally {
        XMLUnit.setIgnoreWhitespace(false);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:WSDL11ToAxisServiceBuilderTest.java

示例4: testFaultReason

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public void testFaultReason() throws Exception {
    SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
    OMElement response = soapFactory.createOMElement(new QName("testNs",
            "test"));
    String faultReason = "myFaultReason";
    AxisFault fault = new AxisFault(new QName("myQname"), faultReason,
            "myFaultNode", "myFaultRole", response);

    ConfigurationContext cc = ConfigurationContextFactory
            .createDefaultConfigurationContext();
    MessageContext ctx = cc.createMessageContext();
    SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
    ctx.setEnvelope(fac.getDefaultEnvelope());
    MessageContext faultCtx = MessageContextBuilder
            .createFaultMessageContext(ctx, fault);

    assertEquals(faultReason, Utils.getInboundFaultFromMessageContext(
            faultCtx).getReason());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:FaultSerializationTest.java

示例5: testNoBuilder

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
/**
 * A builder is not added for the multipart/mixed as in the above test.
 * @throws Exception
 */
public void testNoBuilder() throws Exception {
       File file = getTestResourceFile("mime_message.txt");
       MIMEBuilder mimeBuilder = new MIMEBuilder();
       FileInputStream fis = new FileInputStream(file);
       ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
       AxisConfiguration axisConfig = configContext.getAxisConfiguration();
       MessageContext mc = new MessageContext();
       mc.setConfigurationContext(configContext);
       axisConfig.addMessageBuilder("multipart/related", new MIMEBuilder());
       axisConfig.addMessageBuilder("application/soap+xml", new SOAPBuilder());
       axisConfig.addMessageBuilder("text/xml", new SOAPBuilder());
       axisConfig.addMessageBuilder("application/xop+xml", new MTOMBuilder());
       axisConfig.addMessageBuilder("application/xml", new ApplicationXMLBuilder());
       axisConfig.addMessageBuilder("application/x-www-form-urlencoded",
                                    new XFormURLEncodedBuilder());
       axisConfig.addParameter(Constants.Configuration.USE_DEFAULT_FALLBACK_BUILDER, "true");
       OMElement envelope = TransportUtils.createSOAPMessage(mc,fis,"multipart/mixed;boundary=--MIMEBoundary258DE2D105298B756D");
       
       assertTrue(envelope != null);
       assertTrue(envelope instanceof SOAPEnvelope);
       OMElement firstElement = ((SOAPEnvelope)envelope).getBody().getFirstElement();
	assertTrue(firstElement instanceof OMSourcedElement);
	assertTrue(((OMSourcedElement)firstElement).getDataSource() instanceof UnknownContentOMDataSource);
   }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:UnknownContentBuilderTest.java

示例6: initializeRestClient

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的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);
}
 
开发者ID:apache,项目名称:stratos,代码行数:30,代码来源:RestCommandLineService.java

示例7: CarbonRemoteUserStoreManger

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
/**
 * @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);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:36,代码来源:CarbonRemoteUserStoreManger.java

示例8: testFaultSerialization

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public void testFaultSerialization() throws Exception {
    final String REASON = "ReasonValue";

    SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
    SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();
    SOAPFaultValue soapFaultValue = soapFactory
            .createSOAPFaultValue(soapFaultCode);
    soapFaultValue.setText(new QName(
            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, "Sender"));

    SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();
    SOAPFaultText soapFaultText = soapFactory
            .createSOAPFaultText(soapFaultReason);
    soapFaultText.setText(REASON);

    SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail();
    QName qName = new QName("http://mycompany.com", "FaultException", "ex");
    OMElement exception = soapFactory.createOMElement(qName,
            soapFaultDetail);
    exception.setText("Detail text");
    AxisFault fault = new AxisFault(soapFaultCode, soapFaultReason, null,
            null, soapFaultDetail);

    ConfigurationContext cc = ConfigurationContextFactory
            .createDefaultConfigurationContext();
    MessageContext ctx = cc.createMessageContext();
    SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
    ctx.setEnvelope(fac.getDefaultEnvelope());
    MessageContext faultCtx = MessageContextBuilder
            .createFaultMessageContext(ctx, fault);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    TransportUtils.writeMessage(faultCtx, bos);

    String result = new String(bos.toByteArray());

    // For right now, just making sure we have a test for AXIS2-2752
    // Confirm reason was correctly processed
    assertTrue("Incorrect or missing reason!", result.indexOf(REASON) > -1);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:41,代码来源:FaultSerializationTest.java

示例9: Java2WSDLBuilder

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public Java2WSDLBuilder() {
	try {
		ConfigurationContext configCtx = ConfigurationContextFactory
				.createDefaultConfigurationContext();
		axisConfig = configCtx.getAxisConfiguration();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:Java2WSDLBuilder.java

示例10: setUp

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    canRunTests();
    if (!canRunTests) {
        System.out.println("[WARNING] Aborting clustering tests");
        return;
    }

    System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, Utils.getIpAddress());

    // First cluster
    configurationContext1 =
            ConfigurationContextFactory.createDefaultConfigurationContext();
    serviceGroup1 = createAxisServiceGroup(configurationContext1);
    service1 = createAxisService(serviceGroup1);
    ctxMan1 = getContextManager();
    configMan1 = getConfigurationManager();
    clusterManager1 = getClusterManager(configurationContext1, ctxMan1, configMan1);
    clusterManager1.addParameter(domainParam);
    clusterManager1.init();
    System.out.println("---------- ClusteringAgent-1 successfully initialized -----------");

    // Second cluster
    configurationContext2 =
            ConfigurationContextFactory.createDefaultConfigurationContext();
    serviceGroup2 = createAxisServiceGroup(configurationContext2);
    service2 = createAxisService(serviceGroup2);
    ctxMan2 = getContextManager();
    configMan2 = getConfigurationManager();
    clusterManager2 = getClusterManager(configurationContext2, ctxMan2, configMan2);
    clusterManager2.addParameter(domainParam);
    clusterManager2.init();
    System.out.println("---------- ClusteringAgent-2 successfully initialized -----------");
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:34,代码来源:ContextReplicationTest.java

示例11: setUp

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
protected void setUp() throws Exception {

        Thread.sleep(3000);

        configurationContext1 = ConfigurationContextFactory.createDefaultConfigurationContext();
        configurationContext2 = ConfigurationContextFactory.createDefaultConfigurationContext();

        clusterManager1 = getClusterManager(configurationContext1);
        clusterManager2 = getClusterManager(configurationContext2);

        clusterManager1.getStateManager().setConfigurationContext(configurationContext1);
        clusterManager2.getStateManager().setConfigurationContext(configurationContext2);

        clusterManager1.getNodeManager().setConfigurationContext(configurationContext1);
        clusterManager2.getNodeManager().setConfigurationContext(configurationContext2);

        //giving both Nodes the same deployment configuration
        axisConfiguration1 = configurationContext1.getAxisConfiguration();
        serviceGroup1 = new AxisServiceGroup(axisConfiguration1);
        service1 = new AxisService(serviceName);
        serviceGroup1.addService(service1);
        axisConfiguration1.addServiceGroup(serviceGroup1);

        axisConfiguration2 = configurationContext2.getAxisConfiguration();
        serviceGroup2 = new AxisServiceGroup(axisConfiguration2);
        service2 = new AxisService(serviceName);
        serviceGroup2.addService(service2);
        axisConfiguration2.addServiceGroup(serviceGroup2);

        //Initiating ClusterManagers
        System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, Utils.getIpAddress());
        try {
            clusterManager1.init();
            System.out.println("ClusteringAgent-1 successfully initialized");
            System.out.println("*** PLEASE IGNORE THE java.net.ConnectException STACKTRACES. THIS IS EXPECTED ***");
            clusterManager2.init();
            System.out.println("ClusteringAgent-2 successfully initialized");
        } catch (ClusteringFault e) {
            String message =
                    "Could not initialize ClusterManagers. Please check the network connection";
            System.out.println(message + ": " + e);
            e.printStackTrace();
            skipChannelTests = true;
        }
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:46,代码来源:ClusterManagerTestCase.java

示例12: getDefaultConfigurationContext

import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public static ConfigurationContext getDefaultConfigurationContext() throws Exception {
    if (configCtx == null) {
        configCtx = ConfigurationContextFactory.createDefaultConfigurationContext();
    }
    return configCtx;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:7,代码来源:ConfigCtxCache.java


注:本文中的org.apache.axis2.context.ConfigurationContextFactory.createDefaultConfigurationContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。