Class RD_API


  • public class RD_API
    extends Object
    Resource Description (RD) API for processing such resources.
    Author:
    Niko Siltala
    • Field Detail

      • ID_SEPARATOR

        public static final String ID_SEPARATOR
        Separator used to separate sections within the ID
        See Also:
        Constant Field Values
      • RD_FILE_TYPE

        public static final String RD_FILE_TYPE
        File type (ending) used for Resource description Files
        See Also:
        Constant Field Values
    • Constructor Detail

      • RD_API

        public RD_API()
        Default constructor
      • RD_API

        public RD_API​(String configFileName)
        Constructor with explicit configuration file.
        Parameters:
        configFileName - path and filename for configuration file for RD_API
    • Method Detail

      • readRDInFromString

        public ResourceDescription readRDInFromString​(InputStream rdInXML_inputStream)
                                               throws JAXBException,
                                                      Exception
        Reads in Resource Description as argument content (InputStream, String as XML format) and builds the Java binding (JAXB) objects.
        Parameters:
        rdInXML_inputStream - RD's content as InputStream and content in XML format
        Returns:
        ResourceDescription Root object for the read structure
        Throws:
        JAXBException
        Exception
      • readRDInFromString

        public ResourceDescription readRDInFromString​(String rdInXML)
                                               throws JAXBException,
                                                      Exception
        Reads in Resource Description as argument content(XML format) and builds the Java binding (JAXB) objects. Stores object structure locally.
        Parameters:
        rdInXML - RD's content in XML format
        Returns:
        ResourceDescription Root object for the read structure
        Throws:
        Exception
        JAXBException
      • saveRDToLocation

        public boolean saveRDToLocation​(ResourceDescription rdObj,
                                        String fileLocation)
                                 throws Exception
        Saves given RD object data into file.
        Parameters:
        rd - Resource Description as object model
        fileLocation - Location of the file where data is to be stored.
        Returns:
        true if saving succeeds
        Throws:
        Exception
      • getCapabilitiesAsBPOntoModelFromRD

        public fi.tut.mei.capabilityQueryLib.Client getCapabilitiesAsBPOntoModelFromRD​(ResourceDescription rdObj)
                                                                                throws Exception
        Creates a new Resource Model Ontology. After this it gets the capabilities (in ontology format) from the RD and creates/puts them into just created Resource Model ontology as instances.
        Parameters:
        rdObj -
        Returns:
        new Ontology Client containing the resources capabilities
        Throws:
        Exception
      • getCapabilitiesAsBPOntoModelFromRD

        public void getCapabilitiesAsBPOntoModelFromRD​(fi.tut.mei.capabilityQueryLib.Client capaOntoModel,
                                                       ResourceDescription rdObj)
                                                throws Exception
        Gets the capabilities (in ontology format) from the RD and creates/puts them into Resource Model ontology as instances. This limits to the first Resource of this RD. A new blueprint is created into the model and it is populated with the capabilities. The name of the Blueprint is at the same time updated to correspond the Resource's unique name. NOTE: Existing ontology content will be cleared when calling this method!
        Parameters:
        capaOntoModel - Resource Model Ontology, where the capabilites from RD are read to. NOTE: Existing ontology content will be cleared!
        rdObj - RD object, from which its capabilities (in ontology format) are read from
        Throws:
        Exception
      • getCapabilitiesAsBPOntoModelFromResource

        public void getCapabilitiesAsBPOntoModelFromResource​(fi.tut.mei.capabilityQueryLib.Client capaOntoModel,
                                                             ResourceCT resourceObj)
                                                      throws Exception
        Gets the capabilities (in ontology format) from the RD's Resource and creates/puts them into Resource Model ontology as instances. A new blueprint is created into the model and it is populated with the capabilities. The name of the Blueprint is at the same time updated to correspond the Resource's unique name. NOTE: Existing ontology content will be cleared when calling this method!
        Parameters:
        capaOntoModel - Resource Model Ontology, where the capabilites from given RD's Resource are read to. NOTE: Existing ontology content will be cleared!
        resourceObj - RD's Resource object, from which its capabilities (in ontology format) are read from
        Throws:
        Exception
      • getUniqueNameOfResource

        public String getUniqueNameOfResource​(ResourceCT resourceObj)
        Gets unique name of a resource
        Parameters:
        resourceObj -
        Returns:
        unique name
      • putCapabilitiesOntoToRDModel

        public void putCapabilitiesOntoToRDModel​(fi.tut.mei.capabilityQueryLib.model.Blueprint blueprint,
                                                 ResourceDescription toRdObj)
                                          throws Exception
        Puts the content of a Blueprint, which is defined in Resource Model (instance) ontology, inside the given Resource Description (RD). This creates or overwrites the capability content in the ontology format inside the RD.
        Parameters:
        blueprint - Blueprint in the ontology format, which is defined in Resource Model (instance) ontology.
        toRdObj - Resource Description where the data is placed.
        Throws:
        Exception
      • putCapabilitiesOntoToRDModel

        protected void putCapabilitiesOntoToRDModel​(fi.tut.mei.capabilityQueryLib.Client capaOntoModel,
                                                    ResourceDescription toRdObj)
                                             throws Exception
        Puts the content of a Resource Model (instance) ontology, inside the given Resource Description. Ontology should contain ONLY data for a single device (Resource instance). Then this data creates or overwrites the capability content in the ontology format in RD.
        Parameters:
        capaOntoModel - Resource Model (instance) ontology
        toRdObj - Resource Description where the data is placed.
        Throws:
        Exception
      • getCapabilitiesOntoAsXMLNodeFromOntoClient

        protected Document getCapabilitiesOntoAsXMLNodeFromOntoClient​(fi.tut.mei.capabilityQueryLib.Client capaOntoModel)
                                                               throws Exception
        Throws:
        Exception