@Override public void printPlanEndpoints() { this.init(); this.em.getTransaction().begin(); List<WSDLEndpoint> endpoints = null; Query queryWSDLEndpoint = this.em.createQuery("SELECT e FROM WSDLEndpoint e"); endpoints = queryWSDLEndpoint.getResultList(); this.em.getTransaction().commit(); StringBuilder builder = new StringBuilder(); String ls = System.getProperty("line.separator"); builder.append( "debug output for stored endpoints of management plans, flags: csarid, planid, ianame, porttype " + ls); for (WSDLEndpoint endpoint : endpoints) { builder.append( "endpoint: " + endpoint.getCSARId() + " " + endpoint.getPlanId() + " " + endpoint.getIaName() + " " + endpoint.getPortType() + ls); } CoreInternalEndpointServiceImpl.LOG.debug(builder.toString()); }
/** * 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(WSDLEndpoint endpoint) { this.init(); Query wsdlEndpointQuery = this.em.createNamedQuery(WSDLEndpoint.getWSDLEndpointByPortType); // Set parameters wsdlEndpointQuery.setParameter("portType", endpoint.getPortType()); // wsdlEndpointQuery.setParameter("addressType", // endpoint.getAddressType()); wsdlEndpointQuery.setParameter("csarId", endpoint.getCSARId()); // Check if the result list is empty return wsdlEndpointQuery.getResultList().size() != 0; }
@Override /** {@Inheritdoc} */ public void storeWSDLEndpoint(WSDLEndpoint endpoint) { this.init(); CoreInternalEndpointServiceImpl.LOG.debug( "Storing WSDL Endpoint with CSARID: \"" + endpoint.getCSARId() + "\", portType: \"" + endpoint.getPortType() + "\", IAName: \"" + endpoint.getIaName() + "\", NodeTypeImplementation: \"" + endpoint.getNodeTypeImplementation() + "\", URI: \"" + endpoint.getURI().toString() + "\""); // TODO this check is a hack because of the problem with deploying of // multiple deployment artifacts if (!this.existsWSDLEndpoint(endpoint)) { this.em.getTransaction().begin(); CoreInternalEndpointServiceImpl.LOG.debug( "The endpoint for \"{}\" is not stored. Thus store it.", endpoint.getPortType()); this.em.persist(endpoint); this.em.getTransaction().commit(); } else { CoreInternalEndpointServiceImpl.LOG.debug( "The endpoint for \"{}\" is stored already.", endpoint.getPortType()); } }
public void _endpoint_show_wsdl(CommandInterpreter commandInterpreter) { this.em.getTransaction().begin(); Query query = this.em.createQuery("SELECT e FROM WSDLEndpoint e"); @SuppressWarnings("unchecked") List<WSDLEndpoint> queryResults = query.getResultList(); for (WSDLEndpoint e : queryResults) { commandInterpreter.println("CSARId: " + e.getCSARId()); commandInterpreter.println("PortType: " + e.getPortType().toString()); commandInterpreter.println( "PlanId: " + (e.getPlanId() == null ? "" : e.getPlanId().toString())); commandInterpreter.println( "NodeTypeImpl: " + (e.getNodeTypeImplementation() == null ? "" : e.getNodeTypeImplementation().toString())); commandInterpreter.println("IaName: " + (e.getIaName() == null ? "" : e.getIaName())); commandInterpreter.println("URI: " + e.getURI().toString()); commandInterpreter.println(""); } this.em.getTransaction().commit(); }