001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him.editors;
020:
021: import org.openharmonise.vfs.*;
022: import org.openharmonise.vfs.status.*;
023:
024: /**
025: * Interface for classes which need to act as content editors within
026: * Harmonise Information Manager.
027: *
028: * @author Matthew Large
029: * @version $Revision: 1.1 $
030: *
031: */
032: public interface Editor {
033:
034: /**
035: * Opens a virtual file for editing.
036: *
037: * @param sPath Full path
038: * @param vfs Virtual file system
039: * @return Local file path to working version or null if there is no working version
040: */
041: public PathStatusWrapper open(String sPath,
042: AbstractVirtualFileSystem vfs);
043:
044: /**
045: * Creates a new virtual file.
046: *
047: * @param sPath Full path
048: * @param vfs Virtual file system
049: * @return Local file path to working version or null if there is no working version
050: */
051: public PathStatusWrapper createNew(String sPath,
052: AbstractVirtualFileSystem vfs);
053:
054: /**
055: * Creates a new virtual file.
056: *
057: * @param sPath Full path
058: * @param content Content for new virtual file
059: * @param vfs Virtual file system
060: * @return Local file path to working version or null if there is no working version
061: */
062: public PathStatusWrapper createNew(String sPath, byte[] content,
063: AbstractVirtualFileSystem vfs);
064:
065: /**
066: * Discards any changes that have been made to a virtual file's
067: * content.
068: *
069: * @param sPath Full path
070: * @param vfs Virtual file system
071: */
072: public StatusData discardChanges(String sPath,
073: AbstractVirtualFileSystem vfs);
074:
075: /**
076: * Exports the content of a virtual file.
077: *
078: * @param sPath Full path
079: * @param vfs Virtual file system
080: */
081: public StatusData export(String sPath, AbstractVirtualFileSystem vfs);
082:
083: /**
084: * Checks if a resource was actually created the last time one
085: * of the create new methods was called.
086: *
087: * @return true if a resource was actually created
088: */
089: public boolean hasResourceBeenCreated();
090:
091: /**
092: * Opens the virtual file in a suitable preview environment.
093: * @param sPath
094: * @param vfs
095: */
096: public PathStatusWrapper preview(String sPath,
097: AbstractVirtualFileSystem vfs);
098:
099: /**
100: * @param path
101: * @param vfs
102: * @return
103: */
104: public PathStatusWrapper upload(String path,
105: AbstractVirtualFileSystem vfs);
106: }
|