Class AbstractSubmodel<S extends org.eclipse.basyx.submodel.metamodel.api.ISubmodel>

  • Type Parameters:
    S - the BaSyx type implementing the sub-model
    All Implemented Interfaces:
    BaSyxElementTranslator.SubmodelElementsRegistrar, de.iip_ecosphere.platform.support.aas.DeferredParent, de.iip_ecosphere.platform.support.aas.Element, de.iip_ecosphere.platform.support.aas.ElementContainer, de.iip_ecosphere.platform.support.aas.ElementsAccess, de.iip_ecosphere.platform.support.aas.HasDataSpecification, de.iip_ecosphere.platform.support.aas.HasKind, de.iip_ecosphere.platform.support.aas.HasSemantics, de.iip_ecosphere.platform.support.aas.Identifiable, de.iip_ecosphere.platform.support.aas.Qualifiable, de.iip_ecosphere.platform.support.aas.Referable, de.iip_ecosphere.platform.support.aas.Submodel
    Direct Known Subclasses:
    BaSyxISubmodel, BaSyxSubmodel

    public abstract class AbstractSubmodel<S extends org.eclipse.basyx.submodel.metamodel.api.ISubmodel>
    extends java.lang.Object
    implements de.iip_ecosphere.platform.support.aas.Submodel, BaSyxElementTranslator.SubmodelElementsRegistrar
    Basic sub-model implementation.
    Author:
    Holger Eichelberger, SSE
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface de.iip_ecosphere.platform.support.aas.Submodel

        de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.DataElement> dataElements  
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.Builder<?>> deferred  
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.Operation> operations  
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.Property> properties  
      private S submodel  
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractSubmodel​(S submodel)
      Creates an instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(de.iip_ecosphere.platform.support.aas.AasVisitor visitor)  
      void buildDeferred()
      Calls Builder.build() on all deferred builders.
      de.iip_ecosphere.platform.support.aas.Reference createReference()  
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.DataElement> dataElements()  
      (package private) void defer​(java.lang.String shortId, de.iip_ecosphere.platform.support.Builder<?> builder)
      Registers a sub-build as deferred.
      void delete​(de.iip_ecosphere.platform.support.aas.SubmodelElement elt)  
      de.iip_ecosphere.platform.support.aas.DataElement getDataElement​(java.lang.String idShort)  
      int getDataElementsCount()  
      <B extends de.iip_ecosphere.platform.support.Builder<?>>
      B
      getDeferred​(java.lang.String shortId, java.lang.Class<B> cls)
      Returns a deferred builder.
      java.lang.String getIdentification()
      Returns the identification of the submodel.
      java.lang.String getIdShort()  
      de.iip_ecosphere.platform.support.aas.Operation getOperation​(java.lang.String idShort)  
      int getOperationsCount()  
      int getPropertiesCount()  
      de.iip_ecosphere.platform.support.aas.Property getProperty​(java.lang.String idShort)  
      de.iip_ecosphere.platform.support.aas.ReferenceElement getReferenceElement​(java.lang.String idShort)  
      (package private) S getSubmodel()
      Returns the sub-model instance.
      de.iip_ecosphere.platform.support.aas.SubmodelElement getSubmodelElement​(java.lang.String idShort)  
      de.iip_ecosphere.platform.support.aas.SubmodelElementCollection getSubmodelElementCollection​(java.lang.String idShort)  
      int getSubmodelElementsCount()  
      static java.lang.String getSubmodelEndpoint​(de.iip_ecosphere.platform.support.ServerAddress server, de.iip_ecosphere.platform.support.aas.Aas aas, de.iip_ecosphere.platform.support.aas.Submodel submodel)
      Returns an AAS sub-model URI according to the BaSyx naming schema.
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Operation> operations()  
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Property> properties()  
      <D extends org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.DataElement>
      BaSyxDataElement<D>
      register​(BaSyxDataElement<D> dataElement)
      Registers a data element.
      BaSyxFile register​(BaSyxFile file)
      Registers a file data element.
      BaSyxOperation register​(BaSyxOperation operation)
      Registers an operation.
      BaSyxProperty register​(BaSyxProperty property)
      Registers a property.
      BaSyxReferenceElement register​(BaSyxReferenceElement reference)
      Registers a reference element.
      BaSyxSubmodelElementCollection register​(BaSyxSubmodelElementCollection collection)
      Registers a sub-model element collection.
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements()  
      private void warn​(java.lang.String msg)
      Emits a warning.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface de.iip_ecosphere.platform.support.aas.Element

        update
      • Methods inherited from interface de.iip_ecosphere.platform.support.aas.Submodel

        createSubmodelElementCollectionBuilder
    • Field Detail

      • submodel

        private S extends org.eclipse.basyx.submodel.metamodel.api.ISubmodel submodel
      • operations

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.Operation> operations
      • dataElements

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.DataElement> dataElements
      • properties

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.Property> properties
      • submodelElements

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements
      • deferred

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.Builder<?>> deferred
    • Constructor Detail

      • AbstractSubmodel

        protected AbstractSubmodel​(S submodel)
        Creates an instance. Prevents external creation.
        Parameters:
        submodel - the sub model instance
    • Method Detail

      • getSubmodel

        S getSubmodel()
        Returns the sub-model instance.
        Returns:
        the sub-model instance
      • warn

        private void warn​(java.lang.String msg)
        Emits a warning.
        Parameters:
        msg - the message to be emitted
      • getIdShort

        public java.lang.String getIdShort()
        Specified by:
        getIdShort in interface de.iip_ecosphere.platform.support.aas.Element
      • submodelElements

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements()
        Specified by:
        submodelElements in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • properties

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Property> properties()
        Specified by:
        properties in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • dataElements

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.DataElement> dataElements()
        Specified by:
        dataElements in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • operations

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Operation> operations()
        Specified by:
        operations in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getSubmodelElementsCount

        public int getSubmodelElementsCount()
        Specified by:
        getSubmodelElementsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getDataElementsCount

        public int getDataElementsCount()
        Specified by:
        getDataElementsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getOperationsCount

        public int getOperationsCount()
        Specified by:
        getOperationsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getDataElement

        public de.iip_ecosphere.platform.support.aas.DataElement getDataElement​(java.lang.String idShort)
        Specified by:
        getDataElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getProperty

        public de.iip_ecosphere.platform.support.aas.Property getProperty​(java.lang.String idShort)
        Specified by:
        getProperty in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getPropertiesCount

        public int getPropertiesCount()
        Specified by:
        getPropertiesCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getReferenceElement

        public de.iip_ecosphere.platform.support.aas.ReferenceElement getReferenceElement​(java.lang.String idShort)
        Specified by:
        getReferenceElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getOperation

        public de.iip_ecosphere.platform.support.aas.Operation getOperation​(java.lang.String idShort)
        Specified by:
        getOperation in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getSubmodelElement

        public de.iip_ecosphere.platform.support.aas.SubmodelElement getSubmodelElement​(java.lang.String idShort)
        Specified by:
        getSubmodelElement in interface de.iip_ecosphere.platform.support.aas.Submodel
      • getSubmodelElementCollection

        public de.iip_ecosphere.platform.support.aas.SubmodelElementCollection getSubmodelElementCollection​(java.lang.String idShort)
        Specified by:
        getSubmodelElementCollection in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • accept

        public void accept​(de.iip_ecosphere.platform.support.aas.AasVisitor visitor)
        Specified by:
        accept in interface de.iip_ecosphere.platform.support.aas.Element
      • createReference

        public de.iip_ecosphere.platform.support.aas.Reference createReference()
        Specified by:
        createReference in interface de.iip_ecosphere.platform.support.aas.Submodel
      • delete

        public void delete​(de.iip_ecosphere.platform.support.aas.SubmodelElement elt)
        Specified by:
        delete in interface de.iip_ecosphere.platform.support.aas.Submodel
      • getSubmodelEndpoint

        public static java.lang.String getSubmodelEndpoint​(de.iip_ecosphere.platform.support.ServerAddress server,
                                                           de.iip_ecosphere.platform.support.aas.Aas aas,
                                                           de.iip_ecosphere.platform.support.aas.Submodel submodel)
        Returns an AAS sub-model URI according to the BaSyx naming schema. [public for testing, debugging]
        Parameters:
        server - the server address
        aas - the AAS
        submodel - the sub-model
        Returns:
        the endpoint URI
      • defer

        void defer​(java.lang.String shortId,
                   de.iip_ecosphere.platform.support.Builder<?> builder)
        Registers a sub-build as deferred.
        Parameters:
        shortId - the shortId of the element
        builder - the sub-builder to be registered
        See Also:
        buildDeferred()
      • buildDeferred

        public void buildDeferred()
        Calls Builder.build() on all deferred builders.
        Specified by:
        buildDeferred in interface de.iip_ecosphere.platform.support.aas.DeferredParent
        See Also:
        defer(String, Builder)
      • getDeferred

        public <B extends de.iip_ecosphere.platform.support.Builder<?>> B getDeferred​(java.lang.String shortId,
                                                                                      java.lang.Class<B> cls)
        Returns a deferred builder.
        Type Parameters:
        B - the builder type
        Parameters:
        shortId - the short id
        cls - the builder type
        Returns:
        the builder or null if no builder for shortId with the respective type is registered
      • getIdentification

        public java.lang.String getIdentification()
        Returns the identification of the submodel.
        Specified by:
        getIdentification in interface de.iip_ecosphere.platform.support.aas.Identifiable
        Returns:
        the identification (prefixed according to IdentifierType, custom if none matches). Can e.g. be used with Registry if not null.