From 6f7b9301dd9983ff9f761e6503cebbdb2d45e750 Mon Sep 17 00:00:00 2001
Message-Id:
<6f7b9301dd9983ff9f761e6503cebbdb2d45e750.1350037981.git.cbley(a)av-test.de>
In-Reply-To: <cover.1350037981.git.cbley(a)av-test.de>
References:
<2DA6F4A3691599408358374D182280F9141CF6(a)xmb-rcd-x04.cisco.com> <cover.1350037981.git.cbley(a)av-test.de>
From: cbley(a)av-test.de (Claudio Bley)
Date: Wed, 10 Oct 2012 11:23:14 +0200
Subject: [PATCH 14/15] Remove functions not intended to be used by libvirt bindings.
To: libvir-list(a)redhat.com
Organization: AV-Test GmbH, Germany
This affects virSecretGetConnect, virNetworkGetConnect and
virDomainGetConnect.
The libvirt API documentation has this to say about those functions:
WARNING: When writing libvirt bindings in other languages, do not use this
function. Instead, store the connection and the ... object together.
---
src/main/java/org/libvirt/Connect.java | 39 -----------------------
src/main/java/org/libvirt/jna/Libvirt.java | 3 --
src/test/java/org/libvirt/TestJavaBindings.java | 3 --
3 files changed, 45 deletions(-)
diff --git a/src/main/java/org/libvirt/Connect.java
b/src/main/java/org/libvirt/Connect.java
index a775ce1..b3e29be 100644
--- a/src/main/java/org/libvirt/Connect.java
+++ b/src/main/java/org/libvirt/Connect.java
@@ -31,45 +31,6 @@ import com.sun.jna.ptr.LongByReference;
public class Connect {
/**
- * Creates a new connection object from the domain. If all you want is the
- * existing domain's connection, use the getConnection method directly. Thie
- * method returns a new connection.
- *
- * @param domain
- * @return a new connection
- */
- public static Connect connectionForDomain(Domain domain) {
- ConnectionPointer conn = Libvirt.INSTANCE.virDomainGetConnect(domain.VDP);
- return new Connect(conn);
- }
-
- /**
- * Creates a new connection object from the network. If all you want is the
- * existing network's connection, use the getConnection method directly.
- * Thie method returns a new connection.
- *
- * @param network
- * @return a new connection
- */
- public static Connect connectionForNetwork(Network network) {
- ConnectionPointer conn = Libvirt.INSTANCE.virNetworkGetConnect(network.VNP);
- return new Connect(conn);
- }
-
- /**
- * Creates a new connection object from the network. If all you want is the
- * existing network's connection, use the getConnection method directly.
- * Thie method returns a new connection.
- *
- * @param secret
- * @return a new connection
- */
- public static Connect connectionForSecret(Secret secret) {
- ConnectionPointer conn = Libvirt.INSTANCE.virSecretGetConnect(secret.VSP);
- return new Connect(conn);
- }
-
- /**
* Get the version of a connection.
*
* @see <a
diff --git a/src/main/java/org/libvirt/jna/Libvirt.java
b/src/main/java/org/libvirt/jna/Libvirt.java
index 5d2a291..87979cd 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -192,7 +192,6 @@ public interface Libvirt extends Library {
int virDomainDetachDeviceFlags(DomainPointer virDomainPtr, String deviceXML, int
flags);
int virDomainFree(DomainPointer virDomainPtr);
int virDomainGetAutostart(DomainPointer virDomainPtr, IntByReference value);
- ConnectionPointer virDomainGetConnect(DomainPointer virDomainPtr);
int virDomainGetBlockInfo(DomainPointer virDomainPtr, String path, virDomainBlockInfo
info, int flags);
int virDomainGetID(DomainPointer virDomainPtr);
int virDomainGetInfo(DomainPointer virDomainPtr, virDomainInfo vInfo);
@@ -242,7 +241,6 @@ public interface Libvirt extends Library {
int virDomainUndefine(DomainPointer virDomainPtr);
// Network functions
- ConnectionPointer virNetworkGetConnect(NetworkPointer virnetworkPtr);
int virNetworkCreate(NetworkPointer virConnectPtr);
NetworkPointer virNetworkCreateXML(ConnectionPointer virConnectPtr, String xmlDesc);
NetworkPointer virNetworkDefineXML(ConnectionPointer virConnectPtr, String xmlDesc);
@@ -341,7 +339,6 @@ public interface Libvirt extends Library {
int virInterfaceUndefine(InterfacePointer virDevicePointer);
// Secret Methods
- ConnectionPointer virSecretGetConnect(SecretPointer virSecretPtr);
int virSecretFree(SecretPointer virSecretPtr);
SecretPointer virSecretDefineXML(ConnectionPointer virConnectPtr, String xml, int
flags);
int virSecretGetUUID(SecretPointer virSecretPtr, byte[] uuidString);
diff --git a/src/test/java/org/libvirt/TestJavaBindings.java
b/src/test/java/org/libvirt/TestJavaBindings.java
index 55ca64b..bba4cdb 100644
--- a/src/test/java/org/libvirt/TestJavaBindings.java
+++ b/src/test/java/org/libvirt/TestJavaBindings.java
@@ -158,9 +158,6 @@ public final class TestJavaBindings extends TestCase {
dom.setSchedulerParameters(pars);
dom.getSchedulerParameters() ;
-
- assertNotNull(Connect.connectionForDomain(dom));
- assertTrue(Connect.connectionForDomain(dom) != dom.getConnect());
}
public void testInterfaces() throws Exception {
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern