001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Florent Guillaume
011 */
012package org.nuxeo.ecm.core.storage.sql;
013
014import org.nuxeo.ecm.core.storage.sql.Session.PathResolver;
015
016/**
017 * Interface for the backend-specific initialization code of a {@link Repository}.
018 *
019 * @see RepositoryImpl
020 */
021public interface RepositoryBackend {
022
023    /**
024     * Initializer.
025     */
026    void initialize(RepositoryImpl repository);
027
028    /**
029     * Initializes the {@link ModelSetup}. Called once lazily at repository initialization.
030     */
031    void initializeModelSetup(ModelSetup modelSetup);
032
033    /**
034     * Initializes what's needed after the {@link Model} has been created. Called once lazily at repository
035     * initialization.
036     */
037    void initializeModel(Model model);
038
039    /**
040     * Sets the cluster invalidator, to be used by future mappers created.
041     *
042     * @since 7.4
043     */
044    void setClusterInvalidator(ClusterInvalidator clusterInvalidator);
045
046    /**
047     * Creates a new instance a {@link Mapper}. Called once for every new session.
048     *
049     * @param model the model
050     * @param pathResolver the path resolver
051     * @param useInvalidations whether this mapper participates in invalidation propagation
052     */
053    Mapper newMapper(Model model, PathResolver pathResolver, boolean useInvalidations);
054
055    /**
056     * Shuts down the backend.
057     */
058    void shutdown();
059
060}