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


Java OMElement.getText方法代码示例

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


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

示例1: loadOperation

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public OMElement loadOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement loadElement = param.getFirstChildWithName(new QName("load"));
        String l = loadElement.getText();
        long load = Long.parseLong(l);

        for (long i = 0; i < load; i++) {
            System.out.println("Iteration: " + i);
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            loadElement.setText("Response from server: " + sName);
        } else {
            loadElement.setText("Response from anonymous server");
        }
        return param;
    }
 
开发者ID:wso2,项目名称:product-ei,代码行数:22,代码来源:LBService1.java

示例2: getPropertyFromAxisConf

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
private static String getPropertyFromAxisConf(String parameter) throws IOException, XMLStreamException {
    try (InputStream file = new FileInputStream(Paths.get(CarbonBaseUtils.getCarbonConfigDirPath(), "axis2",
            "axis2.xml").toString())) {
       if(axis2Config == null) {
           OMElement element = (OMElement) XMLUtils.toOM(file);
           element.build();
           axis2Config = element;
       }
        Iterator parameters = axis2Config.getChildrenWithName(new QName("parameter"));
        while (parameters.hasNext()) {
            OMElement parameterElement = (OMElement) parameters.next();
            if (parameter.equals(parameterElement.getAttribute(new QName("name")).getAttributeValue())) {
                return parameterElement.getText();
            }
        }
        return null;
    } catch (IOException | XMLStreamException e) {
        throw e;
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:21,代码来源:Utils.java

示例3: createRuleDTO

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public static RuleElementDTO createRuleDTO(OMElement omElement) {
    RuleElementDTO ruleElementDTO = new RuleElementDTO();

    if (omElement != null) {
        ruleElementDTO.setRuleId(omElement.
                getAttributeValue(new QName(EntitlementPolicyConstants.RULE_ID)).trim());
        ruleElementDTO.setRuleEffect(omElement.
                getAttributeValue(new QName(EntitlementPolicyConstants.RULE_EFFECT)).trim());

        Iterator iterator1 = omElement.
                getChildrenWithLocalName(EntitlementPolicyConstants.DESCRIPTION_ELEMENT);

        while (iterator1.hasNext()) {
            OMElement descriptionElement = (OMElement) iterator1.next();
            if (descriptionElement != null && descriptionElement.getText() != null) {
                ruleElementDTO.setRuleDescription(descriptionElement.getText().trim());
            }
        }
    }

    return ruleElementDTO;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:PolicyEditorUtil.java

示例4: generateParameterMap

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
 * populates endpoint parameter map
 * @param element
 * @return created Inbound Endpoint parametr map
 */
private Map<String,String> generateParameterMap(OMElement element) {

	Map<String,String> paramMap = new HashMap<String, String>();
	OMElement params = element.getFirstChildWithName(new QName(XMLConfigConstants.SYNAPSE_NAMESPACE,
	                                                           "parameters"));
	if (params != null) {
		Iterator<OMElement> iterator = params.getChildrenWithName(new QName(XMLConfigConstants.SYNAPSE_NAMESPACE,"parameter"));
		while (iterator.hasNext()) {
			OMElement parametreElement = iterator.next();
			String nameAttr = parametreElement.getAttribute(new QName("name")).getAttributeValue();
			String valueAttr = parametreElement.getText();
			paramMap.put(nameAttr,valueAttr);
		}
	}

	return paramMap;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:ESBTestCaseUtils.java

示例5: build

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public static InboundProvisioningConfig build(OMElement inboundProvisioningConfigOM) {
    InboundProvisioningConfig inboundProvisioningConfig = new InboundProvisioningConfig();

    if (inboundProvisioningConfigOM == null) {
        return inboundProvisioningConfig;
    }

    Iterator<?> iter = inboundProvisioningConfigOM.getChildElements();

    while (iter.hasNext()) {
        OMElement element = (OMElement) (iter.next());
        String elementName = element.getLocalName();

        if ("ProvisioningUserStore".equals(elementName)) {
            inboundProvisioningConfig.setProvisioningUserStore(element.getText());
        } else if ("IsProvisioningEnabled".equals(elementName) && element.getText() != null) {
            inboundProvisioningConfig.setProvisioningEnabled(Boolean.parseBoolean(element.getText()));
        } else if ("IsDumbModeEnabled".equals(elementName) && element.getText() != null) {
            inboundProvisioningConfig.setDumbMode(Boolean.parseBoolean(element.getText()));
        }
    }

    return inboundProvisioningConfig;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:InboundProvisioningConfig.java

示例6: getPolicyRegistryPath

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
 * This will return the policy path which is taken from registry. ie the original policy. It will be retrieved
 * from the policy which is attached to the service
 *
 * @param serviceName name of the service.
 * @return Registry path to policy.
 */
private String getPolicyRegistryPath(String serviceName) {
    AxisService service = axisConfig.getServiceForActivation(serviceName);
    // Define an empty string. This will only get executed when a policy is picked from registry. Having an empty
    // string will avoid issues if something went wrong while adding policy path to carbonSecConfig
    String policyPath = "";
    try {
        OMElement carbonSecConfig = getCarbonSecConfigs(getCurrentPolicy(service));
        OMElement policyPathElement = carbonSecConfig.getFirstChildWithName(new QName(SecurityConstants
                .SECURITY_NAMESPACE, POLICY_PATH));
        if (policyPathElement != null) {
            policyPath = policyPathElement.getText();
        }
    } catch (SecurityConfigException e) {
        log.error("Error while retrieving current policy from service", e);
    }
    return policyPath;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:SecurityConfigAdmin.java

示例7: sleepOperation

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public OMElement sleepOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement timeElement = param.getFirstChildWithName(new QName("load"));
        String time = timeElement.getText();
        try {
            Thread.sleep(Long.parseLong(time));
        } catch (InterruptedException e) {
            throw new AxisFault("Service is interrupted while sleeping.");
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            timeElement.setText("Response from server: " + sName);
        } else {
            timeElement.setText("Response from anonymous server");
        }
        return param;
    }
 
开发者ID:wso2,项目名称:product-ei,代码行数:22,代码来源:LBService1.java

示例8: sessionlessClient

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public String sessionlessClient() throws AxisFault {

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMElement value = fac.createOMElement("Value", null);
        value.setText("Sample string");

        Options options = new Options();
        options.setTo(new EndpointReference("http://localhost:8480/services/LBService1"));

        options.setAction("urn:sampleOperation");


        long timeout = Integer.parseInt(getProperty("timeout", "10000000"));
        System.out.println("timeout=" + timeout);
        options.setTimeOutInMilliSeconds(timeout);

        // set addressing, transport and proxy url
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference("http://localhost:8480"));

        serviceClient.setOptions(options);
        String testString = "";

        long i = 0;
        while (i < 100) {

            serviceClient.getOptions().setManageSession(true);
            OMElement responseElement = serviceClient.sendReceive(value);
            String response = responseElement.getText();

            i++;
            System.out.println("Request: " + i + " ==> " + response);
            testString = testString.concat(":" + i + ">" + response + ":");
        }

        return testString;
    }
 
开发者ID:wso2,项目名称:product-ei,代码行数:38,代码来源:LoadbalanceFailoverClient.java

示例9: sendLoadBalanceRequest

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
 * This method is used to send a single request to the load balancing service
 * @param proxyURL will be the location where load balancing proxy or sequence is defined.
 * @param serviceURL will be the URL for LBService
 * @return the response
 * @throws org.apache.axis2.AxisFault
 */
public String sendLoadBalanceRequest(String proxyURL,String serviceURL,String clientTimeoutInMilliSeconds) throws AxisFault {

    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMElement value = fac.createOMElement("Value", null);
    value.setText("Sample string");

    Options options = new Options();
    if (proxyURL != null && !"null".equals(proxyURL)) {
        options.setTo(new EndpointReference(proxyURL));
    }

    options.setAction("urn:sampleOperation");

    long timeout = Integer.parseInt(getProperty("timeout", clientTimeoutInMilliSeconds));
    System.out.println("timeout=" + timeout);
    options.setTimeOutInMilliSeconds(timeout);

    if (serviceURL != null && !"null".equals(serviceURL)) {
        // set addressing, transport and proxy url
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference(serviceURL));
    }

    serviceClient.setOptions(options);

    serviceClient.getOptions().setManageSession(true);
    OMElement responseElement = serviceClient.sendReceive(value);
    String response = responseElement.getText();

    return response;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:39,代码来源:LoadbalanceFailoverClient.java

示例10: parseCustomQuoteResponse

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
 * Digests the custom quote response and extracts the last trade price
 * @param result
 * @return
 * @throws javax.xml.stream.XMLStreamException
 *
 *      <CheckPriceResponse xmlns="http://ws.invesbot.com/" >
 *          <Code>IBM</Code>
 *          <Price>82.90</Price>
 *      </CheckPriceResponse>
 */
public static String parseCustomQuoteResponse(OMElement result) throws Exception {

    AXIOMXPath xPath = new AXIOMXPath("//ns:Price");
    xPath.addNamespace("ns","http://services.samples/xsd");
    OMElement price = (OMElement) xPath.selectSingleNode(result);        
    if (price != null) {
        return price.getText();
    } else {
        throw new Exception("Unexpected response : " + result);
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:StockQuoteHandler.java

示例11: parseOrder

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
 * @param payload XML message content came inside the JMS message
 * @throws XMLStreamException on error
 */
private void parseOrder(String payload) throws XMLStreamException {
    InputStream is = new ByteArrayInputStream(payload.getBytes());
    javax.xml.stream.XMLStreamReader parser = XMLInputFactory
            .newInstance().createXMLStreamReader(is);
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(parser,
            null);
    SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
    // retrieve SOAP body
    SOAPBody soapBody = envelope.getBody();
    OMElement messageNode = soapBody.getFirstChildWithName(new QName(
            FIX_MSG));
    Iterator<?> messageElements = (Iterator<?>) messageNode
            .getChildElements();
    while (messageElements.hasNext()) {
        OMElement node = (OMElement) messageElements.next();
        if (node.getQName().getLocalPart().equals(FIX_MSG_BODY)) {
            Iterator<?> bodyElements = (Iterator<?>) node.getChildElements();
            while (bodyElements.hasNext()) {
                OMElement bodyNode = (OMElement) bodyElements.next();
                String tag = bodyNode
                        .getAttributeValue(new QName(FIX_MSG_ID));
                String value = bodyNode.getText();
                if (tag.equals(FIX_MSG_SYMBOL)) {
                    inSymbol = value;
                } else if (tag.equals(FIX_MSG_CLORDID)) {
                    inClOrderID = value;
                } else if (tag.equals(FIX_MSG_ORDQTY)) {
                    inQty = value;
                }
            }
        }
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:38,代码来源:AMQPConsumer.java

示例12: updateSecondaryUserStore

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
 * Encrypts the secondary user store configuration
 *
 * @param secondaryStoreDocument OMElement of respective file path
 * @param cipher                 Cipher object read for super-tenant's key store
 * @throws UserStoreConfigurationDeployerException If update operation failed
 */
private void updateSecondaryUserStore(OMElement secondaryStoreDocument, Cipher cipher) throws
        UserStoreConfigurationDeployerException {
    String className = secondaryStoreDocument.getAttributeValue(new QName(UserStoreConfigurationConstants.PROPERTY_CLASS));
    ArrayList<String> encryptList = getEncryptPropertyList(className);
    Iterator<?> ite = secondaryStoreDocument.getChildrenWithName(new QName(UserStoreConfigurationConstants.PROPERTY));
    while (ite.hasNext()) {
        OMElement propElem = (OMElement) ite.next();

        if (propElem != null && (propElem.getText() != null)) {
            String propertyName = propElem.getAttributeValue(new QName(UserStoreConfigurationConstants.PROPERTY_NAME));

            OMAttribute encryptedAttr = propElem.getAttribute(new QName(UserStoreConfigurationConstants
                    .PROPERTY_ENCRYPTED));
            if (encryptedAttr == null) {
                boolean encrypt = encryptList.contains(propertyName) || isEligibleTobeEncrypted(propElem);
                if (encrypt) {
                    OMAttribute encryptAttr = propElem.getAttribute(new QName(UserStoreConfigurationConstants.PROPERTY_ENCRYPT));
                    if (encryptAttr != null) {
                        propElem.removeAttribute(encryptAttr);
                    }

                    try {
                        String cipherText = Base64.encode(cipher.doFinal((propElem.getText().getBytes())));
                        propElem.setText(cipherText);
                        propElem.addAttribute(UserStoreConfigurationConstants.PROPERTY_ENCRYPTED, "true", null);
                    } catch (GeneralSecurityException e) {
                        String errMsg = "Encryption in secondary user store failed";
                        throw new UserStoreConfigurationDeployerException(errMsg, e);
                    }
                }
            }
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:42,代码来源:UserStoreConfigurationDeployer.java

示例13: sendSleepRequest

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
 * This method is used to send a single request to the load balancing service which will invoke a sleep in the service
 * @param proxyURL will be the location where load balancing proxy or sequence is defined.
 * @param sleepTimeInMilliSeconds
 * @param clientTimeoutInMilliSeconds
 * @return
 * @throws org.apache.axis2.AxisFault
 */
public String sendSleepRequest(String proxyURL,String sleepTimeInMilliSeconds, String clientTimeoutInMilliSeconds) throws AxisFault {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement sleepOperation = fac.createOMElement("sleepOperation", omNs);
    OMElement load = fac.createOMElement("load",null);
    load.setText(sleepTimeInMilliSeconds);
    sleepOperation.addChild(load);



    Options options = new Options();
    if (proxyURL != null && !"null".equals(proxyURL)) {
        options.setTo(new EndpointReference(proxyURL));
    }

    options.setAction("urn:sleepOperation");

    long timeout = Integer.parseInt(getProperty("timeout", clientTimeoutInMilliSeconds));
    System.out.println("timeout=" + timeout);
    options.setTimeOutInMilliSeconds(timeout);

    serviceClient.setOptions(options);

    serviceClient.getOptions().setManageSession(true);
     OMElement responseElement = serviceClient.sendReceive(sleepOperation);
    String response = responseElement.getText();

    return response;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:38,代码来源:LoadbalanceFailoverClient.java

示例14: sleepOperation

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public OMElement sleepOperation(OMElement topParam) {

        topParam.build();
        topParam.detach();

        OMElement param = topParam.getFirstChildWithName(new QName("load"));
        String l = param.getText();
        long time = Long.parseLong(l);

        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        Long c = null;
        Object o = serviceContext.getProperty("count");
        if (o == null) {
            c = new Long(1);
            serviceContext.setProperty("count", c);
        } else {
            c = (Long) o;
            c = new Long(c.longValue() + 1);
            serviceContext.setProperty("count", c);
        }

        String cName = "anonymous";
        Object cn = serviceContext.getProperty("cName");
        if (cn != null) {
            cName = (String) cn;

        }

        String sName = "anonymous";
        Object s = System.getProperty("server_name");
        if (s != null) {
            sName = (String) s;
        }

        String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
        System.out.println(msg);

        param.setText(msg);

        return topParam;
    }
 
开发者ID:wso2,项目名称:product-ei,代码行数:47,代码来源:LBService2.java

示例15: createPolicyElementDTO

import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public static PolicyElementDTO createPolicyElementDTO(String policy)
        throws EntitlementPolicyCreationException {

    PolicyElementDTO policyElementDTO = new PolicyElementDTO();
    OMElement omElement;
    try {
        omElement = AXIOMUtil.stringToOM(policy);
    } catch (XMLStreamException e) {
        throw new EntitlementPolicyCreationException("Policy can not be converted to OMElement");
    }

    if (omElement != null) {

        policyElementDTO.setPolicyName(omElement.
                getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_ID)));

        String ruleCombiningAlgorithm = omElement.
                getAttributeValue(new QName(EntitlementPolicyConstants.RULE_ALGORITHM));

        try {
            policyElementDTO.setRuleCombiningAlgorithms(ruleCombiningAlgorithm.
                    split(PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_3)[1]);
        } catch (Exception ignore) {
            policyElementDTO.setRuleCombiningAlgorithms(ruleCombiningAlgorithm.
                    split(PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_1)[1]);
            // if this is also fails, can not edit the policy
        }

        Iterator iterator = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
                DESCRIPTION_ELEMENT);

        if (iterator.hasNext()) {
            OMElement descriptionElement = (OMElement) iterator.next();
            if (descriptionElement != null && descriptionElement.getText() != null) {
                policyElementDTO.setPolicyDescription(descriptionElement.getText().trim());
            }
        }

    }
    return policyElementDTO;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:42,代码来源:PolicyEditorUtil.java


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