idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
147,200
private static TransportType map2TransportType ( String transportId ) { TransportType type ; if ( CXF_HTTP_TRANSPORT_ID . equals ( transportId ) || SOAP_HTTP_TRANSPORT_ID . equals ( transportId ) ) { type = TransportType . HTTP ; } else { type = TransportType . OTHER ; } return type ; }
Maps a transportId to its corresponding TransportType .
147,201
private EventTypeEnum getEventType ( Message message ) { boolean isRequestor = MessageUtils . isRequestor ( message ) ; boolean isFault = MessageUtils . isFault ( message ) ; boolean isOutbound = MessageUtils . isOutbound ( message ) ; if ( ! isFault && isRestMessage ( message ) ) { isFault = ( message . getExchange ( ...
Gets the event type from message .
147,202
protected String getPayload ( Message message ) { try { String encoding = ( String ) message . get ( Message . ENCODING ) ; if ( encoding == null ) { encoding = "UTF-8" ; } CachedOutputStream cos = message . getContent ( CachedOutputStream . class ) ; if ( cos == null ) { LOG . warning ( "Could not find CachedOutputStr...
Gets the message payload .
147,203
private void handleContentLength ( Event event ) { if ( event . getContent ( ) == null ) { return ; } if ( maxContentLength == - 1 || event . getContent ( ) . length ( ) <= maxContentLength ) { return ; } if ( maxContentLength < CUT_START_TAG . length ( ) + CUT_END_TAG . length ( ) ) { event . setContent ( "" ) ; event...
Handle content length .
147,204
private Map < String , Criteria > getCriterias ( Map < String , String [ ] > params ) { Map < String , Criteria > result = new HashMap < String , Criteria > ( ) ; for ( Map . Entry < String , String [ ] > param : params . entrySet ( ) ) { for ( Criteria criteria : FILTER_CRITERIAS ) { if ( criteria . getName ( ) . equa...
Reads filter parameters .
147,205
public void setSessionTimeout ( int timeout ) { ( ( ZKBackend ) getBackend ( ) ) . setSessionTimeout ( timeout ) ; if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( "Locator session timeout set to: " + timeout ) ; } }
Specify the time out of the session established at the server . The session is kept alive by requests sent by this client object . If the session is idle for a period of time that would timeout the session the client will send a PING request to keep the session alive .
147,206
public void racRent ( ) { pos = pos - 1 ; String userName = CarSearch . getLastSearchParams ( ) [ 0 ] ; String pickupDate = CarSearch . getLastSearchParams ( ) [ 1 ] ; String returnDate = CarSearch . getLastSearchParams ( ) [ 2 ] ; this . searcher . search ( userName , pickupDate , returnDate ) ; if ( searcher != null ...
Rent a car available in the last serach result
147,207
public void addProperty ( String name , String ... values ) { List < String > valueList = new ArrayList < String > ( ) ; for ( String value : values ) { valueList . add ( value . trim ( ) ) ; } properties . put ( name . trim ( ) , valueList ) ; }
Add a property with the given name and the given list of values to this Properties object . Name and values are trimmed before the property is added .
147,208
protected SingleBusLocatorRegistrar getRegistrar ( Bus bus ) { SingleBusLocatorRegistrar registrar = busRegistrars . get ( bus ) ; if ( registrar == null ) { check ( locatorClient , "serviceLocator" , "registerService" ) ; registrar = new SingleBusLocatorRegistrar ( bus ) ; registrar . setServiceLocator ( locatorClient...
Retrieves the registar linked to the bus . Creates a new registar is not present .
147,209
public void useXopAttachmentServiceWithWebClient ( ) throws Exception { final String serviceURI = "http://localhost:" + port + "/services/attachments/xop" ; JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean ( ) ; factoryBean . setAddress ( serviceURI ) ; factoryBean . setProperties ( Collections . singlet...
Writes and reads the XOP attachment using a CXF JAX - RS WebClient . Note that WebClient is created with the help of JAXRSClientFactoryBean . JAXRSClientFactoryBean can be used when neither of the WebClient factory methods is appropriate . For example in this case an mtom - enabled property is set on the factory bean f...
147,210
public void useXopAttachmentServiceWithProxy ( ) throws Exception { final String serviceURI = "http://localhost:" + port + "/services/attachments" ; XopAttachmentService proxy = JAXRSClientFactory . create ( serviceURI , XopAttachmentService . class ) ; XopBean xop = createXopBean ( ) ; System . out . println ( ) ; Sys...
Writes and reads the XOP attachment using a CXF JAX - RS Proxy The proxy automatically sets the mtom - enabled property by checking the CXF EndpointProperty set on the XopAttachment interface .
147,211
private XopBean createXopBean ( ) throws Exception { XopBean xop = new XopBean ( ) ; xop . setName ( "xopName" ) ; InputStream is = getClass ( ) . getResourceAsStream ( "/java.jpg" ) ; byte [ ] data = IOUtils . readBytesFromStream ( is ) ; xop . setBytes ( data ) ; xop . setDatahandler ( new DataHandler ( new ByteArray...
Creates a XopBean . The image on the disk is included as a byte array a DataHandler and java . awt . Image
147,212
private void verifyXopResponse ( XopBean xopOriginal , XopBean xopResponse ) { if ( ! Arrays . equals ( xopResponse . getBytes ( ) , xopOriginal . getBytes ( ) ) ) { throw new RuntimeException ( "Received XOP attachment is corrupted" ) ; } System . out . println ( ) ; System . out . println ( "XOP attachment has been s...
Verifies that the received image is identical to the original one .
147,213
public void setMonitoringService ( org . talend . esb . sam . common . service . MonitoringService monitoringService ) { this . monitoringService = monitoringService ; }
Sets the monitoring service .
147,214
private static void throwFault ( String code , String message , Throwable t ) throws PutEventsFault { if ( LOG . isLoggable ( Level . SEVERE ) ) { LOG . log ( Level . SEVERE , "Throw Fault " + code + " " + message , t ) ; } FaultType faultType = new FaultType ( ) ; faultType . setFaultCode ( code ) ; faultType . setFau...
Throw fault .
147,215
public void putEvents ( List < Event > events ) { Exception lastException ; List < EventType > eventTypes = new ArrayList < EventType > ( ) ; for ( Event event : events ) { EventType eventType = EventMapper . map ( event ) ; eventTypes . add ( eventType ) ; } int i = 0 ; lastException = null ; while ( i < numberOfRetri...
Sends all events to the web service . Events will be transformed with mapper before sending .
147,216
private EventType createEventType ( EventEnumType type ) { EventType eventType = new EventType ( ) ; eventType . setTimestamp ( Converter . convertDate ( new Date ( ) ) ) ; eventType . setEventType ( type ) ; OriginatorType origType = new OriginatorType ( ) ; origType . setProcessId ( Converter . getPID ( ) ) ; try { I...
Creates the event type .
147,217
private void putEvent ( EventType eventType ) throws Exception { List < EventType > eventTypes = Collections . singletonList ( eventType ) ; int i ; for ( i = 0 ; i < retryNum ; ++ i ) { try { monitoringService . putEvents ( eventTypes ) ; break ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , e . getMessage ( ...
Put event .
147,218
private boolean checkConfig ( BundleContext context ) throws Exception { ServiceReference serviceRef = context . getServiceReference ( ConfigurationAdmin . class . getName ( ) ) ; ConfigurationAdmin cfgAdmin = ( ConfigurationAdmin ) context . getService ( serviceRef ) ; Configuration config = cfgAdmin . getConfiguratio...
Check config .
147,219
private void initWsClient ( BundleContext context ) throws Exception { ServiceReference serviceRef = context . getServiceReference ( ConfigurationAdmin . class . getName ( ) ) ; ConfigurationAdmin cfgAdmin = ( ConfigurationAdmin ) context . getService ( serviceRef ) ; Configuration config = cfgAdmin . getConfiguration ...
Inits the ws client .
147,220
protected void handleResponseOut ( T message ) throws Fault { Message reqMsg = message . getExchange ( ) . getInMessage ( ) ; if ( reqMsg == null ) { LOG . warning ( "InMessage is null!" ) ; return ; } Exchange ex = reqMsg . getExchange ( ) ; if ( ex . isOneWay ( ) ) { return ; } String reqFid = FlowIdHelper . getFlowI...
Handling out responce .
147,221
protected void handleRequestOut ( T message ) throws Fault { String flowId = FlowIdHelper . getFlowId ( message ) ; if ( flowId == null && message . containsKey ( PhaseInterceptorChain . PREVIOUS_MESSAGE ) ) { @ SuppressWarnings ( "unchecked" ) WeakReference < Message > wrPreviousMessage = ( WeakReference < Message > )...
Handling out request .
147,222
protected void handleINEvent ( Exchange exchange , String reqFid ) throws Fault { Message inMsg = exchange . getInMessage ( ) ; EventProducerInterceptor epi = null ; FlowIdHelper . setFlowId ( inMsg , reqFid ) ; ListIterator < Interceptor < ? extends Message > > interceptors = inMsg . getInterceptorChain ( ) . getItera...
Calling EventProducerInterceptor in case of logging faults .
147,223
public void setDialect ( String dialect ) { String [ ] scripts = createScripts . get ( dialect ) ; createSql = scripts [ 0 ] ; createSqlInd = scripts [ 1 ] ; }
Sets the database dialect .
147,224
public static Event map ( EventType eventType ) { Event event = new Event ( ) ; event . setEventType ( mapEventTypeEnum ( eventType . getEventType ( ) ) ) ; Date date = ( eventType . getTimestamp ( ) == null ) ? new Date ( ) : eventType . getTimestamp ( ) . toGregorianCalendar ( ) . getTime ( ) ; event . setTimestamp (...
Map the EventType .
147,225
private static Map < String , String > mapCustomInfo ( CustomInfoType ciType ) { Map < String , String > customInfo = new HashMap < String , String > ( ) ; if ( ciType != null ) { for ( CustomInfoType . Item item : ciType . getItem ( ) ) { customInfo . put ( item . getKey ( ) , item . getValue ( ) ) ; } } return custom...
Map custom info .
147,226
private static String mapContent ( DataHandler dh ) { if ( dh == null ) { return "" ; } try { InputStream is = dh . getInputStream ( ) ; String content = IOUtils . toString ( is ) ; is . close ( ) ; return content ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Map content .
147,227
private static MessageInfo mapMessageInfo ( MessageInfoType messageInfoType ) { MessageInfo messageInfo = new MessageInfo ( ) ; if ( messageInfoType != null ) { messageInfo . setFlowId ( messageInfoType . getFlowId ( ) ) ; messageInfo . setMessageId ( messageInfoType . getMessageId ( ) ) ; messageInfo . setOperationNam...
Map message info .
147,228
private static Originator mapOriginatorType ( OriginatorType originatorType ) { Originator originator = new Originator ( ) ; if ( originatorType != null ) { originator . setCustomId ( originatorType . getCustomId ( ) ) ; originator . setHostname ( originatorType . getHostname ( ) ) ; originator . setIp ( originatorType...
Map originator type .
147,229
private static EventTypeEnum mapEventTypeEnum ( EventEnumType eventType ) { if ( eventType != null ) { return EventTypeEnum . valueOf ( eventType . name ( ) ) ; } return EventTypeEnum . UNKNOWN ; }
Map event type enum .
147,230
public void useNewSOAPService ( boolean direct ) throws Exception { URL wsdlURL = getClass ( ) . getResource ( "/CustomerServiceNew.wsdl" ) ; org . customer . service . CustomerServiceService service = new org . customer . service . CustomerServiceService ( wsdlURL ) ; org . customer . service . CustomerService custome...
New SOAP client uses new SOAP service .
147,231
public void useNewSOAPServiceWithOldClient ( ) throws Exception { URL wsdlURL = getClass ( ) . getResource ( "/CustomerServiceNew.wsdl" ) ; com . example . customerservice . CustomerServiceService service = new com . example . customerservice . CustomerServiceService ( wsdlURL ) ; com . example . customerservice . Cust...
Old SOAP client uses new SOAP service
147,232
public void useNewSOAPServiceWithOldClientAndRedirection ( ) throws Exception { URL wsdlURL = getClass ( ) . getResource ( "/CustomerService.wsdl" ) ; com . example . customerservice . CustomerServiceService service = new com . example . customerservice . CustomerServiceService ( wsdlURL ) ; com . example . customerser...
Old SOAP client uses new SOAP service with the redirection to the new endpoint and transformation on the server side
147,233
private void addTransformInterceptors ( List < Interceptor < ? > > inInterceptors , List < Interceptor < ? > > outInterceptors , boolean newClient ) { Map < String , String > newToOldTransformMap = new HashMap < String , String > ( ) ; newToOldTransformMap . put ( "{http://customer/v2}*" , "{http://customer/v1}*" ) ; M...
Prepares transformation interceptors for a client .
147,234
@ SuppressWarnings ( "unused" ) @ XmlAttribute ( name = "id" ) private String getXmlID ( ) { return String . format ( "%s-%s" , this . getClass ( ) . getSimpleName ( ) , Long . valueOf ( id ) ) ; }
to do with XmlId value being strictly of type String
147,235
private void stopAllServersAndRemoveCamelContext ( CamelContext camelContext ) { log . debug ( "Stopping all servers associated with {}" , camelContext ) ; List < SingleBusLocatorRegistrar > registrars = locatorRegistrar . getAllRegistars ( camelContext ) ; registrars . forEach ( registrar -> registrar . stopAllServers...
Stops all servers linked with the current camel context
147,236
public static EventType map ( Event event ) { EventType eventType = new EventType ( ) ; eventType . setTimestamp ( Converter . convertDate ( event . getTimestamp ( ) ) ) ; eventType . setEventType ( convertEventType ( event . getEventType ( ) ) ) ; OriginatorType origType = mapOriginator ( event . getOriginator ( ) ) ;...
convert Event bean to EventType manually .
147,237
private static DataHandler getDataHandlerForString ( Event event ) { try { return new DataHandler ( new ByteDataSource ( event . getContent ( ) . getBytes ( "UTF-8" ) ) ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } }
Gets the data handler from event .
147,238
private static MessageInfoType mapMessageInfo ( MessageInfo messageInfo ) { if ( messageInfo == null ) { return null ; } MessageInfoType miType = new MessageInfoType ( ) ; miType . setMessageId ( messageInfo . getMessageId ( ) ) ; miType . setFlowId ( messageInfo . getFlowId ( ) ) ; miType . setPorttype ( convertString...
Mapping message info .
147,239
private static OriginatorType mapOriginator ( Originator originator ) { if ( originator == null ) { return null ; } OriginatorType origType = new OriginatorType ( ) ; origType . setProcessId ( originator . getProcessId ( ) ) ; origType . setIp ( originator . getIp ( ) ) ; origType . setHostname ( originator . getHostna...
Mapping originator .
147,240
private static CustomInfoType convertCustomInfo ( Map < String , String > customInfo ) { if ( customInfo == null ) { return null ; } CustomInfoType ciType = new CustomInfoType ( ) ; for ( Entry < String , String > entry : customInfo . entrySet ( ) ) { CustomInfoType . Item cItem = new CustomInfoType . Item ( ) ; cItem ...
Convert custom info .
147,241
private static EventEnumType convertEventType ( org . talend . esb . sam . common . event . EventTypeEnum eventType ) { if ( eventType == null ) { return null ; } return EventEnumType . valueOf ( eventType . name ( ) ) ; }
Convert event type .
147,242
private static QName convertString ( String str ) { if ( str != null ) { return QName . valueOf ( str ) ; } else { return null ; } }
Convert string to qname .
147,243
public void logException ( Level level ) { if ( ! LOG . isLoggable ( level ) ) { return ; } final StringBuilder builder = new StringBuilder ( ) ; builder . append ( "\n----------------------------------------------------" ) ; builder . append ( "\nMonitoringException" ) ; builder . append ( "\n-------------------------...
Prints the error message as log message .
147,244
private LocatorSelectionStrategy getLocatorSelectionStrategy ( String locatorSelectionStrategy ) { if ( null == locatorSelectionStrategy ) { return locatorSelectionStrategyMap . get ( DEFAULT_STRATEGY ) . getInstance ( ) ; } if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "Strategy " + locatorSele...
If the String argument locatorSelectionStrategy is as key in the map representing the locatorSelectionStrategies the corresponding strategy is selected else it remains unchanged .
147,245
@ Value ( "${locator.strategy}" ) public void setDefaultLocatorSelectionStrategy ( String defaultLocatorSelectionStrategy ) { this . defaultLocatorSelectionStrategy = defaultLocatorSelectionStrategy ; if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "Default strategy " + defaultLocatorSelectionStra...
If the String argument defaultLocatorSelectionStrategy is as key in the map representing the locatorSelectionStrategies the corresponding strategy is selected and set as default strategy else both the selected strategy and the default strategy remain unchanged .
147,246
public void enable ( ConduitSelectorHolder conduitSelectorHolder , SLPropertiesMatcher matcher , String selectionStrategy ) { LocatorTargetSelector selector = new LocatorTargetSelector ( ) ; selector . setEndpoint ( conduitSelectorHolder . getConduitSelector ( ) . getEndpoint ( ) ) ; String actualStrategy = selectionSt...
The selectionStrategy given as String argument is selected as locatorSelectionStrategy . If selectionStrategy is null the defaultLocatorSelectionStrategy is used instead . Then the new locatorSelectionStrategy is connected to the locatorClient and the matcher . A new LocatorTargetSelector is created set to the locatorS...
147,247
public static void applyWsdlExtensions ( Bus bus ) { ExtensionRegistry registry = bus . getExtension ( WSDLManager . class ) . getExtensionRegistry ( ) ; try { JAXBExtensionHelper . addExtensions ( registry , javax . wsdl . Definition . class , org . talend . esb . mep . requestcallback . impl . wsdl . PLType . class )...
Adds JAXB WSDL extensions to allow work with custom WSDL elements such as \ partner - link \
147,248
public void setQueue ( EventQueue queue ) { if ( epi == null ) { MessageToEventMapper mapper = new MessageToEventMapper ( ) ; mapper . setMaxContentLength ( maxContentLength ) ; epi = new EventProducerInterceptor ( mapper , queue ) ; } }
Sets the queue .
147,249
private boolean detectWSAddressingFeature ( InterceptorProvider provider , Bus bus ) { if ( bus . getFeatures ( ) != null ) { Iterator < Feature > busFeatures = bus . getFeatures ( ) . iterator ( ) ; while ( busFeatures . hasNext ( ) ) { Feature busFeature = busFeatures . next ( ) ; if ( busFeature instanceof WSAddress...
detect if WS Addressing feature already enabled .
147,250
private void addWSAddressingInterceptors ( InterceptorProvider provider ) { MAPAggregator mapAggregator = new MAPAggregator ( ) ; MAPCodec mapCodec = new MAPCodec ( ) ; provider . getInInterceptors ( ) . add ( mapAggregator ) ; provider . getInInterceptors ( ) . add ( mapCodec ) ; provider . getOutInterceptors ( ) . ad...
Add WSAddressing Interceptors to InterceptorProvider in order to using AddressingProperties to get MessageID .
147,251
public static String readFlowId ( Message message ) { if ( ! ( message instanceof SoapMessage ) ) { return null ; } String flowId = null ; Header hdFlowId = ( ( SoapMessage ) message ) . getHeader ( FLOW_ID_QNAME ) ; if ( hdFlowId != null ) { if ( hdFlowId . getObject ( ) instanceof String ) { flowId = ( String ) hdFlo...
Read flow id .
147,252
public static void writeFlowId ( Message message , String flowId ) { if ( ! ( message instanceof SoapMessage ) ) { return ; } SoapMessage soapMessage = ( SoapMessage ) message ; Header hdFlowId = soapMessage . getHeader ( FLOW_ID_QNAME ) ; if ( hdFlowId != null ) { LOG . warning ( "FlowId already existing in soap heade...
Write flow id to message .
147,253
public static STSClient createSTSX509Client ( Bus bus , Map < String , String > stsProps ) { final STSClient stsClient = createClient ( bus , stsProps ) ; stsClient . setWsdlLocation ( stsProps . get ( STS_X509_WSDL_LOCATION ) ) ; stsClient . setEndpointQName ( new QName ( stsProps . get ( STS_NAMESPACE ) , stsProps . ...
for bpm connector
147,254
private boolean isSecuredByPolicy ( Server server ) { boolean isSecured = false ; EndpointInfo ei = server . getEndpoint ( ) . getEndpointInfo ( ) ; PolicyEngine pe = bus . getExtension ( PolicyEngine . class ) ; if ( null == pe ) { LOG . finest ( "No Policy engine found" ) ; return isSecured ; } Destination destinatio...
Is the transport secured by a policy
147,255
private boolean isSecuredByProperty ( Server server ) { boolean isSecured = false ; Object value = server . getEndpoint ( ) . get ( "org.talend.tesb.endpoint.secured" ) ; if ( value instanceof String ) { try { isSecured = Boolean . valueOf ( ( String ) value ) ; } catch ( Exception ex ) { } } return isSecured ; }
Is the transport secured by a JAX - WS property
147,256
private void writeCustomInfo ( Event event ) { for ( Map . Entry < String , String > customInfo : event . getCustomInfo ( ) . entrySet ( ) ) { long cust_id = dbDialect . getIncrementer ( ) . nextLongValue ( ) ; getJdbcTemplate ( ) . update ( "insert into EVENTS_CUSTOMINFO (ID, EVENT_ID, CUST_KEY, CUST_VALUE)" + " value...
write CustomInfo list into table .
147,257
private Map < String , String > readCustomInfo ( long eventId ) { List < Map < String , Object > > rows = getJdbcTemplate ( ) . queryForList ( "select * from EVENTS_CUSTOMINFO where EVENT_ID=" + eventId ) ; Map < String , String > customInfo = new HashMap < String , String > ( rows . size ( ) ) ; for ( Map < String , O...
read CustomInfo list from table .
147,258
private String toSQLPattern ( String attribute ) { String pattern = attribute . replace ( "*" , "%" ) ; if ( ! pattern . startsWith ( "%" ) ) { pattern = "%" + pattern ; } if ( ! pattern . endsWith ( "%" ) ) { pattern = pattern . concat ( "%" ) ; } return pattern ; }
To sql pattern .
147,259
private void checkMessageID ( Message message ) { if ( ! MessageUtils . isOutbound ( message ) ) return ; AddressingProperties maps = ContextUtils . retrieveMAPs ( message , false , MessageUtils . isOutbound ( message ) ) ; if ( maps == null ) { maps = new AddressingProperties ( ) ; } if ( maps . getMessageID ( ) == nu...
check if MessageID exists in the message if not only generate new MessageID for outbound message .
147,260
public static String getCorrelationId ( Message message ) { String correlationId = ( String ) message . get ( CORRELATION_ID_KEY ) ; if ( null == correlationId ) { correlationId = readCorrelationId ( message ) ; } if ( null == correlationId ) { correlationId = readCorrelationIdSoap ( message ) ; } return correlationId ...
Get CorrelationId from message .
147,261
public static String readCorrelationId ( Message message ) { String correlationId = null ; Map < String , List < String > > headers = getOrCreateProtocolHeader ( message ) ; List < String > correlationIds = headers . get ( CORRELATION_ID_KEY ) ; if ( correlationIds != null && correlationIds . size ( ) > 0 ) { correlati...
Read correlation id from message .
147,262
private static Map < String , List < String > > getOrCreateProtocolHeader ( Message message ) { Map < String , List < String > > headers = CastUtils . cast ( ( Map < ? , ? > ) message . get ( Message . PROTOCOL_HEADERS ) ) ; if ( headers == null ) { headers = new HashMap < String , List < String > > ( ) ; message . put...
Gets the or create protocol header .
147,263
public void putEvents ( List < Event > events ) { List < Event > filteredEvents = filterEvents ( events ) ; executeHandlers ( filteredEvents ) ; for ( Event event : filteredEvents ) { persistenceHandler . writeEvent ( event ) ; } }
Executes all event manipulating handler and writes the event with persist handler .
147,264
private List < Event > filterEvents ( List < Event > events ) { List < Event > filteredEvents = new ArrayList < Event > ( ) ; for ( Event event : events ) { if ( ! filter ( event ) ) { filteredEvents . add ( event ) ; } } return filteredEvents ; }
Filter events .
147,265
public boolean filter ( Event event ) { LOG . info ( "StringContentFilter called" ) ; if ( wordsToFilter != null ) { for ( String filterWord : wordsToFilter ) { if ( event . getContent ( ) != null && - 1 != event . getContent ( ) . indexOf ( filterWord ) ) { return true ; } } } return false ; }
Filter event if word occurs in wordsToFilter .
147,266
public String checkIn ( byte [ ] data ) { String id = UUID . randomUUID ( ) . toString ( ) ; dataMap . put ( id , data ) ; return id ; }
Store the given data and return a uuid for later retrieval of the data
147,267
private static void setupFlowId ( SoapMessage message ) { String flowId = FlowIdHelper . getFlowId ( message ) ; if ( flowId == null ) { flowId = FlowIdProtocolHeaderCodec . readFlowId ( message ) ; } if ( flowId == null ) { flowId = FlowIdSoapCodec . readFlowId ( message ) ; } if ( flowId == null ) { Exchange ex = mes...
This functions reads SAM flowId and sets it as message property for subsequent store in CallContext
147,268
private static X509Certificate getReqSigCert ( Message message ) { List < WSHandlerResult > results = CastUtils . cast ( ( List < ? > ) message . getExchange ( ) . getInMessage ( ) . get ( WSHandlerConstants . RECV_RESULTS ) ) ; if ( results == null ) { return null ; } for ( WSHandlerResult rResult : results ) { List <...
Refactor the method into public CXF utility and reuse it from CXF instead copy&paste
147,269
private void useSearchService ( ) throws Exception { System . out . println ( "Searching..." ) ; WebClient wc = WebClient . create ( "http://localhost:" + port + "/services/personservice/search" ) ; WebClient . getConfig ( wc ) . getHttpConduit ( ) . getClient ( ) . setReceiveTimeout ( 10000000L ) ; wc . accept ( Media...
SearchService is a service which shares the information about Persons with the PersonService . It lets users search for individual people using simple or complex search expressions . The interaction with this service also verifies that the JAX - RS server is capable of supporting multiple root resource classes
147,270
public void useSimpleProxy ( ) { String webAppAddress = "http://localhost:" + port + "/services/personservice" ; PersonService proxy = JAXRSClientFactory . create ( webAppAddress , PersonService . class ) ; new PersonServiceProxyClient ( proxy ) . useService ( ) ; }
This function uses a proxy which is capable of transforming typed invocations into proper HTTP calls which will be understood by RESTful services . This works for subresources as well . Interfaces and concrete classes can be proxified in the latter case a CGLIB runtime dependency is needed . CXF JAX - RS proxies can be...
147,271
public static String readCorrelationId ( Message message ) { if ( ! ( message instanceof SoapMessage ) ) { return null ; } String correlationId = null ; Header hdCorrelationId = ( ( SoapMessage ) message ) . getHeader ( CORRELATION_ID_QNAME ) ; if ( hdCorrelationId != null ) { if ( hdCorrelationId . getObject ( ) insta...
Read correlation id .
147,272
public static void writeCorrelationId ( Message message , String correlationId ) { if ( ! ( message instanceof SoapMessage ) ) { return ; } SoapMessage soapMessage = ( SoapMessage ) message ; Header hdCorrelationId = soapMessage . getHeader ( CORRELATION_ID_QNAME ) ; if ( hdCorrelationId != null ) { LOG . warning ( "Co...
Write correlation id to message .
147,273
public void handleEvent ( Event event ) { LOG . fine ( "ContentLengthHandler called" ) ; if ( CUT_START_TAG . length ( ) + CUT_END_TAG . length ( ) > length ) { LOG . warning ( "Trying to cut content. But length is shorter then needed for " + CUT_START_TAG + CUT_END_TAG + ". So content is skipped." ) ; event . setConte...
Cut the message content to the configured length .
147,274
public static XMLGregorianCalendar convertDate ( Date date ) { if ( date == null ) { return null ; } GregorianCalendar gc = new GregorianCalendar ( ) ; gc . setTimeInMillis ( date . getTime ( ) ) ; try { return getDatatypeFactory ( ) . newXMLGregorianCalendar ( gc ) ; } catch ( DatatypeConfigurationException ex ) { ret...
convert Date to XMLGregorianCalendar .
147,275
public static CustomInfo getOrCreateCustomInfo ( Message message ) { CustomInfo customInfo = message . get ( CustomInfo . class ) ; if ( customInfo == null ) { customInfo = new CustomInfo ( ) ; message . put ( CustomInfo . class , customInfo ) ; } return customInfo ; }
Access the customInfo of a message using this accessor . The CustomInfo map will be automatically created and stored in the event if it is not yet present
147,276
public static boolean isMessageContentToBeLogged ( final Message message , final boolean logMessageContent , boolean logMessageContentOverride ) { if ( ! logMessageContentOverride ) { return logMessageContent ; } Object logMessageContentExtObj = message . getContextualProperty ( EXTERNAL_PROPERTY_NAME ) ; if ( null == ...
If the org . talend . esb . sam . agent . log . messageContent property value is true then log the message content If it is false then skip the message content logging Else fall back to global property log . messageContent
147,277
public void initLocator ( ) throws InterruptedException , ServiceLocatorException { if ( locatorClient == null ) { if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( "Instantiate locatorClient client for Locator Server " + locatorEndpoints + "..." ) ; } ServiceLocatorImpl client = new ServiceLocatorImpl ( ) ; clie...
Instantiate Service Locator client . After successful instantiation establish a connection to the Service Locator server . This method will be called if property locatorClient is null . For this purpose was defined additional properties to instantiate ServiceLocatorImpl .
147,278
public void disconnectLocator ( ) throws InterruptedException , ServiceLocatorException { if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( "Destroy Locator client" ) ; } if ( endpointCollector != null ) { endpointCollector . stopScheduledCollection ( ) ; } if ( locatorClient != null ) { locatorClient . disconnec...
Should use as destroy method . Disconnects from a Service Locator server . All endpoints that were registered before are removed from the server . Set property locatorClient to null .
147,279
List < W3CEndpointReference > lookupEndpoints ( QName serviceName , MatcherDataType matcherData ) throws ServiceLocatorFault , InterruptedExceptionFault { SLPropertiesMatcher matcher = createMatcher ( matcherData ) ; List < String > names = null ; List < W3CEndpointReference > result = new ArrayList < W3CEndpointRefere...
For the given service name return list of endpoint references currently registered at the service locator server endpoints .
147,280
private List < String > getRotatedList ( List < String > strings ) { int index = RANDOM . nextInt ( strings . size ( ) ) ; List < String > rotated = new ArrayList < String > ( ) ; for ( int i = 0 ; i < strings . size ( ) ; i ++ ) { rotated . add ( strings . get ( index ) ) ; index = ( index + 1 ) % strings . size ( ) ;...
Rotate list of String . Used for randomize selection of received endpoints
147,281
public void start ( String [ ] arguments ) { boolean notStarted = ! started . getAndSet ( true ) ; if ( notStarted ) { start ( new MultiInstanceWorkloadStrategy ( factory , name , arguments , endpointRegistry , execService ) ) ; } }
Start the operation by instantiating the first job instance in a separate Thread .
147,282
protected void processStart ( Endpoint endpoint , EventTypeEnum eventType ) { if ( ! sendLifecycleEvent ) { return ; } Event event = createEvent ( endpoint , eventType ) ; queue . add ( event ) ; }
Process start .
147,283
protected void processStop ( Endpoint endpoint , EventTypeEnum eventType ) { if ( ! sendLifecycleEvent ) { return ; } Event event = createEvent ( endpoint , eventType ) ; monitoringServiceClient . putEvents ( Collections . singletonList ( event ) ) ; if ( LOG . isLoggable ( Level . INFO ) ) { LOG . info ( "Send " + eve...
Process stop .
147,284
private Event createEvent ( Endpoint endpoint , EventTypeEnum type ) { Event event = new Event ( ) ; MessageInfo messageInfo = new MessageInfo ( ) ; Originator originator = new Originator ( ) ; event . setMessageInfo ( messageInfo ) ; event . setOriginator ( originator ) ; Date date = new Date ( ) ; event . setTimestam...
Creates the event for endpoint with specific type .
147,285
public void useOldRESTService ( ) throws Exception { List < Object > providers = createJAXRSProviders ( ) ; com . example . customerservice . CustomerService customerService = JAXRSClientFactory . createFromModel ( "http://localhost:" + port + "/examples/direct/rest" , com . example . customerservice . CustomerService ...
Old REST client uses old REST service
147,286
public void useNewRESTService ( String address ) throws Exception { List < Object > providers = createJAXRSProviders ( ) ; org . customer . service . CustomerService customerService = JAXRSClientFactory . createFromModel ( address , org . customer . service . CustomerService . class , "classpath:/model/CustomerService-...
New REST client uses new REST service
147,287
public void useNewRESTServiceWithOldClient ( ) throws Exception { List < Object > providers = createJAXRSProviders ( ) ; com . example . customerservice . CustomerService customerService = JAXRSClientFactory . createFromModel ( "http://localhost:" + port + "/examples/direct/new-rest" , com . example . customerservice ....
Old REST client uses new REST service
147,288
public void init ( ) { if ( bus != null && sendLifecycleEvent ) { ServerLifeCycleManager slcm = bus . getExtension ( ServerLifeCycleManager . class ) ; if ( null != slcm ) { ServiceListenerImpl svrListener = new ServiceListenerImpl ( ) ; svrListener . setSendLifecycleEvent ( sendLifecycleEvent ) ; svrListener . setQueu...
Instantiates a new event collector .
147,289
public void setDefaultInterval ( long defaultInterval ) { if ( defaultInterval <= 0 ) { LOG . severe ( "collector.scheduler.interval must be greater than 0. Recommended value is 500-1000. Current value is " + defaultInterval ) ; throw new IllegalArgumentException ( "collector.scheduler.interval must be greater than 0. ...
Set default interval for sending events to monitoring service . DefaultInterval will be used by scheduler .
147,290
public void sendEventsFromQueue ( ) { if ( null == queue || stopSending ) { return ; } LOG . fine ( "Scheduler called for sending events" ) ; int packageSize = getEventsPerMessageCall ( ) ; while ( ! queue . isEmpty ( ) ) { final List < Event > list = new ArrayList < Event > ( ) ; int i = 0 ; while ( i < packageSize &&...
Method will be executed asynchronously .
147,291
private void sendEvents ( final List < Event > events ) { if ( null != handlers ) { for ( EventHandler current : handlers ) { for ( Event event : events ) { current . handleEvent ( event ) ; } } } LOG . info ( "Put events(" + events . size ( ) + ") to Monitoring Server." ) ; try { if ( sendToEventadmin ) { EventAdminPu...
Sends the events to monitoring service client .
147,292
public void start ( String [ ] arguments ) { boolean notStarted = ! started . getAndSet ( true ) ; if ( notStarted ) { start ( new SingleInstanceWorkloadStrategy ( job , name , arguments , endpointRegistry , execService ) ) ; } }
Starts the one and only job instance in a separate Thread . Should be called exactly one time before the operation is stopped .
147,293
public static void writeCorrelationId ( Message message , String correlationId ) { Map < String , List < String > > headers = getOrCreateProtocolHeader ( message ) ; headers . put ( CORRELATIONID_HTTP_HEADER_NAME , Collections . singletonList ( correlationId ) ) ; if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine (...
Write correlation id .
147,294
public static String readFlowId ( Message message ) { String flowId = null ; Map < String , List < String > > headers = getOrCreateProtocolHeader ( message ) ; List < String > flowIds = headers . get ( FLOWID_HTTP_HEADER_NAME ) ; if ( flowIds != null && flowIds . size ( ) > 0 ) { flowId = flowIds . get ( 0 ) ; if ( LOG...
Read flow id from message .
147,295
public static void writeFlowId ( Message message , String flowId ) { Map < String , List < String > > headers = getOrCreateProtocolHeader ( message ) ; headers . put ( FLOWID_HTTP_HEADER_NAME , Collections . singletonList ( flowId ) ) ; if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( "HTTP header '" + FLOWID_HT...
Write flow id .
147,296
public static void addInterceptors ( InterceptorProvider provider ) { PhaseManager phases = BusFactory . getDefaultBus ( ) . getExtension ( PhaseManager . class ) ; for ( Phase p : phases . getInPhases ( ) ) { provider . getInInterceptors ( ) . add ( new DemoInterceptor ( p . getName ( ) ) ) ; provider . getInFaultInte...
This method will add a DemoInterceptor into every in and every out phase of the interceptor chains .
147,297
private boolean somethingMayHaveChanged ( PhaseInterceptorChain pic ) { Iterator < Interceptor < ? extends Message > > it = pic . iterator ( ) ; Interceptor < ? extends Message > last = null ; while ( it . hasNext ( ) ) { Interceptor < ? extends Message > cur = it . next ( ) ; if ( cur == this ) { if ( last instanceof ...
as we know nothing has changed .
147,298
public void printInterceptorChain ( InterceptorChain chain ) { Iterator < Interceptor < ? extends Message > > it = chain . iterator ( ) ; String phase = "" ; StringBuilder builder = null ; while ( it . hasNext ( ) ) { Interceptor < ? extends Message > interceptor = it . next ( ) ; if ( interceptor instanceof DemoInterc...
Prints out the interceptor chain in a format that is easy to read . It also filters out instances of the DemoInterceptor so you can see what the chain would look like in a normal invokation .
147,299
public com . squareup . okhttp . Call getCharactersCharacterIdShipCall ( Integer characterId , String datasource , String ifNoneMatch , String token , final ApiCallback callback ) throws ApiException { Object localVarPostBody = new Object ( ) ; String localVarPath = "/v1/characters/{character_id}/ship/" . replaceAll ( ...
Build call for getCharactersCharacterIdShip