idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
4,600
public static NoResponseListener getInstance ( Batcher batcher ) { if ( batcher instanceof WriteBatcher ) { WriteFailureListener [ ] writeFailureListeners = ( ( WriteBatcher ) batcher ) . getBatchFailureListeners ( ) ; for ( WriteFailureListener writeFailureListener : writeFailureListeners ) { if ( writeFailureListener...
Returns the NoResponseListener instance registered with the Batcher .
4,601
public static void tearDownExample ( String host , int port , String user , String password , Authentication authType ) throws ResourceNotFoundException , ForbiddenUserException , FailedRequestException { DatabaseClient client = DatabaseClientFactory . newClient ( host , port , user , password , authType ) ; XMLDocumen...
clean up by deleting the read document and the example transform
4,602
protected ProgressUpdate newProgressUpdate ( QueryBatch batch , long startTime , long totalForThisUpdate , double timeSoFar ) { return new SimpleProgressUpdate ( batch , startTime , totalForThisUpdate , timeSoFar ) ; }
A subclass can override this to provide a different implementation of ProgressUpdate .
4,603
protected void invokeConsumer ( Consumer < ProgressUpdate > consumer , ProgressUpdate progressUpdate ) { try { consumer . accept ( progressUpdate ) ; } catch ( Throwable t ) { logger . error ( "Exception thrown by a Consumer<ProgressUpdate> consumer: " + consumer + "; progressUpdate: " + progressUpdate , t ) ; } }
Protected so that a subclass can override how a consumer is invoked particularly how an exception is handled .
4,604
public static void run ( ExampleProperties props ) throws IOException , ResourceNotFoundException , ForbiddenUserException , FailedRequestException { System . out . println ( "example: " + BatchManagerExample . class . getName ( ) ) ; installResourceExtension ( props . host , props . port , props . adminUser , props . ...
install and then use the resource extension
4,605
public static void setUpExample ( DatabaseClient client ) throws ResourceNotFoundException , ForbiddenUserException , FailedRequestException { XMLDocumentManager docMgr = client . newXMLDocumentManager ( ) ; StringHandle handle = new StringHandle ( ) ; docMgr . write ( "/batch/read1.xml" , handle . with ( "<read1/>" ) ...
create some documents to work with
4,606
private void buildSubjectCredentials ( ) throws LoginException { Subject subject = new Subject ( ) ; LoginContext lc = new LoginContext ( "Krb5LoginContext" , subject , null , ( krbOptions != null ) ? new KerberosLoginConfiguration ( krbOptions ) : new KerberosLoginConfiguration ( ) ) ; lc . login ( ) ; loginContext = ...
This method checks the validity of the TGT in the cache and build the Subject inside the LoginContext using Krb5LoginModule and the TGT cached by the Kerberos client . It assumes that a valid TGT is already present in the kerberos client s cache .
4,607
private String getClientPrincipalName ( ) { final Set < Principal > principalSet = loginContext . getSubject ( ) . getPrincipals ( ) ; if ( principalSet . size ( ) != 1 ) throw new IllegalStateException ( "Only one principal is expected. Found 0 or more than one principals :" + principalSet ) ; return principalSet . it...
This method is responsible for getting the client principal name from the subject s principal set
4,608
private String buildAuthorizationHeader ( String serverPrincipalName ) throws LoginException { final String clientPrincipal = getClientPrincipalName ( ) ; final CreateAuthorizationHeaderAction action = new CreateAuthorizationHeaderAction ( clientPrincipal , serverPrincipalName ) ; Set < Object > privateCreds = loginCon...
This method builds the Authorization header for Kerberos . It generates a request token based on the service ticket client principal name and time - stamp
4,609
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { InputSource . class } ; } public boolean isHandled ( Class < ? > type ) { return InputSource . class . isAssignableFrom ( type ) ; } public < C > ContentH...
Creates a factory to create a InputSourceHandle instance for a SAX InputSource .
4,610
public void process ( ContentHandler handler ) { try { if ( logger . isInfoEnabled ( ) ) logger . info ( "Processing input source with SAX content handler" ) ; XMLReader reader = makeReader ( false ) ; reader . setContentHandler ( handler ) ; reader . parse ( content ) ; } catch ( SAXException e ) { logger . error ( "F...
Reads the input source sending SAX events to the supplied content handler .
4,611
public void setQueryCriteria ( QueryDefinition querydef ) { this . querydef = querydef ; summary = null ; metrics = null ; facets = null ; warnings = null ; reports = null ; planEvents = null ; constraints = null ; events = null ; totalResults = - 1 ; start = - 1 ; pageLength = 0 ; snippetType = null ; qtext = null ; q...
Sets the query definition used in the search .
4,612
public String [ ] getFacetNames ( ) { if ( facets == null || facets . isEmpty ( ) ) { return new String [ 0 ] ; } Set < String > names = facets . keySet ( ) ; return names . toArray ( new String [ names . size ( ) ] ) ; }
Returns a list of the facet names returned in this search .
4,613
public FacetResult getFacetResult ( String name ) { if ( facets == null || facets . isEmpty ( ) ) { return null ; } return facets . get ( name ) ; }
Returns the named facet results .
4,614
public FacetResult [ ] getFacetResults ( ) { if ( facets == null || facets . isEmpty ( ) ) { return new FacetResult [ 0 ] ; } Collection < FacetResult > facetResults = facets . values ( ) ; return facetResults . toArray ( new FacetResult [ facetResults . size ( ) ] ) ; }
Returns an array of facet results for this search .
4,615
public Document getPlan ( ) { DOMHandle handle = getPlan ( new DOMHandle ( ) ) ; return ( handle == null ) ? null : handle . get ( ) ; }
Returns the query plan associated with this search .
4,616
public void processEvent ( QueryBatch batch ) { try { PlanBuilder . Plan exportPlan = exportFunction . apply ( batch ) ; for ( RowRecord record : rowManager . resultRows ( exportPlan ) ) { for ( Consumer < RowRecord > listener : opticExportListeners ) { try { listener . accept ( record ) ; } catch ( Throwable t ) { log...
This is the method QueryBatcher calls for OpticExportListener to do its thing . You should not need to call it .
4,617
public < T > T evaluateXPath ( String xpathExpression , Class < T > as ) throws XPathExpressionException { return evaluateXPath ( xpathExpression , get ( ) , as ) ; }
Evaluate a string XPath expression against the retrieved document . An XPath expression can return a Node or subinterface such as Element or Text a NodeList or a Boolean Number or String value .
4,618
public < T > T evaluateXPath ( String xpathExpression , Node context , Class < T > as ) throws XPathExpressionException { checkContext ( context ) ; return castAs ( getXPathProcessor ( ) . evaluate ( xpathExpression , context , returnXPathConstant ( as ) ) , as ) ; }
Evaluate a string XPath expression relative to a node such as a node returned by a previous XPath expression . An XPath expression can return a Node or subinterface such as Element or Text a NodeList or a Boolean Number or String value .
4,619
public < T > T evaluateXPath ( XPathExpression xpathExpression , Class < T > as ) throws XPathExpressionException { return evaluateXPath ( xpathExpression , get ( ) , as ) ; }
Evaluate a compiled XPath expression against the retrieved document . An XPath expression can return a Node or subinterface such as Element or Text a NodeList or a Boolean Number or String value .
4,620
public void initializeListener ( QueryBatcher queryBatcher ) { HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener . getInstance ( queryBatcher ) ; if ( hostAvailabilityListener != null ) { BatchFailureListener < QueryBatch > retryListener = hostAvailabilityListener . initializeRetryListener ( ...
This implementation of initializeListener adds this instance of ExportToWriterListener to the two RetryListener s in this QueryBatcher so they will retry any batches that fail during the read request .
4,621
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { Document . class } ; } public boolean isHandled ( Class < ? > type ) { return Document . class . isAssignableFrom ( type ) ; } public < C > ContentHandle ...
Creates a factory to create a DOM4JHandle instance for a dom4j document .
4,622
public static void writeReadDeleteDocument ( DatabaseClient client , String filename , String format ) throws IOException { GenericDocumentManager docMgr = client . newDocumentManager ( ) ; InputStream docStream = Util . openStream ( "data" + File . separator + filename ) ; if ( docStream == null ) throw new IOExceptio...
write read and delete the document
4,623
public HostAvailabilityListener withMinHosts ( int numHosts ) { if ( moveMgr . getConnectionType ( ) == DatabaseClient . ConnectionType . GATEWAY ) { if ( numHosts != 1 ) { throw new IllegalArgumentException ( "numHosts must be 1 when using only the primary host for the connection" ) ; } } else { if ( numHosts <= 0 ) t...
If less than minHosts are left calls stopJob .
4,624
public HostAvailabilityListener withHostUnavailableExceptions ( Class < Throwable > ... exceptionTypes ) { hostUnavailableExceptions = new ArrayList < > ( ) ; for ( Class < Throwable > exception : exceptionTypes ) { hostUnavailableExceptions . add ( exception ) ; } return this ; }
Overwrites the list of exceptions for which a request can be retried and a MarkLogic host can be blacklisted
4,625
public void processFailure ( WriteBatch batch , Throwable throwable ) { boolean isHostUnavailableException = processException ( batch . getBatcher ( ) , throwable , batch . getClient ( ) . getHost ( ) ) ; if ( isHostUnavailableException == true ) { try { logger . warn ( "Retrying failed batch: {}, results so far: {}, u...
This implements the WriteFailureListener interface
4,626
public void processFailure ( QueryBatchException queryBatch ) { boolean isHostUnavailableException = processException ( queryBatch . getBatcher ( ) , queryBatch , queryBatch . getClient ( ) . getHost ( ) ) ; if ( isHostUnavailableException == true ) { try { logger . warn ( "Retrying failed batch: {}, results so far: {}...
This implements the QueryFailureListener interface
4,627
public BatchFailureListener < QueryBatch > initializeRetryListener ( QueryBatchListener queryBatchListener ) { if ( ! retryListenersSet . contains ( queryBatchListener ) ) { synchronized ( this ) { if ( ! retryListenersSet . contains ( queryBatchListener ) ) { RetryListener retryListener = new RetryListener ( queryBatc...
Initializes the RetryListener for the given QueryBatchListener .
4,628
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { InputStream . class } ; } public boolean isHandled ( Class < ? > type ) { return InputStream . class . isAssignableFrom ( type ) ; } public < C > ContentH...
Creates a factory to create an InputStreamHandle instance for an input stream .
4,629
public static ExampleProperties loadProperties ( ) throws IOException { String propsName = "Example.properties" ; try ( InputStream propsStream = openStream ( propsName ) ) { if ( propsStream == null ) throw new IOException ( "Could not read properties " + propsName ) ; Properties props = new Properties ( ) ; props . l...
Read the configuration properties for the example from the file Example . properties .
4,630
static public DatabaseClient newClient ( String host , int port ) { return newClient ( host , port , null , null , null , null , null , null ) ; }
Creates a client to access the database by means of a REST server without any authentication . Such clients can be convenient for experimentation but should not be used in production .
4,631
static public void addConfigurator ( ClientConfigurator < ? > configurator ) { if ( ! HttpClientConfigurator . class . isInstance ( configurator ) && ! OkHttpClientConfigurator . class . isInstance ( configurator ) ) { throw new IllegalArgumentException ( "Configurator must implement OkHttpClientConfigurator" ) ; } cli...
Adds a listener that provides custom configuration when a communication library is created .
4,632
public Map < String , List < String > > merge ( Map < String , List < String > > currentParams ) { Map < String , List < String > > params = ( currentParams != null ) ? currentParams : new RequestParameters ( ) ; params . put ( "transform" , Arrays . asList ( getName ( ) ) ) ; for ( Map . Entry < String , List < String...
Merges the transform and its parameters with other parameters of the request .
4,633
public static void main ( String [ ] args ) throws IOException { Properties properties = new Properties ( ) ; for ( int i = 0 ; i < args . length ; i ++ ) { String name = args [ i ] ; if ( name . startsWith ( "-" ) && name . length ( ) > 1 && ++ i < args . length ) { name = name . substring ( 1 ) ; if ( "properties" . ...
Command - line invocation .
4,634
public void makeServer ( ConfigServer configServer , RESTServer restServer ) throws IOException { DefaultHttpClient client = new DefaultHttpClient ( ) ; String host = configServer . getHost ( ) ; int configPort = configServer . getPort ( ) ; Authentication authType = configServer . getAuthType ( ) ; if ( authType != nu...
Programmatic invocation .
4,635
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { JsonNode . class } ; } public boolean isHandled ( Class < ? > type ) { return JsonNode . class . isAssignableFrom ( type ) ; } public < C > ContentHandle ...
Creates a factory to create a JacksonHandle instance for a JSON node .
4,636
public PlanExprCol as ( PlanColumn column , ServerExpression expression ) { return new ExprColCallImpl ( "op" , "as" , new Object [ ] { column , expression } ) ; }
after code generation can specify base class
4,637
public void initializeListener ( QueryBatcher queryBatcher ) { HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener . getInstance ( queryBatcher ) ; if ( hostAvailabilityListener != null ) { BatchFailureListener < QueryBatch > retryListener = hostAvailabilityListener . initializeRetryListener ( ...
This implementation of initializeListener adds this instance of ApplyTransformListener to the two RetryListener s in this QueryBatcher so they will retry any batches that fail during the apply - transform request .
4,638
public StructuredQueryDefinition andNot ( StructuredQueryDefinition positive , StructuredQueryDefinition negative ) { checkQuery ( positive ) ; checkQuery ( negative ) ; return new AndNotQuery ( positive , negative ) ; }
Defines an AND NOT query combining a positive and negative query . You can use an AND or OR query over a list of query definitions as the positive or negative query .
4,639
public StructuredQueryDefinition near ( int maximumDistance , double weight , Ordering order , StructuredQueryDefinition ... queries ) { checkQueries ( queries ) ; return new NearQuery ( null , maximumDistance , weight , order , queries ) ; }
Defines a NEAR query over the list of query definitions with specified parameters .
4,640
public StructuredQueryDefinition containerQuery ( ContainerIndex index , StructuredQueryDefinition query ) { checkQuery ( query ) ; return new ContainerQuery ( index , query ) ; }
Matches a query within the substructure contained by an element or JSON property .
4,641
public StructuredQueryDefinition value ( TextIndex index , String ... values ) { return new ValueQuery ( index , null , null , null , values ) ; }
Matches an element attribute JSON property or field that has a value with the same string value as at least one of the criteria values .
4,642
public StructuredQueryDefinition value ( TextIndex index , Number ... values ) { return new ValueQuery ( index , null , null , null , values ) ; }
Matches an JSON property that has a value with the same numeric value as at least one of the criteria values . Note this method will not match any XML node .
4,643
public StructuredQueryDefinition value ( TextIndex index , FragmentScope scope , String [ ] options , double weight , Number ... values ) { return new ValueQuery ( index , scope , options , weight , values ) ; }
Matches a JSON property that has a value with the same numeric value as at least one of the criteria values . Note this method will not match any XML node .
4,644
public StructuredQueryDefinition range ( RangeIndex index , String type , String collation , String [ ] options , Operator operator , Object ... values ) { return new RangeQuery ( index , type , collation , null , options , operator , values ) ; }
Matches an element attribute JSON property field or path whose value that has the correct datatyped comparison with one of the criteria values .
4,645
public GeospatialIndex geoJSONProperty ( JSONProperty parent , JSONProperty jsonProperty ) { if ( parent == null ) throw new IllegalArgumentException ( "parent cannot be null" ) ; if ( jsonProperty == null ) throw new IllegalArgumentException ( "jsonProperty cannot be null" ) ; return new GeoJSONPropertyImpl ( parent ,...
Identifies a parent json property with a child json property whose text has the latitude and longitude coordinates to match with a geospatial query .
4,646
public GeospatialIndex geoJSONPropertyPair ( JSONProperty parent , JSONProperty lat , JSONProperty lon ) { if ( parent == null ) throw new IllegalArgumentException ( "parent cannot be null" ) ; if ( lat == null ) throw new IllegalArgumentException ( "lat cannot be null" ) ; if ( lon == null ) throw new IllegalArgumentE...
Identifies a parent json property with child latitude and longitude json properties to match with a geospatial query .
4,647
public GeospatialIndex geoElementPair ( Element parent , Element lat , Element lon ) { return new GeoElementPairImpl ( parent , lat , lon ) ; }
Identifies a parent element with child latitude and longitude elements to match with a geospatial query .
4,648
public GeospatialIndex geoAttributePair ( Element parent , Attribute lat , Attribute lon ) { return new GeoAttributePairImpl ( parent , lat , lon ) ; }
Identifies a parent element with child latitude and longitude attributes to match with a geospatial query .
4,649
public Circle circle ( Point center , double radius ) { return new CircleImpl ( center . getLatitude ( ) , center . getLongitude ( ) , radius ) ; }
Specifies a geospatial region as a circle supplying a point for the center .
4,650
public Box box ( double south , double west , double north , double east ) { return new BoxImpl ( south , west , north , east ) ; }
Specifies a geospatial region as a box supplying the coordinates for the perimeter .
4,651
public StructuredQueryDefinition containerConstraint ( String constraintName , StructuredQueryDefinition query ) { checkQuery ( query ) ; return new ContainerConstraintQuery ( constraintName , query ) ; }
Matches a query within the substructure of the container specified by the constraint .
4,652
public StructuredQueryDefinition valueConstraint ( String constraintName , double weight , String ... values ) { return new ValueConstraintQuery ( constraintName , weight , values ) ; }
Matches the container specified by the constraint when it has a value with the same string value as at least one of the criteria values .
4,653
public StructuredQueryDefinition wordConstraint ( String constraintName , double weight , String ... words ) { return new WordConstraintQuery ( constraintName , weight , words ) ; }
Matches the container specified by the constraint when it has at least one of the criteria words .
4,654
public StructuredQueryDefinition rangeConstraint ( String constraintName , Operator operator , String ... values ) { return new RangeConstraintQuery ( constraintName , operator , values ) ; }
Matches the container specified by the constraint whose value that has the correct datatyped comparison with one of the criteria values .
4,655
public GeospatialConstraintQuery geospatialConstraint ( String constraintName , Region ... regions ) { checkRegions ( regions ) ; return new GeospatialConstraintQuery ( constraintName , regions ) ; }
Matches the container specified by the constraint whose geospatial point appears within one of the criteria regions .
4,656
public StructuredQueryDefinition geospatialRegionConstraint ( String constraintName , GeospatialOperator operator , Region ... regions ) { checkRegions ( regions ) ; return new GeospatialRegionConstraintQuery ( constraintName , operator , regions ) ; }
Matches the container specified by the constraint whose geospatial region appears within one of the criteria regions .
4,657
public StructuredQueryDefinition temporalPeriodRange ( Axis axis , TemporalOperator operator , Period period , String ... options ) { if ( axis == null ) throw new IllegalArgumentException ( "axis cannot be null" ) ; if ( period == null ) throw new IllegalArgumentException ( "period cannot be null" ) ; return temporalP...
Matches documents that have a value in the specified axis that matches the specified period using the specified operator .
4,658
public StructuredQueryDefinition temporalPeriodRange ( Axis [ ] axes , TemporalOperator operator , Period [ ] periods , String ... options ) { if ( axes == null ) throw new IllegalArgumentException ( "axes cannot be null" ) ; if ( operator == null ) throw new IllegalArgumentException ( "operator cannot be null" ) ; if ...
Matches documents that have a value in the specified axis that matches the specified periods using the specified operator .
4,659
public StructuredQueryDefinition temporalPeriodCompare ( Axis axis1 , TemporalOperator operator , Axis axis2 , String ... options ) { if ( axis1 == null ) throw new IllegalArgumentException ( "axis1 cannot be null" ) ; if ( operator == null ) throw new IllegalArgumentException ( "operator cannot be null" ) ; if ( axis2...
Matches documents that have a relevant pair of period values . Values from axis1 must match values from axis2 using the specified operator .
4,660
public < T > T get ( String type , Class < T > as ) { return ValueConverter . convertToJava ( type , value , as ) ; }
Returns the value cast to the specified type .
4,661
public FilteredForestConfiguration withRenamedHost ( String hostName , String targetHostName ) { if ( hostName == null ) throw new IllegalArgumentException ( "hostName must not be null" ) ; if ( targetHostName == null ) throw new IllegalArgumentException ( "targetHostName must not be null" ) ; renames . put ( hostName ...
Rename hosts to network - addressable names rather than the host names known to the MarkLogic cluster .
4,662
public DocumentDescriptor create ( DocumentUriTemplate template , W contentHandle ) throws ForbiddenUserException , FailedRequestException { return create ( template , null , contentHandle , null , null , null , null , null ) ; }
strongly typed creators
4,663
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { JsonParser . class } ; } public boolean isHandled ( Class < ? > type ) { return JsonParser . class . isAssignableFrom ( type ) ; } public < C > ContentHan...
Creates a factory to create a JacksonParserHandle instance for a JsonParser .
4,664
public JsonParser get ( ) { if ( parser == null ) { if ( content == null ) { throw new IllegalStateException ( "Handle is not yet populated with content" ) ; } try { parser = getMapper ( ) . getFactory ( ) . createParser ( content ) ; } catch ( JsonParseException e ) { throw new MarkLogicIOException ( e ) ; } catch ( I...
JsonParser allows streaming access to content as it arrives .
4,665
public void set ( JsonParser parser ) { this . parser = parser ; if ( parser == null ) { content = null ; } else if ( parser . getInputSource ( ) instanceof InputStream ) { content = ( InputStream ) parser . getInputSource ( ) ; } }
Available for the edge case that content from a JsonParser must be written .
4,666
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { XMLStreamReader . class } ; } public boolean isHandled ( Class < ? > type ) { return XMLStreamReader . class . isAssignableFrom ( type ) ; } public < C > ...
Creates a factory to create an XMLStreamReaderHandle instance for a StAX stream reader .
4,667
public static void configure ( DatabaseClient client ) throws IOException { RuleManager ruleMgr = client . newRuleManager ( ) ; String rawRule = "<rapi:rule xmlns:rapi='http://marklogic.com/rest-api'>" + "<rapi:name>" + RULE_NAME + "</rapi:name>" + "<rapi:description>industry of Real Estate</rapi:description>" + "<sear...
set up alert rules
4,668
public static void match ( DatabaseClient client ) throws IOException { QueryManager queryMgr = client . newQueryManager ( ) ; String criteria = "neighborhoods" ; StringQueryDefinition querydef = queryMgr . newStringDefinition ( ) ; querydef . setCriteria ( criteria ) ; RuleManager ruleMgr = client . newRuleManager ( )...
match documents against the alert rules
4,669
public static void tearDownExample ( DatabaseClient client ) { XMLDocumentManager docMgr = client . newXMLDocumentManager ( ) ; for ( String filename : filenames ) { docMgr . delete ( "/example/" + filename ) ; } RuleManager ruleMgr = client . newRuleManager ( ) ; ruleMgr . delete ( RULE_NAME ) ; }
the rules used for matching
4,670
public DeleteListener onBatchFailure ( BatchFailureListener < Batch < String > > listener ) { failureListeners . add ( listener ) ; return this ; }
When a batch fails or a callback throws an Exception run this listener code . Multiple listeners can be registered with this method .
4,671
public static org . w3c . dom . Element domElement ( String xmlString ) { org . w3c . dom . Element element = null ; try { ByteArrayInputStream bais = new ByteArrayInputStream ( xmlString . getBytes ( Charset . forName ( "UTF-8" ) ) ) ; element = getFactory ( ) . newDocumentBuilder ( ) . parse ( bais ) . getDocumentEle...
Construct a dom Element from a string . A utility function for creating DOM elements when needed for other builder functions .
4,672
public void put ( String name , String value ) { List < String > list = new ArrayList < > ( ) ; list . add ( value ) ; getMap ( ) . put ( name , list ) ; }
Set a parameter to a single value .
4,673
public void put ( String name , String ... values ) { getMap ( ) . put ( name , Arrays . asList ( values ) ) ; }
Sets a parameter to a list of values .
4,674
public void add ( String name , String value ) { if ( containsKey ( name ) ) { get ( name ) . add ( value ) ; } else { put ( name , value ) ; } }
Appends a value to the list for a parameter .
4,675
public void add ( String name , String ... values ) { if ( containsKey ( name ) ) { List < String > list = get ( name ) ; for ( String value : values ) { list . add ( value ) ; } } else { put ( name , values ) ; } }
Appends a list of values to the list for a parameter .
4,676
public List < String > put ( String key , List < String > value ) { return getMap ( ) . put ( key , value ) ; }
Sets the values of a parameter name returning the previous values if any .
4,677
public void putAll ( Map < ? extends String , ? extends List < String > > m ) { getMap ( ) . putAll ( m ) ; }
Adds existing parameter names and values .
4,678
public Set < Map . Entry < String , List < String > > > entrySet ( ) { return getMap ( ) . entrySet ( ) ; }
Returns a set of parameter - list entries .
4,679
public RequestParameters copy ( String prefix ) { String keyPrefix = prefix + ":" ; RequestParameters copy = new RequestParameters ( ) ; for ( Map . Entry < String , List < String > > entry : entrySet ( ) ) { copy . put ( keyPrefix + entry . getKey ( ) , entry . getValue ( ) ) ; } return copy ; }
Creates a copy of the parameters prepending a namespace prefix to each parameter name .
4,680
public void processEvent ( QueryBatch batch ) { try ( DocumentPage docs = getDocs ( batch ) ) { while ( docs . hasNext ( ) ) { for ( Consumer < DocumentRecord > listener : exportListeners ) { try { listener . accept ( docs . next ( ) ) ; } catch ( Throwable t ) { logger . error ( "Exception thrown by an onDocumentReady...
This is the method QueryBatcher calls for ExportListener to do its thing . You should not need to call it .
4,681
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { XMLEventReader . class } ; } public boolean isHandled ( Class < ? > type ) { return XMLEventReader . class . isAssignableFrom ( type ) ; } public < C > Co...
Creates a factory to create an XMLEventReaderHandle instance for a StAX event reader .
4,682
public HashMap < String , String > getValuesMap ( ) { if ( optionsHolder == null ) return null ; else return optionsHolder . getOptionsMap ( ) ; }
Returns a HashMap of the named query options from the server .
4,683
public static void setUpExample ( XMLDocumentManager docMgr , String docId , String filename ) throws IOException { InputStream docStream = Util . openStream ( "data" + File . separator + filename ) ; if ( docStream == null ) throw new IOException ( "Could not read document example" ) ; DocumentMetadataHandle metadataH...
set up by writing document metadata and content for the example to read
4,684
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { Reader . class } ; } public boolean isHandled ( Class < ? > type ) { return Reader . class . isAssignableFrom ( type ) ; } public < C > ContentHandle < C ...
Creates a factory to create a ReaderHandle instance for a Reader .
4,685
public JobInformationRecorder withWriteBatcher ( DataMovementManager dataMovementManager , WriteBatcher writeBatcher ) { if ( sourceBatcher . isStarted ( ) ) throw new IllegalStateException ( "Configuration cannot be changed after startJob has been called" ) ; this . writeBatcher = writeBatcher ; this . dataMovementMan...
Sets the WriteBatcher object which should be used for writing the job information . This overrides the internal WriteBatcher object created by default .
4,686
public JobInformationRecorder withProperty ( String key , String value ) { if ( sourceBatcher . isStarted ( ) ) throw new IllegalStateException ( "Configuration cannot be changed after startJob has been called" ) ; properties . put ( key , value ) ; return this ; }
Sets the key value pair to the job information . This would be persisted along with the other job information like start time end time etc
4,687
public JobInformationRecorder withProperty ( Map < String , String > properties ) { if ( sourceBatcher . isStarted ( ) ) throw new IllegalStateException ( "Configuration cannot be changed after startJob has been called" ) ; this . properties . clear ( ) ; this . properties . putAll ( properties ) ; return this ; }
Sets the map of key value pairs to the job information . This would be persisted along with the other job information like start time end time etc . This would clear any key value property set before and initialize the properties with this map .
4,688
public void importQueryDefinition ( XMLWriteHandle queryDef ) { List < XMLEvent > importedList = Utilities . importFromHandle ( queryDef ) ; XMLEvent firstEvent = importedList . get ( 0 ) ; if ( firstEvent . getEventType ( ) == XMLStreamConstants . START_ELEMENT ) { StartElement startElement = firstEvent . asStartEleme...
Imports an XML combined search definition that defines the matching criteria for this rule .
4,689
public < T extends XMLReadHandle > T exportQueryDefinition ( T handle ) { return Utilities . exportToHandle ( this . queryPayload , handle ) ; }
Exports the embedded query definitions and options to a handle
4,690
public void write ( OutputStream out ) throws IOException { try { valueSerializer = null ; XMLStreamWriter serializer = factory . createXMLStreamWriter ( out , "UTF-8" ) ; serializer . setPrefix ( RequestConstants . RESTAPI_PREFIX , RequestConstants . RESTAPI_NS ) ; serializer . setPrefix ( RequestConstants . SEARCH_PR...
Writes a serialized RuleDefinition to an OutputStream as XML .
4,691
public void setDefaultNamespaceURI ( String namespaceURI ) { if ( namespaceURI == null ) throw new IllegalArgumentException ( "Cannot set default prefix to null namespace URI" ) ; bindings . put ( XMLConstants . DEFAULT_NS_PREFIX , namespaceURI ) ; }
Specifies the namespace URI bound to the empty prefix .
4,692
public String getNamespaceURI ( String prefix ) { if ( prefix == null ) throw new IllegalArgumentException ( "Cannot get namespace URI for null prefix" ) ; if ( XMLConstants . XML_NS_PREFIX . equals ( prefix ) ) return XMLConstants . XML_NS_URI ; if ( XMLConstants . XMLNS_ATTRIBUTE . equals ( prefix ) ) return XMLConst...
Returns the URI for a namespace binding .
4,693
public void setNamespaceURI ( String prefix , String namespaceURI ) { if ( prefix == null ) throw new IllegalArgumentException ( "Cannot bind null prefix" ) ; if ( namespaceURI == null ) throw new IllegalArgumentException ( "Cannot set prefix to null namespace URI" ) ; if ( XMLConstants . XML_NS_PREFIX . equals ( prefi...
Specifies a binding between a prefix and a namespace URI .
4,694
public String getPrefix ( String namespaceURI ) { if ( namespaceURI == null ) throw new IllegalArgumentException ( "Cannot find prefix for null namespace URI" ) ; if ( XMLConstants . XML_NS_URI . equals ( namespaceURI ) ) return XMLConstants . XML_NS_PREFIX ; if ( XMLConstants . XMLNS_ATTRIBUTE_NS_URI . equals ( namesp...
Returns the prefix for a namespace binding .
4,695
public Iterator < String > getPrefixes ( String namespaceURI ) { if ( namespaceURI == null ) throw new IllegalArgumentException ( "Cannot find prefix for null namespace URI" ) ; List < String > list = new ArrayList < > ( ) ; if ( XMLConstants . XML_NS_URI . equals ( namespaceURI ) ) list . add ( XMLConstants . XML_NS_P...
Returns all prefixes with a namespace binding .
4,696
public Set < java . util . Map . Entry < String , String > > entrySet ( ) { return bindings . entrySet ( ) ; }
Gets the namespace bindings .
4,697
public RequestParameters asParameters ( ) { RequestParameters params = new RequestParameters ( ) ; if ( title != null ) params . put ( "title" , title ) ; if ( description != null ) params . put ( "description" , description ) ; if ( provider != null ) params . put ( "provider" , provider ) ; if ( version != null ) par...
Constructs request parameters expressing the extension metadata .
4,698
public String getName ( ) { ResourceServices services = getServices ( ) ; return ( services != null ) ? services . getResourceName ( ) : null ; }
Returns the name of the resource .
4,699
public void startLogging ( RequestLogger logger ) { ResourceServices services = getServices ( ) ; if ( services != null ) services . startLogging ( logger ) ; }
Starts debugging client requests . You can suspend and resume debugging output using the methods of the logger .