-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
- * 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.history;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.OutputStream;\r
-\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.history.impl.CollectorImpl;\r
-import org.simantics.history.impl.FileHistory;\r
-import org.simantics.history.impl.FlushPolicy;\r
-import org.simantics.history.impl.MemoryHistory;\r
-import org.simantics.history.util.HistoryExportUtil;\r
-\r
-/**\r
- * Facade-class for History Services.\r
- * \r
- * There are two main services HistoryManager and Collector.\r
- * There are two main implementations file and memory.\r
- * \r
- * @author toni.kalajainen\r
- */\r
-public class History {\r
-\r
- /**\r
- * Open a file based history manager.\r
- * (Note, Trend does not need flush policy)\r
- * \r
- * @param workarea\r
- * @return history manager\r
- */\r
- public static HistoryManager openFileHistory(File workarea)\r
- {\r
- return new FileHistory(workarea);\r
- }\r
- \r
- /**\r
- * Create a transient memory history\r
- * \r
- * @return no history\r
- */\r
- public static HistoryManager createMemoryHistory()\r
- {\r
- return new MemoryHistory();\r
- }\r
- \r
- /**\r
- * Create collector\r
- * \r
- * @param historyManager\r
- * @return collector\r
- */\r
- public static Collector createCollector(HistoryManager historyManager)\r
- {\r
- CollectorImpl result = new CollectorImpl(historyManager);\r
- return result;\r
- }\r
- \r
- /**\r
- * Create collector\r
- * \r
- * @param historyManager\r
- * @param flushPolicy\r
- * @return collector\r
- */\r
- public static Collector createCollector(HistoryManager historyManager, FlushPolicy flushPolicy)\r
- {\r
- CollectorImpl result = new CollectorImpl(historyManager);\r
- result.setFlushPolicy(flushPolicy);\r
- return result;\r
- }\r
-\r
- /**\r
- * Export whole history manager to an output stream.\r
- * \r
- * @param history\r
- * @param timeBinding\r
- * @param from\r
- * @param end\r
- * @param os\r
- * @throws IOException\r
- * @throws HistoryException\r
- */\r
- public static void exportHistory( HistoryManager history, Binding timeBinding, Double from, Double end, OutputStream os )\r
- throws IOException, HistoryException\r
- {\r
- HistoryExportUtil eu = new HistoryExportUtil();\r
- eu.exportHistory(history, timeBinding, from, end, os);\r
- }\r
- \r
- /**\r
- * Import a history manager from an input stream \r
- * \r
- * @param history\r
- * @param is\r
- * @throws IOException\r
- * @throws HistoryException\r
- */\r
- public static void importHistory( HistoryManager history, InputStream is )\r
- throws IOException, HistoryException\r
- {\r
- HistoryExportUtil eu = new HistoryExportUtil();\r
- eu.importHistory(history, is);\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 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.history;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.simantics.databoard.binding.Binding;
+import org.simantics.history.impl.CollectorImpl;
+import org.simantics.history.impl.FileHistory;
+import org.simantics.history.impl.FlushPolicy;
+import org.simantics.history.impl.MemoryHistory;
+import org.simantics.history.util.HistoryExportUtil;
+
+/**
+ * Facade-class for History Services.
+ *
+ * There are two main services HistoryManager and Collector.
+ * There are two main implementations file and memory.
+ *
+ * @author toni.kalajainen
+ */
+public class History {
+
+ /**
+ * Open a file based history manager.
+ * (Note, Trend does not need flush policy)
+ *
+ * @param workarea
+ * @return history manager
+ */
+ public static HistoryManager openFileHistory(File workarea)
+ {
+ return new FileHistory(workarea);
+ }
+
+ /**
+ * Create a transient memory history
+ *
+ * @return no history
+ */
+ public static HistoryManager createMemoryHistory()
+ {
+ return new MemoryHistory();
+ }
+
+ /**
+ * Create collector
+ *
+ * @param historyManager
+ * @return collector
+ */
+ public static Collector createCollector(HistoryManager historyManager)
+ {
+ CollectorImpl result = new CollectorImpl(historyManager);
+ return result;
+ }
+
+ /**
+ * Create collector
+ *
+ * @param historyManager
+ * @param flushPolicy
+ * @return collector
+ */
+ public static Collector createCollector(HistoryManager historyManager, FlushPolicy flushPolicy)
+ {
+ CollectorImpl result = new CollectorImpl(historyManager);
+ result.setFlushPolicy(flushPolicy);
+ return result;
+ }
+
+ /**
+ * Export whole history manager to an output stream.
+ *
+ * @param history
+ * @param timeBinding
+ * @param from
+ * @param end
+ * @param os
+ * @throws IOException
+ * @throws HistoryException
+ */
+ public static void exportHistory( HistoryManager history, Binding timeBinding, Double from, Double end, OutputStream os )
+ throws IOException, HistoryException
+ {
+ HistoryExportUtil eu = new HistoryExportUtil();
+ eu.exportHistory(history, timeBinding, from, end, os);
+ }
+
+ /**
+ * Import a history manager from an input stream
+ *
+ * @param history
+ * @param is
+ * @throws IOException
+ * @throws HistoryException
+ */
+ public static void importHistory( HistoryManager history, InputStream is )
+ throws IOException, HistoryException
+ {
+ HistoryExportUtil eu = new HistoryExportUtil();
+ eu.importHistory(history, is);
+ }
+
+}