Index: FCSSimpleEndpoint/trunk/pom.xml
===================================================================
--- FCSSimpleEndpoint/trunk/pom.xml	(revision 5474)
+++ FCSSimpleEndpoint/trunk/pom.xml	(revision 5477)
@@ -4,5 +4,5 @@
     <groupId>eu.clarin.sru.fcs</groupId>
     <artifactId>fcs-simple-endpoint</artifactId>
-    <version>1.3.0-SNAPSHOT</version>
+    <version>2.0-SNAPSHOT</version>
     <packaging>jar</packaging>
     <name>A simple CLARIN FCS endpoint</name>
Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/DataView.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/DataView.java	(revision 5477)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/DataView.java	(revision 5477)
@@ -0,0 +1,72 @@
+package eu.clarin.sru.server.fcs;
+
+public class DataView {
+
+	public enum PayloadDelivery {
+		SEND_BY_DEFAULT, NEED_TO_REQUEST;
+		
+		@Override
+		public String toString(){
+			String str = super.toString().toLowerCase();
+			return str.replace("_", "-");
+		}
+	}
+
+	public enum PayloadDisposition {
+		INLINE, REFERENCE;
+		
+		@Override
+		public String toString(){
+			return super.toString().toLowerCase();
+		}
+	}
+	
+	private String description;
+	private String mimeType;
+	private String payloadDisposition;
+	private String payloadDelivery;
+	private String shortIdentifier;
+	
+	public DataView() {	}
+	public DataView(String description, String mimeType, 
+			PayloadDisposition payloadDisposition, PayloadDelivery payloadDelivery, 
+			String shortId){
+		this.description = description;
+		this.mimeType = mimeType;
+		this.payloadDisposition = payloadDisposition.toString();
+		this.payloadDelivery = payloadDelivery.toString();
+		this.shortIdentifier = shortId;		
+	}
+	
+	
+	public String getDescription() {
+		return description;
+	}
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	public String getMimeType() {
+		return mimeType;
+	}
+	public void setMimeType(String mimeType) {
+		this.mimeType = mimeType;
+	}
+	public String getPayloadDisposition() {
+		return payloadDisposition;
+	}
+	public void setPayloadDisposition(String payloadDisposition) {
+		this.payloadDisposition = payloadDisposition;
+	}
+	public String getPayloadDelivery() {
+		return payloadDelivery;
+	}
+	public void setPayloadDelivery(String payloadDelivery) {
+		this.payloadDelivery = payloadDelivery;
+	}
+	public String getShortIdentifier() {
+		return shortIdentifier;
+	}
+	public void setShortIdentifier(String shortIdentifier) {
+		this.shortIdentifier = shortIdentifier;
+	}
+}
Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/EndpointDescriptionWriter.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/EndpointDescriptionWriter.java	(revision 5477)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/EndpointDescriptionWriter.java	(revision 5477)
@@ -0,0 +1,67 @@
+package eu.clarin.sru.server.fcs;
+
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class EndpointDescriptionWriter {
+		
+	public static final String NAMESPACE = "http://clarin.eu/fcs/endpoint-description";
+	public static final String PREFIX = "ed";
+	public static final int VERSION = 1;
+		
+	public static void writeEndpointDescription(XMLStreamWriter writer, 
+			List<String> capabilities, List<DataView> supportedDataViews, 
+			List<ResourceInfo> resourceInfoList) 
+			throws XMLStreamException{
+		
+		if (writer == null) {
+            throw new NullPointerException("writer == null");
+        }
+		
+        writer.writeStartElement(PREFIX, "EndpointDescription", NAMESPACE);
+        writer.writeNamespace(PREFIX, NAMESPACE);
+        writer.writeAttribute("version", String.valueOf(VERSION));
+        writeCapabilities(writer,capabilities);
+        writeSupportedDataViews(writer,supportedDataViews);
+        ResourceInfoWriter.writeFullResourceInfo(writer,PREFIX, resourceInfoList);
+        writer.writeEndElement();
+	}
+	
+	private static void writeCapabilities(XMLStreamWriter writer, 
+			List<String> capabilities) throws XMLStreamException{
+		
+		if (writer == null) {
+            throw new NullPointerException("writer == null");
+        }
+		
+        writer.writeStartElement(PREFIX, "Capabilities", NAMESPACE);
+		
+		for (String c : capabilities){
+	        writer.writeStartElement(PREFIX, "Capability", NAMESPACE);
+	        writer.writeCharacters(c);
+		    writer.writeEndElement();
+		}
+		writer.writeEndElement();		
+	}
+	
+	private static void writeSupportedDataViews(XMLStreamWriter writer,
+			List<DataView> supportedDataViews) throws XMLStreamException {
+		
+		if (writer == null) {
+            throw new NullPointerException("writer == null");
+        }
+		
+        writer.writeStartElement(PREFIX, "SupportedDataViews", NAMESPACE);
+		
+		for (DataView dv : supportedDataViews) {
+	        writer.writeStartElement(PREFIX, "SupportedDataView", NAMESPACE);
+	        writer.writeAttribute("id", dv.getShortIdentifier());
+	        writer.writeAttribute("delivery-policy", dv.getPayloadDelivery());
+	        writer.writeCharacters(dv.getMimeType());
+	        writer.writeEndElement();
+		}
+		writer.writeEndElement();
+	}	
+}
Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/FCSResultWriter.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/FCSResultWriter.java	(revision 5474)
+++ 	(revision )
@@ -1,73 +1,0 @@
-package eu.clarin.sru.server.fcs;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-public class FCSResultWriter {
-	private static final String FCS_NS = "http://clarin.eu/fcs/resource";
-    private static final String FCS_PREFIX = "fcs";
-    private static final String FCS_DATAVIEW_MIMETYPE =
-            "application/x-clarin-fcs-hits+xml";
-    
-    private static final String HITS_NS = "http://clarin.eu/fcs/dataview/hits";
-    private static final String HITS_PREFIX = "hits";
-    
-    public static void writeResource(XMLStreamWriter writer, String pid, String ref, 
-			String leftContext, String keyword, String rightContext)
-            throws XMLStreamException {
-		
-		if (writer == null) {
-            throw new NullPointerException("writer == null");
-        }
-		
-		writer.setPrefix(FCS_PREFIX, FCS_NS);
-        writer.writeStartElement(FCS_NS, "Resource");
-        writer.writeNamespace(FCS_PREFIX, FCS_NS);
-        if ((pid != null) && !pid.isEmpty()) {
-            writer.writeAttribute("pid", pid);
-        }
-        if ((ref != null) && !ref.isEmpty()) {
-            writer.writeAttribute("ref", ref);
-        }        
-        writeDataView(writer, leftContext, keyword, rightContext);        
-        writer.writeEndElement();
-	}
-    
-    public static void writeDataView(XMLStreamWriter writer, String leftContext, 
-    		String keyword, String rightContext) throws XMLStreamException { 
-    	
-    	if (writer == null) {
-            throw new NullPointerException("writer == null");
-        }
-    	
-    	writer.writeStartElement(FCS_NS, "DataView");
-        writer.writeAttribute("type", FCS_DATAVIEW_MIMETYPE);        
-        writeHits(writer, leftContext, keyword, rightContext);        
-        writer.writeEndElement();
-    }
-    
-    public static void writeHits(XMLStreamWriter writer, String leftContext, 
-    		String keyword, String rightContext) throws XMLStreamException {                                    
-            
-    	if (writer == null) {
-            throw new NullPointerException("writer == null");
-        }
-        writer.setPrefix(HITS_PREFIX, HITS_NS);
-        writer.writeStartElement(HITS_NS, "Result");
-        writer.writeNamespace(HITS_PREFIX, HITS_NS);
-        
-        if (leftContext != null && !leftContext.isEmpty()) {
-            writer.writeCharacters(leftContext);
-        }
-        
-        writer.writeStartElement(HITS_NS, "Hit");
-        writer.writeCharacters(keyword);
-        writer.writeEndElement(); // Hit
-
-        if (rightContext != null && !rightContext.isEmpty()) {
-            writer.writeCharacters(rightContext);
-        }
-        
-        writer.writeEndElement(); // Result
-    }
-}
Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfo.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfo.java	(revision 5474)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfo.java	(revision 5477)
@@ -14,4 +14,5 @@
 public class ResourceInfo {
     private final String pid;
+    @Deprecated
     private final int resourceCount;
     private final Map<String, String> title;
@@ -19,6 +20,7 @@
     private final String landingPageURI;
     private final List<String> languages;
+    private final List<String> availableDataViews;
     private List<ResourceInfo> subResources;
-
+    
 
     /**
@@ -50,4 +52,5 @@
             Map<String, String> title, Map<String, String> description,
             String landingPageURI, List<String> languages,
+            List<String> availableDataViews,
             List<ResourceInfo> subResources) {
         if (pid == null) {
@@ -76,9 +79,16 @@
         }
         this.languages = languages;
+        if (availableDataViews == null){
+        	throw new IllegalArgumentException("available data views == null");
+        }
+        if (availableDataViews.isEmpty()){
+        	throw new IllegalArgumentException("available data views are empty");
+        }
+        this.availableDataViews = availableDataViews;
         if ((subResources != null) && !subResources.isEmpty()) {
             this.subResources = Collections.unmodifiableList(subResources);
         } else {
             this.subResources = null;
-        }
+        }        
     }
 
@@ -101,4 +111,5 @@
      * @return a number of items or <code>-1</code> if not applicable
      */
+    @Deprecated
     public int getResourceCount() {
         return resourceCount;
@@ -196,3 +207,9 @@
     }
 
+
+	public List<String> getAvailableDataViews() {
+		return availableDataViews;
+	}
+
+
 } // class ResourceInfo
Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfoWriter.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfoWriter.java	(revision 5477)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfoWriter.java	(revision 5477)
@@ -0,0 +1,155 @@
+package eu.clarin.sru.server.fcs;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class ResourceInfoWriter {
+
+	public static final String FCS_RESOURCE_INFO_NS =
+            "http://clarin.eu/fcs/endpoint-description";
+    
+	public static void writeFullResourceInfo(XMLStreamWriter writer,
+            String prefix, List<ResourceInfo> resourceInfoList)
+            throws XMLStreamException {
+		
+        if (resourceInfoList == null) {
+            throw new NullPointerException("resourceInfoList == null");
+        }
+        if (!resourceInfoList.isEmpty()) {
+            final boolean defaultNS = ((prefix == null) || prefix.isEmpty());
+            if (defaultNS) {
+                writer.setDefaultNamespace(FCS_RESOURCE_INFO_NS);
+            } else {
+                writer.setPrefix(prefix, FCS_RESOURCE_INFO_NS);
+            }
+            writer.writeStartElement(FCS_RESOURCE_INFO_NS, "Resources");
+            if (defaultNS) {
+                writer.writeDefaultNamespace(FCS_RESOURCE_INFO_NS);
+            } else {
+                writer.writeNamespace(prefix, FCS_RESOURCE_INFO_NS);
+            }
+            for (ResourceInfo resourceInfo : resourceInfoList) {
+                doWriteResourceInfo(writer, prefix, resourceInfo, false, true);
+            }
+            writer.writeEndElement(); // "ResourceCollection" element
+        }
+    }
+
+
+	public static void writeResourceInfo(XMLStreamWriter writer, String prefix,
+            ResourceInfo resourceInfo) throws XMLStreamException {        
+        doWriteResourceInfo(writer, prefix, resourceInfo, true, false);
+    }
+
+
+	private static void doWriteResourceInfo(XMLStreamWriter writer,
+            String prefix, ResourceInfo resourceInfo, boolean writeNS,
+            boolean recursive) throws XMLStreamException {
+		
+		if (writer == null) {
+            throw new NullPointerException("writer == null");
+        }
+		if (prefix == null) {
+            throw new NullPointerException("prefix == null");
+        }
+		if (prefix.isEmpty()) {
+            throw new IllegalArgumentException("prefix is empty");
+        }
+		if (resourceInfo == null) {
+            throw new NullPointerException("resourceInfo == null");
+        }
+		
+        final boolean defaultNS = ((prefix == null) || prefix.isEmpty());
+        if (writeNS) {
+            if (defaultNS) {
+                writer.setDefaultNamespace(FCS_RESOURCE_INFO_NS);
+            } else {
+                writer.setPrefix(prefix, FCS_RESOURCE_INFO_NS);
+            }
+        }
+        writer.writeStartElement(FCS_RESOURCE_INFO_NS, "Resource");
+        if (writeNS) {
+            if (defaultNS) {
+                writer.writeDefaultNamespace(FCS_RESOURCE_INFO_NS);
+            } else {
+                writer.writeNamespace(prefix, FCS_RESOURCE_INFO_NS);
+            }
+        }
+        if (recursive) {
+            /*
+             * HACK: only output @pid for recursive (= explain) requests.
+             * This should be revisited, if we decide to go for the explain
+             * style enumeration of resources.
+             */
+            writer.writeAttribute("pid", resourceInfo.getPid());
+        }
+        if (resourceInfo.hasSubResources()) {
+            writer.writeAttribute("hasSubResources", "true");
+        }
+
+        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
+        }
+
+        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
+            }
+        }
+
+        final String landingPageURI = resourceInfo.getLandingPageURI();
+        if (landingPageURI != null) {
+            writer.writeStartElement(FCS_RESOURCE_INFO_NS, "LandingPageURI");
+            writer.writeCharacters(landingPageURI);
+            writer.writeEndElement(); // "LandingPageURI" element
+        }
+
+        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
+
+        final List<String> availableDataViews = resourceInfo.getAvailableDataViews();
+        writer.writeStartElement(FCS_RESOURCE_INFO_NS, "AvailableDataViews");
+        
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < availableDataViews.size(); i++) {
+            sb.append(availableDataViews.get(i));
+            sb.append(" ");
+        }        
+        writer.writeAttribute("ref", sb.toString().trim());
+        
+        writer.writeEndElement(); // "Languages" element
+
+        
+        if (recursive && resourceInfo.hasSubResources()) {
+            writer.writeStartElement(FCS_RESOURCE_INFO_NS,
+                    "ResourceInfoCollection");
+            for (ResourceInfo r : resourceInfo.getSubResources()) {
+                doWriteResourceInfo(writer, prefix, r, writeNS, recursive);
+            }
+            writer.writeEndElement(); // "ResourceCollection" element
+        }
+        writer.writeEndElement(); // "ResourceInfo" element
+    }	
+}
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 5474)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleEndpointSearchEngineBase.java	(revision 5477)
@@ -1,4 +1,5 @@
 package eu.clarin.sru.server.fcs;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -6,5 +7,4 @@
 
 import javax.servlet.ServletContext;
