]> source.dussan.org Git - archiva.git/blob
ce696ebe6d438912c4484358dc53da20df2937ed
[archiva.git] /
1
2 package org.apache.archiva.configuration.io.registry;
3
4 /*
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements.  See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership.  The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the
10  * "License"); you may not use this file except in compliance
11  * with the License.  You may obtain a copy of the License at
12  *
13  *   http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing,
16  * software distributed under the License is distributed on an
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  * KIND, either express or implied.  See the License for the
19  * specific language governing permissions and limitations
20  * under the License.
21  */
22
23 import org.apache.archiva.redback.components.registry.Registry;
24
25 // Util imports
26 import java.util.*;
27
28 // Model class imports
29 import org.apache.archiva.configuration.Configuration;
30 import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
31 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
32 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
33 import org.apache.archiva.configuration.LegacyArtifactPath;
34 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
35 import org.apache.archiva.configuration.RepositoryCheckPath;
36 import org.apache.archiva.configuration.AbstractRepositoryConnectorConfiguration;
37 import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration;
38 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
39 import org.apache.archiva.configuration.SyncConnectorConfiguration;
40 import org.apache.archiva.configuration.NetworkProxyConfiguration;
41 import org.apache.archiva.configuration.RepositoryScanningConfiguration;
42 import org.apache.archiva.configuration.FileType;
43 import org.apache.archiva.configuration.OrganisationInformation;
44 import org.apache.archiva.configuration.WebappConfiguration;
45 import org.apache.archiva.configuration.UserInterfaceOptions;
46 import org.apache.archiva.configuration.NetworkConfiguration;
47 import org.apache.archiva.configuration.ArchivaRuntimeConfiguration;
48 import org.apache.archiva.configuration.RedbackRuntimeConfiguration;
49 import org.apache.archiva.configuration.ArchivaDefaultConfiguration;
50 import org.apache.archiva.configuration.LdapConfiguration;
51 import org.apache.archiva.configuration.FileLockConfiguration;
52 import org.apache.archiva.configuration.CacheConfiguration;
53 import org.apache.archiva.configuration.LdapGroupMapping;
54
55
56
57
58 /**
59  * Generate Plexus Registry output mechanism for model 'Configuration'.
60  */
61 public class ConfigurationRegistryWriter
62 {
63     public void write( Configuration model, Registry registry )
64     {
65         writeConfiguration( "", model, registry );
66     }
67
68     private void writeConfiguration( String prefix, Configuration value, Registry registry )
69     {
70         if ( value != null )
71         {
72                   if ( value.getVersion() != null
73  )
74             {
75                       String version = "version";
76                 registry.setString( prefix + version, value.getVersion() );
77                   }
78                         if ( value.getMetadataStore() != null && !value.getMetadataStore().equals( "jcr" )
79  )
80             {
81                       String metadataStore = "metadataStore";
82                 registry.setString( prefix + metadataStore, value.getMetadataStore() );
83                   }
84                   if ( value.getRepositoryGroups() != null && value.getRepositoryGroups().size() > 0
85  )
86             {
87                 registry.removeSubset( prefix + "repositoryGroups" );
88
89                 int count = 0;
90                 for ( Iterator iter = value.getRepositoryGroups().iterator(); iter.hasNext(); count++ )
91                 {
92                     String name = "repositoryGroups.repositoryGroup(" + count + ")";
93                     RepositoryGroupConfiguration o = ( RepositoryGroupConfiguration ) iter.next();
94                     writeRepositoryGroupConfiguration( prefix + name + ".", o, registry );
95                 }
96             }
97             if ( value.getManagedRepositories() != null && value.getManagedRepositories().size() > 0
98  )
99             {
100                 registry.removeSubset( prefix + "managedRepositories" );
101
102                 int count = 0;
103                 for ( Iterator iter = value.getManagedRepositories().iterator(); iter.hasNext(); count++ )
104                 {
105                     String name = "managedRepositories.managedRepository(" + count + ")";
106                     ManagedRepositoryConfiguration o = ( ManagedRepositoryConfiguration ) iter.next();
107                     writeManagedRepositoryConfiguration( prefix + name + ".", o, registry );
108                 }
109             }
110             if ( value.getRemoteRepositories() != null && value.getRemoteRepositories().size() > 0
111  )
112             {
113                 registry.removeSubset( prefix + "remoteRepositories" );
114
115                 int count = 0;
116                 for ( Iterator iter = value.getRemoteRepositories().iterator(); iter.hasNext(); count++ )
117                 {
118                     String name = "remoteRepositories.remoteRepository(" + count + ")";
119                     RemoteRepositoryConfiguration o = ( RemoteRepositoryConfiguration ) iter.next();
120                     writeRemoteRepositoryConfiguration( prefix + name + ".", o, registry );
121                 }
122             }
123             if ( value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
124  )
125             {
126                 registry.removeSubset( prefix + "proxyConnectors" );
127
128                 int count = 0;
129                 for ( Iterator iter = value.getProxyConnectors().iterator(); iter.hasNext(); count++ )
130                 {
131                     String name = "proxyConnectors.proxyConnector(" + count + ")";
132                     ProxyConnectorConfiguration o = ( ProxyConnectorConfiguration ) iter.next();
133                     writeProxyConnectorConfiguration( prefix + name + ".", o, registry );
134                 }
135             }
136             if ( value.getNetworkProxies() != null && value.getNetworkProxies().size() > 0
137  )
138             {
139                 registry.removeSubset( prefix + "networkProxies" );
140
141                 int count = 0;
142                 for ( Iterator iter = value.getNetworkProxies().iterator(); iter.hasNext(); count++ )
143                 {
144                     String name = "networkProxies.networkProxy(" + count + ")";
145                     NetworkProxyConfiguration o = ( NetworkProxyConfiguration ) iter.next();
146                     writeNetworkProxyConfiguration( prefix + name + ".", o, registry );
147                 }
148             }
149             if ( value.getLegacyArtifactPaths() != null && value.getLegacyArtifactPaths().size() > 0
150  )
151             {
152                 registry.removeSubset( prefix + "legacyArtifactPaths" );
153
154                 int count = 0;
155                 for ( Iterator iter = value.getLegacyArtifactPaths().iterator(); iter.hasNext(); count++ )
156                 {
157                     String name = "legacyArtifactPaths.legacyArtifactPath(" + count + ")";
158                     LegacyArtifactPath o = ( LegacyArtifactPath ) iter.next();
159                     writeLegacyArtifactPath( prefix + name + ".", o, registry );
160                 }
161             }
162             if ( value.getRepositoryScanning() != null
163  )
164             {
165                 writeRepositoryScanningConfiguration( prefix + "repositoryScanning.", value.getRepositoryScanning(), registry );
166             }
167             if ( value.getWebapp() != null
168  )
169             {
170                 writeWebappConfiguration( prefix + "webapp.", value.getWebapp(), registry );
171             }
172             if ( value.getOrganisationInfo() != null
173  )
174             {
175                 writeOrganisationInformation( prefix + "organisationInfo.", value.getOrganisationInfo(), registry );
176             }
177             if ( value.getNetworkConfiguration() != null
178  )
179             {
180                 writeNetworkConfiguration( prefix + "networkConfiguration.", value.getNetworkConfiguration(), registry );
181             }
182             if ( value.getRedbackRuntimeConfiguration() != null
183  )
184             {
185                 writeRedbackRuntimeConfiguration( prefix + "redbackRuntimeConfiguration.", value.getRedbackRuntimeConfiguration(), registry );
186             }
187             if ( value.getArchivaRuntimeConfiguration() != null
188  )
189             {
190                 writeArchivaRuntimeConfiguration( prefix + "archivaRuntimeConfiguration.", value.getArchivaRuntimeConfiguration(), registry );
191             }
192             if ( value.getProxyConnectorRuleConfigurations() != null && value.getProxyConnectorRuleConfigurations().size() > 0
193  )
194             {
195                 registry.removeSubset( prefix + "proxyConnectorRuleConfigurations" );
196
197                 int count = 0;
198                 for ( Iterator iter = value.getProxyConnectorRuleConfigurations().iterator(); iter.hasNext(); count++ )
199                 {
200                     String name = "proxyConnectorRuleConfigurations.proxyConnectorRuleConfiguration(" + count + ")";
201                     ProxyConnectorRuleConfiguration o = ( ProxyConnectorRuleConfiguration ) iter.next();
202                     writeProxyConnectorRuleConfiguration( prefix + name + ".", o, registry );
203                 }
204             }
205             if ( value.getArchivaDefaultConfiguration() != null
206  )
207             {
208                 writeArchivaDefaultConfiguration( prefix + "archivaDefaultConfiguration.", value.getArchivaDefaultConfiguration(), registry );
209             }
210         }
211     }
212     
213     private void writeAbstractRepositoryConfiguration( String prefix, AbstractRepositoryConfiguration value, Registry registry )
214     {
215         if ( value != null )
216         {
217                   if ( value.getId() != null
218  )
219             {
220                       String id = "id";
221                 registry.setString( prefix + id, value.getId() );
222                   }
223                         if ( value.getType() != null && !value.getType().equals( "MAVEN" )
224  )
225             {
226                       String type = "type";
227                 registry.setString( prefix + type, value.getType() );
228                   }
229                         if ( value.getName() != null
230  )
231             {
232                       String name = "name";
233                 registry.setString( prefix + name, value.getName() );
234                   }
235                         if ( value.getLayout() != null && !value.getLayout().equals( "default" )
236  )
237             {
238                       String layout = "layout";
239                 registry.setString( prefix + layout, value.getLayout() );
240                   }
241                         if ( value.getIndexDir() != null && !value.getIndexDir().equals( "" )
242  )
243             {
244                       String indexDir = "indexDir";
245                 registry.setString( prefix + indexDir, value.getIndexDir() );
246                   }
247                         if ( value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals( "" )
248  )
249             {
250                       String packedIndexDir = "packedIndexDir";
251                 registry.setString( prefix + packedIndexDir, value.getPackedIndexDir() );
252                   }
253                         if ( value.getDescription() != null && !value.getDescription().equals( "" )
254  )
255             {
256                       String description = "description";
257                 registry.setString( prefix + description, value.getDescription() );
258                   }
259               }
260     }
261     
262     private void writeRemoteRepositoryConfiguration( String prefix, RemoteRepositoryConfiguration value, Registry registry )
263     {
264         if ( value != null )
265         {
266                   if ( value.getUrl() != null
267  )
268             {
269                       String url = "url";
270                 registry.setString( prefix + url, value.getUrl() );
271                   }
272                         if ( value.getUsername() != null
273  )
274             {
275                       String username = "username";
276                 registry.setString( prefix + username, value.getUsername() );
277                   }
278                         if ( value.getPassword() != null
279  )
280             {
281                       String password = "password";
282                 registry.setString( prefix + password, value.getPassword() );
283                   }
284                         if ( value.getTimeout() != 60
285  )
286             {
287                       String timeout = "timeout";
288                 registry.setInt( prefix + timeout, value.getTimeout() );
289                   }
290                         if ( value.getRefreshCronExpression() != null && !value.getRefreshCronExpression().equals( "0 0 08 ? * SUN" )
291  )
292             {
293                       String refreshCronExpression = "refreshCronExpression";
294                 registry.setString( prefix + refreshCronExpression, value.getRefreshCronExpression() );
295                   }
296                             String downloadRemoteIndex = "downloadRemoteIndex";
297                 registry.setBoolean( prefix + downloadRemoteIndex, value.isDownloadRemoteIndex() );
298                         if ( value.getRemoteIndexUrl() != null
299  )
300             {
301                       String remoteIndexUrl = "remoteIndexUrl";
302                 registry.setString( prefix + remoteIndexUrl, value.getRemoteIndexUrl() );
303                   }
304                         if ( value.getRemoteDownloadNetworkProxyId() != null
305  )
306             {
307                       String remoteDownloadNetworkProxyId = "remoteDownloadNetworkProxyId";
308                 registry.setString( prefix + remoteDownloadNetworkProxyId, value.getRemoteDownloadNetworkProxyId() );
309                   }
310                         if ( value.getRemoteDownloadTimeout() != 300
311  )
312             {
313                       String remoteDownloadTimeout = "remoteDownloadTimeout";
314                 registry.setInt( prefix + remoteDownloadTimeout, value.getRemoteDownloadTimeout() );
315                   }
316                             String downloadRemoteIndexOnStartup = "downloadRemoteIndexOnStartup";
317                 registry.setBoolean( prefix + downloadRemoteIndexOnStartup, value.isDownloadRemoteIndexOnStartup() );
318                   if ( value.getExtraParameters() != null && value.getExtraParameters().size() > 0
319  )
320             {
321                 registry.removeSubset( prefix + "extraParameters" );
322                 
323                 for ( Iterator iter = value.getExtraParameters().keySet().iterator(); iter.hasNext(); )
324                 {
325                     String key = (String) iter.next();
326                     String v = (String) value.getExtraParameters().get( key );
327
328                     registry.setString( prefix + "extraParameters." + key, v );
329                 }
330             }
331             if ( value.getExtraHeaders() != null && value.getExtraHeaders().size() > 0
332  )
333             {
334                 registry.removeSubset( prefix + "extraHeaders" );
335                 
336                 for ( Iterator iter = value.getExtraHeaders().keySet().iterator(); iter.hasNext(); )
337                 {
338                     String key = (String) iter.next();
339                     String v = (String) value.getExtraHeaders().get( key );
340
341                     registry.setString( prefix + "extraHeaders." + key, v );
342                 }
343             }
344                   if ( value.getCheckPath() != null
345  )
346             {
347                       String checkPath = "checkPath";
348                 registry.setString( prefix + checkPath, value.getCheckPath() );
349                   }
350                         if ( value.getId() != null
351  )
352             {
353                       String id = "id";
354                 registry.setString( prefix + id, value.getId() );
355                   }
356                         if ( value.getType() != null && !value.getType().equals( "MAVEN" )
357  )
358             {
359                       String type = "type";
360                 registry.setString( prefix + type, value.getType() );
361                   }
362                         if ( value.getName() != null
363  )
364             {
365                       String name = "name";
366                 registry.setString( prefix + name, value.getName() );
367                   }
368                         if ( value.getLayout() != null && !value.getLayout().equals( "default" )
369  )
370             {
371                       String layout = "layout";
372                 registry.setString( prefix + layout, value.getLayout() );
373                   }
374                         if ( value.getIndexDir() != null && !value.getIndexDir().equals( "" )
375  )
376             {
377                       String indexDir = "indexDir";
378                 registry.setString( prefix + indexDir, value.getIndexDir() );
379                   }
380                         if ( value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals( "" )
381  )
382             {
383                       String packedIndexDir = "packedIndexDir";
384                 registry.setString( prefix + packedIndexDir, value.getPackedIndexDir() );
385                   }
386                         if ( value.getDescription() != null && !value.getDescription().equals( "" )
387  )
388             {
389                       String description = "description";
390                 registry.setString( prefix + description, value.getDescription() );
391                   }
392               }
393     }
394     
395     private void writeManagedRepositoryConfiguration( String prefix, ManagedRepositoryConfiguration value, Registry registry )
396     {
397         if ( value != null )
398         {
399                   if ( value.getLocation() != null
400  )
401             {
402                       String location = "location";
403                 registry.setString( prefix + location, value.getLocation() );
404                   }
405                             String releases = "releases";
406                 registry.setBoolean( prefix + releases, value.isReleases() );
407                             String blockRedeployments = "blockRedeployments";
408                 registry.setBoolean( prefix + blockRedeployments, value.isBlockRedeployments() );
409                             String snapshots = "snapshots";
410                 registry.setBoolean( prefix + snapshots, value.isSnapshots() );
411                             String scanned = "scanned";
412                 registry.setBoolean( prefix + scanned, value.isScanned() );
413                         if ( value.getRefreshCronExpression() != null && !value.getRefreshCronExpression().equals( "0 0 * * * ?" )
414  )
415             {
416                       String refreshCronExpression = "refreshCronExpression";
417                 registry.setString( prefix + refreshCronExpression, value.getRefreshCronExpression() );
418                   }
419                         if ( value.getRetentionCount() != 2
420  )
421             {
422                       String retentionCount = "retentionCount";
423                 registry.setInt( prefix + retentionCount, value.getRetentionCount() );
424                   }
425                         if ( value.getRetentionPeriod() != 100
426  )
427             {
428                       String retentionPeriod = "retentionPeriod";
429                 registry.setInt( prefix + retentionPeriod, value.getRetentionPeriod() );
430                   }
431                             String deleteReleasedSnapshots = "deleteReleasedSnapshots";
432                 registry.setBoolean( prefix + deleteReleasedSnapshots, value.isDeleteReleasedSnapshots() );
433                             String skipPackedIndexCreation = "skipPackedIndexCreation";
434                 registry.setBoolean( prefix + skipPackedIndexCreation, value.isSkipPackedIndexCreation() );
435                             String stageRepoNeeded = "stageRepoNeeded";
436                 registry.setBoolean( prefix + stageRepoNeeded, value.isStageRepoNeeded() );
437                         if ( value.getId() != null
438  )
439             {
440                       String id = "id";
441                 registry.setString( prefix + id, value.getId() );
442                   }
443                         if ( value.getType() != null && !value.getType().equals( "MAVEN" )
444  )
445             {
446                       String type = "type";
447                 registry.setString( prefix + type, value.getType() );
448                   }
449                         if ( value.getName() != null
450  )
451             {
452                       String name = "name";
453                 registry.setString( prefix + name, value.getName() );
454                   }
455                         if ( value.getLayout() != null && !value.getLayout().equals( "default" )
456  )
457             {
458                       String layout = "layout";
459                 registry.setString( prefix + layout, value.getLayout() );
460                   }
461                         if ( value.getIndexDir() != null && !value.getIndexDir().equals( "" )
462  )
463             {
464                       String indexDir = "indexDir";
465                 registry.setString( prefix + indexDir, value.getIndexDir() );
466                   }
467                         if ( value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals( "" )
468  )
469             {
470                       String packedIndexDir = "packedIndexDir";
471                 registry.setString( prefix + packedIndexDir, value.getPackedIndexDir() );
472                   }
473                         if ( value.getDescription() != null && !value.getDescription().equals( "" )
474  )
475             {
476                       String description = "description";
477                 registry.setString( prefix + description, value.getDescription() );
478                   }
479               }
480     }
481     
482     private void writeLegacyArtifactPath( String prefix, LegacyArtifactPath value, Registry registry )
483     {
484         if ( value != null )
485         {
486                   if ( value.getPath() != null
487  )
488             {
489                       String path = "path";
490                 registry.setString( prefix + path, value.getPath() );
491                   }
492                         if ( value.getArtifact() != null
493  )
494             {
495                       String artifact = "artifact";
496                 registry.setString( prefix + artifact, value.getArtifact() );
497                   }
498               }
499     }
500     
501     private void writeRepositoryGroupConfiguration( String prefix, RepositoryGroupConfiguration value, Registry registry )
502     {
503         if ( value != null )
504         {
505                   if ( value.getId() != null
506  )
507             {
508                       String id = "id";
509                 registry.setString( prefix + id, value.getId() );
510                   }
511                         if ( value.getMergedIndexPath() != null && !value.getMergedIndexPath().equals( ".indexer" )
512  )
513             {
514                       String mergedIndexPath = "mergedIndexPath";
515                 registry.setString( prefix + mergedIndexPath, value.getMergedIndexPath() );
516                   }
517                         if ( value.getMergedIndexTtl() != 30
518  )
519             {
520                       String mergedIndexTtl = "mergedIndexTtl";
521                 registry.setInt( prefix + mergedIndexTtl, value.getMergedIndexTtl() );
522                   }
523                         if ( value.getCronExpression() != null && !value.getCronExpression().equals( "" )
524  )
525             {
526                       String cronExpression = "cronExpression";
527                 registry.setString( prefix + cronExpression, value.getCronExpression() );
528                   }
529                   if ( value.getRepositories() != null && value.getRepositories().size() > 0
530  )
531             {
532                 registry.removeSubset( prefix + "repositories" );
533
534                 int count = 0;
535                 for ( Iterator iter = value.getRepositories().iterator(); iter.hasNext(); count++ )
536                 {
537                     String name = "repositories.repository(" + count + ")";
538                     String repository = ( String ) iter.next();
539                     registry.setString( prefix + name, repository );
540                 }
541             }
542         }
543     }
544     
545     private void writeRepositoryCheckPath( String prefix, RepositoryCheckPath value, Registry registry )
546     {
547         if ( value != null )
548         {
549                   if ( value.getUrl() != null
550  )
551             {
552                       String url = "url";
553                 registry.setString( prefix + url, value.getUrl() );
554                   }
555                         if ( value.getPath() != null
556  )
557             {
558                       String path = "path";
559                 registry.setString( prefix + path, value.getPath() );
560                   }
561               }
562     }
563     
564     private void writeAbstractRepositoryConnectorConfiguration( String prefix, AbstractRepositoryConnectorConfiguration value, Registry registry )
565     {
566         if ( value != null )
567         {
568                   if ( value.getSourceRepoId() != null
569  )
570             {
571                       String sourceRepoId = "sourceRepoId";
572                 registry.setString( prefix + sourceRepoId, value.getSourceRepoId() );
573                   }
574                         if ( value.getTargetRepoId() != null
575  )
576             {
577                       String targetRepoId = "targetRepoId";
578                 registry.setString( prefix + targetRepoId, value.getTargetRepoId() );
579                   }
580                         if ( value.getProxyId() != null
581  )
582             {
583                       String proxyId = "proxyId";
584                 registry.setString( prefix + proxyId, value.getProxyId() );
585                   }
586                   if ( value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
587  )
588             {
589                 registry.removeSubset( prefix + "blackListPatterns" );
590
591                 int count = 0;
592                 for ( Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++ )
593                 {
594                     String name = "blackListPatterns.blackListPattern(" + count + ")";
595                     String blackListPattern = ( String ) iter.next();
596                     registry.setString( prefix + name, blackListPattern );
597                 }
598             }
599             if ( value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
600  )
601             {
602                 registry.removeSubset( prefix + "whiteListPatterns" );
603
604                 int count = 0;
605                 for ( Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++ )
606                 {
607                     String name = "whiteListPatterns.whiteListPattern(" + count + ")";
608                     String whiteListPattern = ( String ) iter.next();
609                     registry.setString( prefix + name, whiteListPattern );
610                 }
611             }
612             if ( value.getPolicies() != null && value.getPolicies().size() > 0
613  )
614             {
615                 registry.removeSubset( prefix + "policies" );
616                 
617                 for ( Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); )
618                 {
619                     String key = (String) iter.next();
620                     String v = (String) value.getPolicies().get( key );
621
622                     registry.setString( prefix + "policies." + key, v );
623                 }
624             }
625             if ( value.getProperties() != null && value.getProperties().size() > 0
626  )
627             {
628                 registry.removeSubset( prefix + "properties" );
629                 
630                 for ( Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); )
631                 {
632                     String key = (String) iter.next();
633                     String v = (String) value.getProperties().get( key );
634
635                     registry.setString( prefix + "properties." + key, v );
636                 }
637             }
638                       String disabled = "disabled";
639                 registry.setBoolean( prefix + disabled, value.isDisabled() );
640               }
641     }
642     
643     private void writeProxyConnectorRuleConfiguration( String prefix, ProxyConnectorRuleConfiguration value, Registry registry )
644     {
645         if ( value != null )
646         {
647                   if ( value.getRuleType() != null
648  )
649             {
650                       String ruleType = "ruleType";
651                 registry.setString( prefix + ruleType, value.getRuleType() );
652                   }
653                         if ( value.getPattern() != null
654  )
655             {
656                       String pattern = "pattern";
657                 registry.setString( prefix + pattern, value.getPattern() );
658                   }
659                   if ( value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
660  )
661             {
662                 registry.removeSubset( prefix + "proxyConnectors" );
663
664                 int count = 0;
665                 for ( Iterator iter = value.getProxyConnectors().iterator(); iter.hasNext(); count++ )
666                 {
667                     String name = "proxyConnectors.proxyConnector(" + count + ")";
668                     ProxyConnectorConfiguration o = ( ProxyConnectorConfiguration ) iter.next();
669                     writeProxyConnectorConfiguration( prefix + name + ".", o, registry );
670                 }
671             }
672         }
673     }
674     
675     private void writeProxyConnectorConfiguration( String prefix, ProxyConnectorConfiguration value, Registry registry )
676     {
677         if ( value != null )
678         {
679                   if ( value.getOrder() != 0
680  )
681             {
682                       String order = "order";
683                 registry.setInt( prefix + order, value.getOrder() );
684                   }
685                         if ( value.getSourceRepoId() != null
686  )
687             {
688                       String sourceRepoId = "sourceRepoId";
689                 registry.setString( prefix + sourceRepoId, value.getSourceRepoId() );
690                   }
691                         if ( value.getTargetRepoId() != null
692  )
693             {
694                       String targetRepoId = "targetRepoId";
695                 registry.setString( prefix + targetRepoId, value.getTargetRepoId() );
696                   }
697                         if ( value.getProxyId() != null
698  )
699             {
700                       String proxyId = "proxyId";
701                 registry.setString( prefix + proxyId, value.getProxyId() );
702                   }
703                   if ( value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
704  )
705             {
706                 registry.removeSubset( prefix + "blackListPatterns" );
707
708                 int count = 0;
709                 for ( Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++ )
710                 {
711                     String name = "blackListPatterns.blackListPattern(" + count + ")";
712                     String blackListPattern = ( String ) iter.next();
713                     registry.setString( prefix + name, blackListPattern );
714                 }
715             }
716             if ( value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
717  )
718             {
719                 registry.removeSubset( prefix + "whiteListPatterns" );
720
721                 int count = 0;
722                 for ( Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++ )
723                 {
724                     String name = "whiteListPatterns.whiteListPattern(" + count + ")";
725                     String whiteListPattern = ( String ) iter.next();
726                     registry.setString( prefix + name, whiteListPattern );
727                 }
728             }
729             if ( value.getPolicies() != null && value.getPolicies().size() > 0
730  )
731             {
732                 registry.removeSubset( prefix + "policies" );
733                 
734                 for ( Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); )
735                 {
736                     String key = (String) iter.next();
737                     String v = (String) value.getPolicies().get( key );
738
739                     registry.setString( prefix + "policies." + key, v );
740                 }
741             }
742             if ( value.getProperties() != null && value.getProperties().size() > 0
743  )
744             {
745                 registry.removeSubset( prefix + "properties" );
746                 
747                 for ( Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); )
748                 {
749                     String key = (String) iter.next();
750                     String v = (String) value.getProperties().get( key );
751
752                     registry.setString( prefix + "properties." + key, v );
753                 }
754             }
755                       String disabled = "disabled";
756                 registry.setBoolean( prefix + disabled, value.isDisabled() );
757               }
758     }
759     
760     private void writeSyncConnectorConfiguration( String prefix, SyncConnectorConfiguration value, Registry registry )
761     {
762         if ( value != null )
763         {
764                   if ( value.getCronExpression() != null && !value.getCronExpression().equals( "0 0 * * * ?" )
765  )
766             {
767                       String cronExpression = "cronExpression";
768                 registry.setString( prefix + cronExpression, value.getCronExpression() );
769                   }
770                         if ( value.getMethod() != null && !value.getMethod().equals( "rsync" )
771  )
772             {
773                       String method = "method";
774                 registry.setString( prefix + method, value.getMethod() );
775                   }
776                         if ( value.getSourceRepoId() != null
777  )
778             {
779                       String sourceRepoId = "sourceRepoId";
780                 registry.setString( prefix + sourceRepoId, value.getSourceRepoId() );
781                   }
782                         if ( value.getTargetRepoId() != null
783  )
784             {
785                       String targetRepoId = "targetRepoId";
786                 registry.setString( prefix + targetRepoId, value.getTargetRepoId() );
787                   }
788                         if ( value.getProxyId() != null
789  )
790             {
791                       String proxyId = "proxyId";
792                 registry.setString( prefix + proxyId, value.getProxyId() );
793                   }
794                   if ( value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
795  )
796             {
797                 registry.removeSubset( prefix + "blackListPatterns" );
798
799                 int count = 0;
800                 for ( Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++ )
801                 {
802                     String name = "blackListPatterns.blackListPattern(" + count + ")";
803                     String blackListPattern = ( String ) iter.next();
804                     registry.setString( prefix + name, blackListPattern );
805                 }
806             }
807             if ( value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
808  )
809             {
810                 registry.removeSubset( prefix + "whiteListPatterns" );
811
812                 int count = 0;
813                 for ( Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++ )
814                 {
815                     String name = "whiteListPatterns.whiteListPattern(" + count + ")";
816                     String whiteListPattern = ( String ) iter.next();
817                     registry.setString( prefix + name, whiteListPattern );
818                 }
819             }
820             if ( value.getPolicies() != null && value.getPolicies().size() > 0
821  )
822             {
823                 registry.removeSubset( prefix + "policies" );
824                 
825                 for ( Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); )
826                 {
827                     String key = (String) iter.next();
828                     String v = (String) value.getPolicies().get( key );
829
830                     registry.setString( prefix + "policies." + key, v );
831                 }
832             }
833             if ( value.getProperties() != null && value.getProperties().size() > 0
834  )
835             {
836                 registry.removeSubset( prefix + "properties" );
837                 
838                 for ( Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); )
839                 {
840                     String key = (String) iter.next();
841                     String v = (String) value.getProperties().get( key );
842
843                     registry.setString( prefix + "properties." + key, v );
844                 }
845             }
846                       String disabled = "disabled";
847                 registry.setBoolean( prefix + disabled, value.isDisabled() );
848               }
849     }
850     
851     private void writeNetworkProxyConfiguration( String prefix, NetworkProxyConfiguration value, Registry registry )
852     {
853         if ( value != null )
854         {
855                   if ( value.getId() != null
856  )
857             {
858                       String id = "id";
859                 registry.setString( prefix + id, value.getId() );
860                   }
861                         if ( value.getProtocol() != null && !value.getProtocol().equals( "http" )
862  )
863             {
864                       String protocol = "protocol";
865                 registry.setString( prefix + protocol, value.getProtocol() );
866                   }
867                         if ( value.getHost() != null
868  )
869             {
870                       String host = "host";
871                 registry.setString( prefix + host, value.getHost() );
872                   }
873                         if ( value.getPort() != 8080
874  )
875             {
876                       String port = "port";
877                 registry.setInt( prefix + port, value.getPort() );
878                   }
879                         if ( value.getUsername() != null
880  )
881             {
882                       String username = "username";
883                 registry.setString( prefix + username, value.getUsername() );
884                   }
885                         if ( value.getPassword() != null
886  )
887             {
888                       String password = "password";
889                 registry.setString( prefix + password, value.getPassword() );
890                   }
891                             String useNtlm = "useNtlm";
892                 registry.setBoolean( prefix + useNtlm, value.isUseNtlm() );
893               }
894     }
895     
896     private void writeRepositoryScanningConfiguration( String prefix, RepositoryScanningConfiguration value, Registry registry )
897     {
898         if ( value != null )
899         {
900             if ( value.getFileTypes() != null && value.getFileTypes().size() > 0
901  )
902             {
903                 registry.removeSubset( prefix + "fileTypes" );
904
905                 int count = 0;
906                 for ( Iterator iter = value.getFileTypes().iterator(); iter.hasNext(); count++ )
907                 {
908                     String name = "fileTypes.fileType(" + count + ")";
909                     FileType o = ( FileType ) iter.next();
910                     writeFileType( prefix + name + ".", o, registry );
911                 }
912             }
913             if ( value.getKnownContentConsumers() != null && value.getKnownContentConsumers().size() > 0
914  )
915             {
916                 registry.removeSubset( prefix + "knownContentConsumers" );
917
918                 int count = 0;
919                 for ( Iterator iter = value.getKnownContentConsumers().iterator(); iter.hasNext(); count++ )
920                 {
921                     String name = "knownContentConsumers.knownContentConsumer(" + count + ")";
922                     String knownContentConsumer = ( String ) iter.next();
923                     registry.setString( prefix + name, knownContentConsumer );
924                 }
925             }
926             if ( value.getInvalidContentConsumers() != null && value.getInvalidContentConsumers().size() > 0
927  )
928             {
929                 registry.removeSubset( prefix + "invalidContentConsumers" );
930
931                 int count = 0;
932                 for ( Iterator iter = value.getInvalidContentConsumers().iterator(); iter.hasNext(); count++ )
933                 {
934                     String name = "invalidContentConsumers.invalidContentConsumer(" + count + ")";
935                     String invalidContentConsumer = ( String ) iter.next();
936                     registry.setString( prefix + name, invalidContentConsumer );
937                 }
938             }
939         }
940     }
941     
942     private void writeFileType( String prefix, FileType value, Registry registry )
943     {
944         if ( value != null )
945         {
946                   if ( value.getId() != null
947  )
948             {
949                       String id = "id";
950                 registry.setString( prefix + id, value.getId() );
951                   }
952                   if ( value.getPatterns() != null && value.getPatterns().size() > 0
953  )
954             {
955                 registry.removeSubset( prefix + "patterns" );
956
957                 int count = 0;
958                 for ( Iterator iter = value.getPatterns().iterator(); iter.hasNext(); count++ )
959                 {
960                     String name = "patterns.pattern(" + count + ")";
961                     String pattern = ( String ) iter.next();
962                     registry.setString( prefix + name, pattern );
963                 }
964             }
965         }
966     }
967     
968     private void writeOrganisationInformation( String prefix, OrganisationInformation value, Registry registry )
969     {
970         if ( value != null )
971         {
972                   if ( value.getName() != null
973  )
974             {
975                       String name = "name";
976                 registry.setString( prefix + name, value.getName() );
977                   }
978                         if ( value.getUrl() != null
979  )
980             {
981                       String url = "url";
982                 registry.setString( prefix + url, value.getUrl() );
983                   }
984                         if ( value.getLogoLocation() != null
985  )
986             {
987                       String logoLocation = "logoLocation";
988                 registry.setString( prefix + logoLocation, value.getLogoLocation() );
989                   }
990               }
991     }
992     
993     private void writeWebappConfiguration( String prefix, WebappConfiguration value, Registry registry )
994     {
995         if ( value != null )
996         {
997             if ( value.getUi() != null
998  )
999             {
1000                 writeUserInterfaceOptions( prefix + "ui.", value.getUi(), registry );
1001             }
1002         }
1003     }
1004     
1005     private void writeUserInterfaceOptions( String prefix, UserInterfaceOptions value, Registry registry )
1006     {
1007         if ( value != null )
1008         {
1009                       String showFindArtifacts = "showFindArtifacts";
1010                 registry.setBoolean( prefix + showFindArtifacts, value.isShowFindArtifacts() );
1011                             String appletFindEnabled = "appletFindEnabled";
1012                 registry.setBoolean( prefix + appletFindEnabled, value.isAppletFindEnabled() );
1013                             String disableEasterEggs = "disableEasterEggs";
1014                 registry.setBoolean( prefix + disableEasterEggs, value.isDisableEasterEggs() );
1015                         if ( value.getApplicationUrl() != null
1016  )
1017             {
1018                       String applicationUrl = "applicationUrl";
1019                 registry.setString( prefix + applicationUrl, value.getApplicationUrl() );
1020                   }
1021                             String disableRegistration = "disableRegistration";
1022                 registry.setBoolean( prefix + disableRegistration, value.isDisableRegistration() );
1023               }
1024     }
1025     
1026     private void writeNetworkConfiguration( String prefix, NetworkConfiguration value, Registry registry )
1027     {
1028         if ( value != null )
1029         {
1030                   if ( value.getMaxTotal() != 30
1031  )
1032             {
1033                       String maxTotal = "maxTotal";
1034                 registry.setInt( prefix + maxTotal, value.getMaxTotal() );
1035                   }
1036                         if ( value.getMaxTotalPerHost() != 30
1037  )
1038             {
1039                       String maxTotalPerHost = "maxTotalPerHost";
1040                 registry.setInt( prefix + maxTotalPerHost, value.getMaxTotalPerHost() );
1041                   }
1042                             String usePooling = "usePooling";
1043                 registry.setBoolean( prefix + usePooling, value.isUsePooling() );
1044               }
1045     }
1046     
1047     private void writeArchivaRuntimeConfiguration( String prefix, ArchivaRuntimeConfiguration value, Registry registry )
1048     {
1049         if ( value != null )
1050         {
1051             if ( value.getUrlFailureCacheConfiguration() != null
1052  )
1053             {
1054                 writeCacheConfiguration( prefix + "urlFailureCacheConfiguration.", value.getUrlFailureCacheConfiguration(), registry );
1055             }
1056             if ( value.getFileLockConfiguration() != null
1057  )
1058             {
1059                 writeFileLockConfiguration( prefix + "fileLockConfiguration.", value.getFileLockConfiguration(), registry );
1060             }
1061                   if ( value.getDataDirectory() != null
1062  )
1063             {
1064                       String dataDirectory = "dataDirectory";
1065                 registry.setString( prefix + dataDirectory, value.getDataDirectory() );
1066                   }
1067                         if ( value.getRepositoryBaseDirectory() != null
1068  )
1069             {
1070                       String repositoryBaseDirectory = "repositoryBaseDirectory";
1071                 registry.setString( prefix + repositoryBaseDirectory, value.getRepositoryBaseDirectory() );
1072                   }
1073                         if ( value.getRemoteRepositoryBaseDirectory() != null
1074  )
1075             {
1076                       String remoteRepositoryBaseDirectory = "remoteRepositoryBaseDirectory";
1077                 registry.setString( prefix + remoteRepositoryBaseDirectory, value.getRemoteRepositoryBaseDirectory() );
1078                   }
1079                         if ( value.getDefaultLanguage() != null && !value.getDefaultLanguage().equals( "en-US" )
1080  )
1081             {
1082                       String defaultLanguage = "defaultLanguage";
1083                 registry.setString( prefix + defaultLanguage, value.getDefaultLanguage() );
1084                   }
1085                         if ( value.getLanguageRange() != null && !value.getLanguageRange().equals( "en,fr,de" )
1086  )
1087             {
1088                       String languageRange = "languageRange";
1089                 registry.setString( prefix + languageRange, value.getLanguageRange() );
1090                   }
1091               }
1092     }
1093     
1094     private void writeRedbackRuntimeConfiguration( String prefix, RedbackRuntimeConfiguration value, Registry registry )
1095     {
1096         if ( value != null )
1097         {
1098                       String migratedFromRedbackConfiguration = "migratedFromRedbackConfiguration";
1099                 registry.setBoolean( prefix + migratedFromRedbackConfiguration, value.isMigratedFromRedbackConfiguration() );
1100                   if ( value.getUserManagerImpls() != null && value.getUserManagerImpls().size() > 0
1101  )
1102             {
1103                 registry.removeSubset( prefix + "userManagerImpls" );
1104
1105                 int count = 0;
1106                 for ( Iterator iter = value.getUserManagerImpls().iterator(); iter.hasNext(); count++ )
1107                 {
1108                     String name = "userManagerImpls.userManagerImpl(" + count + ")";
1109                     String userManagerImpl = ( String ) iter.next();
1110                     registry.setString( prefix + name, userManagerImpl );
1111                 }
1112             }
1113             if ( value.getRbacManagerImpls() != null && value.getRbacManagerImpls().size() > 0
1114  )
1115             {
1116                 registry.removeSubset( prefix + "rbacManagerImpls" );
1117
1118                 int count = 0;
1119                 for ( Iterator iter = value.getRbacManagerImpls().iterator(); iter.hasNext(); count++ )
1120                 {
1121                     String name = "rbacManagerImpls.rbacManagerImpl(" + count + ")";
1122                     String rbacManagerImpl = ( String ) iter.next();
1123                     registry.setString( prefix + name, rbacManagerImpl );
1124                 }
1125             }
1126             if ( value.getLdapConfiguration() != null
1127  )
1128             {
1129                 writeLdapConfiguration( prefix + "ldapConfiguration.", value.getLdapConfiguration(), registry );
1130             }
1131             if ( value.getLdapGroupMappings() != null && value.getLdapGroupMappings().size() > 0
1132  )
1133             {
1134                 registry.removeSubset( prefix + "ldapGroupMappings" );
1135
1136                 int count = 0;
1137                 for ( Iterator iter = value.getLdapGroupMappings().iterator(); iter.hasNext(); count++ )
1138                 {
1139                     String name = "ldapGroupMappings.ldapGroupMapping(" + count + ")";
1140                     LdapGroupMapping o = ( LdapGroupMapping ) iter.next();
1141                     writeLdapGroupMapping( prefix + name + ".", o, registry );
1142                 }
1143             }
1144             if ( value.getConfigurationProperties() != null && value.getConfigurationProperties().size() > 0
1145  )
1146             {
1147                 registry.removeSubset( prefix + "configurationProperties" );
1148                 
1149                 for ( Iterator iter = value.getConfigurationProperties().keySet().iterator(); iter.hasNext(); )
1150                 {
1151                     String key = (String) iter.next();
1152                     String v = (String) value.getConfigurationProperties().get( key );
1153
1154                     registry.setString( prefix + "configurationProperties." + key, v );
1155                 }
1156             }
1157                       String useUsersCache = "useUsersCache";
1158                 registry.setBoolean( prefix + useUsersCache, value.isUseUsersCache() );
1159                   if ( value.getUsersCacheConfiguration() != null
1160  )
1161             {
1162                 writeCacheConfiguration( prefix + "usersCacheConfiguration.", value.getUsersCacheConfiguration(), registry );
1163             }
1164         }
1165     }
1166     
1167     private void writeArchivaDefaultConfiguration( String prefix, ArchivaDefaultConfiguration value, Registry registry )
1168     {
1169         if ( value != null )
1170         {
1171             if ( value.getDefaultCheckPaths() != null && value.getDefaultCheckPaths().size() > 0
1172  )
1173             {
1174                 registry.removeSubset( prefix + "defaultCheckPaths" );
1175
1176                 int count = 0;
1177                 for ( Iterator iter = value.getDefaultCheckPaths().iterator(); iter.hasNext(); count++ )
1178                 {
1179                     String name = "defaultCheckPaths.defaultCheckPath(" + count + ")";
1180                     RepositoryCheckPath o = ( RepositoryCheckPath ) iter.next();
1181                     writeRepositoryCheckPath( prefix + name + ".", o, registry );
1182                 }
1183             }
1184         }
1185     }
1186     
1187     private void writeLdapConfiguration( String prefix, LdapConfiguration value, Registry registry )
1188     {
1189         if ( value != null )
1190         {
1191                   if ( value.getHostName() != null
1192  )
1193             {
1194                       String hostName = "hostName";
1195                 registry.setString( prefix + hostName, value.getHostName() );
1196                   }
1197                         if ( value.getPort() != 0
1198  )
1199             {
1200                       String port = "port";
1201                 registry.setInt( prefix + port, value.getPort() );
1202                   }
1203                             String ssl = "ssl";
1204                 registry.setBoolean( prefix + ssl, value.isSsl() );
1205                         if ( value.getBaseDn() != null
1206  )
1207             {
1208                       String baseDn = "baseDn";
1209                 registry.setString( prefix + baseDn, value.getBaseDn() );
1210                   }
1211                         if ( value.getBaseGroupsDn() != null
1212  )
1213             {
1214                       String baseGroupsDn = "baseGroupsDn";
1215                 registry.setString( prefix + baseGroupsDn, value.getBaseGroupsDn() );
1216                   }
1217                         if ( value.getContextFactory() != null
1218  )
1219             {
1220                       String contextFactory = "contextFactory";
1221                 registry.setString( prefix + contextFactory, value.getContextFactory() );
1222                   }
1223                         if ( value.getBindDn() != null
1224  )
1225             {
1226                       String bindDn = "bindDn";
1227                 registry.setString( prefix + bindDn, value.getBindDn() );
1228                   }
1229                         if ( value.getPassword() != null
1230  )
1231             {
1232                       String password = "password";
1233                 registry.setString( prefix + password, value.getPassword() );
1234                   }
1235                         if ( value.getAuthenticationMethod() != null
1236  )
1237             {
1238                       String authenticationMethod = "authenticationMethod";
1239                 registry.setString( prefix + authenticationMethod, value.getAuthenticationMethod() );
1240                   }
1241                             String bindAuthenticatorEnabled = "bindAuthenticatorEnabled";
1242                 registry.setBoolean( prefix + bindAuthenticatorEnabled, value.isBindAuthenticatorEnabled() );
1243                             String writable = "writable";
1244                 registry.setBoolean( prefix + writable, value.isWritable() );
1245                             String useRoleNameAsGroup = "useRoleNameAsGroup";
1246                 registry.setBoolean( prefix + useRoleNameAsGroup, value.isUseRoleNameAsGroup() );
1247                   if ( value.getExtraProperties() != null && value.getExtraProperties().size() > 0
1248  )
1249             {
1250                 registry.removeSubset( prefix + "extraProperties" );
1251                 
1252                 for ( Iterator iter = value.getExtraProperties().keySet().iterator(); iter.hasNext(); )
1253                 {
1254                     String key = (String) iter.next();
1255                     String v = (String) value.getExtraProperties().get( key );
1256
1257                     registry.setString( prefix + "extraProperties." + key, v );
1258                 }
1259             }
1260         }
1261     }
1262     
1263     private void writeFileLockConfiguration( String prefix, FileLockConfiguration value, Registry registry )
1264     {
1265         if ( value != null )
1266         {
1267                       String skipLocking = "skipLocking";
1268                 registry.setBoolean( prefix + skipLocking, value.isSkipLocking() );
1269                         if ( value.getLockingTimeout() != 0
1270  )
1271             {
1272                       String lockingTimeout = "lockingTimeout";
1273                 registry.setInt( prefix + lockingTimeout, value.getLockingTimeout() );
1274                   }
1275               }
1276     }
1277     
1278     private void writeCacheConfiguration( String prefix, CacheConfiguration value, Registry registry )
1279     {
1280         if ( value != null )
1281         {
1282                   if ( value.getTimeToIdleSeconds() != -1
1283  )
1284             {
1285                       String timeToIdleSeconds = "timeToIdleSeconds";
1286                 registry.setInt( prefix + timeToIdleSeconds, value.getTimeToIdleSeconds() );
1287                   }
1288                         if ( value.getTimeToLiveSeconds() != -1
1289  )
1290             {
1291                       String timeToLiveSeconds = "timeToLiveSeconds";
1292                 registry.setInt( prefix + timeToLiveSeconds, value.getTimeToLiveSeconds() );
1293                   }
1294                         if ( value.getMaxElementsInMemory() != -1
1295  )
1296             {
1297                       String maxElementsInMemory = "maxElementsInMemory";
1298                 registry.setInt( prefix + maxElementsInMemory, value.getMaxElementsInMemory() );
1299                   }
1300                         if ( value.getMaxElementsOnDisk() != -1
1301  )
1302             {
1303                       String maxElementsOnDisk = "maxElementsOnDisk";
1304                 registry.setInt( prefix + maxElementsOnDisk, value.getMaxElementsOnDisk() );
1305                   }
1306               }
1307     }
1308     
1309     private void writeLdapGroupMapping( String prefix, LdapGroupMapping value, Registry registry )
1310     {
1311         if ( value != null )
1312         {
1313                   if ( value.getGroup() != null
1314  )
1315             {
1316                       String group = "group";
1317                 registry.setString( prefix + group, value.getGroup() );
1318                   }
1319                   if ( value.getRoleNames() != null && value.getRoleNames().size() > 0
1320  )
1321             {
1322                 registry.removeSubset( prefix + "roleNames" );
1323
1324                 int count = 0;
1325                 for ( Iterator iter = value.getRoleNames().iterator(); iter.hasNext(); count++ )
1326                 {
1327                     String name = "roleNames.roleName(" + count + ")";
1328                     String roleName = ( String ) iter.next();
1329                     registry.setString( prefix + name, roleName );
1330                 }
1331             }
1332         }
1333     }
1334     
1335 }