Access to connected clients in a QuickServer from a CommandPlugin in QSAdmin

47 views
Skip to first unread message

Jarl

unread,
Oct 19, 2012, 4:25:49 PM10/19/12
to quick...@googlegroups.com
Hi

I have seen the need to add custom commands to the admin server. But I need to iterate the connected clients of the server.

I have looked into the source and the controlServer is not passed into the QuickServer admin instance.

Instead this controlServer field is only used inside the QSAdminServer class that creates the actual admin QuickServer object.

I really need access to the control server from the admin server. So getControlServer and setControlServer methods would be nice to have in the QuickServer class.

Of course, for normal servers this will be "this" or even null.

What do you think about this?

Jarl

Akshath

unread,
Oct 20, 2012, 2:41:13 AM10/20/12
to quick...@googlegroups.com
To add your own custom commands to admin server you need to implement "org.quickserver.net.qsadmin.CommandPlugin" and set the same in XML (quickserver\qsadmin-server\command-plugin).

From with-in your CommandPlugin you can access the base server (server you like to control) using 

QuickServer mainqs= (QuickServer) handler.getServer().getStoreObjects()[0];

Check out the ftpserver example provided with the distribution. 

Jarl André Hübenthal

unread,
Oct 20, 2012, 10:50:26 AM10/20/12
to quick...@googlegroups.com

But as an experienced software developer that uses this tool for the sake of simplicity its a nasty hack and unreadable to access an object Array and cast the first element.  Couldn’t yiu add a get Base Server method in quickserver that will throw a runtime Exception if used by the base server? It should in other words only be used by the admin server. A better way is to extend quickserver for the admin server so that the get base server method is only in the extending class. For ex QuickserverAdmin.

Jarl

--
You received this message because you are subscribed to the Google Groups "quickserver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/quickserver/-/SLVIeRao5l8J.
To post to this group, send email to quick...@googlegroups.com.
To unsubscribe from this group, send email to quickserver...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/quickserver?hl=en.

Akshath

unread,
Oct 27, 2012, 4:16:30 AM10/27/12
to quick...@googlegroups.com
good point.. shall add this in future release.
Reply all
Reply to author
Forward
0 new messages