Return-Path: X-Original-To: apmail-cloudstack-issues-archive@www.apache.org Delivered-To: apmail-cloudstack-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0D4021868A for ; Mon, 26 Oct 2015 21:12:30 +0000 (UTC) Received: (qmail 68928 invoked by uid 500); 26 Oct 2015 21:12:28 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 68582 invoked by uid 500); 26 Oct 2015 21:12:28 -0000 Mailing-List: contact issues-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list issues@cloudstack.apache.org Received: (qmail 68316 invoked by uid 500); 26 Oct 2015 21:12:28 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 68272 invoked by uid 99); 26 Oct 2015 21:12:28 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Oct 2015 21:12:28 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id F1F662C1F63 for ; Mon, 26 Oct 2015 21:12:27 +0000 (UTC) Date: Mon, 26 Oct 2015 21:12:27 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-8832) Update Nuage VSP plugin to work with Nuage VSP release 3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-8832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14975083#comment-14975083 ] ASF GitHub Bot commented on CLOUDSTACK-8832: -------------------------------------------- Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/801#discussion_r43053698 --- Diff: plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/NuageVspPluginClientLoader.java --- @@ -19,28 +19,101 @@ package net.nuage.vsp.acs; +import net.nuage.vsp.acs.client.NuageVspApiClient; +import net.nuage.vsp.acs.client.NuageVspElementClient; +import net.nuage.vsp.acs.client.NuageVspGuruClient; +import net.nuage.vsp.acs.client.NuageVspManagerClient; +import net.nuage.vsp.acs.client.NuageVspSyncClient; +import org.apache.log4j.Logger; + +import javax.naming.ConfigurationException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; public class NuageVspPluginClientLoader { - private static NuageVspPluginClientLoader nuageVspPluginClientClassloader; - private ClassLoader loader = null; + private ClassLoader _loader = null; + private static final Logger s_logger = Logger.getLogger(NuageVspPluginClientLoader.class); + + private NuageVspApiClient _nuageVspApiClient; + private NuageVspElementClient _nuageVspElementClient; + private NuageVspGuruClient _nuageVspGuruClient; + private NuageVspManagerClient _nuageVspManagerClient; + private NuageVspSyncClient _nuageVspSyncClient; + + private static final String NUAGE_PLUGIN_CLIENT_JAR_FILE = "/usr/share/nuagevsp/lib/nuage-vsp-acs-client.jar"; + private static final String NUAGE_VSP_API_CLIENT_IMPL = "net.nuage.vsp.acs.client.impl.NuageVspApiClientImpl"; + private static final String NUAGE_VSP_SYNC_CLIENT_IMPL = "net.nuage.vsp.acs.client.impl.NuageVspSyncClientImpl"; + private static final String NUAGE_VSP_ELEMENT_CLIENT_IMPL = "net.nuage.vsp.acs.client.impl.NuageVspElementClientImpl"; + private static final String NUAGE_VSP_GURU_CLIENT_IMPL = "net.nuage.vsp.acs.client.impl.NuageVspGuruClientImpl"; + private static final String NUAGE_VSP_MANAGER_CLIENT_IMPL = "net.nuage.vsp.acs.client.impl.NuageVspManagerClientImpl"; private NuageVspPluginClientLoader(String nuagePluginClientJarLocation) { try { - loader = URLClassLoader.newInstance(new URL[] {new URL("jar:file:" + nuagePluginClientJarLocation + "!/")}, + _loader = URLClassLoader.newInstance(new URL[] {new URL("jar:file:" + nuagePluginClientJarLocation + "!/")}, getClass().getClassLoader()); } catch (MalformedURLException e) { - e.printStackTrace(); + throw new IllegalArgumentException(e); } } - public static ClassLoader getClassLoader(String nuagePluginClientJarLocation) { - if (nuageVspPluginClientClassloader == null) { - nuageVspPluginClientClassloader = new NuageVspPluginClientLoader(nuagePluginClientJarLocation); + public static NuageVspPluginClientLoader getClientLoader(String relativePath, String[] cmsUserInfo, int numRetries, int retryInterval, + String nuageVspCmsId) throws ConfigurationException { + NuageVspPluginClientLoader nuageVspPluginClientClassloader = new NuageVspPluginClientLoader(NUAGE_PLUGIN_CLIENT_JAR_FILE); + nuageVspPluginClientClassloader.loadClasses(relativePath, cmsUserInfo, numRetries, retryInterval, nuageVspCmsId); + return nuageVspPluginClientClassloader; + } + + private void loadClasses(String relativePath, String[] cmsUserInfo, int numRetries, int retryInterval, String nuageVspCmsId) throws ConfigurationException { + try { + Class nuageVspApiClientClass = Class.forName(NUAGE_VSP_API_CLIENT_IMPL, true, _loader); + Class nuageVspSyncClientClass = Class.forName(NUAGE_VSP_SYNC_CLIENT_IMPL, true, _loader); + Class nuageVspGuruClientClass = Class.forName(NUAGE_VSP_GURU_CLIENT_IMPL, true, _loader); + Class nuageVspElementClientClass = Class.forName(NUAGE_VSP_ELEMENT_CLIENT_IMPL, true, _loader); + Class nuageVspManagerClientClass = Class.forName(NUAGE_VSP_MANAGER_CLIENT_IMPL, true, _loader); + + //Instantiate the instances + _nuageVspApiClient = (NuageVspApiClient)nuageVspApiClientClass.newInstance(); + _nuageVspApiClient.setNuageVspHost(relativePath, cmsUserInfo, numRetries, retryInterval, nuageVspCmsId); + _nuageVspSyncClient = (NuageVspSyncClient)nuageVspSyncClientClass.newInstance(); + _nuageVspSyncClient.setNuageVspApiClient(_nuageVspApiClient); + _nuageVspGuruClient = (NuageVspGuruClient)nuageVspGuruClientClass.newInstance(); + _nuageVspGuruClient.setNuageVspApiClient(_nuageVspApiClient); + _nuageVspElementClient = (NuageVspElementClient)nuageVspElementClientClass.newInstance(); + _nuageVspElementClient.setNuageVspApiClient(_nuageVspApiClient); + _nuageVspManagerClient = (NuageVspManagerClient)nuageVspManagerClientClass.newInstance(); + _nuageVspManagerClient.setNuageVspApiClient(_nuageVspApiClient); + } catch (ClassNotFoundException cnfe) { + s_logger.error("Error while loading classes of Nuage VSP client", cnfe); + throw new ConfigurationException("Error while loading classes of Nuage VSP client"); + } catch (InstantiationException ie) { + s_logger.error("Error while initializing classes of Nuage VSP client", ie); + throw new ConfigurationException("Error while initializing classes of Nuage VSP client"); + } catch (IllegalAccessException iae) { + s_logger.error("Error while accessing classes of Nuage VSP client", iae); + throw new ConfigurationException("Error while accessing classes of Nuage VSP client"); --- End diff -- Pass ``iae`` into the ``ConfigurationException`` constructor to understand the cause of the exception. > Update Nuage VSP plugin to work with Nuage VSP release 3.2 > ---------------------------------------------------------- > > Key: CLOUDSTACK-8832 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8832 > Project: CloudStack > Issue Type: Improvement > Security Level: Public(Anyone can view this level - this is the default.) > Components: Management Server > Affects Versions: 4.6.0 > Reporter: Nick Livens > Assignee: Nick Livens > Attachments: nuageVspMarvinLogs.tar.gz > > > Nuage VSP 3.2 is being released, we want to bring the plugin up to date for this release -- This message was sent by Atlassian JIRA (v6.3.4#6332)