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 instanceof NoResponseListener ) { return ( NoResponseListener ) writeFailureListener ; } } } else if ( batcher instanceof QueryBatcher ) { QueryFailureListener [ ] queryFailureListeners = ( ( QueryBatcher ) batcher ) . getQueryFailureListeners ( ) ; for ( QueryFailureListener queryFailureListener : queryFailureListeners ) { if ( queryFailureListener instanceof NoResponseListener ) { return ( NoResponseListener ) queryFailureListener ; } } } else { throw new IllegalStateException ( "The Batcher should be either a QueryBatcher instance or a WriteBatcher instance" ) ; } return null ; }
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 ) ; XMLDocumentManager docMgr = client . newXMLDocumentManager ( ) ; docMgr . delete ( "/example/flipper.xml" ) ; TransformExtensionsManager transMgr = client . newServerConfigManager ( ) . newTransformExtensionsManager ( ) ; transMgr . deleteTransform ( TRANSFORM_NAME ) ; client . release ( ) ; }
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 . adminPassword , props . authType ) ; useResource ( props . host , props . port , props . writerUser , props . writerPassword , props . authType ) ; tearDownExample ( props . host , props . port , props . adminUser , props . adminPassword , props . authType ) ; }
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/>" ) ) ; DocumentMetadataHandle meta2 = new DocumentMetadataHandle ( ) ; meta2 . getCollections ( ) . add ( "/batch/collection2" ) ; docMgr . write ( "/batch/read2.xml" , meta2 , handle . with ( "<read2/>" ) ) ; docMgr . write ( "/batch/delete1.xml" , handle . with ( "<delete1/>" ) ) ; }
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 = lc ; }
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 . iterator ( ) . next ( ) . getName ( ) ; }
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 = loginContext . getSubject ( ) . getPrivateCredentials ( ) ; for ( Object privateCred : privateCreds ) { if ( privateCred instanceof KerberosTicket ) { String serverPrincipalTicketName = ( ( KerberosTicket ) privateCred ) . getServer ( ) . getName ( ) ; if ( ( serverPrincipalTicketName . startsWith ( "krbtgt" ) ) && ( ( KerberosTicket ) privateCred ) . getEndTime ( ) . compareTo ( new Date ( ) ) == - 1 ) { buildSubjectCredentials ( ) ; break ; } } } Subject . doAs ( loginContext . getSubject ( ) , action ) ; return action . getNegotiateToken ( ) ; }
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 > ContentHandle < C > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new InputSourceHandle ( ) : null ; return handle ; } } ; }
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 ( "Failed to process input source with SAX content handler" , e ) ; throw new MarkLogicInternalException ( e ) ; } catch ( IOException e ) { logger . error ( "Failed to process input source with SAX content handler" , e ) ; throw new MarkLogicInternalException ( e ) ; } }
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 ; queryEvents = null ; }
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 ) { logger . error ( "Exception thrown by an onRowRecordReady listener " , t ) ; } } } } catch ( Throwable t ) { for ( BatchFailureListener < Batch < String > > listener : opticFailureListeners ) { try { listener . processFailure ( batch , t ) ; } catch ( Throwable t2 ) { logger . error ( "Exception thrown by an onBatchFailure listener" , t2 ) ; } } } }
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 ) ; if ( retryListener != null ) onFailure ( retryListener ) ; } NoResponseListener noResponseListener = NoResponseListener . getInstance ( queryBatcher ) ; if ( noResponseListener != null ) { BatchFailureListener < QueryBatch > noResponseRetryListener = noResponseListener . initializeRetryListener ( this ) ; if ( noResponseRetryListener != null ) onFailure ( noResponseRetryListener ) ; } }
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 < C > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new DOM4JHandle ( ) : null ; return handle ; } } ; }
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 IOException ( "Could not read document example" ) ; String docId = "/example/" + filename ; InputStreamHandle writeHandle = new InputStreamHandle ( ) ; writeHandle . set ( docStream ) ; docMgr . write ( docId , writeHandle ) ; BytesHandle readHandle = new BytesHandle ( ) ; docMgr . read ( docId , readHandle ) ; byte [ ] document = readHandle . get ( ) ; docMgr . delete ( docId ) ; System . out . println ( "Wrote, read, and deleted /example/" + filename + " content with " + document . length + " bytes in the " + format + " format" ) ; }
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 ) throw new IllegalArgumentException ( "numHosts must be > 0" ) ; int numConfigHosts = moveMgr . readForestConfig ( ) . getPreferredHosts ( ) . length ; if ( numHosts > numConfigHosts ) throw new IllegalArgumentException ( "numHosts must be less than or equal to the number of hosts in the cluster" ) ; } this . minHosts = numHosts ; return this ; }
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: {}, uris: {}" , batch . getJobBatchNumber ( ) , batch . getJobWritesSoFar ( ) , Stream . of ( batch . getItems ( ) ) . map ( event -> event . getTargetUri ( ) ) . collect ( Collectors . toList ( ) ) ) ; batch . getBatcher ( ) . retryWithFailureListeners ( batch ) ; } catch ( RuntimeException e ) { logger . error ( "Exception during retry" , e ) ; processFailure ( batch , e ) ; } } }
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: {}, forest: {}, forestBatch: {}, forest results so far: {}" , queryBatch . getJobBatchNumber ( ) , queryBatch . getJobResultsSoFar ( ) , queryBatch . getForest ( ) . getForestName ( ) , queryBatch . getForestBatchNumber ( ) , queryBatch . getForestResultsSoFar ( ) ) ; queryBatch . getBatcher ( ) . retryWithFailureListeners ( queryBatch ) ; } catch ( RuntimeException e ) { logger . error ( "Exception during retry" , e ) ; processFailure ( new QueryBatchException ( queryBatch , e ) ) ; } } }
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 ( queryBatchListener ) ; retryListenersSet . add ( queryBatchListener ) ; return retryListener ; } } } return null ; }
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 > ContentHandle < C > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new InputStreamHandle ( ) : null ; return handle ; } } ; }
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 . load ( propsStream ) ; return new ExampleProperties ( props ) ; } }
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" ) ; } clientConfigurator = configurator ; }
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 > > entry : entrySet ( ) ) { params . put ( "trans:" + entry . getKey ( ) , entry . getValue ( ) ) ; } return params ; }
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" . equals ( name ) ) { try ( InputStream propsStream = Bootstrapper . class . getClassLoader ( ) . getResourceAsStream ( name ) ) { if ( propsStream == null ) throw new IOException ( "Could not read bootstrapper properties" ) ; Properties props = new Properties ( ) ; props . load ( propsStream ) ; props . putAll ( properties ) ; properties = props ; } } else { properties . put ( name , args [ i ] ) ; } } else { System . err . println ( "invalid argument: " + name ) ; System . err . println ( getUsage ( ) ) ; System . exit ( 1 ) ; } } String invalid = joinList ( listInvalidKeys ( properties ) ) ; if ( invalid != null && invalid . length ( ) > 0 ) { System . err . println ( "invalid arguments: " + invalid ) ; System . err . println ( getUsage ( ) ) ; System . exit ( 1 ) ; } new Bootstrapper ( ) . makeServer ( properties ) ; System . out . println ( "Created " + properties . getProperty ( "restserver" ) + " server on " + properties . getProperty ( "restport" ) + " port for " + properties . getProperty ( "restdb" ) + " database" ) ; }
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 != null ) { List < String > prefList = new ArrayList < > ( ) ; if ( authType == Authentication . BASIC ) prefList . add ( AuthPolicy . BASIC ) ; else if ( authType == Authentication . DIGEST ) prefList . add ( AuthPolicy . DIGEST ) ; else throw new IllegalArgumentException ( "Unknown authentication type: " + authType . name ( ) ) ; client . getParams ( ) . setParameter ( AuthPNames . PROXY_AUTH_PREF , prefList ) ; String configUser = configServer . getUser ( ) ; String configPassword = configServer . getPassword ( ) ; client . getCredentialsProvider ( ) . setCredentials ( new AuthScope ( host , configPort ) , new UsernamePasswordCredentials ( configUser , configPassword ) ) ; } BasicHttpContext context = new BasicHttpContext ( ) ; StringEntity content ; try { content = new StringEntity ( restServer . toXMLString ( ) ) ; } catch ( XMLStreamException e ) { throw new IOException ( "Could not create payload to bootstrap server." ) ; } content . setContentType ( "application/xml" ) ; HttpPost poster = new HttpPost ( "http://" + host + ":" + configPort + "/v1/rest-apis" ) ; poster . setEntity ( content ) ; HttpResponse response = client . execute ( poster , context ) ; StatusLine status = response . getStatusLine ( ) ; int statusCode = status . getStatusCode ( ) ; String statusPhrase = status . getReasonPhrase ( ) ; client . getConnectionManager ( ) . shutdown ( ) ; if ( statusCode >= 300 ) { throw new RuntimeException ( "Failed to create REST server using host=" + host + " and port=" + configPort + ": " + statusCode + " " + statusPhrase + "\n" + "Please check the server log for detail" ) ; } }
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 < C > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new JacksonHandle ( ) : null ; return handle ; } } ; }
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 ) ; if ( retryListener != null ) onFailure ( retryListener ) ; } }
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 , jsonProperty ) ; }
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 IllegalArgumentException ( "lon cannot be null" ) ; return new GeoJSONPropertyPairImpl ( parent , lat , lon ) ; }
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 temporalPeriodRange ( new Axis [ ] { axis } , operator , new Period [ ] { period } , options ) ; }
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 ( periods == null ) throw new IllegalArgumentException ( "periods cannot be null" ) ; return new TemporalPeriodRangeQuery ( axes , operator , periods , options ) ; }
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 == null ) throw new IllegalArgumentException ( "axis2 cannot be null" ) ; return new TemporalPeriodCompareQuery ( axis1 , operator , axis2 , options ) ; }
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 . toLowerCase ( ) , targetHostName . toLowerCase ( ) ) ; return this ; }
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 > ContentHandle < C > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new JacksonParserHandle ( ) : null ; return handle ; } } ; }
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 ( IOException e ) { throw new MarkLogicIOException ( e ) ; } } return parser ; }
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 > ContentHandle < C > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new XMLStreamReaderHandle ( ) : null ; return handle ; } } ; }
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>" + "<search:search " + "xmlns:search='http://marklogic.com/appservices/search'>" + "<search:query>" + "<search:value-constraint-query>" + "<search:constraint-name>industry</search:constraint-name>" + "<search:text>Real Estate</search:text>" + "</search:value-constraint-query>" + "</search:query>" + "<search:options>" + "<search:constraint name='industry'>" + "<search:value>" + "<search:element name='industry' ns=''/>" + "</search:value>" + "</search:constraint>" + "</search:options>" + "</search:search>" + "<rapi:rule-metadata>" + "<correlate-with>/demographic-statistics?zipcode=</correlate-with>" + "</rapi:rule-metadata>" + "</rapi:rule>" ; StringHandle writeHandle = new StringHandle ( rawRule ) ; ruleMgr . writeRule ( RULE_NAME , writeHandle ) ; }
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 ( ) ; RuleDefinitionList matchedRules = ruleMgr . match ( querydef , new RuleDefinitionList ( ) ) ; Iterator < RuleDefinition > ruleItr = matchedRules . iterator ( ) ; while ( ruleItr . hasNext ( ) ) { RuleDefinition rule = ruleItr . next ( ) ; System . out . println ( "document criteria " + criteria + " matched rule " + rule . getName ( ) + " with metadata " + rule . getMetadata ( ) ) ; } }
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 ) . getDocumentElement ( ) ; } catch ( SAXException e ) { throw new MarkLogicIOException ( "Could not make Element from xmlString" + xmlString , e ) ; } catch ( IOException e ) { throw new MarkLogicIOException ( "Could not make Element from xmlString" + xmlString , e ) ; } catch ( ParserConfigurationException e ) { throw new MarkLogicIOException ( "Could not make Element from xmlString" + xmlString , e ) ; } return element ; }
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 listener" , t ) ; } } } } catch ( Throwable t ) { for ( BatchFailureListener < Batch < String > > listener : failureListeners ) { try { listener . processFailure ( batch , t ) ; } catch ( Throwable t2 ) { logger . error ( "Exception thrown by an onBatchFailure listener" , t2 ) ; } } for ( BatchFailureListener < QueryBatch > queryBatchFailureListener : queryBatchFailureListeners ) { try { queryBatchFailureListener . processFailure ( batch , t ) ; } catch ( Throwable t2 ) { logger . error ( "Exception thrown by an onFailure listener" , t2 ) ; } } } }
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 > ContentHandle < C > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new XMLEventReaderHandle ( ) : null ; return handle ; } } ; }
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 metadataHandle = new DocumentMetadataHandle ( ) ; metadataHandle . getCollections ( ) . addAll ( "products" , "real-estate" ) ; metadataHandle . getPermissions ( ) . add ( "app-user" , Capability . UPDATE , Capability . READ ) ; metadataHandle . getProperties ( ) . put ( "reviewed" , true ) ; metadataHandle . setQuality ( 1 ) ; metadataHandle . getMetadataValues ( ) . add ( "key1" , "value1" ) ; InputStreamHandle handle = new InputStreamHandle ( ) ; handle . set ( docStream ) ; docMgr . write ( docId , metadataHandle , handle ) ; }
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 > newHandle ( Class < C > type ) { @ SuppressWarnings ( "unchecked" ) ContentHandle < C > handle = isHandled ( type ) ? ( ContentHandle < C > ) new ReaderHandle ( ) : null ; return handle ; } } ; }
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 . dataMovementManager = dataMovementManager ; this . client = writeBatcher . getPrimaryClient ( ) ; this . dataMovementManager . startJob ( this . writeBatcher ) ; return this ; }
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 . asStartElement ( ) ; if ( RequestConstants . SEARCH_NS . equals ( startElement . getName ( ) . getNamespaceURI ( ) ) && startElement . getName ( ) . getLocalPart ( ) . equals ( "query" ) ) { List < XMLEvent > wrappedList = new ArrayList < > ( ) ; XMLEventFactory eventFactory = XMLEventFactory . newInstance ( ) ; XMLEvent startSearchElement = eventFactory . createStartElement ( "search" , RequestConstants . SEARCH_NS , "search" ) ; XMLEvent endSearchElement = eventFactory . createEndElement ( "search" , RequestConstants . SEARCH_NS , "search" ) ; wrappedList . add ( startSearchElement ) ; wrappedList . addAll ( importedList ) ; wrappedList . add ( endSearchElement ) ; this . queryPayload = wrappedList ; } else { this . queryPayload = importedList ; } } else { logger . warn ( "Expected imported XML to be an element, but it's not." ) ; this . queryPayload = importedList ; } }
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_PREFIX , RequestConstants . SEARCH_NS ) ; serializer . setPrefix ( "xsi" , XMLConstants . W3C_XML_SCHEMA_INSTANCE_NS_URI ) ; serializer . setPrefix ( "xs" , XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; serializer . writeStartDocument ( "utf-8" , "1.0" ) ; serializer . writeStartElement ( RequestConstants . RESTAPI_PREFIX , "rule" , RequestConstants . RESTAPI_NS ) ; serializer . writeStartElement ( RequestConstants . RESTAPI_PREFIX , "name" , RequestConstants . RESTAPI_NS ) ; serializer . writeCharacters ( getName ( ) ) ; serializer . writeEndElement ( ) ; serializer . writeStartElement ( RequestConstants . RESTAPI_PREFIX , "description" , RequestConstants . RESTAPI_NS ) ; String description = getDescription ( ) ; if ( description != null ) serializer . writeCharacters ( description ) ; serializer . writeEndElement ( ) ; serializer . flush ( ) ; XMLEventWriter eventWriter = factory . createXMLEventWriter ( out ) ; for ( XMLEvent event : this . queryPayload ) { eventWriter . add ( event ) ; } eventWriter . flush ( ) ; out . flush ( ) ; writeMetadataElement ( serializer ) ; serializer . writeEndElement ( ) ; serializer . writeEndDocument ( ) ; } catch ( XMLStreamException e ) { throw new MarkLogicIOException ( "Failed to serialize rule" , e ) ; } catch ( TransformerFactoryConfigurationError e ) { throw new MarkLogicIOException ( "Failed to serialize rule" , e ) ; } catch ( TransformerException e ) { throw new MarkLogicIOException ( "Failed to serialize rule" , e ) ; } finally { valueSerializer = null ; } }
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 XMLConstants . XMLNS_ATTRIBUTE_NS_URI ; String namespaceURI = bindings . get ( prefix ) ; return ( namespaceURI != null ) ? namespaceURI : XMLConstants . NULL_NS_URI ; }
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 ( prefix ) || XMLConstants . XMLNS_ATTRIBUTE . equals ( prefix ) ) return ; bindings . put ( prefix , namespaceURI ) ; }
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 ( namespaceURI ) ) return XMLConstants . XMLNS_ATTRIBUTE ; for ( Map . Entry < String , String > entry : bindings . entrySet ( ) ) { if ( namespaceURI . equals ( entry . getValue ( ) ) ) return entry . getKey ( ) ; } return null ; }
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_PREFIX ) ; else if ( XMLConstants . XMLNS_ATTRIBUTE_NS_URI . equals ( namespaceURI ) ) list . add ( XMLConstants . XMLNS_ATTRIBUTE ) ; else for ( Map . Entry < String , String > entry : bindings . entrySet ( ) ) { if ( namespaceURI . equals ( entry . getValue ( ) ) ) list . add ( entry . getKey ( ) ) ; } return Collections . unmodifiableList ( list ) . iterator ( ) ; }
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 ) params . put ( "version" , version ) ; return params ; }
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 .