1 package org.apache.archiva.metadata.repository.cassandra;
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 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;
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;
48 import static org.apache.archiva.metadata.repository.cassandra.model.ColumnNames.*;
51 * FIXME make all configuration not hardcoded :-)
53 * @author Olivier Lamy
56 @Service("archivaEntityManagerFactory#cassandra")
57 public class DefaultCassandraArchivaManager
58 implements CassandraArchivaManager
61 private Logger logger = LoggerFactory.getLogger( getClass() );
64 private ApplicationContext applicationContext;
66 private static final String CLUSTER_NAME = "archiva";
68 private static final String KEYSPACE_NAME = "ArchivaKeySpace";
70 private boolean started;
72 private Cluster cluster;
74 private Keyspace keyspace;
77 private String repositoryFamilyName = "repository";
79 private String namespaceFamilyName = "namespace";
81 private String projectFamilyName = PROJECT.toString();
83 private String projectVersionMetadataFamilyName = "projectversionmetadata";
85 private String artifactMetadataFamilyName = "artifactmetadata";
87 private String metadataFacetFamilyName = "metadatafacet";
89 private String mailingListFamilyName = "mailinglist";
91 private String licenseFamilyName = "license";
93 private String dependencyFamilyName = "dependency";
95 private String checksumFamilyName = "checksum";
97 @Value("${cassandra.host}")
98 private String cassandraHost;
100 @Value("${cassandra.port}")
101 private String cassandraPort;
103 @Value("${cassandra.maxActive}")
104 private int maxActive;
106 @Value("${cassandra.readConsistencyLevel}")
107 private String readConsistencyLevel;
109 @Value("${cassandra.writeConsistencyLevel}")
110 private String writeConsistencyLevel;
112 @Value("${cassandra.replicationFactor}")
113 private int replicationFactor;
115 @Value("${cassandra.keyspace.name}")
116 private String keyspaceName;
118 @Value("${cassandra.cluster.name}")
119 private String clusterName;
122 private RepositorySessionFactoryBean repositorySessionFactoryBean;
125 public void initialize()
127 // skip initialisation if not cassandra
128 if ( !StringUtils.equals( repositorySessionFactoryBean.getId(), "cassandra" ) )
132 final CassandraHostConfigurator configurator =
133 new CassandraHostConfigurator( cassandraHost + ":" + cassandraPort );
134 configurator.setMaxActive( maxActive );
135 //configurator.setCassandraThriftSocketTimeout( );
137 cluster = HFactory.getOrCreateCluster( clusterName, configurator );
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 );
144 List<ColumnFamilyDefinition> cfds = new ArrayList<>();
149 final ColumnFamilyDefinition namespace =
150 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
151 getNamespaceFamilyName(), //
152 ComparatorType.UTF8TYPE );
153 cfds.add( namespace );
155 // creating indexes for cql query
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 );
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 );
174 final ColumnFamilyDefinition repository =
175 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
176 getRepositoryFamilyName(), //
177 ComparatorType.UTF8TYPE );
179 cfds.add( repository );
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 );
192 final ColumnFamilyDefinition project = HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
193 getProjectFamilyName(), //
194 ComparatorType.UTF8TYPE );
197 // creating indexes for cql query
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 );
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 );
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 );
221 //projectversionmetadatamodel
224 final ColumnFamilyDefinition projectVersionMetadataModel =
225 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
226 getProjectVersionMetadataFamilyName(), //
227 ComparatorType.UTF8TYPE );
228 cfds.add( projectVersionMetadataModel );
230 // creating indexes for cql query
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 );
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 );
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 );
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 );
262 // artifactmetadatamodel table
265 final ColumnFamilyDefinition artifactMetadataModel =
266 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
267 getArtifactMetadataFamilyName(), //
268 ComparatorType.UTF8TYPE );
269 cfds.add( artifactMetadataModel );
271 // creating indexes for cql query
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
339 // metadatafacetmodel table
341 final ColumnFamilyDefinition metadataFacetModel =
342 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
343 getMetadataFacetFamilyName(), //
344 ComparatorType.UTF8TYPE );
345 cfds.add( metadataFacetModel );
347 // creating indexes for cql query
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 );
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 );
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 );
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 );
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 );
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 );
395 final ColumnFamilyDefinition checksumCf =
396 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
397 getChecksumFamilyName(), //
398 ComparatorType.UTF8TYPE );
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 );
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 );
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 );
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 );
430 cfds.add( checksumCf );
432 // creating indexes for cql query
438 final ColumnFamilyDefinition mailingListCf =
439 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
440 getMailingListFamilyName(), //
441 ComparatorType.UTF8TYPE );
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 );
450 cfds.add( mailingListCf );
452 // creating indexes for cql query
458 final ColumnFamilyDefinition licenseCf =
459 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
460 getLicenseFamilyName(), //
461 ComparatorType.UTF8TYPE );
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 );
470 cfds.add( licenseCf );
472 // creating indexes for cql query
478 final ColumnFamilyDefinition dependencyCf =
479 HFactory.createColumnFamilyDefinition( keyspace.getKeyspaceName(), //
480 getDependencyFamilyName(), //
481 ComparatorType.UTF8TYPE );
482 cfds.add( dependencyCf );
484 // creating indexes for cql query
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 );
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 );
502 // TODO take care of update new table!!
503 { // ensure keyspace exists, here if the keyspace doesn't exist we suppose nothing exist
504 if ( cluster.describeKeyspace( keyspaceName ) == null )
506 logger.info( "Creating Archiva Cassandra '{}' keyspace.", keyspaceName );
507 cluster.addKeyspace( HFactory.createKeyspaceDefinition( keyspaceName, //
508 ThriftKsDef.DEF_STRATEGY_CLASS, //
509 replicationFactor, //
524 public void shutdown()
530 public boolean started()
537 public Keyspace getKeyspace()
543 public Cluster getCluster()
549 public String getRepositoryFamilyName()
551 return repositoryFamilyName;
555 public String getNamespaceFamilyName()
557 return namespaceFamilyName;
561 public String getProjectFamilyName()
563 return projectFamilyName;
567 public String getProjectVersionMetadataFamilyName()
569 return projectVersionMetadataFamilyName;
573 public String getArtifactMetadataFamilyName()
575 return artifactMetadataFamilyName;
579 public String getMetadataFacetFamilyName()
581 return metadataFacetFamilyName;
585 public String getMailingListFamilyName()
587 return mailingListFamilyName;
591 public String getLicenseFamilyName()
593 return licenseFamilyName;
597 public String getDependencyFamilyName()
599 return dependencyFamilyName;
603 public String getChecksumFamilyName() {
604 return checksumFamilyName;