public class OsgiConsoleClient extends SlingClient
SlingClient.Builder, SlingClient.InternalBuilder<T extends SlingClient>| Modifier and Type | Field and Description |
|---|---|
static String |
JSON_KEY_DATA |
static String |
JSON_KEY_ID |
static String |
JSON_KEY_STATE |
static String |
JSON_KEY_VERSION |
DEFAULT_NODE_TYPE| Constructor and Description |
|---|
OsgiConsoleClient(org.apache.http.impl.client.CloseableHttpClient http,
SlingClientConfig config)
Constructor used by adaptTo() and InternalBuilder classes.
|
OsgiConsoleClient(URI serverUrl,
String userName,
String password)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkBundleInstalled(String symbolicName,
int waitTime,
int retries)
Deprecated.
does not respect polling practices; use
waitBundleInstalled(String, long, long) instead |
SlingHttpResponse |
deleteConfiguration(String pid,
int... expectedStatus)
Delete the config referenced by the PID
|
String |
editConfiguration(String PID,
String factoryPID,
Map<String,Object> configProperties,
int... expectedStatus)
Sets properties of a config referenced by its PID.
|
String |
editConfigurationWithWait(int waitCount,
String PID,
String factoryPID,
Map<String,Object> configProperties,
int... expectedStatus)
Deprecated.
|
long |
getBundleId(String symbolicName)
Get the id of the bundle
|
BundleInfo |
getBundleInfo(String id,
int... expectedStatus)
Returns the wrapper for the bundle info json
|
BundlesInfo |
getBundlesInfo(int... expectedStatus)
Returns the wrapper for the bundles info json
|
String |
getBundleState(String symbolicName)
Get the state of the bundle
|
static String |
getBundleSymbolicName(File bundleFile)
Get the symbolic name from a bundle file by looking at the manifest
|
String |
getBundleVersion(String symbolicName)
Get the version of the bundle
|
static String |
getBundleVersionFromFile(File bundleFile)
Get the version form a bundle file by looking at the manifest
|
ComponentInfo |
getComponentInfo(String id,
int expectedStatus)
Returns the wrapper for the component info json
|
ComponentsInfo |
getComponentsInfo(int... expectedStatus)
Returns the wrapper for the components info json
|
Map<String,Object> |
getConfiguration(String pid,
int... expectedStatus)
Returns a map of all properties set for the config referenced by the PID, where the map keys
are the property names.
|
Map<String,Object> |
getConfigurationWithWait(long waitCount,
String pid,
int... expectedStatus)
Deprecated.
|
SlingHttpResponse |
installBundle(File f,
boolean startBundle)
Install a bundle using the Felix webconsole HTTP interface
|
SlingHttpResponse |
installBundle(File f,
boolean startBundle,
int startLevel)
Install a bundle using the Felix webconsole HTTP interface, with a specific start level
|
boolean |
installBundleWithRetry(File f,
boolean startBundle,
int startLevel,
int waitTime,
int retries)
|
void |
refreshPackages()
Calls PackageAdmin.refreshPackages to force re-wiring of all the bundles.
|
void |
startBundle(String symbolicName)
Starts a bundle
|
void |
startBundlewithWait(String symbolicName,
int waitTime,
int retries)
Deprecated.
|
SlingHttpResponse |
uninstallBundle(String symbolicName)
Uninstall a bundle
|
void |
waitBundleInstalled(String symbolicName,
long timeout,
long delay) |
String |
waitEditConfiguration(long timeout,
String PID,
String factoryPID,
Map<String,Object> configProperties,
int... expectedStatus)
Sets properties of a config referenced by its PID.
|
Map<String,Object> |
waitGetConfiguration(long timeout,
String pid,
int... expectedStatus)
Returns a map of all properties set for the config referenced by the PID, where the map keys
are the property names.
|
void |
waitInstallBundle(File f,
boolean startBundle,
int startLevel,
long timeout,
long delay)
Install a bundle using the Felix webconsole HTTP interface and wait for it to be installed
|
void |
waitStartBundle(String symbolicName,
long timeout,
long delay)
Starts a bundle and waits for it to be started
|
createFolder, createNode, createNodeRecursive, deletePath, doGetJson, exists, getJsonNode, getJsonNode, getNodeNameFromPath, getParentPath, getUUId, getUUID, move, setPropertiesString, setPropertyString, setPropertyStringArray, upload, waitExists, waitUntilExistsadaptTo, addValue, close, doDelete, doGet, doGet, doGet, doHead, doPatch, doPost, doPost, doPut, doRawRequest, doRequest, doStreamGet, doStreamPost, doStreamRequest, execute, execute, execute, execute, execute, execute, execute, execute, getClientId, getConnectionManager, getCookieStore, getCredentialsProvider, getParams, getPassword, getPath, getPath, getUrl, getUrl, getUrl, getUser, getValue, getValues, hasValuepublic static final String JSON_KEY_ID
public static final String JSON_KEY_VERSION
public static final String JSON_KEY_DATA
public static final String JSON_KEY_STATE
public OsgiConsoleClient(URI serverUrl, String userName, String password) throws ClientException
SlingClient.SlingClient(URI, String, String)serverUrl - the URL to the server under testuserName - the user name used for authenticationpassword - the password for this userClientException - if the client cannot be instantiatedpublic OsgiConsoleClient(org.apache.http.impl.client.CloseableHttpClient http,
SlingClientConfig config)
throws ClientException
http - http client to be used for requestsconfig - sling specific configsClientException - if the client cannot be instantiatedpublic BundlesInfo getBundlesInfo(int... expectedStatus) throws ClientException
expectedStatus - list of accepted statuses of the responseClientException - if the response status does not match any of the expectedStatuspublic BundleInfo getBundleInfo(String id, int... expectedStatus) throws ClientException
id - the id of the bundleexpectedStatus - list of accepted statuses of the responseClientException - if the response status does not match any of the expectedStatuspublic ComponentsInfo getComponentsInfo(int... expectedStatus) throws ClientException
expectedStatus - list of accepted statuses of the responseClientException - if the response status does not match any of the expectedStatuspublic ComponentInfo getComponentInfo(String id, int expectedStatus) throws ClientException
id - the id of the componentexpectedStatus - list of accepted statuses of the responseClientException - if the response status does not match any of the expectedStatuspublic Map<String,Object> getConfiguration(String pid, int... expectedStatus) throws ClientException
pid - the pid of the configurationexpectedStatus - list of accepted statuses of the responseClientException - if the response status does not match any of the expectedStatus@Deprecated public Map<String,Object> getConfigurationWithWait(long waitCount, String pid, int... expectedStatus) throws ClientException, InterruptedException
waitGetConfiguration(long, String, int...)waitCount - The number of maximum wait intervals of 500ms.
Between each wait interval, the method polls the backend to see if the configuration ahs been set.pid - pidexpectedStatus - expected response statusClientException - if the response status does not match any of the expectedStatusInterruptedException - to mark this operation as "waiting"public Map<String,Object> waitGetConfiguration(long timeout, String pid, int... expectedStatus) throws ClientException, InterruptedException, TimeoutException
timeout - Maximum time to wait for the configuration to be available, in ms.pid - service pidexpectedStatus - expected response statusClientException - if the response status does not match any of the expectedStatusInterruptedException - to mark this operation as "waiting"TimeoutException - if the timeout was reachedpublic String editConfiguration(String PID, String factoryPID, Map<String,Object> configProperties, int... expectedStatus) throws ClientException
PID - Persistent identity stringfactoryPID - Factory persistent identity string or nullconfigProperties - map of propertiesexpectedStatus - expected response statusClientException - if the response status does not match any of the expectedStatus@Deprecated public String editConfigurationWithWait(int waitCount, String PID, String factoryPID, Map<String,Object> configProperties, int... expectedStatus) throws ClientException, InterruptedException
waitEditConfiguration(long, String, String, Map, int...)waitCount - The number of maximum wait intervals of 500ms.
Between each wait interval, the method polls the backend to see if the configuration ahs been set.PID - Persistent identity stringfactoryPID - Factory persistent identity string or nullconfigProperties - map of propertiesexpectedStatus - expected response statusClientException - if the response status does not match any of the expectedStatusInterruptedException - to mark this operation as "waiting"public String waitEditConfiguration(long timeout, String PID, String factoryPID, Map<String,Object> configProperties, int... expectedStatus) throws ClientException, InterruptedException, TimeoutException
timeout - Max time to wait for the configuration to be set, in msPID - Persistent identity stringfactoryPID - Factory persistent identity string or nullconfigProperties - map of propertiesexpectedStatus - expected response statusClientException - if the response status does not match any of the expectedStatusInterruptedException - to mark this operation as "waiting"TimeoutException - if the timeout was reachedpublic SlingHttpResponse deleteConfiguration(String pid, int... expectedStatus) throws ClientException
pid - pidexpectedStatus - expected response statusClientException - if the response status does not match any of the expectedStatuspublic SlingHttpResponse uninstallBundle(String symbolicName) throws ClientException
symbolicName - bundle symbolic nameClientExceptionpublic SlingHttpResponse installBundle(File f, boolean startBundle) throws ClientException
f - the bundle filestartBundle - whether to start the bundle or notClientExceptionpublic SlingHttpResponse installBundle(File f, boolean startBundle, int startLevel) throws ClientException
f - bundle filestartBundle - whether to start or just install the bundlestartLevel - start levelClientException - if the request failed@Deprecated public boolean checkBundleInstalled(String symbolicName, int waitTime, int retries) throws InterruptedException
waitBundleInstalled(String, long, long) insteadsymbolicName - the name of the bundlewaitTime - How many milliseconds to wait between retriesretries - the number of retriesInterruptedException@Deprecated public boolean installBundleWithRetry(File f, boolean startBundle, int startLevel, int waitTime, int retries) throws ClientException, InterruptedException
f - the bundle filestartBundle - whether to start the bundle or notstartLevel - the start level of the bundle. negative values mean default start levelwaitTime - how long to wait between retries of checking the bundleretries - how many times to check for the bundle to be installed, until giving upClientExceptionInterruptedExceptionpublic void waitInstallBundle(File f, boolean startBundle, int startLevel, long timeout, long delay) throws ClientException, InterruptedException, TimeoutException
f - the bundle filestartBundle - whether to start the bundle or notstartLevel - the start level of the bundle. negative values mean default start leveltimeout - how much to wait for the bundle to be installed before throwing a TimeoutExceptiondelay - time to wait between checks of the stateClientExceptionTimeoutException - if the bundle did not install before timeout was reachedInterruptedExceptionpublic void waitBundleInstalled(String symbolicName, long timeout, long delay) throws TimeoutException, InterruptedException
TimeoutExceptionInterruptedExceptionpublic long getBundleId(String symbolicName) throws ClientException
symbolicName - bundle symbolic nameClientException - if the id cannot be retrievedpublic String getBundleVersion(String symbolicName) throws ClientException
symbolicName - bundle symbolic nameClientExceptionpublic String getBundleState(String symbolicName) throws ClientException
symbolicName - bundle symbolic nameClientException - if the state cannot be retrievedpublic void startBundle(String symbolicName) throws ClientException
symbolicName - the name of the bundleClientException@Deprecated public void startBundlewithWait(String symbolicName, int waitTime, int retries) throws ClientException, InterruptedException
waitStartBundle(String, long, long)symbolicName - the name of the bundlewaitTime - How many milliseconds to wait between retriesretries - the number of retriesClientException, - InterruptedExceptionClientExceptionInterruptedExceptionpublic void waitStartBundle(String symbolicName, long timeout, long delay) throws ClientException, InterruptedException, TimeoutException
symbolicName - the name of the bundletimeout - max time to wait for the bundle to start, in msdelay - time to wait between status checks, in msClientException, - InterruptedException, TimeoutExceptionClientExceptionInterruptedExceptionTimeoutExceptionpublic void refreshPackages()
throws ClientException
ClientExceptionpublic static String getBundleSymbolicName(File bundleFile) throws IOException
bundleFile - bundle fileIOExceptionpublic static String getBundleVersionFromFile(File bundleFile) throws IOException
bundleFile - bundle fileIOExceptionCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.