summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/plugin/README_plugin.txt37
-rw-r--r--src/plugin/install.rdf19
-rwxr-xr-xsrc/plugin/make_xpi.sh22
-rw-r--r--src/plugin/plugin.c199
-rw-r--r--src/plugin/plugin.h29
-rw-r--r--src/plugin/test.html17
6 files changed, 323 insertions, 0 deletions
diff --git a/src/plugin/README_plugin.txt b/src/plugin/README_plugin.txt
new file mode 100644
index 0000000..91100ed
--- a/dev/null
+++ b/src/plugin/README_plugin.txt
@@ -0,0 +1,37 @@
+The contents of this directory are used to deploy the application as a
+web browser plugin. The following references are relevant to the
+technologies used here:
+
+"Plugins," Mozilla Developer Center, last modified August 23, 2009, https://developer.mozilla.org/en/Plugins.
+
+"Shipping a plugin as an extension," Mozilla Developer Center, last
+modified June 2, 2008,
+https://developer.mozilla.org/en/Shipping_a_plugin_as_an_extension.
+
+Analysis of current library dependencies for the web browser plugin:
+$ ldd libflumapplugin.so.0.0.0
+
+ Basic Linux Runtime
+ -------------------
+ /lib/ld-linux.so.2
+ libgcc_s.so.1 => /lib/libgcc_s.so.1
+ libstdc++.so.5 => /usr/lib/libstdc++.so.5
+ linux-gate.so.1 =>
+ libc.so.6 => /lib/i686/cmov/libc.so.6
+ libcrypt.so.1 => /lib/i686/cmov/libcrypt.so.1
+ libdl.so.2 => /lib/i686/cmov/libdl.so.2
+ libm.so.6 => /lib/i686/cmov/libm.so.6
+ libpthread.so.0 => /lib/i686/cmov/libpthread.so.0
+ librt.so.1 => /lib/i686/cmov/librt.so.1
+
+ IBM DB2 Client
+ --------------
+ libdb2.so.1 => /home/db2inst1/sqllib/lib32/libdb2.so.1
+ libdb2dascmn.so.1 => /home/db2inst1/sqllib/lib32/libdb2dascmn.so.1
+ libdb2g11n.so.1 => /home/db2inst1/sqllib/lib32/libdb2g11n.so.1
+ libdb2genreg.so.1 => /home/db2inst1/sqllib/lib32/libdb2genreg.so.1
+ libdb2install.so.1 => /home/db2inst1/sqllib/lib32/libdb2install.so.1
+ libdb2locale.so.1 => /home/db2inst1/sqllib/lib32/libdb2locale.so.1
+ libdb2osse.so.1 => /home/db2inst1/sqllib/lib32/libdb2osse.so.1
+ libdb2osse_db2.so.1 => /home/db2inst1/sqllib/lib32/libdb2osse_db2.so.1
+ libdb2trcapi.so.1 => /home/db2inst1/sqllib/lib32/libdb2trcapi.so.1
diff --git a/src/plugin/install.rdf b/src/plugin/install.rdf
new file mode 100644
index 0000000..552cc56
--- a/dev/null
+++ b/src/plugin/install.rdf
@@ -0,0 +1,19 @@
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>vistool@donpellegrino.com</em:id>
+ <em:name>Influenza Sequence Mapping Project Visualization Tool</em:name>
+ <em:version>1.0</em:version>
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>1.5</em:minVersion>
+ <em:maxVersion>3.6.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <em:creator>Don Pellegrino</em:creator>
+ <em:homepageURL>http://cluster.ischool.drexel.edu/~st96wym4/flumap/</em:homepageURL>
+ <em:description>Tool for interactive exploration of data from the Influenza Sequence Mapping Project.</em:description>
+ <!-- Add update links here -->
+ </Description>
+</RDF>
diff --git a/src/plugin/make_xpi.sh b/src/plugin/make_xpi.sh
new file mode 100755
index 0000000..cb206db
--- a/dev/null
+++ b/src/plugin/make_xpi.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# This script creates a XPI file.
+
+# The structure of an Installable Bundle is documented on-line at:
+# https://developer.mozilla.org/en/Bundles. Note that Iceweasel
+# 3.0.12 on Debian x86 is unable to find the library if gcc4 is used
+# in place of gcc3 or if the library name is not truncated to .so.
+# Also running from the GNOME taskbar does not include the DB2
+# run-time in the LD_LIBRARY_PATH which causes the library to fail to
+# load with no errors reported. Running from a shell with the
+# LD_LIBRARY_PATH set resolves this. DB2 run-time libraries should be
+# statically linked however static verions are not including with DB2
+# v9.5 Express/C.
+cp ../.libs/libflumapplugin.so.0.0.0 \
+platform/Linux_x86-gcc3/plugins/libflumapplugin.so
+
+# ZIP is used make the extension as per the instructions at:
+# https://developer.mozilla.org/en/Extension_Packaging
+zip -r flumap.xpi \
+install.rdf \
+platform/*
diff --git a/src/plugin/plugin.c b/src/plugin/plugin.c
new file mode 100644
index 0000000..300e2f3
--- a/dev/null
+++ b/src/plugin/plugin.c
@@ -0,0 +1,199 @@
+#include "plugin.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+/*
+ * This code is based on the Basic Plugin Example from Mozilla on-line
+ * at
+ * http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/BasicPlugin.c.
+ */
+
+#define PLUGIN_NAME "Influenza Sequence Mapping Project Visualization Tool"
+#define PLUGIN_DESCRIPTION "A tool for data exploration and discovery."
+#define PLUGIN_VERSION "0.1"
+
+static NPNetscapeFuncs* sBrowserFuncs = NULL;
+
+typedef struct InstanceData
+{
+ NPP npp;
+ NPWindow window;
+} InstanceData;
+
+static void
+fillPluginFunctionTable (NPPluginFuncs* pFuncs)
+{
+ pFuncs->version = 11;
+ pFuncs->size = sizeof(*pFuncs);
+ pFuncs->newp = NPP_New;
+ pFuncs->destroy = NPP_Destroy;
+ pFuncs->setwindow = NPP_SetWindow;
+ pFuncs->newstream = NPP_NewStream;
+ pFuncs->destroystream = NPP_DestroyStream;
+ pFuncs->asfile = NPP_StreamAsFile;
+ pFuncs->writeready = NPP_WriteReady;
+ pFuncs->write = NPP_Write;
+ pFuncs->print = NPP_Print;
+ pFuncs->event = NPP_HandleEvent;
+ pFuncs->urlnotify = NPP_URLNotify;
+ pFuncs->getvalue = NPP_GetValue;
+ pFuncs->setvalue = NPP_SetValue;
+
+ return;
+}
+
+NP_EXPORT(NPError)
+NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
+{
+ sBrowserFuncs = bFuncs;
+
+ fillPluginFunctionTable(pFuncs);
+
+ return NPERR_NO_ERROR;
+}
+
+NP_EXPORT(char*)
+NP_GetPluginVersion()
+{
+ return PLUGIN_VERSION;
+}
+
+NP_EXPORT(char*)
+NP_GetMIMEDescription()
+{
+ return "application/x-flumap::Visualization Tool";
+}
+
+NP_EXPORT(NPError)
+NP_GetValue(void* future, NPPVariable aVariable, void* aValue)
+{
+ switch (aVariable)
+ {
+ case NPPVpluginNameString:
+ *((char**)aValue) = PLUGIN_NAME;
+ break;
+ case NPPVpluginDescriptionString:
+ *((char**)aValue) = PLUGIN_DESCRIPTION;
+ break;
+ default:
+ return NPERR_INVALID_PARAM;
+ break;
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+NP_EXPORT(NPError)
+NP_Shutdown()
+{
+ return NPERR_NO_ERROR;
+}
+
+NPError
+NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ // Make sure we can render this plugin
+ NPBool browserSupportsWindowless = false;
+ sBrowserFuncs->getvalue(instance, NPNVSupportsWindowless, &browserSupportsWindowless);
+ if (!browserSupportsWindowless) {
+ printf("Windowless mode not supported by the browser\n");
+ return NPERR_GENERIC_ERROR;
+ }
+
+ sBrowserFuncs->setvalue(instance, NPPVpluginWindowBool, (void*)false);
+
+ // set up our our instance data
+ InstanceData* instanceData = (InstanceData*)malloc(sizeof(InstanceData));
+ if (!instanceData)
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ memset(instanceData, 0, sizeof(InstanceData));
+ instanceData->npp = instance;
+ instance->pdata = instanceData;
+
+ return NPERR_NO_ERROR;
+}
+
+NPError
+NPP_Destroy(NPP instance, NPSavedData** save)
+{
+ InstanceData* instanceData = (InstanceData*)(instance->pdata);
+ free(instanceData);
+ return NPERR_NO_ERROR;
+}
+
+NPError
+NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ InstanceData* instanceData = (InstanceData*)(instance->pdata);
+ instanceData->window = *window;
+ return NPERR_NO_ERROR;
+}
+
+NPError
+NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
+{
+ return NPERR_GENERIC_ERROR;
+}
+
+NPError
+NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_GENERIC_ERROR;
+}
+
+int32_t
+NPP_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32_t
+NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
+{
+ return 0;
+}
+
+void
+NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+ return;
+}
+
+void
+NPP_Print(NPP instance, NPPrint* platformPrint) {
+ return;
+}
+
+int16_t
+NPP_HandleEvent(NPP instance, void* event)
+{
+ InstanceData *instanceData = (InstanceData*)(instance->pdata);
+ // XEvent *nativeEvent = (XEvent*)event;
+
+ // if (nativeEvent->type != GraphicsExpose)
+ //return 0;
+
+ printf ("In NPP_HandleEvent for the plugin.\n");
+
+ return 1;
+}
+
+void
+NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData)
+{
+ return;
+}
+
+NPError
+NPP_GetValue(NPP instance, NPPVariable variable, void *value)
+{
+ return NPERR_GENERIC_ERROR;
+}
+
+NPError
+NPP_SetValue(NPP instance, NPNVariable variable, void *value)
+{
+ return NPERR_GENERIC_ERROR;
+}
diff --git a/src/plugin/plugin.h b/src/plugin/plugin.h
new file mode 100644
index 0000000..2f1d505
--- a/dev/null
+++ b/src/plugin/plugin.h
@@ -0,0 +1,29 @@
+#ifndef PLUGIN_H
+#define PLUGIN_H
+
+/*
+ * Based on Basic Plugin exmaple from Mozilla on-line at
+ * http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/BasicPlugin.h
+ */
+
+#include <npapi.h>
+#include <npupp.h>
+
+NPError NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
+NPError NP_Shutdown();
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+int32_t NPP_WriteReady(NPP instance, NPStream* stream);
+int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void NPP_Print(NPP instance, NPPrint* platformPrint);
+int16_t NPP_HandleEvent(NPP instance, void* event);
+void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
+
+#endif // PLUGIN_H
diff --git a/src/plugin/test.html b/src/plugin/test.html
new file mode 100644
index 0000000..ce35369
--- a/dev/null
+++ b/src/plugin/test.html
@@ -0,0 +1,17 @@
+<html>
+ <body>
+
+ <center><h1>Basic Plugin Example for Mozilla Test Case</h1></center>
+
+ This test case is to demonstrate the Basic Plugin example. You
+ should see the plugin window with the black frame aroung it and
+ the browser user agent string which plugin draws inside the
+ window.
+ <br><br>
+
+ <center>
+ <embed type="application/x-flumap" width=600 height=80>
+ </center>
+
+ </body>
+</html>

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.