本文整理汇总了Java中org.apache.axiom.om.OMElement.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java OMElement.getAttribute方法的具体用法?Java OMElement.getAttribute怎么用?Java OMElement.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axiom.om.OMElement
的用法示例。
在下文中一共展示了OMElement.getAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOffices
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
@Test(groups = {"wso2.dss"}, dependsOnMethods = {"addOffice"})
public void getOffices() throws AxisFault, XPathExpressionException {
AxisServiceClient serviceClient = new AxisServiceClient();
OMElement response = serviceClient.sendReceive(getPayloadGetOffice(), getServiceUrlHttp(serviceName), "showAllOffices");
Assert.assertNotNull(response, "Response Message in null");
Iterator<OMElement> itr = response.getChildrenWithName(new QName("Office"));
int recordCount = 0;
while (itr.hasNext()) {
OMElement office = itr.next();
Assert.assertNotNull(office.getAttribute(new QName("officeCode")), "officeCode attribute not found with response");
Assert.assertFalse(office.getAttributeValue(new QName("officeCode")).equalsIgnoreCase(""), "Attribute Name officeCode value empty");
if (office.getAttribute(new QName("country")) != null) {
Assert.assertFalse(office.getAttributeValue(new QName("country")).equalsIgnoreCase(""), "Attribute Name country value empty");
}
++recordCount;
}
Assert.assertEquals(recordCount, 10, "All offices on the table not in response.invalid response. " +
"because one of attribute value is null");
}
示例2: readAuthenticationEndpointQueryParams
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
private void readAuthenticationEndpointQueryParams(OMElement documentElement) {
OMElement authEndpointQueryParamsElem = documentElement
.getFirstChildWithName(IdentityApplicationManagementUtil
.getQNameWithIdentityApplicationNS(FrameworkConstants.Config.QNAME_AUTH_ENDPOINT_QUERY_PARAMS));
if (authEndpointQueryParamsElem != null) {
authEndpointQueryParamsConfigAvailable = true;
OMAttribute actionAttr = authEndpointQueryParamsElem.getAttribute(new QName(
FrameworkConstants.Config.ATTR_AUTH_ENDPOINT_QUERY_PARAM_ACTION));
authEndpointQueryParamsAction = FrameworkConstants.AUTH_ENDPOINT_QUERY_PARAMS_ACTION_EXCLUDE;
if (actionAttr != null) {
String actionValue = actionAttr.getAttributeValue();
if (actionValue != null && !actionValue.isEmpty()) {
authEndpointQueryParamsAction = actionValue;
}
}
for (Iterator authEndpointQueryParamElems = authEndpointQueryParamsElem
.getChildrenWithLocalName(FrameworkConstants.Config.ELEM_AUTH_ENDPOINT_QUERY_PARAM); authEndpointQueryParamElems
.hasNext(); ) {
String queryParamName = processAuthEndpointQueryParamElem((OMElement) authEndpointQueryParamElems
.next());
if (queryParamName != null) {
this.authEndpointQueryParams.add(queryParamName);
}
}
}
}
示例3: processAuthEndpointQueryParamElem
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
private String processAuthEndpointQueryParamElem(OMElement authEndpointQueryParamElem) {
OMAttribute nameAttr = authEndpointQueryParamElem.getAttribute(new QName(
FrameworkConstants.Config.ATTR_AUTH_ENDPOINT_QUERY_PARAM_NAME));
if (nameAttr == null) {
log.warn("Each Authentication Endpoint Query Param should have a unique name attribute. This Query Param will skipped.");
return null;
}
return nameAttr.getAttributeValue();
}
示例4: processAuthenticatorNameMappingElement
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
private void processAuthenticatorNameMappingElement(OMElement authenticatorNameMappingElem) {
OMAttribute nameAttr = authenticatorNameMappingElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_AUTHENTICATOR_NAME_MAPPING_NAME));
OMAttribute aliasAttr = authenticatorNameMappingElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_AUTHENTICATOR_NAME_MAPPING_ALIAS));
if (nameAttr == null || aliasAttr == null) {
log.warn("An AuthenticatorNameMapping must contain \'name\' and \'alias\' attributes. Skipping the element.");
return;
}
authenticatorNameMappings.put(aliasAttr.getAttributeValue(), nameAttr.getAttributeValue());
}
示例5: processIdPConfigElement
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
private ExternalIdPConfig processIdPConfigElement(OMElement idpConfigElem) {
OMAttribute nameAttr = idpConfigElem.getAttribute(new QName("name"));
// if the name is not given, do not register this config
if (nameAttr == null) {
log.warn("Each IDP configuration should have a unique name attribute");
return null;
}
// read the config parameters
Map<String, String> parameterMap = new HashMap<>();
for (Iterator paramIterator = idpConfigElem.getChildrenWithLocalName("Parameter");
paramIterator.hasNext(); ) {
OMElement paramElem = (OMElement) paramIterator.next();
OMAttribute paramNameAttr = paramElem.getAttribute(new QName("name"));
if (paramNameAttr == null) {
log.warn("A Parameter should have a name attribute. Skipping the parameter.");
continue;
}
parameterMap.put(paramNameAttr.getAttributeValue(), paramElem.getText());
}
IdentityProvider fedIdp = new IdentityProvider();
fedIdp.setIdentityProviderName(nameAttr.getAttributeValue());
ExternalIdPConfig externalIdPConfig = new ExternalIdPConfig(fedIdp);
externalIdPConfig.setParameterMap(parameterMap);
return externalIdPConfig;
}
示例6: 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);
}
}
}
}
}
}
示例7: processSequenceElement
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* Create SequenceDOs for each sequence entry
*
* @param sequenceElem
* @return
*/
private SequenceConfig processSequenceElement(OMElement sequenceElem) {
SequenceConfig sequenceConfig = new SequenceConfig();
String applicationId = "default";
OMAttribute appIdAttr = sequenceElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_APPLICATION_ID));
if (appIdAttr != null) {
applicationId = appIdAttr.getAttributeValue();
}
sequenceConfig.setApplicationId(applicationId);
OMAttribute forceAuthnAttr = sequenceElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_FORCE_AUTHENTICATE));
if (forceAuthnAttr != null) {
sequenceConfig.setForceAuthn(Boolean.valueOf(forceAuthnAttr.getAttributeValue()));
}
OMAttribute checkAuthnAttr = sequenceElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_CHECK_AUTHENTICATE));
if (checkAuthnAttr != null) {
sequenceConfig.setCheckAuthn(Boolean.valueOf(checkAuthnAttr.getAttributeValue()));
}
//RequestPathAuthenticators
OMElement reqPathAuthenticatorsElem = sequenceElem.getFirstChildWithName(IdentityApplicationManagementUtil.
getQNameWithIdentityApplicationNS(FrameworkConstants.Config.ELEM_REQ_PATH_AUTHENTICATOR));
if (reqPathAuthenticatorsElem != null) {
for (Iterator reqPathAuthenticatorElems = reqPathAuthenticatorsElem.getChildElements(); reqPathAuthenticatorElems.hasNext(); ) {
OMElement reqPathAuthenticatorElem = (OMElement) reqPathAuthenticatorElems.next();
String authenticatorName = reqPathAuthenticatorElem.getAttributeValue(IdentityApplicationManagementUtil.
getQNameWithIdentityApplicationNS(FrameworkConstants.Config.ATTR_AUTHENTICATOR_NAME));
AuthenticatorConfig authenticatorConfig = authenticatorConfigMap.get(authenticatorName);
sequenceConfig.getReqPathAuthenticators().add(authenticatorConfig);
}
}
// for each step defined, create a StepDO instance
for (Iterator stepElements = sequenceElem.getChildrenWithLocalName(FrameworkConstants.Config.ELEM_STEP);
stepElements.hasNext(); ) {
StepConfig stepConfig = processStepElement((OMElement) stepElements.next());
if (stepConfig != null) {
sequenceConfig.getStepMap().put(stepConfig.getOrder(), stepConfig);
}
}
return sequenceConfig;
}
示例8: processStepElement
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* Create StepDOs for each step entry
*
* @param stepElem
* @return
*/
private StepConfig processStepElement(OMElement stepElem) {
StepConfig stepConfig = new StepConfig();
OMAttribute loginPageAttr = stepElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_STEP_LOGIN_PAGE));
if (loginPageAttr != null) {
stepConfig.setLoginPage(loginPageAttr.getAttributeValue());
}
OMAttribute orderAttr = stepElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_STEP_ORDER));
if (orderAttr == null) {
log.warn("Each Step Configuration should have an order. +"
+ "Authenticators under this Step will not be registered.");
return null;
}
stepConfig.setOrder(Integer.parseInt(orderAttr.getAttributeValue()));
for (Iterator authenticatorElements = stepElem.getChildrenWithLocalName(FrameworkConstants.Config.ELEM_AUTHENTICATOR);
authenticatorElements.hasNext(); ) {
OMElement authenticatorElem = (OMElement) authenticatorElements.next();
String authenticatorName = authenticatorElem.getAttributeValue(new QName(FrameworkConstants.Config.ATTR_AUTHENTICATOR_NAME));
AuthenticatorConfig authenticatorConfig = authenticatorConfigMap.get(authenticatorName);
String idps = authenticatorElem.getAttributeValue(new QName(FrameworkConstants.Config.ATTR_AUTHENTICATOR_IDPS));
//if idps defined
if (idps != null && !idps.isEmpty()) {
String[] idpArr = idps.split(",");
for (String idp : idpArr) {
authenticatorConfig.getIdpNames().add(idp);
}
} else {
authenticatorConfig.getIdpNames().add(FrameworkConstants.LOCAL_IDP_NAME);
}
stepConfig.getAuthenticatorList().add(authenticatorConfig);
}
return stepConfig;
}
示例9: processAuthenticatorConfigElement
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* Create AuthenticatorBean elements for each authenticator entry
*
* @param authenticatorConfigElem OMElement for Authenticator
* @return AuthenticatorBean object
*/
private AuthenticatorConfig processAuthenticatorConfigElement(OMElement authenticatorConfigElem) {
// read the name of the authenticator. this is a mandatory attribute.
OMAttribute nameAttr = authenticatorConfigElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_AUTHENTICATOR_CONFIG_NAME));
// if the name is not given, do not register this authenticator
if (nameAttr == null) {
log.warn("Each Authenticator Configuration should have a unique name attribute. +" +
"This Authenticator will not be registered.");
return null;
}
String authenticatorName = nameAttr.getAttributeValue();
// check whether the disabled attribute is set
boolean enabled = false;
if (authenticatorConfigElem.getAttribute(IdentityApplicationManagementUtil.
getQNameWithIdentityApplicationNS(FrameworkConstants.Config.ATTR_AUTHENTICATOR_ENABLED)) != null) {
enabled = Boolean.parseBoolean(authenticatorConfigElem.getAttribute(IdentityApplicationManagementUtil.
getQNameWithIdentityApplicationNS(FrameworkConstants.Config.ATTR_AUTHENTICATOR_ENABLED)).getAttributeValue());
}
// read the config parameters
Map<String, String> parameterMap = new HashMap<>();
for (Iterator paramIterator = authenticatorConfigElem.getChildrenWithLocalName(FrameworkConstants.Config.ELEM_PARAMETER);
paramIterator.hasNext(); ) {
OMElement paramElem = (OMElement) paramIterator.next();
OMAttribute paramNameAttr = paramElem.getAttribute(new QName(FrameworkConstants.Config.ATTR_PARAMETER_NAME));
if (paramNameAttr == null) {
log.warn("An Authenticator Parameter should have a name attribute. Skipping the parameter.");
continue;
}
parameterMap.put(paramNameAttr.getAttributeValue(), paramElem.getText());
}
AuthenticatorConfig authenticatorConfig = new AuthenticatorConfig(authenticatorName, enabled, parameterMap);
authenticatorConfig.setApplicationAuthenticator(FrameworkUtils.getAppAuthenticatorByName(authenticatorName));
return authenticatorConfig;
}