use of org.apache.geode.management.DependenciesNotFoundException in project geode by apache.
the class CommandService method createLocalCommandService.
/* ************** Methods to be implemented by sub-classes END ************ */
/* **************************** factory methods *************************** */
/**
* Returns a newly created or existing instance of the
* <code>CommandService<code> associated with the
* specified <code>Cache</code>.
*
* @param cache Underlying <code>Cache</code> instance to be used to create a Command Service.
* @throws CommandServiceException If command service could not be initialized.
*/
public static CommandService createLocalCommandService(Cache cache) throws CommandServiceException {
if (cache == null || cache.isClosed()) {
throw new CacheClosedException("Can not create command service as cache doesn't exist or cache is closed.");
}
if (localCommandService == null || !localCommandService.isUsable()) {
String nonExistingDependency = CliUtil.cliDependenciesExist(false);
if (nonExistingDependency != null) {
throw new DependenciesNotFoundException(LocalizedStrings.CommandServiceManager_COULD_NOT_FIND__0__LIB_NEEDED_FOR_CLI_GFSH.toLocalizedString(new Object[] { nonExistingDependency }));
}
localCommandService = new MemberCommandService(cache);
}
return localCommandService;
}
Aggregations