// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/MarketplaceException.java
// @SuppressWarnings("serial")
// public class MarketplaceException extends RuntimeException {
// 
//     public MarketplaceException() {
//     }
// 
//     public MarketplaceException(String message) {
//         super(message);
//     }
//     
//     public MarketplaceException(String message, Throwable cause){
//     	super(message, cause);
//     }
// 
// }
// 
// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/store/rdf/RdfStore.java
// public abstract class RdfStore {
// 	
// 	public abstract void shutdown();
// 	public abstract void initialize();
//     public abstract boolean store(String identifier, String entry);
//     public abstract void tag(String identifier, String tag);
//     public abstract void removeTag(String identifier, String tag);
//     public abstract List<Map<String, String>> getRdfEntriesAsMap(String query) throws MarketplaceException;
//     public abstract String getRdfEntriesAsXml(String query) throws MarketplaceException;
//     public abstract String getRdfEntriesAsJson(String query) throws MarketplaceException;
//     public abstract String getRdfEntry(String uri) throws MarketplaceException;
//     public abstract void remove(String identifier);
//     public abstract int size();
// }


import static eu.stratuslab.marketplace.metadata.MetadataNamespaceContext.MARKETPLACE_URI;
import static eu.stratuslab.marketplace.metadata.MetadataNamespaceContext.SLTERMS_NS_URI;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import org.openrdf.model.Value;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.LiteralImpl;
import org.openrdf.query.BindingSet;
import org.openrdf.query.MalformedQueryException;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.QueryLanguage;
import org.openrdf.query.TupleQuery;
import org.openrdf.query.TupleQueryResult;
import org.openrdf.query.resultio.TupleQueryResultWriter;
import org.openrdf.query.resultio.TupleQueryResultWriterFactory;
import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriterFactory;
import org.openrdf.query.resultio.sparqljson.SPARQLResultsJSONWriterFactory;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.RepositoryLockedException;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.rio.RDFFormat;
import org.openrdf.sail.LockManager;
import org.openrdf.sail.SailException;
import org.openrdf.sail.SailLockedException;
import org.openrdf.sail.helpers.SailBase;
import eu.stratuslab.marketplace.server.MarketplaceException;
import eu.stratuslab.marketplace.server.store.rdf.RdfStore;
	}
	
	public boolean store(String identifier, String entry) {
		boolean success = false;
		String idURI = "/" + identifier;
		
		try {
			RepositoryConnection con = getMetadataStore().getConnection();
			ValueFactory vf = con.getValueFactory();
			Reader reader = new StringReader(entry);
			try {
				con.clear(vf.createURI(idURI));
				con.add(reader, MARKETPLACE_URI, RDFFormat.RDFXML,
						vf.createURI(idURI));				
			} finally {
				con.close();
			}
			success = true;
		} catch (RepositoryException e) {
			LOGGER.severe("Unable to clear metadata entry: " + e.getMessage());
		} catch (java.io.IOException e) {
			LOGGER.severe("Error storing metadata entry: " + e.getMessage());
		} catch (org.openrdf.rio.RDFParseException e) {
			LOGGER.severe(e.getMessage());
		}

		return success;
	}

	@Override
// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/MarketplaceException.java
// @SuppressWarnings("serial")
// public class MarketplaceException extends RuntimeException {
// 
//     public MarketplaceException() {
//     }
// 
//     public MarketplaceException(String message) {
//         super(message);
//     }
//     
//     public MarketplaceException(String message, Throwable cause){
//     	super(message, cause);
//     }
// 
// }
// 
// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/store/rdf/RdfStore.java
// public abstract class RdfStore {
// 	
// 	public abstract void shutdown();
// 	public abstract void initialize();
//     public abstract boolean store(String identifier, String entry);
//     public abstract void tag(String identifier, String tag);
//     public abstract void removeTag(String identifier, String tag);
//     public abstract List<Map<String, String>> getRdfEntriesAsMap(String query) throws MarketplaceException;
//     public abstract String getRdfEntriesAsXml(String query) throws MarketplaceException;
//     public abstract String getRdfEntriesAsJson(String query) throws MarketplaceException;
//     public abstract String getRdfEntry(String uri) throws MarketplaceException;
//     public abstract void remove(String identifier);
//     public abstract int size();
// }


// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/store/rdf/sesame/SesameRdfStore.java
import static eu.stratuslab.marketplace.metadata.MetadataNamespaceContext.MARKETPLACE_URI;
import static eu.stratuslab.marketplace.metadata.MetadataNamespaceContext.SLTERMS_NS_URI;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import org.openrdf.model.Value;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.LiteralImpl;
import org.openrdf.query.BindingSet;
import org.openrdf.query.MalformedQueryException;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.QueryLanguage;
import org.openrdf.query.TupleQuery;
import org.openrdf.query.TupleQueryResult;
import org.openrdf.query.resultio.TupleQueryResultWriter;
import org.openrdf.query.resultio.TupleQueryResultWriterFactory;
import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriterFactory;
import org.openrdf.query.resultio.sparqljson.SPARQLResultsJSONWriterFactory;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.RepositoryLockedException;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.rio.RDFFormat;
import org.openrdf.sail.LockManager;
import org.openrdf.sail.SailException;
import org.openrdf.sail.SailLockedException;
import org.openrdf.sail.helpers.SailBase;
import eu.stratuslab.marketplace.server.MarketplaceException;
import eu.stratuslab.marketplace.server.store.rdf.RdfStore;

	}
	
	public boolean store(String identifier, String entry) {
		boolean success = false;
		String idURI = "/" + identifier;
		
		try {
			RepositoryConnection con = getMetadataStore().getConnection();
			ValueFactory vf = con.getValueFactory();
			Reader reader = new StringReader(entry);
			try {
				con.clear(vf.createURI(idURI));
				con.add(reader, MARKETPLACE_URI, RDFFormat.RDFXML,
						vf.createURI(idURI));				
			} finally {
				con.close();
			}
			success = true;
		} catch (RepositoryException e) {
			LOGGER.severe("Unable to clear metadata entry: " + e.getMessage());
		} catch (java.io.IOException e) {
			LOGGER.severe("Error storing metadata entry: " + e.getMessage());
		} catch (org.openrdf.rio.RDFParseException e) {
			LOGGER.severe(e.getMessage());
		}

		return success;
	}

	@Override
	public String getRdfEntry(String uri) throws MarketplaceException {