You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by ad...@apache.org on 2010/05/26 20:34:49 UTC
svn commit: r948527 [23/38] - in /incubator/shiro:
branches/shiro-root-1.0.x/ branches/shiro-root-1.0.x/all/
branches/shiro-root-1.0.x/core/src/main/java/org/apache/shiro/
branches/shiro-root-1.0.x/core/src/main/java/org/apache/shiro/aop/
branches/shir...
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/ReflectionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/ReflectionBuilder.java?rev=948527&r1=948526&r2=948527&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/ReflectionBuilder.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/ReflectionBuilder.java Wed May 26 18:34:28 2010
@@ -1,379 +1,379 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.shiro.config;
-
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.shiro.codec.Base64;
-import org.apache.shiro.codec.Hex;
-import org.apache.shiro.util.ClassUtils;
-import org.apache.shiro.util.CollectionUtils;
-import org.apache.shiro.util.Nameable;
-import org.apache.shiro.util.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.beans.PropertyDescriptor;
-import java.util.*;
-
-
-/**
- * Object builder that uses reflection and Apache Commons BeanUtils to build objects given a
- * map of "property values". Typically these come from the Shiro INI configuration and are used
- * to construct or modify the SecurityManager, its dependencies, and web-based security filters.
- *
- * @author Les Hazlewood
- * @author Jeremy Haile
- * @since 0.9
- */
-public class ReflectionBuilder {
-
- //TODO - complete JavaDoc
-
- private static final Logger log = LoggerFactory.getLogger(ReflectionBuilder.class);
-
- private static final String OBJECT_REFERENCE_BEGIN_TOKEN = "$";
- private static final String ESCAPED_OBJECT_REFERENCE_BEGIN_TOKEN = "\\$";
- private static final String GLOBAL_PROPERTY_PREFIX = "shiro";
- private static final char MAP_KEY_VALUE_DELIMITER = ':';
- private static final String HEX_BEGIN_TOKEN = "0x";
-
- private Map<String, ?> objects;
-
- public ReflectionBuilder() {
- this.objects = new LinkedHashMap<String, Object>();
- }
-
- public ReflectionBuilder(Map<String, ?> defaults) {
- this.objects = CollectionUtils.isEmpty(defaults) ? new LinkedHashMap<String, Object>() : defaults;
- }
-
- public Map<String, ?> getObjects() {
- return objects;
- }
-
- public void setObjects(Map<String, ?> objects) {
- this.objects = CollectionUtils.isEmpty(objects) ? new LinkedHashMap<String, Object>() : objects;
- }
-
- public Object getBean(String id) {
- return objects.get(id);
- }
-
- @SuppressWarnings({"unchecked"})
- public <T> T getBean(String id, Class<T> requiredType) {
- if (requiredType == null) {
- throw new NullPointerException("requiredType argument cannot be null.");
- }
- Object bean = getBean(id);
- if (bean == null) {
- return null;
- }
- if (!requiredType.isAssignableFrom(bean.getClass())) {
- throw new IllegalStateException("Bean with id [" + id + "] is not of the required type [" +
- requiredType.getName() + "].");
- }
- return (T) bean;
- }
-
- @SuppressWarnings({"unchecked"})
- public Map<String, ?> buildObjects(Map<String, String> kvPairs) {
- if (kvPairs != null && !kvPairs.isEmpty()) {
-
- // Separate key value pairs into object declarations and property assignment
- // so that all objects can be created up front
-
- //https://issues.apache.org/jira/browse/SHIRO-85 - need to use LinkedHashMaps here:
- Map<String, String> instanceMap = new LinkedHashMap<String, String>();
- Map<String, String> propertyMap = new LinkedHashMap<String, String>();
-
- for (Map.Entry<String, String> entry : kvPairs.entrySet()) {
- if (entry.getKey().indexOf('.') < 0 || entry.getKey().endsWith(".class")) {
- instanceMap.put(entry.getKey(), entry.getValue());
- } else {
- propertyMap.put(entry.getKey(), entry.getValue());
- }
- }
-
- // Create all instances
- for (Map.Entry<String, String> entry : instanceMap.entrySet()) {
- createNewInstance((Map<String, Object>) objects, entry.getKey(), entry.getValue());
- }
-
- // Set all properties
- for (Map.Entry<String, String> entry : propertyMap.entrySet()) {
- applyProperty(entry.getKey(), entry.getValue(), objects);
- }
- }
-
- return objects;
- }
-
- 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 applyProperty(String key, String value, Map objects) {
-
- int index = key.indexOf('.');
-
- if (index >= 0) {
- String name = key.substring(0, index);
- String property = key.substring(index + 1, key.length());
-
- if (GLOBAL_PROPERTY_PREFIX.equalsIgnoreCase(name)) {
- applyGlobalProperty(objects, property, value);
- } else {
- applySingleProperty(objects, name, property, value);
- }
-
- } else {
- throw new IllegalArgumentException("All property keys must contain a '.' character. " +
- "(e.g. myBean.property = value) These should already be separated out by buildObjects().");
- }
- }
-
- protected void applyGlobalProperty(Map objects, String property, String value) {
- for (Object instance : objects.values()) {
- try {
- PropertyDescriptor pd = PropertyUtils.getPropertyDescriptor(instance, property);
- if (pd != null) {
- applyProperty(instance, property, value);
- }
- } catch (Exception e) {
- String msg = "Error retrieving property descriptor for instance " +
- "of type [" + instance.getClass().getName() + "] " +
- "while setting property [" + property + "]";
- throw new ConfigurationException(msg, e);
- }
- }
- }
-
- protected void applySingleProperty(Map objects, String name, String property, String value) {
- Object instance = objects.get(name);
- if (property.equals("class")) {
- throw new IllegalArgumentException("Property keys should not contain 'class' properties since these " +
- "should already be separated out by buildObjects().");
-
- } else if (instance == null) {
- String msg = "Configuration error. Specified object [" + name + "] with property [" +
- property + "] without first defining that object's class. Please first " +
- "specify the class property first, e.g. myObject = fully_qualified_class_name " +
- "and then define additional properties.";
- throw new IllegalArgumentException(msg);
-
- } else {
- applyProperty(instance, property, value);
- }
- }
-
- protected boolean isReference(String value) {
- return value != null && value.startsWith(OBJECT_REFERENCE_BEGIN_TOKEN);
- }
-
- protected String getId(String referenceToken) {
- return referenceToken.substring(OBJECT_REFERENCE_BEGIN_TOKEN.length());
- }
-
- protected Object getReferencedObject(String id) {
- Object o = objects != null && !objects.isEmpty() ? objects.get(id) : null;
- if (o == null) {
- String msg = "The object with id [" + id + "] has not yet been defined and therefore cannot be " +
- "referenced. Please ensure objects are defined in the order in which they should be " +
- "created and made available for future reference.";
- throw new UnresolveableReferenceException(msg);
- }
- return o;
- }
-
- protected String unescapeIfNecessary(String value) {
- if (value != null && value.startsWith(ESCAPED_OBJECT_REFERENCE_BEGIN_TOKEN)) {
- return value.substring(ESCAPED_OBJECT_REFERENCE_BEGIN_TOKEN.length() - 1);
- }
- return value;
- }
-
- protected Object resolveReference(String reference) {
- String id = getId(reference);
- log.debug("Encountered object reference '{}'. Looking up object with id '{}'", reference, id);
- return getReferencedObject(id);
- }
-
- protected boolean isTypedProperty(Object object, String propertyName, Class clazz) {
- if (clazz == null) {
- throw new NullPointerException("type (class) argument cannot be null.");
- }
- try {
- PropertyDescriptor descriptor = PropertyUtils.getPropertyDescriptor(object, propertyName);
- if (descriptor == null) {
- String msg = "Property '" + propertyName + "' does not exist for object of " +
- "type " + object.getClass().getName() + ".";
- throw new ConfigurationException(msg);
- }
- Class propertyClazz = descriptor.getPropertyType();
- return clazz.isAssignableFrom(propertyClazz);
- } catch (ConfigurationException ce) {
- //let it propagate:
- throw ce;
- } catch (Exception e) {
- String msg = "Unable to determine if property [" + propertyName + "] represents a " + clazz.getName();
- throw new ConfigurationException(msg, e);
- }
- }
-
- protected Set<?> toSet(String sValue) {
- String[] tokens = StringUtils.split(sValue);
- if (tokens == null || tokens.length <= 0) {
- return null;
- }
- Set<String> setTokens = new LinkedHashSet<String>(Arrays.asList(tokens));
-
- //now convert into correct values and/or references:
- Set<Object> values = new LinkedHashSet<Object>(setTokens.size());
- for (String token : setTokens) {
- Object value = resolveValue(token);
- values.add(value);
- }
- return values;
- }
-
- protected Map<?, ?> toMap(String sValue) {
- String[] tokens = StringUtils.split(sValue, StringUtils.DEFAULT_DELIMITER_CHAR,
- StringUtils.DEFAULT_QUOTE_CHAR, StringUtils.DEFAULT_QUOTE_CHAR, true, true);
- if (tokens == null || tokens.length <= 0) {
- return null;
- }
-
- Map<String, String> mapTokens = new LinkedHashMap<String, String>(tokens.length);
- for (String token : tokens) {
- String[] kvPair = StringUtils.split(token, MAP_KEY_VALUE_DELIMITER);
- if (kvPair == null || kvPair.length != 2) {
- String msg = "Map property value [" + sValue + "] contained key-value pair token [" +
- token + "] that does not properly split to a single key and pair. This must be the " +
- "case for all map entries.";
- throw new ConfigurationException(msg);
- }
- mapTokens.put(kvPair[0], kvPair[1]);
- }
-
- //now convert into correct values and/or references:
- Map<Object, Object> map = new LinkedHashMap<Object, Object>(mapTokens.size());
- for (Map.Entry<String, String> entry : mapTokens.entrySet()) {
- Object key = resolveValue(entry.getKey());
- Object value = resolveValue(entry.getValue());
- map.put(key, value);
- }
- return map;
- }
-
-
- protected List<?> toList(String sValue) {
- String[] tokens = StringUtils.split(sValue);
- if (tokens == null || tokens.length <= 0) {
- return null;
- }
-
- //now convert into correct values and/or references:
- List<Object> values = new ArrayList<Object>(tokens.length);
- for (String token : tokens) {
- Object value = resolveValue(token);
- values.add(value);
- }
- return values;
- }
-
- protected byte[] toBytes(String sValue) {
- if (sValue == null) {
- return null;
- }
- byte[] bytes;
- if (sValue.startsWith(HEX_BEGIN_TOKEN)) {
- String hex = sValue.substring(HEX_BEGIN_TOKEN.length());
- bytes = Hex.decode(hex);
- } else {
- //assume base64 encoded:
- bytes = Base64.decode(sValue);
- }
- return bytes;
- }
-
- protected Object resolveValue(String stringValue) {
- Object value;
- if (isReference(stringValue)) {
- value = resolveReference(stringValue);
- } else {
- value = unescapeIfNecessary(stringValue);
- }
- return value;
- }
-
-
- protected void applyProperty(Object object, String propertyName, String stringValue) {
-
- Object value;
-
- if (isTypedProperty(object, propertyName, Set.class)) {
- value = toSet(stringValue);
- } else if (isTypedProperty(object, propertyName, Map.class)) {
- value = toMap(stringValue);
- } else if (isTypedProperty(object, propertyName, List.class) ||
- isTypedProperty(object, propertyName, Collection.class)) {
- value = toList(stringValue);
- } else if (isTypedProperty(object, propertyName, byte[].class)) {
- value = toBytes(stringValue);
- } else {
- value = resolveValue(stringValue);
- }
-
- try {
- if (log.isTraceEnabled()) {
- log.trace("Applying property [{}] value [{}] on object of type [{}]",
- new Object[]{propertyName, value, object.getClass().getName()});
- }
- BeanUtils.setProperty(object, propertyName, value);
- } catch (Exception e) {
- String msg = "Unable to set property '" + propertyName + "' with value [" + stringValue + "] on object " +
- "of type " + (object != null ? object.getClass().getName() : null) + ". If " +
- "'" + stringValue + "' is a reference to another (previously defined) object, prefix it with " +
- "'" + OBJECT_REFERENCE_BEGIN_TOKEN + "' to indicate that the referenced " +
- "object should be used as the actual value. " +
- "For example, " + OBJECT_REFERENCE_BEGIN_TOKEN + stringValue;
- throw new ConfigurationException(msg, e);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shiro.config;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.shiro.codec.Base64;
+import org.apache.shiro.codec.Hex;
+import org.apache.shiro.util.ClassUtils;
+import org.apache.shiro.util.CollectionUtils;
+import org.apache.shiro.util.Nameable;
+import org.apache.shiro.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.beans.PropertyDescriptor;
+import java.util.*;
+
+
+/**
+ * Object builder that uses reflection and Apache Commons BeanUtils to build objects given a
+ * map of "property values". Typically these come from the Shiro INI configuration and are used
+ * to construct or modify the SecurityManager, its dependencies, and web-based security filters.
+ *
+ * @author Les Hazlewood
+ * @author Jeremy Haile
+ * @since 0.9
+ */
+public class ReflectionBuilder {
+
+ //TODO - complete JavaDoc
+
+ private static final Logger log = LoggerFactory.getLogger(ReflectionBuilder.class);
+
+ private static final String OBJECT_REFERENCE_BEGIN_TOKEN = "$";
+ private static final String ESCAPED_OBJECT_REFERENCE_BEGIN_TOKEN = "\\$";
+ private static final String GLOBAL_PROPERTY_PREFIX = "shiro";
+ private static final char MAP_KEY_VALUE_DELIMITER = ':';
+ private static final String HEX_BEGIN_TOKEN = "0x";
+
+ private Map<String, ?> objects;
+
+ public ReflectionBuilder() {
+ this.objects = new LinkedHashMap<String, Object>();
+ }
+
+ public ReflectionBuilder(Map<String, ?> defaults) {
+ this.objects = CollectionUtils.isEmpty(defaults) ? new LinkedHashMap<String, Object>() : defaults;
+ }
+
+ public Map<String, ?> getObjects() {
+ return objects;
+ }
+
+ public void setObjects(Map<String, ?> objects) {
+ this.objects = CollectionUtils.isEmpty(objects) ? new LinkedHashMap<String, Object>() : objects;
+ }
+
+ public Object getBean(String id) {
+ return objects.get(id);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public <T> T getBean(String id, Class<T> requiredType) {
+ if (requiredType == null) {
+ throw new NullPointerException("requiredType argument cannot be null.");
+ }
+ Object bean = getBean(id);
+ if (bean == null) {
+ return null;
+ }
+ if (!requiredType.isAssignableFrom(bean.getClass())) {
+ throw new IllegalStateException("Bean with id [" + id + "] is not of the required type [" +
+ requiredType.getName() + "].");
+ }
+ return (T) bean;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public Map<String, ?> buildObjects(Map<String, String> kvPairs) {
+ if (kvPairs != null && !kvPairs.isEmpty()) {
+
+ // Separate key value pairs into object declarations and property assignment
+ // so that all objects can be created up front
+
+ //https://issues.apache.org/jira/browse/SHIRO-85 - need to use LinkedHashMaps here:
+ Map<String, String> instanceMap = new LinkedHashMap<String, String>();
+ Map<String, String> propertyMap = new LinkedHashMap<String, String>();
+
+ for (Map.Entry<String, String> entry : kvPairs.entrySet()) {
+ if (entry.getKey().indexOf('.') < 0 || entry.getKey().endsWith(".class")) {
+ instanceMap.put(entry.getKey(), entry.getValue());
+ } else {
+ propertyMap.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ // Create all instances
+ for (Map.Entry<String, String> entry : instanceMap.entrySet()) {
+ createNewInstance((Map<String, Object>) objects, entry.getKey(), entry.getValue());
+ }
+
+ // Set all properties
+ for (Map.Entry<String, String> entry : propertyMap.entrySet()) {
+ applyProperty(entry.getKey(), entry.getValue(), objects);
+ }
+ }
+
+ return objects;
+ }
+
+ 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 applyProperty(String key, String value, Map objects) {
+
+ int index = key.indexOf('.');
+
+ if (index >= 0) {
+ String name = key.substring(0, index);
+ String property = key.substring(index + 1, key.length());
+
+ if (GLOBAL_PROPERTY_PREFIX.equalsIgnoreCase(name)) {
+ applyGlobalProperty(objects, property, value);
+ } else {
+ applySingleProperty(objects, name, property, value);
+ }
+
+ } else {
+ throw new IllegalArgumentException("All property keys must contain a '.' character. " +
+ "(e.g. myBean.property = value) These should already be separated out by buildObjects().");
+ }
+ }
+
+ protected void applyGlobalProperty(Map objects, String property, String value) {
+ for (Object instance : objects.values()) {
+ try {
+ PropertyDescriptor pd = PropertyUtils.getPropertyDescriptor(instance, property);
+ if (pd != null) {
+ applyProperty(instance, property, value);
+ }
+ } catch (Exception e) {
+ String msg = "Error retrieving property descriptor for instance " +
+ "of type [" + instance.getClass().getName() + "] " +
+ "while setting property [" + property + "]";
+ throw new ConfigurationException(msg, e);
+ }
+ }
+ }
+
+ protected void applySingleProperty(Map objects, String name, String property, String value) {
+ Object instance = objects.get(name);
+ if (property.equals("class")) {
+ throw new IllegalArgumentException("Property keys should not contain 'class' properties since these " +
+ "should already be separated out by buildObjects().");
+
+ } else if (instance == null) {
+ String msg = "Configuration error. Specified object [" + name + "] with property [" +
+ property + "] without first defining that object's class. Please first " +
+ "specify the class property first, e.g. myObject = fully_qualified_class_name " +
+ "and then define additional properties.";
+ throw new IllegalArgumentException(msg);
+
+ } else {
+ applyProperty(instance, property, value);
+ }
+ }
+
+ protected boolean isReference(String value) {
+ return value != null && value.startsWith(OBJECT_REFERENCE_BEGIN_TOKEN);
+ }
+
+ protected String getId(String referenceToken) {
+ return referenceToken.substring(OBJECT_REFERENCE_BEGIN_TOKEN.length());
+ }
+
+ protected Object getReferencedObject(String id) {
+ Object o = objects != null && !objects.isEmpty() ? objects.get(id) : null;
+ if (o == null) {
+ String msg = "The object with id [" + id + "] has not yet been defined and therefore cannot be " +
+ "referenced. Please ensure objects are defined in the order in which they should be " +
+ "created and made available for future reference.";
+ throw new UnresolveableReferenceException(msg);
+ }
+ return o;
+ }
+
+ protected String unescapeIfNecessary(String value) {
+ if (value != null && value.startsWith(ESCAPED_OBJECT_REFERENCE_BEGIN_TOKEN)) {
+ return value.substring(ESCAPED_OBJECT_REFERENCE_BEGIN_TOKEN.length() - 1);
+ }
+ return value;
+ }
+
+ protected Object resolveReference(String reference) {
+ String id = getId(reference);
+ log.debug("Encountered object reference '{}'. Looking up object with id '{}'", reference, id);
+ return getReferencedObject(id);
+ }
+
+ protected boolean isTypedProperty(Object object, String propertyName, Class clazz) {
+ if (clazz == null) {
+ throw new NullPointerException("type (class) argument cannot be null.");
+ }
+ try {
+ PropertyDescriptor descriptor = PropertyUtils.getPropertyDescriptor(object, propertyName);
+ if (descriptor == null) {
+ String msg = "Property '" + propertyName + "' does not exist for object of " +
+ "type " + object.getClass().getName() + ".";
+ throw new ConfigurationException(msg);
+ }
+ Class propertyClazz = descriptor.getPropertyType();
+ return clazz.isAssignableFrom(propertyClazz);
+ } catch (ConfigurationException ce) {
+ //let it propagate:
+ throw ce;
+ } catch (Exception e) {
+ String msg = "Unable to determine if property [" + propertyName + "] represents a " + clazz.getName();
+ throw new ConfigurationException(msg, e);
+ }
+ }
+
+ protected Set<?> toSet(String sValue) {
+ String[] tokens = StringUtils.split(sValue);
+ if (tokens == null || tokens.length <= 0) {
+ return null;
+ }
+ Set<String> setTokens = new LinkedHashSet<String>(Arrays.asList(tokens));
+
+ //now convert into correct values and/or references:
+ Set<Object> values = new LinkedHashSet<Object>(setTokens.size());
+ for (String token : setTokens) {
+ Object value = resolveValue(token);
+ values.add(value);
+ }
+ return values;
+ }
+
+ protected Map<?, ?> toMap(String sValue) {
+ String[] tokens = StringUtils.split(sValue, StringUtils.DEFAULT_DELIMITER_CHAR,
+ StringUtils.DEFAULT_QUOTE_CHAR, StringUtils.DEFAULT_QUOTE_CHAR, true, true);
+ if (tokens == null || tokens.length <= 0) {
+ return null;
+ }
+
+ Map<String, String> mapTokens = new LinkedHashMap<String, String>(tokens.length);
+ for (String token : tokens) {
+ String[] kvPair = StringUtils.split(token, MAP_KEY_VALUE_DELIMITER);
+ if (kvPair == null || kvPair.length != 2) {
+ String msg = "Map property value [" + sValue + "] contained key-value pair token [" +
+ token + "] that does not properly split to a single key and pair. This must be the " +
+ "case for all map entries.";
+ throw new ConfigurationException(msg);
+ }
+ mapTokens.put(kvPair[0], kvPair[1]);
+ }
+
+ //now convert into correct values and/or references:
+ Map<Object, Object> map = new LinkedHashMap<Object, Object>(mapTokens.size());
+ for (Map.Entry<String, String> entry : mapTokens.entrySet()) {
+ Object key = resolveValue(entry.getKey());
+ Object value = resolveValue(entry.getValue());
+ map.put(key, value);
+ }
+ return map;
+ }
+
+
+ protected List<?> toList(String sValue) {
+ String[] tokens = StringUtils.split(sValue);
+ if (tokens == null || tokens.length <= 0) {
+ return null;
+ }
+
+ //now convert into correct values and/or references:
+ List<Object> values = new ArrayList<Object>(tokens.length);
+ for (String token : tokens) {
+ Object value = resolveValue(token);
+ values.add(value);
+ }
+ return values;
+ }
+
+ protected byte[] toBytes(String sValue) {
+ if (sValue == null) {
+ return null;
+ }
+ byte[] bytes;
+ if (sValue.startsWith(HEX_BEGIN_TOKEN)) {
+ String hex = sValue.substring(HEX_BEGIN_TOKEN.length());
+ bytes = Hex.decode(hex);
+ } else {
+ //assume base64 encoded:
+ bytes = Base64.decode(sValue);
+ }
+ return bytes;
+ }
+
+ protected Object resolveValue(String stringValue) {
+ Object value;
+ if (isReference(stringValue)) {
+ value = resolveReference(stringValue);
+ } else {
+ value = unescapeIfNecessary(stringValue);
+ }
+ return value;
+ }
+
+
+ protected void applyProperty(Object object, String propertyName, String stringValue) {
+
+ Object value;
+
+ if (isTypedProperty(object, propertyName, Set.class)) {
+ value = toSet(stringValue);
+ } else if (isTypedProperty(object, propertyName, Map.class)) {
+ value = toMap(stringValue);
+ } else if (isTypedProperty(object, propertyName, List.class) ||
+ isTypedProperty(object, propertyName, Collection.class)) {
+ value = toList(stringValue);
+ } else if (isTypedProperty(object, propertyName, byte[].class)) {
+ value = toBytes(stringValue);
+ } else {
+ value = resolveValue(stringValue);
+ }
+
+ try {
+ if (log.isTraceEnabled()) {
+ log.trace("Applying property [{}] value [{}] on object of type [{}]",
+ new Object[]{propertyName, value, object.getClass().getName()});
+ }
+ BeanUtils.setProperty(object, propertyName, value);
+ } catch (Exception e) {
+ String msg = "Unable to set property '" + propertyName + "' with value [" + stringValue + "] on object " +
+ "of type " + (object != null ? object.getClass().getName() : null) + ". If " +
+ "'" + stringValue + "' is a reference to another (previously defined) object, prefix it with " +
+ "'" + OBJECT_REFERENCE_BEGIN_TOKEN + "' to indicate that the referenced " +
+ "object should be used as the actual value. " +
+ "For example, " + OBJECT_REFERENCE_BEGIN_TOKEN + stringValue;
+ throw new ConfigurationException(msg, e);
+ }
+ }
+
+}
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/ReflectionBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/UnresolveableReferenceException.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/UnresolveableReferenceException.java?rev=948527&r1=948526&r2=948527&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/UnresolveableReferenceException.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/UnresolveableReferenceException.java Wed May 26 18:34:28 2010
@@ -1,64 +1,64 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.shiro.config;
-
-/**
- * Exception thrown when a reference to an object is made, but that object cannot be found. This is most likely
- * thrown due to a configuration line that references an object that hasn't been defined yet.
- *
- * @author Les Hazlewood
- * @since 0.9 RC2
- */
-public class UnresolveableReferenceException extends ConfigurationException {
-
- /**
- * Creates a new UnresolveableReferenceException.
- */
- public UnresolveableReferenceException() {
- super();
- }
-
- /**
- * Constructs a new UnresolveableReferenceException.
- *
- * @param message the reason for the exception
- */
- public UnresolveableReferenceException(String message) {
- super(message);
- }
-
- /**
- * Constructs a new UnresolveableReferenceException.
- *
- * @param cause the underlying Throwable that caused this exception to be thrown.
- */
- public UnresolveableReferenceException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Constructs a new UnresolveableReferenceException.
- *
- * @param message the reason for the exception
- * @param cause the underlying Throwable that caused this exception to be thrown.
- */
- public UnresolveableReferenceException(String message, Throwable cause) {
- super(message, cause);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shiro.config;
+
+/**
+ * Exception thrown when a reference to an object is made, but that object cannot be found. This is most likely
+ * thrown due to a configuration line that references an object that hasn't been defined yet.
+ *
+ * @author Les Hazlewood
+ * @since 0.9 RC2
+ */
+public class UnresolveableReferenceException extends ConfigurationException {
+
+ /**
+ * Creates a new UnresolveableReferenceException.
+ */
+ public UnresolveableReferenceException() {
+ super();
+ }
+
+ /**
+ * Constructs a new UnresolveableReferenceException.
+ *
+ * @param message the reason for the exception
+ */
+ public UnresolveableReferenceException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new UnresolveableReferenceException.
+ *
+ * @param cause the underlying Throwable that caused this exception to be thrown.
+ */
+ public UnresolveableReferenceException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new UnresolveableReferenceException.
+ *
+ * @param message the reason for the exception
+ * @param cause the underlying Throwable that caused this exception to be thrown.
+ */
+ public UnresolveableReferenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/UnresolveableReferenceException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/AbstractSymmetricCipherService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/AesCipherService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/BlowfishCipherService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/CipherService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/CryptoException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/DefaultBlockCipherService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/JcaCipherService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/OperationMode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/PaddingScheme.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/AbstractHash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/Hash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/Md2Hash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/Md5Hash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/Sha1Hash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/Sha256Hash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/Sha384Hash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/Sha512Hash.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/hash/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/crypto/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/DefaultSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/ResourceUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/SerializationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/Serializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/XmlSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiCallback.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiCallback.java?rev=948527&r1=948526&r2=948527&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiCallback.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiCallback.java Wed May 26 18:34:28 2010
@@ -1,55 +1,55 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.shiro.jndi;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-/**
- * Callback interface to be implemented by classes that need to perform an
- * operation (such as a lookup) in a JNDI context. This callback approach
- * is valuable in simplifying error handling, which is performed by the
- * JndiTemplate class. This is a similar to JdbcTemplate's approach.
- *
- * <p>Note that there is hardly any need to implement this callback
- * interface, as JndiTemplate provides all usual JNDI operations via
- * convenience methods.
- *
- * <p>Note that this interface is an exact copy of the Spring Framework's identically named interface from
- * their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require a full dependency on the
- * Spring framework, nor does Spring make available only its JNDI classes in a small jar, or we would have used that.
- * Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and authors have remained in tact.
- *
- * @author Rod Johnson
- * @see JndiTemplate
- */
-public interface JndiCallback {
-
- /**
- * Do something with the given JNDI context.
- * Implementations don't need to worry about error handling
- * or cleanup, as the JndiTemplate class will handle this.
- *
- * @param ctx the current JNDI context
- * @return a result object, or <code>null</code>
- * @throws NamingException if thrown by JNDI methods
- */
- Object doInContext(Context ctx) throws NamingException;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shiro.jndi;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+/**
+ * Callback interface to be implemented by classes that need to perform an
+ * operation (such as a lookup) in a JNDI context. This callback approach
+ * is valuable in simplifying error handling, which is performed by the
+ * JndiTemplate class. This is a similar to JdbcTemplate's approach.
+ *
+ * <p>Note that there is hardly any need to implement this callback
+ * interface, as JndiTemplate provides all usual JNDI operations via
+ * convenience methods.
+ *
+ * <p>Note that this interface is an exact copy of the Spring Framework's identically named interface from
+ * their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require a full dependency on the
+ * Spring framework, nor does Spring make available only its JNDI classes in a small jar, or we would have used that.
+ * Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and authors have remained in tact.
+ *
+ * @author Rod Johnson
+ * @see JndiTemplate
+ */
+public interface JndiCallback {
+
+ /**
+ * Do something with the given JNDI context.
+ * Implementations don't need to worry about error handling
+ * or cleanup, as the JndiTemplate class will handle this.
+ *
+ * @param ctx the current JNDI context
+ * @return a result object, or <code>null</code>
+ * @throws NamingException if thrown by JNDI methods
+ */
+ Object doInContext(Context ctx) throws NamingException;
+
+}
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiCallback.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java?rev=948527&r1=948526&r2=948527&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java Wed May 26 18:34:28 2010
@@ -1,180 +1,180 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.shiro.jndi;
-
-import java.util.Properties;
-import javax.naming.NamingException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Convenient superclass for JNDI accessors, providing "jndiTemplate"
- * and "jndiEnvironment" bean properties.
- *
- * <p>Note that this implementation is an almost exact combined copy of the Spring Framework's 'JndiAccessor' and
- * 'JndiLocatorSupport' classes from their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require
- * a full dependency on the Spring framework, nor does Spring make available only its JNDI classes in a small jar, or
- * we would have used that. Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and
- * authors have remained in tact.
- *
- * @author Juergen Hoeller
- * @see #setJndiTemplate
- * @see #setJndiEnvironment
- * @see #setResourceRef
- * @since 1.1
- */
-public class JndiLocator {
-
- /**
- * Private class log.
- */
- private static final Logger log = LoggerFactory.getLogger(JndiLocator.class);
-
- /**
- * JNDI prefix used in a J2EE container
- */
- public static final String CONTAINER_PREFIX = "java:comp/env/";
-
- private boolean resourceRef = false;
-
- private JndiTemplate jndiTemplate = new JndiTemplate();
-
-
- /**
- * Set the JNDI template to use for JNDI lookups.
- * <p>You can also specify JNDI environment settings via "jndiEnvironment".
- *
- * @see #setJndiEnvironment
- */
- public void setJndiTemplate(JndiTemplate jndiTemplate) {
- this.jndiTemplate = (jndiTemplate != null ? jndiTemplate : new JndiTemplate());
- }
-
- /**
- * Return the JNDI template to use for JNDI lookups.
- */
- public JndiTemplate getJndiTemplate() {
- return this.jndiTemplate;
- }
-
- /**
- * Set the JNDI environment to use for JNDI lookups.
- * <p>Creates a JndiTemplate with the given environment settings.
- *
- * @see #setJndiTemplate
- */
- public void setJndiEnvironment(Properties jndiEnvironment) {
- this.jndiTemplate = new JndiTemplate(jndiEnvironment);
- }
-
- /**
- * Return the JNDI environment to use for JNDI lookups.
- */
- public Properties getJndiEnvironment() {
- return this.jndiTemplate.getEnvironment();
- }
-
- /**
- * Set whether the lookup occurs in a J2EE container, i.e. if the prefix
- * "java:comp/env/" needs to be added if the JNDI name doesn't already
- * contain it. Default is "false".
- * <p>Note: Will only get applied if no other scheme (e.g. "java:") is given.
- */
- public void setResourceRef(boolean resourceRef) {
- this.resourceRef = resourceRef;
- }
-
- /**
- * Return whether the lookup occurs in a J2EE container.
- */
- public boolean isResourceRef() {
- return this.resourceRef;
- }
-
-
- /**
- * Perform an actual JNDI lookup for the given name via the JndiTemplate.
- * <p>If the name doesn't begin with "java:comp/env/", this prefix is added
- * if "resourceRef" is set to "true".
- *
- * @param jndiName the JNDI name to look up
- * @return the obtained object
- * @throws javax.naming.NamingException if the JNDI lookup failed
- * @see #setResourceRef
- */
- protected Object lookup(String jndiName) throws NamingException {
- return lookup(jndiName, null);
- }
-
- /**
- * Perform an actual JNDI lookup for the given name via the JndiTemplate.
- * <p>If the name doesn't begin with "java:comp/env/", this prefix is added
- * if "resourceRef" is set to "true".
- *
- * @param jndiName the JNDI name to look up
- * @param requiredType the required type of the object
- * @return the obtained object
- * @throws NamingException if the JNDI lookup failed
- * @see #setResourceRef
- */
- protected Object lookup(String jndiName, Class requiredType) throws NamingException {
- if (jndiName == null) {
- throw new IllegalArgumentException("jndiName argument must not be null");
- }
- String convertedName = convertJndiName(jndiName);
- Object jndiObject;
- try {
- jndiObject = getJndiTemplate().lookup(convertedName, requiredType);
- }
- catch (NamingException ex) {
- if (!convertedName.equals(jndiName)) {
- // Try fallback to originally specified name...
- if (log.isDebugEnabled()) {
- log.debug("Converted JNDI name [" + convertedName +
- "] not found - trying original name [" + jndiName + "]. " + ex);
- }
- jndiObject = getJndiTemplate().lookup(jndiName, requiredType);
- } else {
- throw ex;
- }
- }
- log.debug("Located object with JNDI name '{}'", convertedName);
- return jndiObject;
- }
-
- /**
- * Convert the given JNDI name into the actual JNDI name to use.
- * <p>The default implementation applies the "java:comp/env/" prefix if
- * "resourceRef" is "true" and no other scheme (e.g. "java:") is given.
- *
- * @param jndiName the original JNDI name
- * @return the JNDI name to use
- * @see #CONTAINER_PREFIX
- * @see #setResourceRef
- */
- protected String convertJndiName(String jndiName) {
- // Prepend container prefix if not already specified and no other scheme given.
- if (isResourceRef() && !jndiName.startsWith(CONTAINER_PREFIX) && jndiName.indexOf(':') == -1) {
- jndiName = CONTAINER_PREFIX + jndiName;
- }
- return jndiName;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shiro.jndi;
+
+import java.util.Properties;
+import javax.naming.NamingException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Convenient superclass for JNDI accessors, providing "jndiTemplate"
+ * and "jndiEnvironment" bean properties.
+ *
+ * <p>Note that this implementation is an almost exact combined copy of the Spring Framework's 'JndiAccessor' and
+ * 'JndiLocatorSupport' classes from their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require
+ * a full dependency on the Spring framework, nor does Spring make available only its JNDI classes in a small jar, or
+ * we would have used that. Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and
+ * authors have remained in tact.
+ *
+ * @author Juergen Hoeller
+ * @see #setJndiTemplate
+ * @see #setJndiEnvironment
+ * @see #setResourceRef
+ * @since 1.1
+ */
+public class JndiLocator {
+
+ /**
+ * Private class log.
+ */
+ private static final Logger log = LoggerFactory.getLogger(JndiLocator.class);
+
+ /**
+ * JNDI prefix used in a J2EE container
+ */
+ public static final String CONTAINER_PREFIX = "java:comp/env/";
+
+ private boolean resourceRef = false;
+
+ private JndiTemplate jndiTemplate = new JndiTemplate();
+
+
+ /**
+ * Set the JNDI template to use for JNDI lookups.
+ * <p>You can also specify JNDI environment settings via "jndiEnvironment".
+ *
+ * @see #setJndiEnvironment
+ */
+ public void setJndiTemplate(JndiTemplate jndiTemplate) {
+ this.jndiTemplate = (jndiTemplate != null ? jndiTemplate : new JndiTemplate());
+ }
+
+ /**
+ * Return the JNDI template to use for JNDI lookups.
+ */
+ public JndiTemplate getJndiTemplate() {
+ return this.jndiTemplate;
+ }
+
+ /**
+ * Set the JNDI environment to use for JNDI lookups.
+ * <p>Creates a JndiTemplate with the given environment settings.
+ *
+ * @see #setJndiTemplate
+ */
+ public void setJndiEnvironment(Properties jndiEnvironment) {
+ this.jndiTemplate = new JndiTemplate(jndiEnvironment);
+ }
+
+ /**
+ * Return the JNDI environment to use for JNDI lookups.
+ */
+ public Properties getJndiEnvironment() {
+ return this.jndiTemplate.getEnvironment();
+ }
+
+ /**
+ * Set whether the lookup occurs in a J2EE container, i.e. if the prefix
+ * "java:comp/env/" needs to be added if the JNDI name doesn't already
+ * contain it. Default is "false".
+ * <p>Note: Will only get applied if no other scheme (e.g. "java:") is given.
+ */
+ public void setResourceRef(boolean resourceRef) {
+ this.resourceRef = resourceRef;
+ }
+
+ /**
+ * Return whether the lookup occurs in a J2EE container.
+ */
+ public boolean isResourceRef() {
+ return this.resourceRef;
+ }
+
+
+ /**
+ * Perform an actual JNDI lookup for the given name via the JndiTemplate.
+ * <p>If the name doesn't begin with "java:comp/env/", this prefix is added
+ * if "resourceRef" is set to "true".
+ *
+ * @param jndiName the JNDI name to look up
+ * @return the obtained object
+ * @throws javax.naming.NamingException if the JNDI lookup failed
+ * @see #setResourceRef
+ */
+ protected Object lookup(String jndiName) throws NamingException {
+ return lookup(jndiName, null);
+ }
+
+ /**
+ * Perform an actual JNDI lookup for the given name via the JndiTemplate.
+ * <p>If the name doesn't begin with "java:comp/env/", this prefix is added
+ * if "resourceRef" is set to "true".
+ *
+ * @param jndiName the JNDI name to look up
+ * @param requiredType the required type of the object
+ * @return the obtained object
+ * @throws NamingException if the JNDI lookup failed
+ * @see #setResourceRef
+ */
+ protected Object lookup(String jndiName, Class requiredType) throws NamingException {
+ if (jndiName == null) {
+ throw new IllegalArgumentException("jndiName argument must not be null");
+ }
+ String convertedName = convertJndiName(jndiName);
+ Object jndiObject;
+ try {
+ jndiObject = getJndiTemplate().lookup(convertedName, requiredType);
+ }
+ catch (NamingException ex) {
+ if (!convertedName.equals(jndiName)) {
+ // Try fallback to originally specified name...
+ if (log.isDebugEnabled()) {
+ log.debug("Converted JNDI name [" + convertedName +
+ "] not found - trying original name [" + jndiName + "]. " + ex);
+ }
+ jndiObject = getJndiTemplate().lookup(jndiName, requiredType);
+ } else {
+ throw ex;
+ }
+ }
+ log.debug("Located object with JNDI name '{}'", convertedName);
+ return jndiObject;
+ }
+
+ /**
+ * Convert the given JNDI name into the actual JNDI name to use.
+ * <p>The default implementation applies the "java:comp/env/" prefix if
+ * "resourceRef" is "true" and no other scheme (e.g. "java:") is given.
+ *
+ * @param jndiName the original JNDI name
+ * @return the JNDI name to use
+ * @see #CONTAINER_PREFIX
+ * @see #setResourceRef
+ */
+ protected String convertJndiName(String jndiName) {
+ // Prepend container prefix if not already specified and no other scheme given.
+ if (isResourceRef() && !jndiName.startsWith(CONTAINER_PREFIX) && jndiName.indexOf(':') == -1) {
+ jndiName = CONTAINER_PREFIX + jndiName;
+ }
+ return jndiName;
+ }
+
+}
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java?rev=948527&r1=948526&r2=948527&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java Wed May 26 18:34:28 2010
@@ -1,226 +1,226 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.shiro.jndi;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Helper class that simplifies JNDI operations. It provides methods to lookup and
- * bind objects, and allows implementations of the {@link JndiCallback} interface
- * to perform any operation they like with a JNDI naming context provided.
- * <p/>
- * <p>Note that this implementation is an almost exact copy of the Spring Framework's identically named class from
- * their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require a full dependency on the
- * Spring framework, nor does Spring make available only its JNDI classes in a small jar, or we would have used that.
- * Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and authors have remained in tact.
- *
- * @author Rod Johnson
- * @author Juergen Hoeller
- * @see JndiCallback
- * @see #execute
- */
-public class JndiTemplate {
-
- private static final Logger log = LoggerFactory.getLogger(JndiTemplate.class);
-
- private Properties environment;
-
- /** Create a new JndiTemplate instance. */
- public JndiTemplate() {
- }
-
- /**
- * Create a new JndiTemplate instance, using the given environment.
- *
- * @param environment the Properties to initialize with
- */
- public JndiTemplate(Properties environment) {
- this.environment = environment;
- }
-
- /**
- * Set the environment for the JNDI InitialContext.
- *
- * @param environment the Properties to initialize with
- */
- public void setEnvironment(Properties environment) {
- this.environment = environment;
- }
-
- /**
- * Return the environment for the JNDI InitialContext, or <code>null</code> if none should be used.
- *
- * @return the environment for the JNDI InitialContext, or <code>null</code> if none should be used.
- */
- public Properties getEnvironment() {
- return this.environment;
- }
-
- /**
- * Execute the given JNDI context callback implementation.
- *
- * @param contextCallback JndiCallback implementation
- * @return a result object returned by the callback, or <code>null</code>
- * @throws NamingException thrown by the callback implementation
- * @see #createInitialContext
- */
- public Object execute(JndiCallback contextCallback) throws NamingException {
- Context ctx = createInitialContext();
- try {
- return contextCallback.doInContext(ctx);
- }
- finally {
- try {
- ctx.close();
- } catch (NamingException ex) {
- log.debug("Could not close JNDI InitialContext", ex);
- }
- }
- }
-
- /**
- * Create a new JNDI initial context. Invoked by {@link #execute}.
- * <p>The default implementation use this template's environment settings.
- * Can be subclassed for custom contexts, e.g. for testing.
- *
- * @return the initial Context instance
- * @throws NamingException in case of initialization errors
- */
- @SuppressWarnings({"unchecked"})
- protected Context createInitialContext() throws NamingException {
- Properties env = getEnvironment();
- Hashtable icEnv = null;
- if (env != null) {
- icEnv = new Hashtable(env.size());
- for (Enumeration en = env.propertyNames(); en.hasMoreElements();) {
- String key = (String) en.nextElement();
- icEnv.put(key, env.getProperty(key));
- }
- }
- return new InitialContext(icEnv);
- }
-
- /**
- * Look up the object with the given name in the current JNDI context.
- *
- * @param name the JNDI name of the object
- * @return object found (cannot be <code>null</code>; if a not so well-behaved
- * JNDI implementations returns null, a NamingException gets thrown)
- * @throws NamingException if there is no object with the given
- * name bound to JNDI
- */
- public Object lookup(final String name) throws NamingException {
- log.debug("Looking up JNDI object with name '{}'", name);
- return execute(new JndiCallback() {
- public Object doInContext(Context ctx) throws NamingException {
- Object located = ctx.lookup(name);
- if (located == null) {
- throw new NameNotFoundException(
- "JNDI object with [" + name + "] not found: JNDI implementation returned null");
- }
- return located;
- }
- });
- }
-
- /**
- * Look up the object with the given name in the current JNDI context.
- *
- * @param name the JNDI name of the object
- * @param requiredType type the JNDI object must match. Can be an interface or
- * superclass of the actual class, or <code>null</code> for any match. For example,
- * if the value is <code>Object.class</code>, this method will succeed whatever
- * the class of the returned instance.
- * @return object found (cannot be <code>null</code>; if a not so well-behaved
- * JNDI implementations returns null, a NamingException gets thrown)
- * @throws NamingException if there is no object with the given
- * name bound to JNDI
- */
- public Object lookup(String name, Class requiredType) throws NamingException {
- Object jndiObject = lookup(name);
- if (requiredType != null && !requiredType.isInstance(jndiObject)) {
- String msg = "Jndi object acquired under name '" + name + "' is of type [" +
- jndiObject.getClass().getName() + "] and not assignable to the required type [" +
- requiredType.getName() + "].";
- throw new NamingException(msg);
- }
- return jndiObject;
- }
-
- /**
- * Bind the given object to the current JNDI context, using the given name.
- *
- * @param name the JNDI name of the object
- * @param object the object to bind
- * @throws NamingException thrown by JNDI, mostly name already bound
- */
- public void bind(final String name, final Object object) throws NamingException {
- log.debug("Binding JNDI object with name '{}'", name);
- execute(new JndiCallback() {
- public Object doInContext(Context ctx) throws NamingException {
- ctx.bind(name, object);
- return null;
- }
- });
- }
-
- /**
- * Rebind the given object to the current JNDI context, using the given name.
- * Overwrites any existing binding.
- *
- * @param name the JNDI name of the object
- * @param object the object to rebind
- * @throws NamingException thrown by JNDI
- */
- public void rebind(final String name, final Object object) throws NamingException {
- log.debug("Rebinding JNDI object with name '{}'", name);
- execute(new JndiCallback() {
- public Object doInContext(Context ctx) throws NamingException {
- ctx.rebind(name, object);
- return null;
- }
- });
- }
-
- /**
- * Remove the binding for the given name from the current JNDI context.
- *
- * @param name the JNDI name of the object
- * @throws NamingException thrown by JNDI, mostly name not found
- */
- public void unbind(final String name) throws NamingException {
- log.debug("Unbinding JNDI object with name '{}'", name);
- execute(new JndiCallback() {
- public Object doInContext(Context ctx) throws NamingException {
- ctx.unbind(name);
- return null;
- }
- });
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shiro.jndi;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Helper class that simplifies JNDI operations. It provides methods to lookup and
+ * bind objects, and allows implementations of the {@link JndiCallback} interface
+ * to perform any operation they like with a JNDI naming context provided.
+ * <p/>
+ * <p>Note that this implementation is an almost exact copy of the Spring Framework's identically named class from
+ * their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require a full dependency on the
+ * Spring framework, nor does Spring make available only its JNDI classes in a small jar, or we would have used that.
+ * Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and authors have remained in tact.
+ *
+ * @author Rod Johnson
+ * @author Juergen Hoeller
+ * @see JndiCallback
+ * @see #execute
+ */
+public class JndiTemplate {
+
+ private static final Logger log = LoggerFactory.getLogger(JndiTemplate.class);
+
+ private Properties environment;
+
+ /** Create a new JndiTemplate instance. */
+ public JndiTemplate() {
+ }
+
+ /**
+ * Create a new JndiTemplate instance, using the given environment.
+ *
+ * @param environment the Properties to initialize with
+ */
+ public JndiTemplate(Properties environment) {
+ this.environment = environment;
+ }
+
+ /**
+ * Set the environment for the JNDI InitialContext.
+ *
+ * @param environment the Properties to initialize with
+ */
+ public void setEnvironment(Properties environment) {
+ this.environment = environment;
+ }
+
+ /**
+ * Return the environment for the JNDI InitialContext, or <code>null</code> if none should be used.
+ *
+ * @return the environment for the JNDI InitialContext, or <code>null</code> if none should be used.
+ */
+ public Properties getEnvironment() {
+ return this.environment;
+ }
+
+ /**
+ * Execute the given JNDI context callback implementation.
+ *
+ * @param contextCallback JndiCallback implementation
+ * @return a result object returned by the callback, or <code>null</code>
+ * @throws NamingException thrown by the callback implementation
+ * @see #createInitialContext
+ */
+ public Object execute(JndiCallback contextCallback) throws NamingException {
+ Context ctx = createInitialContext();
+ try {
+ return contextCallback.doInContext(ctx);
+ }
+ finally {
+ try {
+ ctx.close();
+ } catch (NamingException ex) {
+ log.debug("Could not close JNDI InitialContext", ex);
+ }
+ }
+ }
+
+ /**
+ * Create a new JNDI initial context. Invoked by {@link #execute}.
+ * <p>The default implementation use this template's environment settings.
+ * Can be subclassed for custom contexts, e.g. for testing.
+ *
+ * @return the initial Context instance
+ * @throws NamingException in case of initialization errors
+ */
+ @SuppressWarnings({"unchecked"})
+ protected Context createInitialContext() throws NamingException {
+ Properties env = getEnvironment();
+ Hashtable icEnv = null;
+ if (env != null) {
+ icEnv = new Hashtable(env.size());
+ for (Enumeration en = env.propertyNames(); en.hasMoreElements();) {
+ String key = (String) en.nextElement();
+ icEnv.put(key, env.getProperty(key));
+ }
+ }
+ return new InitialContext(icEnv);
+ }
+
+ /**
+ * Look up the object with the given name in the current JNDI context.
+ *
+ * @param name the JNDI name of the object
+ * @return object found (cannot be <code>null</code>; if a not so well-behaved
+ * JNDI implementations returns null, a NamingException gets thrown)
+ * @throws NamingException if there is no object with the given
+ * name bound to JNDI
+ */
+ public Object lookup(final String name) throws NamingException {
+ log.debug("Looking up JNDI object with name '{}'", name);
+ return execute(new JndiCallback() {
+ public Object doInContext(Context ctx) throws NamingException {
+ Object located = ctx.lookup(name);
+ if (located == null) {
+ throw new NameNotFoundException(
+ "JNDI object with [" + name + "] not found: JNDI implementation returned null");
+ }
+ return located;
+ }
+ });
+ }
+
+ /**
+ * Look up the object with the given name in the current JNDI context.
+ *
+ * @param name the JNDI name of the object
+ * @param requiredType type the JNDI object must match. Can be an interface or
+ * superclass of the actual class, or <code>null</code> for any match. For example,
+ * if the value is <code>Object.class</code>, this method will succeed whatever
+ * the class of the returned instance.
+ * @return object found (cannot be <code>null</code>; if a not so well-behaved
+ * JNDI implementations returns null, a NamingException gets thrown)
+ * @throws NamingException if there is no object with the given
+ * name bound to JNDI
+ */
+ public Object lookup(String name, Class requiredType) throws NamingException {
+ Object jndiObject = lookup(name);
+ if (requiredType != null && !requiredType.isInstance(jndiObject)) {
+ String msg = "Jndi object acquired under name '" + name + "' is of type [" +
+ jndiObject.getClass().getName() + "] and not assignable to the required type [" +
+ requiredType.getName() + "].";
+ throw new NamingException(msg);
+ }
+ return jndiObject;
+ }
+
+ /**
+ * Bind the given object to the current JNDI context, using the given name.
+ *
+ * @param name the JNDI name of the object
+ * @param object the object to bind
+ * @throws NamingException thrown by JNDI, mostly name already bound
+ */
+ public void bind(final String name, final Object object) throws NamingException {
+ log.debug("Binding JNDI object with name '{}'", name);
+ execute(new JndiCallback() {
+ public Object doInContext(Context ctx) throws NamingException {
+ ctx.bind(name, object);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Rebind the given object to the current JNDI context, using the given name.
+ * Overwrites any existing binding.
+ *
+ * @param name the JNDI name of the object
+ * @param object the object to rebind
+ * @throws NamingException thrown by JNDI
+ */
+ public void rebind(final String name, final Object object) throws NamingException {
+ log.debug("Rebinding JNDI object with name '{}'", name);
+ execute(new JndiCallback() {
+ public Object doInContext(Context ctx) throws NamingException {
+ ctx.rebind(name, object);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Remove the binding for the given name from the current JNDI context.
+ *
+ * @param name the JNDI name of the object
+ * @throws NamingException thrown by JNDI, mostly name not found
+ */
+ public void unbind(final String name) throws NamingException {
+ log.debug("Unbinding JNDI object with name '{}'", name);
+ execute(new JndiCallback() {
+ public Object doInContext(Context ctx) throws NamingException {
+ ctx.unbind(name);
+ return null;
+ }
+ });
+ }
+
+}
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/jndi/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/AbstractRememberMeManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/AuthenticatingSecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/AuthorizingSecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/CachingSecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/DefaultSubjectFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/RealmSecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/RememberMeManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SessionsSecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/activedirectory/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/jdbc/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/jndi/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/ldap/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native