Package com.eka.middleware.service
Class ServiceUtils
java.lang.Object
com.eka.middleware.service.ServiceUtils
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic org.apache.logging.log4j.Loggerstatic final com.fasterxml.jackson.dataformat.xml.XmlMapperstatic final com.fasterxml.jackson.dataformat.yaml.YAMLMapper
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic DateaddHoursToDate(Date date, int hours) static voidafterServiceExecution(DataPipeline dp, String fqn, Map<String, Object> passThroughData) static booleanareBracesBalanced(String input) static voidbeforeServiceExecution(DataPipeline dp, String fqn, Map<String, Object> passThroughData) static voidclearSession(io.undertow.server.HttpServerExchange exchange) static final voidcompileJavaCode(String fqn, DataPipeline dataPipeLine) static byte[]compress(byte[] data) static ObjectconvertPolyglotValue(org.graalvm.polyglot.Value value) static voidcopyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) static byte[]deCompress(byte[] data) static Stringstatic final StringdeleteURLAlias(String alias, DataPipeline dp) static Stringstatic final voidexecute(String fqn, DataPipeline dataPipeLine) static final voidexecuteEmbeddedService(DataPipeline dataPipeline, String apiServiceJson) extractHeaders(io.undertow.server.HttpServerExchange exchange) static com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadatafetchMetadata(String discoveryUrl, com.nimbusds.jose.JWSAlgorithm jwsAlgo) static final StringgenerateUUID(String msg) static byte[]getBody(DataPipeline dataPipeLine) static final InputStreamgetBodyAsStream(DataPipeline dataPipeLine) static ObjectgetCaseInsensitiveKey(Map<String, Object> map, String key) static final URL[]getClassesURLs(String path) static AuthAccountgetCurrentLoggedInAuthAccount(io.undertow.server.HttpServerExchange exchange) static org.pac4j.core.profile.UserProfilegetCurrentLoggedInUserProfile(io.undertow.server.HttpServerExchange exchange) static Objectstatic final StringgetFormattedLogLine(String id, String resource, String info) getFormattedLogMap(String id, String resource, String info) static final String[]getJarPaths(String path, String packagePath) static SecretKeySpecstatic final MultiPartgetMultiPart(DataPipeline dataPipeLine) static final Stringstatic Stringstatic final StringgetServerProperty(String key) static StringgetTenantName(io.undertow.server.handlers.Cookie cookie) static StringgetToken(io.undertow.server.handlers.Cookie cookie) static final StringgetURLAlias(String fqn, Tenant tenant) static StringinitNewTenant(String name, AuthAccount account, String password) static booleanisApiCall(io.undertow.server.HttpServerExchange exchange) static booleanisMac()static final booleanisPublicFolder(String path) static booleanstatic booleanisUnix()static booleanstatic booleanstatic voidloadCustomJar(DataPipeline dp, String path) static voidloadCustomJar(DataPipeline dp, String packageName, String jarFileName) static voidstatic voidmanipulateHeaders(io.undertow.server.HttpServerExchange exchange) static Stringstatic StringnormalizeApiPathName(String method, String s) static Stringstatic final StringobjectToJson(Object object) static final voidprintException(DataPipeline dp, String msg, Exception e) static final voidprintException(Tenant tenant, String msg, Exception e) static final voidprintException(String msg, Exception e) static final byte[]readAllBytes(File file) static voidredirectRequest(io.undertow.server.HttpServerExchange exchange, String path) static final StringregisterURLAlias(String fqn, String alias, DataPipeline dp) static StringreplaceAllIgnoreRegx(String source, String search, String replace) static voidsaveServerProperties(DataPipeline dataPipeline) searchEndpoints(String keyword, Tenant tenant) static io.undertow.server.handlers.CookiesetupCookie(io.undertow.server.HttpServerExchange exchange, String tenantName, String token) static StringsetupRequestPath(io.undertow.server.HttpServerExchange exchange) static final voidstartStreaming(RuntimePipeline rp, MultiPart mp) static voidstartTenantServices(String tenant) static final Stringstatic final Stringstatic final StringtoPrettyJson(Map<String, Object> map) static StringtoServiceSlug(String str) static final Stringstatic final Stringstatic voidunzipBuildFile(String srcZip, String destinationBasePath) static final StringxmlToString(Object o, String rootName) static voidzipFile(File fileToZip, String fileName, ZipOutputStream zipOut) 
- 
Field Details- 
xmlMapperpublic static final com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper
- 
yamlMapperpublic static final com.fasterxml.jackson.dataformat.yaml.YAMLMapper yamlMapper
- 
LOGGERpublic static org.apache.logging.log4j.Logger LOGGER
 
