Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleEndpointSearchEngineBase.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleEndpointSearchEngineBase.java	(revision 5670)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleEndpointSearchEngineBase.java	(revision 5753)
@@ -2,5 +2,4 @@
 
 import java.net.URI;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -14,8 +13,5 @@
 import org.slf4j.LoggerFactory;
 import org.z3950.zing.cql.CQLNode;
-import org.z3950.zing.cql.CQLRelation;
 import org.z3950.zing.cql.CQLTermNode;
-import org.z3950.zing.cql.Modifier;
-
 import eu.clarin.sru.server.SRUConfigException;
 import eu.clarin.sru.server.SRUConstants;
@@ -37,21 +33,13 @@
 public abstract class SimpleEndpointSearchEngineBase extends
         SRUSearchEngineBase {
-    private static final String FCS_DISABLE_LEGECY_MODE =
-            "eu.clarin.sru.server.fcs.disableLegacyMode";
-    private static final String X_FCS_ENDPOINT_DESCRIPTION = "x-fcs-endpoint-description";
-    private static final String X_CMD_RESOURCE_INFO = "x-cmd-resource-info";
-    private static final String ED_NS = "http://clarin.eu/fcs/endpoint-description";
+    private static final String X_FCS_ENDPOINT_DESCRIPTION =
+            "x-fcs-endpoint-description";
+    private static final String ED_NS =
+            "http://clarin.eu/fcs/endpoint-description";
     private static final String ED_PREFIX = "ed";
     private static final int ED_VERSION = 1;
-    private static final String FCS_RESOURCE_INFO_NS = "http://clarin.eu/fcs/1.0/resource-info";
-    private static final String FCS_SCAN_INDEX_FCS_RESOURCE = "fcs.resource";
-    private static final String FCS_SCAN_INDEX_CQL_SERVERCHOICE = "cql.serverChoice";
-    private static final String FCS_SCAN_SUPPORTED_RELATION_CQL_1_1 = "scr";
-    private static final String FCS_SCAN_SUPPORTED_RELATION_CQL_1_2 = "=";
-    private static final String FCS_SUPPORTED_RELATION_EXACT = "exact";
     private static final Logger logger =
             LoggerFactory.getLogger(SimpleEndpointSearchEngineBase.class);
     protected EndpointDescription endpointDescription;
-    private boolean disableLegecyMode;
 
 
@@ -81,11 +69,4 @@
                     "returned no valid implementation of an EndpointDescription");
         }
-
-        if (params.containsKey(FCS_DISABLE_LEGECY_MODE)) {
-            logger.info("disabling FCS legacy mode");
-            this.disableLegecyMode = false;
-        } else {
-            this.disableLegecyMode = true;
-        }
     }
 
@@ -148,81 +129,5 @@
             SRURequest request, SRUDiagnosticList diagnostics)
             throws SRUException {
-
-        if (isLegacyMode()) {
-            /*
-             * Check if we got a scan on fcs.resource. If yes, handle it
-             * accordingly, otherwise delegate to user-provided implementation.
-             */
-            final List<ResourceInfo> result = translateFcsScanResource(request
-                    .getScanClause());
-            if (result != null) {
-                /*
-                 * Make sure, we honor the maximumTerms limit, of the client
-                 * requests it ...
-                 */
-                final int maxTerms = ((result.size() > 0) && (request
-                        .getMaximumTerms() > 0)) ? Math.min(result.size(),
-                        request.getMaximumTerms()) : result.size();
-
-                /*
-                 * Shall we provide extended resource information ... ?
-                 */
-                final boolean provideResourceInfo = parseBoolean(request
-                        .getExtraRequestData(X_CMD_RESOURCE_INFO));
-
-                return new SRUScanResultSet(diagnostics) {
-                    private int idx = -1;
-
-
-                    @Override
-                    public boolean nextTerm() {
-                        return (result != null) && (++idx < maxTerms);
-                    }
-
-
-                    @Override
-                    public String getValue() {
-                        return result.get(idx).getPid();
-                    }
-
-
-                    @Override
-                    public int getNumberOfRecords() {
-                        return -1;
-                    }
-
-
-                    @Override
-                    public String getDisplayTerm() {
-                        return result.get(idx).getTitle("en");
-                    }
-
-
-                    @Override
-                    public WhereInList getWhereInList() {
-                        return null;
-                    }
-
-
-                    @Override
-                    public boolean hasExtraTermData() {
-                        return provideResourceInfo;
-                    }
-
-
-                    @Override
-                    public void writeExtraTermData(XMLStreamWriter writer)
-                            throws XMLStreamException {
-                        if (provideResourceInfo) {
-                            writeLegacyResourceInfo(writer, result.get(idx));
-                        }
-                    }
-                };
-            } else {
-                return doScan(config, request, diagnostics);
-            }
-        } else {
-            return doScan(config, request, diagnostics);
-        }
+        return doScan(config, request, diagnostics);
     }
 
