Package com.axway.apim.lib.utils
Class Utils
- java.lang.Object
-
- com.axway.apim.lib.utils.Utils
-
public class Utils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUtils.FedKeyType
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddCustomPropertiesForEntity(List<? extends CustomPropertiesEntity> entities, String json, CustomPropertiesFilter filter)static booleanaskYesNo(String question)static booleanaskYesNo(String question, String positive, String negative)static booleancompareValues(Object actualValue, Object desiredValue)static StringcreateFileName(String host, String stage, String prefix)static StringgetAPIDefinitionUriFromFile(String pathToAPIDefinition)static StringgetAPILogString(API api)static StringgetEncryptedPassword()static StringgetExternalPolicyName(String policy)static StringgetExternalPolicyName(String policy, Utils.FedKeyType keyType)static FilegetInstallFolder()static LonggetParsedDate(String date)static FilegetStageConfig(String stage, String stageConfig, File baseConfigFile)static StringhandleOpenAPIServerUrl(String serverUrl, String backendBasePath)static StringignoreBasePath(String serverUrl)static booleanisHttpUri(String pathToAPIDefinition)static FilelocateConfigFile(String configFileName)static voidprogressPercentage(int remain, int total, String prefix)static StringsubstituteVariables(File inputFile)This method is replacing variables such as ${TokenEndpoint} in the given file with declared variables coming from either the Environment-Variables or from system-properties.static voidvalidateCustomProperties(Map<String,String> customProperties, CustomProperties.Type type)
-
-
-
Method Detail
-
getAPIDefinitionUriFromFile
public static String getAPIDefinitionUriFromFile(String pathToAPIDefinition) throws AppException
- Throws:
AppException
-
progressPercentage
public static void progressPercentage(int remain, int total, String prefix)
-
askYesNo
public static boolean askYesNo(String question)
-
getExternalPolicyName
public static String getExternalPolicyName(String policy, Utils.FedKeyType keyType)
-
substituteVariables
public static String substituteVariables(File inputFile) throws IOException
This method is replacing variables such as ${TokenEndpoint} in the given file with declared variables coming from either the Environment-Variables or from system-properties.- Parameters:
inputFile- The API-Config file to be replaced and returned as String- Returns:
- a String representation of the API-Config-File
- Throws:
IOException- if the file can't be found
-
getStageConfig
public static File getStageConfig(String stage, String stageConfig, File baseConfigFile)
- Parameters:
stage- defines a stage which identifies a prod or qa environment.stageConfig- can be given to define the stage config file to be usedbaseConfigFile- the base configuration- Returns:
- the staged config file
-
locateConfigFile
public static File locateConfigFile(String configFileName) throws AppException
- Throws:
AppException
-
getInstallFolder
public static File getInstallFolder()
-
validateCustomProperties
public static void validateCustomProperties(Map<String,String> customProperties, CustomProperties.Type type) throws AppException
- Throws:
AppException
-
addCustomPropertiesForEntity
public static void addCustomPropertiesForEntity(List<? extends CustomPropertiesEntity> entities, String json, CustomPropertiesFilter filter) throws IOException
- Throws:
IOException
-
getParsedDate
public static Long getParsedDate(String date) throws AppException
- Throws:
AppException
-
isHttpUri
public static boolean isHttpUri(String pathToAPIDefinition)
-
handleOpenAPIServerUrl
public static String handleOpenAPIServerUrl(String serverUrl, String backendBasePath) throws MalformedURLException
- Throws:
MalformedURLException
-
getEncryptedPassword
public static String getEncryptedPassword()
-
createFileName
public static String createFileName(String host, String stage, String prefix) throws AppException
- Throws:
AppException
-
-