protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof IndirectEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); IndirectEndpoint indirectEndpoint = (IndirectEndpoint) endpoint; String ref = indirectEndpoint.getKey(); if (ref != null) { endpointElement.addAttribute("key", ref, null); } // serialize the parameters serializeProperties(indirectEndpoint, endpointElement); return endpointElement; } }
protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof IndirectEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); IndirectEndpoint indirectEndpoint = (IndirectEndpoint) endpoint; String ref = indirectEndpoint.getKey(); if (ref != null) { endpointElement.addAttribute("key", ref, null); } // serialize the parameters serializeProperties(indirectEndpoint, endpointElement); return endpointElement; } }
/** * Helper method to construct children endpoints * * @param listEndpointElement OMElement representing the children endpoints * @param parent Parent endpoint * @param properties bag of properties to pass in any information to the factory * @return List of children endpoints */ protected ArrayList<Endpoint> getEndpoints(OMElement listEndpointElement, Endpoint parent, Properties properties) { ArrayList<Endpoint> endpoints = new ArrayList<Endpoint>(); ArrayList<String> keys = new ArrayList<String>(); Iterator iter = listEndpointElement.getChildrenWithName(XMLConfigConstants.ENDPOINT_ELT); while (iter.hasNext()) { OMElement endptElem = (OMElement) iter.next(); Endpoint endpoint = EndpointFactory.getEndpointFromElement(endptElem, true, properties); if (endpoint instanceof IndirectEndpoint) { String key = ((IndirectEndpoint) endpoint).getKey(); if (!keys.contains(key)) { keys.add(key); } else { handleException("Same endpoint definition cannot be used with in the siblings"); } } endpoint.setParentEndpoint(parent); endpoints.add(endpoint); } return endpoints; }
private String getEndpointName(Endpoint endpoint) { if (endpoint == null) { handleException("Endpoint cannot be null."); } assert endpoint != null; String endpointName = endpoint.getName(); if (endpointName == null && endpoint instanceof IndirectEndpoint) { endpointName = ((IndirectEndpoint) endpoint).getKey(); } validateInput(endpointName); return endpointName; }
/** * Helper method to construct children endpoints * * @param listEndpointElement OMElement representing the children endpoints * @param parent Parent endpoint * @param properties bag of properties to pass in any information to the factory * @return List of children endpoints */ protected ArrayList<Endpoint> getEndpoints(OMElement listEndpointElement, Endpoint parent, Properties properties) { ArrayList<Endpoint> endpoints = new ArrayList<Endpoint>(); ArrayList<String> keys = new ArrayList<String>(); Iterator iter = listEndpointElement.getChildrenWithName(XMLConfigConstants.ENDPOINT_ELT); while (iter.hasNext()) { OMElement endptElem = (OMElement) iter.next(); Endpoint endpoint = EndpointFactory.getEndpointFromElement(endptElem, true, properties); if (endpoint instanceof IndirectEndpoint) { String key = ((IndirectEndpoint) endpoint).getKey(); if (!keys.contains(key)) { keys.add(key); } else { handleException("Same endpoint definition cannot be used with in the siblings"); } } endpoint.setParentEndpoint(parent); endpoints.add(endpoint); } return endpoints; }
private String getEndpointName(Endpoint endpoint) { if (endpoint == null) { handleException("Endpoint cannot be null."); } assert endpoint != null; String endpointName = endpoint.getName(); if (endpointName == null && endpoint instanceof IndirectEndpoint) { endpointName = ((IndirectEndpoint) endpoint).getKey(); } validateInput(endpointName); return endpointName; }
public void setComponentStatisticsId(ArtifactHolder holder) { if (this instanceof IndirectEndpoint) { String sequenceId = StatisticIdentityGenerator .getIdReferencingComponent(((IndirectEndpoint) (this)).getKey(), ComponentType.ENDPOINT, holder); StatisticIdentityGenerator.reportingEndEvent(sequenceId, ComponentType.ENDPOINT, holder); } else { if (definition == null) { EndpointDefinition definition = new EndpointDefinition(); this.setDefinition(definition); } if (definition.getAspectConfiguration() == null) { definition.configure(new AspectConfiguration(getReportingName())); } String sequenceId = StatisticIdentityGenerator.getIdForComponent(getReportingName(), ComponentType.ENDPOINT, holder); definition.getAspectConfiguration().setUniqueId(sequenceId); StatisticIdentityGenerator.reportingEndEvent(sequenceId, ComponentType.ENDPOINT, holder); } } }
String endpointKey = ((IndirectEndpoint) endpoint).getKey(); endpoint = synapseInMsgCtx.getEndpoint(endpointKey);