public abstract class Kaa extends Object
Entry point to the Kaa library.
Responsible for the Kaa initialization and start/stop actions.
Contains abstract method createClient()
for AbstractKaaClient
concrete object creation. All manipulations using Kaa library should be
accessed through KaaClient
interface.
WARNING: Calling getClient()
without previously
initialized Kaa library (init()
) will return null and will
cause NullPointerException when attempting to use Kaa client functionality.
Available implementations can be found in Maven projects client-java-android and client-java-desktop
.
// Start Kaa
Kaa kaa = new SomeKaaImpl();
kaa.start();
// Stop Kaa:
kaa.stop();
// Accessing KaaClient:
KaaClient kaaClient = kaa.getClient();
...
}
KaaClient
,
AbstractKaaClient
Constructor and Description |
---|
Kaa() |
Modifier and Type | Method and Description |
---|---|
protected abstract AbstractKaaClient |
createClient()
Creates platform-specific
AbstractKaaClient object. |
KaaClient |
getClient()
Retrieves the Kaa client.
|
protected void |
init()
Initialize Kaa library.
|
void |
pause()
Pauses Kaa's workflow.
|
void |
resume()
Resumes Kaa's workflow.
|
void |
start()
Starts Kaa's workflow.
|
void |
stop()
Stops Kaa's workflow.
|
protected void init() throws Exception
Initialize Kaa library.
Each call forces KaaClient
to be reinitialized. All current
processes will be stopped and new client will be created using
createClient()
and start()
should be called as
client will not start automatically.
Exception
protected abstract AbstractKaaClient createClient() throws Exception
AbstractKaaClient
object.AbstractKaaClient
Exception
public void start() throws IOException, TransportException
Starts Kaa's workflow.
Should be called after each call to init()
.
IOException
TransportException
AbstractKaaClient.start()
public void stop()
AbstractKaaClient.stop()
public void pause()
public void resume()
Copyright © 2015. All rights reserved.