@@ -261,10 +166,12 @@
 
     /**
-     * Handle a <em>explain</em> operation. The default implementation is a
-     * no-op. Override this method, if you want to provide a custom behavior.
-     *
-     * @see SRUSearchEngine#explain(SRUServerConfig, SRURequest,
-     *      SRUDiagnosticList)
-     */
+     * Handle a <em>scan</em> operation. The default implementation is a no-op.
+     * Override this method, if you want to provide a custom behavior.
+     *
+     * @see SRUSearchEngine#scan(SRUServerConfig, SRURequest, SRUDiagnosticList)
+     * @deprecated override
+     *             {@link #scan(SRUServerConfig, SRURequest, SRUDiagnosticList)}
+     */
+    @Deprecated
     protected SRUScanResultSet doScan(SRUServerConfig config,
             SRURequest request, SRUDiagnosticList diagnostics)
@@ -300,77 +207,4 @@
         }
         return false;
-    }
-
-
-    private List<ResourceInfo> translateFcsScanResource(CQLNode scanClause)
-            throws SRUException {
-        if (scanClause instanceof CQLTermNode) {
-            final CQLTermNode root = (CQLTermNode) scanClause;
-            logger.debug("index = '{}', relation = '{}', term = '{}'",
-                    new Object[] { root.getIndex(),
-                            root.getRelation().getBase(), root.getTerm() });
-
-            String index = root.getIndex();
-            if (FCS_SCAN_INDEX_CQL_SERVERCHOICE.equals(index) &&
-                    FCS_SCAN_INDEX_FCS_RESOURCE.equals(root.getTerm())) {
-                throw new SRUException(SRUConstants.SRU_UNSUPPORTED_INDEX,
-                        "scan operation with 'scanClause' with value " +
-                        "'fcs.resource' is deprecated within CLARIN-FCS");
-            }
-            if (!(FCS_SCAN_INDEX_FCS_RESOURCE.equals(index))) {
-                logger.debug("got scan operation on index '{}', bailing ...",
-                        index);
-                return null;
-            }
-
-            logger.warn("scan on 'fcs.resource' for endpoint resource " +
-                    "enumeration is deprecated.");
-
-            // only allow "=" relation without any modifiers
-            final CQLRelation relationNode = root.getRelation();
-            String relation = relationNode.getBase();
-            if (!(FCS_SCAN_SUPPORTED_RELATION_CQL_1_1.equals(relation) ||
-                    FCS_SCAN_SUPPORTED_RELATION_CQL_1_2.equals(relation) ||
-                    FCS_SUPPORTED_RELATION_EXACT.equals(relation))) {
-                throw new SRUException(SRUConstants.SRU_UNSUPPORTED_RELATION,
-                        relationNode.getBase(), "Relation \"" +
-                                relationNode.getBase() +
-                                "\" is not supported in scan operation.");
-            }
-            final List<Modifier> modifiers = relationNode.getModifiers();
-            if ((modifiers != null) && !modifiers.isEmpty()) {
-                Modifier modifier = modifiers.get(0);
-                throw new SRUException(
-                        SRUConstants.SRU_UNSUPPORTED_RELATION_MODIFIER,
-                        modifier.getValue(), "Relation modifier \"" +
-                                modifier.getValue() +
-                                "\" is not supported in scan operation.");
-            }
-
-            final String term = root.getTerm();
-            if ((term == null) || term.isEmpty()) {
-                throw new SRUException(SRUConstants.SRU_EMPTY_TERM_UNSUPPORTED,
-                        "An empty term is not supported in scan operation.");
-            }
-
-            /*
-             * generate result: currently we only have a flat hierarchy, so
-             * return an empty result on any attempt to do a recursive scan ...
-             */
-            List<ResourceInfo> results = null;
-            if ((FCS_SCAN_INDEX_CQL_SERVERCHOICE.equals(index) &&
-                    FCS_SCAN_INDEX_FCS_RESOURCE.equals(term)) ||
-                    (FCS_SCAN_INDEX_FCS_RESOURCE.equals(index))) {
-                results = endpointDescription.getResourceList(term);
-            }
-            if ((results == null) || results.isEmpty()) {
-                return Collections.emptyList();
-            } else {
-                return results;
-            }
-        } else {
-            throw new SRUException(SRUConstants.SRU_QUERY_FEATURE_UNSUPPORTED,
-                    "Scan clause too complex.");
-        }
     }
 
