本文整理汇总了Java中gov.nih.nci.cagrid.common.Utils.serializeObject方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.serializeObject方法的具体用法?Java Utils.serializeObject怎么用?Java Utils.serializeObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nih.nci.cagrid.common.Utils
的用法示例。
在下文中一共展示了Utils.serializeObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: microarraySetToStatml
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public gridextensions.Data microarraySetToStatml(edu.columbia.geworkbench.cagrid.microarray.MicroarraySet microarraySet) throws RemoteException {
try {
// get XML
StringWriter microarraySw = new StringWriter();
Utils.serializeObject(microarraySet, new QName("MicroarraySet"), microarraySw);
GeWorkbenchParser gwParser = new GeWorkbenchParser();
gwParser.parseMicroarray(microarraySw.toString());
GenePatternParser gpParser = new GenePatternParser();
gpParser.setMicroarrayData(gpParser.getMicroarrayData());
return gpParser.convertToStatml();
} catch (Exception e) {
e.printStackTrace();
throw new RemoteException(e.getMessage());
}
}
示例2: next
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
* @return TypeAttribute[] unless xmlOnly == true,
* then a serialized CQLAttributeResult
*/
public Object next() {
if (currentIndex >= results.length - 1) {
// works because on first call, currentIndex == -1
throw new NoSuchElementException();
}
currentIndex++;
CQLAttributeResult result = results[currentIndex];
if (xmlOnly) {
StringWriter writer = new StringWriter();
try {
Utils.serializeObject(result, CQL_ATTRIBUTE_RESULT_QNAME, writer);
} catch (Exception ex) {
throw new RuntimeException("Error serializing attribute results: " + ex.getMessage(), ex);
}
return writer.getBuffer().toString();
}
return result.getAttribute();
}
示例3: getAuthorizationExtensionData
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public ExtensionType getAuthorizationExtensionData() throws Exception {
ExtensionType extension = new ExtensionType();
extension.setExtensionType(ExtensionsLoader.AUTHORIZATION_EXTENSION);
extension.setName(getAuthorizationExtensionDescriptionType().getName());
MembershipExpression expression = getGridgrouperExpressionEditor().getMembershipExpression();
MembershipExpressionValidator.validateMembeshipExpression(expression);
StringWriter sw = new StringWriter();
Utils.serializeObject(expression, MembershipExpression.getTypeDesc().getXmlType(), sw);
Document doc = XMLUtilities.stringToDocument(sw.toString());
Element el = (Element)doc.getRootElement().detach();
MessageElement elem = AxisJdomUtils.fromElement(el);
ExtensionTypeExtensionData data = new ExtensionTypeExtensionData();
data.set_any(new MessageElement[] {elem});
extension.setExtensionData(data);
return extension;
}
示例4: getRequestMessage
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
Message getRequestMessage(IntegrationHubDto hubDto) throws LVException {
try {
QName qName = new QName(hubDto.getQName(), hubDto.getQRequest());
Object requestObj = hubDto.getRequestObj();
Utils.serializeObject(requestObj, qName , new PrintWriter(hubDto.getMessageXml()));
Message requestMessage = new Message();
Metadata metadata = new Metadata();
metadata.setExternalIdentifier(hubDto.getExternalIdentifier());
metadata.setCredentials(hubDto.getCredential());
metadata.setServiceType(hubDto.getServiceType());
requestMessage.setMetadata(metadata);
requestMessage.setRequest(new Request());
MessagePayload messagePayload = new MessagePayload();
URI uri = new URI();
uri.setPath(hubDto.getQName());
messagePayload.setXmlSchemaDefinition(uri);
MessageElement messageElement = new MessageElement(qName, requestObj);
messagePayload.set_any(new MessageElement[] {messageElement });
requestMessage.getRequest().setBusinessMessagePayload(messagePayload);
return requestMessage;
} catch (Exception e) {
throw new LVException(e);
}
}
示例5: createSubscriptionListener
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private SubscriptionListener createSubscriptionListener(
final FederatedQueryResultsRetrievalClient resultsClient, final InfoHolder info) {
SubscriptionListener listener = new SubscriptionListener() {
public void subscriptionValueChanged(ResourcePropertyValueChangeNotificationType notification) {
try {
String newMetadataDocument = AnyHelper.toSingleString(notification.getNewValue().get_any());
FederatedQueryExecutionStatus status = Utils.deserializeObject(
new StringReader(newMetadataDocument), FederatedQueryExecutionStatus.class);
StringWriter writer = new StringWriter();
Utils.serializeObject(status, FederatedQueryResultsConstants.FEDERATEDQUERYEXECUTIONSTATUS, writer);
LOG.debug("GOT NOTIFICATION:");
LOG.debug(writer.getBuffer().toString());
if ((info.success == null || !info.success.booleanValue()) && ProcessingStatus.Complete.equals(status.getCurrentStatus())) {
enumerateAndVerify(resultsClient);
LOG.debug("SETTING SUCCESS STATUS TO TRUE");
info.success = Boolean.TRUE;
}
} catch (Exception ex) {
ex.printStackTrace();
info.success = Boolean.FALSE;
info.exception = ex;
}
}
};
return listener;
}
示例6: createSubscriptionListener
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private SubscriptionListener createSubscriptionListener(
final FederatedQueryResultsClient resultsClient, final InfoHolder info) {
SubscriptionListener listener = new SubscriptionListener() {
public void subscriptionValueChanged(ResourcePropertyValueChangeNotificationType notification) {
try {
String newMetadataDocument = AnyHelper.toSingleString(notification.getNewValue().get_any());
FederatedQueryExecutionStatus status = (FederatedQueryExecutionStatus) Utils.deserializeObject(
new StringReader(newMetadataDocument), FederatedQueryExecutionStatus.class);
StringWriter writer = new StringWriter();
Utils.serializeObject(status, FederatedQueryResultsConstants.FEDERATEDQUERYEXECUTIONSTATUS, writer);
LOG.debug("GOT NOTIFICATION:");
LOG.debug(writer.getBuffer().toString());
if ((info.success == null || !info.success.booleanValue()) && ProcessingStatus.Complete.equals(status.getCurrentStatus())) {
enumerateAndVerify(resultsClient);
LOG.debug("SETTING SUCCESS STATUS TO TRUE");
info.success = Boolean.TRUE;
}
} catch (Exception ex) {
ex.printStackTrace();
info.success = Boolean.FALSE;
info.exception = ex;
}
}
};
return listener;
}
示例7: validateCQLResultSet
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
* Validates a CQL result set's contents against the restricted result set schema
*
* @param resultSet
* @throws SchemaValidationException
*/
public void validateCQLResultSet(CQLQueryResults resultSet) throws SchemaValidationException {
// make sure we are ready to go
initializeRestrictedXSD();
if (resultSet == null) {
LOG.debug("Null results passed, ignoring.");
return;
}
StringWriter writer = new StringWriter();
try {
Utils.serializeObject(resultSet, CqlSchemaConstants.CQL_RESULT_COLLECTION_QNAME, writer);
} catch (Exception e) {
LOG.error(e);
throw new SchemaValidationException("Problem serializing result set", e);
}
String xmlContents = writer.getBuffer().toString();
if (LOG.isDebugEnabled()) {
LOG.debug("RESULTS:\n" + xmlContents);
}
this.validator.validate(xmlContents);
}
示例8: saveCurrentFile
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void saveCurrentFile() {
try {
ValidationDescription description = createValidationDescription();
FileWriter writer = new FileWriter(currentDeploymentDescriptionFile);
Utils.serializeObject(description, GridDeploymentValidationLoader.VALIDATION_DESCRIPTION_QNAME, writer);
writer.flush();
writer.close();
} catch (Exception ex) {
ex.printStackTrace();
String[] message = {
"An error occured saving the deployment description:",
ex.getMessage()
};
JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE);
}
}
示例9: getAuthorizationExtensionData
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
@Override
public ExtensionType getAuthorizationExtensionData() throws Exception {
CSMAuthorizationDescription desc = getCsmAuthorizationPanel().getAuthorization();
ExtensionType extension = new ExtensionType();
extension.setExtensionType(ExtensionsLoader.AUTHORIZATION_EXTENSION);
extension.setName(getAuthorizationExtensionDescriptionType().getName());
StringWriter sw = new StringWriter();
Utils.serializeObject(desc, desc.getTypeDesc().getXmlType(), sw);
Document doc = XMLUtilities.stringToDocument(sw.toString());
Element el = (Element)doc.getRootElement().detach();
MessageElement elem = AxisJdomUtils.fromElement(el);
ExtensionTypeExtensionData data = new ExtensionTypeExtensionData();
data.set_any(new MessageElement[] {elem});
extension.setExtensionData(data);
return extension;
}
示例10: writeAuditorsConfiguration
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void writeAuditorsConfiguration(DataServiceAuditors auditors) throws Exception {
if (CommonTools.servicePropertyExists(
getServiceInfo().getServiceDescriptor(),
DataServiceConstants.DATA_SERVICE_AUDITORS_CONFIG_FILE_PROPERTY)) {
try {
// get the name of the auditor config file
String filename = CommonTools.getServicePropertyValue(
getServiceInfo().getServiceDescriptor(),
DataServiceConstants.DATA_SERVICE_AUDITORS_CONFIG_FILE_PROPERTY);
File outFile = new File(getServiceInfo().getBaseDirectory().getAbsolutePath()
+ File.separator + "etc" + File.separator + filename);
FileWriter writer = new FileWriter(outFile);
Utils.serializeObject(auditors,
DataServiceConstants.DATA_SERVICE_AUDITORS_QNAME, writer);
writer.flush();
writer.close();
} catch (Exception ex) {
ex.printStackTrace();
throw new CodegenExtensionException(
"Error writing auditor configuration: " + ex.getMessage(), ex);
}
}
}
示例11: persistModelChanges
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void persistModelChanges() throws Throwable {
// persist the changes made by the configuration steps
File serviceModelFile = new File(getServiceInformation().getBaseDirectory(), IntroduceConstants.INTRODUCE_XML_FILE);
LOG.debug("Persisting changes to service model (" + serviceModelFile.getAbsolutePath() + ")");
FileWriter writer = new FileWriter(serviceModelFile);
Utils.serializeObject(getServiceInformation().getServiceDescriptor(), IntroduceConstants.INTRODUCE_SKELETON_QNAME, writer);
writer.flush();
writer.close();
}
示例12: checkDefaultPredicates
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static CQLQuery checkDefaultPredicates(CQLQuery original) throws Exception {
LOG.debug("Checking query for Attributes with no predicate defined");
StringWriter originalWriter = new StringWriter();
Utils.serializeObject(original, DataServiceConstants.CQL_QUERY_QNAME, originalWriter);
Element root = XMLUtilities.stringToDocument(originalWriter.getBuffer().toString()).getRootElement();
Filter attributeNoPredicateFilter = new Filter() {
public boolean matches(Object o) {
if (o instanceof Element) {
Element e = (Element) o;
if (e.getName().equals("Attribute") && e.getAttribute("predicate") == null) {
return true;
}
}
return false;
}
};
List<?> attributesWithNoPredicate = root.getContent(attributeNoPredicateFilter);
Iterator<?> attribIter = attributesWithNoPredicate.iterator();
while (attribIter.hasNext()) {
LOG.debug("Adding default predicate to an attribute");
Element elem = (Element) attribIter.next();
elem.setAttribute("predicate", "EQUAL_TO");
}
String xml = XMLUtilities.elementToString(root);
CQLQuery edited = Utils.deserializeObject(new StringReader(xml), CQLQuery.class);
return edited;
}
示例13: createSubscriptionListener
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private SubscriptionListener createSubscriptionListener(
final FederatedQueryResultsClient resultsClient, final InfoHolder info) {
SubscriptionListener listener = new SubscriptionListener() {
private boolean completeDetected = false;
public void subscriptionValueChanged(ResourcePropertyValueChangeNotificationType notification) {
try {
String newMetadataDocument = AnyHelper.toSingleString(notification.getNewValue().get_any());
FederatedQueryExecutionStatus status = Utils.deserializeObject(
new StringReader(newMetadataDocument), FederatedQueryExecutionStatus.class);
StringWriter writer = new StringWriter();
Utils.serializeObject(status, FederatedQueryResultsConstants.FEDERATEDQUERYEXECUTIONSTATUS, writer);
if (LOG.isDebugEnabled()) {
LOG.debug("GOT NOTIFICATION:");
LOG.debug(writer.getBuffer().toString());
}
if (!completeDetected && ProcessingStatus.Complete.equals(status.getCurrentStatus())) {
completeDetected = true;
LOG.debug("EXECUTING TRANSFER AND VERIFY PROCESS");
transferAndVerify(resultsClient);
LOG.debug("SETTING SUCCESS STATUS TO TRUE");
info.success = Boolean.TRUE;
}
} catch (Exception ex) {
ex.printStackTrace();
info.success = Boolean.FALSE;
info.exception = ex;
}
}
};
return listener;
}
示例14: serializeDCQLQueryResults
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
* Write the XML representation of the specified query results to the specified
* writer, using the configuration specified by the WSDD configuration.
* If either the results or writer are null, an IllegalArgumentException will be thrown.
*
* @param results
* @param writer
* @param wsddStream
* @throws Exception
*/
public static void serializeDCQLQueryResults(DCQLQueryResultsCollection results, Writer writer, InputStream wsddStream) throws Exception {
if (results == null || writer == null) {
throw new IllegalArgumentException("Null is not a valid argument");
}
if (wsddStream == null) {
Utils.serializeObject(results, DCQLConstants.DCQL_RESULTS_QNAME, writer);
} else {
Utils.serializeObject(results, DCQLConstants.DCQL_RESULTS_QNAME, writer, wsddStream);
}
}
示例15: next
import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public CQLResult next() {
CQLResult result = null;
if (queryModifier == null) {
// object result
Object instance = cqlResultsIterator.next();
try {
// serialize the object so it can go into an AnyNode
StringWriter xmlWriter = new StringWriter();
if (wsddStream == null) {
Utils.serializeObject(instance, targetQName, xmlWriter);
} else {
wsddStream.reset();
Utils.serializeObject(instance, targetQName, xmlWriter, wsddStream);
}
AnyNode node = AnyNodeHelper.convertStringToAnyNode(xmlWriter.toString());
result = new CQLObjectResult(node);
} catch (Exception ex) {
NoSuchElementException nse = new NoSuchElementException("Unable to convert object to AnyNode: " + ex.getMessage());
nse.initCause(ex);
throw nse;
}
} else {
if (queryModifier.isCountOnly()) {
String value = String.valueOf(cqlResultsIterator.next());
result = new CQLAggregateResult(Aggregation.COUNT, "id", value);
} else {
// distinct or multiple attribute results
String[] attributeNames = queryModifier.getDistinctAttribute() != null
? new String[] {queryModifier.getDistinctAttribute()} : queryModifier.getAttributeNames();
Object[] values = (Object[]) cqlResultsIterator.next();
TargetAttribute[] tas = new TargetAttribute[attributeNames.length];
for (int i = 0; i < attributeNames.length; i++) {
tas[i] = new TargetAttribute(attributeNames[i], String.valueOf(values[i]));
}
result = new CQLAttributeResult(tas);
}
}
return result;
}