From 22ad1052c294e2bc5a10a812eb78d29c88e3e99f Mon Sep 17 00:00:00 2001 From: Mathieu Carbou Date: Thu, 28 Sep 2017 13:43:49 +0200 Subject: [PATCH] oss management is working too if jars are here --- .../CacheManagerBusinessReflectionImpl.java | 9 +++- .../tinypounder/TinyPounderMainUI.java | 41 +++++++++++-------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/terracotta/tinypounder/CacheManagerBusinessReflectionImpl.java b/src/main/java/org/terracotta/tinypounder/CacheManagerBusinessReflectionImpl.java index 49413a7..164de22 100644 --- a/src/main/java/org/terracotta/tinypounder/CacheManagerBusinessReflectionImpl.java +++ b/src/main/java/org/terracotta/tinypounder/CacheManagerBusinessReflectionImpl.java @@ -239,11 +239,16 @@ public void initializeCacheManager(String terracottaServerUrl, String cmName, St cacheManagerPersistenceConfiguration = null; } Object cacheManager; + Object defaultManagementRegistryConfiguration; + try { + defaultManagementRegistryConfiguration = constructDefaultManagementRegistryConfiguration(cmName); + } catch (Exception e) { + defaultManagementRegistryConfiguration = null; + } if (kitAwareClassLoaderDelegator.isEEKit()) { - Object defaultManagementRegistryConfiguration = constructDefaultManagementRegistryConfiguration(cmName); cacheManager = constructCacheManagerBuilder(clusteringServiceConfigurationBuilder, cacheManagerPersistenceConfiguration, defaultManagementRegistryConfiguration); } else { - cacheManager = constructCacheManagerBuilder(clusteringServiceConfigurationBuilder, cacheManagerPersistenceConfiguration, null); + cacheManager = constructCacheManagerBuilder(clusteringServiceConfigurationBuilder, cacheManagerPersistenceConfiguration, defaultManagementRegistryConfiguration); } ehCacheManagerClass = loadClass("org.ehcache.core.EhcacheManager"); Method initMethod = ehCacheManagerClass.getMethod("init"); diff --git a/src/main/java/org/terracotta/tinypounder/TinyPounderMainUI.java b/src/main/java/org/terracotta/tinypounder/TinyPounderMainUI.java index ae96760..3abe81b 100644 --- a/src/main/java/org/terracotta/tinypounder/TinyPounderMainUI.java +++ b/src/main/java/org/terracotta/tinypounder/TinyPounderMainUI.java @@ -273,9 +273,9 @@ private void addVoltronCommandsControls() { serverControls = new GridLayout(); serverControls.setWidth(50, Unit.PERCENTAGE); voltronControlLayout.addComponentsAndExpand(serverControls); - + HorizontalLayout row1 = new HorizontalLayout(); - + Button clusterStartBtn = new Button(); clusterStartBtn.setCaption("Start all servers"); clusterStartBtn.addStyleName("align-bottom"); @@ -325,9 +325,9 @@ private void addVoltronCommandsControls() { row1.addComponents(clusterNameTF, clusterConfigBtn, clusterReConfigBtn, clusterBackupBtn, clusterDumpBtn, clusterStopBtn); } - + voltronControlLayout.addComponentsAndExpand(row1); - + consoles = new TabSheet(); mainConsole = addConsole("Main", "main"); voltronControlLayout.addComponentsAndExpand(consoles); @@ -558,7 +558,7 @@ private void addVoltronConfigControls() { displayWarningNotification("Folder deleted with success"); changeTrashButtonStatus(baseLocation.getValue()); } catch (IOException e) { - displayErrorNotification("Could not delete the folder", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Could not delete the folder", e); } } else { displayErrorNotification("Could not delete the folder", "Either folder does not exist or does not have logs/ nor data/ in it"); @@ -1113,7 +1113,7 @@ private void addCacheControls() { cacheNameField.clear(); displayWarningNotification("Cache added with success !"); } catch (RuntimeException e) { - displayErrorNotification("Cache could not be added !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Cache could not be added !", e); } }); @@ -1145,7 +1145,7 @@ private void addCacheControls() { refreshCacheStuff(listDataProvider); displayWarningNotification("Cache removed with success !"); } catch (RuntimeException e) { - displayErrorNotification("Cache could not be removed !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Cache could not be removed !", e); refreshCacheStuff(listDataProvider); } }); @@ -1158,7 +1158,7 @@ private void addCacheControls() { refreshCacheStuff(listDataProvider); displayWarningNotification("Cache destroyed with success !"); } catch (Exception e) { - displayErrorNotification("Cache could not be destroyed !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Cache could not be destroyed !", e); refreshCacheStuff(listDataProvider); } }); @@ -1189,6 +1189,11 @@ private void displayWarningNotification(String caption) { notification.show(Page.getCurrent()); } + private void displayErrorNotification(String caption, Throwable e) { + e.printStackTrace(); + displayErrorNotification(caption, ExceptionUtils.getRootCauseMessage(e)); + } + private void displayErrorNotification(String caption, String message) { Notification notification = new Notification(caption, message, @@ -1293,7 +1298,7 @@ private void addCacheManagerControls() { cacheManagerConfigTextArea.setValue(cacheManagerBusiness.retrieveHumanReadableConfiguration()); refreshCacheManagerControls(); } catch (Exception e) { - displayErrorNotification("CacheManager could not be initialized!", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("CacheManager could not be initialized!", e); } }); @@ -1304,7 +1309,7 @@ private void addCacheManagerControls() { refreshCacheControls(); refreshCacheManagerControls(); } catch (Exception e) { - displayErrorNotification("CacheManager could not be closed!", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("CacheManager could not be closed!", e); } }); Button destroyCacheManager = new Button("Destroy CacheManager"); @@ -1315,7 +1320,7 @@ private void addCacheManagerControls() { refreshCacheManagerControls(); displayWarningNotification("CacheManager destroyed with success !"); } catch (Exception e) { - displayErrorNotification("CacheManager could not be destroyed!", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("CacheManager could not be destroyed!", e); } }); @@ -1385,7 +1390,7 @@ private void addKitControls() { if (e.getCause() instanceof NoSuchFileException) { displayErrorNotification("Kit path could not update !", "Make sure the path points to a kit !"); } else { - displayErrorNotification("Kit path could not update !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Kit path could not update !", e); } } }); @@ -1428,7 +1433,7 @@ private void addDatasetManagerControls() { datasetManagerBusiness.initializeDatasetManager(!clusteredCheckBox.getValue() ? null : terracottaUrlField.getValue()); refreshDatasetManagerControls(); } catch (Exception e) { - displayErrorNotification("DatasetManager could not be initialized!", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("DatasetManager could not be initialized!", e); } }); @@ -1439,7 +1444,7 @@ private void addDatasetManagerControls() { refreshDatasetControls(); refreshDatasetManagerControls(); } catch (Exception e) { - displayErrorNotification("DatasetManager could not be closed!", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("DatasetManager could not be closed!", e); } }); @@ -1519,7 +1524,7 @@ private void addDatasetControls() { datasetNameField.clear(); displayWarningNotification("Dataset added with success !"); } catch (RuntimeException e) { - displayErrorNotification("Dataset could not be added !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Dataset could not be added !", e); } }); @@ -1534,7 +1539,7 @@ private void addDatasetControls() { refreshDatasetStuff(listDataProvider); displayWarningNotification("Dataset instance " + datasetInstanceName + " created with success !"); } catch (Exception e) { - displayErrorNotification("Dataset instance could not be created !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Dataset instance could not be created !", e); refreshDatasetStuff(listDataProvider); } }); @@ -1547,7 +1552,7 @@ private void addDatasetControls() { refreshDatasetStuff(listDataProvider); displayWarningNotification("Dataset destroyed with success !"); } catch (Exception e) { - displayErrorNotification("Dataset could not be destroyed !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Dataset could not be destroyed !", e); refreshDatasetStuff(listDataProvider); } }); @@ -1570,7 +1575,7 @@ private void addDatasetControls() { refreshDatasetStuff(listDataProvider); displayWarningNotification("Dataset instance closed with success !"); } catch (Exception e) { - displayErrorNotification("Dataset instance could not be closed !", ExceptionUtils.getRootCauseMessage(e)); + displayErrorNotification("Dataset instance could not be closed !", e); refreshDatasetStuff(listDataProvider); } });