Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1b7950163ccf98e996600ac565117047eab42b10
[simgrid.git] / src / bindings / java / org / simgrid / msg / Storage.java
1 /* Bindings to the MSG storage */
2
3 /* Copyright (c) 2006-2014. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 package org.simgrid.msg;
10
11 public class Storage {
12
13         /**
14          * This attribute represents a bind between a java storage object and
15          * a native storage. Even if this attribute is public you must never
16          * access to it.
17          */ 
18         private long bind;
19
20         /**
21          * Storage name
22          */
23         protected String name;
24
25         /**
26          * User data.
27          */ 
28         private Object data;
29         /**
30          *
31          */
32         protected Storage() {
33                 this.bind = 0;
34                 this.data = null;
35         };
36
37         public String toString (){
38                 return this.name; 
39
40         }
41
42         /**
43          * This static method gets a storage instance associated with a native
44          * storage of your platform. This is the best way to get a java storage object.
45          *
46          * @param name          The name of the storage to get.
47          *
48          * @return              The storage object with the given name.
49          * @exception           StorageNotFoundException if the name of the storage is not valid.
50          *                                      NativeException if the native version of this method failed.
51          */ 
52         public native static Storage getByName(String name) 
53                         throws HostNotFoundException, NullPointerException;
54
55         /**
56          * This method returns the name of a storage.
57          * @return                      The name of the storage.
58          *
59          */ 
60         public String getName() {
61                 return name;
62         }
63
64         /**
65          * This method returns the size (in bytes) of a storage element.
66          *
67          * @return      The size (in bytes) of the storage element.
68          *
69          */ 
70         public native long getSize();
71
72         /**
73          * This method returns the free size (in bytes) of a storage element.
74          *
75          * @return      The free size (in bytes) of the storage element.
76          *
77          */ 
78         public native long getFreeSize();
79
80         /**
81          * This method returns the used size (in bytes) of a storage element.
82          *
83          * @return      The used size (in bytes) of the storage element.
84          *
85          */ 
86         public native long getUsedSize();
87
88         /**
89          * Returns the value of a given storage property. 
90          */
91         public native String getProperty(String name);
92
93         /**
94          * Change the value of a given storage property. 
95          */
96         public native void setProperty(String name, String value);
97
98
99         /** 
100          *
101          * Returns the host name the storage is attached to
102          *
103          * @return      the host name the storage is attached to
104          */
105         public native String getHost();
106
107         /**
108          * This static method returns all of the storages of the installed platform.
109          *
110          * @return                      An array containing all the storages installed.
111          *
112          */ 
113         public native static Storage[] all();
114
115         /**
116          * Class initializer, to initialize various JNI stuff
117          */
118         public static native void nativeInit();
119         static {
120                 nativeInit();
121         }               
122
123 }