Permalink
Browse files

Merge remote-tracking branch 'origin/master'

  • Loading branch information...
2 parents d3df4c5 + 5284dcc commit 6f8e3f02b72292412ebca739c6bb5e3b4dc44c3b @jesse-gallagher jesse-gallagher committed Dec 19, 2012
Showing with 847 additions and 22 deletions.
  1. BIN DOTSFeedMonster/_builds/org.openntf.news.monster_0.0.1.201212091335.jar
  2. +11 −0 DOTSFeedMonster/org.openntf.news.monster/.classpath
  3. +28 −0 DOTSFeedMonster/org.openntf.news.monster/.project
  4. +8 −0 DOTSFeedMonster/org.openntf.news.monster/.settings/org.eclipse.jdt.core.prefs
  5. +4 −0 DOTSFeedMonster/org.openntf.news.monster/.settings/org.eclipse.pde.core.prefs
  6. +16 −0 DOTSFeedMonster/org.openntf.news.monster/META-INF/MANIFEST.MF
  7. +26 −0 DOTSFeedMonster/org.openntf.news.monster/build.properties
  8. BIN DOTSFeedMonster/org.openntf.news.monster/lib/commons-logging-api-1.1.1.jar
  9. BIN DOTSFeedMonster/org.openntf.news.monster/lib/jdom.jar
  10. BIN DOTSFeedMonster/org.openntf.news.monster/lib/jericho-html-3.1.jar
  11. BIN DOTSFeedMonster/org.openntf.news.monster/lib/rome-1.0.jar
  12. +13 −0 DOTSFeedMonster/org.openntf.news.monster/plugin.xml
  13. +171 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/Story.java
  14. +38 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/dots/activator/Activator.java
  15. +64 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/monster/DOTSFeedMonster.java
  16. +149 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/monster/FeedMonster.java
  17. +182 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/monster/RSSReader.java
  18. +31 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/shared/Constants.java
  19. +14 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/shared/MonsterException.java
  20. +14 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/shared/StoryReaderException.java
  21. +49 −0 DOTSFeedMonster/org.openntf.news.monster/src/org/openntf/news/shared/Utilities.java
  22. +7 −0 DOTSFeedMonster/readme.txt
  23. +1 −1 disk-collaborationtoday/.settings/org.eclipse.core.resources.prefs
  24. +2 −2 disk-collaborationtoday/Code/Java/org/openntf/news/http/core/NewsEntriesJson.java
  25. +9 −9 disk-collaborationtoday/CustomControls/leftColumnLineItems.xsp.metadata
  26. +10 −10 disk-collaborationtoday/XPages/author.xsp.metadata
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="lib/rome-1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jdom.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-logging-api-1.1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jericho-html-3.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.openntf.news.monster</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,8 @@
+#Sun Dec 09 11:05:27 VET 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
@@ -0,0 +1,4 @@
+#Mon Feb 08 11:29:33 EST 2010
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.openntf.news.monster;singleton:=true
+Bundle-Version: 0.0.1.qualifier
+Bundle-Activator: org.openntf.news.dots.activator.Activator
+Bundle-Vendor: OpenNTF
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6,
+ J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Require-Bundle: com.ibm.dots
+Bundle-ClassPath: lib/rome-1.0.jar,
+ .,
+ lib/jdom.jar,
+ lib/commons-logging-api-1.1.1.jar,
+ lib/jericho-html-3.1.jar
+
@@ -0,0 +1,26 @@
+# ***********************************************************************
+# © Copyright IBM Corp. 2009,2010
+#
+# Licensed 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.
+# *************************************************************************
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ lib/rome-1.0.jar,\
+ lib/jdom.jar,\
+ lib/jericho-html-3.1.jar,\
+ lib/commons-logging-api-1.1.1.jar
+jre.compilation.profile = J2SE-1.5
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="com.ibm.dots.task">
+ <task id="org.openntf.news.readFeeds"
+ description=""
+ class="org.openntf.news.monster.DOTSFeedMonster"
+ runOnStart="false">
+ <!--<run every="30" unit="second" />-->
+ </task>
+ </extension>
+</plugin>
@@ -0,0 +1,171 @@
+package org.openntf.news;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TimeZone;
+
+import lotus.domino.Database;
+import lotus.domino.Document;
+import lotus.domino.NotesException;
+import lotus.domino.Session;
+
+import org.openntf.news.shared.Constants;
+import org.openntf.news.shared.StoryReaderException;
+import org.openntf.news.shared.Utilities;
+
+// Story element for news items
+public class Story {
+
+ //From Entry
+ private String id;
+ private String link;
+ private Calendar date;
+ private String title;
+ private String abstractContent;
+ private String fullContent;
+
+ //Set on Save
+ private Calendar creationDate;
+
+ private HashMap<String,Object> additionalFields;
+ private boolean redirectEnabled=false;
+
+ public Story() {
+ additionalFields=new HashMap<String,Object>();
+
+ // setting all things GMT to prevent time zone inconsistencies...
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ }
+
+ public void addField(String name, Object value) {
+ additionalFields.put(name, value);
+ }
+
+ public Object getField(String name) {
+ return additionalFields.get(name);
+ }
+
+ public void addFields(Map<String,Object> values) {
+ additionalFields.putAll(values);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+
+ public Calendar getDate() {
+ return date;
+ }
+
+ public void setDate(Calendar date) {
+ this.date = date;
+ }
+
+
+ public String getTitle() {
+ return title;
+ }
+
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+
+ public String getAbstractContent() {
+ return abstractContent;
+ }
+
+ public void setAbstractContent(String abstractContent) {
+ this.abstractContent = abstractContent;
+ }
+
+ public String getFullContent() {
+ return fullContent;
+ }
+
+ public void setFullContent(String fullContent) {
+ this.fullContent = fullContent;
+ }
+
+ public Calendar getCreationDate() {
+ return creationDate;
+ }
+
+ public void setCreationDate(Calendar creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ public String toString() {
+ DateFormat sdf = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
+ return getTitle() + " (" + getLink() + " - " + sdf.format(getDate().getTime()) + ")";
+ }
+
+ public boolean saveToDatabase(Database db) throws StoryReaderException {
+ try {
+ setCreationDate(Calendar.getInstance());
+
+ Session session=db.getParent();
+
+ Document storyDoc = db.createDocument();
+ storyDoc.replaceItemValue("Form", "News");
+ storyDoc.replaceItemValue("NID", Utilities.generateUniqueId());
+
+ if(isRedirectEnabled()) {
+ try {
+ setLink(Utilities.followRedirect(getLink()));
+ } catch (IOException e) {
+ throw new StoryReaderException(Constants.EXCEPTION_COMM_ERROR + ": "+getLink());
+ }
+ }
+
+ storyDoc.replaceItemValue("NLink", getLink());
+
+ storyDoc.replaceItemValue("NCreationDate", session.createDateTime(getCreationDate()));
+ storyDoc.replaceItemValue("NPublicationDate", session.createDateTime(getDate()));
+ storyDoc.replaceItemValue("NTitle", getTitle());
+ storyDoc.replaceItemValue("NAbstract", getAbstractContent());
+ storyDoc.replaceItemValue("NContent", getFullContent());
+
+ for (Map.Entry<String, Object> entry : additionalFields.entrySet()) {
+ storyDoc.replaceItemValue(entry.getKey(), entry.getValue());
+ }
+
+ storyDoc.save();
+ storyDoc.recycle();
+
+
+ return true;
+ } catch (NotesException e) {
+ throw new StoryReaderException(Constants.EXCEPTION_SAVE_STORY + ": "+ e.getMessage());
+ }
+
+ }
+
+ public boolean isRedirectEnabled() {
+ return redirectEnabled;
+ }
+
+ public void setRedirectEnabled(boolean redirectEnabled) {
+ this.redirectEnabled = redirectEnabled;
+ }
+
+
+}
@@ -0,0 +1,38 @@
+/*
+ * © Copyright IBM Corp. 2009,2010
+ *
+ * Licensed 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.openntf.news.dots.activator;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
@@ -0,0 +1,64 @@
+package org.openntf.news.monster;
+
+import lotus.domino.Database;
+import lotus.domino.NotesException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.openntf.news.shared.Constants;
+import org.openntf.news.shared.MonsterException;
+import org.openntf.news.shared.Utilities;
+
+import com.ibm.dots.task.AbstractServerTask;
+import com.ibm.dots.task.RunWhen;
+
+
+public class DOTSFeedMonster extends AbstractServerTask {
+
+ Database db;
+
+ public DOTSFeedMonster() {
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.dots.task.IServerTaskRunnable#dispose()
+ */
+ public void dispose() throws NotesException {
+ if(db!=null) db.recycle();
+ }
+
+ /* (non-Javadoc)
+ * This is version 1
+ */
+ public void run(RunWhen runWhen, String[] args, IProgressMonitor monitor) throws NotesException {
+
+ monitor.beginTask(Constants.APPLICATION_NAME + ": " + Constants.TASK_ID, 0 );
+ logMessage(Constants.APPLICATION_NAME + ": " + Constants.TASK_ID + " started");
+ if(Constants.memory_dump) logMessage("Launching: " + Utilities.getMemoryStatus());
+
+ String dbname=getSession().getEnvironmentString("Monster_TargetDB", true);
+
+ if(null == dbname || dbname.equals("")) {
+ dbname=Constants.DATABASE_PATH_AND_NAME;
+ }
+
+ logMessage(Constants.APPLICATION_NAME + ": Using database '" + dbname + "'");
+
+ db = getSession().getDatabase("", dbname );
+
+ try {
+ if(!db.isOpen()) {
+ throw new MonsterException(Constants.EXCEPTION_NEWSDB_ERROR + ": "+dbname);
+ }
+
+ new FeedMonster(db).ReadFeeds();
+ } catch(MonsterException e) {
+ if(Constants.debug) e.printStackTrace();
+ logMessage(e.getMessage());
+ }
+
+ logMessage(Constants.APPLICATION_NAME + ": " + Constants.TASK_ID + " finished");
+ if(Constants.memory_dump) logMessage("Run Success: " + Utilities.getMemoryStatus());
+ monitor.worked( 1 );
+
+ }
+}
Oops, something went wrong.

0 comments on commit 6f8e3f0

Please sign in to comment.