-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.db.service;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.WriteOnlyGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.request.WriteTraits;\r
-\r
-/**\r
- * @author TUOKSK\r
- *\r
- */\r
-public interface XSupport {\r
- /**\r
- * Writes illegal data into the current cluster cluster stream.\r
- *\r
- * @param r is resource used to identify cluster. If null then all clusters\r
- * streams are corrupted.\r
- */\r
- void corruptCluster(Resource r)\r
- throws DatabaseException;\r
- /**\r
- * Creates new cluster proxy for given clusterId.\r
- * Depending on the cluster id this proxy is valid or invalid.\r
- *\r
- * @param clusterId is used to identify cluster.\r
- * @return index of cluster proxy in cluster table.\r
- * @throws DatabaseException\r
- */\r
- int corruptClusterTable(long clusterId)\r
- throws DatabaseException;\r
- /**\r
- * Flush all modified data in the given cluster stream to server.\r
- *\r
- * @param r is resource used to identify cluster. If null then all clusters\r
- * streams are flushed.\r
- */\r
- void flushCluster(Resource r)\r
- throws ServiceException;\r
-\r
- /**\r
- * Forcibly breaks underlying connection.\r
- */\r
- void breakConnection()\r
- throws DatabaseException;\r
- /**\r
- * Set cluster stream on or off.\r
- *\r
- * @param setOff true if cluster stream is turned off\r
- * @throws DatabaseException\r
- */\r
- void setClusterStreamOff(boolean setOff)\r
- throws DatabaseException;\r
-\r
- /**\r
- * Clears the meta data cache.\r
- *\r
- * @return count of meta data entries in cache before clearing\r
- * @throws DatabaseException\r
- */\r
- int clearMetadataCache()\r
- throws DatabaseException;\r
- /**\r
- * Sends commit message to server but does not end transaction.\r
- * @param wgraph Write graph to ensure that this is called inside transaction.\r
- *\r
- */\r
- <T> void commitAndContinue(WriteOnlyGraph wograph, WriteTraits wtraits);\r
-\r
- /**\r
- * Get cluster's immutable property.\r
- *\r
- * @param resource used to get cluster.\r
- * @return true if cluster is immutable.\r
- * @throws DatabaseException\r
- */\r
- boolean getImmutable(Resource resource)\r
- throws DatabaseException;\r
- /**\r
- * Set cluster's immutable property.\r
- *\r
- * @param resource used to get cluster.\r
- * @param immutable value to set.\r
- * @throws DatabaseException\r
- */\r
- void setImmutable(Resource resource, boolean immutable)\r
- throws DatabaseException;\r
-\r
- /**\r
- * @param allowImmutableWrites <code>true</code> to allow writing to immutable cluster \r
- * @param createAsImmutable <code>true</code> to make all created clusters immutable\r
- */\r
- void setServiceMode(boolean allowImmutableWrites, boolean createAsImmutable);\r
-\r
- /**\r
- * If resource is acquired from DelayedWriteGraph during delayed write request then\r
- * this method can be used to convert it to normal resource which can be use in\r
- * write and write only requests.\r
- *\r
- * @param resource to convert.\r
- * @return converted resource if it was acquired from delayed write request.\r
- * Otherwise returns input resource.\r
- */\r
- Resource convertDelayedResourceToResource(Resource resource);\r
-\r
- /**\r
- * Execute given command on server.\r
- * @param command\r
- * @return result of the command\r
- * @throws DatabaseException\r
- */\r
- String execute(String command)\r
- throws DatabaseException;\r
- /**\r
- * Tests cluster functionality.\r
- * Database session is needed but no layer0.\r
- * Enables us to test cluster implementation without layer0.\r
- *\r
- * @param session\r
- */\r
- void testCluster(Session session)\r
- throws DatabaseException;\r
-\r
- /**\r
- * Writes garbage to server page table and exits server with -1 exit code.\r
- *\r
- * @throws DatabaseException\r
- */\r
- public void corruptPageTableAndDie()\r
- throws DatabaseException;\r
-\r
- /**\r
- * Returns clusters known to server.\r
- * @throws DatabaseException\r
- */\r
- public ClusterUID[] listClusters()\r
- throws DatabaseException;\r
-\r
- /**\r
- * Deletes given cluster from server.\r
- * @param clusterUID\r
- * @throws DatabaseException\r
- */\r
- public void deleteCluster(ClusterUID clusterUID)\r
- throws DatabaseException;\r
- public void purge() throws DatabaseException;\r
-\r
- public boolean rolledback();\r
- \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.service;
+
+import org.simantics.db.Resource;
+import org.simantics.db.Session;
+import org.simantics.db.WriteOnlyGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.ServiceException;
+import org.simantics.db.request.WriteTraits;
+
+/**
+ * @author TUOKSK
+ *
+ */
+public interface XSupport {
+ /**
+ * Writes illegal data into the current cluster cluster stream.
+ *
+ * @param r is resource used to identify cluster. If null then all clusters
+ * streams are corrupted.
+ */
+ void corruptCluster(Resource r)
+ throws DatabaseException;
+ /**
+ * Creates new cluster proxy for given clusterId.
+ * Depending on the cluster id this proxy is valid or invalid.
+ *
+ * @param clusterId is used to identify cluster.
+ * @return index of cluster proxy in cluster table.
+ * @throws DatabaseException
+ */
+ int corruptClusterTable(long clusterId)
+ throws DatabaseException;
+ /**
+ * Flush all modified data in the given cluster stream to server.
+ *
+ * @param r is resource used to identify cluster. If null then all clusters
+ * streams are flushed.
+ */
+ void flushCluster(Resource r)
+ throws ServiceException;
+
+ /**
+ * Forcibly breaks underlying connection.
+ */
+ void breakConnection()
+ throws DatabaseException;
+ /**
+ * Set cluster stream on or off.
+ *
+ * @param setOff true if cluster stream is turned off
+ * @throws DatabaseException
+ */
+ void setClusterStreamOff(boolean setOff)
+ throws DatabaseException;
+
+ /**
+ * Clears the meta data cache.
+ *
+ * @return count of meta data entries in cache before clearing
+ * @throws DatabaseException
+ */
+ int clearMetadataCache()
+ throws DatabaseException;
+ /**
+ * Sends commit message to server but does not end transaction.
+ * @param wgraph Write graph to ensure that this is called inside transaction.
+ *
+ */
+ <T> void commitAndContinue(WriteOnlyGraph wograph, WriteTraits wtraits);
+
+ /**
+ * Get cluster's immutable property.
+ *
+ * @param resource used to get cluster.
+ * @return true if cluster is immutable.
+ * @throws DatabaseException
+ */
+ boolean getImmutable(Resource resource)
+ throws DatabaseException;
+ /**
+ * Set cluster's immutable property.
+ *
+ * @param resource used to get cluster.
+ * @param immutable value to set.
+ * @throws DatabaseException
+ */
+ void setImmutable(Resource resource, boolean immutable)
+ throws DatabaseException;
+
+ /**
+ * @param allowImmutableWrites <code>true</code> to allow writing to immutable cluster
+ * @param createAsImmutable <code>true</code> to make all created clusters immutable
+ */
+ void setServiceMode(boolean allowImmutableWrites, boolean createAsImmutable);
+
+ /**
+ * If resource is acquired from DelayedWriteGraph during delayed write request then
+ * this method can be used to convert it to normal resource which can be use in
+ * write and write only requests.
+ *
+ * @param resource to convert.
+ * @return converted resource if it was acquired from delayed write request.
+ * Otherwise returns input resource.
+ */
+ Resource convertDelayedResourceToResource(Resource resource);
+
+ /**
+ * Execute given command on server.
+ * @param command
+ * @return result of the command
+ * @throws DatabaseException
+ */
+ String execute(String command)
+ throws DatabaseException;
+ /**
+ * Tests cluster functionality.
+ * Database session is needed but no layer0.
+ * Enables us to test cluster implementation without layer0.
+ *
+ * @param session
+ */
+ void testCluster(Session session)
+ throws DatabaseException;
+
+ /**
+ * Writes garbage to server page table and exits server with -1 exit code.
+ *
+ * @throws DatabaseException
+ */
+ public void corruptPageTableAndDie()
+ throws DatabaseException;
+
+ /**
+ * Returns clusters known to server.
+ * @throws DatabaseException
+ */
+ public ClusterUID[] listClusters()
+ throws DatabaseException;
+
+ /**
+ * Deletes given cluster from server.
+ * @param clusterUID
+ * @throws DatabaseException
+ */
+ public void deleteCluster(ClusterUID clusterUID)
+ throws DatabaseException;
+ public void purge() throws DatabaseException;
+
+ public boolean rolledback();
+
+}