808 |
808 |
}
|
809 |
809 |
|
810 |
810 |
/**
|
811 |
|
* Search the metadata catalog for identifiers that match the criteria
|
812 |
|
*
|
813 |
|
* @param session - the Session object containing the credentials for the Subject
|
814 |
|
* @param queryType - An identifier for the type of query expression
|
815 |
|
* provided in the query
|
816 |
|
* @param query - The criteria for matching the characteristics of the
|
817 |
|
* metadata objects of interest
|
818 |
|
*
|
819 |
|
* @return objectList - the list of objects matching the criteria
|
820 |
|
*
|
821 |
|
* @throws InvalidToken
|
822 |
|
* @throws ServiceFailure
|
823 |
|
* @throws NotAuthorized
|
824 |
|
* @throws InvalidRequest
|
825 |
|
* @throws NotImplemented
|
|
811 |
* Metacat does not implement this method at the CN level
|
826 |
812 |
*/
|
827 |
813 |
@Override
|
828 |
814 |
public ObjectList search(Session session, String queryType, String query)
|
829 |
815 |
throws InvalidToken, ServiceFailure, NotAuthorized, InvalidRequest,
|
830 |
816 |
NotImplemented {
|
831 |
817 |
|
832 |
|
ObjectList objectList = null;
|
833 |
|
try {
|
834 |
|
objectList =
|
835 |
|
IdentifierManager.getInstance().querySystemMetadata(
|
836 |
|
null, //startTime,
|
837 |
|
null, //endTime,
|
838 |
|
null, //objectFormat,
|
839 |
|
false, //replicaStatus,
|
840 |
|
0, //start,
|
841 |
|
-1 //count
|
842 |
|
);
|
843 |
|
|
844 |
|
} catch (Exception e) {
|
845 |
|
throw new ServiceFailure("4310", "Error querying system metadata: " + e.getMessage());
|
846 |
|
}
|
847 |
|
|
848 |
|
return objectList;
|
849 |
|
|
850 |
|
//throw new NotImplemented("4281", "search not implemented");
|
851 |
|
|
852 |
|
// the code block below is from an older implementation
|
853 |
|
|
854 |
|
/* This block commented out because of the EcoGrid circular dependency.
|
855 |
|
* For now, query will not be supported until the circularity can be
|
856 |
|
* resolved, probably by moving the ecogrid query syntax transformers
|
857 |
|
* directly into the Metacat codebase. MBJ 2010-02-03
|
858 |
|
|
859 |
|
try {
|
860 |
|
EcogridQueryParser parser = new EcogridQueryParser(request
|
861 |
|
.getReader());
|
862 |
|
parser.parseXML();
|
863 |
|
QueryType queryType = parser.getEcogridQuery();
|
864 |
|
EcogridJavaToMetacatJavaQueryTransformer queryTransformer =
|
865 |
|
new EcogridJavaToMetacatJavaQueryTransformer();
|
866 |
|
QuerySpecification metacatQuery = queryTransformer
|
867 |
|
.transform(queryType);
|
868 |
|
|
869 |
|
DBQuery metacat = new DBQuery();
|
870 |
|
|
871 |
|
boolean useXMLIndex = (new Boolean(PropertyService
|
872 |
|
.getProperty("database.usexmlindex"))).booleanValue();
|
873 |
|
String xmlquery = "query"; // we don't care the query in resultset,
|
874 |
|
// the query can be anything
|
875 |
|
PrintWriter out = null; // we don't want metacat result, so set out null
|
876 |
|
|
877 |
|
// parameter: queryspecification, user, group, usingIndexOrNot
|
878 |
|
StringBuffer result = metacat.createResultDocument(xmlquery,
|
879 |
|
metacatQuery, out, username, groupNames, useXMLIndex);
|
880 |
|
|
881 |
|
// create result set transfer
|
882 |
|
String saxparser = PropertyService.getProperty("xml.saxparser");
|
883 |
|
MetacatResultsetParser metacatResultsetParser = new MetacatResultsetParser(
|
884 |
|
new StringReader(result.toString()), saxparser, queryType
|
885 |
|
.getNamespace().get_value());
|
886 |
|
ResultsetType records = metacatResultsetParser.getEcogridResult();
|
887 |
|
|
888 |
|
System.out
|
889 |
|
.println(EcogridResultsetTransformer.toXMLString(records));
|
890 |
|
response.setContentType("text/xml");
|
891 |
|
out = response.getWriter();
|
892 |
|
out.print(EcogridResultsetTransformer.toXMLString(records));
|
893 |
|
|
894 |
|
} catch (Exception e) {
|
895 |
|
e.printStackTrace();
|
896 |
|
}*/
|
897 |
|
|
898 |
|
|
|
818 |
throw new NotImplemented("4281", "Metacat does not implement CN.search");
|
|
819 |
|
|
820 |
// ObjectList objectList = null;
|
|
821 |
// try {
|
|
822 |
// objectList =
|
|
823 |
// IdentifierManager.getInstance().querySystemMetadata(
|
|
824 |
// null, //startTime,
|
|
825 |
// null, //endTime,
|
|
826 |
// null, //objectFormat,
|
|
827 |
// false, //replicaStatus,
|
|
828 |
// 0, //start,
|
|
829 |
// 1000 //count
|
|
830 |
// );
|
|
831 |
//
|
|
832 |
// } catch (Exception e) {
|
|
833 |
// throw new ServiceFailure("4310", "Error querying system metadata: " + e.getMessage());
|
|
834 |
// }
|
|
835 |
//
|
|
836 |
// return objectList;
|
|
837 |
|
899 |
838 |
}
|
900 |
839 |
|
901 |
840 |
/**
|
CN.search() id not implemented by metacat -- making that explicit and also testing for it.