-import javax.xml.XMLConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
@@ -36,7 +36,8 @@
 public abstract class SimpleEndpointSearchEngineBase extends
         SRUSearchEngineBase {
-    private static final String FCS_RESOURCE_INFO_NS =
-            "http://clarin.eu/fcs/1.0/resource-info";
-    private static final String X_CMD_RESOURCE_INFO = "x-cmd-resource-info";
+    
+//    private static final String X_CMD_RESOURCE_INFO = "x-cmd-resource-info";
+    private static final String X_FCS_ENDPOINT_DESCRIPTION = "x-fcs-endpoint-description";
+    
     private static final String FCS_SCAN_INDEX_FCS_RESOURCE = "fcs.resource";
     private static final String FCS_SCAN_INDEX_CQL_SERVERCHOICE = "cql.serverChoice";
@@ -47,7 +48,17 @@
             LoggerFactory.getLogger(SimpleEndpointSearchEngineBase.class);
     protected ResourceInfoInventory resourceInfoInventory;
-
-
-    /**
+    
+    public List<String> capabilities;
+    public List<DataView> supportedDataViews;
+    
+    public void addEndpointCapability(String c){
+    	capabilities.add(c);
+    }
+    
+    public void addDataView(DataView d){
+    	supportedDataViews.add(d);
+    }
+	
+	/**
      * This method should not be overridden. Perform your custom initialization
      * in the {@link #doInit(ServletContext, SRUServerConfig, Map)} method
@@ -61,8 +72,22 @@
         logger.debug("initializing");
         super.init(context, config, params);
-
+        
+        logger.debug("Setting basic capability");
+        capabilities = new ArrayList<String>();
+        capabilities.add("http://clarin.eu/fcs/capability/basic-search");
+        
+        logger.debug("Setting Generic Hits dataview");
+        supportedDataViews = new ArrayList<DataView>();
+        supportedDataViews.add(
+        		new DataView("The representation of the hit", 
+        			"application/x-clarin-fcs-hits+xml", 
+        			DataView.PayloadDisposition.INLINE, 
+        			DataView.PayloadDelivery.SEND_BY_DEFAULT, 
+        			"hits")
+        );
+        
         logger.debug("initializing search engine implementation");
         doInit(context, config, params);
-
+        	
         logger.debug("initizalizing resource info inventory");
         this.resourceInfoInventory = createResourceInfoInventory(context, config, params);
@@ -97,5 +122,5 @@
             throws SRUException {
         final boolean provideResourceInfo =
-                parseBoolean(request.getExtraRequestData(X_CMD_RESOURCE_INFO));
+                parseBoolean(request.getExtraRequestData(X_FCS_ENDPOINT_DESCRIPTION));
         if (provideResourceInfo) {
             final List<ResourceInfo> resourceInfoList =
@@ -112,5 +137,7 @@
                 public void writeExtraResponseData(XMLStreamWriter writer)
                         throws XMLStreamException {
-                    writeFullResourceInfo(writer, null, resourceInfoList);
+                	EndpointDescriptionWriter.writeEndpointDescription(writer, 
+                			capabilities, supportedDataViews, resourceInfoList);
+                    //ResourceInfoWriter.writeFullResourceInfo(writer, null, resourceInfoList);
                 }
             };
@@ -130,4 +157,5 @@
      */
     @Override
+    @Deprecated
     public final SRUScanResultSet scan(SRUServerConfig config,
             SRURequest request, SRUDiagnosticList diagnostics)
@@ -153,5 +181,5 @@
              */
             final boolean provideResourceInfo = parseBoolean(
-                    request.getExtraRequestData(X_CMD_RESOURCE_INFO));
+                    request.getExtraRequestData(X_FCS_ENDPOINT_DESCRIPTION));
 
             return new SRUScanResultSet(diagnostics) {
@@ -198,5 +226,5 @@
                         throws XMLStreamException {
                     if (provideResourceInfo) {
-                        writeResourceInfo(writer, null, result.get(idx));
+                        ResourceInfoWriter.writeResourceInfo(writer, null, result.get(idx));
                     }
                 }
@@ -266,4 +294,5 @@
      *      SRUDiagnosticList)
      */
