本文整理汇总了Java中gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException类的典型用法代码示例。如果您正苦于以下问题:Java RemoteResourcePropertyRetrievalException类的具体用法?Java RemoteResourcePropertyRetrievalException怎么用?Java RemoteResourcePropertyRetrievalException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RemoteResourcePropertyRetrievalException类属于gov.nih.nci.cagrid.metadata.exceptions包,在下文中一共展示了RemoteResourcePropertyRetrievalException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCaGridVersion
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
public static CaGridVersion getCaGridVersion(EndpointReferenceType serviceEPR) throws InvalidResourcePropertyException,
RemoteResourcePropertyRetrievalException, ResourcePropertyRetrievalException {
CaGridVersion result = null;
try {
Element resourceProperty = ResourcePropertyHelper.getResourceProperty(serviceEPR,
MetadataConstants.CAGRID_VERSION_QNAME);
result = deserializeCaGridVersion(new StringReader(XmlUtils.toString(resourceProperty)));
} catch (InvalidResourcePropertyException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Resource property for CaGridVersion not found on " + serviceEPR.getAddress().toString());
LOG.debug("Assuming the service is from an older version of caGrid which doesn' have this property");
LOG.debug(e);
}
} catch (Exception ex) {
throw new ResourcePropertyRetrievalException("Unable to deserailize CaGridVersion: " + ex.getMessage(), ex);
}
return result;
}
示例2: isDataService
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Determines if the given service is a data service
*
* @param serviceEPR
* @return true iff the service is a data service
* @throws RemoteResourcePropertyRetrievalException
* @throws ResourcePropertyRetrievalException
*/
public static boolean isDataService(EndpointReferenceType serviceEPR) throws InvalidResourcePropertyException,
RemoteResourcePropertyRetrievalException, ResourcePropertyRetrievalException {
DomainModel domainModel = null;
ServiceMetadata serviceMetadata = null;
try {
domainModel = getDomainModel(serviceEPR);
serviceMetadata = getServiceMetadata(serviceEPR);
} catch (InvalidResourcePropertyException e) {
// if it complains about not having the necessary metadata, its not
// a data service
return false;
}
return domainModel != null && serviceMetadata != null;
}
示例3: handleException
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
private void handleException(Exception e) throws InvalidResourceException,
GenericException {
if (e instanceof RemoteResourcePropertyRetrievalException) {
log.info(e);
} else if (e instanceof MalformedURLException) {
log.error(e);
throw new InvalidResourceException("malformed URL has occurred ("
+ e.getMessage() + ")", e);
} else if (e instanceof ResourcePropertyRetrievalException) {
log.error(e);
throw new InvalidResourceException(
"error occured retrieving resource property "
+ e.getMessage(), e);
} else if (e instanceof RemoteException) {
log.error(e);
throw new GenericException(
"communication-related exception occured " + e.getMessage(), e);
} else {
log.error(e);
throw new GenericException("error occured " + e.getMessage(), e);
}
}
示例4: discoverByFilter
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Applies the specified predicate to the common path in the Index Service's
* Resource Properties to return registered services' EPRs that match the
* predicate.
*
* @param xpathPredicate
* predicate to apply to the "Entry" in Index Service
* @return EndpointReferenceType[] of matching services @
* @throws ResourcePropertyRetrievalException
* @throws QueryInvalidException
* @throws RemoteResourcePropertyRetrievalException
*/
protected EndpointReferenceType[] discoverByFilter(String xpathPredicate)
throws RemoteResourcePropertyRetrievalException, QueryInvalidException, ResourcePropertyRetrievalException {
EndpointReferenceType[] results = null;
// query the service and deser the results
MessageElement[] elements = ResourcePropertyHelper.queryResourceProperties(this.indexEPR,
translateXPath(xpathPredicate));
Object[] objects = null;
try {
objects = ObjectDeserializer.toObject(elements, EndpointReferenceType.class);
} catch (DeserializationException e) {
throw new ResourcePropertyRetrievalException("Unable to deserialize results to EPRs!", e);
}
// if we got results, cast them into what we are expected to return
if (objects != null) {
results = new EndpointReferenceType[objects.length];
System.arraycopy(objects, 0, results, 0, objects.length);
}
return results;
}
示例5: getUmlClassesFromService
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
protected UMLClass[] getUmlClassesFromService() throws MalformedURIException, InvalidResourcePropertyException, RemoteResourcePropertyRetrievalException, ResourcePropertyRetrievalException {
if (umlClassList == null) {
EndpointReferenceType epr = new EndpointReferenceType();
AttributedURI uri = new AttributedURI(getServiceUrl());
epr.setAddress(uri);
DomainModel domainModel = MetadataUtils.getDomainModel(epr);
DomainModelExposedUMLClassCollection classCollection = domainModel.getExposedUMLClassCollection();
umlClassList = classCollection.getUMLClass();
}
return umlClassList;
}
示例6: getServiceMetadata
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Obtain the service metadata from the specified service.
*
* @param serviceEPR
* @return The service metadata from the targeted service
* @throws InvalidResourcePropertyException
* @throws RemoteResourcePropertyRetrievalException
* @throws ResourcePropertyRetrievalException
*/
public static ServiceMetadata getServiceMetadata(EndpointReferenceType serviceEPR)
throws InvalidResourcePropertyException, RemoteResourcePropertyRetrievalException,
ResourcePropertyRetrievalException {
Element resourceProperty = ResourcePropertyHelper.getResourceProperty(serviceEPR,
MetadataConstants.CAGRID_MD_QNAME);
ServiceMetadata result;
try {
result = deserializeServiceMetadata(new StringReader(XmlUtils.toString(resourceProperty)));
} catch (Exception e) {
throw new ResourcePropertyRetrievalException("Unable to deserailize ServiceMetadata: " + e.getMessage(), e);
}
return result;
}
示例7: getDomainModel
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Obtain the data service metadata from the specified service.
*
* @param serviceEPR
* @return The domain model from the targeted data service
* @throws InvalidResourcePropertyException
* @throws RemoteResourcePropertyRetrievalException
* @throws ResourcePropertyRetrievalException
*/
public static DomainModel getDomainModel(EndpointReferenceType serviceEPR) throws InvalidResourcePropertyException,
RemoteResourcePropertyRetrievalException, ResourcePropertyRetrievalException {
Element resourceProperty = ResourcePropertyHelper.getResourceProperty(serviceEPR,
MetadataConstants.CAGRID_DATA_MD_QNAME);
DomainModel result;
try {
result = deserializeDomainModel(new StringReader(XmlUtils.toString(resourceProperty)));
} catch (Exception e) {
throw new ResourcePropertyRetrievalException("Unable to deserailize DomainModel: " + e.getMessage(), e);
}
return result;
}
示例8: main
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
public static void main(String[] args) throws RemoteResourcePropertyRetrievalException, QueryInvalidException,
ResourcePropertyRetrievalException, InvalidConfigurationException, InterruptedException, IOException {
for (int i = 0; i < args.length; i++) {
String sourceURL = args[i];
DiscoveryClient sourceClient = new DiscoveryClient(sourceURL);
EndpointReferenceType[] allServices = sourceClient.getAllServices(true);
System.out.println("Found " + allServices.length + " services in Index Service:" + sourceURL);
for (EndpointReferenceType epr : allServices) {
System.out.println("Processing service: " + epr.getAddress());
try {
File registrationFile = new File("resources/registrationTemplate.xml");
if (registrationFile.exists() && registrationFile.canRead()) {
ServiceGroupRegistrationParameters params = ServiceGroupRegistrationClient
.readParams(registrationFile.getAbsolutePath());
params.setRegistrantEPR(epr);
for (int j = 0; j < MULTIPLIER; j++) {
// System.out.println("Registering for the " + (j+1)
// + " time.");
AdvertisementClient registrationClient = new AdvertisementClient(params);
registrationClient.register();
}
Thread.sleep((long) (1000 + (1000 * (10 * Math.random()))));
} else {
System.out.println("Unable to read registration file:" + registrationFile);
}
} catch (Exception e) {
System.err.println("Exception when trying to register service (" + epr + "): " + e.getMessage());
}
}
}
System.out.println("Type 'exit' to quit, and unregister services:");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
while (line != null) {
if (line.equals("exit")) {
System.out.println("Exiting.");
System.exit(0);
}
line = br.readLine();
}
}
示例9: queryResourceProperties
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
public static MessageElement[] queryResourceProperties(EndpointReferenceType endpoint, String queryExpression)
throws RemoteResourcePropertyRetrievalException, QueryInvalidException {
return queryResourceProperties(endpoint, queryExpression, null);
}
示例10: getResourceProperties
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
public static Element getResourceProperties(EndpointReferenceType endpoint)
throws ResourcePropertyRetrievalException, RemoteResourcePropertyRetrievalException, QueryInvalidException {
return getResourceProperties(endpoint, (InputStream) null);
}
示例11: getResourceProperty
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
public static Element getResourceProperty(EndpointReferenceType endpoint, QName rpName)
throws ResourcePropertyRetrievalException, RemoteResourcePropertyRetrievalException,
InvalidResourcePropertyException {
return getResourceProperty(endpoint, rpName, null);
}
示例12: getAllServices
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Query the registry for all registered services
*
* @param requireMetadataCompliance
* if true, only services providing the standard metadata will be
* returned. Otherwise, all services registered will be returned,
* regardless of whether or not any metadata has been aggregated.
* @return EndpointReferenceType[] contain all registered services
* @throws ResourcePropertyRetrievalException
* @throws QueryInvalidException
* @throws RemoteResourcePropertyRetrievalException
*/
public EndpointReferenceType[] getAllServices(boolean requireMetadataCompliance)
throws RemoteResourcePropertyRetrievalException, QueryInvalidException, ResourcePropertyRetrievalException {
if (!requireMetadataCompliance) {
return discoverByFilter("*");
} else {
return discoverByFilter(MD_PATH);
}
}
示例13: discoverServicesByPointOfContact
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Searches to find services that have the given point of contact associated
* with them. Any fields set on the point of contact are checked for a
* match. For example, you can set only the lastName, and only it will be
* checked, or you can specify several feilds and they all must be equal.
*
* @param contact
* point of contact
* @return EndpointReferenceType[] matching the criteria
* @throws ResourcePropertyRetrievalException
* @throws QueryInvalidException
* @throws RemoteResourcePropertyRetrievalException
*/
public EndpointReferenceType[] discoverServicesByPointOfContact(PointOfContact contact)
throws RemoteResourcePropertyRetrievalException, QueryInvalidException, ResourcePropertyRetrievalException {
String pocPredicate = buildPOCPredicate(contact);
return discoverByFilter(MD_PATH + "[" + cagrid + ":hostingResearchCenter/" + com + ":ResearchCenter/" + com
+ ":pointOfContactCollection/" + com + ":PointOfContact[" + pocPredicate + "] or " + cagrid
+ ":serviceDescription/" + serv + ":Service/" + serv + ":pointOfContactCollection/" + com
+ ":PointOfContact[" + pocPredicate + "]]");
}
示例14: discoverServicesByOperationInput
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Searches to find services that have an operation defined that takes the
* given UMLClass as input. Any fields set on the UMLClass are checked for a
* match. For example, you can set only the packageName, and only it will be
* checked, or you can specify several feilds and they all must be equal.
* NOTE: Only attributes of the UMLClass are examined (associated objects
* (e.g. UMLAttributeCollection and SemanticMetadataCollection) are
* ignored).
*
* @param clazzPrototype
* The protype UMLClass
* @return EndpointReferenceType[] matching the criteria
* @throws ResourcePropertyRetrievalException
* @throws QueryInvalidException
* @throws RemoteResourcePropertyRetrievalException
*/
public EndpointReferenceType[] discoverServicesByOperationInput(UMLClass clazzPrototype)
throws RemoteResourcePropertyRetrievalException, QueryInvalidException, ResourcePropertyRetrievalException {
String umlClassPredicate = buildUMLClassPredicate(clazzPrototype);
return discoverByFilter(OPER_PATH + "/" + serv + ":inputParameterCollection/" + serv + ":InputParameter/" + com
+ ":UMLClass[" + umlClassPredicate + "]");
}
示例15: discoverServicesByOperationOutput
import gov.nih.nci.cagrid.metadata.exceptions.RemoteResourcePropertyRetrievalException; //导入依赖的package包/类
/**
* Searches to find services that have an operation defined that produces
* the given UMLClass. Any fields set on the UMLClass are checked for a
* match. For example, you can set only the packageName, and only it will be
* checked, or you can specify several feilds and they all must be equal.
* NOTE: Only attributes of the UMLClass are examined (associated objects
* (e.g. UMLAttributeCollection and SemanticMetadataCollection) are
* ignored).
*
* @param clazzPrototype
* The protype UMLClass
* @return EndpointReferenceType[] matching the criteria
* @throws ResourcePropertyRetrievalException
* @throws QueryInvalidException
* @throws RemoteResourcePropertyRetrievalException
*/
public EndpointReferenceType[] discoverServicesByOperationOutput(UMLClass clazzPrototype)
throws RemoteResourcePropertyRetrievalException, QueryInvalidException, ResourcePropertyRetrievalException {
String umlClassPredicate = buildUMLClassPredicate(clazzPrototype);
return discoverByFilter(OPER_PATH + "/" + serv + ":Output/" + com + ":UMLClass[" + umlClassPredicate + "]");
}