Search in sources :

Example 6 with AddressSpaceException

use of com.prosysopc.ua.client.AddressSpaceException in project FAAAST-Service by FraunhoferIOSB.

the class AasServiceNodeManager method addSubmodelElementBaseData.

/**
 * Adds base data to the given submodel element.
 *
 * @param node The desired submodel element UA node
 * @param element The corresponding AAS submodel element
 * @throws StatusException If the operation fails
 * @throws ServiceException If the operation fails
 * @throws AddressSpaceException If the operation fails
 * @throws ServiceResultException If the operation fails
 */
private void addSubmodelElementBaseData(AASSubmodelElementType node, SubmodelElement element) throws StatusException {
    try {
        if ((node != null) && (element != null)) {
            // Category
            String category = element.getCategory();
            if (category == null) {
                category = "";
            }
            node.setCategory(category);
            node.setModelingKind(ValueConverter.convertModelingKind(element.getKind()));
            // DataSpecifications
            addEmbeddedDataSpecifications(node, element.getEmbeddedDataSpecifications());
            // SemanticId
            if (element.getSemanticId() != null) {
                addSemanticId(node, element.getSemanticId());
            }
            // Qualifiers
            List<Constraint> qualifiers = element.getQualifiers();
            if ((qualifiers != null) && (!qualifiers.isEmpty())) {
                if (node.getQualifierNode() == null) {
                    addQualifierNode(node);
                }
                addQualifiers(node.getQualifierNode(), qualifiers);
            }
            // Description
            addDescriptions(node, element.getDescriptions());
            if (VALUES_READ_ONLY) {
                node.getCategoryNode().setAccessLevel(AccessLevelType.CurrentRead);
                node.getModelingKindNode().setAccessLevel(AccessLevelType.CurrentRead);
            }
        }
    } catch (Exception ex) {
        LOG.error("addSubmodelElementBaseData Exception", ex);
        throw ex;
    }
}
Also used : Constraint(io.adminshell.aas.v3.model.Constraint) ByteString(com.prosysopc.ua.stack.builtintypes.ByteString) LangString(io.adminshell.aas.v3.model.LangString) ServiceResultException(com.prosysopc.ua.stack.common.ServiceResultException) StatusException(com.prosysopc.ua.StatusException) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) ServiceException(com.prosysopc.ua.ServiceException) UaNodeFactoryException(com.prosysopc.ua.nodes.UaNodeFactoryException) AddressSpaceException(com.prosysopc.ua.client.AddressSpaceException)

Example 7 with AddressSpaceException

use of com.prosysopc.ua.client.AddressSpaceException in project FAAAST-Service by FraunhoferIOSB.

the class AasServiceNodeManager method createAasNodes.

/**
 * Creates the AAS nodes in the address space.
 *
 * @throws StatusException If the operation fails
 * @throws ServiceException If the operation fails
 * @throws AddressSpaceException If the operation fails
 * @throws ServiceResultException If the operation fails
 */
private void createAasNodes() throws StatusException, ServiceResultException, ServiceException, AddressSpaceException {
    try {
        if (aasEnvironment != null) {
            // add AASEnvironmentType
            addAasEnvironmentNode();
            // ConceptDescriptions.
            addConceptDescriptions(aasEnvironment.getConceptDescriptions());
            // Assets
            List<Asset> assets = aasEnvironment.getAssets();
            if ((assets != null) && (!assets.isEmpty())) {
                for (Asset asset : assets) {
                    addAsset(aasEnvironmentNode, asset);
                }
            }
            // Submodels
            List<Submodel> submodels = aasEnvironment.getSubmodels();
            if ((submodels != null) && (!submodels.isEmpty())) {
                for (Submodel submodel : submodels) {
                    addSubmodel(aasEnvironmentNode, submodel);
                }
            }
            addAssetAdministrationShells();
        }
    } catch (Exception ex) {
        LOG.error("createAasNodes Exception", ex);
        throw ex;
    }
}
Also used : Submodel(io.adminshell.aas.v3.model.Submodel) Asset(io.adminshell.aas.v3.model.Asset) ServiceResultException(com.prosysopc.ua.stack.common.ServiceResultException) StatusException(com.prosysopc.ua.StatusException) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) ServiceException(com.prosysopc.ua.ServiceException) UaNodeFactoryException(com.prosysopc.ua.nodes.UaNodeFactoryException) AddressSpaceException(com.prosysopc.ua.client.AddressSpaceException)

Example 8 with AddressSpaceException

use of com.prosysopc.ua.client.AddressSpaceException in project FAAAST-Service by FraunhoferIOSB.

the class AasServiceNodeManager method init.

/**
 * Initializes the Node Manager.
 *
 * @throws StatusException If the operation fails
 * @throws UaNodeFactoryException Error creating nodes
 */
@Override
protected void init() throws StatusException, UaNodeFactoryException {
    try {
        super.init();
        createAddressSpace();
    } catch (ServiceResultException ex) {
        throw new StatusException(ex);
    } catch (ServiceException ex) {
        throw new StatusException(ex.getServiceResult(), ex);
    } catch (AddressSpaceException | MessageBusException ex) {
        throw new StatusException(ex.getMessage(), ex);
    }
}
Also used : MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) StatusException(com.prosysopc.ua.StatusException) ServiceException(com.prosysopc.ua.ServiceException) ServiceResultException(com.prosysopc.ua.stack.common.ServiceResultException) AddressSpaceException(com.prosysopc.ua.client.AddressSpaceException)

Aggregations

ServiceException (com.prosysopc.ua.ServiceException)8 StatusException (com.prosysopc.ua.StatusException)8 AddressSpaceException (com.prosysopc.ua.client.AddressSpaceException)8 ServiceResultException (com.prosysopc.ua.stack.common.ServiceResultException)8 MessageBusException (de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException)8 UaNodeFactoryException (com.prosysopc.ua.nodes.UaNodeFactoryException)7 ByteString (com.prosysopc.ua.stack.builtintypes.ByteString)4 ObjectData (de.fraunhofer.iosb.ilt.faaast.service.endpoint.opcua.data.ObjectData)4 LangString (io.adminshell.aas.v3.model.LangString)4 UaQualifiedName (com.prosysopc.ua.UaQualifiedName)3 NodeId (com.prosysopc.ua.stack.builtintypes.NodeId)3 QualifiedName (com.prosysopc.ua.stack.builtintypes.QualifiedName)3 Constraint (io.adminshell.aas.v3.model.Constraint)3 Reference (io.adminshell.aas.v3.model.Reference)3 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)3 Asset (io.adminshell.aas.v3.model.Asset)2 Submodel (io.adminshell.aas.v3.model.Submodel)2 AASSubmodelType (opc.i4aas.AASSubmodelType)2 PlainProperty (com.prosysopc.ua.server.nodes.PlainProperty)1 LocalizedText (com.prosysopc.ua.stack.builtintypes.LocalizedText)1