Logo AND Algorithmique Numérique Distribuée

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