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.io.Serializable;
025import java.util.List;
026import java.util.Map;
027
028import javax.servlet.http.HttpServletRequest;
029
030import org.nuxeo.apidoc.api.NuxeoArtifact;
031import org.nuxeo.ecm.core.api.CoreSession;
032import org.nuxeo.ecm.core.api.DocumentModel;
033
034public interface SnapshotManager {
035
036    void initSeamContext(HttpServletRequest request);
037
038    DistributionSnapshot getRuntimeSnapshot();
039
040    void addPersistentSnapshot(String key, DistributionSnapshot snapshot);
041
042    DistributionSnapshot getSnapshot(String key, CoreSession session);
043
044    List<DistributionSnapshot> readPersistentSnapshots(CoreSession session);
045
046    List<DistributionSnapshot> listPersistentSnapshots(CoreSession session);
047
048    Map<String, DistributionSnapshot> getPersistentSnapshots(CoreSession session);
049
050    List<String> getPersistentSnapshotNames(CoreSession session);
051
052    List<DistributionSnapshotDesc> getAvailableDistributions(CoreSession session);
053
054    List<String> getAvailableVersions(CoreSession session, NuxeoArtifact nxItem);
055
056    void exportSnapshot(CoreSession session, String key, OutputStream out) throws IOException;
057
058    void importSnapshot(CoreSession session, InputStream is) throws IOException;
059
060    DistributionSnapshot persistRuntimeSnapshot(CoreSession session);
061
062    DistributionSnapshot persistRuntimeSnapshot(CoreSession session, String name, Map<String, Serializable> properties);
063
064    DistributionSnapshot persistRuntimeSnapshot(CoreSession session, String name, Map<String, Serializable> properties, SnapshotFilter filter);
065
066    void validateImportedSnapshot(CoreSession session, String name, String version, String pathSegment, String title);
067
068    DocumentModel importTmpSnapshot(CoreSession session, InputStream is) throws IOException;
069
070}