105 |
105 |
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
|
106 |
106 |
import edu.ucsb.nceas.metacat.MetaCatServlet;
|
107 |
107 |
import edu.ucsb.nceas.metacat.MetacatHandler;
|
|
108 |
|
|
109 |
import edu.ucsb.nceas.metacat.common.query.EnabledQueryEngines;
|
108 |
110 |
import edu.ucsb.nceas.metacat.common.query.stream.ContentTypeByteArrayInputStream;
|
109 |
111 |
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService;
|
110 |
112 |
import edu.ucsb.nceas.metacat.index.MetacatSolrEngineDescriptionHandler;
|
... | ... | |
145 |
147 |
public class MNodeService extends D1NodeService
|
146 |
148 |
implements MNAuthorization, MNCore, MNRead, MNReplication, MNStorage, MNQuery {
|
147 |
149 |
|
148 |
|
private static final String PATHQUERY = "pathquery";
|
|
150 |
//private static final String PATHQUERY = "pathquery";
|
149 |
151 |
private static final String UUID_SCHEME = "UUID";
|
150 |
152 |
private static final String DOI_SCHEME = "DOI";
|
151 |
153 |
private static final String UUID_PREFIX = "urn:uuid:";
|
... | ... | |
1409 |
1411 |
public QueryEngineDescription getQueryEngineDescription(String engine)
|
1410 |
1412 |
throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented,
|
1411 |
1413 |
NotFound {
|
1412 |
|
if(engine != null && engine.equals(PATHQUERY)) {
|
|
1414 |
if(engine != null && engine.equals(EnabledQueryEngines.PATHQUERYENGINE)) {
|
1413 |
1415 |
QueryEngineDescription qed = new QueryEngineDescription();
|
1414 |
|
qed.setName(PATHQUERY);
|
|
1416 |
qed.setName(EnabledQueryEngines.PATHQUERYENGINE);
|
1415 |
1417 |
qed.setQueryEngineVersion("1.0");
|
1416 |
1418 |
qed.addAdditionalInfo("This is the traditional structured query for Metacat");
|
1417 |
1419 |
Vector<String> pathsForIndexing = null;
|
... | ... | |
1433 |
1435 |
qed.addQueryField(field);
|
1434 |
1436 |
}
|
1435 |
1437 |
return qed;
|
1436 |
|
} else if (engine != null && engine.equals(MetacatSolrIndex.SOLRQUERY)) {
|
|
1438 |
} else if (engine != null && engine.equals(EnabledQueryEngines.SOLRENGINE)) {
|
|
1439 |
/*if(!EnabledQueryEngines.getInstance().isEnabled(EnabledQueryEngines.SOLRENGINE)) {
|
|
1440 |
throw new NotImplemented("0000", "MNodeService.getQueryEngineDescription - the query engine "+engine +" hasn't been implemented or has been disabled.");
|
|
1441 |
}*/
|
1437 |
1442 |
try {
|
1438 |
1443 |
QueryEngineDescription qed = MetacatSolrEngineDescriptionHandler.getInstance().getQueryEngineDescritpion();
|
1439 |
1444 |
return qed;
|
... | ... | |
1451 |
1456 |
public QueryEngineList listQueryEngines() throws InvalidToken,
|
1452 |
1457 |
ServiceFailure, NotAuthorized, NotImplemented {
|
1453 |
1458 |
QueryEngineList qel = new QueryEngineList();
|
1454 |
|
// support pathquery initially
|
1455 |
|
qel.addQueryEngine(PATHQUERY);
|
1456 |
|
qel.addQueryEngine(MetacatSolrIndex.SOLRQUERY);
|
|
1459 |
qel.addQueryEngine(EnabledQueryEngines.PATHQUERYENGINE);
|
|
1460 |
qel.addQueryEngine(EnabledQueryEngines.SOLRENGINE);
|
|
1461 |
/*List<String> enables = EnabledQueryEngines.getInstance().getEnabled();
|
|
1462 |
for(String name : enables) {
|
|
1463 |
qel.addQueryEngine(name);
|
|
1464 |
}*/
|
1457 |
1465 |
return qel;
|
1458 |
1466 |
}
|
1459 |
1467 |
|
... | ... | |
1483 |
1491 |
}
|
1484 |
1492 |
//System.out.println("====== user is "+user);
|
1485 |
1493 |
//System.out.println("====== groups are "+groups);
|
1486 |
|
if (engine != null && engine.equals(PATHQUERY)) {
|
|
1494 |
if (engine != null && engine.equals(EnabledQueryEngines.PATHQUERYENGINE)) {
|
1487 |
1495 |
try {
|
1488 |
1496 |
DBQuery queryobj = new DBQuery();
|
1489 |
1497 |
|
... | ... | |
1496 |
1504 |
throw new ServiceFailure("Pathquery error", e.getMessage());
|
1497 |
1505 |
}
|
1498 |
1506 |
|
1499 |
|
} else if (engine != null && engine.equals(MetacatSolrIndex.SOLRQUERY)) {
|
|
1507 |
} else if (engine != null && engine.equals(EnabledQueryEngines.SOLRENGINE)) {
|
|
1508 |
/*if(!EnabledQueryEngines.getInstance().isEnabled(EnabledQueryEngines.SOLRENGINE)) {
|
|
1509 |
throw new NotImplemented("0000", "MNodeService.query - the query engine "+engine +" hasn't been implemented or has been disabled.");
|
|
1510 |
}*/
|
1500 |
1511 |
logMetacat.info("The query is ==================================== \n"+query);
|
1501 |
1512 |
try {
|
1502 |
1513 |
|
Use some contants from the EnabledQueryEngines.