@@ -0,0 +1,2213 @@
+/*%0A * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0%0A * (the %22License%22). You may not use this work except in compliance with the License, which is%0A * available at www.apache.org/licenses/LICENSE-2.0%0A *%0A * This software is distributed on an %22AS IS%22 basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied, as more fully set forth in the License.%0A *%0A * See the NOTICE file distributed with this work for information regarding copyright ownership.%0A */%0A%0Apackage alluxio.master.journal;%0A%0Aimport alluxio.util.io.PathUtils;%0A%0A/**%0A * Interface for factories which create %7B@link Journal%7Ds.%0A */%0Apublic interface JournalFactory %7B%0A  /**%0A   * @param directory the directory for the journal%0A   * @return a journal based on the given directory%0A   */%0A  Journal get(String directory);%0A%0A  abstract class AbstractJournalFactory implements JournalFactory %7B%0A    protected final String mBaseDirectory;%0A%0A    /**%0A     * Creates a journal factory with the specified directory as the root. When journals are%0A     * created, their paths are appended to the base path, e.g.%0A     *%0A     * basesDirectory journalDirectory1 journalDirectory2%0A     *%0A     * @param baseDirectory the base directory for journals created by this factory%0A     */%0A    public AbstractJournalFactory(String baseDirectory) %7B%0A      mBaseDirectory = baseDirectory;%0A    %7D%0A  %7D%0A%0A  final class ReadWrite extends AbstractJournalFactory %7B%0A    /**%0A     * %7B@inheritDoc%7D%0A     *%0A     * @param baseDirectory the base directory for journals created by this factory%0A     */%0A    public ReadWrite(String baseDirectory) %7B%0A      super(baseDirectory);%0A    %7D%0A%0A    @Override%0A    public Journal get(String directory) %7B%0A      return new ReadWriteJournal(PathUtils.concatPath(mBaseDirectory, directory));%0A    %7D%0A  %7D%0A%0A  final class ReadOnly extends AbstractJournalFactory %7B%0A    /**%0A     * %7B@inheritDoc%7D%0A     *%0A     * @param baseDirectory the base directory for journals created by this factory%0A     */%0A    public ReadOnly(String baseDirectory) %7B%0A      super(baseDirectory);%0A    %7D%0A%0A    @Override%0A    public Journal get(String directory) %7B%0A      return new ReadWriteJournal(PathUtils.concatPath(mBaseDirectory, directory));%0A    %7D%0A  %7D%0A%7D%0A

Add journal factory