This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.metadata.repository.cassandra;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.archiva.configuration.ArchivaConfiguration;
023import org.apache.archiva.metadata.model.MetadataFacetFactory;
024import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
025import org.apache.archiva.metadata.repository.MetadataRepositoryException;
026import org.apache.archiva.metadata.repository.MetadataResolver;
027import org.apache.archiva.metadata.repository.MetadataService;
028import org.apache.archiva.metadata.repository.RepositorySession;
029import org.apache.archiva.metadata.repository.RepositorySessionFactory;
030import org.apache.commons.lang3.StringUtils;
031import org.springframework.context.ApplicationContext;
032import org.springframework.stereotype.Service;
033
034import javax.inject.Inject;
035import javax.inject.Named;
036import java.util.HashMap;
037import java.util.Map;
038
039/**
040 * @author Olivier Lamy
041 * @since 2.0.0
042 */
043@Service("repositorySessionFactory#cassandra")
044public class CassandraRepositorySessionFactory extends AbstractRepositorySessionFactory
045    implements RepositorySessionFactory
046{
047
048    @Inject
049    @Named(value = "archivaConfiguration#default")
050    private ArchivaConfiguration configuration;
051
052    @Inject
053    private MetadataResolver metadataResolver;
054
055    @Inject
056    private ApplicationContext applicationContext;
057
058    @Inject
059    private CassandraArchivaManager cassandraArchivaManager;
060
061    @Inject
062    private MetadataService metadataService;
063
064    public void initialize()
065    {
066    }
067
068    @Override
069    protected void shutdown() {
070        cassandraArchivaManager.shutdown();
071    }
072
073
074    @Override
075    public RepositorySession createSession() throws MetadataRepositoryException
076    {
077        CassandraMetadataRepository metadataRepository =
078            new CassandraMetadataRepository( metadataService, configuration, cassandraArchivaManager );
079        return new RepositorySession( metadataRepository, metadataResolver );
080    }
081
082}