+    @Deprecated
     protected SRUScanResultSet doScan(SRUServerConfig config,
             SRURequest request, SRUDiagnosticList diagnostics)
@@ -301,5 +330,5 @@
     }
 
-
+    @Deprecated
     private List<ResourceInfo> translateFcsScanResource(CQLNode scanClause)
             throws SRUException {
@@ -373,119 +402,5 @@
 
 
-    private static void writeFullResourceInfo(XMLStreamWriter writer,
-            String prefix, List<ResourceInfo> resourceInfoList)
-            throws XMLStreamException {
-        if (resourceInfoList == null) {
-            throw new NullPointerException("resourceInfoList == null");
-        }
-        if (!resourceInfoList.isEmpty()) {
-            final boolean defaultNS = ((prefix == null) || prefix.isEmpty());
-            if (defaultNS) {
-                writer.setDefaultNamespace(FCS_RESOURCE_INFO_NS);
-            } else {
-                writer.setPrefix(prefix, FCS_RESOURCE_INFO_NS);
-            }
-            writer.writeStartElement(FCS_RESOURCE_INFO_NS, "ResourceCollection");
-            if (defaultNS) {
-                writer.writeDefaultNamespace(FCS_RESOURCE_INFO_NS);
-            } else {
-                writer.writeNamespace(prefix, FCS_RESOURCE_INFO_NS);
-            }
-            for (ResourceInfo resourceInfo : resourceInfoList) {
-                doWriteResourceInfo(writer, prefix, resourceInfo, false, true);
-            }
-            writer.writeEndElement(); // "ResourceCollection" element
-        }
-    }
-
-
-    private static void writeResourceInfo(XMLStreamWriter writer, String prefix,
-            ResourceInfo resourceInfo) throws XMLStreamException {
-        if (resourceInfo == null) {
-            throw new NullPointerException("resourceInfo == null");
-        }
-        doWriteResourceInfo(writer, prefix, resourceInfo, true, false);
-    }
-
-
-    private static void doWriteResourceInfo(XMLStreamWriter writer,
-            String prefix, ResourceInfo resourceInfo, boolean writeNS,
-            boolean recursive) throws XMLStreamException {
-        final boolean defaultNS = ((prefix == null) || prefix.isEmpty());
-        if (writeNS) {
-            if (defaultNS) {
-                writer.setDefaultNamespace(FCS_RESOURCE_INFO_NS);
-            } else {
-                writer.setPrefix(prefix, FCS_RESOURCE_INFO_NS);
-            }
-        }
-        writer.writeStartElement(FCS_RESOURCE_INFO_NS, "ResourceInfo");
-        if (writeNS) {
-            if (defaultNS) {
-                writer.writeDefaultNamespace(FCS_RESOURCE_INFO_NS);
-            } else {
-                writer.writeNamespace(prefix, FCS_RESOURCE_INFO_NS);
-            }
-        }
-        if (recursive) {
-            /*
-             * HACK: only output @pid for recursive (= explain) requests.
-             * This should be revisited, if we decide to go for the explain
-             * style enumeration of resources.
-             */
-            writer.writeAttribute("pid", resourceInfo.getPid());
-        }
-        if (resourceInfo.hasSubResources()) {
-            writer.writeAttribute("hasSubResources", "true");
-        }
-
-        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
-        }
-
-        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
-            }
-        }
-
-        final String landingPageURI = resourceInfo.getLandingPageURI();
-        if (landingPageURI != null) {
-            writer.writeStartElement(FCS_RESOURCE_INFO_NS, "LandingPageURI");
-            writer.writeCharacters(landingPageURI);
-            writer.writeEndElement(); // "LandingPageURI" element
-        }
-
-        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
-
-        if (recursive && resourceInfo.hasSubResources()) {
-            writer.writeStartElement(FCS_RESOURCE_INFO_NS,
-                    "ResourceInfoCollection");
-            for (ResourceInfo r : resourceInfo.getSubResources()) {
-                doWriteResourceInfo(writer, prefix, r, writeNS, recursive);
-            }
-            writer.writeEndElement(); // "ResourceCollection" element
-        }
-        writer.writeEndElement(); // "ResourceInfo" element
-    }
+    
 
 } // class SimpleEndpointSearchEngineBase
Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleFcsResourceWriter.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleFcsResourceWriter.java	(revision 5477)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleFcsResourceWriter.java	(revision 5477)
@@ -0,0 +1,73 @@
+package eu.clarin.sru.server.fcs;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SimpleFcsResourceWriter {
+	private static final String FCS_NS = "http://clarin.eu/fcs/resource";
+    private static final String FCS_PREFIX = "fcs";
+    private static final String FCS_DATAVIEW_MIMETYPE =
+            "application/x-clarin-fcs-hits+xml";
+    
+    private static final String HITS_NS = "http://clarin.eu/fcs/dataview/hits";
+    private static final String HITS_PREFIX = "hits";
+    
+    public static void writeResource(XMLStreamWriter writer, String pid, String ref, 
+			String leftContext, String keyword, String rightContext)
+            throws XMLStreamException {
+		
+		if (writer == null) {
+            throw new NullPointerException("writer == null");
+        }
+		
+		writer.setPrefix(FCS_PREFIX, FCS_NS);
+        writer.writeStartElement(FCS_NS, "Resource");
+        writer.writeNamespace(FCS_PREFIX, FCS_NS);
+        if ((pid != null) && !pid.isEmpty()) {
+            writer.writeAttribute("pid", pid);
+        }
+        if ((ref != null) && !ref.isEmpty()) {
+            writer.writeAttribute("ref", ref);
+        }        
+        writeDataView(writer, leftContext, keyword, rightContext);        
+        writer.writeEndElement();
+	}
+    
+    public static void writeDataView(XMLStreamWriter writer, String leftContext, 
+    		String keyword, String rightContext) throws XMLStreamException { 
+    	
+    	if (writer == null) {
+            throw new NullPointerException("writer == null");
+        }
+    	
+    	writer.writeStartElement(FCS_NS, "DataView");
+        writer.writeAttribute("type", FCS_DATAVIEW_MIMETYPE);        
+        writeHits(writer, leftContext, keyword, rightContext);        
+        writer.writeEndElement();
+    }
+    
+    public static void writeHits(XMLStreamWriter writer, String leftContext, 
+    		String keyword, String rightContext) throws XMLStreamException {                                    
+            
+    	if (writer == null) {
+            throw new NullPointerException("writer == null");
+        }
+        writer.setPrefix(HITS_PREFIX, HITS_NS);
+        writer.writeStartElement(HITS_NS, "Result");
+        writer.writeNamespace(HITS_PREFIX, HITS_NS);
+        
+        if (leftContext != null && !leftContext.isEmpty()) {
+            writer.writeCharacters(leftContext);
+        }
+        
+        writer.writeStartElement(HITS_NS, "Hit");
+        writer.writeCharacters(keyword);
+        writer.writeEndElement(); // Hit
+
+        if (rightContext != null && !rightContext.isEmpty()) {
+            writer.writeCharacters(rightContext);
+        }
+        
+        writer.writeEndElement(); // Result
+    }
+}
Index: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleResourceInfoInventoryParser.java
===================================================================
--- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleResourceInfoInventoryParser.java	(revision 5474)
+++ FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleResourceInfoInventoryParser.java	(revision 5477)
@@ -4,4 +4,5 @@
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -27,4 +28,5 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
@@ -44,5 +46,5 @@
  */
 public class SimpleResourceInfoInventoryParser {
-    private static final String NS = "http://clarin.eu/fcs/1.0/resource-info";
+    private static final String NS = "http://clarin.eu/fcs/endpoint-description";
     private static final String LANG_EN = "en";
     private static final Logger logger =
@@ -103,5 +105,5 @@
             });
             XPathExpression expression =
