protected void addFilter(String name, Filter filter, boolean init, boolean overwrite) { Filter existing = getFilter(name); if (existing == null || overwrite) { if (filter instanceof Nameable) { ((Nameable) filter).setName(name); } if (init) { initFilter(filter); } this.filters.put(name, filter); } }
protected void createNewInstance(Map<String, Object> objects, String name, String value) { Object currentInstance = objects.get(name); if (currentInstance != null) { log.info("An instance with name '{}' already exists. " + "Redefining this object as a new instance of type {}", name, value); } Object instance;//name with no property, assume right hand side of equals sign is the class name: try { instance = ClassUtils.newInstance(value); if (instance instanceof Nameable) { ((Nameable) instance).setName(name); } } catch (Exception e) { String msg = "Unable to instantiate class [" + value + "] for object named '" + name + "'. " + "Please ensure you've specified the fully qualified class name correctly."; throw new ConfigurationException(msg, e); } objects.put(name, instance); }
private Collection<Realm> getRealms(Map<String, ?> instances) { //realms and realm factory might have been created - pull them out first so we can //initialize the securityManager: List<Realm> realms = new ArrayList<Realm>(); //iterate over the map entries to pull out the realm factory(s): for (Map.Entry<String, ?> entry : instances.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); if (value instanceof RealmFactory) { addToRealms(realms, (RealmFactory) value); } else if (value instanceof Realm) { Realm realm = (Realm) value; //set the name if null: String existingName = realm.getName(); if (existingName == null || existingName.startsWith(realm.getClass().getName())) { if (realm instanceof Nameable) { ((Nameable) realm).setName(name); log.debug("Applied name '{}' to Nameable realm instance {}", name, realm); } else { log.info("Realm does not implement the {} interface. Configured name will not be applied.", Nameable.class.getName()); } } realms.add(realm); } } return realms; }
applyGlobalPropertiesIfNecessary(filter); if (filter instanceof Nameable) { ((Nameable) filter).setName(name);
private Collection<Realm> getRealms(Map<String, ?> instances) { //realms and realm factory might have been created - pull them out first so we can //initialize the securityManager: List<Realm> realms = new ArrayList<Realm>(); //iterate over the map entries to pull out the realm factory(s): for (Map.Entry<String, ?> entry : instances.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); if (value instanceof RealmFactory) { addToRealms(realms, (RealmFactory) value); } else if (value instanceof Realm) { Realm realm = (Realm) value; //set the name if null: String existingName = realm.getName(); if (existingName == null || existingName.startsWith(realm.getClass().getName())) { if (realm instanceof Nameable) { ((Nameable) realm).setName(name); log.debug("Applied name '{}' to Nameable realm instance {}", name, realm); } else { log.info("Realm does not implement the {} interface. Configured name will not be applied.", Nameable.class.getName()); } } realms.add(realm); } } return realms; }
protected void createNewInstance(Map<String, Object> objects, String name, String value) { Object currentInstance = objects.get(name); if (currentInstance != null) { log.info("An instance with name '{}' already exists. " + "Redefining this object as a new instance of type []", name, value); } Object instance;//name with no property, assume right hand side of equals sign is the class name: try { instance = ClassUtils.newInstance(value); if (instance instanceof Nameable) { ((Nameable) instance).setName(name); } } catch (Exception e) { String msg = "Unable to instantiate class [" + value + "] for object named '" + name + "'. " + "Please ensure you've specified the fully qualified class name correctly."; throw new ConfigurationException(msg, e); } objects.put(name, instance); }
protected void createNewInstance(Map<String, Object> objects, String name, String value) { Object currentInstance = objects.get(name); if (currentInstance != null) { log.info("An instance with name '{}' already exists. " + "Redefining this object as a new instance of type {}", name, value); } Object instance;//name with no property, assume right hand side of equals sign is the class name: try { instance = ClassUtils.newInstance(value); if (instance instanceof Nameable) { ((Nameable) instance).setName(name); } } catch (Exception e) { String msg = "Unable to instantiate class [" + value + "] for object named '" + name + "'. " + "Please ensure you've specified the fully qualified class name correctly."; throw new ConfigurationException(msg, e); } objects.put(name, instance); }
private Collection<Realm> getRealms(Map<String, ?> instances) { //realms and realm factory might have been created - pull them out first so we can //initialize the securityManager: List<Realm> realms = new ArrayList<Realm>(); //iterate over the map entries to pull out the realm factory(s): for (Map.Entry<String, ?> entry : instances.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); if (value instanceof RealmFactory) { addToRealms(realms, (RealmFactory) value); } else if (value instanceof Realm) { Realm realm = (Realm) value; //set the name if null: String existingName = realm.getName(); if (existingName == null || existingName.startsWith(realm.getClass().getName())) { if (realm instanceof Nameable) { ((Nameable) realm).setName(name); log.debug("Applied name '{}' to Nameable realm instance {}", name, realm); } else { log.info("Realm does not implement the {} interface. Configured name will not be applied.", Nameable.class.getName()); } } realms.add(realm); } } return realms; }
applyGlobalPropertiesIfNecessary(filter); if (filter instanceof Nameable) { ((Nameable) filter).setName(name);