本文整理汇总了Java中gov.nih.nci.cagrid.data.mapping.Mappings类的典型用法代码示例。如果您正苦于以下问题:Java Mappings类的具体用法?Java Mappings怎么用?Java Mappings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Mappings类属于gov.nih.nci.cagrid.data.mapping包,在下文中一共展示了Mappings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQNameForClass
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
protected QName getQNameForClass(String clazz) {
QName name = null;
LOG.debug("Checking class to qname mappings for " + clazz);
Mappings mappings = getClassToQnameMappings();
if (mappings.getMapping() != null) {
for (ClassToQname c2q : mappings.getMapping()) {
if (c2q.getClassName().equals(clazz)) {
name = QName.valueOf(c2q.getQname());
LOG.debug("Found mapping");
break;
}
}
}
if (name == null) {
LOG.debug("QName not found in class to qname mappings, checking Axis types registry");
try {
name = Utils.getRegisteredQName(Class.forName(clazz));
} catch (ClassNotFoundException e) {
LOG.error("UNABLE TO LOAD CLASS " + clazz + " TO DETERMINE QNAME: " + e.getMessage(), e);
}
}
if (name == null) {
LOG.warn("Unable to determine a QName for class " + clazz);
}
return name;
}
示例2: processQuery
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
public CQLQueryResults processQuery(CQLQuery cqlQuery) throws MalformedQueryException, QueryProcessingException {
List<?> results = getResultsList(cqlQuery);
Mappings mapping = TestQueryResultsGenerator.getClassToQnameMappings();
try {
CQLQueryResults queryResults = CQLResultsCreationUtil.createObjectResults(results, cqlQuery.getTarget().getName(), mapping);
return queryResults;
} catch (ResultsCreationException ex) {
throw new QueryProcessingException("Error creating result set: " + ex.getMessage(), ex);
}
}
示例3: getQname
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
private QName getQname(String targetClassname) {
Mappings map = TestQueryResultsGenerator.getClassToQnameMappings();
for (ClassToQname c2q : map.getMapping()) {
if (c2q.getClassName().equals(targetClassname)) {
return QName.valueOf(c2q.getQname());
}
}
return null;
}
示例4: getClassToQnameMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
public static Mappings getClassToQnameMappings() {
Mappings mapping = new Mappings();
ClassToQname bookMap = new ClassToQname();
bookMap.setClassName(Book.class.getName());
bookMap.setQname(new QName(BOOKSTORE_NAMESPACE, "Book").toString());
ClassToQname storeMap = new ClassToQname();
storeMap.setClassName(BookStore.class.getName());
storeMap.setQname(new QName(BOOKSTORE_NAMESPACE, "BookStore").toString());
mapping.setMapping(new ClassToQname[] {bookMap, storeMap});
return mapping;
}
示例5: getClassToQnameMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
private Mappings getClassToQnameMappings() throws Exception {
if (mappings == null) {
// get the mapping file name
String filename = ServiceConfigUtil.getClassToQnameMappingsFile();
mappings = Utils.deserializeDocument(filename, Mappings.class);
}
return mappings;
}
示例6: createObjectResults
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
/**
* Creates a CQL Query Results object containing object results
*
* @param objects
* The objects to serialize and place in the object results
* @param targetName
* The name of the targeted class which produced these results
* @param classToQname
* A Mapping from class name to QName
* @return
* A CQLQueryResults instance with its object results populated
*
* @throws ResultsCreationException
*/
public static CQLQueryResults createObjectResults(List objects, String targetName, Mappings classToQname) throws ResultsCreationException {
CQLQueryResults results = new CQLQueryResults();
results.setTargetClassname(targetName);
QName targetQName = getQname(targetName, classToQname);
List objectResults = new ArrayList();
for (Iterator iter = objects.iterator(); iter.hasNext();) {
MessageElement elem = new MessageElement(targetQName, iter.next());
objectResults.add(new CQLObjectResult(new MessageElement[] {elem}));
}
CQLObjectResult[] objectResultArray = new CQLObjectResult[objectResults.size()];
objectResults.toArray(objectResultArray);
results.setObjectResult(objectResultArray);
return results;
}
示例7: getQname
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
private static QName getQname(String className, Mappings classMappings) {
for (int i = 0; classMappings.getMapping() != null && i < classMappings.getMapping().length; i++) {
if (classMappings.getMapping(i).getClassName().equals(className)) {
return QName.valueOf(classMappings.getMapping(i).getQname());
}
}
return null;
}
示例8: initializeClassToQnameMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
private void initializeClassToQnameMappings() throws InitializationException {
try {
// get the mapping file name
String filename = ServiceConfigUtil.getClassToQnameMappingsFile();
// String filename = "mapping.xml";
this.classToQnameMappings = (Mappings) Utils.deserializeDocument(filename, Mappings.class);
} catch (Exception ex) {
String message = "Error initializing class to QName mappings: " + ex.getMessage();
LOG.error(message, ex);
throw new InitializationException(message, ex);
}
}
示例9: getClassToQnameMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
private Mappings getClassToQnameMappings() throws Exception {
// get the mapping file name
String filename = ServiceConfigUtil.getClassToQnameMappingsFile();
// String filename = "mapping.xml";
Mappings mappings = (Mappings) Utils.deserializeDocument(filename, Mappings.class);
return mappings;
}
示例10: getClassToQnameMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
/**
* Get xml mappings.
* @return xml mappings
* @throws Exception on error
*/
protected Mappings getClassToQnameMappings() throws Exception {
// get the mapping file name
String filename = ServiceConfigUtil.getClassToQnameMappingsFile();
Mappings mappings = (Mappings) Utils.deserializeDocument(filename, Mappings.class);
return mappings;
}
示例11: initialize
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
/**
* Used to inject a pre-existing Dataset Service and a custom security service. This method
* is intended for testing purposes only.
* @param parameters Properties passed to CQLQueryProcessor
* @param wsdd WSDD file passed to CQLQueryProcessor
* @param datasetService Used to configure Cql2SparqlProcessor
* @throws InitializationException
*/
public void initialize(DatasetService datasetService, GlobusSecurityService securitySvc, InputStream wsdd, Mappings classToQname) throws InitializationException {
super.initialize(getRequiredParameters(), wsdd) ;
anzo = new Anzo(datasetService) ;
if (!anzo.isConnected()) {
throw new InitializationException("Error connecting to anzo.") ;
}
processor = new Cql2SparqlProcessor(anzo, getCvitMappers()) ;
this.securitySvc = securitySvc ;
this.classToQname = classToQname ;
}
示例12: MappingFileQNameResolver
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
public MappingFileQNameResolver(Mappings mappings) {
this.mappings = mappings;
}
示例13: deserializeMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
public static Mappings deserializeMappings(File mappingsFile) throws Exception {
FileReader reader = new FileReader(mappingsFile);
Mappings map = Utils.deserializeObject(reader, Mappings.class);
return map;
}
示例14: getClassToQnameMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
protected Mappings getClassToQnameMappings() {
return classToQnameMappings;
}
示例15: deserializeMappings
import gov.nih.nci.cagrid.data.mapping.Mappings; //导入依赖的package包/类
public static Mappings deserializeMappings(File mappingsFile) throws Exception {
FileReader reader = new FileReader(mappingsFile);
Mappings map = (Mappings) Utils.deserializeObject(reader, Mappings.class);
return map;
}