/** * * This is a convenience method that calls find(File, String, boolean) * with the last parameter set to "false" (does not match directories). * * @see #find(File, String, boolean) * */ public static File find(File contextRoot, String fileName) { return find(contextRoot, fileName, false); }
public static String[] split(String s) { return split(s, " "); }
public static void copyDirectory(File source, File destination) throws IOException { copyDirectory(source, destination, null); }
protected Class createImplementationClass(Element xml, Environment env) { String className = XmlUtils.getElementText(xml, DescriptorConstants.JAVA_CAPABILITY_QNAME); // // null return value necessary to support default/required capability // implementations for some vendors // if (className == null) return null; return ReflectUtils.getClass(className, env.getClassLoader()); }
/** * * This is a convenience method that invokes newInstance(Class) with a Class * object representing the given type. * * @see #getClass(String, ClassLoader) * @see #newInstance(Class) * */ public static Object newInstance(String className) { return newInstance(getClass(className)); }
/** * * This method calls getClass(Class, ClassLoader) with this class' * ClassLoader. * * @param className * The name of the class to load. * * @return The Class representing the given class name. A RuntimeException * is thrown if the class is not found. * * @see #exists(String) * */ public static Class getClass(String className) { if (_helper != null) { Class clazz = _helper.getClass(className); if (clazz != null) return clazz; } return getClass(className, _DEFAULT_CLASS_LOADER); }
/** * * @param type * * @return The unqualified (local) name of the class/interface. If the type * is an array, the [] characters will be appended. * */ public static String getShortName(Class type) { if (type.isArray()) { Class base = getClassFromArrayClass(type); String name = getShortName(base); return name + "[]"; } return getShortName(type.getName()); }
/** * * Removes the given value from the collection of values associated with * the given key. If removing the value results in the key having no * more entries associated with it, the key itself is removed. * * @param map * @param key * @param value * */ private void removeItem(MultiMap map, Object key, Object value) { Collection all = (Collection)map.get(key); all.remove(value); if (all.isEmpty()) map.remove(key); }
public synchronized final Iterator getChangeApprovers(QName property) { Collection approvers = (Collection)_approversByQName.get(property); return approvers.iterator(); }
/** * * Executes the timer's task whether the timer is scheduled or not. The * implementation first tries to cancel the timer, then executes the * task directly (via TimerTask.run()). * */ public final void executeNow() { cancel(); _task.run(); }
public Serializer create() { return (Serializer)ReflectUtils.newInstance(getSerializerClass()); }
/** * * This is a convenience method that calls remove(File, boolean) with * the second parameter set to "false" (doesn't prune empty directories). * * @see #remove(File, boolean) * */ public static void remove(File file) throws IOException { remove(file, false); }
public Date getTerminationTime() { return _terminationTimer.getScheduledTime(); }
public static void copyFile(File source, File destination) throws IOException { // // if the destination is a dir, what we really want to do is create // a file with the same name in that dir // if (destination.isDirectory()) destination = new File(destination, source.getName()); FileInputStream input = new FileInputStream(source); copyFile(input, destination); }
/** * * This is a convenience method that invokes newInstance(Class) with a Class * object loaded by the given ClassLoader * * @see #getClass(String, ClassLoader) * @see #newInstance(Class) * */ public static Object newInstance(String className, ClassLoader classLoader) { return newInstance(getClass(className, classLoader)); }
public ListIterator iterator() { String[] nodes = StringUtils.split(_topicPath.getLocalPart(), "/"); return new ConcretePathIterator(_topicSpace, nodes); }
public synchronized final Iterator getChangeListeners(QName property) { Collection listeners = (Collection)_listenersByQName.get(property); return listeners.iterator(); }
public void shutdown() throws SoapFault { // // make sure we stop the timer so we don't get a concurrency error // by trying to terminate ourselves in the midst of termination // _terminationTimer.cancel(); super.shutdown(); }
public Persistence newInstance() { Persistence persistence = (Persistence)ReflectUtils.newInstance(getPersistenceClass()); persistence.setPersistenceLocation(getPersistenceLocation()); return persistence; }
public synchronized final Iterator getReadListeners(QName property) { Collection readers = (Collection)_readersByQName.get(property); return readers.iterator(); }