Skip to content

Commit

Permalink
Merge pull request #29 from mathieucarbou/improvements
Browse files Browse the repository at this point in the history
oss management is working too if jars are here
  • Loading branch information
mathieucarbou authored Sep 28, 2017
2 parents 5ad8da7 + 22ad105 commit b7e32c3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
41 changes: 23 additions & 18 deletions src/main/java/org/terracotta/tinypounder/TinyPounderMainUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
});

Expand Down Expand Up @@ -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);
}
});
Expand All @@ -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);
}
});
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
});

Expand All @@ -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");
Expand All @@ -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);
}
});

Expand Down Expand Up @@ -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);
}
}
});
Expand Down Expand Up @@ -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);
}
});

Expand All @@ -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);
}
});

Expand Down Expand Up @@ -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);
}
});

Expand All @@ -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);
}
});
Expand All @@ -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);
}
});
Expand All @@ -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);
}
});
Expand Down

0 comments on commit b7e32c3

Please sign in to comment.