Jen,
I don't know what the SJDC branch is, but if it is the USC modified version,
I wonder if you would also be able to fix the problem that has come up
several times in the past on the jasig-user list. In multi-server
environments all announcements disappear if a database error occurs when
retrieving announcements. I have provided to the list the fix based on the
Columbia code, but since we are not using the USC code, I cannot fix and
test it directly. See "USC Announcement problem" in the jasig-user list
(http://www.nabble.com/Google-Gadgets-to12528614.html#a15965154) for details
of a recent incident. I have attached the code modifications necessary in
the Columbia version, and based on the responses in the past, the USC code
is either exactly the same or very similar.
 
Paul Gazda
 
  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jen Bourey
Sent: Tuesday, May 13, 2008 1:44 PM
To: uportal-dev@lists.ja-sig.org
Subject: [uportal-dev] CAnnouncements and up3
 
I've been working on getting the SJDC branch of the CAnnouncements channel
working in up3 and have made a bunch of modifications to get the code to
compile successfully under uPortal 3.0.  In particular, the code uses the
portal's LogService for all its logging needs, and LogService was removed
from up3 in favor of log4j + commons logging.  I've modified my local
version to work with commons logging, which seems fairly desirable anyway.  





The other necessary change was to modify the PropertiesLoader to use the
ResourceLoader.getResourceAsStream method rather than
ResourceLoader.getResourceAsFile.  The getResourceAsFile method was removed
from up3 since it no longer worked, but the getResourceAsStream method has
been present since at least 2003, so I would expect this change to work in
pre-up3 versions.





It seems like both these changes are likely to be compatible enough with
pre-up3 versions that we could commit the changes without having to create a
separate up3 branch.  However, we probably would want to add a separate up3
build task to the ant build script.  Does this approach sound reasonable?
Is it likely to cause conflicts with uPortal versions people are currently
running the SJDC branch with?





Just as a general warning, there some issues that crop up with the channel
due to some of the database changes that were made in up3.  In uportal 3.0,
things like entities and groups no longer have hard-coded, predictable IDs.
If you give the channel the opportunity to add administrative groups itself,
it will create them with the wrong entity type and fail to successfully add
portal administrators to them.  I've had good success with first creating
the necessary administrative groups through either the portal administrative
API or importing .group and .membership files, configuring the announcements
properties files with these new group numbers, then deploying the channel
itself.





- Jen
-- 






You are currently subscribed to uportal-dev@lists.ja-sig.org as:
[EMAIL PROTECTED]


To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/uportal-dev

-- 
You are currently subscribed to uportal-dev@lists.ja-sig.org as: [EMAIL 
PROTECTED]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/uportal-dev
ITopicStoreAuthority.java
-------------------------
Change:
public HashMap getDBTopicIDs (); 
To:
public HashMap getDBTopicIDs () throws Exception;


RDBMTopicStore.java
-------------------
A try-catch block around the code below.
                // Delete from announcements cache and topic object 
announcements that were
                // deleted from database by another server.
                try {
                  Set dbAnnKeys = (getDBAnnIDs(t.getID()).keySet());
                  HashMap tmpMap = new HashMap();
                  tmpMap.putAll(anns);
                  Set annKeys = tmpMap.keySet();
                  annKeys.removeAll(dbAnnKeys);
                  if (!annKeys.isEmpty()) {
                    Iterator i = annKeys.iterator();
                    while (i.hasNext()) {
                      String annKey = (String)i.next();
                      anns.remove(annKey);
                      t.removeAnnouncement(annKey);
                      t.store();
                    }
                  }
                }
                catch (Exception e) {
                  log.error("ERROR: Retrieval of announcements from database 
failed. " +
                            "Check for announcements deleted by another server 
was bypassed. ", e);
                }

Change:
    public HashMap getDBTopicIDs() {
        HashMap topicIDs = new HashMap();
        Connection conn = null;
        try {
          conn = this.getConnection();
          String q = "select TOPIC_ID from " + TOPIC_TABLE;
          RDBMServices.PreparedStatement ps = new 
RDBMServices.PreparedStatement(conn, q);
          ResultSet rs = ps.executeQuery();
          try {
              while (rs.next()) {
                  topicIDs.put(rs.getString("TOPIC_ID"), null);
              }
          } catch (Exception e) {
              log.error( e);
          }
          ps.close();
        } catch (Exception e) {
            log.error( e);

To:
    public HashMap getDBTopicIDs() throws Exception {
        HashMap topicIDs = new HashMap();
        Connection conn = null;
        try {
          conn = this.getConnection();
          String q = "select TOPIC_ID from " + TOPIC_TABLE;
          RDBMServices.PreparedStatement ps = new 
RDBMServices.PreparedStatement(conn, q);
          ResultSet rs = ps.executeQuery();

          while (rs.next()) {
              topicIDs.put(rs.getString("TOPIC_ID"), null);
          }
          ps.close();
        } catch (Exception e) {
            log.error("ERROR: RDBMTopicStore.getDBTopicIDs: Retrieval of topic 
IDs " +
                      "from database failed. ", e);
            throw new Exception(e);

Change:
    public HashMap getDBAnnIDs(String topicID) {
        HashMap annIDs = new HashMap();
        Connection conn = null;
        try {
          conn = this.getConnection();
          String q = "select MESSAGE_ID from " + MESSAGE_TABLE + " where 
TOPIC_ID = ?";
          RDBMServices.PreparedStatement ps = new 
RDBMServices.PreparedStatement(conn, q);
          ps.setString(1,topicID);
          ResultSet rs = ps.executeQuery();
          try {
              while (rs.next()) {
                  annIDs.put(rs.getString("MESSAGE_ID"), null);
              }
          } catch (Exception e) {
              log.error( e);
          }
          ps.close();
        } catch (Exception e) {
            log.error( e);

To:
    public HashMap getDBAnnIDs(String topicID) throws Exception {
        HashMap annIDs = new HashMap();
        Connection conn = null;
        try {
          conn = this.getConnection();
          String q = "select MESSAGE_ID from " + MESSAGE_TABLE + " where 
TOPIC_ID = ?";
          RDBMServices.PreparedStatement ps = new 
RDBMServices.PreparedStatement(conn, q);
          ps.setString(1,topicID);
          ResultSet rs = ps.executeQuery();

          while (rs.next()) {
              annIDs.put(rs.getString("MESSAGE_ID"), null);
          }
          ps.close();
        } catch (Exception e) {
            log.error("ERROR: RDBMTopicStore.getDBAnnIDs: Retrieval of 
announcements " +
                      "from database failed. ", e);
            throw new Exception(e);

TopicManager.java
-----------------
Change:
    public Topic[] getAllTopics () {
        // Delete from topics object topics that were deleted from database
        // by another server.
        Set dbTopicKeys = (authority.getDBTopicIDs()).keySet();
        HashMap tmpMap = new HashMap();
        tmpMap.putAll(topics);
        Set topicKeys = tmpMap.keySet();
        topicKeys.removeAll(dbTopicKeys);
        if (!topicKeys.isEmpty()) {
          Iterator i = topicKeys.iterator();
          while (i.hasNext()) {
            String topicKey = (String)i.next();
            flushTopic((Topic)topics.get(topicKey));
          }
        }

To:
    public Topic[] getAllTopics () {
        // Delete from topics object topics that were deleted from database
        // by another server.
        try {
          Set dbTopicKeys = (authority.getDBTopicIDs()).keySet();
          HashMap tmpMap = new HashMap();
          tmpMap.putAll(topics);
          Set topicKeys = tmpMap.keySet();
          topicKeys.removeAll(dbTopicKeys);
          if (!topicKeys.isEmpty()) {
            Iterator i = topicKeys.iterator();
            while (i.hasNext()) {
              String topicKey = (String)i.next();
              flushTopic((Topic)topics.get(topicKey));
            }
          }
        }
        catch (Exception e) {
          log.error("ERROR: Retrieval of topic IDs from database failed. " +
                    "Check for topics deleted by another server was bypassed. 
", e);
        }

Reply via email to