This file is indexed.

/usr/share/doc/libvirt-doc/java.html is in libvirt-doc 1.2.2-0ubuntu13.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
        This file is autogenerated from java.html.in
        Do not edit this file. Changes will be lost.
      -->
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="main.css" />
    <link rel="SHORTCUT ICON" href="32favicon.png" />
    <title>libvirt: Java API bindings</title>
    <meta name="description" content="libvirt, virtualization, virtualization API" />
  </head>
  <body>
    <div id="header">
      <div id="headerLogo"></div>
      <div id="headerSearch">
        <form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><div>
            <input id="query" name="query" type="text" size="12" value="" />
            <input id="submit" name="submit" type="submit" value="Search" />
          </div></form>
      </div>
    </div>
    <div id="body">
      <div id="menu">
        <ul class="l0"><li>
            <div>
              <a title="Front page of the libvirt website" class="inactive" href="index.html">Home</a>
            </div>
          </li><li>
            <div>
              <a title="Details of new features and bugs fixed in each release" class="inactive" href="news.html">News</a>
            </div>
          </li><li>
            <div>
              <a title="Applications known to use libvirt" class="inactive" href="apps.html">Applications</a>
            </div>
          </li><li>
            <div>
              <a title="Get the latest source releases, binary builds and get access to the source repository" class="inactive" href="downloads.html">Downloads</a>
            </div>
          </li><li>
            <div>
              <a title="Information for users, administrators and developers" class="active" href="docs.html">Documentation</a>
              <ul class="l1"><li>
                  <div>
                    <a title="How to compile libvirt" class="inactive" href="compiling.html">Compiling</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Information about deploying and using libvirt" class="inactive" href="deployment.html">Deployment</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Overview of the logical subsystems in the libvirt API" class="inactive" href="intro.html">Architecture</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Description of the XML formats used in libvirt" class="inactive" href="format.html">XML format</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Hypervisor specific driver information" class="inactive" href="drivers.html">Drivers</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Reference manual for the C public API" class="inactive" href="html/index.html">API reference</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Bindings of the libvirt API for other languages" class="active" href="bindings.html">Language bindings</a>
                    <ul class="l2"><li>
                        <div>
                          <a title="overview of the python API bindings" class="inactive" href="python.html">Python</a>
                        </div>
                      </li><li>
                        <div>
                          <span class="active">Java</span>
                        </div>
                      </li><li>
                        <div>
                          <a title="overview of the C# API bindings" class="inactive" href="csharp.html">C#</a>
                        </div>
                      </li><li>
                        <div>
                          <a title="overview of the PHP API bindings" class="inactive" href="php.html">PHP</a>
                        </div>
                      </li></ul>
                  </div>
                </li><li>
                  <div>
                    <a title="Working on the internals of libvirt API, driver and daemon code" class="inactive" href="internals.html">Internals</a>
                  </div>
                </li><li>
                  <div>
                    <a title="A guide and reference for developing with libvirt" class="inactive" href="devguide.html">Development Guide</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Command reference for virsh" class="inactive" href="virshcmdref.html">Virsh Commands</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Project governance and code of conduct" class="inactive" href="governance.html">Governance</a>
                  </div>
                </li></ul>
            </div>
          </li><li>
            <div>
              <a title="User contributed content" class="inactive" href="http://wiki.libvirt.org">Wiki</a>
            </div>
          </li><li>
            <div>
              <a title="Frequently asked questions" class="inactive" href="http://wiki.libvirt.org/page/FAQ">FAQ</a>
            </div>
          </li><li>
            <div>
              <a title="How and where to report bugs and request features" class="inactive" href="bugs.html">Bug reports</a>
            </div>
          </li><li>
            <div>
              <a title="How to contact the developers via email and IRC" class="inactive" href="contact.html">Contact</a>
            </div>
          </li><li>
            <div>
              <a title="Available test suites for libvirt" class="inactive" href="testsuites.html">Test suites</a>
            </div>
          </li><li>
            <div>
              <a title="Miscellaneous links of interest related to libvirt" class="inactive" href="relatedlinks.html">Related Links</a>
            </div>
          </li><li>
            <div>
              <a title="Overview of all content on the website" class="inactive" href="sitemap.html">Sitemap</a>
            </div>
          </li></ul>
      </div>
      <div id="content">
        <h1>Java API bindings</h1>
        <h2>Presentation</h2>
        <p>The Java bindings make use of <a href="https://jna.dev.java.net/" shape="rect">JNA</a>
    to expose the C API in a Java friendly way. The bindings are based on
    work initiated by Toth Istvan.</p>
        <h2>Getting it</h2>
        <p>
  The latest versions of the libvirt Java bindings can be downloaded from:
</p>
        <ul><li><a href="ftp://libvirt.org/libvirt/java/" shape="rect">libvirt.org FTP server</a></li><li><a href="http://libvirt.org/sources/java/" shape="rect">libvirt.org HTTP server</a></li></ul>
        <h3>Maven</h3>
        <p>A maven repository is located at <a href="http://www.libvirt.org/maven2/" shape="rect">http://www.libvirt.org/maven2/</a>
which you can use to include this in your maven projects.</p>
        <h2>GIT source repository</h2>
        <p> The Java bindings code source is now maintained in a <a href="http://git-scm.com/" shape="rect">git</a> repository available on
<a href="http://libvirt.org/git/" shape="rect">libvirt.org</a>:
</p>
        <pre xml:space="preserve">
git clone git://libvirt.org/libvirt-java.git
</pre>
        <p>
It can also be browsed at
</p>
        <pre xml:space="preserve">

