james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r821286 - in /james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository: ArticleIDRepository.java NNTPGroup.java NNTPGroupImpl.java NNTPRepository.java NNTPRepositoryImpl.java
Date Sat, 03 Oct 2009 10:06:01 GMT
Author: norman
Date: Sat Oct  3 10:06:01 2009
New Revision: 821286

URL: http://svn.apache.org/viewvc?rev=821286&view=rev
Log:
Use Generics

Modified:
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroup.java
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroupImpl.java
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepository.java
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java?rev=821286&r1=821285&r2=821286&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java
Sat Oct  3 10:06:01 2009
@@ -176,7 +176,7 @@
                 fin.close();
             }
         }
-        Enumeration enumeration = prop.keys();
+        Enumeration<?> enumeration = prop.keys();
         NNTPArticle article = null;
         while ( article == null && enumeration.hasMoreElements() ) {
             String groupName = (String)enumeration.nextElement();

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroup.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroup.java?rev=821286&r1=821285&r2=821286&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroup.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroup.java
Sat Oct  3 10:06:01 2009
@@ -92,14 +92,14 @@
      *
      * @return the article iterator
      */
-    Iterator getArticlesSince(Date dt);
+    Iterator<NNTPArticle> getArticlesSince(Date dt);
 
     /**
      * Retrieves an iterator of all articles in this newsgroup
      *
      * @return the article iterator
      */
-    Iterator getArticles();
+    Iterator<NNTPArticle> getArticles();
 
     /**
      * Retrieves the group information in a format consistent with

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroupImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroupImpl.java?rev=821286&r1=821285&r2=821286&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroupImpl.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPGroupImpl.java
Sat Oct  3 10:06:01 2009
@@ -162,11 +162,11 @@
     /**
      * @see org.apache.james.nntpserver.repository.NNTPGroup#getArticlesSince(Date)
      */
-    public Iterator getArticlesSince(Date dt) {
+    public Iterator<NNTPArticle> getArticlesSince(Date dt) {
         File[] f = root.listFiles(new AndFileFilter
             (new DateSinceFileFilter(dt.getTime()),
              new InvertedFileFilter(new ExtensionFileFilter(".id"))));
-        List list = new ArrayList();
+        List<NNTPArticle> list = new ArrayList<NNTPArticle>();
         for ( int i = 0 ; i < f.length ; i++ ) {
             list.add(new NNTPArticleImpl(this, f[i]));
         }
@@ -176,9 +176,9 @@
     /**
      * @see org.apache.james.nntpserver.repository.NNTPGroup#getArticles()
      */
-    public Iterator getArticles() {
+    public Iterator<NNTPArticle> getArticles() {
         File[] f = root.listFiles();
-        List list = new ArrayList();
+        List<NNTPArticle> list = new ArrayList<NNTPArticle>();
         for ( int i = 0 ; i < f.length ; i++ )
             list.add(new NNTPArticleImpl(this, f[i]));
         return list.iterator();

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepository.java?rev=821286&r1=821285&r2=821286&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepository.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepository.java
Sat Oct  3 10:06:01 2009
@@ -65,7 +65,7 @@
      *
      * @return an iterator containing the groups retrieved
      */
-    Iterator getMatchedGroups(String wildmat);
+    Iterator<NNTPGroup> getMatchedGroups(String wildmat);
 
     /**
      * Gets all groups added since the specified date
@@ -74,7 +74,7 @@
      *
      * @return an iterator containing the groups retrieved
      */
-    Iterator getGroupsSince(Date dt);
+    Iterator<NNTPGroup> getGroupsSince(Date dt);
 
     /**
      * Gets all articles posted since the specified date
@@ -83,7 +83,7 @@
      *
      * @return an iterator containing the articles retrieved
      */
-    Iterator getArticlesSince(Date dt);
+    Iterator<NNTPArticle> getArticlesSince(Date dt);
 
     /**
      * Returns whether this repository is read only.

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java?rev=821286&r1=821285&r2=821286&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
Sat Oct  3 10:06:01 2009
@@ -87,7 +87,7 @@
     /**
      * A map to allow lookup of valid newsgroup names
      */
-    private HashMap groupNameMap = null;
+    private HashMap<String,String> groupNameMap = null;
 
     /**
      * Restrict use to newsgroups specified in config only
@@ -132,7 +132,7 @@
      *
      * TODO: This needs to be addressed so it scales better
      */
-    private HashMap repositoryGroups = new HashMap();
+    private HashMap<String,NNTPGroup> repositoryGroups = new HashMap<String,NNTPGroup>();
 
     /**
      * The service manager
@@ -176,7 +176,7 @@
         }
         Configuration newsgroupConfiguration = configuration.getChild("newsgroups");
         definedGroupsOnly = newsgroupConfiguration.getAttributeAsBoolean("only", false);
-        groupNameMap = new HashMap();
+        groupNameMap = new HashMap<String,String>();
         if ( newsgroupConfiguration != null ) {
             Configuration[] children = newsgroupConfiguration.getChildren("newsgroup");
             if ( children != null ) {
@@ -231,10 +231,10 @@
             throw new ConfigurationException(errorBuffer.toString());
         }
 
-        Set groups = groupNameMap.keySet();
-        Iterator groupIterator = groups.iterator();
+        Set<String> groups = groupNameMap.keySet();
+        Iterator<String> groupIterator = groups.iterator();
         while( groupIterator.hasNext() ) {
-            String groupName = (String)groupIterator.next();
+            String groupName = groupIterator.next();
             File groupFile = new File(rootPath,groupName);
             if ( groupFile.exists() == false ) {
                 groupFile.mkdirs();
@@ -362,7 +362,7 @@
     /**
      * @see org.apache.james.nntpserver.repository.NNTPRepository#getMatchedGroups(String)
      */
-    public Iterator getMatchedGroups(String wildmat) {
+    public Iterator<NNTPGroup> getMatchedGroups(String wildmat) {
         File[] f = rootPath.listFiles(new AndFileFilter(new GroupFilter(), new AndFileFilter
             (new DirectoryFileFilter(),new GlobFilenameFilter(wildmat))));
         return getGroups(f);
@@ -376,8 +376,8 @@
      *
      * @return an iterator of news groups
      */
-    private Iterator getGroups(File[] f) {
-        List list = new ArrayList();
+    private Iterator<NNTPGroup> getGroups(File[] f) {
+        List<NNTPGroup> list = new ArrayList<NNTPGroup>();
         for ( int i = 0 ; i < f.length ; i++ ) {
             if (f[i] != null) {
                 list.add(getGroup(f[i].getName()));
@@ -389,7 +389,7 @@
     /**
      * @see org.apache.james.nntpserver.repository.NNTPRepository#getGroupsSince(Date)
      */
-    public Iterator getGroupsSince(Date dt) {
+    public Iterator<NNTPGroup> getGroupsSince(Date dt) {
         File[] f = rootPath.listFiles(new AndFileFilter(new GroupFilter(), new AndFileFilter
             (new DirectoryFileFilter(),new DateSinceFileFilter(dt.getTime()))));
         return getGroups(f);
@@ -402,16 +402,16 @@
     /**
      * @see org.apache.james.nntpserver.repository.NNTPRepository#getArticlesSince(Date)
      */
-    public Iterator getArticlesSince(final Date dt) {
-        final Iterator giter = getGroupsSince(dt);
-        return new Iterator() {
+    public Iterator<NNTPArticle> getArticlesSince(final Date dt) {
+        final Iterator<NNTPGroup> giter = getGroupsSince(dt);
+        return new Iterator<NNTPArticle>() {
 
-                private Iterator iter = null;
+                private Iterator<NNTPArticle> iter = null;
 
                 public boolean hasNext() {
                     if ( iter == null ) {
                         if ( giter.hasNext() ) {
-                            NNTPGroup group = (NNTPGroup)giter.next();
+                            NNTPGroup group = giter.next();
                             iter = group.getArticlesSince(dt);
                         }
                         else {
@@ -426,7 +426,7 @@
                     }
                 }
 
-                public Object next() {
+                public NNTPArticle next() {
                     return iter.next();
                 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message