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;
}
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;
}
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;
}
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;
}
}
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;
}
Aggregations