/** * Constructs a <tt>Librarian</tt>. * * @param factory the factory * @param housekeeper the house keeper */ public Librarian(TargetFactory factory, Housekeeper housekeeper) { housekeeper.registerForCleanup(this); extension = '.' + factory.getNativeLibraryExtension(); }
/** * Adds the configuration from the specified URL. * * @param properties the configuration * @param url the URL, for error reporting. May be <tt>null</tt> */ protected void add(Properties properties, URL url) { Parser parser = createParser(platforms, url); parser.parse(properties, implementations); }
/** * Determines if this platform is an instance of the platform family name. * * @param name the platform family name * @return {@code true} if the platform is an instance of <tt>name</tt> */ public boolean isA(Name name) { return isA(this.name, name); }
@Override public boolean isTrue() { return matcher.matchesCurrentPlatform(forOs); }
/** * Prompts for a value from a set of values. * * @param prompt the prompt to display * @param values the valid values * @return the user input value; if the user input is empty (return key pressed) return defaultValue */ public String prompt(String prompt, String[] values) { return prompt(prompt, values, ""); }
/** * Prints a message to the console without a new line. * * @param message the message to print */ protected void print(String message) { console.print(message); }
private String createXDGDirectory(String menuName, String icon, String comment) { String menuDirectoryDescriptor = "[Desktop Entry]\n" + "Name=$Name\n" + "Comment=$Comment\n" + "Icon=$Icon\n" + "Type=Directory\n" + "Encoding=UTF-8"; menuDirectoryDescriptor = StringTool.replace(menuDirectoryDescriptor, "$Name", menuName); menuDirectoryDescriptor = StringTool.replace(menuDirectoryDescriptor, "$Comment", comment); menuDirectoryDescriptor = StringTool.replace(menuDirectoryDescriptor, "$Icon", icon); return menuDirectoryDescriptor; }
/** * Returns the platform for the specified operating system name and architecture. * * @param name the operating system name or symbolic name * @param arch the operating system architecture, or symbolic architecture * @return the corresponding platform */ public Platform getPlatform(String name, String arch) { return getPlatform(name, arch, null); }
/** * Gets the output of the given (console based) commandline * * @param aCommandLine to execute * @param dir the working directory for the execution * @return the result of the command */ public static String getExecOutput(String[] aCommandLine, String dir) { return getExecOutput(aCommandLine, dir, false); }
/** * Entry point for phase 1. This class tries to remove all files given in the Vector. * * @param temporaryFileNames * @throws IOException */ public static void invoke(List<String> temporaryFileNames) throws IOException { LibraryRemover self = new LibraryRemover(1); self.invoke1(temporaryFileNames); }
/** * Relaunches the installer with elevated rights. * * @return the status code returned by the launched process (by convention, 0 means a success). * @throws IOException if an I/O error occurs * @throws InterruptedException if the launch was interrupted */ public int relaunchWithElevatedRights() throws Exception { return relaunchWithElevatedRights(new String[0]); } public int relaunchWithElevatedRights(String ... args) throws Exception
/** * The run() method. Frees the library. Note that the thread is likely to get 'frozen' and the * application can only be treminated through a call to <code>System.exit()</code>. */ /*--------------------------------------------------------------------------*/ public void run() { client.freeLibrary(name); } }
public FileMerge(URL url, String destination, Map<OutputStream, List<String>> mergeContent) { this.mergeContent = mergeContent; this.sourceToCopy = FileUtil.convertUrlToFile(url); this.destination = destination; }
/** * Escapes all white Space Characters * * @param aPathString * @return */ public static String replaceSpacesWithMinus(String aPathString) { return replaceSpaces(aPathString, "-"); }
public static void loadConfiguration() throws IOException { if (OVERRIDE) { loadConfiguration(LOGGING_CONFIGURATION, null); } }
/** * Determines if the OS model matches the current platform. * * @param model the OS model * @return {@code true} if they match */ public boolean matchesCurrentPlatform(OsModel model) { return match(platform, model); }
/** * Creates a platform specific implementation of a class, for the current platform. * * @param clazz the class to create a platform specific instance of * @return the instance for the specified platform * @throws Exception for any error */ @Override public <T> T create(Class<T> clazz) throws Exception { return create(clazz, platform); }
/** * Constructs a {@code FileQueueFactory}. * * @param platform the current platform * @param librarian the librarian */ public FileQueueFactory(Platform platform, Librarian librarian) { supportsQueue = platform.isA(Platform.Name.WINDOWS); this.librarian = librarian; }
/** * Returns the platform given the operating system name, architecture and version. * * @param name the operating system name or symbolic name * @param arch the operating system architecture, or symbolic architecture * @param version the operating system version. May be {@code null} * @return the corresponding platform */ public Platform getPlatform(String name, String arch, String version) { return getPlatform(name, arch, version, null); }