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.model.ArtifactReference;
33 import org.apache.archiva.proxy.common.WagonFactory;
34 import org.apache.archiva.proxy.common.WagonFactoryException;
35 import org.apache.archiva.proxy.common.WagonFactoryRequest;
36 import org.apache.archiva.repository.ManagedRepository;
37 import org.apache.archiva.repository.PasswordCredentials;
38 import org.apache.archiva.repository.RemoteRepository;
39 import org.apache.archiva.repository.Repository;
40 import org.apache.archiva.repository.RepositoryType;
41 import org.apache.archiva.repository.UnsupportedRepositoryTypeException;
42 import org.apache.archiva.repository.features.IndexCreationFeature;
43 import org.apache.archiva.repository.features.RemoteIndexFeature;
44 import org.apache.commons.lang.StringUtils;
45 import org.apache.maven.index.*;
46 import org.apache.maven.index.context.IndexCreator;
47 import org.apache.maven.index.context.IndexingContext;
48 import org.apache.maven.index.packer.IndexPacker;
49 import org.apache.maven.index.packer.IndexPackingRequest;
50 import org.apache.maven.index.updater.IndexUpdateRequest;
51 import org.apache.maven.index.updater.IndexUpdater;
52 import org.apache.maven.index.updater.ResourceFetcher;
53 import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException;
54 import org.apache.maven.wagon.ConnectionException;
55 import org.apache.maven.wagon.ResourceDoesNotExistException;
56 import org.apache.maven.wagon.StreamWagon;
57 import org.apache.maven.wagon.TransferFailedException;
58 import org.apache.maven.wagon.Wagon;
59 import org.apache.maven.wagon.authentication.AuthenticationException;
60 import org.apache.maven.wagon.authentication.AuthenticationInfo;
61 import org.apache.maven.wagon.authorization.AuthorizationException;
62 import org.apache.maven.wagon.events.TransferEvent;
63 import org.apache.maven.wagon.events.TransferListener;
64 import org.apache.maven.wagon.proxy.ProxyInfo;
65 import org.apache.maven.wagon.shared.http.AbstractHttpClientWagon;
66 import org.apache.maven.wagon.shared.http.HttpConfiguration;
67 import org.apache.maven.wagon.shared.http.HttpMethodConfiguration;
68 import org.slf4j.Logger;
69 import org.slf4j.LoggerFactory;
70 import org.springframework.stereotype.Service;
72 import javax.inject.Inject;
73 import java.io.FileNotFoundException;
74 import java.io.IOException;
75 import java.io.InputStream;
76 import java.net.MalformedURLException;
78 import java.nio.file.Files;
79 import java.nio.file.Path;
80 import java.nio.file.Paths;
81 import java.util.ArrayList;
82 import java.util.Collection;
83 import java.util.List;
85 import java.util.concurrent.ConcurrentSkipListSet;
86 import java.util.stream.Collectors;
89 * Maven implementation of index manager.
90 * The index manager is a singleton, so we try to make sure, that index operations are not running
91 * parallel by synchronizing on the index path.
92 * A update operation waits for parallel running methods to finish before starting, but after a certain
93 * time of retries a IndexUpdateFailedException is thrown.
95 @Service( "archivaIndexManager#maven" )
96 public class MavenIndexManager implements ArchivaIndexManager
99 private static final Logger log = LoggerFactory.getLogger( MavenIndexManager.class );
102 private Indexer indexer;
105 private IndexerEngine indexerEngine;
108 private List<? extends IndexCreator> indexCreators;
111 private IndexPacker indexPacker;
114 private Scanner scanner;
117 private ArchivaConfiguration archivaConfiguration;
120 private WagonFactory wagonFactory;
123 private NetworkProxyAdmin networkProxyAdmin;
126 private IndexUpdater indexUpdater;
129 private ArtifactContextProducer artifactContextProducer;
131 private ConcurrentSkipListSet<Path> activeContexts = new ConcurrentSkipListSet<>( );
133 private static final int WAIT_TIME = 100;
134 private static final int MAX_WAIT = 10;
137 IndexingContext getMvnContext( ArchivaIndexingContext context ) throws UnsupportedBaseContextException
139 if ( !context.supports( IndexingContext.class ) )
141 log.error( "The provided archiva index context does not support the maven IndexingContext" );
142 throw new UnsupportedBaseContextException( "The context does not support the Maven IndexingContext" );
144 return context.getBaseContext( IndexingContext.class );
147 private Path getIndexPath( ArchivaIndexingContext ctx )
149 return PathUtil.getPathFromUri( ctx.getPath( ) );
153 interface IndexUpdateConsumer
156 void accept( IndexingContext indexingContext ) throws IndexUpdateFailedException;
160 * This method is used to do some actions around the update execution code. And to make sure, that no other
161 * method is running on the same index.
163 private void executeUpdateFunction( ArchivaIndexingContext context, IndexUpdateConsumer function ) throws IndexUpdateFailedException
165 IndexingContext indexingContext = null;
168 indexingContext = getMvnContext( context );
170 catch ( UnsupportedBaseContextException e )
172 throw new IndexUpdateFailedException( "Maven index is not supported by this context", e );
174 final Path ctxPath = getIndexPath( context );
176 boolean active = false;
177 while ( loop-- > 0 && !active )
179 active = activeContexts.add( ctxPath );
182 Thread.currentThread( ).sleep( WAIT_TIME );
184 catch ( InterruptedException e )
193 function.accept( indexingContext );
197 activeContexts.remove( ctxPath );
202 throw new IndexUpdateFailedException( "Timeout while waiting for index release on context " + context.getId( ) );
207 public void pack( final ArchivaIndexingContext context ) throws IndexUpdateFailedException
209 executeUpdateFunction( context, indexingContext -> {
212 IndexPackingRequest request = new IndexPackingRequest( indexingContext,
213 indexingContext.acquireIndexSearcher( ).getIndexReader( ),
214 indexingContext.getIndexDirectoryFile( ) );
215 indexPacker.packIndex( request );
216 indexingContext.updateTimestamp( true );
218 catch ( IOException e )
220 log.error( "IOException while packing index of context " + context.getId( ) + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? ": " + e.getMessage( ) : "" ) );
221 throw new IndexUpdateFailedException( "IOException during update of " + context.getId( ), e );
229 public void scan( final ArchivaIndexingContext context, final boolean update ) throws IndexUpdateFailedException
231 executeUpdateFunction( context, indexingContext -> {
232 DefaultScannerListener listener = new DefaultScannerListener( indexingContext, indexerEngine, update, null );
233 ScanningRequest request = new ScanningRequest( indexingContext, listener );
234 ScanningResult result = scanner.scan( request );
235 if ( result.hasExceptions( ) )
237 log.error( "Exceptions occured during index scan of " + context.getId( ) );
238 result.getExceptions( ).stream( ).map( e -> e.getMessage( ) ).distinct( ).limit( 5 ).forEach(
239 s -> log.error( "Message: " + s )
247 public void update( final ArchivaIndexingContext context, final URI remoteUpdateUri, final boolean fullUpdate ) throws IndexUpdateFailedException
249 log.info( "start download remote index for remote repository {}", context.getRepository( ).getId( ) );
251 if ( !( context.getRepository( ) instanceof RemoteRepository ) )
253 throw new IndexUpdateFailedException( "The context is not associated to a remote repository " + context.getId( ) );
255 final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( );
257 executeUpdateFunction( context,
261 // create a temp directory to download files
262 Path tempIndexDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), ".tmpIndex" );
263 Path indexCacheDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), ".indexCache" );
264 Files.createDirectories( indexCacheDirectory );
265 if ( Files.exists( tempIndexDirectory ) )
267 org.apache.archiva.common.utils.FileUtils.deleteDirectory( tempIndexDirectory );
269 Files.createDirectories( tempIndexDirectory );
270 tempIndexDirectory.toFile( ).deleteOnExit( );
271 String baseIndexUrl = indexingContext.getIndexUpdateUrl( );
273 String wagonProtocol = remoteUpdateUri.toURL( ).getProtocol( );
275 NetworkProxy networkProxy = null;
276 if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) )
278 RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
279 if ( StringUtils.isNotBlank( rif.getProxyId( ) ) )
283 networkProxy = networkProxyAdmin.getNetworkProxy( rif.getProxyId( ) );
285 catch ( RepositoryAdminException e )
287 log.error( "Error occured while retrieving proxy {}", e.getMessage( ) );
289 if ( networkProxy == null )
292 "your remote repository is configured to download remote index trought a proxy we cannot find id:{}",
297 final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon(
298 new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders( ) ).networkProxy(
301 int readTimeout = (int) rif.getDownloadTimeout( ).toMillis( ) * 1000;
302 wagon.setReadTimeout( readTimeout );
303 wagon.setTimeout( (int) remoteRepository.getTimeout( ).toMillis( ) * 1000 );
305 if ( wagon instanceof AbstractHttpClientWagon )
307 HttpConfiguration httpConfiguration = new HttpConfiguration( );
308 HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration( );
309 httpMethodConfiguration.setUsePreemptive( true );
310 httpMethodConfiguration.setReadTimeout( readTimeout );
311 httpConfiguration.setGet( httpMethodConfiguration );
312 AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration );
315 wagon.addTransferListener( new DownloadListener( ) );
316 ProxyInfo proxyInfo = null;
317 if ( networkProxy != null )
319 proxyInfo = new ProxyInfo( );
320 proxyInfo.setType( networkProxy.getProtocol( ) );
321 proxyInfo.setHost( networkProxy.getHost( ) );
322 proxyInfo.setPort( networkProxy.getPort( ) );
323 proxyInfo.setUserName( networkProxy.getUsername( ) );
324 proxyInfo.setPassword( networkProxy.getPassword( ) );
326 AuthenticationInfo authenticationInfo = null;
327 if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials ) )
329 PasswordCredentials creds = (PasswordCredentials) remoteRepository.getLoginCredentials( );
330 authenticationInfo = new AuthenticationInfo( );
331 authenticationInfo.setUserName( creds.getUsername( ) );
332 authenticationInfo.setPassword( new String( creds.getPassword( ) ) );
334 wagon.connect( new org.apache.maven.wagon.repository.Repository( remoteRepository.getId( ), baseIndexUrl ), authenticationInfo,
337 Path indexDirectory = indexingContext.getIndexDirectoryFile( ).toPath( );
338 if ( !Files.exists( indexDirectory ) )
340 Files.createDirectories( indexDirectory );
343 ResourceFetcher resourceFetcher =
344 new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository );
345 IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
346 request.setForceFullUpdate( fullUpdate );
347 request.setLocalIndexCacheDir( indexCacheDirectory.toFile( ) );
349 indexUpdater.fetchAndUpdateIndex( request );
351 indexingContext.updateTimestamp( true );
355 catch ( AuthenticationException e )
357 log.error( "Could not login to the remote proxy for updating index of {}", remoteRepository.getId( ), e );
358 throw new IndexUpdateFailedException( "Login in to proxy failed while updating remote repository " + remoteRepository.getId( ), e );
360 catch ( ConnectionException e )
362 log.error( "Connection error during index update for remote repository {}", remoteRepository.getId( ), e );
363 throw new IndexUpdateFailedException( "Connection error during index update for remote repository " + remoteRepository.getId( ), e );
365 catch ( MalformedURLException e )
367 log.error( "URL for remote index update of remote repository {} is not correct {}", remoteRepository.getId( ), remoteUpdateUri, e );
368 throw new IndexUpdateFailedException( "URL for remote index update of repository is not correct " + remoteUpdateUri, e );
370 catch ( IOException e )
372 log.error( "IOException during index update of remote repository {}: {}", remoteRepository.getId( ), e.getMessage( ), e );
373 throw new IndexUpdateFailedException( "IOException during index update of remote repository " + remoteRepository.getId( )
374 + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? ": " + e.getMessage( ) : "" ), e );
376 catch ( WagonFactoryException e )
378 log.error( "Wagon for remote index download of {} could not be created: {}", remoteRepository.getId( ), e.getMessage( ), e );
379 throw new IndexUpdateFailedException( "Error while updating the remote index of " + remoteRepository.getId( ), e );
386 public void addArtifactsToIndex( final ArchivaIndexingContext context, final Collection<Path> artifactReference ) throws IndexUpdateFailedException
388 executeUpdateFunction(context, indexingContext -> {
389 Collection<ArtifactContext> artifacts = artifactReference.stream().map(r -> artifactContextProducer.getArtifactContext(indexingContext, r.toFile())).collect(Collectors.toList());
391 indexer.addArtifactsToIndex(artifacts, indexingContext);
392 } catch (IOException e) {
393 log.error("IOException while adding artifact {}", e.getMessage(), e);
394 throw new IndexUpdateFailedException("Error occured while adding artifact to index of "+context.getId()
395 + (StringUtils.isNotEmpty(e.getMessage()) ? ": "+e.getMessage() : ""));
401 public void removeArtifactsFromIndex( ArchivaIndexingContext context, Collection<Path> artifactReference ) throws IndexUpdateFailedException
403 executeUpdateFunction(context, indexingContext -> {
404 Collection<ArtifactContext> artifacts = artifactReference.stream().map(r -> artifactContextProducer.getArtifactContext(indexingContext, 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( );