Access Keys:
Skip to content (Access Key - 0)

MMS

import gov.nih.nci.cagrid.metadata.dataservice.DomainModel;

import java.rmi.RemoteException;

import org.apache.axis.types.URI.MalformedURIException;
import org.cagrid.mms.client.MetadataModelServiceClient;
import org.cagrid.mms.common.MetadataModelServiceI;
import org.cagrid.mms.domain.Property;
import org.cagrid.mms.domain.UMLProjectIdentifer;
import org.cagrid.mms.stubs.types.InvalidUMLProjectIndentifier;


public class DeveloperGuideExamples {

    public static void main(String[] args) {
        try {

            // instantiate the MMS interface by passing the Client constructor a URL
            MetadataModelServiceI mms = new MetadataModelServiceClient(
                "http://mms.training.cagrid.org:8080/wsrf/services/cagrid/MetadataModelService");

            // identify the UML Project of interest
            UMLProjectIdentifer project = new UMLProjectIdentifer();
            project.setIdentifier("caCORE 3.2");
            project.setVersion("3.2");
            
            // not specifying a Source Identifier, implies the MMS should use
            // its default; which is the same as explicitly specifying it as below 
            // project.setSourceIdentifier(mms.getModelSourceMetadata().getDefaultSourceIdentifier());
            
            // you may also specify additional source-specific properties to help identify the UML Project
            // Property p = new Property();
            // p.setName("publicID");
            // p.set_value("2528431");
            // project.setAdditionalSourceProperty(new Property[]{p});

            // generate a Domain Model for the whole project
            DomainModel domainModel = mms.generateDomainModelForProject(project);
            
            //TODO use the generated Domain Model

        } catch (MalformedURIException e) {
            // TODO handle the case where the client is constructed with an
            // invalid URL
            e.printStackTrace();
            return;
        } catch (InvalidUMLProjectIndentifier e) {
            // TODO handle the case where the metadata source being used to does
            // not recognize the specified UML Project
            e.printStackTrace();
            return;
        } catch (RemoteException e) {
            // TODO handle general errors, such as connection refused
            e.printStackTrace();
            return;
        }
    }
}
Last edited by
Sarah Honacki (854 days ago)
Adaptavist Theme Builder Powered by Atlassian Confluence