public void enable ( ConduitSelectorHolder conduitSelectorHolder , SLPropertiesMatcher matcher , String selectionStrategy ) { LocatorTargetSelector selector = new LocatorTargetSelector ( ) ; selector . setEndpoint ( conduitSelectorHolder . getConduitSelector ( ) . getEndpoint ( ) ) ; String actualStrategy = selectionStrategy != null ? selectionStrategy : defaultLocatorSelectionStrategy ; LocatorSelectionStrategy locatorSelectionStrategy = getLocatorSelectionStrategy ( actualStrategy ) ; locatorSelectionStrategy . setServiceLocator ( locatorClient ) ; if ( matcher != null ) { locatorSelectionStrategy . setMatcher ( matcher ) ; } selector . setLocatorSelectionStrategy ( locatorSelectionStrategy ) ; if ( LOG . isLoggable ( Level . INFO ) ) { LOG . log ( Level . INFO , "Client enabled with strategy " + locatorSelectionStrategy . getClass ( ) . getName ( ) + "." ) ; } conduitSelectorHolder . setConduitSelector ( selector ) ; if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "Successfully enabled client " + conduitSelectorHolder + " for the service locator" ) ; } }
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 locatorSelectionStrategy and then set as selector in the conduitSelectorHolder .