public class IFCRUtility extends Object
Modifier and Type | Class and Description |
---|---|
static class |
IFCRUtility.HttpStatusException
An exception for use when an HTTP request returns a non-2xx status code.
|
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
static String |
PUBLIC_IMPORT_MODE |
Constructor and Description |
---|
IFCRUtility(String repositoryUrl,
String username,
String password)
Constructs a utility for operating on the repository at the given URL.
|
Modifier and Type | Method and Description |
---|---|
static void |
close(OutputStream out)
Attempts to close the given output stream.
|
void |
copyNode(String src,
String dest)
Creates a copy of the specified source node at the specified
destination.
|
void |
deleteNode(String path)
Deletes the specified node.
|
void |
deployContent(String application,
String targetEnvironment)
Causes IFCR to deploy applicable content to the target environment.
|
String |
exportJsonString(String nodeUrl)
Returns a string with the JSON representation of the specified node and all of its descendants.
|
String |
exportJsonString(String nodeUrl,
String selector)
Returns a string with the JSON representation of the specified node and all of its descendants.
|
void |
exportMdexZip(String filePath,
String node)
Connects to the MDEXExportServlet and retrieves a zip file
|
void |
exportNode(String targetDirPath,
String configAbsPath)
Exports the contents of the given node into the given directory.
|
void |
exportNode(String directory,
String fileName,
String node)
Exports the contents of the given node into the given directory.
|
void |
exportXml(String filePath,
String node)
Exports the specified node and all of its descendants as JCR
system view XML.
|
void |
exportZip(String filePath,
String node)
Exports the specified node, and all its children, as a zip file.
|
String |
getUsername()
Method to retrieve username
|
org.apache.http.HttpResponse |
httpGet(String path)
Performs an HTTP GET request for the given resource (relative to the
repository root).
|
org.apache.http.HttpResponse |
httpGet(String path,
String params)
Performs an HTTP GET request for the given resource (relative to the
repository root).
|
org.apache.http.HttpResponse |
httpHead(String path)
Performs an HTTP HEAD request for the given resource (relative to the
repository root).
|
org.apache.http.HttpResponse |
httpPost(String path,
org.apache.http.HttpEntity entity)
Performs an HTTP POST request for the given resource (relative to the
repository root).
|
org.apache.http.HttpResponse |
httpPost(String path,
List<org.apache.http.NameValuePair> params)
Performs an HTTP POST request for the given resource (relative to the
repository root).
|
org.apache.http.HttpResponse |
httpPost(String path,
String... params)
Performs an HTTP POST request for the given resource (relative to the
repository root).
|
org.apache.http.HttpResponse |
httpPostDoNotConsume(String path,
String... params)
This works same way as
httpPost(String, String...) ,
but without consuming the HttpResponse. |
void |
importNode(String source,
String node,
String importMode,
boolean replace)
Imports the contents of the given directory or zip into the specified
node in the IFCR.
|
void |
importXml(String parentNode,
String nodeName,
String filePath)
Imports the node hierarchy described in the specified JCR system view
XML file into the IFCR.
|
void |
legacyExportContent(String configAbsPath,
boolean shouldExportRootNode,
String targetDirPath)
Deprecated.
|
void |
legacyExportContent(String configAbsPath,
String targetDirPath)
Deprecated.
|
void |
mdexPublish(String site)
Causes the IFCR to publish all applicable content from the
authoring environment to the authoring dgraphs for the
specified site.
|
void |
mdexPublish(String site,
boolean authoring)
Causes the IFCR to publish all applicable content from the
specified environment to the appropriate dgraphs for the
specified site.
|
void |
mdexPublish(String site,
boolean authoring,
String componentId)
Causes the IFCR to publish all applicable content from the
specified environment to the specified dgraph for the
specified site.
|
boolean |
nodeExists(String path)
Checks to see whether the specified node exists in the repository.
|
void |
promoteFromAuthoringToLive(String site)
Promotes the authoring environment of the specified site to be the
live environment.
|
void |
updateSearchTermExpansions(String node) |
static void |
writeDirectoryContents(String prefix,
File dir,
ZipOutputStream out)
Write the contents of the specified directory to the given stream.
|
public static final int BUFFER_SIZE
public static final String PUBLIC_IMPORT_MODE
public IFCRUtility(String repositoryUrl, String username, String password) throws AppConfigurationException
repositoryUrl
- The URL of the repositoryusername
- The username to use for authenticating to the IFCRpassword
- The password to use for authenticating to the IFCRAppConfigurationException
- If the given URL was not validpublic String getUsername()
public void copyNode(String src, String dest) throws IOException
src
- The path to the source nodedest
- The path to the destination nodeIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic boolean nodeExists(String path) throws IOException
path
- The path to the node, relative to the repository roottrue
if the node exists, false
if notIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic void deleteNode(String path) throws IOException
path
- The path to the node, relative to the repository rootIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic String exportJsonString(String nodeUrl, String selector) throws IOException
nodeUrl
- The path to the node, relative to the repository rootIOException
public String exportJsonString(String nodeUrl) throws IOException
nodeUrl
- The path to the node, relative to the repository rootIOException
public void exportZip(String filePath, String node) throws IOException
filePath
- The path on file to export to.node
- The node you want to export as a zip file.IOException
- Thrown when the node or its children could not be
written to disk in a zip file.public void exportXml(String filePath, String node) throws IOException
filePath
- The path of the file to write the export tonode
- The path to the node, relative to the repository rootIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic void exportMdexZip(String filePath, String node) throws IOException
filePath
- node
- IOException
public void importXml(String parentNode, String nodeName, String filePath) throws IOException
parentNode
- The path to the parent node for the import, relative
to the repository URL. This is the node that will end up having the
root node of the import as a child.nodeName
- The name of the root node of the importfilePath
- The file to importIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic void exportNode(String directory, String fileName, String node) throws IOException
directory
- The output directoryfileName
- The name of the zip file to write to disk.node
- The path to the node relative to the repository URLIOException
- If there is a problem reading from the IFCR or
writing to diskpublic void exportNode(String targetDirPath, String configAbsPath) throws IOException
targetDirPath
- The output directoryconfigAbsPath
- The path to the node relative to the repository URLIOException
- If there is a problem reading from the IFCR or
writing to disk@Deprecated public void legacyExportContent(String configAbsPath, String targetDirPath) throws IOException
targetDirPath
- The directory in which the exported content should be stored. If given directory doesn't
exists, it will be created. If the given directory exists, all of its content will be deleted.IOException
@Deprecated public void legacyExportContent(String configAbsPath, boolean shouldExportRootNode, String targetDirPath) throws IOException
targetDirPath
- The directory in which the exported content should be stored. If given directory doesn't
exists, it will be created.shouldExportRootNode
- When false, the content at given path is not exported, only the content under the given path is exported.
When true, the content at the given path is exported as well.IOException
public void deployContent(String application, String targetEnvironment) throws IOException
application
- The application to be deployedtargetEnvironment
- The targetEnvironment to be deployed. The possible values are "Authoring"
and "Live". Currently only "Authoring" environment is supported. For other than "Authoring", an
exception will be thrown.IOException
#httpPost(String, List)}
public void updateSearchTermExpansions(String node) throws IOException
IOException
public void importNode(String source, String node, String importMode, boolean replace) throws IOException
source
- The input directory or zipnode
- The path to the node relative to the repository URLIOException
- If there is a problem reading from disk or
uploading to the IFCRpublic static void writeDirectoryContents(String prefix, File dir, ZipOutputStream out) throws IOException
IOException
public void mdexPublish(String site) throws IOException
site
- The site to publishIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic void mdexPublish(String site, boolean authoring) throws IOException
site
- The site to publishauthoring
- Whether to publish content from the authoring
environment (as opposed to the live environment)IOException
- If there was a problem connecting to the
IFCR or performing the operationpublic void mdexPublish(String site, boolean authoring, String componentId) throws IOException
site
- The site to publishauthoring
- Whether to publish content from the authoring
environment (as opposed to the live environment)componentId
- The component ID of the dgraph to publish toIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic void promoteFromAuthoringToLive(String site) throws IOException
site
- The site to promoteIOException
- If there was a problem connecting to the
IFCR or performing the operationpublic org.apache.http.HttpResponse httpHead(String path) throws IOException
path
- The pathIOException
- If there was a problem connecting to the IFCRpublic org.apache.http.HttpResponse httpGet(String path) throws IOException
path
- The pathIOException
- If there was a problem connecting to the IFCRpublic org.apache.http.HttpResponse httpGet(String path, String params) throws IOException
path
- The pathparams
- The request parameters to use in the request. For example, name=valueIOException
- If there was a problem connecting to the IFCRpublic org.apache.http.HttpResponse httpPost(String path, List<org.apache.http.NameValuePair> params) throws IOException
path
- The pathparams
- A list of parameters to include on the requestIOException
- If there was a problem connecting to the IFCRpublic org.apache.http.HttpResponse httpPost(String path, String... params) throws IOException
path
- The pathparams
- A list of parameters to include on the requestIOException
- If there was a problem connecting to the IFCRpublic org.apache.http.HttpResponse httpPost(String path, org.apache.http.HttpEntity entity) throws IOException
path
- The pathentity
- The entity to include on the POST requestIOException
- If there was a problem connecting to the IFCRpublic org.apache.http.HttpResponse httpPostDoNotConsume(String path, String... params) throws IOException
httpPost(String, String...)
,
but without consuming the HttpResponse. The caller should be responsible
for closing the stream.IOException
public static void close(OutputStream out)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.