SDB implementation of RDF API (and merge from trunk)

This commit is contained in:
brianjlowe 2012-06-04 21:09:36 +00:00
parent 8aa257d564
commit cead502f89
194 changed files with 10522 additions and 5324 deletions

View file

@ -21,7 +21,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
/**
* Mock the basic functions of Individual for unit tests.
@ -380,12 +379,6 @@ public class IndividualStub implements Individual {
throw new RuntimeException("Individual.setVClasses() not implemented.");
}
@Override
public boolean isMemberOfClassProhibitedFromSearch(ProhibitedFromSearch pfs) {
throw new RuntimeException(
"Individual.isMemberOfClassProhibitedFromSearch() not implemented.");
}
@Override
public void setObjectPropertyStatements(List<ObjectPropertyStatement> list) {
throw new RuntimeException(

View file

@ -0,0 +1,264 @@
package stubs.edu.cornell.mannlib.vitro.webapp.dao;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import edu.cornell.mannlib.vitro.webapp.beans.Classes2Classes;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
public class VClassDaoStub implements VClassDao {
// ----------------------------------------------------------------------
// Stub infrastructure
// ----------------------------------------------------------------------
private final Map<String, VClass> vclassesByUri = new HashMap<String, VClass>();
public void setVClass(String uri, VClass vclass) {
vclassesByUri.put(uri, vclass);
}
// ----------------------------------------------------------------------
// Stub methods
// ----------------------------------------------------------------------
@Override
public VClass getVClassByURI(String URI) {
return vclassesByUri.get(URI);
}
// ----------------------------------------------------------------------
// Un-implemented methods
// ----------------------------------------------------------------------
@Override
public List<VClass> getRootClasses() {
throw new RuntimeException(
"VClassDaoStub.getRootClasses() not implemented.");
}
@Override
public List<VClass> getOntologyRootClasses(String ontologyURI) {
throw new RuntimeException(
"VClassDaoStub.getOntologyRootClasses() not implemented.");
}
@Override
public List<VClass> getAllVclasses() {
throw new RuntimeException(
"VClassDaoStub.getAllVclasses() not implemented.");
}
@Override
public List<String> getDisjointWithClassURIs(String vclassURI) {
throw new RuntimeException(
"VClassDaoStub.getDisjointWithClassURIs() not implemented.");
}
@Override
public void addSuperclass(VClass subclass, VClass superclass) {
throw new RuntimeException(
"VClassDaoStub.addSuperclass() not implemented.");
}
@Override
public void addSuperclass(String classURI, String superclassURI) {
throw new RuntimeException(
"VClassDaoStub.addSuperclass() not implemented.");
}
@Override
public void removeSuperclass(VClass vclass, VClass superclass) {
throw new RuntimeException(
"VClassDaoStub.removeSuperclass() not implemented.");
}
@Override
public void removeSuperclass(String classURI, String superclassURI) {
throw new RuntimeException(
"VClassDaoStub.removeSuperclass() not implemented.");
}
@Override
public void addSubclass(VClass vclass, VClass subclass) {
throw new RuntimeException(
"VClassDaoStub.addSubclass() not implemented.");
}
@Override
public void addSubclass(String classURI, String subclassURI) {
throw new RuntimeException(
"VClassDaoStub.addSubclass() not implemented.");
}
@Override
public void removeSubclass(VClass vclass, VClass subclass) {
throw new RuntimeException(
"VClassDaoStub.removeSubclass() not implemented.");
}
@Override
public void removeSubclass(String classURI, String subclassURI) {
throw new RuntimeException(
"VClassDaoStub.removeSubclass() not implemented.");
}
@Override
public void addDisjointWithClass(String classURI, String disjointCLassURI) {
throw new RuntimeException(
"VClassDaoStub.addDisjointWithClass() not implemented.");
}
@Override
public void removeDisjointWithClass(String classURI, String disjointClassURI) {
throw new RuntimeException(
"VClassDaoStub.removeDisjointWithClass() not implemented.");
}
@Override
public List<String> getEquivalentClassURIs(String classURI) {
throw new RuntimeException(
"VClassDaoStub.getEquivalentClassURIs() not implemented.");
}
@Override
public void addEquivalentClass(String classURI, String equivalentClassURI) {
throw new RuntimeException(
"VClassDaoStub.addEquivalentClass() not implemented.");
}
@Override
public void removeEquivalentClass(String classURI, String equivalentClassURI) {
throw new RuntimeException(
"VClassDaoStub.removeEquivalentClass() not implemented.");
}
@Override
public List<String> getSubClassURIs(String classURI) {
throw new RuntimeException(
"VClassDaoStub.getSubClassURIs() not implemented.");
}
@Override
public List<String> getAllSubClassURIs(String classURI) {
throw new RuntimeException(
"VClassDaoStub.getAllSubClassURIs() not implemented.");
}
@Override
public List<String> getSuperClassURIs(String classURI, boolean direct) {
throw new RuntimeException(
"VClassDaoStub.getSuperClassURIs() not implemented.");
}
@Override
public List<String> getAllSuperClassURIs(String classURI) {
throw new RuntimeException(
"VClassDaoStub.getAllSuperClassURIs() not implemented.");
}
@Override
public void insertNewVClass(VClass cls) throws InsertException {
throw new RuntimeException(
"VClassDaoStub.insertNewVClass() not implemented.");
}
@Override
public void updateVClass(VClass cls) {
throw new RuntimeException(
"VClassDaoStub.updateVClass() not implemented.");
}
@Override
public void deleteVClass(String URI) {
throw new RuntimeException(
"VClassDaoStub.deleteVClass() not implemented.");
}
@Override
public void deleteVClass(VClass cls) {
throw new RuntimeException(
"VClassDaoStub.deleteVClass() not implemented.");
}
@Override
public List<VClass> getVClassesForProperty(String propertyURI,
boolean domainSide) {
throw new RuntimeException(
"VClassDaoStub.getVClassesForProperty() not implemented.");
}
@Override
public List<VClass> getVClassesForProperty(String vclassURI,
String propertyURI) {
throw new RuntimeException(
"VClassDaoStub.getVClassesForProperty() not implemented.");
}
@Override
public void addVClassesToGroup(VClassGroup group) {
throw new RuntimeException(
"VClassDaoStub.addVClassesToGroup() not implemented.");
}
@Override
public void insertNewClasses2Classes(Classes2Classes c2c) {
throw new RuntimeException(
"VClassDaoStub.insertNewClasses2Classes() not implemented.");
}
@Override
public void deleteClasses2Classes(Classes2Classes c2c) {
throw new RuntimeException(
"VClassDaoStub.deleteClasses2Classes() not implemented.");
}
@Override
public void addVClassesToGroup(VClassGroup group,
boolean includeUninstantiatedClasses) {
throw new RuntimeException(
"VClassDaoStub.addVClassesToGroup() not implemented.");
}
@Override
public void addVClassesToGroup(VClassGroup group,
boolean includeUninstantiatedClasses, boolean getIndividualCount) {
throw new RuntimeException(
"VClassDaoStub.addVClassesToGroup() not implemented.");
}
@Override
public void addVClassesToGroups(List<VClassGroup> groups) {
throw new RuntimeException(
"VClassDaoStub.addVClassesToGroups() not implemented.");
}
@Override
public boolean isSubClassOf(VClass vc1, VClass vc2) {
throw new RuntimeException(
"VClassDaoStub.isSubClassOf() not implemented.");
}
@Override
public boolean isSubClassOf(String vclassURI1, String vclassURI2) {
throw new RuntimeException(
"VClassDaoStub.isSubClassOf() not implemented.");
}
@Override
public VClass getTopConcept() {
throw new RuntimeException(
"VClassDaoStub.getTopConcept() not implemented.");
}
@Override
public VClass getBottomConcept() {
throw new RuntimeException(
"VClassDaoStub.getBottomConcept() not implemented.");
}
}

View file

@ -10,6 +10,8 @@ import java.io.StringWriter;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
@ -29,6 +31,7 @@ public class HttpServletResponseStub implements HttpServletResponse {
private String errorMessage;
private Map<String, String> headers = new HashMap<String, String>();
private String contentType;
private String charset = "";
private ByteArrayOutputStream outputStream;
private StringWriter outputWriter;
@ -129,9 +132,19 @@ public class HttpServletResponseStub implements HttpServletResponse {
return headers.containsKey(name);
}
/**
* Calling setContentType("this/type;charset=UTF-8") is the same as calling
* setContentType("this/type;charset=UTF-8"); setCharacterEncoding("UTF-8")
*/
@Override
public void setContentType(String contentType) {
this.contentType = contentType;
Pattern p = Pattern.compile(";\\scharset=([^;]+)");
Matcher m = p.matcher(contentType);
if (m.find()) {
this.charset = m.group(1);
}
}
@Override
@ -139,6 +152,16 @@ public class HttpServletResponseStub implements HttpServletResponse {
return contentType;
}
@Override
public void setCharacterEncoding(String charset) {
this.charset = charset;
}
@Override
public String getCharacterEncoding() {
return charset;
}
// ----------------------------------------------------------------------
// Un-implemented methods
// ----------------------------------------------------------------------
@ -155,12 +178,6 @@ public class HttpServletResponseStub implements HttpServletResponse {
"HttpServletResponseStub.getBufferSize() not implemented.");
}
@Override
public String getCharacterEncoding() {
throw new RuntimeException(
"HttpServletResponseStub.getCharacterEncoding() not implemented.");
}
@Override
public Locale getLocale() {
throw new RuntimeException(
@ -191,12 +208,6 @@ public class HttpServletResponseStub implements HttpServletResponse {
"HttpServletResponseStub.setBufferSize() not implemented.");
}
@Override
public void setCharacterEncoding(String arg0) {
throw new RuntimeException(
"HttpServletResponseStub.setCharacterEncoding() not implemented.");
}
@Override
public void setContentLength(int arg0) {
throw new RuntimeException(

View file

@ -0,0 +1,46 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package stubs.org.apache.solr.client.solrj;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.common.util.NamedList;
/**
* TODO
*/
public class SolrServerStub extends SolrServer {
private static final Log log = LogFactory.getLog(SolrServerStub.class);
// ----------------------------------------------------------------------
// Stub infrastructure
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Stub methods
// ----------------------------------------------------------------------
/*
* (non-Javadoc)
*
* @see
* org.apache.solr.client.solrj.SolrServer#request(org.apache.solr.client
* .solrj.SolrRequest)
*/
@Override
public NamedList<Object> request(SolrRequest request)
throws SolrServerException, IOException {
// TODO not really an implementation.
return new NamedList<Object>();
}
// ----------------------------------------------------------------------
// Un-implemented methods
// ----------------------------------------------------------------------
}