-                    xpath.compile("/ri:ResourceCollection/ri:ResourceInfo");
+                    xpath.compile("/ri:Resources/ri:Resource");
             NodeList list =
                     (NodeList) expression.evaluate(doc, XPathConstants.NODESET);
@@ -137,4 +139,5 @@
             String link = null;
             List<String> langs = null;
+            String[] availableDataViews = null;
             List<ResourceInfo> sub = null;
 
@@ -262,7 +265,18 @@
                 }
             }
-
+            
+            XPathExpression x6 = xpath.compile("ri:AvailableDataViews/@ref");
+            String ref = (String) x6.evaluate(node, XPathConstants.STRING);
+            
+            if (ref == null || ref.isEmpty()){
+            	throw new SRUConfigException("Element <AvailableDataViews> " +
+                        "must have a non-empty attribute ref.");
+            }
+            
+            availableDataViews = ref.split("\\s+");
+            
+            
             XPathExpression x5 =
-                    xpath.compile("ri:ResourceCollection/ri:ResourceInfo");
+                    xpath.compile("ri:Resources/ri:Resource");
             NodeList l5 = (NodeList) x5.evaluate(node, XPathConstants.NODESET);
             if ((l5 != null) && (l5.getLength() > 0)) {
@@ -274,5 +288,5 @@
             }
             ris.add(new ResourceInfo(pid, resourceCount, titles, descrs, link,
-                    langs, sub));
+                    langs, Arrays.asList(availableDataViews),sub));
         }
         return ris;
