Class PolicyExport
- java.lang.Object
-
- com.sun.identity.cli.CLICommandBase
-
- com.sun.identity.cli.AuthenticatedCommand
-
- org.forgerock.openam.cli.entitlement.PolicyExport
-
- All Implemented Interfaces:
CLICommand
public final class PolicyExport extends AuthenticatedCommand
Exports policy model resources into a JSON file.- Since:
- 14.0.0
-
-
Field Summary
-
Fields inherited from class com.sun.identity.cli.AuthenticatedCommand
ssoToken
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PolicyExport(org.forgerock.http.Client client)
Constructs a new json resource command.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handleRequest(RequestContext request)
Authenticates the administrator.void
handleResourceRequest(RequestContext request)
Handles the passed request.protected String
objectToJsonString(Object object)
Given an object, converts it to a well formatted json representation.protected org.forgerock.json.JsonValue
readJsonFile(String jsonFile)
Reads in a json file.protected org.forgerock.http.protocol.Response
sendRequest(org.forgerock.http.protocol.Request request, String endpoint)
Sends the given request to the passed endpoint.protected void
writeJsonFile(org.forgerock.json.JsonValue jsonValue, String jsonFile)
Writes out json to file.-
Methods inherited from class com.sun.identity.cli.AuthenticatedCommand
getAdminID, getAdminPassword, getAdminSSOToken, ldapLogin, processFileAttributes, writeLog
-
Methods inherited from class com.sun.identity.cli.CLICommandBase
debugError, debugError, debugMessage, debugWarning, getCommandManager, getOutputWriter, getResourceString, getStringOptionValue, getStringOptionValue, isOptionSet, isVerbose, tokenize
-
-
-
-
Method Detail
-
handleResourceRequest
public void handleResourceRequest(RequestContext request) throws CLIException
Handles the passed request.- Parameters:
request
- the command request- Throws:
CLIException
- should some error occur
-
handleRequest
public final void handleRequest(RequestContext request) throws CLIException
Description copied from class:AuthenticatedCommand
Authenticates the administrator. Dervived classes needs to call this method from the dervived method,handleRequest(RequestContext rc)
. Override this method to get user name and passowrd.- Specified by:
handleRequest
in interfaceCLICommand
- Overrides:
handleRequest
in classAuthenticatedCommand
- Parameters:
request
- Request Context.- Throws:
CLIException
- if authentication fails.
-
sendRequest
protected final org.forgerock.http.protocol.Response sendRequest(org.forgerock.http.protocol.Request request, String endpoint) throws CLIException
Sends the given request to the passed endpoint.- Parameters:
request
- http requestendpoint
- endpoint- Returns:
- http response
- Throws:
CLIException
- should some error occur
-
readJsonFile
protected final org.forgerock.json.JsonValue readJsonFile(String jsonFile) throws CLIException
Reads in a json file.- Parameters:
jsonFile
- the path to the json file- Returns:
- the json representation
- Throws:
CLIException
- should some error occur
-
writeJsonFile
protected final void writeJsonFile(org.forgerock.json.JsonValue jsonValue, String jsonFile) throws CLIException
Writes out json to file.- Parameters:
jsonValue
- the json to be written outjsonFile
- the path to the json file- Throws:
CLIException
- should some error occur
-
objectToJsonString
protected final String objectToJsonString(Object object) throws CLIException
Given an object, converts it to a well formatted json representation.- Parameters:
object
- object- Returns:
- json representation
- Throws:
CLIException
- should some error occur during the transformation to json
-
-