@@ -507,67 +341,3 @@
     }
 
-
-    private void writeLegacyResourceInfo(XMLStreamWriter writer,
-            ResourceInfo resourceInfo) throws XMLStreamException {
-        writer.setDefaultNamespace(FCS_RESOURCE_INFO_NS);
-        writer.writeStartElement(FCS_RESOURCE_INFO_NS, "ResourceInfo");
-        writer.writeDefaultNamespace(FCS_RESOURCE_INFO_NS);
-
-        // title
-        final Map<String, String> title = resourceInfo.getTitle();
-        for (Map.Entry<String, String> i : title.entrySet()) {
-            writer.setPrefix(XMLConstants.XML_NS_PREFIX,
-                    XMLConstants.XML_NS_URI);
-            writer.writeStartElement(FCS_RESOURCE_INFO_NS, "Title");
-            writer.writeAttribute(XMLConstants.XML_NS_URI, "lang", i.getKey());
-            writer.writeCharacters(i.getValue());
-            writer.writeEndElement(); // "title" element
-        }
-
-        // description
-        final Map<String, String> description = resourceInfo.getDescription();
-        if (description != null) {
-            for (Map.Entry<String, String> i : description.entrySet()) {
-                writer.writeStartElement(FCS_RESOURCE_INFO_NS, "Description");
-                writer.writeAttribute(XMLConstants.XML_NS_URI, "lang",
-                        i.getKey());
-                writer.writeCharacters(i.getValue());
-                writer.writeEndElement(); // "Description" element
-            }
-        }
-
-        // landing page
-        final String landingPageURI = resourceInfo.getLandingPageURI();
-        if (landingPageURI != null) {
-            writer.writeStartElement(FCS_RESOURCE_INFO_NS, "LandingPageURI");
-            writer.writeCharacters(landingPageURI);
-            writer.writeEndElement(); // "LandingPageURI" element
-        }
-
-        // languages
-        final List<String> languages = resourceInfo.getLanguages();
-        writer.writeStartElement(FCS_RESOURCE_INFO_NS, "Languages");
-        for (String i : languages) {
-            writer.writeStartElement(FCS_RESOURCE_INFO_NS, "Language");
-            writer.writeCharacters(i);
-            writer.writeEndElement(); // "Language" element
-
-        }
-        writer.writeEndElement(); // "Languages" element
-        writer.writeEndElement(); // "ResourceInfo" element
-    }
-
-
-    /**
-     * Check, if running in legacy mode. Only intended for comparability with
-     * legacy clients until the new CLARIN-FCS specification is deployed on a
-     * larger scale.
-     *
-     * @return <code>true</code> if running in legacy mode, <code>false</code>
-     *         otherwise
-     */
-    protected boolean isLegacyMode() {
-        return !disableLegecyMode;
-    }
-
 } // class SimpleEndpointSearchEngineBase
