/** @see BrooklynServerPaths#getMgmtBaseDir(ManagementContext) */ public static String getMgmtBaseDir(ManagementContext mgmt) { return BrooklynServerPaths.getMgmtBaseDir(mgmt); } /** @see BrooklynServerPaths#getMgmtBaseDir(ManagementContext) */
/** @see BrooklynServerPaths#getMgmtBaseDir(ManagementContext) */ public static String getMgmtBaseDir(StringConfigMap brooklynProperties) { return BrooklynServerPaths.getMgmtBaseDir(brooklynProperties); } /** @see BrooklynServerPaths#getMgmtBaseDir(ManagementContext) */
/** @see BrooklynServerPaths#getMgmtBaseDir(ManagementContext) */ public static String getMgmtBaseDir(Map<String,?> brooklynProperties) { return BrooklynServerPaths.getMgmtBaseDir(brooklynProperties); }
/** Computes the base dir where brooklyn should read and write configuration. * Defaults to <code>~/.brooklyn/</code>. * <p> * Also see other variants of this method if a {@link ManagementContext} is not yet available. */ public static String getMgmtBaseDir(ManagementContext mgmt) { return getMgmtBaseDir(mgmt.getConfig()); }
public static File getBrooklynWebTmpDir(ManagementContext mgmt) { String brooklynMgmtBaseDir = getMgmtBaseDir(mgmt); File webappTempDir = new File(Os.mergePaths(brooklynMgmtBaseDir, "planes", mgmt.getManagementNodeId(), "jetty")); try { FileUtils.forceMkdir(webappTempDir); Os.deleteOnExitRecursivelyAndEmptyParentsUpTo(webappTempDir, new File(brooklynMgmtBaseDir)); return webappTempDir; } catch (Exception e) { Exceptions.propagateIfFatal(e); IllegalStateException e2 = new IllegalStateException("Cannot create working directory "+webappTempDir+" for embedded jetty server: "+e, e); log.warn(e2.getMessage()+" (rethrowing)"); throw e2; } }
protected static String resolveAgainstBaseDir(StringConfigMap brooklynProperties, String path) { if (!Os.isAbsolutish(path)) path = Os.mergePaths(getMgmtBaseDir(brooklynProperties), path); return Os.tidyPath(path); }
@Test(groups="Integration") // integration only because non-reusable OSGi takes ~200ms public void testOsgiPathDefault() { mgmt = LocalManagementContextForTests.builder(true).enableOsgiNonReusable().build(); String path = BrooklynServerPaths.getOsgiCacheDir(mgmt).getAbsolutePath(); Assert.assertTrue(path.startsWith(BrooklynServerPaths.getMgmtBaseDir(mgmt)), path); Assert.assertTrue(path.contains(mgmt.getManagementNodeId()), path); assertExistsThenIsCleaned(path); }
public static File getOsgiCacheDir(ManagementContext mgmt) { StringConfigMap brooklynProperties = mgmt.getConfig(); String cacheDir = brooklynProperties.getConfig(BrooklynServerConfig.OSGI_CACHE_DIR); // note dir should be different for each instance if starting multiple instances // hence default including management node ID cacheDir = TemplateProcessor.processTemplateContents(cacheDir, mgmt, MutableMap.of(BrooklynServerConfig.MGMT_BASE_DIR.getName(), getMgmtBaseDir(mgmt), BrooklynServerConfig.MANAGEMENT_NODE_ID_PROPERTY, mgmt.getManagementNodeId(), Os.TmpDirFinder.BROOKLYN_OS_TMPDIR_PROPERTY, Os.tmp())); cacheDir = resolveAgainstBaseDir(mgmt.getConfig(), cacheDir); return new File(cacheDir); }
ImmutableList.of("chmod 755 create-certs.sh", "./create-certs.sh " + sensors().get(ADDRESS))); String localCertsDir = Os.mergePaths(BrooklynServerPaths.getMgmtBaseDir(getManagementContext()), "docker-certs"); Os.mkdirs(new File(localCertsDir)); certPath = Os.mergePaths(localCertsDir, getId() + "-cert.pem");