<a href="http://libvirt.org/git/?p=libvirt-java.git;a=summary" shape="rect">http://libvirt.org/git/?p=libvirt-java.git;a=summary</a>
</pre>
        <p></p>
        <h2>GIT repository mirror</h2>
        <p>
  The source code is also mirrored on <a href="http://www.gitorious.org" shape="rect">gitorious</a>
  to aid in public development. You clone the repo with
</p>
        <pre xml:space="preserve">
  git clone git://gitorious.org/libvirt/libvirt-java.git
</pre>
        <p>
  It can also be browsed at
</p>
        <pre xml:space="preserve">

  <a href="http://gitorious.org/libvirt/libvirt-java" shape="rect">http://gitorious.org/libvirt/libvirt-java</a>
</pre>
        <p></p>
        <h2>CVS repository access (Deprecated)</h2>
        <p> The old source repository uses <a href="http://ximbiot.com/cvs/cvshome/docs/" shape="rect">CVS</a> and anonymous access
is provided. Prior to accessing the server is it necessary to authenticate
using the password <code>anoncvs</code>. This can be accomplished with
the <code>cvs login</code> command:
</p>
        <pre xml:space="preserve">
  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs login
</pre>
        <p>
  Once authenticated, a checkout can be obtained using
</p>
        <pre xml:space="preserve">
  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs co libvirt-java
</pre>
        <p></p>
        <h2>Building</h2>
        <p>The code is built using ant, and assumes that you have the jna jar installed. Once you have downloaded
the code you can build the code with</p>
        <pre xml:space="preserve">

% cd libvirt-java
% ant build
</pre>
        <h2>Content</h2>
        <p>The bindings are articulated around a few
classes in the <code>org/libvirt</code> package, notably the
<code>Connect</code>, <code>Domain</code> and <code>Network</code>
ones. Functions in the <a href="html/libvirt-libvirt.html" shape="rect">C API</a>
taking <code>virConnectPtr</code>, <code>virDomainPtr</code> or
<code>virNetworkPtr</code> as their first argument usually become
methods for the classes, their name is just stripped from the
virConnect or virDomain(Get) prefix and the first letter gets converted to
lower case, for example the C functions:</p>
        <p>
      <code>int <a href="html/libvirt-libvirt.html#virConnectNumOfDomains" shape="rect">virConnectNumOfDomains</a>
(virConnectPtr conn);</code>
    </p>
        <p>
      <code>int <a href="html/libvirt-libvirt.html#virDomainSetMaxMemory" shape="rect">virDomainSetMaxMemory</a>
(virDomainPtr domain, unsigned long memory);</code>
    </p>
        <p>become</p>
        <p>
      <code>virConn.numOfDomains()</code>
    </p>
        <p>
      <code>virDomain.setMaxMemory(long memory)</code>
    </p>
        <p> There is of course some functions where the mapping is less direct
and using extra classes to map complex arguments. The <a href="http://libvirt.org/sources/java/javadoc" shape="rect">Javadoc</a> is available online or as
part of a separate libvirt-java-javadoc package.</p>
        <p>So let's look at a simple example inspired from the
<code>test.java</code> test found in <code>src</code> in the source tree:</p>
        <pre xml:space="preserve">import <span style="color: #0071FF; background-color: #FFFFFF">org.libvirt.*</span>;
public class minitest {
    public static void main(String[] args) {
        Connect conn=null;
        try{
            conn = new <span style="color: #0071FF; background-color: #FFFFFF">Connect</span>("test:///default", true);
        } catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e){
            System.out.println("exception caught:"+e);
            System.out.println(e.getError());
        }
        try{
            <span style="color: #0071FF; background-color: #FFFFFF">Domain</span> testDomain=conn.<span style="color: #007F00; background-color: #FFFFFF">domainLookupByName</span>("test");
            System.out.println("Domain:" + testDomain.<span style="color: #E50073; background-color: #FFFFFF">getName</span>() + " id " +
                               testDomain.<span style="color: #E50073; background-color: #FFFFFF">getID</span>() + " running " +
                               testDomain.<span style="color: #E50073; background-color: #FFFFFF">getOSType</span>());
        } catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e){
            System.out.println("exception caught:"+e);
            System.out.println(e.getError());
        }
    }
}
</pre>
        <p>There is not much to comment about it, it really is a straight mapping
from the C API, the only points to notice are:</p>
        <ul><li>the import of the modules in the <code><span style="color: #0071FF; background-color: #FFFFFF">org.libvirt</span></code> package</li><li>getting a connection to the hypervisor, in that case using the
    readonly access to the default test hypervisor.</li><li>getting an object representing the test domain using <span style="color: #007F00; background-color: #FFFFFF">lookupByName</span></li><li>if the domain is not found a LibvirtError exception will be raised</li><li>extracting and printing some information about the domain using
    various <span style="color: #E50073; background-color: #FFFFFF">methods</span>
    associated to the Domain class.</li></ul>
        <h2>Maven</h2>
        <p>Up until version 0.4.7 the Java bindings were available from the central maven repository.</p>
        <p>If you want to use 0.4.8 or higher, please add the following repository to your pom.xml</p>
        <pre xml:space="preserve">&lt;repositories&gt;
  &lt;repository&gt;
    &lt;id&gt;libvirt-org&lt;/id&gt;
    &lt;url&gt;http://libvirt.org/maven2&lt;/url&gt;
  &lt;/repository&gt;
&lt;/repositories&gt;</pre>
      </div>
    </div>
    <div id="footer">
      <p id="sponsor">
	    Sponsored by:<br /><a href="http://et.redhat.com/"><img src="et.png" alt="Project sponsored by Red Hat Emerging Technology" /></a></p>
    </div>
  </body>
</html>