All Downloads are FREE. Search and download functionalities are using the official Maven repository.

csip.ArchiveStore Maven / Gradle / Ivy

Go to download

The Cloud Services Integration Platform is a SoA implementation to offer a Model-as-a-Service framework, Application Programming Interface, deployment infrastructure, and service implementations for environmental modeling.

There is a newer version: 2.6.30
Show newest version
/*
 * $Id: ArchiveStore.java 27bed8415b8b 2019-01-31 od $
 *
 * This file is part of the Cloud Services Integration Platform (CSIP),
 * a Model-as-a-Service framework, API and application suite.
 *
 * 2012-2019, Olaf David and others, OMSLab, Colorado State University.
 *
 * OMSLab licenses this file to you under the MIT license.
 * See the LICENSE file in the project root for more information.
 */
package csip;

import java.io.File;
import java.util.HashSet;
import java.util.Set;

/**
 * Archive Store
 */
interface ArchiveStore extends AutoCloseable {

  static final String ARCHIVE_TOO_BIG = "the archive too big.";
  static final String ARCHIVE_PREFIX = "archive-";


  boolean isAvailable();


  void archiveSession(String sid, ModelArchive ma, File f) throws Exception;


  ModelArchive getArchive(String suid) throws Exception;


  boolean hasArchive(String suid) throws Exception;


  void removeArchive(String suid);


  byte[] getFile(String suid) throws Exception;


  /**
   * Get the number of elements.
   * @return the number of elements
   */
  long getCount();


  Set keys(int skip, int limit, String sortby, boolean sortAsc);

  /**
   *
   */
  ArchiveStore NONE = new ArchiveStore() {
    Set keys = new HashSet<>();


    @Override
    public void archiveSession(String sid, ModelArchive ma, File f) throws Exception {
    }


    @Override
    public ModelArchive getArchive(String suid) throws Exception {
      return null;
    }


    @Override
    public void removeArchive(String suid) {
    }


    @Override
    public byte[] getFile(String suid) throws Exception {
      return null;
    }


    @Override
    public void close() throws Exception {
    }


    @Override
    public Set keys(int skip, int limit, String sortby, boolean sortAsc) {
      return keys;
    }


    @Override
    public long getCount() {
      return keys.size();
    }


    @Override
    public boolean hasArchive(String suid) throws Exception {
      return false;
    }


    @Override
    public boolean isAvailable() {
      return false;
    }

  };

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy