How to run example plugin (SearchMe.java)?

Hi Guys,

i try to run the plugin example…anyone able to run it?

i am running spark 2.0.2 and Sparkplug Kit 1.1.0?

do they have the same library?because spark is running org and Sparkplug Kit is running com…

i had compiled SearchMe.java succesfuly, so i do have the class.

and my jar contains 2 files which are

lib\plugin-classes.jar --> com\jivesoftware\spark\examples\SearchMe.class

and

plugin.xml

i have this error and the plugin menu is gone…

Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: com/jivesoftware/spark/search/Searchable

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.access$100(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

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)

my plugin.xml is

please assist me

regards

Welly

Message was edited by: welly

Message was edited by: welly

The Sparkplug dev kit doesn’'t work for 2.0.1

You have to copy over the libraries and spark.jar from your Spark directory into the spark directory in the Sparkplug dev kit.

So copy over the Spark\lib directory into your spark\lib of the sparkplug kit directory, which if I think is sparkplug\spark\lib.

Thanks Cyclone.

i just tried it , copy the library to sparkplugs.ya i can compile the code after i edit these lines in SearchMe.java

from

package com.jivesoftware.spark.examples;

import com.jivesoftware.spark.search.Searchable;

import com.jivesoftware.spark.SparkManager;

import com.jivesoftware.resource.LaRes;

return LaRes.getImageIcon(LaRes.SMALL_AGENT_IMAGE);

to

package org.jivesoftware.spark.examples;

import org.jivesoftware.spark.search.Searchable;

import org.jivesoftware.spark.SparkManager;

import org.jivesoftware.resource.SparkRes;

return SparkRes.getImageIcon(SparkRes.SMALL_AGENT_IMAGE);

i can compile it.

You are a life saver

and i am closer now

Do you mind telling me which class or method should i use to get the transcriptwindow content (i mean the message)

by the way, do you have a plugin that send chat transcript or history to http server when the chat ended or triggered by some button?

i am trying to do this plugin…, is it difficult?

thanks a zillion

Regards

Welly

Message was edited by: welly

Message was edited by: welly

I don’‘t have a specific plugin that would do what you’‘re looking to do, but I don’'t think it would be that hard to do.

Just create a MessageListener that will take messages and send them via HTTP to your HTTP server.

Let me know if you need some examples or help with this. Wouldn’'t mind at all.

hi Cyclone,

Glad to hear that

you are the best…

i am a newbie in java

i wanna ask u about this

i wanna add a button in the toolbar or chatwindow, but there are two size of chat window,

first is i chat via spark to spark --> smaller

second is fastpath ( spark chat with customer in the web) --> bigger,

public void chatRoomOpened(final ChatRoom room) {

if(room.getToolBar().getHeight() > 42){

button = new ChatRoomButton(“CRM”,SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24));

}else{

button = new ChatRoomButton(SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24));

}

button.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

TranscriptWindow transwin = new TranscriptWindow();

transwin = room.getTranscriptWindow();

JOptionPane.showMessageDialog(null, transwin.getText());

}

});

room.getToolBar().addChatRoomButton(button);

}

somehow room.getToolBar().getHeight() always return me 0 but if i put the code inside actionlistener of the button, it will return me 60 and 42.

i think, the code is called before the chat windw is initialized.

is there any way to delay until the height is initialized?

any solution?

regards

Welly

It is trying to get the size before the Component is created.

I would say to use public void chatRoomActivated(ChatRoom room) { }

but there is no event being fired.

It is a quick easy fix and I’'ll let someone know.

hi cyclone,

yeah, i tried this event but no event being fired…

so, there is nothing we can do now?

and i want to ask about this method of UserManager

getAllParticipantsInRoom(ChatRoom chatRoom)

Returns a Collection of all ChatUsers in a ChatRoom.

this is my code portion

UserManager userManager = SparkManager.getUserManager();

but the value of userManager.getAllParticipantsInRoom(room).size() always 0?

any idea?

sorry for all the questions each day :stuck_out_tongue:

thanks

Welly

Message was edited by: welly