001/*
002 * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Thierry Delprat
018 */
019package org.nuxeo.apidoc.snapshot;
020
021import java.io.IOException;
022import java.io.InputStream;
023import java.io.OutputStream;
024import java.util.List;
025import java.util.Map;
026
027import javax.servlet.http.HttpServletRequest;
028
029import org.nuxeo.apidoc.api.NuxeoArtifact;
030import org.nuxeo.ecm.core.api.CoreSession;
031import org.nuxeo.ecm.core.api.DocumentModel;
032
033public interface SnapshotManager {
034
035    void initSeamContext(HttpServletRequest request);
036
037    DistributionSnapshot getRuntimeSnapshot();
038
039    void addPersistentSnapshot(String key, DistributionSnapshot snapshot);
040
041    DistributionSnapshot getSnapshot(String key, CoreSession session);
042
043    List<DistributionSnapshot> readPersistentSnapshots(CoreSession session);
044
045    List<DistributionSnapshot> listPersistentSnapshots(CoreSession session);
046
047    Map<String, DistributionSnapshot> getPersistentSnapshots(CoreSession session);
048
049    List<String> getPersistentSnapshotNames(CoreSession session);
050
051    List<DistributionSnapshotDesc> getAvailableDistributions(CoreSession session);
052
053    List<String> getAvailableVersions(CoreSession session, NuxeoArtifact nxItem);
054
055    void exportSnapshot(CoreSession session, String key, OutputStream out) throws IOException;
056
057    void importSnapshot(CoreSession session, InputStream is) throws IOException;
058
059    DistributionSnapshot persistRuntimeSnapshot(CoreSession session);
060
061    DistributionSnapshot persistRuntimeSnapshot(CoreSession session, String name);
062
063    DistributionSnapshot persistRuntimeSnapshot(CoreSession session, String name, SnapshotFilter filter);
064
065    void validateImportedSnapshot(CoreSession session, String name, String version, String pathSegment, String title);
066
067    DocumentModel importTmpSnapshot(CoreSession session, InputStream is) throws IOException;
068
069}