All all = (All) topLevelAssertionObject;
handlePolicyComponents(cacheConfig, all.getPolicyComponents());
} else if (topLevelAssertionObject instanceof XmlPrimtiveAssertion) {
// Validating the policy
XmlPrimtiveAssertion topLevelXmlPrimtiveAssertion
= (XmlPrimtiveAssertion) topLevelAssertionObject;
QName qName = topLevelXmlPrimtiveAssertion.getName();
// validating the Caching assertion
if (qName.equals(CachingConstants.CACHING_ASSERTION_QNAME)) {
Policy cachingPolicyComponent
= PolicyEngine.getPolicy(topLevelXmlPrimtiveAssertion.getValue());
List assertionList = cachingPolicyComponent.getPolicyComponents();
for (Iterator configDataAssertionIterator = assertionList.iterator();
configDataAssertionIterator.hasNext();) {
Object aConfigDataAssertionObject = configDataAssertionIterator.next();
// Validating the caching policy
if (aConfigDataAssertionObject instanceof Policy) {
long expireTime;
DigestGenerator digestGenerator;
int maxMessageSize;
int maxCacheSize;
Policy cachingPolicy = (Policy) aConfigDataAssertionObject;
List childAssertionsList = cachingPolicy.getPolicyComponents();
for (Iterator childAssertionSIterator = childAssertionsList
.iterator(); childAssertionSIterator.hasNext();) {
Object configData = childAssertionSIterator.next();
if (configData instanceof All) {
All all = (All) configData;
List configDataList = all.getPolicyComponents();
for (Iterator configIterator = configDataList
.iterator(); configIterator.hasNext();) {
Object configDtaObject = configIterator.next();
if (configDtaObject instanceof XmlPrimtiveAssertion) {
XmlPrimtiveAssertion cachingPrimtiveAssertion
= (XmlPrimtiveAssertion) configDtaObject;
//todo : break the processing
// Is Identifier specified?
if (cachingPrimtiveAssertion.getName().equals(
CachingConstants.CACHING_XML_IDENTIFIER_QNAME)) {
String value
= cachingPrimtiveAssertion.getValue()
.getText();
try {
// Loading the class using Reflection
digestGenerator = (DigestGenerator)
Class.forName(value).newInstance();
cacheConfig.setDigestGenerator(digestGenerator);
} catch (ClassNotFoundException e) {
handleException("Unable to find the " +
"DigestGenerator implementation \"" +
value + "\"", e);
} catch (IllegalAccessException e) {
handleException("Unable to load the " +
"DigestGenerator implementation \"" +
value + "\"", e);
} catch (InstantiationException e) {
handleException("Unable to instantiate the " +
"DigestGenerator implementation \"" +
value + "\"", e);
}
}
// Is expiration time specified?
if (cachingPrimtiveAssertion.getName().equals(
CachingConstants.CACHE_EXPIRATION_TIME_QNAME) &&
cachingPrimtiveAssertion.getValue() != null) {
expireTime = Long.parseLong(
cachingPrimtiveAssertion
.getValue().getText());
cacheConfig.setTimeout(expireTime);
}
// Is max message size specified?
if (cachingPrimtiveAssertion.getName().equals(
CachingConstants.MAX_MESSAGE_SIZE_QNAME) &&
cachingPrimtiveAssertion.getValue() != null) {
maxMessageSize = Integer.parseInt(
cachingPrimtiveAssertion
.getValue().getText());
cacheConfig.setMaxMessageSize(maxMessageSize);
}
// Is max cache size specified?
if (cachingPrimtiveAssertion.getName().equals(
CachingConstants.MAX_CACHE_SIZE_QNAME) &&
cachingPrimtiveAssertion.getValue() != null) {
maxCacheSize = Integer.parseInt(
cachingPrimtiveAssertion
.getValue().getText());
cacheConfig.setMaxCacheSize(maxCacheSize);
}
} else {