1package org.apache.archiva.metadata.repository.file;
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.MetadataRepository;
26import org.apache.archiva.metadata.repository.MetadataRepositoryException;
27import org.apache.archiva.metadata.repository.MetadataResolver;
28import org.apache.archiva.metadata.repository.MetadataService;
29import org.apache.archiva.metadata.repository.RepositorySession;
30import org.apache.archiva.metadata.repository.RepositorySessionFactory;
31import org.apache.commons.lang3.StringUtils;
32import org.springframework.context.ApplicationContext;
33import org.springframework.stereotype.Service;
3435import javax.inject.Inject;
36import javax.inject.Named;
37import java.util.HashMap;
38import java.util.Map;
3940/**41 *42 */43 @Service( "repositorySessionFactory#file" )
44publicclassFileRepositorySessionFactoryextendsAbstractRepositorySessionFactory45implementsRepositorySessionFactory46 {
47 @Inject
48 @Named( value = "archivaConfiguration#default" )
49privateArchivaConfiguration configuration;
5051 @Inject
52privateMetadataResolver metadataResolver;
5354 @Inject
55private ApplicationContext applicationContext;
5657 @Inject
58privateMetadataService metadataService;
5960publicvoid initialize()
61 {
62 Map<String, MetadataFacetFactory> tmpMetadataFacetFactories =
63 applicationContext.getBeansOfType( MetadataFacetFactory.class );
64 }
6566 @Override
67protectedvoid shutdown() {
68// do nothing69 }
7071 @Override
72publicRepositorySession createSession() throwsMetadataRepositoryException73 {
74MetadataRepository metadataRepository = newFileMetadataRepository( metadataService, configuration );
7576returnnewRepositorySession( metadataRepository, metadataResolver );
77 }
7879 }