001/*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2012 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * Sonar is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * Sonar is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with Sonar; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019 */
020package org.sonar.batch.index;
021
022import com.google.common.collect.Maps;
023import org.sonar.api.batch.Event;
024import org.sonar.api.database.model.Snapshot;
025import org.sonar.api.design.Dependency;
026import org.sonar.api.measures.Measure;
027import org.sonar.api.resources.Project;
028import org.sonar.api.resources.ProjectLink;
029import org.sonar.api.resources.Resource;
030
031import java.util.Collections;
032import java.util.List;
033import java.util.Map;
034
035public final class ReadOnlyPersistenceManager implements PersistenceManager {
036
037  private Map<Resource, String> sources = Maps.newHashMap();
038
039  public void clear() {
040    sources.clear();
041  }
042
043  public void setDelayedMode(boolean b) {
044  }
045
046  public void dump() {
047  }
048
049  public void saveProject(Project project, Project parent) {
050  }
051
052  public Snapshot saveResource(Project project, Resource resource, Resource parent) {
053    return null;
054  }
055
056  public void setSource(Resource file, String source) {
057    sources.put(file, source);
058  }
059
060  public String getSource(Resource resource) {
061    return sources.get(resource);
062  }
063
064  public void saveMeasure(Resource resource, Measure measure) {
065  }
066
067  public Measure reloadMeasure(Measure measure) {
068    return measure;
069  }
070
071  public void saveDependency(Project project, Dependency dependency, Dependency parentDependency) {
072  }
073
074  public void saveLink(Project project, ProjectLink link) {
075  }
076
077  public void deleteLink(Project project, String key) {
078  }
079
080  public List<Event> getEvents(Resource resource) {
081    return Collections.emptyList();
082  }
083
084  public void deleteEvent(Event event) {
085  }
086
087  public void saveEvent(Resource resource, Event event) {
088  }
089}