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


Java Utils.serializeDocument方法代码示例

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


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

示例1: callService

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public WorkFlowOutputType callService() throws Exception {
	WorkFlowOutputType output = null;
	try {
		Call call = createCall();
		if (this.workFlowInput.getQuery().getQuery() != null) {
			System.out.println("Query Name: " + 
					this.workFlowInput.getQuery().getQuery().getName());
			QName workFlowInputQName = new QName(RPROT_DATA_NAMESPACE,
			"WorkFlowInputType");
			Utils.serializeDocument("sample.xml", this.workFlowInput, workFlowInputQName);
		output = (WorkFlowOutputType) call
				.invoke(new Object[] { this.workFlowInput });
		} else {
			System.out.println("Query is null");
		}
		return output;
	} catch (Exception e) {
		e.printStackTrace();
	}
	return output;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:22,代码来源:TestClient.java

示例2: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
    // get the service model
    String serviceModelFile = serviceDir + File.separator + IntroduceConstants.INTRODUCE_XML_FILE;
    ServiceDescription desc = null;
    try {
        desc = Utils.deserializeDocument(serviceModelFile, ServiceDescription.class);
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Error loading service description: " + ex.getMessage());
    }
    if (desc == null) {
        throw new NullPointerException("Service description is NULL!");
    }
    
    // blank the query processor service property
    CommonTools.setServiceProperty(desc, QueryProcessorConstants.QUERY_PROCESSOR_CLASS_PROPERTY, "", false);
    
    // serialize the service model back to disk
    Utils.serializeDocument(serviceModelFile, desc, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:21,代码来源:DisableCql1QueryProcessorStep.java

示例3: storeExtensionData

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
protected void storeExtensionData(Data data) throws Exception {
    File serviceModelFile = new File(serviceInfo.getBaseDirectory(), IntroduceConstants.INTRODUCE_XML_FILE);
    ServiceDescription serviceDesc = serviceInfo.getServiceDescriptor();
    
    ExtensionType[] extensions = serviceDesc.getExtensions().getExtension();
    ExtensionType dataExtension = null;
    for (int i = 0; i < extensions.length; i++) {
        if (extensions[i].getName().equals("data")) {
            dataExtension = extensions[i];
            break;
        }
    }
    if (dataExtension.getExtensionData() == null) {
        dataExtension.setExtensionData(new ExtensionTypeExtensionData());
    }
    ExtensionDataUtils.storeExtensionData(dataExtension.getExtensionData(), data);
    Utils.serializeDocument(serviceModelFile.getAbsolutePath(), serviceDesc, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:AbstractStyleConfigurationStep.java

示例4: storeExtensionData

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void storeExtensionData(Data data) throws Throwable {
    File serviceModelFile = new File(serviceInfo.getDir() + File.separator + IntroduceConstants.INTRODUCE_XML_FILE);
    ServiceDescription serviceDesc = getServiceInformation().getServiceDescriptor();
    
    ExtensionType[] extensions = serviceDesc.getExtensions().getExtension();
    ExtensionType dataExtension = null;
    for (int i = 0; i < extensions.length; i++) {
        if (extensions[i].getName().equals("data")) {
            dataExtension = extensions[i];
            break;
        }
    }
    assertNotNull("Data service extension was not found in the service model", dataExtension);
    if (dataExtension.getExtensionData() == null) {
        dataExtension.setExtensionData(new ExtensionTypeExtensionData());
    }
    ExtensionDataUtils.storeExtensionData(dataExtension.getExtensionData(), data);
    Utils.serializeDocument(serviceModelFile.getAbsolutePath(), serviceDesc, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:20,代码来源:CreateDataServiceStep.java

示例5: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
    System.out.println("Running step: " + getClass().getName());
    
    // set the service property for the auditors config file
    ServiceDescription serviceDesc = Utils.deserializeDocument(
        serviceDir + File.separator + IntroduceConstants.INTRODUCE_XML_FILE, 
        ServiceDescription.class);
    CommonTools.setServiceProperty(serviceDesc, 
        DataServiceConstants.DATA_SERVICE_AUDITORS_CONFIG_FILE_PROPERTY, 
        DataServiceConstants.DATA_SERVICE_AUDITORS_CONFIG_FILE_NAME, true);
    Utils.serializeDocument(
        serviceDir + File.separator + IntroduceConstants.INTRODUCE_XML_FILE,
        serviceDesc, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
    
    // configure the data service auditor
    DataServiceAuditors auditorsDescription = new DataServiceAuditors();
    AuditorConfiguration config = new AuditorConfiguration();
    config.setClassName(FileDataServiceAuditor.class.getName());
    config.setInstanceName("testingDataServiceAuditor");
    MonitoredEvents monitoredEvents = new MonitoredEvents(true, true, true, true);
    config.setMonitoredEvents(monitoredEvents);
    ConfigurationProperty outputFileConfigProp = new ConfigurationProperty();
    outputFileConfigProp.setKey(FileDataServiceAuditor.AUDIT_FILE);
    outputFileConfigProp.setValue(auditorLogFile);
    ConfigurationProperty printResultsConfigProp = new ConfigurationProperty();
    printResultsConfigProp.setKey(FileDataServiceAuditor.PRINT_FULL_RESULTS);
    printResultsConfigProp.setValue(FileDataServiceAuditor.DEFAULT_PRINT_FULL_RESULTS);
    AuditorConfigurationConfigurationProperties configProps = 
        new AuditorConfigurationConfigurationProperties(
            new ConfigurationProperty[] {outputFileConfigProp, printResultsConfigProp});
    config.setConfigurationProperties(configProps);
    auditorsDescription.setAuditorConfiguration(new AuditorConfiguration[] {config});
    
    // serialize the data service auditors config
    String configFilename = serviceDir + File.separator + "etc" 
        + File.separator + DataServiceConstants.DATA_SERVICE_AUDITORS_CONFIG_FILE_NAME;
    Utils.serializeDocument(configFilename, auditorsDescription, 
        DataServiceConstants.DATA_SERVICE_AUDITORS_QNAME);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:40,代码来源:AddFileSystemAuditorStep.java

示例6: 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

示例7: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
    System.out.println("Adding an factory method for " + factorytci.getName() + " generating " + ctci.getName());

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

    MethodType method = new MethodType();
    method.setName(this.factoryMethodName);
    MethodTypeOutput output = new MethodTypeOutput();
    output.setIsClientHandle(true);
    output.setIsCreatingResourceForClientHandle(true);
    output.setClientHandleClass(ctci.getPackageName()+".client." + ctci.getName() + "Client");
    output.setResourceClientIntroduceServiceName(ctci.getName());
    output.setQName(new QName(ctci.getNamespace()+ "/types",ctci.getName() + "Reference"));
    method.setOutput(output);

    MethodTypeInputs inputs = new MethodTypeInputs();
    method.setInputs(inputs);

    CommonTools.addMethod(CommonTools.getService(introService.getServices(), factorytci.getName()), method);
    
    Utils.serializeDocument(getBaseDir() + File.separator + factorytci.getDir() + File.separator + "introduce.xml",
        introService, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
    
    try {
        SyncTools sync = new SyncTools(new File(getBaseDir() + File.separator + factorytci.getDir()));
        sync.sync();
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }

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

示例8: addReport

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public File addReport(SyncReport report) throws Exception {
	File r = getFile(report.getTimestamp());
	Utils.serializeDocument(r.getAbsolutePath(), report, REPORTS_QN);
	return r;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:6,代码来源:HistoryManager.java

示例9: runStep

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

	ServiceDescription introService = (ServiceDescription) Utils.deserializeDocument(getBaseDir() + File.separator
		+ tci.getDir() + File.separator + "introduce.xml", ServiceDescription.class);
	ServiceProperties props = introService.getServiceProperties();
	if (props == null) {
		props = new ServiceProperties();
		introService.setServiceProperties(props);
	}

	ServicePropertiesProperty newProperty1 = new ServicePropertiesProperty();
	newProperty1.setKey("foo");
	newProperty1.setValue("bar");

	ServicePropertiesProperty newProperty2 = new ServicePropertiesProperty();
	newProperty2.setKey("bar");
	newProperty2.setValue("barValue");

	// add new method to array in bean
	// this seems to be a wierd way be adding things....
	ServicePropertiesProperty[] propertyTypeArr;
	int newLength = 0;
	if (props.getProperty() != null) {
		newLength = props.getProperty().length + 2;
		propertyTypeArr = new ServicePropertiesProperty[newLength];
		System.arraycopy(props.getProperty(), 0, propertyTypeArr, 0, props.getProperty().length);
	} else {
		newLength = 2;
		propertyTypeArr = new ServicePropertiesProperty[newLength];
	}
	propertyTypeArr[newLength - 2] = newProperty1;
	propertyTypeArr[newLength - 1] = newProperty2;
	props.setProperty(propertyTypeArr);

	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,代码行数:49,代码来源:AddServicePropertiesStep.java

示例10: postSkeletonCreation

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void postSkeletonCreation() throws Throwable {
    // verify the service model exists
    LOG.debug("Verifying the service model file exists");
    File serviceModelFile = new File(serviceInfo.getDir() + File.separator + IntroduceConstants.INTRODUCE_XML_FILE);
    assertTrue("Service model file does not exist: " + serviceModelFile.getAbsolutePath(), serviceModelFile.exists());
    assertTrue("Service model file cannot be read: " + serviceModelFile.getAbsolutePath(), serviceModelFile.canRead());
    
    // deserialize the service model
    LOG.debug("Deserializing service description from introduce.xml");
    ServiceDescription serviceDesc = Utils.deserializeDocument(
        serviceModelFile.getAbsolutePath(), ServiceDescription.class);      
    
    // verify the data extension is in there
    assertTrue("Service description has no extensions", 
        serviceDesc.getExtensions() != null 
        && serviceDesc.getExtensions().getExtension() != null
        && serviceDesc.getExtensions().getExtension().length != 0);
    ExtensionType[] extensions = serviceDesc.getExtensions().getExtension();
    ExtensionType dataExtension = null;
    for (int i = 0; i < extensions.length; i++) {
        if (extensions[i].getName().equals("data")) {
            dataExtension = extensions[i];
            break;
        }
    }
    assertNotNull("Data service extension not found", dataExtension);
    ExtensionTypeExtensionData extData = new ExtensionTypeExtensionData();
    dataExtension.setExtensionData(extData);
    
    // enable the ws-enumeration support feature
    LOG.debug("Setting ws-enumeration feature enabled");
    Data data = ExtensionDataUtils.getExtensionData(extData);
    ServiceFeatures features = data.getServiceFeatures();
    if (features == null) {
        features = new ServiceFeatures();
        data.setServiceFeatures(features);
    }
    features.setUseWsEnumeration(true);
    ExtensionDataUtils.storeExtensionData(extData, data);
    
    // serialize the edited model to disk
    LOG.debug("Serializing service model to disk");
    Utils.serializeDocument(serviceInfo.getDir() + File.separator + IntroduceConstants.INTRODUCE_XML_FILE,
        serviceDesc, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:46,代码来源:CreateEnumerationDataServiceStep.java

示例11: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
    String serviceModelFile = serviceDir + File.separator + IntroduceConstants.INTRODUCE_XML_FILE;
    ServiceDescription desc = null;
    try {
        desc = Utils.deserializeDocument(serviceModelFile, ServiceDescription.class);
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Error loading service description: " + ex.getMessage());
    }
    if (desc == null) {
        throw new NullPointerException("Service description is NULL!");
    }
    // find the data service extension
    ExtensionType[] extensions = desc.getExtensions().getExtension();
    ExtensionType dataExtension = null;
    for (int i = 0; i < extensions.length; i++) {
        if (extensions[i].getName().equals("data")) {
            dataExtension = extensions[i];
            break;
        }
    }
    if (dataExtension == null) {
        fail("Data service extension not found in service description");
    }

    // set service properties for the testing CQL Query Processor
    TestingCQLQueryProcessor testProc = new TestingCQLQueryProcessor();
    Properties testProperties = testProc.getRequiredParameters();
    // remove all current props for cql query processors
    ServicePropertiesProperty[] currentProperties = desc.getServiceProperties().getProperty();
    List<ServicePropertiesProperty> retainedPropereties = 
        new ArrayList<ServicePropertiesProperty>();
    for (int i = 0; i < currentProperties.length; i++) {
        if (!currentProperties[i].getKey().startsWith(DataServiceConstants.QUERY_PROCESSOR_CONFIG_PREFIX)) {
            retainedPropereties.add(currentProperties[i]);
        }
    }
    // create properties for the test QP's properties
    Enumeration<?> testPropKeys = testProperties.keys();
    while (testPropKeys.hasMoreElements()) {
        String key = (String) testPropKeys.nextElement();
        String prefixedKey = DataServiceConstants.QUERY_PROCESSOR_CONFIG_PREFIX + key;
        String defaultValue = testProperties.getProperty(key);
        String changedValue = defaultValue + "_CHANGED";
        ServicePropertiesProperty testProp = new ServicePropertiesProperty("", Boolean.FALSE, prefixedKey,
            changedValue);
        retainedPropereties.add(testProp);
    }

    // set the new properties in the service description
    ServicePropertiesProperty[] properties = new ServicePropertiesProperty[retainedPropereties.size()];
    retainedPropereties.toArray(properties);
    desc.getServiceProperties().setProperty(properties);

    // set the service property for the new query processor
    CommonTools.setServiceProperty(desc, DataServiceConstants.QUERY_PROCESSOR_CLASS_PROPERTY,
        TestingCQLQueryProcessor.class.getName(), false);
    // serialize the service model back to disk
    Utils.serializeDocument(serviceModelFile, desc, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:61,代码来源:SetQueryProcessorStep.java

示例12: runStep

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public void runStep() throws Throwable {
	System.out.println("Adding a simple 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();
	if(methodsType==null){
		methodsType = new MethodsType();
		CommonTools.getService(introService.getServices(),tci.getName()).setMethods(methodsType);
	}
	
	MethodType method = new MethodType();
	method.setName(this.methodName);
	MethodTypeOutput output = new MethodTypeOutput();
	output.setQName(new QName("http://www.w3.org/2001/XMLSchema", "boolean"));
	method.setOutput(output);

	// create a new input param
	MethodTypeInputsInput input1 = new MethodTypeInputsInput();
	input1.setQName(new QName("http://www.w3.org/2001/XMLSchema", "string"));
	input1.setName("foo");
	input1.setIsArray(false);
	// create a new input param
	MethodTypeInputsInput input2 = new MethodTypeInputsInput();
	input2.setQName(new QName("http://www.w3.org/2001/XMLSchema", "integer"));
	input2.setName("bar");
	input2.setIsArray(false);
	MethodTypeInputsInput[] newInputs = new MethodTypeInputsInput[2];
	newInputs[0] = input1;
	newInputs[1] = input2;
	MethodTypeInputs inputs = new MethodTypeInputs();
	inputs.setInput(newInputs);
	method.setInputs(inputs);

	// add new method to array in bean
	// this seems to be a wierd way be adding things....
	MethodType[] newMethods;
	int newLength = 0;
	if (methodsType.getMethod() != null) {
		newLength = methodsType.getMethod().length + 1;
		newMethods = new MethodType[newLength];
		System.arraycopy(methodsType.getMethod(), 0, newMethods, 0, methodsType.getMethod().length);
	} else {
		newLength = 1;
		newMethods = new MethodType[newLength];
	}
	newMethods[newLength - 1] = method;
	methodsType.setMethod(newMethods);

	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,代码行数:68,代码来源:AddSimpleMethodWithReturnStep.java

示例13: runStep

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

    ServiceDescription introService = Utils.deserializeDocument(getBaseDir() + File.separator
        + tci.getDir() + File.separator + "introduce.xml", ServiceDescription.class);
    
    MethodType method = new MethodType();
    method.setName("createStreamingTransferMethodStep");
    MethodTypeOutput output = new MethodTypeOutput();
    output.setQName(new QName("http://transfer.cagrid.org/TransferService/Context/types",
        "TransferServiceContextReference"));
    method.setOutput(output);
    MethodTypeInputs inputs = new MethodTypeInputs();
    method.setInputs(inputs);

    if (container.getProperties().isSecure()) {
        MethodSecurity msec = new MethodSecurity();
        msec.setSecuritySetting(SecuritySetting.Custom);
        TransportLevelSecurity security = new TransportLevelSecurity();
        security.setCommunicationMethod(CommunicationMethod.Privacy);
        msec.setAnonymousClients(AnonymousCommunication.No);
        msec.setTransportLevelSecurity(security);

        method.setMethodSecurity(msec);
    }

    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, "createStreamingTransferMethodStep"));

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

示例14: runStep

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

    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("anonPrefered");
    MethodTypeOutput output = new MethodTypeOutput();
    output.setQName(new QName(IntroduceConstants.W3CNAMESPACE, "string"));
    method.setOutput(output);
    MethodSecurity security = new MethodSecurity();
    security.setSecuritySetting(SecuritySetting.Custom);
    TransportLevelSecurity sec = new TransportLevelSecurity(CommunicationMethod.Privacy);
    security.setTransportLevelSecurity(sec);
    security.setAnonymousClients(AnonymousCommunication.Yes);
    method.setMethodSecurity(security);

    CommonTools.addMethod(CommonTools.getService(introService.getServices(), tci.getName()), method);

    MethodType method2 = new MethodType();
    method2.setName("anonNotPrefered");
    MethodTypeOutput output2 = new MethodTypeOutput();
    output2.setQName(new QName(IntroduceConstants.W3CNAMESPACE, "string"));
    method2.setOutput(output2);
    MethodSecurity security2 = new MethodSecurity();
    security2.setSecuritySetting(SecuritySetting.Custom);
    TransportLevelSecurity sec2 = new TransportLevelSecurity(CommunicationMethod.Privacy);
    security2.setTransportLevelSecurity(sec);
    security2.setAnonymousClients(AnonymousCommunication.No);
    method2.setMethodSecurity(security2);

    CommonTools.addMethod(CommonTools.getService(introService.getServices(), tci.getName()), method2);

    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, "anonPrefered"));
    assertTrue(StepTools.methodExists(serviceInterface, "anonNotPrefered"));

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

示例15: runStep

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


	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(methodName);

	// set the output
	MethodTypeOutput output = new MethodTypeOutput();
	output.setQName(new QName("gme://projectmobius.org/1/BookStore","Book"));
	output.setIsArray(true);

	// set some parameters
	MethodTypeInputs inputs = new MethodTypeInputs();
	MethodTypeInputsInput[] inputsArray = new MethodTypeInputsInput[1];
	MethodTypeInputsInput input = new MethodTypeInputsInput();
	input.setName("inputOne");
	input.setIsArray(true);
	input.setQName(new QName("gme://projectmobius.org/1/BookStore","Book"));
	input.setIsArray(true);
	inputsArray[0] = input;
	inputs.setInput(inputsArray);
	method.setInputs(inputs);

	// set a fault
	MethodTypeExceptionsException[] exceptionsArray = new MethodTypeExceptionsException[2];
	MethodTypeExceptionsException exception1 = new MethodTypeExceptionsException();
	exception1.setName("testFault1");
	MethodTypeExceptionsException exception2 = new MethodTypeExceptionsException();
	exception2.setName("testFault2");
	exceptionsArray[0] = exception1;
	exceptionsArray[1] = exception2;
	MethodTypeExceptions exceptions = new MethodTypeExceptions();
	exceptions.setException(exceptionsArray);
	method.setExceptions(exceptions);
	method.setOutput(output);

	// add new method to array in bean
	// this seems to be a wierd way be adding things....
	MethodType[] newMethods;
	int newLength = 0;
	if (methodsType.getMethod() != null) {
		newLength = methodsType.getMethod().length + 1;
		newMethods = new MethodType[newLength];
		System.arraycopy(methodsType.getMethod(), 0, newMethods, 0, methodsType.getMethod().length);
	} else {
		newLength = 1;
		newMethods = new MethodType[newLength];
	}
	newMethods[newLength - 1] = method;
	methodsType.setMethod(newMethods);

	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 + File.separator + "common" + File.separator + tci.getName() + "I.java";
	assertTrue(StepTools.methodExists(serviceInterface, methodName));

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


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