All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.jrtps.udds.security.XmlGovernance Maven / Gradle / Ivy

package net.sf.jrtps.udds.security;


/**
 * XmlGovernance is a helper class to read values from Xml file.
 * 
 * @author mcr70
 */
class XmlGovernance {
//	private static final Logger logger = LoggerFactory.getLogger(XmlGovernance.class);
//	private DomainAccessRulesNode dar;
//
//	public XmlGovernance(InputStream is) throws JAXBException {
//        JAXBContext jaxbContext = JAXBContext.newInstance(org.omg.dds.security.xml.governance.ObjectFactory.class);
//
//        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
//        JAXBElement unmarshal = (JAXBElement) jaxbUnmarshaller.unmarshal(is);
//        dar = unmarshal.getValue();
//	}
//	
//	/**
//	 * Gets whether or not unauthenticated join is allowed.
//	 * Default value is false.
//	 * 
//	 * @param domainId domainID to check
//	 * @return true, if domain allows unauthenticated join.
//	 */
//	public boolean allowUnauthenticatedJoin(int domainId) {
//		DomainRule rule = getDomainRule(domainId);
//		boolean value = false;
//		if (rule != null) {
//			value = Boolean.parseBoolean(rule.getAllowUnauthenticatedJoin().value());
//		}
//		
//		logger.debug("allowUnauthenticatedJoin({})", value);
//		return value;
//	}
//
//	/**
//	 * Check, whether or not join access control is enforced.
//	 * Defaults to false.
//	 * 
//	 * @param domainId domainId to check
//	 * @return true, if access control is enforced (isAccessProtected = true)
//	 */
//	public boolean enableJoinAccessControl(int domainId) {
//		DomainRule rule = getDomainRule(domainId);
//		boolean value = false;
//		if (rule != null) {
//			value = Boolean.parseBoolean(rule.getEnableJoinAccessControl().value());
//		}
//		
//		logger.debug("enableJoinAccessControl({})", value);
//		return value;
//	}
//	
//	
//	private DomainRule getDomainRule(int domainId) {
//		DomainAccessRules domainAccessRules = dar.getDomainAccessRules();
//		List domainRules = domainAccessRules.getDomainRule();
//		String domainIdString = "" + domainId;
//		
//		for (DomainRule rule : domainRules) {
//			if (domainIdString.equals(rule.getDomainId())) {
//				return rule;
//			}
//		}
//		
//		return null;
//	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy