ExamplePlugin in Spark 2.0.2?

Ok. I started out simple. I copied the Simple Plugin called ExamplePlugin from the “Developer Guide.” I built in and deployed it to the version of Spark that comes with the development kit. It deployed fine and printed “Welcome to Spark.”

When I deploy the same plugin to v 2.0.2 that I downloaded I get the error below. What needs to change for this to work work under 2.0.2? I tried using the jars that came with 2.0.2 instead of the ones that come with the development kit as well… but I get a similar message.

Oct 4, 2006 10:36:32 AM org.jivesoftware.spark.util.log.Log error

SEVERE:

java.lang.IllegalArgumentException: Provider must be an IQProvider or a Class instance.

at org.jivesoftware.smack.provider.ProviderManager.addIQProvider(ProviderManager.j ava:277)

at org.jivesoftware.spark.plugin.PluginClassLoader.loadSmackProvider(PluginClassLo ader.java:142)

at org.jivesoftware.spark.plugin.PluginClassLoader.checkForSmackProviders(PluginCl assLoader.java:102)

at org.jivesoftware.spark.plugin.PluginClassLoader.addPlugin(PluginClassLoader.jav a:87)

at org.jivesoftware.spark.PluginManager.loadPublicPlugins(PluginManager.java:495)

at org.jivesoftware.spark.PluginManager.loadPlugins(PluginManager.java:163)

at org.jivesoftware.spark.Workspace$4.finished(Workspace.java:259)

at org.jivesoftware.spark.util.SwingWorker$2$1.run(SwingWorker.java:139)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Oct 4, 2006 10:36:32 AM org.jivesoftware.spark.util.log.Log error

SEVERE: Unable to load plugin com.jivesoftware.spark.examples.ExamplePlugin.

java.lang.ClassCastException: com.jivesoftware.spark.examples.ExamplePlugin

at org.jivesoftware.spark.PluginManager.loadPublicPlugin(PluginManager.java:242)

at org.jivesoftware.spark.PluginManager.loadPublicPlugins(PluginManager.java:501)

at org.jivesoftware.spark.PluginManager.loadPlugins(PluginManager.java:163)

at org.jivesoftware.spark.Workspace$4.finished(Workspace.java:259)

at org.jivesoftware.spark.util.SwingWorker$2$1.run(SwingWorker.java:139)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

I am getting a little further. For one thing the Spark packages have changed from com.jivesoftware to org.jivesoftware. For another, I am finding that workspace.getWorkspacePane() method no longer exists.

Any plans to update your documents guys?

I got this working. Once I set up a dev environment in eclipse as opposed to using Notepad, it became a bit easier :8}. Anyways, this code adds a tab in version 2.0.2. The jivesoftware packages changed from being under com to org and getWorkspacePane() returns a SparkTabbedPane now.

Would be nice to have an updated development kit… but I am on my way now.

package com.bn.spark.plugins;

import java.awt.GridLayout;

import javax.swing.*;

import org.jivesoftware.spark.*;

import org.jivesoftware.spark.component.tabbedPane.SparkTabbedPane;

import org.jivesoftware.spark.plugin.Plugin;

public class Stats implements Plugin

{

private void addTabToSpark()

{

Workspace workspace = SparkManager.getWorkspace();

SparkTabbedPane tabbedPane = workspace.getWorkspacePane();

JPanel panel = new JPanel(false);

JLabel label = new JLabel(“Testing”);

panel.setLayout(new GridLayout(1, 1));

panel.add(label);

tabbedPane.addTab(“AHD Stats”, null, panel, “AHD Stats”);

}

public void initialize()

{

System.out.println(“Welcome To Spark”);

addTabToSpark();

}

Check out my reply to our last post.

http://www.jivesoftware.org/community/thread.jspa?threadID=22256&tstart=0

Just need to copy the new libs into your sparkplug kit directory.