shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lhazlew...@apache.org
Subject svn commit: r888543 - in /incubator/shiro/trunk: core/src/main/java/org/apache/shiro/config/ core/src/main/java/org/apache/shiro/util/ web/src/main/java/org/apache/shiro/web/servlet/ web/src/test/java/org/apache/shiro/web/config/
Date Tue, 08 Dec 2009 19:44:46 GMT
Author: lhazlewood
Date: Tue Dec  8 19:44:45 2009
New Revision: 888543

URL: http://svn.apache.org/viewvc?rev=888543&view=rev
Log:
changed Factory.createInstance method name to Factory.getInstance.  This name change allows
for either a new object to be created or a cached object to be returned at the discretion
of the underlying implementation.  The previous ''createInstance' name implied a new instance
is always created, which may or may not be desirable depending on the implementation strategy
or usage.

Modified:
    incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniFactorySupport.java
    incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniSecurityManagerFactory.java
    incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/Factory.java
    incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/IniShiroFilter.java
    incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/config/IniFilterChainResolverFactoryTest.java

Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniFactorySupport.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniFactorySupport.java?rev=888543&r1=888542&r2=888543&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniFactorySupport.java
(original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniFactorySupport.java
Tue Dec  8 19:44:45 2009
@@ -104,7 +104,7 @@
      *
      * @return a new {@code SecurityManager} instance by using a configured INI source.
      */
-    public T createInstance() {
+    public T getInstance() {
         Ini ini = resolveIni();
 
         T instance;

Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniSecurityManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniSecurityManagerFactory.java?rev=888543&r1=888542&r2=888543&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniSecurityManagerFactory.java
(original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/config/IniSecurityManagerFactory.java
Tue Dec  8 19:44:45 2009
@@ -44,7 +44,7 @@
     private static transient final Logger log = LoggerFactory.getLogger(IniSecurityManagerFactory.class);
 
     /**
-     * Creates a new instance.  See the {@link #createInstance()} JavaDoc for detailed explaination
of how an INI
+     * Creates a new instance.  See the {@link #getInstance()} JavaDoc for detailed explaination
of how an INI
      * source will be resolved to use to build the instance.
      */
     public IniSecurityManagerFactory() {

Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/Factory.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/Factory.java?rev=888543&r1=888542&r2=888543&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/Factory.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/Factory.java Tue Dec  8
19:44:45 2009
@@ -22,15 +22,16 @@
  * Generics-aware interface supporting the
  * <a href="http://en.wikipedia.org/wiki/Factory_method_pattern">Factory Method</a>
design pattern.
  *
- * @param <T> The type of the instance created by the Factory implementation.
+ * @param <T> The type of the instance returned by the Factory implementation.
  * @since 1.0
  */
 public interface Factory<T> {
 
     /**
-     * Creates an instance of the required type.
+     * Returns an instance of the required type.  The implementation determines whether or
not a new or cached
+     * instance is created every time this method is called.
      *
      * @return an instance of the required type.
      */
-    T createInstance();
+    T getInstance();
 }

Modified: incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/IniShiroFilter.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/IniShiroFilter.java?rev=888543&r1=888542&r2=888543&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/IniShiroFilter.java
(original)
+++ incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/IniShiroFilter.java
Tue Dec  8 19:44:45 2009
@@ -343,7 +343,7 @@
         } else {
             factory = new WebIniSecurityManagerFactory(ini);
         }
-        SecurityManager securityManager = factory.createInstance();
+        SecurityManager securityManager = factory.getInstance();
         setSecurityManager(securityManager);
     }
 
@@ -363,7 +363,7 @@
             //and set it:
             IniFilterChainResolverFactory filterChainResolverFactory = new IniFilterChainResolverFactory(ini);
             filterChainResolverFactory.setFilterConfig(getFilterConfig());
-            FilterChainResolver resolver = filterChainResolverFactory.createInstance();
+            FilterChainResolver resolver = filterChainResolverFactory.getInstance();
             setFilterChainResolver(resolver);
         }
     }

Modified: incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/config/IniFilterChainResolverFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/config/IniFilterChainResolverFactoryTest.java?rev=888543&r1=888542&r2=888543&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/config/IniFilterChainResolverFactoryTest.java
(original)
+++ incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/config/IniFilterChainResolverFactoryTest.java
Tue Dec  8 19:44:45 2009
@@ -56,8 +56,8 @@
     }
 
     @Test
-    public void testCreateInstanceNoIni() {
-        FilterChainResolver resolver = factory.createInstance();
+    public void testGetInstanceNoIni() {
+        FilterChainResolver resolver = factory.getInstance();
         assertNotNull(resolver);
     }
 
@@ -69,7 +69,7 @@
                         "/index.html = anon";
         ini.load(config);
         factory = new IniFilterChainResolverFactory(ini);
-        FilterChainResolver resolver = factory.createInstance();
+        FilterChainResolver resolver = factory.getInstance();
         assertNotNull(resolver);
     }
 
@@ -95,7 +95,7 @@
                         "/index.html = anon";
         ini.load(config);
         factory = new IniFilterChainResolverFactory(ini);
-        factory.createInstance();
+        factory.getInstance();
     }
 
     @Test
@@ -109,7 +109,7 @@
         FilterConfig config = createNiceMockFilterConfig();
         factory.setFilterConfig(config);
         replay(config);
-        FilterChainResolver resolver = factory.createInstance();
+        FilterChainResolver resolver = factory.getInstance();
         assertNotNull(resolver);
         verify(config);
     }



Mime
View raw message