/** * Reads the system property: tribe.backup.folder.path * This property can set the backups folder location. The location where we are going to store all the backups. * The default value is .../<tag>/backups/ * * @return the full path of the backups folder. */ public static File getBackupsFolder() { final File defaultFolder = new File(SystemInstance.get().getBase().getDirectory(), "backups"); return new File(System.getProperty("tribe.backup.folder.path", defaultFolder.getAbsolutePath())); }
private static URL select(Enumeration<URL> enumeration) { if (enumeration == null) return null; ArrayList<URL> urls = Collections.list(enumeration); if (urls.size() == 0) return null; if (urls.size() == 1) return urls.get(0); // Sort so that the URL closest to openejb.base is first Collections.sort(urls, new UrlComparator(SystemInstance.get().getBase().getDirectory())); return urls.get(0); }
public static File fromName(final String filename) { File file = new File(filename); try { if (!file.isAbsolute()) { file = SystemInstance.get().getBase().getFile(filename, false); } } catch (final IOException e) { // shouldn't happen with validate set to false above return file; } return file; }
public static File cacheFile(final String path) { final File cacheDir = new File(SystemInstance.get().getBase().getDirectory(), cache()); if (!cacheDir.exists() && !cacheDir.mkdirs()) { throw new RuntimeException("Failed to create the directory: " + cacheDir); } return new File(cacheDir, path); }
private List<File> list() { final List<File> files = new ArrayList<File>(); { // list all the files associated with hot deploy locations final FileUtils base = SystemInstance.get().getBase(); for (final Deployments deployment : deployments) { DeploymentsResolver.loadFrom(deployment, base, files); } } return files; }
public static File cacheFile(final String path) { final String cache = cache(); if (new File(cache).isAbsolute()) { return new File(cache, path); } return new File(SystemInstance.get().getBase().getDirectory(), cache + File.separator + path); }
private List<File> list() { final List<File> files = new ArrayList<File>(); { // list all the files associated with hot deploy locations final FileUtils base = SystemInstance.get().getBase(); for (final Deployments deployment : deployments) { DeploymentsResolver.loadFrom(deployment, base, files); } } return files; }
public void configure(BasicDataSource dataSource) { System.setProperty("derby.system.home", SystemInstance.get().getBase().getDirectory().getAbsolutePath()); }
private static URL select(final Enumeration<URL> enumeration) { if (enumeration == null) { return null; } final ArrayList<URL> urls = Collections.list(enumeration); if (urls.size() == 0) { return null; } if (urls.size() == 1) { return urls.get(0); } // Sort so that the URL closest to openejb.base is first Collections.sort(urls, new UrlComparator(SystemInstance.get().getBase().getDirectory())); return urls.get(0); }
private static URL select(final Enumeration<URL> enumeration) { if (enumeration == null) { return null; } final ArrayList<URL> urls = Collections.list(enumeration); if (urls.size() == 0) { return null; } if (urls.size() == 1) { return urls.get(0); } // Sort so that the URL closest to openejb.base is first Collections.sort(urls, new UrlComparator(SystemInstance.get().getBase().getDirectory())); return urls.get(0); }
File outputDirectory() { final File workDirectory = new File(SystemInstance.get().getBase().getDirectory(), "work"); return Files.mkdirs(new File(System.getProperty("tribe.governance.configuration.dump.directory", workDirectory.getAbsolutePath()))); }
public ArrayList<File> getModulesFromClassPath(final List<File> declaredApps, final ClassLoader classLoader) { final FileUtils base = SystemInstance.get().getBase(); final List<URL> classpathAppsUrls = new ArrayList<URL>(); DeploymentsResolver.loadFromClasspath(base, classpathAppsUrls, classLoader); final ArrayList<File> jarFiles = new ArrayList<File>(); for (final URL path : classpathAppsUrls) { final File file = URLs.toFile(path); if (declaredApps != null && declaredApps.contains(file)) { continue; } jarFiles.add(file); } return jarFiles; }
private static File tmpDir() throws IOException { File dir = UrlCache.cacheDir; if (null == dir) { dir = SystemInstance.get().getBase().getDirectory("tmp", true); } return dir; }
private File fromName(final String filename) { File file = new File(simpleValue(filename)); try { if (!file.isAbsolute()) { file = SystemInstance.get().getBase().getFile(filename, false); } } catch (final IOException e) { // shouldn't happen with validate set to false above return null; } return file; } }
public void init(Properties props) throws SystemException { if (props == null) { props = new Properties(); } String dir = props.getProperty(EnvProps.IM_PASSIVATOR_PATH_PREFIX); try { if (dir != null) { sessionDirectory = SystemInstance.get().getBase().getDirectory(dir); } else { sessionDirectory = new File(System.getProperty("java.io.tmpdir", File.separator + "tmp")); } logger.info("Using directory " + sessionDirectory + " for stateful session passivation"); } catch (java.io.IOException e) { throw new SystemException(getClass().getName() + ".init(): can't use directory prefix " + dir + ":" + e, e); } }
public void init(Properties props) throws SystemException { if (props == null) { props = new Properties(); } String dir = props.getProperty(EnvProps.IM_PASSIVATOR_PATH_PREFIX); try { if (dir != null) { sessionDirectory = SystemInstance.get().getBase().getDirectory(dir); } else { sessionDirectory = new File(System.getProperty("java.io.tmpdir", File.separator + "tmp")); } logger.info("Using directory " + sessionDirectory + " for stateful session passivation"); } catch (java.io.IOException e) { throw new SystemException(getClass().getName() + ".init(): can't use directory prefix " + dir + ":" + e, e); } }
private static File doFindFile(final String filename, final String msgSuffix, final boolean warnOnExist) { File file = new File(filename); if (file.isAbsolute()) { if (warnOnExist && file.exists()) { LOGGER.warning(ContainerCodes.KEY_MAKER_ABSOLUTE, "keymaker.key.absolute" + msgSuffix, filename); } } else { final File base = SystemInstance.get().getBase().getDirectory(); file = new File(base, filename); if (warnOnExist && file.exists()) { LOGGER.warning(ContainerCodes.KEY_MAKER_RELATIVE, "keymaker.key.relative" + msgSuffix, filename, base); } } return file; }
public boolean isValidated(String jarFile) { try { File jar = SystemInstance.get().getBase().getFile(jarFile); long lastModified = jar.lastModified(); long lastValidated = getLastValidated(jar); return (lastValidated > lastModified); } catch (Exception e) { return false; } }
@Override public String updatedUrl(final String dataSourceUrl) { System.setProperty("derby.system.home" , SystemInstance.get().getProperty("derby.system.home", SystemInstance.get().getBase().getDirectory().getAbsolutePath())); return dataSourceUrl; }
@Override public String updatedUrl(final String dataSourceUrl) { JavaSecurityManagers.setSystemProperty("derby.system.home" , SystemInstance.get().getProperty("derby.system.home", SystemInstance.get().getBase().getDirectory().getAbsolutePath())); return dataSourceUrl; }