Search in sources :

Example 1 with WSDLEndpoint

use of org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint in project container by OpenTOSCA.

the class CoreEndpointServiceImpl method getWSDLEndpointsForCsarId.

@Override
public List<WSDLEndpoint> getWSDLEndpointsForCsarId(String triggeringContainer, final CsarId csarId) {
    final List<WSDLEndpoint> endpoints = new ArrayList<>();
    final TypedQuery<WSDLEndpoint> queryWSDLEndpoint = this.em.createQuery("SELECT e FROM WSDLEndpoint e where e.csarId= :csarId and e.triggeringContainer = :triggeringContainer", WSDLEndpoint.class);
    queryWSDLEndpoint.setParameter("csarId", csarId);
    queryWSDLEndpoint.setParameter("triggeringContainer", triggeringContainer);
    final List<WSDLEndpoint> queryResults = queryWSDLEndpoint.getResultList();
    for (final WSDLEndpoint endpoint : queryResults) {
        endpoints.add(endpoint);
    }
    return endpoints;
}
Also used : WSDLEndpoint(org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint) ArrayList(java.util.ArrayList)

Example 2 with WSDLEndpoint

use of org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint in project container by OpenTOSCA.

the class CoreEndpointServiceImpl method getWSDLEndpointForIa.

@Override
public WSDLEndpoint getWSDLEndpointForIa(final CsarId csarId, final QName nodeTypeImpl, final String iaName) {
    WSDLEndpoint endpoint = null;
    final TypedQuery<WSDLEndpoint> queryWSDLEndpoint = em.createQuery("SELECT e FROM WSDLEndpoint e where e.csarId= :csarId and e.IaName = :IaName and e.TypeImplementation = :nodeTypeImpl", WSDLEndpoint.class);
    queryWSDLEndpoint.setParameter("csarId", csarId);
    queryWSDLEndpoint.setParameter("IaName", iaName);
    queryWSDLEndpoint.setParameter("nodeTypeImpl", nodeTypeImpl);
    try {
        endpoint = queryWSDLEndpoint.getSingleResult();
    } catch (final NoResultException e) {
        LOG.info("No endpoint stored for requested IA.");
    }
    return endpoint;
}
Also used : WSDLEndpoint(org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint) NoResultException(javax.persistence.NoResultException)

Example 3 with WSDLEndpoint

use of org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint in project container by OpenTOSCA.

the class CoreEndpointServiceImpl method getWSDLEndpointsForNTImplAndIAName.

@Override
public List<WSDLEndpoint> getWSDLEndpointsForNTImplAndIAName(String triggeringContainer, String managingContainer, final QName nodeTypeImpl, final String iaName) {
    final List<WSDLEndpoint> endpoints = new ArrayList<>();
    final TypedQuery<WSDLEndpoint> queryWSDLEndpoint = this.em.createQuery("SELECT e FROM WSDLEndpoint e where e.IaName = :IaName and e.TypeImplementation = :nodeTypeImpl and e.triggeringContainer = :triggeringContainer and e.managingContainer = :managingContainer", WSDLEndpoint.class);
    queryWSDLEndpoint.setParameter("IaName", iaName);
    queryWSDLEndpoint.setParameter("nodeTypeImpl", nodeTypeImpl);
    queryWSDLEndpoint.setParameter("triggeringContainer", triggeringContainer);
    queryWSDLEndpoint.setParameter("managingContainer", managingContainer);
    final List<WSDLEndpoint> queryResults = queryWSDLEndpoint.getResultList();
    for (final WSDLEndpoint endpoint : queryResults) {
        endpoints.add(endpoint);
    }
    return endpoints;
}
Also used : WSDLEndpoint(org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint) ArrayList(java.util.ArrayList)

Example 4 with WSDLEndpoint

use of org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint in project container by OpenTOSCA.

the class CoreEndpointServiceImpl method existsWSDLEndpoint.

/**
 * Helper method to check if a given WSDLEndpoint is already stored in the database
 *
 * @param endpoint to look for
 * @return true, if the Endpoint already exists.
 */