- 
- 
Constructor Details- 
ServiceUtilspublic ServiceUtils()
 
- 
- 
Method Details- 
isWindowspublic static boolean isWindows()
- 
searchEndpoints
- 
isMacpublic static boolean isMac()
- 
isUnixpublic static boolean isUnix()
- 
isSolarispublic 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
 
- 
executeEmbeddedServicepublic static final void executeEmbeddedService(DataPipeline dataPipeline, String apiServiceJson) throws SnippetException - Throws:
- SnippetException
 
- 
isPublicFolder
- 
compileJavaCodepublic static final void compileJavaCode(String fqn, DataPipeline dataPipeLine) throws SnippetException - Throws:
- SnippetException
 
- 
printException
- 
printException
- 
printException
- 
getServerProperty
- 
compresspublic static byte[] compress(byte[] data) 
- 
deCompress- Throws:
- DataFormatException
 
- 
getPathService
- 
extractHeaders
- 
getFormattedLogLine
- 
getFormattedLogMap
- 
getMultiPart- Throws:
- SnippetException
 
- 
getURLAlias- Throws:
- Exception
 
- 
registerURLAliaspublic 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
 
- 
copyDirectorypublic static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException - Throws:
- IOException
 
- 
setupRequestPath
- 
manipulateHeaderspublic static void manipulateHeaders(io.undertow.server.HttpServerExchange exchange) 
- 
setupCookie
- 
clearSessionpublic static void clearSession(io.undertow.server.HttpServerExchange exchange) 
- 
getToken
- 
getTenantName
- 
initNewTenant
- 
startTenantServices- Throws:
- SnippetException
 
- 
getClassesURLs- Throws:
- Exception
 
- 
getCurrentLoggedInUserProfilepublic static org.pac4j.core.profile.UserProfile getCurrentLoggedInUserProfile(io.undertow.server.HttpServerExchange exchange) throws SnippetException - Throws:
- SnippetException
 
- 
getCurrentLoggedInAuthAccountpublic static AuthAccount getCurrentLoggedInAuthAccount(io.undertow.server.HttpServerExchange exchange) throws SnippetException - Throws:
- SnippetException
 
- 
getKey
- 
encrypt
- 
decrypt- Throws:
- Exception
 
- 
addHoursToDate
- 
getJarPaths- Throws:
- Exception
 
- 
zipFilepublic static void zipFile(File fileToZip, String fileName, ZipOutputStream zipOut) throws IOException - Throws:
- IOException
 
- 
fetchMetadatapublic 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
 
- 
isApiCallpublic static boolean isApiCall(io.undertow.server.HttpServerExchange exchange) - Parameters:
- exchange-
- Returns:
 
- 
logInfo
- 
getCaseInsensitiveKey- Parameters:
- map-
- key-
- Returns:
 
- 
normalizeUri
- 
normalizeApiPath
- 
normalizeApiPathName
- 
toServiceSlug
- 
loadCustomJarpublic static void loadCustomJar(DataPipeline dp, String packageName, String jarFileName) throws Exception - Throws:
- Exception
 
- 
loadCustomJar- Throws:
- Exception
 
- 
unzipBuildFile- Throws:
- IOException
 
- 
beforeServiceExecutionpublic static void beforeServiceExecution(DataPipeline dp, String fqn, Map<String, Object> passThroughData) throws Exception- Throws:
- Exception
 
- 
afterServiceExecutionpublic static void afterServiceExecution(DataPipeline dp, String fqn, Map<String, Object> passThroughData) throws Exception- Throws:
- Exception
 
- 
decodeJWT
- 
isValid- Throws:
- SystemException
 
- 
saveServerProperties- Throws:
- Exception
 
 
-