1 package org.apache.archiva.indexer.maven;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.admin.model.RepositoryAdminException;
23 import org.apache.archiva.admin.model.beans.NetworkProxy;
24 import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
25 import org.apache.archiva.common.utils.PathUtil;
26 import org.apache.archiva.configuration.ArchivaConfiguration;
27 import org.apache.archiva.indexer.ArchivaIndexManager;
28 import org.apache.archiva.indexer.ArchivaIndexingContext;
29 import org.apache.archiva.indexer.IndexCreationFailedException;
30 import org.apache.archiva.indexer.IndexUpdateFailedException;
31 import org.apache.archiva.indexer.UnsupportedBaseContextException;
32 import org.apache.archiva.proxy.common.WagonFactory;
33 import org.apache.archiva.proxy.common.WagonFactoryException;
34 import org.apache.archiva.proxy.common.WagonFactoryRequest;
35 import org.apache.archiva.repository.ManagedRepository;
36 import org.apache.archiva.repository.PasswordCredentials;
37 import org.apache.archiva.repository.RemoteRepository;
38 import org.apache.archiva.repository.Repository;
39 import org.apache.archiva.repository.RepositoryType;
40 import org.apache.archiva.repository.UnsupportedRepositoryTypeException;
41 import org.apache.archiva.repository.features.IndexCreationFeature;
42 import org.apache.archiva.repository.features.RemoteIndexFeature;
43 import org.apache.commons.lang.StringUtils;
44 import org.apache.maven.index.*;
45 import org.apache.maven.index.context.IndexCreator;
46 import org.apache.maven.index.context.IndexingContext;
47 import org.apache.maven.index.packer.IndexPacker;
48 import org.apache.maven.index.packer.IndexPackingRequest;
49 import org.apache.maven.index.updater.IndexUpdateRequest;
50 import org.apache.maven.index.updater.IndexUpdater;
51 import org.apache.maven.index.updater.ResourceFetcher;
52 import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException;
53 import org.apache.maven.wagon.ConnectionException;
54 import org.apache.maven.wagon.ResourceDoesNotExistException;
55 import org.apache.maven.wagon.StreamWagon;
56 import org.apache.maven.wagon.TransferFailedException;
57 import org.apache.maven.wagon.Wagon;
58 import org.apache.maven.wagon.authentication.AuthenticationException;
59 import org.apache.maven.wagon.authentication.AuthenticationInfo;
60 import org.apache.maven.wagon.authorization.AuthorizationException;
61 import org.apache.maven.wagon.events.TransferEvent;
62 import org.apache.maven.wagon.events.TransferListener;
63 import org.apache.maven.wagon.proxy.ProxyInfo;
64 import org.apache.maven.wagon.shared.http.AbstractHttpClientWagon;
65 import org.apache.maven.wagon.shared.http.HttpConfiguration;
66 import org.apache.maven.wagon.shared.http.HttpMethodConfiguration;
67 import org.slf4j.Logger;
68 import org.slf4j.LoggerFactory;
69 import org.springframework.stereotype.Service;
71 import javax.inject.Inject;
72 import java.io.FileNotFoundException;
73 import java.io.IOException;
74 import java.io.InputStream;
75 import java.net.MalformedURLException;
77 import java.nio.file.Files;
78 import java.nio.file.Path;
79 import java.nio.file.Paths;
80 import java.util.Collection;
81 import java.util.List;
83 import java.util.concurrent.ConcurrentSkipListSet;
84 import java.util.stream.Collectors;
87 * Maven implementation of index manager.
88 * The index manager is a singleton, so we try to make sure, that index operations are not running
89 * parallel by synchronizing on the index path.
90 * A update operation waits for parallel running methods to finish before starting, but after a certain
91 * time of retries a IndexUpdateFailedException is thrown.
93 @Service( "archivaIndexManager#maven" )
94 public class MavenIndexManager implements ArchivaIndexManager
97 private static final Logger log = LoggerFactory.getLogger( MavenIndexManager.class );
100 private Indexer indexer;
103 private IndexerEngine indexerEngine;
106 private List<? extends IndexCreator> indexCreators;
109 private IndexPacker indexPacker;
112 private Scanner scanner;
115 private ArchivaConfiguration archivaConfiguration;
118 private WagonFactory wagonFactory;
121 private NetworkProxyAdmin networkProxyAdmin;
124 private IndexUpdater indexUpdater;
127 private ArtifactContextProducer artifactContextProducer;
129 private ConcurrentSkipListSet<Path> activeContexts = new ConcurrentSkipListSet<>( );
131 private static final int WAIT_TIME = 100;
132 private static final int MAX_WAIT = 10;
135 public static IndexingContext getMvnContext( ArchivaIndexingContext context ) throws UnsupportedBaseContextException
137 if ( !context.supports( IndexingContext.class ) )
139 log.error( "The provided archiva index context does not support the maven IndexingContext" );
140 throw new UnsupportedBaseContextException( "The context does not support the Maven IndexingContext" );
142 return context.getBaseContext( IndexingContext.class );
145 private Path getIndexPath( ArchivaIndexingContext ctx )
147 return PathUtil.getPathFromUri( ctx.getPath( ) );
151 interface IndexUpdateConsumer
154 void accept( IndexingContext indexingContext ) throws IndexUpdateFailedException;
158 * This method is used to do some actions around the update execution code. And to make sure, that no other
159 * method is running on the same index.
161 private void executeUpdateFunction( ArchivaIndexingContext context, IndexUpdateConsumer function ) throws IndexUpdateFailedException
163 IndexingContext indexingContext = null;
166 indexingContext = getMvnContext( context );
168 catch ( UnsupportedBaseContextException e )
170 throw new IndexUpdateFailedException( "Maven index is not supported by this context", e );
172 final Path ctxPath = getIndexPath( context );
174 boolean active = false;
175 while ( loop-- > 0 && !active )
177 active = activeContexts.add( ctxPath );
180 Thread.currentThread( ).sleep( WAIT_TIME );
182 catch ( InterruptedException e )
191 function.accept( indexingContext );
195 activeContexts.remove( ctxPath );
200 throw new IndexUpdateFailedException( "Timeout while waiting for index release on context " + context.getId( ) );
205 public void pack( final ArchivaIndexingContext context ) throws IndexUpdateFailedException
207 executeUpdateFunction( context, indexingContext -> {
210 IndexPackingRequest request = new IndexPackingRequest( indexingContext,
211 indexingContext.acquireIndexSearcher( ).getIndexReader( ),
212 indexingContext.getIndexDirectoryFile( ) );
213 indexPacker.packIndex( request );
214 indexingContext.updateTimestamp( true );
216 catch ( IOException e )
218 log.error( "IOException while packing index of context " + context.getId( ) + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? ": " + e.getMessage( ) : "" ) );
219 throw new IndexUpdateFailedException( "IOException during update of " + context.getId( ), e );
227 public void scan(final ArchivaIndexingContext context) throws IndexUpdateFailedException
229 executeUpdateFunction( context, indexingContext -> {
230 DefaultScannerListener listener = new DefaultScannerListener( indexingContext, indexerEngine, true, null );
231 ScanningRequest request = new ScanningRequest( indexingContext, listener );
232 ScanningResult result = scanner.scan( request );
233 if ( result.hasExceptions( ) )
235 log.error( "Exceptions occured during index scan of " + context.getId( ) );
236 result.getExceptions( ).stream( ).map( e -> e.getMessage( ) ).distinct( ).limit( 5 ).forEach(
237 s -> log.error( "Message: " + s )
245 public void update( final ArchivaIndexingContext context, final URI remoteUpdateUri, final boolean fullUpdate ) throws IndexUpdateFailedException
247 log.info( "start download remote index for remote repository {}", context.getRepository( ).getId( ) );
249 if ( !( context.getRepository( ) instanceof RemoteRepository ) )
251 throw new IndexUpdateFailedException( "The context is not associated to a remote repository " + context.getId( ) );
253 final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( );
255 executeUpdateFunction( context,
259 // create a temp directory to download files
260 Path tempIndexDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), ".tmpIndex" );
261 Path indexCacheDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), ".indexCache" );
262 Files.createDirectories( indexCacheDirectory );
263 if ( Files.exists( tempIndexDirectory ) )
265 org.apache.archiva.common.utils.FileUtils.deleteDirectory( tempIndexDirectory );
267 Files.createDirectories( tempIndexDirectory );
268 tempIndexDirectory.toFile( ).deleteOnExit( );
269 String baseIndexUrl = indexingContext.getIndexUpdateUrl( );
271 String wagonProtocol = remoteUpdateUri.toURL( ).getProtocol( );
273 NetworkProxy networkProxy = null;
274 if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) )
276 RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
277 if ( StringUtils.isNotBlank( rif.getProxyId( ) ) )
281 networkProxy = networkProxyAdmin.getNetworkProxy( rif.getProxyId( ) );
283 catch ( RepositoryAdminException e )
285 log.error( "Error occured while retrieving proxy {}", e.getMessage( ) );
287 if ( networkProxy == null )
290 "your remote repository is configured to download remote index trought a proxy we cannot find id:{}",
295 final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon(
296 new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders( ) ).networkProxy(
299 int readTimeout = (int) rif.getDownloadTimeout( ).toMillis( ) * 1000;
300 wagon.setReadTimeout( readTimeout );
301 wagon.setTimeout( (int) remoteRepository.getTimeout( ).toMillis( ) * 1000 );
303 if ( wagon instanceof AbstractHttpClientWagon )
305 HttpConfiguration httpConfiguration = new HttpConfiguration( );
306 HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration( );
307 httpMethodConfiguration.setUsePreemptive( true );
308 httpMethodConfiguration.setReadTimeout( readTimeout );
309 httpConfiguration.setGet( httpMethodConfiguration );
310 AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration );
313 wagon.addTransferListener( new DownloadListener( ) );
314 ProxyInfo proxyInfo = null;
315 if ( networkProxy != null )
317 proxyInfo = new ProxyInfo( );
318 proxyInfo.setType( networkProxy.getProtocol( ) );
319 proxyInfo.setHost( networkProxy.getHost( ) );
320 proxyInfo.setPort( networkProxy.getPort( ) );
321 proxyInfo.setUserName( networkProxy.getUsername( ) );
322 proxyInfo.setPassword( networkProxy.getPassword( ) );
324 AuthenticationInfo authenticationInfo = null;
325 if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials ) )
327 PasswordCredentials creds = (PasswordCredentials) remoteRepository.getLoginCredentials( );
328 authenticationInfo = new AuthenticationInfo( );
329 authenticationInfo.setUserName( creds.getUsername( ) );
330 authenticationInfo.setPassword( new String( creds.getPassword( ) ) );
332 wagon.connect( new org.apache.maven.wagon.repository.Repository( remoteRepository.getId( ), baseIndexUrl ), authenticationInfo,
335 Path indexDirectory = indexingContext.getIndexDirectoryFile( ).toPath( );
336 if ( !Files.exists( indexDirectory ) )
338 Files.createDirectories( indexDirectory );
341 ResourceFetcher resourceFetcher =
342 new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository );
343 IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
344 request.setForceFullUpdate( fullUpdate );
345 request.setLocalIndexCacheDir( indexCacheDirectory.toFile( ) );
347 indexUpdater.fetchAndUpdateIndex( request );
349 indexingContext.updateTimestamp( true );
353 catch ( AuthenticationException e )
355 log.error( "Could not login to the remote proxy for updating index of {}", remoteRepository.getId( ), e );
356 throw new IndexUpdateFailedException( "Login in to proxy failed while updating remote repository " + remoteRepository.getId( ), e );
358 catch ( ConnectionException e )
360 log.error( "Connection error during index update for remote repository {}", remoteRepository.getId( ), e );
361 throw new IndexUpdateFailedException( "Connection error during index update for remote repository " + remoteRepository.getId( ), e );
363 catch ( MalformedURLException e )
365 log.error( "URL for remote index update of remote repository {} is not correct {}", remoteRepository.getId( ), remoteUpdateUri, e );
366 throw new IndexUpdateFailedException( "URL for remote index update of repository is not correct " + remoteUpdateUri, e );
368 catch ( IOException e )
370 log.error( "IOException during index update of remote repository {}: {}", remoteRepository.getId( ), e.getMessage( ), e );
371 throw new IndexUpdateFailedException( "IOException during index update of remote repository " + remoteRepository.getId( )
372 + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? ": " + e.getMessage( ) : "" ), e );
374 catch ( WagonFactoryException e )
376 log.error( "Wagon for remote index download of {} could not be created: {}", remoteRepository.getId( ), e.getMessage( ), e );
377 throw new IndexUpdateFailedException( "Error while updating the remote index of " + remoteRepository.getId( ), e );
384 public void addArtifactsToIndex( final ArchivaIndexingContext context, final Collection<URI> artifactReference ) throws IndexUpdateFailedException
386 final URI ctxUri = context.getPath();
387 executeUpdateFunction(context, indexingContext -> {
388 Collection<ArtifactContext> artifacts = artifactReference.stream().map(r -> artifactContextProducer.getArtifactContext(indexingContext, Paths.get(ctxUri.resolve(r)).toFile())).collect(Collectors.toList());
390 indexer.addArtifactsToIndex(artifacts, indexingContext);
391 } catch (IOException e) {
392 log.error("IOException while adding artifact {}", e.getMessage(), e);
393 throw new IndexUpdateFailedException("Error occured while adding artifact to index of "+context.getId()
394 + (StringUtils.isNotEmpty(e.getMessage()) ? ": "+e.getMessage() : ""));
400 public void removeArtifactsFromIndex( ArchivaIndexingContext context, Collection<URI> artifactReference ) throws IndexUpdateFailedException
402 final URI ctxUri = context.getPath();
403 executeUpdateFunction(context, indexingContext -> {
404 Collection<ArtifactContext> artifacts = artifactReference.stream().map(r -> artifactContextProducer.getArtifactContext(indexingContext, Paths.get(ctxUri.resolve(r)).toFile())).collect(Collectors.toList());
406 indexer.deleteArtifactsFromIndex(artifacts, indexingContext);
407 } catch (IOException e) {
408 log.error("IOException while removing artifact {}", e.getMessage(), e);
409 throw new IndexUpdateFailedException("Error occured while removing artifact from index of "+context.getId()
410 + (StringUtils.isNotEmpty(e.getMessage()) ? ": "+e.getMessage() : ""));
417 public boolean supportsRepository( RepositoryType type )
419 return type == RepositoryType.MAVEN;
423 public ArchivaIndexingContext createContext( Repository repository ) throws IndexCreationFailedException
426 if ( repository.getType( ) != RepositoryType.MAVEN )
428 throw new UnsupportedRepositoryTypeException( repository.getType( ) );
430 IndexingContext mvnCtx = null;
433 if ( repository instanceof RemoteRepository )
435 mvnCtx = createRemoteContext( (RemoteRepository) repository );
437 else if ( repository instanceof ManagedRepository )
439 mvnCtx = createManagedContext( (ManagedRepository) repository );
442 catch ( IOException e )
444 log.error( "IOException during context creation " + e.getMessage( ), e );
445 throw new IndexCreationFailedException( "Could not create index context for repository " + repository.getId( )
446 + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? ": " + e.getMessage( ) : "" ), e );
448 MavenIndexContext context = new MavenIndexContext( repository, mvnCtx );
452 private IndexingContext createRemoteContext( RemoteRepository remoteRepository ) throws IOException
454 Path appServerBase = archivaConfiguration.getAppServerBaseDir( );
456 String contextKey = "remote-" + remoteRepository.getId( );
458 // create remote repository path
459 Path repoDir = appServerBase.resolve( "data" ).resolve( "remotes" ).resolve( remoteRepository.getId( ) );
460 if ( !Files.exists( repoDir ) )
462 Files.createDirectories( repoDir );
467 // is there configured indexDirectory ?
468 if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) )
470 RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
471 indexDirectory = PathUtil.getPathFromUri( rif.getIndexUri( ) );
472 if ( !indexDirectory.isAbsolute( ) )
474 indexDirectory = repoDir.resolve( indexDirectory );
477 // if not configured use a default value
478 if ( indexDirectory == null )
480 indexDirectory = repoDir.resolve( ".index" );
482 if ( !Files.exists( indexDirectory ) )
484 Files.createDirectories( indexDirectory );
487 String remoteIndexUrl = calculateIndexRemoteUrl( remoteRepository.getLocation( ), rif );
491 return getIndexingContext( remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl );
493 catch ( IndexFormatTooOldException e )
495 // existing index with an old lucene format so we need to delete it!!!
496 // delete it first then recreate it.
497 log.warn( "the index of repository {} is too old we have to delete and recreate it", //
498 remoteRepository.getId( ) );
499 org.apache.archiva.common.utils.FileUtils.deleteDirectory( indexDirectory );
500 return getIndexingContext( remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl );
506 throw new IOException( "No remote index defined" );
510 private IndexingContext getIndexingContext( Repository repository, String contextKey, Path repoDir, Path indexDirectory, String indexUrl ) throws IOException
512 return indexer.createIndexingContext( contextKey, repository.getId( ), repoDir.toFile( ), indexDirectory.toFile( ),
513 repository.getLocation( ) == null ? null : repository.getLocation( ).toString( ),
519 private IndexingContext createManagedContext( ManagedRepository repository ) throws IOException
522 IndexingContext context;
523 // take care first about repository location as can be relative
524 Path repositoryDirectory = repository.getLocalPath();
526 if ( !Files.exists( repositoryDirectory ) )
530 Files.createDirectories( repositoryDirectory );
532 catch ( IOException e )
534 log.error( "Could not create directory {}", repositoryDirectory );
539 if ( repository.supportsFeature( IndexCreationFeature.class ) )
541 IndexCreationFeature icf = repository.getFeature( IndexCreationFeature.class ).get( );
542 URI indexDir = icf.getIndexPath( );
543 //File managedRepository = new File( repository.getLocation() );
545 Path indexDirectory = null;
546 if ( indexDir != null && !"".equals( indexDir.toString( ) ) )
549 indexDirectory = PathUtil.getPathFromUri( indexDir );
550 // not absolute so create it in repository directory
551 if ( !indexDirectory.isAbsolute( ) )
553 indexDirectory = repositoryDirectory.resolve( indexDirectory );
555 icf.setIndexPath( indexDirectory.normalize( ).toUri( ) );
559 indexDirectory = repositoryDirectory.resolve( ".indexer" );
560 icf.setIndexPath( indexDirectory.toUri( ) );
563 if ( !Files.exists( indexDirectory ) )
565 Files.createDirectories( indexDirectory );
568 String indexUrl = repositoryDirectory.toUri( ).toURL( ).toExternalForm( );
571 context = getIndexingContext( repository, repository.getId( ), repositoryDirectory, indexDirectory, indexUrl );
572 context.setSearchable( repository.isScanned( ) );
574 catch ( IndexFormatTooOldException e )
576 // existing index with an old lucene format so we need to delete it!!!
577 // delete it first then recreate it.
578 log.warn( "the index of repository {} is too old we have to delete and recreate it", //
579 repository.getId( ) );
580 org.apache.archiva.common.utils.FileUtils.deleteDirectory( indexDirectory );
581 context = getIndexingContext( repository, repository.getId( ), repositoryDirectory, indexDirectory, indexUrl );
582 context.setSearchable( repository.isScanned( ) );
588 throw new IOException( "No repository index defined" );
592 private String calculateIndexRemoteUrl( URI baseUri, RemoteIndexFeature rif )
594 if ( rif.getIndexUri( ) == null )
596 return baseUri.resolve( ".index" ).toString( );
600 return baseUri.resolve( rif.getIndexUri( ) ).toString( );
604 private static final class DownloadListener
605 implements TransferListener
607 private Logger log = LoggerFactory.getLogger( getClass( ) );
609 private String resourceName;
611 private long startTime;
613 private int totalLength = 0;
616 public void transferInitiated( TransferEvent transferEvent )
618 startTime = System.currentTimeMillis( );
619 resourceName = transferEvent.getResource( ).getName( );
620 log.debug( "initiate transfer of {}", resourceName );
624 public void transferStarted( TransferEvent transferEvent )
626 this.totalLength = 0;
627 resourceName = transferEvent.getResource( ).getName( );
628 log.info( "start transfer of {}", transferEvent.getResource( ).getName( ) );
632 public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
634 log.debug( "transfer of {} : {}/{}", transferEvent.getResource( ).getName( ), buffer.length, length );
635 this.totalLength += length;
639 public void transferCompleted( TransferEvent transferEvent )
641 resourceName = transferEvent.getResource( ).getName( );
642 long endTime = System.currentTimeMillis( );
643 log.info( "end of transfer file {} {} kb: {}s", transferEvent.getResource( ).getName( ),
644 this.totalLength / 1024, ( endTime - startTime ) / 1000 );
648 public void transferError( TransferEvent transferEvent )
650 log.info( "error of transfer file {}: {}", transferEvent.getResource( ).getName( ),
651 transferEvent.getException( ).getMessage( ), transferEvent.getException( ) );
655 public void debug( String message )
657 log.debug( "transfer debug {}", message );
661 private static class WagonResourceFetcher
662 implements ResourceFetcher
667 Path tempIndexDirectory;
671 RemoteRepository remoteRepository;
673 private WagonResourceFetcher( Logger log, Path tempIndexDirectory, Wagon wagon,
674 RemoteRepository remoteRepository )
677 this.tempIndexDirectory = tempIndexDirectory;
679 this.remoteRepository = remoteRepository;
683 public void connect( String id, String url )
690 public void disconnect( )
697 public InputStream retrieve( String name )
698 throws IOException, FileNotFoundException
702 log.info( "index update retrieve file, name:{}", name );
703 Path file = tempIndexDirectory.resolve( name );
704 Files.deleteIfExists( file );
705 file.toFile( ).deleteOnExit( );
706 wagon.get( addParameters( name, remoteRepository ), file.toFile( ) );
707 return Files.newInputStream( file );
709 catch ( AuthorizationException | TransferFailedException e )
711 throw new IOException( e.getMessage( ), e );
713 catch ( ResourceDoesNotExistException e )
715 FileNotFoundException fnfe = new FileNotFoundException( e.getMessage( ) );
721 // FIXME remove crappy copy/paste
722 protected String addParameters( String path, RemoteRepository remoteRepository )
724 if ( remoteRepository.getExtraParameters( ).isEmpty( ) )
729 boolean question = false;
731 StringBuilder res = new StringBuilder( path == null ? "" : path );
733 for ( Map.Entry<String, String> entry : remoteRepository.getExtraParameters( ).entrySet( ) )
737 res.append( '?' ).append( entry.getKey( ) ).append( '=' ).append( entry.getValue( ) );
741 return res.toString( );