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

org.integratedmodelling.api.runtime.IWorkspace Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 *  Copyright (C) 2007, 2015:
 *  
 *    - Ferdinando Villa 
 *    - integratedmodelling.org
 *    - any other authors listed in @author annotations
 *
 *    All rights reserved. This file is part of the k.LAB software suite,
 *    meant to enable modular, collaborative, integrated 
 *    development of interoperable data and model components. For
 *    details, see http://integratedmodelling.org.
 *    
 *    This program is free software; you can redistribute it and/or
 *    modify it under the terms of the Affero General Public License 
 *    Version 3 or any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but without any warranty; without even the implied warranty of
 *    merchantability or fitness for a particular purpose.  See the
 *    Affero General Public License for more details.
 *  
 *     You should have received a copy of the Affero General Public License
 *     along with this program; if not, write to the Free Software
 *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *     The license is also available at: https://www.gnu.org/licenses/agpl.html
 *******************************************************************************/
package org.integratedmodelling.api.runtime;

import java.io.File;
import java.util.Collection;

import org.integratedmodelling.api.project.IProject;
import org.integratedmodelling.exceptions.KlabException;

/**
 * A workspace exists in a client environment and refers to a directory (or more than one) where projects
 * are found. The workspace registers every project with the project manager and has callbacks for project
 * creation and deletion. Fine-grained event control for workspace modification is provided by the project
 * manager.
 * 
 * A workspace is created on client startup and returned by the IClient.getWorkspace() call if the client
 * property "thinklab.client.workspace" is given a valid value. Workspace changes are communicated to
 * the running engine(s). The project manager updates the workspace when projects are registered that the
 * workspace didn't know about.
 * 
 * @author ferdinando.villa
 *
 */
public interface IWorkspace {

    /**
     * Directories on the local filesystem where each project managed under this workspace. Each project
     * has its own individual location - there is no requirement for a "root" workspace directory.
     * 
     * @return registered project locations
     */
    Collection getProjectLocations();

    /**
     * Create an empty project with this ID in this workspace.
     * 
     * @param project
     * @return a new project
     */
    IProject create(String project);

    /**
     * Delete the passed project - no warnings or anything, so make sure you call this
     * when decided.
     * 
     * @param project
     */
    void delete(String project);

    /**
     * The location where to create a new project. 
     * 
     * @return the default location for new projects
     */
    File getDefaultFileLocation();

    /**
     * The location where to deploy projects that come from the network (projects in the 
     * default location will take over if present). 
     * 
     * @return the default location for deployed projects
     */
    File getDeployLocation();

//    /**
//     * Synchronize a project from the network, finding the authoritative node that distributes it. 
//     * Return the file location of the project so it can be registered, or null if it cannot be 
//     * synchronized.
//     * 
//     * This also works for components, which are consumed after unwrapping them into projects.
//     * 
//     * @param projectId
//     * @return synchronized project
//     * @throws KlabException
//     */
//    IProject synchronizeNetworkProject(String projectId) throws KlabException;

    /**
     * True if the passed project is one of those that are remotely synchronized based on the
     * groups the current user belongs to. If so, it should be considered read-only and loaded 
     * but not visualized in any IDE. 
     * 
     * @param project
     * @return true if project is remote
     */
    boolean isRemotelySynchronized(IProject project);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy