Merged V2.0 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5118 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5119 .
   - OpenSearch Proxy
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5121 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5122 .
   - Extract sample OpenSearch engine registrations into extension config file.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5125 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-02-13 21:21:48 +00:00
parent 2d5a480d85
commit 9067948404
14 changed files with 861 additions and 25 deletions

View File

@@ -23,6 +23,7 @@ import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigException;
import org.alfresco.config.xml.elementreader.ConfigElementReader;
import org.alfresco.web.config.OpenSearchConfigElement.EngineConfig;
import org.alfresco.web.config.OpenSearchConfigElement.ProxyConfig;
import org.dom4j.Element;
@@ -37,9 +38,11 @@ public class OpenSearchElementReader implements ConfigElementReader
public static final String ELEMENT_ENGINES = "engines";
public static final String ELEMENT_ENGINE = "engine";
public static final String ELEMENT_URL = "url";
public static final String ELEMENT_PROXY = "proxy";
public static final String ATTR_TYPE = "type";
public static final String ATTR_LABEL = "label";
public static final String ATTR_LABEL_ID = "label-id";
public static final String ATTR_PROXY = "proxy";
/**
@@ -71,7 +74,8 @@ public class OpenSearchElementReader implements ConfigElementReader
Element engineElem = engines.next();
String label = engineElem.attributeValue(ATTR_LABEL);
String labelId = engineElem.attributeValue(ATTR_LABEL_ID);
EngineConfig engineCfg = new EngineConfig(label, labelId);
String proxy = engineElem.attributeValue(ATTR_PROXY);
EngineConfig engineCfg = new EngineConfig(label, labelId, proxy);
// construct urls for engine
Iterator<Element> urlsConfig = engineElem.elementIterator(ELEMENT_URL);
@@ -87,6 +91,20 @@ public class OpenSearchElementReader implements ConfigElementReader
configElement.addEngine(engineCfg);
}
}
// extract proxy configuration
String url = null;
Element proxyElem = element.element(ELEMENT_PROXY);
if (proxyElem != null)
{
Element urlElem = proxyElem.element(ELEMENT_URL);
if (urlElem != null)
{
url = urlElem.getTextTrim();
ProxyConfig proxyCfg = new ProxyConfig(url);
configElement.setProxy(proxyCfg);
}
}
}
return configElement;