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


Java Utils.deserializeDocument方法代码示例

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


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

示例1: main

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static void main(String[] args) {
    try {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        ExtensionDescription ext = (ExtensionDescription) Utils.deserializeDocument("extensions" + File.separator
            + "gme-discovery" + File.separator + "extension.xml", ExtensionDescription.class);
        final GMEViewer panel = new GMEViewer(ext.getDiscoveryExtensionDescription());
        frame.getContentPane().setLayout(new BorderLayout());
        frame.getContentPane().add(panel, BorderLayout.CENTER);

        frame.pack();
        frame.setVisible(true);
    } catch (Exception e) {
        e.printStackTrace();
        logger.error(e);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:GMEViewer.java

示例2: main

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static void main(String[] args) {
    if (args.length != 2) {
        usage();
    }
    String url = args[0];
    String file = args[1];
    
    System.out.println("Querying service " + url);
    System.out.println("Using query file " + file);
    
    try {
        DataServiceClient client = new DataServiceClient(url);
        
        CQLQuery query = (CQLQuery) Utils.deserializeDocument(file, CQLQuery.class);
        
        CQLQueryResults results = client.query(query);
        Iterator i = new CQLQueryResultsIterator(results, true);
        while (i.hasNext()) {
            System.out.println(i.next());
        }
        System.out.println("Query Complete");
    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(1);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:27,代码来源:DataServiceInvoker.java

示例3: synchronizeOnce

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static boolean synchronizeOnce(String syncDescriptionFile)
{

	boolean success = false;
	try
	{
		// Load Sync Description
		String pathToSyncDescription = syncDescriptionFile;
		SyncDescription description = (SyncDescription) Utils
				.deserializeDocument(pathToSyncDescription,
						SyncDescription.class);

		// Sync with the Trust Fabric Once
		SyncGTS.getInstance().syncOnce(description);
		success = true;
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}

	return success;
}
 
开发者ID:NCIP,项目名称:gsid,代码行数:24,代码来源:GridAuthenticationClient.java

示例4: synchronizePeriodic

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private static boolean synchronizePeriodic(String syncDescriptionFile)
{
	boolean success = false;
	try
	{
		// Load Sync Description
		String pathToSyncDescription = syncDescriptionFile; // "conf/training/sync-description.xml";
		SyncDescription description = (SyncDescription) Utils
				.deserializeDocument(pathToSyncDescription,
						SyncDescription.class);

		// Sync with the Trust Fabric Once
		SyncGTS.getInstance().syncAndResync(description, success);
		success = true;
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}

	return success;
}
 
开发者ID:NCIP,项目名称:gsid,代码行数:23,代码来源:GridAuthenticationClient.java

示例5: testSyncGTS

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static void testSyncGTS(){
	try
	{
		
		if ("yes".equalsIgnoreCase(getSTartAutoSyncGTS()))
		{
			String pathToSyncDescription = FileHelper.getFileAsURL("sync-description.xml").getPath();
			
			//Load Sync Description
			SyncDescription description = (SyncDescription) Utils.deserializeDocument(pathToSyncDescription,SyncDescription.class);

			// Sync with the Trust Fabric Once
			SyncGTS.getInstance().syncAndResyncInBackground(description, false);
		}
	}
	catch (Exception e) 
	{
		e.printStackTrace();
		
	}
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:22,代码来源:CGMMTest.java

示例6: ServiceSecurityImpl

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public ServiceSecurityImpl() throws RemoteException {
	try {
		EndpointReferenceType type = AddressingUtils.createEndpointReference(null);
		String configFileEnd = (String) MessageContext.getCurrentContext().getProperty("securityMetadata");
		String configFile = ContainerConfig.getBaseDirectory() + File.separator + configFileEnd;
		File f = new File(configFile);
		if (!f.exists()) {
			throw new RemoteException("The security metadata file (" + configFile + ") could not be found!!!");
		}
		metadata = (ServiceSecurityMetadata) Utils.deserializeDocument(configFile, ServiceSecurityMetadata.class);

	} catch (Exception e) {
		FaultHelper.printStackTrace(e);
		throw new RemoteException(Utils.getExceptionMessage(e));
	}
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:17,代码来源:ServiceSecurityImpl.java

示例7: getServiceExtensions

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private String getServiceExtensions() throws Exception {
    ServiceDescription description = Utils.deserializeDocument(
        serviceInfo.getDir() + File.separator + IntroduceConstants.INTRODUCE_XML_FILE,
        ServiceDescription.class);
    String ext = "";
    if (description.getExtensions() != null 
        && description.getExtensions().getExtension() != null) {
        ExtensionType[] extensions = description.getExtensions().getExtension();
        for (int i = 0; i < extensions.length; i++) {
            ext += extensions[i].getName();
            if (i + 1 < extensions.length) {
                ext += ",";
            }
        }
    }
    return ext;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:18,代码来源:ResyncAndBuildStep.java

示例8: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
	System.out.println("Adding a bookstore schema");

	// copy over the bookstore schema to be used with the test
	File schemaFile = new File(Utils.decodeUrl(this.getClass().getResource("/schema/bookstore.xsd")));
	Utils.copyFile(schemaFile, new File(getBaseDir() + File.separator + tci.getDir() + File.separator + "schema"
		+ File.separator + tci.getName() + File.separator + "bookstore.xsd"));

	ServiceDescription introService = (ServiceDescription) Utils.deserializeDocument(getBaseDir() + File.separator
		+ tci.getDir() + File.separator + "introduce.xml", ServiceDescription.class);
	

	NamespaceType type = new NamespaceType();
	type.setLocation("." + File.separator + "bookstore.xsd");
	type.setNamespace("gme://projectmobius.org/1/BookStore");
	type.setPackageName("projectmobius.org");
	SchemaElementType etype = new SchemaElementType();
	etype.setType("Book");
	SchemaElementType[] etypeArr = new SchemaElementType[1];
	etypeArr[0] = etype;
	type.setSchemaElement(etypeArr);
	
	CommonTools.addNamespace(introService, type);
	

	Utils.serializeDocument(getBaseDir() + File.separator + tci.getDir() + File.separator + "introduce.xml",
		introService, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
	
	
	try {
		SyncTools sync = new SyncTools(new File(getBaseDir() + File.separator + tci.getDir()));
		sync.sync();
	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
	
	buildStep();

}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:41,代码来源:AddBookstoreSchemaStep.java

示例9: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
    System.out.println("Adding method wich returns client handle with array");

    ServiceDescription introService = (ServiceDescription) Utils.deserializeDocument(getBaseDir() + File.separator
        + tci.getDir() + File.separator + "introduce.xml", ServiceDescription.class);

    MethodType method = new MethodType();
    method.setName(methodName);
    MethodTypeOutput output = new MethodTypeOutput();
    output.setIsArray(this.isArray);
    output.setClientHandleClass(contextTCI.getPackageName() + ".client." + contextTCI.getName() + "Client");
    output.setQName(new QName(contextTCI.getNamespace() + "/types", contextTCI.getName() + "Reference"));
    output.setIsClientHandle(new Boolean(true));
    method.setOutput(output);

    CommonTools.addMethod(introService.getServices().getService(0), method);

    Utils.serializeDocument(getBaseDir() + File.separator + tci.getDir() + File.separator + "introduce.xml",
        introService, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
    
    try {
        SyncTools sync = new SyncTools(new File(getBaseDir() + File.separator + tci.getDir()));
        sync.sync();
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
  

    // look at the interface to make sure method exists.......
    String serviceInterface = getBaseDir() + File.separator + tci.getDir() + File.separator + "src"
        + File.separator + tci.getPackageDir() + File.separator + "common" + File.separator + tci.getName()
        + "I.java";
    assertTrue(StepTools.methodExists(serviceInterface, methodName));

    buildStep();
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:38,代码来源:AddMethodReturningClientHandleMethodStep.java

示例10: getResultsCount

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private int getResultsCount(String dcqlResultsFilename) {
    DCQLQueryResultsCollection results = null;
    try {
        results = Utils.deserializeDocument(
            dcqlResultsFilename, DCQLQueryResultsCollection.class);
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Error deserializing DCQL gold query results: " + ex.getMessage());
    }
    int count = 0;
    for (DCQLResult result : results.getDCQLResult()) {
        count += result.getCQLQueryResultCollection().getObjectResult().length;
    }
    return count;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:16,代码来源:PartialResultsStory.java

示例11: main

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static void main(String[] args) {
	try {
		ServiceMetadata metadata = (ServiceMetadata) Utils.deserializeDocument("serviceMetadata.xml",
			ServiceMetadata.class);
		System.out.println("Success loading file for service:"
			+ metadata.getServiceDescription().getService().getName());
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:11,代码来源:DeserializationExample.java

示例12: ConfigurationUtil

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private ConfigurationUtil() throws Exception {
    if (GridApplication.getContext() != null) {
        configurationManager = GridApplication.getContext().getConfigurationManager();
    } else {
        Application app = null;
        app = Utils.deserializeDocument(IntroducePropertiesManager.getIntroduceConfigurationFile(),
            Application.class);
        configurationManager = new ConfigurationManager(app.getConfiguration(), null);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:11,代码来源:ConfigurationUtil.java

示例13: getAvailableStyles

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * Gets a list of available Data Service styles.  Styles present in the styles directory which
 * do not explicitly match the current Introduce version as compatible may optionally be returned
 * by setting the <i>includeIncompatibleVersions</i> parameter to 'true'
 * 
 * @param includeIncompatibleVersions
 *      If 'true', Styles which may not be compatible with the current Introduce version are not returned.
 * @return
 * @throws Exception
 */
public static List<ServiceStyleContainer> getAvailableStyles(boolean includeIncompatibleVersions) throws Exception {
    // get the current Introduce version
    String introduceVersion = IntroducePropertiesManager.getIntroduceVersion();
    
    // list to store style descriptions
    List<ServiceStyleContainer> styles = new ArrayList<ServiceStyleContainer>();
    
    // locate the styles directory
    File extensionsDir = ExtensionsLoader.getInstance().getExtensionsDir();
    File stylesDir = new File(extensionsDir.getAbsolutePath() + File.separator 
        + "data" + File.separator + DataServiceConstants.SERVICE_STYLES_DIR_NAME);
    
    if (stylesDir.exists() && stylesDir.isDirectory()) {
        // load the styles
        File[] styleDirs = stylesDir.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
                return pathname.isDirectory();
            }
        });
        for (File styleDir : styleDirs) {
            File styleXmlFile = new File(styleDir.getAbsolutePath() 
                + File.separator + DataServiceConstants.SERVICE_STYLE_FILE_NAME);
            DataServiceStyle style = Utils.deserializeDocument(
                styleXmlFile.getAbsolutePath(), DataServiceStyle.class);
            boolean okToAdd = true;
            if (!includeIncompatibleVersions) {
                // check for compatibility
                okToAdd = false;
                if (style.getCompatibleCaGridVersions() != null && 
                    style.getCompatibleCaGridVersions().getVersion() != null) {
                    for (CompatibleCaGridVersionsVersion version : style.getCompatibleCaGridVersions().getVersion()) {
                        if (introduceVersion.equals(version.get_value())) {
                            okToAdd = true;
                            break;
                        }
                    }
                }
            }
            if (okToAdd) {
                ServiceStyleContainer container = new ServiceStyleContainer(style, styleDir);
                styles.add(container);
            }
        }
    }
    return styles;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:57,代码来源:ServiceStyleLoader.java

示例14: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
	System.out.println("Adding a setBook method.");

	ServiceDescription introService = (ServiceDescription) Utils.deserializeDocument(getBaseDir() + File.separator
		+ tci.getDir() + File.separator + "introduce.xml", ServiceDescription.class);
	MethodsType methodsType = CommonTools.getService(introService.getServices(),tci.getName()).getMethods();

	MethodType method = new MethodType();
	method.setName("setBook");
	MethodTypeOutput output = new MethodTypeOutput();
	output.setQName(new QName("","void"));
	method.setOutput(output);

	// create a new input param
	MethodTypeInputsInput input = new MethodTypeInputsInput();
	input.setQName(new QName("gme://projectmobius.org/1/BookStore", "Book"));
	input.setName("book");
	input.setIsArray(false);
	MethodTypeInputsInput[] newInputs = new MethodTypeInputsInput[1];
	newInputs[0] = input;
	MethodTypeInputs inputs = new MethodTypeInputs();
	inputs.setInput(newInputs);
	method.setInputs(inputs);
	
	CommonTools.addMethod(CommonTools.getService(introService.getServices(), tci.getName()), method);

	Utils.serializeDocument(getBaseDir() + File.separator + tci.getDir() + File.separator + "introduce.xml",
		introService, IntroduceConstants.INTRODUCE_SKELETON_QNAME);

	try {
		SyncTools sync = new SyncTools(new File(getBaseDir() + File.separator + tci.getDir()));
		sync.sync();
	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
	
	// look at the interface to make sure method exists.......
	String serviceInterface = getBaseDir() + File.separator + tci.getDir() + File.separator + "src" + File.separator
		+ tci.getPackageDir() + File.separator + "common" + File.separator + tci.getName() + "I.java";
	assertTrue(StepTools.methodExists(serviceInterface, "setBook"));

	buildStep();
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:45,代码来源:AddSetBookMethodStep.java

示例15: main

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    try {
        FederatedQueryProcessorClient fqpClient = new FederatedQueryProcessorClient("http://localhost:8080/wsrf/services/cagrid/FederatedQueryProcessor");
        DCQLQuery query = Utils.deserializeDocument("exampleDistributedJoin1.xml", DCQLQuery.class);
        
        final FederatedQueryResultsClient resultsClient = fqpClient.query(query, null, null);
        System.out.print("Waiting for query to complete");
        while (!resultsClient.isProcessingComplete()) {
            Thread.sleep(200);
            System.out.print(".");
        }
        System.out.println();
        System.out.println("Done, using transfer to retrieve results");
        
        TransferServiceContextReference transferReference = resultsClient.transfer();
        
        System.out.println("Got transfer reference: " + transferReference.getEndpointReference().toString());
        
        TransferServiceContextClient transferClient = new TransferServiceContextClient(transferReference.getEndpointReference());
        
        System.out.println("Getting transfer descriptor");
        DataTransferDescriptor transferDescriptor = transferClient.getDataTransferDescriptor();
        
        System.out.println("Transfering data");
        InputStream dataStream = TransferClientHelper.getData(transferDescriptor);
        StringWriter textWriter = new StringWriter();
        InputStreamReader streamReader = new InputStreamReader(dataStream);
        char[] buffer = new char[1024];
        int charsRead = -1;
        while ((charsRead = streamReader.read(buffer)) != -1) {
            textWriter.write(buffer, 0, charsRead);
        }
        
        streamReader.close();
        dataStream.close();
        
        String xml = textWriter.getBuffer().toString();
        System.out.println("Got data from transfer context:");
        System.out.println(xml);
        
        StringReader xmlReader = new StringReader(xml);
        DCQLQueryResultsCollection results = null;
        results = Utils.deserializeObject(xmlReader, DCQLQueryResultsCollection.class);
        System.out.println("Done, got DCQL results!");
        
        StringWriter writer = new StringWriter();
        Utils.serializeObject(results, DCQLConstants.DCQL_QUERY_QNAME, writer);
    } catch (Throwable ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:55,代码来源:QueryWithTransfer.java


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