if ( addLatestElem != null )
{
// Check for simpleLatest element.
Element simpleLatestElem = addLatestElem.getChild( "simpleLatest", defNS );
// Get a SimpleLatestDsHandler, use default values if element is null.
ProxyDatasetHandler pdh = readDatasetScanAddLatest( simpleLatestElem, catalog );
if ( pdh != null )
allProxyDsHandlers.put( pdh.getProxyDatasetName(), pdh );
}
// Handle all "addProxies" elements.
if ( addProxiesElem != null )
{
for ( Iterator it = addProxiesElem.getChildren().iterator(); it.hasNext(); )
{
Element curChildElem = (Element) it.next();
ProxyDatasetHandler curPdh;
// Handle "simpleLatest" child elements.
if ( curChildElem.getName().equals( "simpleLatest")
&& curChildElem.getNamespace().equals( defNS) )
{
curPdh = readDatasetScanAddLatest( curChildElem, catalog );
}
// Handle "latestComplete" child elements.
else if ( curChildElem.getName().equals( "latestComplete" )
&& curChildElem.getNamespace().equals( defNS ) )
{
// Get latest name.
String latestName = curChildElem.getAttributeValue( "name" );
if ( latestName == null )
{
logger.warn( "readDatasetScanAddProxies(): unnamed latestComplete, skipping.");
continue;
}
// Does latest go on top or bottom of list.
Attribute topAtt = curChildElem.getAttribute( "top" );
boolean latestOnTop = true;
if ( topAtt != null )
{
try
{
latestOnTop = topAtt.getBooleanValue();
}
catch ( DataConversionException e )
{
latestOnTop = true;
}
}
// Get the latest service name.
String serviceName = curChildElem.getAttributeValue( "serviceName" );
if ( serviceName == null )
{
logger.warn( "readDatasetScanAddProxies(): no service name given in latestComplete." );
continue;
}
InvService service = catalog.findService( serviceName );
if ( service == null )
{
logger.warn( "readDatasetScanAddProxies(): named service <" + serviceName + "> not found." );
continue;
}
// Get lastModifed limit.
String lastModLimitVal = curChildElem.getAttributeValue( "lastModifiedLimit" );
long lastModLimit;
if ( lastModLimitVal == null )
lastModLimit = 60; // Default to one hour
else
lastModLimit = Long.parseLong( lastModLimitVal);
// Get isResolver.
String isResolverString = curChildElem.getAttributeValue( "isResolver");
boolean isResolver = true;
if ( isResolverString != null )
if ( isResolverString.equalsIgnoreCase( "false"))
isResolver = false;
// Build the SimpleLatestProxyDsHandler and add to map.
curPdh = new LatestCompleteProxyDsHandler( latestName, latestOnTop, service, isResolver, lastModLimit );
}
else
{
curPdh = null;
// @todo Deal with allowing user defined inserters
//Element userDefElem = addLatestElem.getChild( "proxyDatasetHandlerImpl", defNS );
}
// Add current proxy dataset handler to map if name is not already in map.
if ( curPdh != null )
{
if ( allProxyDsHandlers.containsKey( curPdh.getProxyDatasetName() ) )
{
logger.warn( "readDatasetScanAddProxies(): proxy map already contains key <" + curPdh.getProxyDatasetName() + ">, skipping." );
continue;
}
allProxyDsHandlers.put( curPdh.getProxyDatasetName(), curPdh );
}
}
}
return allProxyDsHandlers;