当前位置: 首页>>代码示例>>Java>>正文


Java Utils.deserializeObject方法代码示例

本文整理汇总了Java中gov.nih.nci.cagrid.common.Utils.deserializeObject方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.deserializeObject方法的具体用法?Java Utils.deserializeObject怎么用?Java Utils.deserializeObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gov.nih.nci.cagrid.common.Utils的用法示例。


在下文中一共展示了Utils.deserializeObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServiceMetadata

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * This method obtains the service metadata for the service.
 * 
 * @return The service metadata.
 * @throws ResourcePropertyRetrievalException
 */

public ServiceMetadata getServiceMetadata() throws InvalidResourcePropertyException,
    ResourcePropertyRetrievalException {
    if (serviceMetadata == null) {
        Element resourceProperty = null;

        InputStream wsdd = getClass().getResourceAsStream("client-config.wsdd");
        resourceProperty = ResourcePropertyHelper.getResourceProperty(client.getEndpointReference(),
            SERVICE_METADATA, wsdd);

        try {
            this.serviceMetadata = (ServiceMetadata) Utils.deserializeObject(new StringReader(XmlUtils
                .toString(resourceProperty)), ServiceMetadata.class);
        } catch (Exception e) {
            throw new ResourcePropertyRetrievalException("Unable to deserailize: " + e.getMessage(), e);
        }
    }
    return this.serviceMetadata;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:26,代码来源:DorianBaseClient.java

示例2: 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;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:28,代码来源:CQLAttributeDefaultPredicateUtil.java

示例3: loadQueryResults

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private CQLQueryResults loadQueryResults(String filename)  {
    String fullFilename = TEST_RESULTS_DIR + filename;
    CQLQueryResults results = null;
    try {
        InputStream resultInputStream = InvokeDataServiceStep.class.getResourceAsStream(fullFilename);
        InputStreamReader reader = new InputStreamReader(resultInputStream);
        results = Utils.deserializeObject(reader, CQLQueryResults.class);
        reader.close();
        resultInputStream.close();
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Error deserializing query results (" + fullFilename + "): " + ex.getMessage());
    }
    return results;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:16,代码来源:InvokeDataServiceStep.java

示例4: loadValidationPackage

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static ValidationPackage loadValidationPackage(InputStream validationDescriptionStream) throws Exception {
    // load the validation description
    InputStreamReader descReader = new InputStreamReader(validationDescriptionStream);
    ValidationDescription desc = (ValidationDescription) 
        Utils.deserializeObject(descReader, ValidationDescription.class);
    descReader.close();
    
    return createValidationPackage(desc);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:10,代码来源:GridDeploymentValidationLoader.java

示例5: loadQuery

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private CQLQuery loadQuery(String filename) {
    CQLQuery query = null;
    try {
        FileReader reader = new FileReader(filename);
        query = Utils.deserializeObject(reader, CQLQuery.class);
        reader.close();
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Error deserializing query (" + filename + "): " + ex.getMessage());
    }
    return query;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:13,代码来源:InvokeDataServiceStep.java

示例6: getPolicy

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public DorianPolicy getPolicy() throws InvalidResourcePropertyException, ResourcePropertyRetrievalException {
    if (!policyLoaded) {
        String version = getServiceVersion();
        if (version.equals(VERSION_1_0) || version.equals(VERSION_1_1) || version.equals(VERSION_1_2)
            || version.equals(VERSION_1_3) || version.equals(VERSION_UNKNOWN)) {
            policyLoaded = true;
            return null;
        } else {
            Element resourceProperty = null;
            InputStream wsdd = getClass().getResourceAsStream("client-config.wsdd");
            resourceProperty = ResourcePropertyHelper.getResourceProperty(client.getEndpointReference(), POLICY,
                wsdd);

            try {
                this.policy = (DorianPolicy) Utils.deserializeObject(new StringReader(XmlUtils
                    .toString(resourceProperty)), DorianPolicy.class);
            } catch (Exception e) {
                throw new ResourcePropertyRetrievalException("Unable to deserailize the Dorian Policy: "
                    + e.getMessage(), e);
            }
            policyLoaded = true;
            return this.policy;
        }
    } else {
        return this.policy;
    }
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:28,代码来源:DorianBaseClient.java

示例7: getCoppaStudy

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * from the request object, it extracts a single coppa study. since we are searching with nci id.
 * its assumed it will return a single study.
 * @param iHubDto iHubDto
 * @return StudyProtocol
 * @throws LVException on error
 */
private StudyProtocol getCoppaStudy(IntegrationHubDto iHubDto) throws LVException {
    StudyProtocol studyProtocol = null;
    if (iHubDto.getResponseObj().getResponseStatus().equals(Statuses.FAILURE))   {
        return studyProtocol;
    }

    try {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        MessageElement messageElement = iHubDto.getResponseObj().getTargetResponse()[0].
            getTargetBusinessMessage().get_any()[0];
        List<MessageElement> childElements = messageElement.getChildren();
        if (childElements != null) {
            for (MessageElement childElement : childElements) {
                Element element = childElement.getAsDOM();
                StringWriter writer = new StringWriter();
                transformer.transform(new DOMSource(element), new StreamResult(writer));
                StringReader reader = new StringReader(writer.toString());
                InputStream wsdd =
                    getClass().getResourceAsStream("/gov/nih/nci/coppa/services/pa/client/client-config.wsdd");
                studyProtocol = (StudyProtocol) Utils.deserializeObject(reader, StudyProtocol.class, wsdd);
                // we can break after the reading the first object. its not expeced
                break;
            }
        }
    } catch (Exception e) {
        LOG.error("Exception occured while getting PA study protocols: ", e);
        throw new LVException(e);
    }
    return studyProtocol;
}
 
开发者ID:NCIP,项目名称:labviewer,代码行数:38,代码来源:COPPAHub.java

示例8: deserializeCQLQueryResults

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * Create an instance of CQLQueryResults from the specified input stream, 
 * using the configuration supplied by the WSDD stream. The xml stream
 * must contain an XML representation of the CQLQueryResults. If the reader is
 * null, an IllegalArgumentException will be thrown.
 * 
 * @param xmlStream
 * @param wsddStream
 * @return an instance of CQLQueryResuls from the specified input stream.
 * @throws Exception
 *             on null argument or deserialization failure
 */
public static CQLQueryResults deserializeCQLQueryResults(InputStream xmlStream, InputStream wsddStream) throws Exception {
    if (xmlStream == null) {
        throw new IllegalArgumentException("Null is not a valid argument");
    }
    
    InputStreamReader reader = new InputStreamReader(xmlStream);
    CQLQueryResults results = null;
    if (wsddStream == null) {
        results = Utils.deserializeObject(reader, CQLQueryResults.class);
    } else {
        results = Utils.deserializeObject(reader, CQLQueryResults.class, wsddStream);
    }
    return results;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:27,代码来源:SerializationUtils.java

示例9: loadQueryResults

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private CQLQueryResults loadQueryResults(String filename)  {
    CQLQueryResults results = null;
    try {
        FileReader reader = new FileReader(filename);
        results = Utils.deserializeObject(reader, CQLQueryResults.class);
        reader.close();
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Error deserializing query results (" + filename + "): " + ex.getMessage());
    }
    return results;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:13,代码来源:InvokeDataServiceStep.java

示例10: generateDomainTypesInformation

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void generateDomainTypesInformation(ServiceInformation info) throws Exception {
    ExtensionDataManager manager = getExtensionDataManager(info);
    
    if (!manager.isNoDomainModel()) {
        // get the beans jar
        String beansJarFilename = CommonTools.getServicePropertyValue(
            info.getServiceDescriptor(), SDK4StyleConstants.BEANS_JAR_FILENAME);
        File beansJar = new File(info.getBaseDirectory(), "lib" + File.separator + beansJarFilename);

        // get the domain model
        String domainModelFilename = null;
        ResourcePropertyType[] metadata = info.getServices().getService(0)
        .getResourcePropertiesList().getResourceProperty();
        for (ResourcePropertyType rp : metadata) {
            if (rp.getQName().equals(DataServiceConstants.DOMAIN_MODEL_QNAME)) {
                domainModelFilename = rp.getFileLocation();
                break;
            }
        }

        FileReader reader = new FileReader(new File(info.getBaseDirectory(), "etc" + File.separator + domainModelFilename));
        DomainModel domainModel = (DomainModel) Utils.deserializeObject(reader, DomainModel.class);

        // create the mapper
        BeanTypeDiscoveryMapper mapper = new BeanTypeDiscoveryMapper(beansJar, domainModel);
        mapper.addBeanTypeDiscoveryEventListener(new BeanTypeDiscoveryEventListener() {
            public void typeDiscoveryBegins(BeanTypeDiscoveryEvent e) {
                String message = "Mapping class " + e.getBeanClassname() 
                + " (" + (e.getCurrentBean() + 1) + " of " + e.getTotalBeans() + ")";
                LOG.debug(message);
            }
        });

        // discover types information
        DomainTypesInformation typesInfo = mapper.discoverTypesInformation();

        // serialize the types info
        String applicationName = CommonTools.getServicePropertyValue(info.getServiceDescriptor(),
            DataServiceConstants.QUERY_PROCESSOR_CONFIG_PREFIX + SDK4QueryProcessor.PROPERTY_APPLICATION_NAME);
        File typesInfoFile = new File(info.getBaseDirectory(), 
            "etc" + File.separator + applicationName + "-" + DOMAIN_TYPES_INFO_FILE_SUFFIX);
        FileWriter writer = new FileWriter(typesInfoFile);
        DomainTypesInformationUtil.serializeDomainTypesInformation(typesInfo, writer);
        writer.flush();
        writer.close();
        // set the query processor's config property
        CommonTools.setServiceProperty(info.getServiceDescriptor(),
            DataServiceConstants.QUERY_PROCESSOR_CONFIG_PREFIX 
            + SDK4QueryProcessor.PROPERTY_DOMAIN_TYPES_INFO_FILENAME,
            typesInfoFile.getName(), true);
    } else {
        LOG.warn("NO DOMAIN MODEL SPECIFIED: This will prevent the query processor " +
                "from initializing correctly when the service container is started!!!");
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:56,代码来源:SDK4PreCodegenHelper.java

示例11: loadDomainModelFile

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void loadDomainModelFile(File domainModelFile) throws Exception {
    // get the domain model
    FileReader modelReader = new FileReader(domainModelFile);
    DomainModel model = Utils.deserializeObject(modelReader, DomainModel.class);
    modelReader.close();
    // get extension data
    Data extensionData = getExtensionData();
    ModelInformation info = extensionData.getModelInformation();
    // set cadsr project information
    UMLProjectIdentifer id = new UMLProjectIdentifer();
    id.setIdentifier(model.getProjectShortName());
    id.setVersion(model.getProjectVersion());
    info.setUMLProjectIdentifer(id);
    // walk classes, creating package groupings as needed
    Map<String, List<String>> packageClasses = new HashMap<String, List<String>>();
    UMLClass[] modelClasses = model.getExposedUMLClassCollection().getUMLClass(); 
    for (int i = 0; i < modelClasses.length; i++) {
        String packageName = modelClasses[i].getPackageName();
        List<String> classList = null;
        if (packageClasses.containsKey(packageName)) {
            classList = packageClasses.get(packageName);
        } else {
            classList = new ArrayList<String>();
            packageClasses.put(packageName, classList);
        }
        classList.add(modelClasses[i].getClassName());
    }
    // create model packages
    ModelPackage[] packages = new ModelPackage[packageClasses.keySet().size()];
    String[] packageNames = new String[packages.length];
    int packIndex = 0;
    Iterator<String> packageNameIter = packageClasses.keySet().iterator();
    while (packageNameIter.hasNext()) {
        String packName = packageNameIter.next();
        ModelPackage pack = new ModelPackage();
        pack.setPackageName(packName);
        // create model classes for the package's classes
        List<String> classNameList = packageClasses.get(packName);
        ModelClass[] classes = new ModelClass[classNameList.size()];
        for (int i = 0; i < classNameList.size(); i++) {
            ModelClass clazz = new ModelClass();
            String className = classNameList.get(i);
            clazz.setShortClassName(className);
            clazz.setSelected(true);
            clazz.setTargetable(true);
            classes[i] = clazz;
        }
        pack.setModelClass(classes);
        packages[packIndex] = pack;
        packageNames[packIndex] = pack.getPackageName();
        packIndex++;
    }
    info.setModelPackage(packages);
    extensionData.setModelInformation(info);
    storeExtensionData(extensionData);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:57,代码来源:SDK4StyleConfigurationStep.java

示例12: deserializeDocumentString

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
protected Object deserializeDocumentString(String xmlDocument, Class objectClass) throws Exception {
    return Utils.deserializeObject(new StringReader(xmlDocument), objectClass);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:4,代码来源:CompleteEnumIteratorBaseTest.java

示例13: deserializeCaGridVersion

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static CaGridVersion deserializeCaGridVersion(Reader xmlReader) throws Exception {
    if (xmlReader == null) {
        throw new IllegalArgumentException("Null is not a valid argument");
    }
    return Utils.deserializeObject(xmlReader, CaGridVersion.class);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:7,代码来源:MetadataUtils.java

示例14: deserializeMappings

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static Mappings deserializeMappings(File mappingsFile) throws Exception {
    FileReader reader = new FileReader(mappingsFile);
    Mappings map = Utils.deserializeObject(reader, Mappings.class);
    return map;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:6,代码来源:MappingFileQNameResolver.java

示例15: deserializeXMLSchemaBundle

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * Create an instance of the XMLSchemaBundle from the specified reader. The
 * reader must point to a stream that contains an XML representation of the
 * XMLSchemaBundle. If the reader is null, an IllegalArgumentException will
 * be thrown.
 * 
 * @param xmlReader
 * @return The deserialized XMLSchemaBundle
 * @throws Exception
 */
public static XMLSchemaBundle deserializeXMLSchemaBundle(Reader xmlReader) throws Exception {
    if (xmlReader == null) {
        throw new IllegalArgumentException("Null is not a valid argument");
    }
    return (XMLSchemaBundle) Utils.deserializeObject(xmlReader, XMLSchemaBundle.class,
        GlobalModelExchangeClient.class.getResourceAsStream("client-config.wsdd"));
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:18,代码来源:SerializationUtils.java


注:本文中的gov.nih.nci.cagrid.common.Utils.deserializeObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。