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


Java ServiceMetadata类代码示例

本文整理汇总了Java中gov.nih.nci.cagrid.metadata.ServiceMetadata的典型用法代码示例。如果您正苦于以下问题:Java ServiceMetadata类的具体用法?Java ServiceMetadata怎么用?Java ServiceMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addServiceMetadata

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
private void addServiceMetadata(ServiceDescription desc) {
    ResourcePropertyType serviceMetadata = new ResourcePropertyType();
    serviceMetadata.setPopulateFromFile(true);
    serviceMetadata.setRegister(true);
    serviceMetadata.setQName(MetadataConstants.SERVICE_METADATA_QNAME);
    ServiceMetadata smd = new ServiceMetadata();
    ServiceMetadataServiceDescription des = new ServiceMetadataServiceDescription();
    Service service = new Service();
    des.setService(service);
    smd.setServiceDescription(des);
    ResourcePropertiesListType propsList = desc.getServices().getService()[0].getResourcePropertiesList();
    if (propsList == null) {
        propsList = new ResourcePropertiesListType();
        desc.getServices().getService()[0].setResourcePropertiesList(propsList);
    }
    ResourcePropertyType[] metadataArray = propsList.getResourceProperty();
    if (metadataArray == null || metadataArray.length == 0) {
        metadataArray = new ResourcePropertyType[]{serviceMetadata};
    } else {
        ResourcePropertyType[] tmpArray = new ResourcePropertyType[metadataArray.length + 1];
        System.arraycopy(metadataArray, 0, tmpArray, 0, metadataArray.length);
        tmpArray[metadataArray.length] = serviceMetadata;
        metadataArray = tmpArray;
    }
    propsList.setResourceProperty(metadataArray);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:27,代码来源:ServiceMetadataCreationPostProcessor.java

示例2: getExistingServiceMetdata

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
public ServiceMetadata getExistingServiceMetdata() {
    if (!shouldCreateMetadata()) {
        return null;
    }

    ServiceMetadata metadata = null;
    // look if the file already exists, and load it in, in case other
    // aspects of it (such as cancer center info) are set by something else
    File mdFile = getMetadataAbsoluteFile();
    if (mdFile.exists() && mdFile.canRead()) {
        try {
            FileReader reader = new FileReader(mdFile);
            metadata = MetadataUtils.deserializeServiceMetadata(reader);
            reader.close();
        } catch (Exception e) {
            LOG.error("Failed to deserialize existing metadata document!  A new one will be created.", e);
        }
    }
    return metadata;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:21,代码来源:MetadataExtensionHelper.java

示例3: getServiceMetadata

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的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

示例4: getServiceVersion

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
/**
 * This method returns the version of the Grid Service
 * 
 * @return The version of the grid service.
 * @throws InvalidResourcePropertyException
 * @throws ResourcePropertyRetrievalException
 */

public String getServiceVersion() throws InvalidResourcePropertyException, ResourcePropertyRetrievalException {
    ServiceMetadata sm = getServiceMetadata();
    if (sm == null) {
        return VERSION_UNKNOWN;
    } else {
        if (sm.getServiceDescription() != null) {
            if (sm.getServiceDescription().getService() != null) {
                if (sm.getServiceDescription().getService().getVersion() != null) {
                    return sm.getServiceDescription().getService().getVersion();
                } else {
                    return VERSION_UNKNOWN;
                }
            } else {
                return VERSION_UNKNOWN;
            }
        } else {
            return VERSION_UNKNOWN;
        }

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

示例5: annotateServiceMetadata

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
public ServiceMetadata annotateServiceMetadata(ServiceMetadata serviceMetadata,
    Map<URI, UMLProjectIdentifer> namespaceToProjectMappings) throws MMSGeneralException,
    InvalidUMLProjectIndentifier {

    Map<String, QualifiedProject> uriToProjectMap = new HashMap<String, QualifiedProject>();
    if (namespaceToProjectMappings != null) {
        for (URI namespace : namespaceToProjectMappings.keySet()) {
            UMLProjectIdentifer projId = namespaceToProjectMappings.get(namespace);
            QualifiedProject proj = new QualifiedProject(getApplicationServiceForUMLProjectIdentifier(projId),
                createProjectPrototypeFromIdentifier(projId));
            uriToProjectMap.put(namespace.toString(), proj);
        }
    }

    ServiceMetadataAnnotator annotator = new ServiceMetadataAnnotator(uriToProjectMap,
        getApplicationService(getModelSourceMetadata().getDefaultSourceIdentifier()));

    try {
        annotator.annotateServiceMetadata(serviceMetadata);
    } catch (CaDSRGeneralException e) {
        throw new MMSGeneralException("Problem from remote caDSR:" + e.getMessage(), e);
    }
    return serviceMetadata;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:CaDSRMMSImpl.java

示例6: annotateServiceMetadata

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
/**
 * Add caDSR information to model.
 * 
 * @param metadata
 * @throws CaDSRGeneralException
 */
public void annotateServiceMetadata(ServiceMetadata metadata) throws CaDSRGeneralException {
    if (metadata == null || metadata.getServiceDescription() == null
        || metadata.getServiceDescription().getService() == null) {
        return;
    }

    Service service = metadata.getServiceDescription().getService();

    // TODO: how to set caDSR registration?
    CaDSRRegistration caDSRRegistration = service.getCaDSRRegistration();

    // TODO: set/edit service semantic metadata once service's are
    // registered in caDSR
    SemanticMetadata[] semanticMetadatas = service.getSemanticMetadata();

    if (service.getServiceContextCollection() == null
        || service.getServiceContextCollection().getServiceContext() == null) {
        return;
    }
    ServiceContext[] serviceContexts = service.getServiceContextCollection().getServiceContext();
    for (int i = 0; i < serviceContexts.length; i++) {
        annotateServiceContext(serviceContexts[i]);
    }

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

示例7: main

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        JFrame f = new JFrame();
        f.setVisible(true);

        JFileChooser fc = new JFileChooser(".");
        fc.showOpenDialog(f);

        File selectedFile = fc.getSelectedFile();
        ServiceMetadata model = MetadataUtils.deserializeServiceMetadata(new FileReader(selectedFile));
        ApplicationService appService = ApplicationServiceProvider
            .getApplicationServiceFromUrl("http://cadsrapi-prod2.nci.nih.gov/cadsrapi40/");
        ServiceMetadataAnnotator anno = new ServiceMetadataAnnotator(null, appService);
        anno.annotateServiceMetadata(model);

        File result = new File(".", selectedFile.getName() + "_annotated");
        MetadataUtils.serializeServiceMetadata(model, new FileWriter(result));
        System.exit(0);

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(-1);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:ServiceMetadataAnnotator.java

示例8: runStep

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
@Override
public void runStep() throws Throwable {
    System.out.println("Checking Service @ " + serviceURL);
    // connect to the url and validate a return
    
    try {
        // TODO: maybe we can have checks in here for the various parts of the metadata?
        Address address = new Address(serviceURL);
        EndpointReferenceType serviceMetaDataEPR = new EndpointReferenceType(address);

        ServiceMetadata serviceMetaData = MetadataUtils.getServiceMetadata(serviceMetaDataEPR);
        System.out.println("   Service Name: "
            + serviceMetaData.getServiceDescription().getService().getName().toString());
        System.out.println("   POC: "
            + serviceMetaData.getServiceDescription().getService()
                .getPointOfContactCollection().getPointOfContact(0).getFirstName()
            + " "
            + serviceMetaData.getServiceDescription().getService()
                .getPointOfContactCollection().getPointOfContact(0).getLastName());
        System.out.println("   Hosting Research Center: "
            + serviceMetaData.getHostingResearchCenter().getResearchCenter().getDisplayName());
    } catch (Exception e) {
        e.printStackTrace();
        fail("Error getting resource property from " + serviceURL + " : " + e.getMessage());
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:27,代码来源:TestServiceMetaData.java

示例9: testInstallMMS

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
@Test
public void testInstallMMS() throws Exception {
    installAndAssertFeature("cagrid-mms", 30000L);
    System.err.println(executeCommand("features:list"));
    assertBundleInstalled("cagrid-mms-api");
    assertBundleInstalled("cagrid-mms-cadsr-impl");
    assertBundleInstalled("cagrid-mms-service");
    assertBundleInstalled("cagrid-mms-wsrf");

    MMS mmsImpl = getOsgiService(MMS.class, 30000L);
    assertNotNull(mmsImpl);
    
    MetadataModelService mmsService = getOsgiService(MetadataModelService.class, 30000L);
    assertNotNull(mmsService);

    // grab its metadata
    ServiceMetadata metadata = mmsService.getServiceMetadata();
    Assert.assertNotNull(metadata);
    assertEquals("Service metadata name was not as expected.", "MetadataModelService", metadata.getServiceDescription().getService().getName());
    ServiceSecurityMetadata securityMetadata = mmsService.getServiceSecurityMetadata();
    Assert.assertNotNull(securityMetadata);
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:23,代码来源:MMSInstallTest.java

示例10: annotateServiceMetadata

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
@Override
public ServiceMetadata annotateServiceMetadata(
		ServiceMetadata serviceMetadata,
		Map<URI, UMLProjectIdentifer> namespaceToProjectMappings)
		throws MMSGeneralException, InvalidUMLProjectIndentifier {
	AnnotateServiceMetadataRequest request = new AnnotateServiceMetadataRequest();
	AnnotateServiceMetadataRequest.NamespaceToProjectMappings mappings = new AnnotateServiceMetadataRequest.NamespaceToProjectMappings();
	
	//TODO:
	//mappings.getNamespaceToProjectMapping().addAll(namespaceToProjectMappings);
	request.setNamespaceToProjectMappings(mappings);
	AnnotateServiceMetadataRequest.ServiceMetadata metadata = new AnnotateServiceMetadataRequest.ServiceMetadata();
	metadata.setServiceMetadata(serviceMetadata);
	request.setServiceMetadata(metadata);
	AnnotateServiceMetadataResponse response = null;
	try {
		response = port.annotateServiceMetadata(request);
	} catch (InvalidUMLProjectIndentifierFaultMessage e) {
		throw new InvalidUMLProjectIndentifier();
	}
	return response.getServiceMetadata();
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:23,代码来源:MMSSoapClient.java

示例11: annotateServiceMetadata

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
/**
 * Add caDSR information to model.
 * 
 * @param metadata
 * @throws CaDSRGeneralException
 */
public void annotateServiceMetadata(ServiceMetadata metadata) throws CaDSRGeneralException {
    if (metadata == null || metadata.getServiceDescription() == null
        || metadata.getServiceDescription().getService() == null) {
        return;
    }

    Service service = metadata.getServiceDescription().getService();

    // TODO: how to set caDSR registration?
    CaDSRRegistration caDSRRegistration = service.getCaDSRRegistration();

    // TODO: set/edit service semantic metadata once service's are
    // registered in caDSR
    SemanticMetadata[] semanticMetadatas = (SemanticMetadata[])service.getSemanticMetadata().toArray();

    if (service.getServiceContextCollection() == null
        || service.getServiceContextCollection().getServiceContext() == null) {
        return;
    }
    ServiceContext[] serviceContexts = (ServiceContext[])service.getServiceContextCollection().getServiceContext().toArray();
    for (int i = 0; i < serviceContexts.length; i++) {
        annotateServiceContext(serviceContexts[i]);
    }

}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:32,代码来源:ServiceMetadataAnnotator.java

示例12: testInstallGME

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
@Test
public void testInstallGME() throws Exception {
    // Install GME feature here
    installAndAssertFeature("cagrid-gme", 30000L);
    System.err.println(executeCommand("features:list"));
    assertBundleInstalled("cagrid-gme-api");
    assertBundleInstalled("cagrid-gme-service");
    assertBundleInstalled("cagrid-gme-wsrf");

    GlobalModelExchangeService gmeService = getOsgiService(GlobalModelExchangeService.class, 30000L);
    assertNotNull(gmeService);

    // grab its metadata
    ServiceMetadata metadata = gmeService.getServiceMetadata();
    Assert.assertNotNull(metadata);
    assertEquals("Service metadata name was not as expected.", "GlobalModelExchange", metadata.getServiceDescription().getService().getName());
    ServiceSecurityMetadata securityMetadata = gmeService.getServiceSecurityMetadata();
    Assert.assertNotNull(securityMetadata);
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:20,代码来源:GMEInstallTest.java

示例13: equals

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
    if (!(object instanceof GTSResourceProperties)) {
        return false;
    }
    if (this == object) {
        return true;
    }
    final GTSResourceProperties that = ((GTSResourceProperties) object);
    {
        ServiceMetadata lhsServiceMetadata;
        lhsServiceMetadata = this.getServiceMetadata();
        ServiceMetadata rhsServiceMetadata;
        rhsServiceMetadata = that.getServiceMetadata();
        if (!strategy.equals(LocatorUtils.property(thisLocator, "serviceMetadata", lhsServiceMetadata), LocatorUtils.property(thatLocator, "serviceMetadata", rhsServiceMetadata), lhsServiceMetadata, rhsServiceMetadata)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:20,代码来源:GTSResourceProperties.java

示例14: appendFields

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
    {
        ServiceMetadata theServiceMetadata;
        theServiceMetadata = this.getServiceMetadata();
        strategy.appendField(locator, this, "serviceMetadata", buffer, theServiceMetadata);
    }
    {
        AuthenticationProfiles theAuthenticationProfiles;
        theAuthenticationProfiles = this.getAuthenticationProfiles();
        strategy.appendField(locator, this, "authenticationProfiles", buffer, theAuthenticationProfiles);
    }
    {
        TrustedIdentityProviders theTrustedIdentityProviders;
        theTrustedIdentityProviders = this.getTrustedIdentityProviders();
        strategy.appendField(locator, this, "trustedIdentityProviders", buffer, theTrustedIdentityProviders);
    }
    {
        DorianPolicy theDorianPolicy;
        theDorianPolicy = this.getDorianPolicy();
        strategy.appendField(locator, this, "dorianPolicy", buffer, theDorianPolicy);
    }
    return buffer;
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:24,代码来源:DorianResourceProperties.java

示例15: hashCode

import gov.nih.nci.cagrid.metadata.ServiceMetadata; //导入依赖的package包/类
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
    int currentHashCode = 1;
    {
        ServiceMetadata theServiceMetadata;
        theServiceMetadata = this.getServiceMetadata();
        currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "serviceMetadata", theServiceMetadata), currentHashCode, theServiceMetadata);
    }
    {
        AuthenticationProfiles theAuthenticationProfiles;
        theAuthenticationProfiles = this.getAuthenticationProfiles();
        currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "authenticationProfiles", theAuthenticationProfiles), currentHashCode, theAuthenticationProfiles);
    }
    {
        TrustedIdentityProviders theTrustedIdentityProviders;
        theTrustedIdentityProviders = this.getTrustedIdentityProviders();
        currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "trustedIdentityProviders", theTrustedIdentityProviders), currentHashCode, theTrustedIdentityProviders);
    }
    {
        DorianPolicy theDorianPolicy;
        theDorianPolicy = this.getDorianPolicy();
        currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "dorianPolicy", theDorianPolicy), currentHashCode, theDorianPolicy);
    }
    return currentHashCode;
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:25,代码来源:DorianResourceProperties.java


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