1 package org.apache.archiva.metadata.repository;
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
23 * The repository session provides a single interface to accessing Archiva repositories. It provides access to three
26 * <li>{@link MetadataRepository} - the metadata content repository for read/write access, in its current state (no
27 * remote resources will be retrieved in the process</li>
28 * <li>{@link MetadataResolver} - access to resolve metadata content, accommodating metadata not yet stored or up to
29 * date in the content repository (i.e. virtualised repositories, remote proxied content, or metadata in a different
30 * model format in the repository storage)</li>
31 * <li>{@link org.apache.archiva.metadata.repository.storage.RepositoryStorage} - access to the physical storage of a
32 * repository and the source artifacts and project models</li>
35 public class RepositorySession
37 private final MetadataRepository repository;
39 private final MetadataResolver resolver;
41 private boolean dirty;
43 // FIXME: include storage here too - perhaps a factory based on repository ID, or one per type to retrieve and
44 // operate on a given repo within the storage API
46 public RepositorySession( MetadataRepository metadataRepository, MetadataResolver resolver )
48 this.repository = metadataRepository;
49 this.resolver = resolver;
52 public MetadataRepository getRepository()
57 public MetadataResolver getResolver()
77 * Close the session. Required to be called for all open sessions to ensure resources are properly released.
78 * If the session has been marked as dirty, it will be saved. This may save partial changes in the case of a typical
79 * <code>try { ... } finally { ... }</code> approach - if this is a problem, ensure you revert changes when an
92 public void markDirty()