[jboss-cvs] JBossAS SVN: r91395 - in projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache: spi and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Jul 18 00:53:26 EDT 2009
Author: ALRubinger
Date: 2009-07-18 00:53:26 -0400 (Sat, 18 Jul 2009)
New Revision: 91395
Removed:
projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/FileFeedFetcher.java
Modified:
projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/RssCacheBean.java
projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/spi/RssCacheCommonBusiness.java
Log:
[EJBBOOK-9] Protect internal state of the cache from being exported/mutation
Deleted: projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/FileFeedFetcher.java
===================================================================
--- projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/FileFeedFetcher.java 2009-07-18 04:48:30 UTC (rev 91394)
+++ projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/FileFeedFetcher.java 2009-07-18 04:53:26 UTC (rev 91395)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.examples.ch07.rsscache.impl.rome;
-
-import java.io.IOException;
-import java.net.URL;
-
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.fetcher.FetcherException;
-import com.sun.syndication.fetcher.impl.AbstractFeedFetcher;
-import com.sun.syndication.io.FeedException;
-
-/**
- * FileFeedFetcher
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class FileFeedFetcher extends AbstractFeedFetcher
-{
-
- /* (non-Javadoc)
- * @see com.sun.syndication.fetcher.FeedFetcher#retrieveFeed(java.net.URL)
- */
- @Override
- public SyndFeed retrieveFeed(URL arg0) throws IllegalArgumentException, IOException, FeedException, FetcherException
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- //-------------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- //-------------------------------------------------------------------------------------||
- // Instance Members -------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- //-------------------------------------------------------------------------------------||
- // Constructor ------------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- //-------------------------------------------------------------------------------------||
- // Required Implementations -----------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- //-------------------------------------------------------------------------------------||
- // Functional Methods -----------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- //-------------------------------------------------------------------------------------||
- // Internal Helper Methods ------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-}
Modified: projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/RssCacheBean.java
===================================================================
--- projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/RssCacheBean.java 2009-07-18 04:48:30 UTC (rev 91394)
+++ projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/impl/rome/RssCacheBean.java 2009-07-18 04:53:26 UTC (rev 91395)
@@ -3,6 +3,7 @@
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.annotation.PostConstruct;
@@ -146,8 +147,11 @@
log.debug("Found new RSS Entry: " + rssEntry);
}
- // Set the entries
- this.entries = rssEntries;
+ // Protect the entries from mutation from exporting the client view
+ final List<RssEntry> protectedEntries = Collections.unmodifiableList(rssEntries);
+
+ // Set the entries in the cache
+ this.entries = protectedEntries;
}
//-------------------------------------------------------------------------------------||
Modified: projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/spi/RssCacheCommonBusiness.java
===================================================================
--- projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/spi/RssCacheCommonBusiness.java 2009-07-18 04:48:30 UTC (rev 91394)
+++ projects/ejb-book/trunk/ch07-rsscache/src/main/java/org/jboss/ejb3/examples/ch07/rsscache/spi/RssCacheCommonBusiness.java 2009-07-18 04:53:26 UTC (rev 91395)
@@ -40,7 +40,8 @@
// ---------------------------------------------------------------------------||
/**
- * Returns all entries in the RSS Feed represented by {@link RssCacheCommonBusiness#getUrl()}
+ * Returns all entries in the RSS Feed represented by {@link RssCacheCommonBusiness#getUrl()}.
+ * This list will not support mutation and is read-only.
*/
List<RssEntry> getEntries();
More information about the jboss-cvs-commits
mailing list