Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4b15bba5e52f372a79647f9440b89d5532388813
[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 = 0;
19
20         /** Storage name */
21         protected String name;
22
23         @Override
24         public String toString (){
25                 return this.name; 
26
27         }
28
29         /**
30          * This static method gets a storage instance associated with a native
31          * storage of your platform. This is the best way to get a java storage object.
32          *
33          * @param name          The name of the storage to get.
34          *
35          * @return              The storage object with the given name.
36          * @exception           StorageNotFoundException if the name of the storage is not valid.
37          */ 
38         public static native Storage getByName(String name) 
39                         throws HostNotFoundException, StorageNotFoundException;
40
41         /**
42          * This method returns the name of a storage.
43          * @return                      The name of the storage.
44          *
45          */ 
46         public String getName() {
47                 return name;
48         }
49
50         /**
51          * This method returns the size (in bytes) of a storage element.
52          *
53          * @return      The size (in bytes) of the storage element.
54          *
55          */ 
56         public native long getSize();
57
58         /**
59          * This method returns the free size (in bytes) of a storage element.
60          *
61          * @return      The free size (in bytes) of the storage element.
62          *
63          */ 
64         public native long getFreeSize();
65
66         /**
67          * This method returns the used size (in bytes) of a storage element.
68          *
69          * @return      The used size (in bytes) of the storage element.
70          *
71          */ 
72         public native long getUsedSize();
73
74         /**
75          * Returns the value of a given storage property. 
76          */
77         public native String getProperty(String name);
78
79         /**
80          * Change the value of a given storage property. 
81          */
82         public native void setProperty(String name, String value);
83
84
85         /** 
86          *
87          * Returns the host name the storage is attached to
88          *
89          * @return      the host name the storage is attached to
90          */
91         public native String getHost();
92
93         /**
94          * This static method returns all of the storages of the installed platform.
95          *
96          * @return                      An array containing all the storages installed.
97          *
98          */ 
99         public static native Storage[] all();
100
101         /**
102          * Class initializer, to initialize various JNI stuff
103          */
104         public static native void nativeInit();
105         static {
106                 nativeInit();
107         }               
108
109 }