1package org.apache.archiva.metadata.repository.cassandra;
23/*4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122import org.apache.archiva.configuration.ArchivaConfiguration;
23import org.apache.archiva.metadata.model.MetadataFacetFactory;
24import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
25import org.apache.archiva.metadata.repository.MetadataRepositoryException;
26import org.apache.archiva.metadata.repository.MetadataResolver;
27import org.apache.archiva.metadata.repository.MetadataService;
28import org.apache.archiva.metadata.repository.RepositorySession;
29import org.apache.archiva.metadata.repository.RepositorySessionFactory;
30import org.apache.commons.lang3.StringUtils;
31import org.springframework.context.ApplicationContext;
32import org.springframework.stereotype.Service;
3334import javax.inject.Inject;
35import javax.inject.Named;
36import java.util.HashMap;
37import java.util.Map;
3839/**40 * @author Olivier Lamy41 * @since 2.0.042 */43 @Service("repositorySessionFactory#cassandra")
44publicclassCassandraRepositorySessionFactoryextends AbstractRepositorySessionFactory
45implements RepositorySessionFactory
46 {
4748 @Inject
49 @Named(value = "archivaConfiguration#default")
50private ArchivaConfiguration configuration;
5152 @Inject
53private MetadataResolver metadataResolver;
5455 @Inject
56private ApplicationContext applicationContext;
5758 @Inject
59privateCassandraArchivaManager cassandraArchivaManager;
6061 @Inject
62private MetadataService metadataService;
6364publicvoid initialize()
65 {
66 }
6768 @Override
69protectedvoid shutdown() {
70 cassandraArchivaManager.shutdown();
71 }
727374 @Override
75public RepositorySession createSession() throws MetadataRepositoryException
76 {
77CassandraMetadataRepository metadataRepository =
78newCassandraMetadataRepository( metadataService, configuration, cassandraArchivaManager );
79returnnew RepositorySession( metadataRepository, metadataResolver );
80 }
8182 }