]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/Database.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / Database.java
index c80abd27d0e456e79aabe07a4881138cbb94804f..8d30e11bcc6e3ac0f912bd83557c54e3e848c4b2 100644 (file)
-package org.simantics.db;\r
-\r
-import java.io.File;\r
-import java.nio.ByteBuffer;\r
-import java.nio.file.Path;\r
-import java.util.Properties;\r
-\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.SDBException;\r
-import org.simantics.db.service.ClusterUID;\r
-\r
-public interface Database {\r
-    static public enum Status {\r
-        NoDatabase { @Override public String getString() { return "NoDatabase"; }},\r
-        NotRunning { @Override public String getString() { return "NotRunning"; }},\r
-        Standalone { @Override public String getString() { return "Standalone"; }},\r
-        Local { @Override public String getString() { return "Local"; }},\r
-        Remote { @Override public String getString() { return "Remote";}};\r
-        public abstract String getString();\r
-        @Override\r
-        public String toString() {\r
-            return message;\r
-        }\r
-        public String message = "";\r
-    }\r
-    public DatabaseUserAgent getUserAgent();\r
-    public void setUserAgent(DatabaseUserAgent dbUserAgent);\r
-    public Status getStatus();\r
-\r
-    public File getFolder();\r
-    public boolean isFolderOk();\r
-    public boolean isFolderOk(File aFolder);\r
-    public boolean isFolderEmpty();\r
-    public boolean isFolderEmpty(File aFolder);\r
-    public void initFolder(Properties properties) throws SDBException;\r
-    public void deleteFiles() throws SDBException;\r
-\r
-    public void start() throws SDBException;\r
-    public boolean isRunning() throws SDBException;\r
-    public boolean tryToStop() throws SDBException;\r
-\r
-    public void connect() throws SDBException;\r
-    public boolean isConnected() throws SDBException;\r
-    public String execute(String command) throws SDBException;\r
-    public void disconnect() throws SDBException;\r
-\r
-    public void clone(File to, int revision, boolean saveHistory) throws SDBException;\r
-    public Path createFromChangeSets(int revision) throws SDBException;\r
-    public void deleteGuard() throws SDBException;\r
-    public Path dumpChangeSets() throws SDBException;\r
-    public void purgeDatabase() throws SDBException;\r
-    public long serverGetTailChangeSetId() throws SDBException;\r
-\r
-    public interface Session {\r
-        public Database getDatabase(); // Convenience method.\r
-        public void close() throws SDBException;\r
-        public void open() throws SDBException;\r
-        public boolean isClosed() throws SDBException;\r
-        public interface ChangeSetData {\r
-            public boolean isOk();\r
-        }\r
-        public interface ChangeSetIds {\r
-            public long getFirstChangeSetId();\r
-            public int getCount();\r
-        }\r
-        public interface Cluster {\r
-            public int getInflateSize();\r
-            public ByteBuffer getDeflated();\r
-        }\r
-        public interface ClusterChanges {\r
-            public long getHeadChangeSetId();\r
-            public int[] getResourceIndex();\r
-            public int[] getPredicateIndex();\r
-            public long[] getPredicateFirst();\r
-            public long[] getPredicateSecond();\r
-            public int[] getValueIndex();\r
-        }\r
-        public interface ClusterIds {\r
-            public int getStatus();\r
-            public long[] getFirst();\r
-            public long[] getSecond();\r
-        }\r
-        public interface Information {\r
-            public String getServerId();\r
-            public String getProtocolId();\r
-            public String getDatabaseId();\r
-            public long getFirstChangeSetId();\r
-        }\r
-        public interface Refresh {\r
-            public long getHeadChangeSetId();\r
-            public long[] getFirst();\r
-            public long[] getSecond();\r
-        }\r
-        public interface ResourceSegment {\r
-            public byte[] getClusterId();\r
-            public int getResourceIndex();\r
-            public long getValueSize(); // Size of whole value.\r
-            public byte[] getSegment(); // Bytes of asked segment.\r
-            public long getOffset(); // Segment offset.\r
-        }\r
-        public interface Transaction {\r
-            public long getHeadChangeSetId();\r
-            public long getTransactionId();\r
-        }\r
-        interface OnChangeSetUpdate {\r
-            public void onChangeSetUpdate(ChangeSetUpdate changeSetUpdate) throws SDBException;\r
-        }\r
-        public void acceptCommit(long transactionId, long changeSetId, byte[] metadata) throws SDBException;\r
-        public long cancelCommit(long transactionId, long changeSetId, byte[] metadata, OnChangeSetUpdate onChangeSetUpdate) throws SDBException;\r
-        public Transaction askReadTransaction() throws SDBException;\r
-        public Transaction askWriteTransaction(long transactionId) throws SDBException;\r
-        public long endTransaction(long transactionId) throws SDBException; // Return head change set id.\r
-        public String execute(String command) throws SDBException;\r
-        public byte[] getChangeSetMetadata(long changeSetId) throws SDBException;\r
-        public ChangeSetData getChangeSetData(long minChangeSetId, long  maxChangeSetId, OnChangeSetUpdate onChangeSetupate) throws SDBException;\r
-        public ChangeSetIds getChangeSetIds() throws SDBException;\r
-        public Cluster getCluster(byte[] clusterId) throws SDBException;\r
-        public ClusterChanges getClusterChanges(long changeSetId, byte[] clusterId) throws SDBException;\r
-        public ClusterIds getClusterIds() throws SDBException;\r
-        public Information getInformation() throws SDBException;\r
-        public Refresh getRefresh(long changeSetId) throws SDBException;\r
-        public ResourceSegment getResourceSegment(byte[] clusterUID, int resourceIndex, long offset, short size) throws SDBException;\r
-        public long reserveIds(int count) throws SDBException;\r
-        public void updateCluster(byte[] operations) throws SDBException;\r
-        public interface ChangeSetUpdate {\r
-            public long getChangeSetId();\r
-            public int getChangeSetIndex();\r
-            public int getNumberOfClusterChangeSets();\r
-            public int getIndexOfClusterChangeSet();\r
-            public byte[] getClusterId();\r
-            public boolean getNewCluster();\r
-            public byte[] getData();\r
-        }\r
-        public boolean undo(long[] changeSetIds, OnChangeSetUpdate onChangeSetUpdate) throws SDBException;\r
-        \r
-        public <T> T clone(ClusterUID clusterUID, ClusterCreator clusterCreator) throws DatabaseException;\r
-        public boolean refreshEnabled();\r
-        public boolean rolledback();\r
-    }\r
-    public Session newSession(ServiceLocator locator) throws SDBException;\r
-    interface Journal {\r
-        public class Line {\r
-            public boolean status;\r
-            public String request;\r
-            public String comment;\r
-        }\r
-        public boolean canRead();\r
-        public int count();\r
-        public int read(int index, Line line) throws SDBException;\r
-    }\r
-    public Journal getJournal() throws SDBException;\r
-    public String getCompression();\r
-}\r
+package org.simantics.db;
+
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import java.util.Properties;
+
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.SDBException;
+import org.simantics.db.service.ClusterUID;
+
+public interface Database {
+    static public enum Status {
+        NoDatabase { @Override public String getString() { return "NoDatabase"; }},
+        NotRunning { @Override public String getString() { return "NotRunning"; }},
+        Standalone { @Override public String getString() { return "Standalone"; }},
+        Local { @Override public String getString() { return "Local"; }},
+        Remote { @Override public String getString() { return "Remote";}};
+        public abstract String getString();
+        @Override
+        public String toString() {
+            return message;
+        }
+        public String message = "";
+    }
+    public DatabaseUserAgent getUserAgent();
+    public void setUserAgent(DatabaseUserAgent dbUserAgent);
+    public Status getStatus();
+
+    public File getFolder();
+    public boolean isFolderOk();
+    public boolean isFolderOk(File aFolder);
+    public boolean isFolderEmpty();
+    public boolean isFolderEmpty(File aFolder);
+    public void initFolder(Properties properties) throws SDBException;
+    public void deleteFiles() throws SDBException;
+
+    public void start() throws SDBException;
+    public boolean isRunning() throws SDBException;
+    public boolean tryToStop() throws SDBException;
+
+    public void connect() throws SDBException;
+    public boolean isConnected() throws SDBException;
+    public String execute(String command) throws SDBException;
+    public void disconnect() throws SDBException;
+
+    public void clone(File to, int revision, boolean saveHistory) throws SDBException;
+    public Path createFromChangeSets(int revision) throws SDBException;
+    public void deleteGuard() throws SDBException;
+    public Path dumpChangeSets() throws SDBException;
+    public void purgeDatabase() throws SDBException;
+    public long serverGetTailChangeSetId() throws SDBException;
+
+    public interface Session {
+        public Database getDatabase(); // Convenience method.
+        public void close() throws SDBException;
+        public void open() throws SDBException;
+        public boolean isClosed() throws SDBException;
+        public interface ChangeSetData {
+            public boolean isOk();
+        }
+        public interface ChangeSetIds {
+            public long getFirstChangeSetId();
+            public int getCount();
+        }
+        public interface Cluster {
+            public int getInflateSize();
+            public ByteBuffer getDeflated();
+        }
+        public interface ClusterChanges {
+            public long getHeadChangeSetId();
+            public int[] getResourceIndex();
+            public int[] getPredicateIndex();
+            public long[] getPredicateFirst();
+            public long[] getPredicateSecond();
+            public int[] getValueIndex();
+        }
+        public interface ClusterIds {
+            public int getStatus();
+            public long[] getFirst();
+            public long[] getSecond();
+        }
+        public interface Information {
+            public String getServerId();
+            public String getProtocolId();
+            public String getDatabaseId();
+            public long getFirstChangeSetId();
+        }
+        public interface Refresh {
+            public long getHeadChangeSetId();
+            public long[] getFirst();
+            public long[] getSecond();
+        }
+        public interface ResourceSegment {
+            public byte[] getClusterId();
+            public int getResourceIndex();
+            public long getValueSize(); // Size of whole value.
+            public byte[] getSegment(); // Bytes of asked segment.
+            public long getOffset(); // Segment offset.
+        }
+        public interface Transaction {
+            public long getHeadChangeSetId();
+            public long getTransactionId();
+        }
+        interface OnChangeSetUpdate {
+            public void onChangeSetUpdate(ChangeSetUpdate changeSetUpdate) throws SDBException;
+        }
+        public void acceptCommit(long transactionId, long changeSetId, byte[] metadata) throws SDBException;
+        public long cancelCommit(long transactionId, long changeSetId, byte[] metadata, OnChangeSetUpdate onChangeSetUpdate) throws SDBException;
+        public Transaction askReadTransaction() throws SDBException;
+        public Transaction askWriteTransaction(long transactionId) throws SDBException;
+        public long endTransaction(long transactionId) throws SDBException; // Return head change set id.
+        public String execute(String command) throws SDBException;
+        public byte[] getChangeSetMetadata(long changeSetId) throws SDBException;
+        public ChangeSetData getChangeSetData(long minChangeSetId, long  maxChangeSetId, OnChangeSetUpdate onChangeSetupate) throws SDBException;
+        public ChangeSetIds getChangeSetIds() throws SDBException;
+        public Cluster getCluster(byte[] clusterId) throws SDBException;
+        public ClusterChanges getClusterChanges(long changeSetId, byte[] clusterId) throws SDBException;
+        public ClusterIds getClusterIds() throws SDBException;
+        public Information getInformation() throws SDBException;
+        public Refresh getRefresh(long changeSetId) throws SDBException;
+        public ResourceSegment getResourceSegment(byte[] clusterUID, int resourceIndex, long offset, short size) throws SDBException;
+        public long reserveIds(int count) throws SDBException;
+        public void updateCluster(byte[] operations) throws SDBException;
+        public interface ChangeSetUpdate {
+            public long getChangeSetId();
+            public int getChangeSetIndex();
+            public int getNumberOfClusterChangeSets();
+            public int getIndexOfClusterChangeSet();
+            public byte[] getClusterId();
+            public boolean getNewCluster();
+            public byte[] getData();
+        }
+        public boolean undo(long[] changeSetIds, OnChangeSetUpdate onChangeSetUpdate) throws SDBException;
+        
+        public <T> T clone(ClusterUID clusterUID, ClusterCreator clusterCreator) throws DatabaseException;
+        public boolean refreshEnabled();
+        public boolean rolledback();
+    }
+    public Session newSession(ServiceLocator locator) throws SDBException;
+    interface Journal {
+        public class Line {
+            public boolean status;
+            public String request;
+            public String comment;
+        }
+        public boolean canRead();
+        public int count();
+        public int read(int index, Line line) throws SDBException;
+    }
+    public Journal getJournal() throws SDBException;
+    public String getCompression();
+}