Package com.eka.middleware.service
Class ServiceUtils
java.lang.Object
com.eka.middleware.service.ServiceUtils
-
Field Summary
Modifier and TypeFieldDescriptionstatic org.apache.logging.log4j.Logger
static final com.fasterxml.jackson.dataformat.xml.XmlMapper
static final com.fasterxml.jackson.dataformat.yaml.YAMLMapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Date
addHoursToDate
(Date date, int hours) static void
afterServiceExecution
(DataPipeline dp, String fqn, Map<String, Object> passThroughData) static boolean
areBracesBalanced
(String input) static void
beforeServiceExecution
(DataPipeline dp, String fqn, Map<String, Object> passThroughData) static void
clearSession
(io.undertow.server.HttpServerExchange exchange) static final void
compileJavaCode
(String fqn, DataPipeline dataPipeLine) static byte[]
compress
(byte[] data) static Object
convertPolyglotValue
(org.graalvm.polyglot.Value value) static void
copyDirectory
(String sourceDirectoryLocation, String destinationDirectoryLocation) static byte[]
deCompress
(byte[] data) static String
static final String
deleteURLAlias
(String alias, DataPipeline dp) static String
static final void
execute
(String fqn, DataPipeline dataPipeLine) static final void
executeEmbeddedService
(DataPipeline dataPipeline, String apiServiceJson) extractHeaders
(io.undertow.server.HttpServerExchange exchange) static com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata
fetchMetadata
(String discoveryUrl, com.nimbusds.jose.JWSAlgorithm jwsAlgo) static final String
generateUUID
(String msg) static byte[]
getBody
(DataPipeline dataPipeLine) static final InputStream
getBodyAsStream
(DataPipeline dataPipeLine) static Object
getCaseInsensitiveKey
(Map<String, Object> map, String key) static final URL[]
getClassesURLs
(String path) static AuthAccount
getCurrentLoggedInAuthAccount
(io.undertow.server.HttpServerExchange exchange) static org.pac4j.core.profile.UserProfile
getCurrentLoggedInUserProfile
(io.undertow.server.HttpServerExchange exchange) static Object
static final String
getFormattedLogLine
(String id, String resource, String info) getFormattedLogMap
(String id, String resource, String info) static final String[]
getJarPaths
(String path, String packagePath) static SecretKeySpec
static final MultiPart
getMultiPart
(DataPipeline dataPipeLine) static final String
static String
static final String
getServerProperty
(String key) static String
getTenantName
(io.undertow.server.handlers.Cookie cookie) static String
getToken
(io.undertow.server.handlers.Cookie cookie) static final String
getURLAlias
(String fqn, Tenant tenant) static String
initNewTenant
(String name, AuthAccount account, String password) static boolean
isApiCall
(io.undertow.server.HttpServerExchange exchange) static boolean
isMac()
static final boolean
isPublicFolder
(String path) static boolean
static boolean
isUnix()
static boolean
static boolean
static void
loadCustomJar
(DataPipeline dp, String path) static void
loadCustomJar
(DataPipeline dp, String packageName, String jarFileName) static void
static void
manipulateHeaders
(io.undertow.server.HttpServerExchange exchange) static String
static String
normalizeApiPathName
(String method, String s) static String
static final String
objectToJson
(Object object) static final void
printException
(DataPipeline dp, String msg, Exception e) static final void
printException
(Tenant tenant, String msg, Exception e) static final void
printException
(String msg, Exception e) static final byte[]
readAllBytes
(File file) static void
redirectRequest
(io.undertow.server.HttpServerExchange exchange, String path) static final String
registerURLAlias
(String fqn, String alias, DataPipeline dp) static String
replaceAllIgnoreRegx
(String source, String search, String replace) static void
saveServerProperties
(DataPipeline dataPipeline) searchEndpoints
(String keyword, Tenant tenant) static io.undertow.server.handlers.Cookie
setupCookie
(io.undertow.server.HttpServerExchange exchange, String tenantName, String token) static String
setupRequestPath
(io.undertow.server.HttpServerExchange exchange) static final void
startStreaming
(RuntimePipeline rp, MultiPart mp) static void
startTenantServices
(String tenant) static final String
static final String
static final String
toPrettyJson
(Map<String, Object> map) static String
toServiceSlug
(String str) static final String
static final String
static void
unzipBuildFile
(String srcZip, String destinationBasePath) static final String
xmlToString
(Object o, String rootName) static void
zipFile
(File fileToZip, String fileName, ZipOutputStream zipOut)
-
Field Details
-
xmlMapper
public static final com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper -
yamlMapper
public static final com.fasterxml.jackson.dataformat.yaml.YAMLMapper yamlMapper -
LOGGER
public static org.apache.logging.log4j.Logger LOGGER
-
-
Constructor Details
-
ServiceUtils
public ServiceUtils()
-
-
Method Details
-
isWindows
public static boolean isWindows() -
searchEndpoints
-
isMac
public static boolean isMac() -
isUnix
public static boolean isUnix() -
isSolaris
public static boolean isSolaris() -
getSeparator
- Throws:
Exception
-
generateUUID
-
toJson
- Throws:
Exception
-
convertPolyglotValue
-
toJson
-
toPrettyJson
- Throws:
Exception
-
objectToJson
- Throws:
Exception
-
readAllBytes
- Throws:
Exception
-
jsonToMap
-
toYaml
- Throws:
Exception
-
yamlToMap
-
xmlToString
- Throws:
Exception
-
toXml
- Throws:
Exception
-
xmlToMap
-
getExceptionMap
-
execute
- Throws:
SnippetException
-
executeEmbeddedService
public static final void executeEmbeddedService(DataPipeline dataPipeline, String apiServiceJson) throws SnippetException - Throws:
SnippetException
-
isPublicFolder
-
compileJavaCode
public static final void compileJavaCode(String fqn, DataPipeline dataPipeLine) throws SnippetException - Throws:
SnippetException
-
printException
-
printException
-
printException
-
getServerProperty
-
compress
public static byte[] compress(byte[] data) -
deCompress
- Throws:
DataFormatException
-
getPathService
-
extractHeaders
-
getFormattedLogLine
-
getFormattedLogMap
-
getMultiPart
- Throws:
SnippetException
-
getURLAlias
- Throws:
Exception
-
registerURLAlias
public static final String registerURLAlias(String fqn, String alias, DataPipeline dp) throws Exception - Throws:
Exception
-
deleteURLAlias
- Throws:
Exception
-
areBracesBalanced
-
startStreaming
- Throws:
SnippetException
-
getBody
- Throws:
SnippetException
-
getBodyAsStream
- Throws:
SnippetException
-
copyDirectory
public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException - Throws:
IOException
-
setupRequestPath
-
manipulateHeaders
public static void manipulateHeaders(io.undertow.server.HttpServerExchange exchange) -
setupCookie
-
clearSession
public static void clearSession(io.undertow.server.HttpServerExchange exchange) -
getToken
-
getTenantName
-
initNewTenant
-
startTenantServices
- Throws:
SnippetException
-
getClassesURLs
- Throws:
Exception
-
getCurrentLoggedInUserProfile
public static org.pac4j.core.profile.UserProfile getCurrentLoggedInUserProfile(io.undertow.server.HttpServerExchange exchange) throws SnippetException - Throws:
SnippetException
-
getCurrentLoggedInAuthAccount
public static AuthAccount getCurrentLoggedInAuthAccount(io.undertow.server.HttpServerExchange exchange) throws SnippetException - Throws:
SnippetException
-
getKey
-
encrypt
-
decrypt
- Throws:
Exception
-
addHoursToDate
-
getJarPaths
- Throws:
Exception
-
zipFile
public static void zipFile(File fileToZip, String fileName, ZipOutputStream zipOut) throws IOException - Throws:
IOException
-
fetchMetadata
public static com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata fetchMetadata(String discoveryUrl, com.nimbusds.jose.JWSAlgorithm jwsAlgo) throws Exception - Throws:
Exception
-
replaceAllIgnoreRegx
-
redirectRequest
- Parameters:
exchange
-path
-- Throws:
SnippetException
-
isApiCall
public static boolean isApiCall(io.undertow.server.HttpServerExchange exchange) - Parameters:
exchange
-- Returns:
-
logInfo
-
getCaseInsensitiveKey
- Parameters:
map
-key
-- Returns:
-
normalizeUri
-
normalizeApiPath
-
normalizeApiPathName
-
toServiceSlug
-
loadCustomJar
public static void loadCustomJar(DataPipeline dp, String packageName, String jarFileName) throws Exception - Throws:
Exception
-
loadCustomJar
- Throws:
Exception
-
unzipBuildFile
- Throws:
IOException
-
beforeServiceExecution
public static void beforeServiceExecution(DataPipeline dp, String fqn, Map<String, Object> passThroughData) throws Exception- Throws:
Exception
-
afterServiceExecution
public static void afterServiceExecution(DataPipeline dp, String fqn, Map<String, Object> passThroughData) throws Exception- Throws:
Exception
-
decodeJWT
-
isValid
- Throws:
SystemException
-
saveServerProperties
- Throws:
Exception
-