Exemplo n.º 1
0
 private static CQLQueryResults queryStandard(
     CQLQuery query, String targetServiceURL, GlobusCredential cred)
     throws RemoteDataServiceException {
   LOG.debug("Querying " + targetServiceURL + " with standard CQL 2 query mechanism");
   DataServiceClient client = null;
   try {
     client = new DataServiceClient(targetServiceURL, cred);
   } catch (MalformedURIException ex) {
     throw new RemoteDataServiceException("Invalid target service URL:" + targetServiceURL, ex);
   } catch (RemoteException ex) {
     String message = "Problem creating client for " + targetServiceURL + ": " + ex.getMessage();
     LOG.error(message, ex);
     throw new RemoteDataServiceException(message, ex);
   }
   // if we have been supplied a credential, make sure we always use it
   if (cred != null) {
     client.setAnonymousPrefered(false);
   }
   CQLQueryResults results = null;
   try {
     results = client.executeQuery(query);
   } catch (RemoteException e) {
     String message =
         "Problem querying remote service " + targetServiceURL + ": " + e.getMessage();
     LOG.error(message, e);
     throw new RemoteDataServiceException(message, e);
   }
   return results;
 }