[libbluray-devel] Implement StorageManager

hpi1 git at videolan.org
Tue Sep 18 11:56:29 CEST 2012


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Sep 18 12:53:20 2012 +0300| [857bf79114b6da8a8f75723870130c84b4a20ded] | committer: hpi1

Implement StorageManager

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=857bf79114b6da8a8f75723870130c84b4a20ded
---

 .../bluray/storage/BindingunitDataAreaInfo.java    |   30 ++++++++++++++++++++
 .../org/bluray/storage/PersistentDataAreaInfo.java |   30 ++++++++++++++++++++
 .../java/org/bluray/storage/StorageManager.java    |   12 ++++++--
 3 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/java/org/bluray/storage/BindingunitDataAreaInfo.java b/src/libbluray/bdj/java/org/bluray/storage/BindingunitDataAreaInfo.java
new file mode 100644
index 0000000..5d811bf
--- /dev/null
+++ b/src/libbluray/bdj/java/org/bluray/storage/BindingunitDataAreaInfo.java
@@ -0,0 +1,30 @@
+/*
+ * This file is part of libbluray
+ * Copyright (C) 2012  Petri Hintukainen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+package org.bluray.storage;
+
+public class BindingunitDataAreaInfo implements DataAreaInfo {
+    public long getFreeSpace() {
+           return 1024000;
+    }
+
+    public long getTotalSpace() {
+           return 1024000;
+    }
+}
diff --git a/src/libbluray/bdj/java/org/bluray/storage/PersistentDataAreaInfo.java b/src/libbluray/bdj/java/org/bluray/storage/PersistentDataAreaInfo.java
new file mode 100644
index 0000000..e7e764f
--- /dev/null
+++ b/src/libbluray/bdj/java/org/bluray/storage/PersistentDataAreaInfo.java
@@ -0,0 +1,30 @@
+/*
+ * This file is part of libbluray
+ * Copyright (C) 2012  Petri Hintukainen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+package org.bluray.storage;
+
+public class PersistentDataAreaInfo implements DataAreaInfo {
+    public long getFreeSpace() {
+           return 1024000;
+    }
+
+    public long getTotalSpace() {
+           return 1024000;
+    }
+}
diff --git a/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java b/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java
index aa043fc..961c8ec 100644
--- a/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java
+++ b/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java
@@ -21,17 +21,23 @@ package org.bluray.storage;
 
 public class StorageManager {
     public static StorageManager getInstance() {
-        throw new Error("Not implemented");
+        synchronized (StorageManager.class) {
+            if (instance == null)
+                instance = new StorageManager();
+        }
+        return instance;
     }
 
     protected StorageManager() {
     }
 
     public DataAreaInfo getBindingunitDataAreaInfo() {
-        throw new Error("Not implemented");
+        return new BindingunitDataAreaInfo();
     }
 
     public DataAreaInfo getPersistentDataAreaInfo() {
-        throw new Error("Not implemented");
+        return new PersistentDataAreaInfo();
     }
+
+    private static StorageManager instance = null;
 }



More information about the libbluray-devel mailing list