private boolean existsWSDLEndpoint(final WSDLEndpoint endpoint) {
    TypedQuery<WSDLEndpoint> findQuery = em.createQuery("SELECT e from WSDLEndpoint e where e.PortType = :portType " + "and e.csarId = :csarId and e.managingContainer = :managingContainer " + "and e.serviceTemplateInstanceID = :serviceTemplateInstanceID and e.PlanId = :planId", WSDLEndpoint.class);
    findQuery.setParameter("portType", endpoint.getPortType());
    findQuery.setParameter("csarId", endpoint.getCsarId());
    findQuery.setParameter("managingContainer", endpoint.getManagingContainer());
    findQuery.setParameter("serviceTemplateInstanceID", endpoint.getServiceTemplateInstanceID());
    findQuery.setParameter("planId", endpoint.getPlanId());
    try {
        @SuppressWarnings("unused") WSDLEndpoint dbResult = findQuery.getSingleResult();
        return true;
    } catch (NoResultException | NonUniqueResultException umm) {
        // maybe return true if result is not unique?
        return false;
    }
}
Also used : WSDLEndpoint(org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint) NonUniqueResultException(javax.persistence.NonUniqueResultException) NoResultException(javax.persistence.NoResultException)

Example 5 with WSDLEndpoint

use of org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint in project container by OpenTOSCA.

the class CoreEndpointServiceImpl method getWSDLEndpoints.

@Override
public /**
 * {@Inheritdoc}
 */
List<WSDLEndpoint> getWSDLEndpoints(final QName portType, final String triggeringContainer, final CsarId csarId) {
    final ArrayList<WSDLEndpoint> results = new ArrayList<>();
    final TypedQuery<WSDLEndpoint> getWSDLEndpointsQuery = em.createQuery("SELECT e FROM WSDLEndpoint e where e.triggeringContainer = :triggeringContainer and e.csarId = :csarId and e.PortType = :portType", WSDLEndpoint.class);
    // Set Parameters for the Query
    getWSDLEndpointsQuery.setParameter("portType", portType);
    getWSDLEndpointsQuery.setParameter("triggeringContainer", triggeringContainer);
    getWSDLEndpointsQuery.setParameter("csarId", csarId);
    // Get Query-Results (WSDLEndpoints) and add them to the result list.
    final List<WSDLEndpoint> queryResults = getWSDLEndpointsQuery.getResultList();
    for (final WSDLEndpoint endpoint : queryResults) {
        results.add(endpoint);
    }
    // Hack, to get endpoints stored from the container e.g. the SI-Invoker
    // endpoint.
    // Set Parameters for the Query
    getWSDLEndpointsQuery.setParameter("portType", portType);
    getWSDLEndpointsQuery.setParameter("csarId", new CsarId(""));
    // Get Query-Results (WSDLEndpoints) and add them to the result list.
    final List<WSDLEndpoint> queryResults2 = getWSDLEndpointsQuery.getResultList();
    for (final WSDLEndpoint endpoint : queryResults2) {
        results.add(endpoint);
    }
    return results;
}
Also used : WSDLEndpoint(org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint) ArrayList(java.util.ArrayList) CsarId(org.opentosca.container.core.model.csar.CsarId)

Aggregations

WSDLEndpoint (org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint)22 ArrayList (java.util.ArrayList)9 URI (java.net.URI)8 URISyntaxException (java.net.URISyntaxException)7 QName (javax.xml.namespace.QName)7 CsarId (org.opentosca.container.core.model.csar.CsarId)6 IManagementBusDeploymentPluginService (org.opentosca.bus.management.deployment.plugin.IManagementBusDeploymentPluginService)5 IOException (java.io.IOException)4 Path (java.nio.file.Path)4 HashMap (java.util.HashMap)4 Exchange (org.apache.camel.Exchange)4 Message (org.apache.camel.Message)4 DefaultExchange (org.apache.camel.support.DefaultExchange)4 LinkedList (java.util.LinkedList)3 Map (java.util.Map)3 Collectors (java.util.stream.Collectors)3 Inject (javax.inject.Inject)3 ProducerTemplate (org.apache.camel.ProducerTemplate)3 TEntityTypeImplementation (org.eclipse.winery.model.tosca.TEntityTypeImplementation)3 TImplementationArtifact (org.eclipse.winery.model.tosca.TImplementationArtifact)3