This project has retired. For details please refer to its
Attic page.
DefaultCassandraArchivaManager xref
1 package org.apache.archiva.metadata.repository.cassandra;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import me.prettyprint.cassandra.model.BasicColumnDefinition;
23 import me.prettyprint.cassandra.model.ConfigurableConsistencyLevel;
24 import me.prettyprint.cassandra.serializers.StringSerializer;
25 import me.prettyprint.cassandra.service.CassandraHostConfigurator;
26 import me.prettyprint.cassandra.service.ThriftKsDef;
27 import me.prettyprint.hector.api.Cluster;
28 import me.prettyprint.hector.api.HConsistencyLevel;
29 import me.prettyprint.hector.api.Keyspace;
30 import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition;
31 import me.prettyprint.hector.api.ddl.ColumnIndexType;
32 import me.prettyprint.hector.api.ddl.ComparatorType;
33 import me.prettyprint.hector.api.factory.HFactory;
34 import org.apache.archiva.metadata.repository.RepositorySessionFactoryBean;
35 import org.apache.commons.lang3.StringUtils;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
38 import org.springframework.beans.factory.annotation.Value;
39 import org.springframework.context.ApplicationContext;
40 import org.springframework.stereotype.Service;
41
42 import javax.annotation.PostConstruct;
43 import javax.annotation.PreDestroy;
44 import javax.inject.Inject;
45 import java.util.ArrayList;
46 import java.util.List;
47
48 import static org.apache.archiva.metadata.repository.cassandra.model.ColumnNames.*;
49
50
51
52
53
54
55
56 @Service("archivaEntityManagerFactory#cassandra")
57 public class DefaultCassandraArchivaManager
58 implements CassandraArchivaManager
59 {
60
61 private Logger logger = LoggerFactory.getLogger( getClass() );
62
63 @Inject
64 private ApplicationContext applicationContext;
65
66 private static final String CLUSTER_NAME = "archiva";
67
68 private static final String KEYSPACE_NAME = "ArchivaKeySpace";
69
70 private boolean started;
71
72 private Cluster cluster;
73
74 private Keyspace keyspace;
75
76
77 private String repositoryFamilyName = "repository";
78
79 private String namespaceFamilyName = "namespace";
80
81 private String projectFamilyName = PROJECT.toString();
82
83 private String projectVersionMetadataFamilyName = "projectversionmetadata";
84
85 private String artifactMetadataFamilyName = "artifactmetadata";
86
87 private String metadataFacetFamilyName = "metadatafacet";
88
89 private String mailingListFamilyName = "mailinglist";
90
91 private String licenseFamilyName = "license";
92
93 private String dependencyFamilyName = "dependency";
94
95 private String checksumFamilyName = "checksum";
96
97 @Value("${cassandra.host}")
98 private String cassandraHost;
99
100 @Value("${cassandra.port}")
101 private String cassandraPort;
102
103 @Value("${cassandra.maxActive}")
104 private int maxActive;
105
106 @Value("${cassandra.readConsistencyLevel}")
107 private String readConsistencyLevel;
108
109 @Value("${cassandra.writeConsistencyLevel}")
110 private String writeConsistencyLevel;
111
112 @Value("${cassandra.replicationFactor}")
113 private int replicationFactor;
114
115 @Value("${cassandra.keyspace.name}")
116 private String keyspaceName;
117
118 @Value("${cassandra.cluster.name}")
119 private String clusterName;
120
121 @Inject
122 private RepositorySessionFactoryBean repositorySessionFactoryBean;
123
124 @PostConstruct
125 public void initialize()
126 {
127
128 if ( !StringUtils.equals( repositorySessionFactoryBean.getId(), "cassandra" ) )
129 {
130 return;
131 }
132 final CassandraHostConfigurator configurator =
133 new CassandraHostConfigurator( cassandraHost + ":" + cassandraPort );
134 configurator.setMaxActive( maxActive );
135
136
137 cluster = HFactory.getOrCreateCluster( clusterName, configurator );
138
139 final ConfigurableConsistencyLevel consistencyLevelPolicy = new ConfigurableConsistencyLevel();
140 consistencyLevelPolicy.setDefaultReadConsistencyLevel( HConsistencyLevel.valueOf( readConsistencyLevel ) );
141 consistencyLevelPolicy.setDefaultWriteConsistencyLevel( HConsistencyLevel.valueOf( writeConsistencyLevel ) );
142 keyspace = HFactory.createKeyspace( keyspaceName, cluster, consistencyLevelPolicy );
143
144 List<ColumnFamilyDefinition> cfds = new ArrayList<>();
145
146
147 {
148
149 final ColumnFamilyDefinition namespace =
150 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
151 getNamespaceFamilyName(),
152 ComparatorType.UTF8TYPE );
153 cfds.add( namespace );
154
155
156
157 BasicColumnDefinition nameColumn = new BasicColumnDefinition();
158 nameColumn.setName( StringSerializer.get().toByteBuffer( NAME.toString() ) );
159 nameColumn.setIndexName( NAME.toString() );
160 nameColumn.setIndexType( ColumnIndexType.KEYS );
161 nameColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
162 namespace.addColumnDefinition( nameColumn );
163
164 BasicColumnDefinition repositoryIdColumn = new BasicColumnDefinition();
165 repositoryIdColumn.setName( StringSerializer.get().toByteBuffer( REPOSITORY_NAME.toString() ) );
166 repositoryIdColumn.setIndexName( REPOSITORY_NAME.toString() );
167 repositoryIdColumn.setIndexType( ColumnIndexType.KEYS );
168 repositoryIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
169 namespace.addColumnDefinition( repositoryIdColumn );
170 }
171
172
173 {
174 final ColumnFamilyDefinition repository =
175 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
176 getRepositoryFamilyName(),
177 ComparatorType.UTF8TYPE );
178
179 cfds.add( repository );
180
181 BasicColumnDefinition nameColumn = new BasicColumnDefinition();
182 nameColumn.setName( StringSerializer.get().toByteBuffer( REPOSITORY_NAME.toString() ) );
183 nameColumn.setIndexName( REPOSITORY_NAME.toString() );
184 nameColumn.setIndexType( ColumnIndexType.KEYS );
185 nameColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
186 repository.addColumnDefinition( nameColumn );
187 }
188
189
190 {
191
192 final ColumnFamilyDefinition project = HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
193 getProjectFamilyName(),
194 ComparatorType.UTF8TYPE );
195 cfds.add( project );
196
197
198
199 BasicColumnDefinition projectIdColumn = new BasicColumnDefinition();
200 projectIdColumn.setName( StringSerializer.get().toByteBuffer( PROJECT_ID.toString() ) );
201 projectIdColumn.setIndexName( PROJECT_ID.toString() );
202 projectIdColumn.setIndexType( ColumnIndexType.KEYS );
203 projectIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
204 project.addColumnDefinition( projectIdColumn );
205
206 BasicColumnDefinition repositoryIdColumn = new BasicColumnDefinition();
207 repositoryIdColumn.setName( StringSerializer.get().toByteBuffer( REPOSITORY_NAME.toString() ) );
208 repositoryIdColumn.setIndexName( REPOSITORY_NAME.toString() );
209 repositoryIdColumn.setIndexType( ColumnIndexType.KEYS );
210 repositoryIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
211 project.addColumnDefinition( repositoryIdColumn );
212
213 BasicColumnDefinition namespaceIdColumn = new BasicColumnDefinition();
214 namespaceIdColumn.setName( StringSerializer.get().toByteBuffer( NAMESPACE_ID.toString() ) );
215 namespaceIdColumn.setIndexName( NAMESPACE_ID.toString() );
216 namespaceIdColumn.setIndexType( ColumnIndexType.KEYS );
217 namespaceIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
218 project.addColumnDefinition( namespaceIdColumn );
219 }
220
221
222 {
223
224 final ColumnFamilyDefinition projectVersionMetadataModel =
225 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
226 getProjectVersionMetadataFamilyName(),
227 ComparatorType.UTF8TYPE );
228 cfds.add( projectVersionMetadataModel );
229
230
231
232 BasicColumnDefinition namespaceIdColumn = new BasicColumnDefinition();
233 namespaceIdColumn.setName( StringSerializer.get().toByteBuffer( NAMESPACE_ID.toString() ) );
234 namespaceIdColumn.setIndexName( NAMESPACE_ID.toString() );
235 namespaceIdColumn.setIndexType( ColumnIndexType.KEYS );
236 namespaceIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
237 projectVersionMetadataModel.addColumnDefinition( namespaceIdColumn );
238
239 BasicColumnDefinition repositoryNameColumn = new BasicColumnDefinition();
240 repositoryNameColumn.setName( StringSerializer.get().toByteBuffer( REPOSITORY_NAME.toString() ) );
241 repositoryNameColumn.setIndexName( REPOSITORY_NAME.toString() );
242 repositoryNameColumn.setIndexType( ColumnIndexType.KEYS );
243 repositoryNameColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
244 projectVersionMetadataModel.addColumnDefinition( repositoryNameColumn );
245
246 BasicColumnDefinition idColumn = new BasicColumnDefinition();
247 idColumn.setName( StringSerializer.get().toByteBuffer( ID.toString() ) );
248 idColumn.setIndexName( ID.toString() );
249 idColumn.setIndexType( ColumnIndexType.KEYS );
250 idColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
251 projectVersionMetadataModel.addColumnDefinition( idColumn );
252
253 BasicColumnDefinition projectIdColumn = new BasicColumnDefinition();
254 projectIdColumn.setName( StringSerializer.get().toByteBuffer( PROJECT_ID.toString() ) );
255 projectIdColumn.setIndexName( PROJECT_ID.toString() );
256 projectIdColumn.setIndexType( ColumnIndexType.KEYS );
257 projectIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
258 projectVersionMetadataModel.addColumnDefinition( projectIdColumn );
259
260 }
261
262
263 {
264
265 final ColumnFamilyDefinition artifactMetadataModel =
266 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
267 getArtifactMetadataFamilyName(),
268 ComparatorType.UTF8TYPE );
269 cfds.add( artifactMetadataModel );
270
271
272
273 BasicColumnDefinition idColumn = new BasicColumnDefinition();
274 idColumn.setName( StringSerializer.get().toByteBuffer( ID.toString() ) );
275 idColumn.setIndexName( ID.toString() );
276 idColumn.setIndexType( ColumnIndexType.KEYS );
277 idColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
278 artifactMetadataModel.addColumnDefinition( idColumn );
279
280 BasicColumnDefinition repositoryNameColumn = new BasicColumnDefinition();
281 repositoryNameColumn.setName( StringSerializer.get().toByteBuffer( REPOSITORY_NAME.toString() ) );
282 repositoryNameColumn.setIndexName( REPOSITORY_NAME.toString() );
283 repositoryNameColumn.setIndexType( ColumnIndexType.KEYS );
284 repositoryNameColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
285 artifactMetadataModel.addColumnDefinition( repositoryNameColumn );
286
287 BasicColumnDefinition namespaceIdColumn = new BasicColumnDefinition();
288 namespaceIdColumn.setName( StringSerializer.get().toByteBuffer( NAMESPACE_ID.toString() ) );
289 namespaceIdColumn.setIndexName( NAMESPACE_ID.toString() );
290 namespaceIdColumn.setIndexType( ColumnIndexType.KEYS );
291 namespaceIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
292 artifactMetadataModel.addColumnDefinition( namespaceIdColumn );
293
294 BasicColumnDefinition projectColumn = new BasicColumnDefinition();
295 projectColumn.setName( StringSerializer.get().toByteBuffer( PROJECT.toString() ) );
296 projectColumn.setIndexName( PROJECT.toString() );
297 projectColumn.setIndexType( ColumnIndexType.KEYS );
298 projectColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
299 artifactMetadataModel.addColumnDefinition( projectColumn );
300
301 BasicColumnDefinition projectVersionColumn = new BasicColumnDefinition();
302 projectVersionColumn.setName( StringSerializer.get().toByteBuffer( PROJECT_VERSION.toString() ) );
303 projectVersionColumn.setIndexName( PROJECT_VERSION.toString() );
304 projectVersionColumn.setIndexType( ColumnIndexType.KEYS );
305 projectVersionColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
306 artifactMetadataModel.addColumnDefinition( projectVersionColumn );
307
308 BasicColumnDefinition versionColumn = new BasicColumnDefinition();
309 versionColumn.setName( StringSerializer.get().toByteBuffer( VERSION.toString() ) );
310 versionColumn.setIndexName( VERSION.toString() );
311 versionColumn.setIndexType( ColumnIndexType.KEYS );
312 versionColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
313 artifactMetadataModel.addColumnDefinition( versionColumn );
314
315 BasicColumnDefinition whenGatheredColumn = new BasicColumnDefinition();
316 whenGatheredColumn.setName( StringSerializer.get().toByteBuffer( WHEN_GATHERED.toString() ) );
317 whenGatheredColumn.setIndexName( WHEN_GATHERED.toString() );
318 whenGatheredColumn.setIndexType( ColumnIndexType.KEYS );
319 whenGatheredColumn.setValidationClass( ComparatorType.LONGTYPE.getClassName() );
320 artifactMetadataModel.addColumnDefinition( whenGatheredColumn );
321
322 BasicColumnDefinition sha1Column = new BasicColumnDefinition();
323 sha1Column.setName( StringSerializer.get().toByteBuffer( SHA1.toString() ) );
324 sha1Column.setIndexName( SHA1.toString() );
325 sha1Column.setIndexType( ColumnIndexType.KEYS );
326 sha1Column.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
327 artifactMetadataModel.addColumnDefinition( sha1Column );
328
329 BasicColumnDefinition md5Column = new BasicColumnDefinition();
330 md5Column.setName( StringSerializer.get().toByteBuffer( MD5.toString() ) );
331 md5Column.setIndexName( MD5.toString() );
332 md5Column.setIndexType( ColumnIndexType.KEYS );
333 md5Column.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
334 artifactMetadataModel.addColumnDefinition( md5Column );
335
336
337 }
338
339
340 {
341 final ColumnFamilyDefinition metadataFacetModel =
342 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
343 getMetadataFacetFamilyName(),
344 ComparatorType.UTF8TYPE );
345 cfds.add( metadataFacetModel );
346
347
348
349 BasicColumnDefinition facetIdColumn = new BasicColumnDefinition();
350 facetIdColumn.setName( StringSerializer.get().toByteBuffer( FACET_ID.toString() ) );
351 facetIdColumn.setIndexName( FACET_ID.toString() );
352 facetIdColumn.setIndexType( ColumnIndexType.KEYS );
353 facetIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
354 metadataFacetModel.addColumnDefinition( facetIdColumn );
355
356 BasicColumnDefinition repositoryNameColumn = new BasicColumnDefinition();
357 repositoryNameColumn.setName( StringSerializer.get().toByteBuffer( REPOSITORY_NAME.toString() ) );
358 repositoryNameColumn.setIndexName( REPOSITORY_NAME.toString() );
359 repositoryNameColumn.setIndexType( ColumnIndexType.KEYS );
360 repositoryNameColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
361 metadataFacetModel.addColumnDefinition( repositoryNameColumn );
362
363 BasicColumnDefinition nameColumn = new BasicColumnDefinition();
364 nameColumn.setName( StringSerializer.get().toByteBuffer( NAME.toString() ) );
365 nameColumn.setIndexName( NAME.toString() );
366 nameColumn.setIndexType( ColumnIndexType.KEYS );
367 nameColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
368 metadataFacetModel.addColumnDefinition( nameColumn );
369
370 BasicColumnDefinition namespaceColumn = new BasicColumnDefinition();
371 namespaceColumn.setName( StringSerializer.get().toByteBuffer( NAMESPACE_ID.toString() ) );
372 namespaceColumn.setIndexName( NAMESPACE_ID.toString() );
373 namespaceColumn.setIndexType( ColumnIndexType.KEYS );
374 namespaceColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
375 metadataFacetModel.addColumnDefinition( namespaceColumn );
376
377 BasicColumnDefinition projectIdColumn = new BasicColumnDefinition();
378 projectIdColumn.setName( StringSerializer.get().toByteBuffer( PROJECT_ID.toString() ) );
379 projectIdColumn.setIndexName( PROJECT_ID.toString() );
380 projectIdColumn.setIndexType( ColumnIndexType.KEYS );
381 projectIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
382 metadataFacetModel.addColumnDefinition( projectIdColumn );
383
384 BasicColumnDefinition projectVersionColumn = new BasicColumnDefinition();
385 projectVersionColumn.setName( StringSerializer.get().toByteBuffer( PROJECT_VERSION.toString() ) );
386 projectVersionColumn.setIndexName( PROJECT_VERSION.toString() );
387 projectVersionColumn.setIndexType( ColumnIndexType.KEYS );
388 projectVersionColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
389 metadataFacetModel.addColumnDefinition( projectVersionColumn );
390
391 }
392
393
394 {
395 final ColumnFamilyDefinition checksumCf =
396 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
397 getChecksumFamilyName(),
398 ComparatorType.UTF8TYPE );
399
400 BasicColumnDefinition artifactMetatadaModel_key = new BasicColumnDefinition();
401 artifactMetatadaModel_key.setName( StringSerializer.get().toByteBuffer( "artifactMetadataModel.key" ) );
402 artifactMetatadaModel_key.setIndexName( "artifactMetadataModel_key" );
403 artifactMetatadaModel_key.setIndexType( ColumnIndexType.KEYS );
404 artifactMetatadaModel_key.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
405 checksumCf.addColumnDefinition( artifactMetatadaModel_key );
406
407
408 BasicColumnDefinition checksumAlgorithmColumn = new BasicColumnDefinition();
409 checksumAlgorithmColumn.setName( StringSerializer.get().toByteBuffer( CHECKSUM_ALG.toString() ) );
410 checksumAlgorithmColumn.setIndexName( CHECKSUM_ALG.toString() );
411 checksumAlgorithmColumn.setIndexType( ColumnIndexType.KEYS );
412 checksumAlgorithmColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
413 checksumCf.addColumnDefinition( checksumAlgorithmColumn );
414
415 BasicColumnDefinition checksumValueColumn = new BasicColumnDefinition();
416 checksumValueColumn.setName( StringSerializer.get().toByteBuffer( CHECKSUM_VALUE.toString() ) );
417 checksumValueColumn.setIndexName( CHECKSUM_VALUE.toString() );
418 checksumValueColumn.setIndexType( ColumnIndexType.KEYS );
419 checksumValueColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
420 checksumCf.addColumnDefinition( checksumValueColumn );
421
422 BasicColumnDefinition repositoryNameColumn = new BasicColumnDefinition();
423 repositoryNameColumn.setName( StringSerializer.get().toByteBuffer( REPOSITORY_NAME.toString() ) );
424 repositoryNameColumn.setIndexName( REPOSITORY_NAME.toString() );
425 repositoryNameColumn.setIndexType( ColumnIndexType.KEYS );
426 repositoryNameColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
427 checksumCf.addColumnDefinition( repositoryNameColumn );
428
429
430 cfds.add( checksumCf );
431
432
433
434 }
435
436
437 {
438 final ColumnFamilyDefinition mailingListCf =
439 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
440 getMailingListFamilyName(),
441 ComparatorType.UTF8TYPE );
442
443 BasicColumnDefinition projectVersionMetadataModel_key = new BasicColumnDefinition();
444 projectVersionMetadataModel_key.setName( StringSerializer.get().toByteBuffer( "projectVersionMetadataModel.key" ) );
445 projectVersionMetadataModel_key.setIndexName( "projectVersionMetadataModel_key" );
446 projectVersionMetadataModel_key.setIndexType( ColumnIndexType.KEYS );
447 projectVersionMetadataModel_key.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
448 mailingListCf.addColumnDefinition( projectVersionMetadataModel_key );
449
450 cfds.add( mailingListCf );
451
452
453
454 }
455
456
457 {
458 final ColumnFamilyDefinition licenseCf =
459 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
460 getLicenseFamilyName(),
461 ComparatorType.UTF8TYPE );
462
463 BasicColumnDefinition projectVersionMetadataModel_key = new BasicColumnDefinition();
464 projectVersionMetadataModel_key.setName( StringSerializer.get().toByteBuffer( "projectVersionMetadataModel.key" ) );
465 projectVersionMetadataModel_key.setIndexName( "projectVersionMetadataModel_key" );
466 projectVersionMetadataModel_key.setIndexType( ColumnIndexType.KEYS );
467 projectVersionMetadataModel_key.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
468 licenseCf.addColumnDefinition( projectVersionMetadataModel_key );
469
470 cfds.add( licenseCf );
471
472
473
474 }
475
476
477 {
478 final ColumnFamilyDefinition dependencyCf =
479 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(),
480 getDependencyFamilyName(),
481 ComparatorType.UTF8TYPE );
482 cfds.add( dependencyCf );
483
484
485
486 BasicColumnDefinition groupIdColumn = new BasicColumnDefinition();
487 groupIdColumn.setName( StringSerializer.get().toByteBuffer( GROUP_ID.toString() ) );
488 groupIdColumn.setIndexName( "groupIdIdx" );
489 groupIdColumn.setIndexType( ColumnIndexType.KEYS );
490 groupIdColumn.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
491 dependencyCf.addColumnDefinition( groupIdColumn );
492
493 BasicColumnDefinition projectVersionMetadataModel_key = new BasicColumnDefinition();
494 projectVersionMetadataModel_key.setName( StringSerializer.get().toByteBuffer( "projectVersionMetadataModel.key" ) );
495 projectVersionMetadataModel_key.setIndexName( "projectVersionMetadataModel_key" );
496 projectVersionMetadataModel_key.setIndexType( ColumnIndexType.KEYS );
497 projectVersionMetadataModel_key.setValidationClass( ComparatorType.UTF8TYPE.getClassName() );
498 dependencyCf.addColumnDefinition( projectVersionMetadataModel_key );
499
500 }
501
502
503 {
504 if ( cluster.describeKeyspace( keyspaceName ) == null )
505 {
506 logger.info( "Creating Archiva Cassandra '{}' keyspace.", keyspaceName );
507 cluster.addKeyspace( HFactory.createKeyspaceDefinition( keyspaceName,
508 ThriftKsDef.DEF_STRATEGY_CLASS,
509 replicationFactor,
510 cfds )
511 );
512 }
513 }
514
515 }
516
517 @Override
518 public void start()
519 {
520 }
521
522 @PreDestroy
523 @Override
524 public void shutdown()
525 {
526 }
527
528
529 @Override
530 public boolean started()
531 {
532 return started;
533 }
534
535
536 @Override
537 public Keyspace getKeyspace()
538 {
539 return keyspace;
540 }
541
542 @Override
543 public Cluster getCluster()
544 {
545 return cluster;
546 }
547
548 @Override
549 public String getRepositoryFamilyName()
550 {
551 return repositoryFamilyName;
552 }
553
554 @Override
555 public String getNamespaceFamilyName()
556 {
557 return namespaceFamilyName;
558 }
559
560 @Override
561 public String getProjectFamilyName()
562 {
563 return projectFamilyName;
564 }
565
566 @Override
567 public String getProjectVersionMetadataFamilyName()
568 {
569 return projectVersionMetadataFamilyName;
570 }
571
572 @Override
573 public String getArtifactMetadataFamilyName()
574 {
575 return artifactMetadataFamilyName;
576 }
577
578 @Override
579 public String getMetadataFacetFamilyName()
580 {
581 return metadataFacetFamilyName;
582 }
583
584 @Override
585 public String getMailingListFamilyName()
586 {
587 return mailingListFamilyName;
588 }
589
590 @Override
591 public String getLicenseFamilyName()
592 {
593 return licenseFamilyName;
594 }
595
596 @Override
597 public String getDependencyFamilyName()
598 {
599 return dependencyFamilyName;
600 }
601
602 @Override
603 public String getChecksumFamilyName() {
604 return checksumFamilyName;
605 }
606 }