Class HubRunner
start()
method must be called to start it up.
The main(java.lang.String[])
method can be used to launch a hub from
the command line. Use the -help
flag for more information.
- Since:
- 15 Jul 2008
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionHubRunner
(SampXmlRpcClientFactory xClientFactory, SampXmlRpcServerFactory xServerFactory, HubService hub, File lockfile) Deprecated.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Deprecated.Attempts to determine whether an external hub can be started usingrunExternalHub(org.astrogrid.samp.xmlrpc.HubMode)
.Deprecated.Used to generate the registration password.getHub()
Deprecated.Returns the HubService object used by this runner.Deprecated.Returns the lockfile information associated with this object.static void
Deprecated.Main method.Deprecated.Returns an HTTP URL at which the lockfile for this hub can be found.static void
runExternalHub
(HubMode hubMode) Deprecated.Static method which will attempt to start a hub running in an external JVM.static HubRunner
Deprecated.Static method which may be used to start a SAMP hub programmatically.static HubRunner
Deprecated.Static method which may be used to start a SAMP hub programmatically, with a supplied samp.secret string.static int
Deprecated.Does the work for running themain(java.lang.String[])
method.void
shutdown()
Deprecated.Shuts down the hub and tidies up.void
start()
Deprecated.Starts the hub and writes the lockfile.
-
Constructor Details
-
HubRunner
public HubRunner(SampXmlRpcClientFactory xClientFactory, SampXmlRpcServerFactory xServerFactory, HubService hub, File lockfile) Deprecated.Constructor. If the suppliedlockfile
is null, no lockfile will be written at hub startup.- Parameters:
xClientFactory
- XML-RPC client factory implementationxServerFactory
- XML-RPC server implementationhub
- object providing hub serviceslockfile
- location to use for hub lockfile, or null
-
-
Method Details
-
start
Deprecated.Starts the hub and writes the lockfile.- Throws:
IOException
- if a hub is already running or an error occurs
-
shutdown
public void shutdown()Deprecated.Shuts down the hub and tidies up. May harmlessly be called multiple times. -
getHub
Deprecated.Returns the HubService object used by this runner.- Returns:
- hub service
-
getLockInfo
Deprecated.Returns the lockfile information associated with this object. Only present afterstart()
has been called.- Returns:
- lock info
-
publishLockfile
Deprecated.Returns an HTTP URL at which the lockfile for this hub can be found. The first call to this method causes the lockfile to be published in this way; subsequent calls return the same value.Use this with care; publishing your lockfile means that other people can connect to your hub and potentially do disruptive things.
- Returns:
- lockfile information URL
- Throws:
IOException
-
createSecret
Deprecated.Used to generate the registration password. May be overridden.- Returns:
- pasword
-
main
Deprecated.Main method. Starts a hub. Use "-help" flag for more information.- Parameters:
args
- command-line arguments- Throws:
IOException
-
runMain
Deprecated.Does the work for running themain(java.lang.String[])
method. System.exit() is not called from this method. Use "-help" flag for more information.- Parameters:
args
- command-line arguments- Returns:
- 0 means success, non-zero means error status
- Throws:
IOException
-
runHub
Deprecated.Static method which may be used to start a SAMP hub programmatically. The returned hub is running (start
has been called).If the hub mode corresponds to one of the GUI options, one of two things will happen. An attempt will be made to install an icon in the "system tray"; if this is successful, the attached popup menu will provide options for displaying the hub window and for shutting it down. If no system tray is available, the hub window will be posted directly, and the hub will shut down when this window is closed. System tray functionality is only available when running under Java 1.6 or later, and when using a suitable display manager.
- Parameters:
hubMode
- hub modexmlrpc
- XML-RPC implementation; automatically determined if null- Returns:
- running hub
- Throws:
IOException
-
runHub
public static HubRunner runHub(HubMode hubMode, XmlRpcKit xmlrpc, String secret, File lockfile) throws IOException Deprecated.Static method which may be used to start a SAMP hub programmatically, with a supplied samp.secret string. The returned hub is running (start
has been called).If the hub mode corresponds to one of the GUI options, one of two things will happen. An attempt will be made to install an icon in the "system tray"; if this is successful, the attached popup menu will provide options for displaying the hub window and for shutting it down. If no system tray is available, the hub window will be posted directly, and the hub will shut down when this window is closed. System tray functionality is only available when running under Java 1.6 or later, and when using a suitable display manager.
- Parameters:
hubMode
- hub modexmlrpc
- XML-RPC implementation; automatically determined if nullsecret
- samp.secret string to be used for hub connection; chosen at random if nulllockfile
- location of lockfile to write, or null for lock to be provided by HTTP- Returns:
- running hub
- Throws:
IOException
-
runExternalHub
Deprecated.Static method which will attempt to start a hub running in an external JVM. The resulting hub can therefore outlast the lifetime of the current application. Because of the OS interaction required, it's hard to make this bulletproof, and it may fail without an exception, but we do our best.- Parameters:
hubMode
- hub mode- Throws:
IOException
- See Also:
-
checkExternalHubAvailability
Deprecated.Attempts to determine whether an external hub can be started usingrunExternalHub(org.astrogrid.samp.xmlrpc.HubMode)
. If it can be determined that such an attempt would fail, this method will throw an exception with an informative message. This method succeeding is not a guarantee that an external hub can be started successfullly. The behaviour of this method is not expected to change over the lifetime of a given JVM.- Throws:
IOException
-
Hub
instead