idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
130,400 | @ Action ( name = "Validate" , outputs = { @ Output ( RETURN_CODE ) , @ Output ( RESULT_TEXT ) , @ Output ( RETURN_RESULT ) , @ Output ( ERROR_MESSAGE ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS , matchType = COMPARE_EQUAL ) , @ Response ( text = ResponseNames... | Service to validate an XML document . Input must be given for either xmlDocument or for xmlLocation . The xsdLocation input is optional but if specified then the XML document will be validated against the XSD schema . |
130,401 | @ Action ( name = "Remove" , outputs = { @ Output ( RETURN_CODE ) , @ Output ( RETURN_RESULT ) , @ Output ( RESULT_XML ) , @ Output ( ERROR_MESSAGE ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS , matchType = COMPARE_EQUAL ) , @ Response ( text = ResponseNames . ... | Removes an element or attribute from an XML document . |
130,402 | public static String loadAsString ( String resourceFileName ) throws IOException , URISyntaxException { try ( InputStream is = ResourceLoader . class . getClassLoader ( ) . getResourceAsStream ( resourceFileName ) ) { StringWriter stringWriter = new StringWriter ( ) ; IOUtils . copy ( is , stringWriter , StandardCharse... | Loads the contents of a project resource file in a string . |
130,403 | @ Action ( name = "List Item Grabber" , outputs = { @ Output ( RESULT_TEXT ) , @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text = F... | This operation is used to retrieve a value from a list . When the index of an element from a list is known this operation can be used to extract the element . |
130,404 | @ Action ( name = "Default if empty" , description = OPERATION_DESC , outputs = { @ Output ( value = RETURN_CODE , description = RETURN_CODE_DESC ) , @ Output ( value = RETURN_RESULT , description = RETURN_RESULT_DESC ) , @ Output ( value = EXCEPTION , description = EXCEPTION_DESC ) , } , responses = { @ Response ( tex... | This operation checks if a string is blank or empty and if it s true a default value will be assigned instead of the initial string . |
130,405 | protected void validateDelimiters ( String rowDelimiter , String columnDelimiter ) throws Exception { if ( rowDelimiter . equals ( columnDelimiter ) ) { throw new Exception ( INVALID_DELIMITERS ) ; } if ( StringUtils . contains ( columnDelimiter , rowDelimiter ) ) { throw new Exception ( INVALID_ROW_DELIMITER ) ; } } | This method checks if the delimiters are equal and if the row delimiter is a substring of the column delimiter and throws an exception with the appropriate message . |
130,406 | protected Object [ ] extractHeaderNamesAndValues ( String headersMap , String rowDelimiter , String columnDelimiter ) throws Exception { String [ ] rows = headersMap . split ( Pattern . quote ( rowDelimiter ) ) ; ArrayList < String > headerNames = new ArrayList < > ( ) ; ArrayList < String > headerValues = new ArrayLis... | This method extracts and returns an object containing two Lists . A list with the header names and a list with the header values . Values found on same position in the two lists correspond to each other . |
130,407 | protected boolean validateRow ( String row , String columnDelimiter , int rowNumber ) throws Exception { if ( row . contains ( columnDelimiter ) ) { if ( row . equals ( columnDelimiter ) ) { throw new Exception ( format ( ROW_WITH_EMPTY_HEADERS_INPUT , rowNumber + 1 ) ) ; } else { String [ ] headerNameAndValue = row . ... | This method validates a row contained in the headers input of the operation . |
130,408 | protected SMTPMessage addHeadersToSMTPMessage ( SMTPMessage message , List < String > headerNames , List < String > headerValues ) throws MessagingException { SMTPMessage msg = new SMTPMessage ( message ) ; Iterator namesIter = headerNames . iterator ( ) ; Iterator valuesIter = headerValues . iterator ( ) ; while ( nam... | The method creates a copy of the SMTPMessage object passed through the arguments list and adds the headers to the copied object then returns it . If the header is already present in the message then its values list will be updated with the given header value . |
130,409 | private static String getLowerCaseString ( final String string ) { return StringUtils . strip ( string ) . toLowerCase ( ) ; } | Given a string it lowercase it and strips the blank spaces from the ends |
130,410 | @ Action ( name = "List Contains All" , outputs = { @ Output ( RESPONSE_TEXT ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) , @ Output ( EXCEPTION ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text ... | This method checks to see if a list contains every element in another list . |
130,411 | public static String execQueryAllRows ( final SQLInputs sqlInputs ) throws Exception { ConnectionService connectionService = new ConnectionService ( ) ; try ( final Connection connection = connectionService . setUpConnection ( sqlInputs ) ) { connection . setReadOnly ( true ) ; Statement statement = connection . create... | todo Run a SQL query with given configuration |
130,412 | public static ObjectContent [ ] getObjectProperties ( ConnectionResources connectionResources , ManagedObjectReference mor , String [ ] properties ) throws RuntimeFaultFaultMsg , InvalidPropertyFaultMsg { if ( mor == null ) { return new ObjectContent [ 0 ] ; } PropertyFilterSpec spec = new PropertyFilterSpec ( ) ; spec... | Retrieve contents for a single object based on the property collector registered with the service . |
130,413 | private static List < ObjectContent > retrievePropertiesAllObjects ( ConnectionResources connectionResources , List < PropertyFilterSpec > propertyFilterSpecList ) throws RuntimeFaultFaultMsg , InvalidPropertyFaultMsg { VimPortType vimPort = connectionResources . getVimPortType ( ) ; ManagedObjectReference serviceInsta... | Uses the new RetrievePropertiesEx method to emulate the now deprecated RetrieveProperties method |
130,414 | public static void validateInputs ( EditXmlInputs inputs ) throws Exception { validateXmlAndFilePathInputs ( inputs . getXml ( ) , inputs . getFilePath ( ) ) ; if ( Constants . Inputs . MOVE_ACTION . equals ( inputs . getAction ( ) ) ) { validateIsNotEmpty ( inputs . getXpath2 ( ) , "xpath2 input is required for action... | Validates the operation inputs . |
130,415 | @ Action ( name = "Get shared access key token for Azure" , outputs = { @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) , @ Output ( EXCEPTION ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = ReturnCodes . SUCCESS , matchType = COMPARE_EQUAL , responseType = RESOLVED ) , @ Response ... | Generates the shared access key token for Azure API calls . |
130,416 | @ Action ( name = "List Sort" , outputs = { @ Output ( RESULT_TEXT ) , @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text = FAILURE ,... | This method sorts a list of strings . If the list contains only numerical strings it is sorted in numerical order . Otherwise it is sorted alphabetically . |
130,417 | @ Action ( name = "List Remover" , outputs = { @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text = FAILURE , field = RETURN_CODE , v... | This method removes an element from a list of strings . |
130,418 | public DataSource openPooledDataSource ( DBType aDbType , String aDbUrl , String aUsername , String aPassword ) throws SQLException { final DataSource unPooledDS = DataSources . unpooledDataSource ( aDbUrl , aUsername , aPassword ) ; final Map < String , String > props = this . getPoolingProperties ( aDbType ) ; return... | get the pooled datasource from c3p0 pool |
130,419 | private Map < String , String > getPoolingProperties ( DBType aDbType ) { Map < String , String > retMap = new HashMap < > ( ) ; String acqIncSize = this . getPropStringValue ( CONNECTION_ACQUIREINCREMENT_SIZE_NAME , CONNECTION_ACQUIREINCREMENT_SIZE_DEFAULT_VALUE ) ; retMap . put ( C3P0_ACQUIRE_INCREMENT_NAME , acqIncS... | set up the properties for c3p0 based on the properties values in databasePooling . properties . |
130,420 | public int getAllConnectionNumber ( DataSource aPooledDataSource ) throws SQLException { PooledDataSource pDs = ( PooledDataSource ) aPooledDataSource ; return pDs . getNumConnectionsAllUsers ( ) ; } | The followings are only for testing purpose |
130,421 | public static String getIPv4OrIPv6WithSquareBracketsHost ( String dbServer ) { final Address address = new Address ( dbServer ) ; return address . getURIIPV6Literal ( ) ; } | Method returning the host surrounded by square brackets if dbServer is IPv6 format . Otherwise the returned string will be the same . |
130,422 | public static String computeSessionId ( final String aString ) { final byte [ ] byteData = DigestUtils . sha256 ( aString . getBytes ( ) ) ; final StringBuilder sb = new StringBuilder ( "SQLQuery:" ) ; for ( final byte aByteData : byteData ) { final String hex = Integer . toHexString ( 0xFF & aByteData ) ; if ( hex . l... | compute session id for JDBC operations |
130,423 | public void cleanDataSources ( ) { Hashtable < String , List < String > > removedDsKeyTable = null ; Enumeration < String > allPoolKeys = dbmsPoolTable . keys ( ) ; while ( allPoolKeys . hasMoreElements ( ) ) { String dbPoolKey = allPoolKeys . nextElement ( ) ; Hashtable < String , DataSource > dsTable = dbmsPoolTable ... | clean any empty datasource and pool in the dbmsPool table . |
130,424 | public synchronized void shutdownDbmsPools ( ) { datasourceCleaner . shutdown ( ) ; datasourceCleaner = null ; cleanerThread . interrupt ( ) ; cleanerThread = null ; if ( dbmsPoolTable == null ) { return ; } Enumeration < String > allDbmsKeys = dbmsPoolTable . keys ( ) ; while ( allDbmsKeys . hasMoreElements ( ) ) { St... | force shutdown everything |
130,425 | protected boolean getPropBooleanValue ( String aPropName , String aDefaultValue ) { boolean retValue ; String temp = dbPoolingProperties . getProperty ( aPropName , aDefaultValue ) ; retValue = Boolean . valueOf ( temp ) ; return retValue ; } | get boolean value based on the property name from property file the property file is databasePooling . properties |
130,426 | protected int getPropIntValue ( String aPropName , String aDefaultValue ) { int retValue ; String temp = dbPoolingProperties . getProperty ( aPropName , aDefaultValue ) ; retValue = Integer . valueOf ( temp ) ; return retValue ; } | get int value based on the property name from property file the property file is databasePooling . properties |
130,427 | private void createCleaner ( ) { if ( cleanerThread == null ) { int interval = getPropIntValue ( DB_DATASOURCE_CLEAN_INTERNAL_NAME , DB_DATASOURCE_CLEAN_INTERNAL_DEFAULT_VALUE ) ; this . datasourceCleaner = new PooledDataSourceCleaner ( this , interval ) ; this . cleanerThread = new Thread ( datasourceCleaner ) ; this ... | create and start a pool cleaner if pooling is enabled . |
130,428 | protected DataSource createDataSource ( DBType aDbType , String aDbUrl , String aUsername , String aPassword , Hashtable < String , DataSource > aDsTable ) throws SQLException { DataSource retDatasource ; String totalMaxPoolSizeName ; switch ( aDbType ) { case ORACLE : totalMaxPoolSizeName = ORACLE_MAX_POOL_SIZE_NAME ;... | create a new pooled datasource if total max pool size for the dbms is still ok . total max pool size per user < = total max pool size specified for specific db type . for example max pool size per user = 20 total max pool size for oracle dbms is 100 . only 5 datasource can be opened . |
130,429 | private char retrieveWrappingQuoteTypeOfJsonMemberNames ( String jsonString ) { char quote = '\"' ; for ( char c : jsonString . toCharArray ( ) ) { if ( c == '\'' || c == '\"' ) { quote = c ; break ; } } return quote ; } | Returns the quote character used for specifying json member names and String values of json members |
130,430 | public Map < String , String > customizeVM ( HttpInputs httpInputs , VmInputs vmInputs , GuestInputs guestInputs , boolean isWin ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { ManagedObjectReference vmMor = new MorObjectHandler ( ) . getMor ( con... | Method used to connect to specified data center and customize the windows OS based virtual machine identified by the inputs provided . |
130,431 | public Map < String , String > mountTools ( HttpInputs httpInputs , VmInputs vmInputs ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { ManagedObjectReference vmMor = new MorObjectHandler ( ) . getMor ( connectionResources , ManagedObjectType . VIRT... | Method used to connect to specified data center and start the Install Tools process on virtual machine identified by the inputs provided . |
130,432 | public static Map < String , Object > validateAndBuildKeyValuesMap ( String listenAddresses , String port , String ssl , String sslCaFile , String sslCertFile , String sslKeyFile , String maxConnections , String sharedBuffers , String effectiveCacheSize , String autovacuum , String workMem ) { Map < String , Object > k... | Method to validate inputs and consolidate to a map . |
130,433 | public static void changeProperty ( String filename , Map < String , Object > keyValuePairs ) throws IOException { if ( keyValuePairs . size ( ) == 0 ) { return ; } final File file = new File ( filename ) ; final File tmpFile = new File ( file + ".tmp" ) ; PrintWriter pw = new PrintWriter ( tmpFile ) ; BufferedReader b... | Method to modify the Postgres config postgresql . conf based on key - value pairs |
130,434 | public static void changeProperty ( String filename , String [ ] allowedHosts , String [ ] allowedUsers ) throws IOException { if ( ( allowedHosts == null || allowedHosts . length == 0 ) && ( allowedUsers == null || allowedUsers . length == 0 ) ) { return ; } final File file = new File ( filename ) ; final File tmpFile... | Method to modify the Postgres config pg_hba . config |
130,435 | @ Action ( name = "Convert XML to Json" , outputs = { @ Output ( NAMESPACES_PREFIXES ) , @ Output ( NAMESPACES_URIS ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) , @ Output ( EXCEPTION ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS ) , @ Response ( te... | Converts a XML document to a JSON array or a JSON object . |
130,436 | @ Action ( name = "Trim List" , outputs = { @ Output ( RESULT_TEXT ) , @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text = FAILURE ,... | This method trims values from a list . The values trimmed are equally distributed from the high and low ends of the list . The list is sorted before trimming . The number of elements trimmed is dictated by the percentage that is passed in . If the percentage would indicate an odd number of elements the number trimmed i... |
130,437 | @ Action ( name = "Find Text in PDF" , description = FIND_TEXT_IN_PDF_OPERATION_DESC , outputs = { @ Output ( value = RETURN_CODE , description = RETURN_CODE_DESC ) , @ Output ( value = RETURN_RESULT , description = FIND_TEXT_IN_PDF_RETURN_RESULT_DESC ) , @ Output ( value = EXCEPTION , description = EXCEPTION_DESC ) , ... | This operation checks if a text input is found in a PDF file . |
130,438 | @ Action ( name = "List Prepender" , outputs = { @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text = FAILURE , field = RETURN_CODE ,... | This method pre - pends an element to a list of strings . |
130,439 | @ Action ( name = "Append Child" , outputs = { @ Output ( RETURN_CODE ) , @ Output ( RETURN_RESULT ) , @ Output ( RESULT_XML ) , @ Output ( ERROR_MESSAGE ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS , matchType = COMPARE_EQUAL ) , @ Response ( text = ResponseNa... | Appends a child to an XML element . |
130,440 | public static boolean saveSshSessionAndChannel ( Session session , Channel channel , GlobalSessionObject < Map < String , SSHConnection > > sessionParam , String sessionId ) { final SSHConnection sshConnection ; if ( channel != null ) { sshConnection = new SSHConnection ( session , channel ) ; } else { sshConnection = ... | Save the SSH session and the channel in the cache . |
130,441 | public static String encodeStringInBase64 ( String str , Charset charset ) { return new String ( Base64 . encodeBase64 ( str . getBytes ( charset ) ) ) ; } | Encodes a string to base64 . |
130,442 | private ClusterDasVmConfigInfo createVmOverrideConfiguration ( ManagedObjectReference vmMor , String restartPriority ) { ClusterDasVmConfigInfo clusterDasVmConfigInfo = new ClusterDasVmConfigInfo ( ) ; clusterDasVmConfigInfo . setKey ( vmMor ) ; clusterDasVmConfigInfo . setDasSettings ( createClusterDasVmSettings ( res... | Das method adds a vm override to a HA enabled Cluster . |
130,443 | private ClusterDasVmSettings createClusterDasVmSettings ( String restartPriority ) { ClusterDasVmSettings clusterDasVmSettings = new ClusterDasVmSettings ( ) ; clusterDasVmSettings . setRestartPriority ( restartPriority ) ; return clusterDasVmSettings ; } | Das method creates a cluster vm setting . |
130,444 | private ClusterConfigInfoEx getClusterConfiguration ( ConnectionResources connectionResources , ManagedObjectReference clusterMor , String clusterName ) throws RuntimeFaultFaultMsg , InvalidPropertyFaultMsg { ObjectContent [ ] objectContents = GetObjectProperties . getObjectProperties ( connectionResources , clusterMor... | Das method gets the current cluster configurations . |
130,445 | @ Action ( name = "Update Property Value" , outputs = { @ Output ( RETURN_CODE ) , @ Output ( RETURN_RESULT ) , @ Output ( EXCEPTION ) , @ Output ( STDERR ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS , matchType = MatchType . COMPARE_EQUAL , responseType = Resp... | Updates the Postgres config postgresql . conf |
130,446 | public Map < String , ManagedObjectReference > inContainerByType ( ManagedObjectReference folder , String morefType , RetrieveOptions retrieveOptions ) throws InvalidPropertyFaultMsg , RuntimeFaultFaultMsg { RetrieveResult results = containerViewByType ( folder , morefType , retrieveOptions ) ; return toMap ( results )... | Returns all the MOREFs of the specified type that are present under the container |
130,447 | private RetrieveResult containerViewByType ( final ManagedObjectReference container , final String morefType , final RetrieveOptions retrieveOptions , final String ... morefProperties ) throws RuntimeFaultFaultMsg , InvalidPropertyFaultMsg { PropertyFilterSpec [ ] propertyFilterSpecs = propertyFilterSpecs ( container ,... | Returns the raw RetrieveResult object for the provided container filtered on properties list |
130,448 | private RetrieveResult containerViewByType ( final ManagedObjectReference container , final String morefType , final RetrieveOptions retrieveOptions ) throws RuntimeFaultFaultMsg , InvalidPropertyFaultMsg { return this . containerViewByType ( container , morefType , retrieveOptions , ManagedObjectType . NAME . getValue... | Initialize the helper object on the current connection at invocation time . Do not initialize on construction since the connection may not be ready yet . |
130,449 | public static void init ( SQLInputs sqlInputs ) throws Exception { if ( sqlInputs != null ) { sqlInputs . setStrDelim ( "," ) ; sqlInputs . setStrColumns ( "" ) ; sqlInputs . setLRows ( new ArrayList < String > ( ) ) ; sqlInputs . setIUpdateCount ( 0 ) ; sqlInputs . setSqlCommand ( null ) ; sqlInputs . setDbServer ( nu... | init all the non - static variables . |
130,450 | public void run ( ) { state = STATE_CLEANER . RUNNING ; while ( state != STATE_CLEANER . SHUTDOWN ) { try { Thread . sleep ( interval * 1000 ) ; } catch ( InterruptedException e ) { break ; } this . manager . cleanDataSources ( ) ; if ( this . manager . getDbmsPoolSize ( ) == 0 ) { state = STATE_CLEANER . SHUTDOWN ; br... | wake up and clean the pools if the pool has empty connection table . |
130,451 | public static boolean arrayElementsAreNull ( String [ ] uncontainedArray ) { boolean empty = true ; for ( Object ob : uncontainedArray ) { if ( ob != null ) { empty = false ; break ; } } return empty ; } | This method check if all elements of an array are null . |
130,452 | public String getSignedHeadersString ( Map < String , String > headers ) { List < String > sortedList = new ArrayList < > ( headers . keySet ( ) ) ; Collections . sort ( sortedList , String . CASE_INSENSITIVE_ORDER ) ; StringBuilder signedHeaderString = new StringBuilder ( ) ; for ( String header : sortedList ) { if ( ... | Creates a comma separated list of headers . |
130,453 | public static String encryptPassword ( final String aPlainPass ) throws Exception { byte [ ] encBytes = encryptString ( aPlainPass . getBytes ( DEFAULT_CODEPAGE ) ) ; return Base64 . encodeBase64String ( encBytes ) ; } | encrypt a plain password |
130,454 | public static String documentToString ( Document xmlDocument ) throws IOException { String encoding = ( xmlDocument . getXmlEncoding ( ) == null ) ? "UTF-8" : xmlDocument . getXmlEncoding ( ) ; OutputFormat format = new OutputFormat ( xmlDocument ) ; format . setLineWidth ( 65 ) ; format . setIndenting ( true ) ; forma... | Returns a String representation for the XML Document . |
130,455 | private Source readSource ( String xmlDocument , String features ) throws Exception { if ( xmlDocument . startsWith ( Constants . Inputs . HTTP_PREFIX_STRING ) || xmlDocument . startsWith ( Constants . Inputs . HTTPS_PREFIX_STRING ) ) { URL xmlUrl = new URL ( xmlDocument ) ; InputStream xmlStream = xmlUrl . openStream ... | Reads the xml content from a file URL or string . |
130,456 | public static boolean isDateValid ( String date , Locale locale ) { try { DateFormat format = DateFormat . getDateTimeInstance ( DateFormat . DEFAULT , DateFormat . DEFAULT , locale ) ; format . parse ( date ) ; return true ; } catch ( ParseException e ) { return false ; } } | Because the date passed as argument can be in java format and because not all formats are compatible with joda - time this method checks if the date string is valid with java . In this way we can use the proper DateTime without changing the output . |
130,457 | public static Locale getLocaleByCountry ( String lang , String country ) { return StringUtils . isNotBlank ( country ) ? new Locale ( lang , country ) : new Locale ( lang ) ; } | Generates the locale |
130,458 | public static DateTime getJodaOrJavaDate ( final DateTimeFormatter dateFormatter , final String date ) throws Exception { if ( DateTimeUtils . isDateValid ( date , dateFormatter . getLocale ( ) ) ) { DateFormat dateFormat = DateFormat . getDateTimeInstance ( DateFormat . DEFAULT , DateFormat . DEFAULT , dateFormatter .... | Returns a LocalDateTime depending on how the date passes as argument is formatted . |
130,459 | public static DateTimeFormatter getDateFormatter ( String format , String lang , String country ) { if ( StringUtils . isNotBlank ( format ) ) { DateTimeFormatter dateFormat = DateTimeFormat . forPattern ( format ) ; if ( StringUtils . isNotBlank ( lang ) ) { return dateFormat . withLocale ( DateTimeUtils . getLocaleBy... | Generates a DateTimeFormatter using a custom pattern with the default locale or a new one according to what language and country are provided as params . |
130,460 | public static DateTimeFormatter formatWithDefault ( String lang , String country ) { return ( StringUtils . isNotBlank ( lang ) ) ? DateTimeFormat . longDateTime ( ) . withLocale ( DateTimeUtils . getLocaleByCountry ( lang , country ) ) : DateTimeFormat . longDateTime ( ) . withLocale ( Locale . getDefault ( ) ) ; } | Generates a DateTimeFormatter using full date pattern with the default locale or a new one according to what language and country are provided as params . |
130,461 | public static String execSqlQueryTabular ( final SQLInputs sqlInputs ) throws Exception { ConnectionService connectionService = new ConnectionService ( ) ; try ( final Connection connection = connectionService . setUpConnection ( sqlInputs ) ) { connection . setReadOnly ( true ) ; final Statement statement = connection... | Run a SQL query with given configuration |
130,462 | @ Action ( name = "XpathQuery" , outputs = { @ Output ( RETURN_CODE ) , @ Output ( RETURN_RESULT ) , @ Output ( SELECTED_VALUE ) , @ Output ( ERROR_MESSAGE ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS , matchType = COMPARE_EQUAL ) , @ Response ( text = Response... | Selects from an XML document using an XPATH query . |
130,463 | @ Action ( name = "Convert JSON to XML" , outputs = { @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS ) , @ Response ( text = ResponseNames . FAILURE , field = RETURN_CODE , value = FAILURE ) } ) public Map < Str... | Converts a JSON array or a JSON object to a XML document . |
130,464 | @ Action ( name = "Update pg_hba.config" , outputs = { @ Output ( RETURN_CODE ) , @ Output ( RETURN_RESULT ) , @ Output ( EXCEPTION ) , @ Output ( STDERR ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = RETURN_CODE , value = SUCCESS , matchType = MatchType . COMPARE_EQUAL , responseType = Respo... | Updates the Postgres config pg_hba . config |
130,465 | @ Action ( name = "Extract text from image" , description = EXTRACT_TEXT_FROM_IMAGE_DESC , outputs = { @ Output ( value = RETURN_CODE , description = RETURN_CODE_DESC ) , @ Output ( value = RETURN_RESULT , description = RETURN_RESULT_DESC ) , @ Output ( value = TEXT_STRING , description = TEXT_STRING_DESC ) , @ Output ... | This operation extracts the text from a specified file given as input using Tesseract s OCR library . |
130,466 | public static boolean isUUID ( String string ) { try { if ( string != null ) { UUID . fromString ( string ) ; return true ; } else { return false ; } } catch ( IllegalArgumentException ex ) { return false ; } } | Checks if a string is a valid UUID or not . |
130,467 | public static void validateUUID ( String uuid , String uuidValueOf ) throws RuntimeException { if ( ! WSManUtils . isUUID ( uuid ) ) { throw new RuntimeException ( "The returned " + uuidValueOf + " is not a valid UUID value! " + uuidValueOf + ": " + uuid ) ; } } | Validates a UUID value and throws a specific exception if UUID is invalid . |
130,468 | public static void verifyScriptExecutionStatus ( final Map < String , String > resultMap ) { if ( ZERO_SCRIPT_EXIT_CODE . equals ( resultMap . get ( SCRIPT_EXIT_CODE ) ) ) { resultMap . put ( RETURN_CODE , RETURN_CODE_SUCCESS ) ; } else { resultMap . put ( RETURN_CODE , RETURN_CODE_FAILURE ) ; } } | Checks the scriptExitCode value of the script execution and fails the operation if exit code is different than zero . |
130,469 | @ Action ( name = "Offset Time By" , description = "Changes the time represented by a date by the specified number of seconds" , outputs = { @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) , @ Output ( EXCEPTION ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = ReturnCodes . SUCCESS ... | Changes the time represented by a date by the specified number of seconds . If locale is specified it will return the date and time string based on the locale . Otherwise default locale will be used . |
130,470 | @ Action ( name = "List AWS Cloud Formation stacks" , outputs = { @ Output ( Outputs . RETURN_CODE ) , @ Output ( Outputs . RETURN_RESULT ) , @ Output ( Outputs . EXCEPTION ) } , responses = { @ Response ( text = Outputs . SUCCESS , field = Outputs . RETURN_CODE , value = Outputs . SUCCESS_RETURN_CODE , matchType = Mat... | List AWS Cloud Formation Stacks |
130,471 | @ Action ( name = "List Size" , outputs = { @ Output ( RESULT_TEXT ) , @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = Constants . ResponseNames . SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @... | This method returns the length of a list of strings . |
130,472 | protected String getPropStringValue ( String aPropName , String aDefaultValue ) { return dbPoolingProperties . getProperty ( aPropName , aDefaultValue ) ; } | get string value based on the property name from property file the property file is databasePooling . properties |
130,473 | public String getStringToSign ( String requestDate , String credentialScope , String canonicalRequest ) throws SignatureException { try { return AWS4_SIGNING_ALGORITHM + LINE_SEPARATOR + requestDate + LINE_SEPARATOR + credentialScope + LINE_SEPARATOR + new String ( Hex . encode ( calculateHash ( canonicalRequest ) ) , ... | Combines the inputs into a string with a fixed structure and calculates the canonical request digest . This string can be used with the derived signing key to create an AWS signature . |
130,474 | public byte [ ] getDerivedSigningKey ( String secretAccessKey , String dateStamp , String region , String amazonApi ) throws SignatureException { try { byte [ ] kSecret = ( AWS_SIGNATURE_VERSION + secretAccessKey ) . getBytes ( ENCODING ) ; byte [ ] kDate = calculateHmacSHA256 ( dateStamp , kSecret ) ; byte [ ] kRegion... | Derives a signing key from the AWS secret access key . |
130,475 | private byte [ ] calculateHmacSHA256 ( String data , byte [ ] key ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException { Mac mac = Mac . getInstance ( HMAC_ALGORITHM ) ; mac . init ( new SecretKeySpec ( key , HMAC_ALGORITHM ) ) ; return mac . doFinal ( data . getBytes ( ENCODING ) ) ; ... | Calculates the keyed - hash message authentication code for the data string . |
130,476 | public Map < String , String > getOsDescriptors ( HttpInputs httpInputs , VmInputs vmInputs , String delimiter ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { ManagedObjectReference environmentBrowserMor = new MorObjectHandler ( ) . getEnvironment... | Method used to connect to data center to retrieve a list with all the guest operating system descriptors supported by the host system . |
130,477 | public Map < String , String > createVM ( HttpInputs httpInputs , VmInputs vmInputs ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { VmUtils utils = new VmUtils ( ) ; ManagedObjectReference vmFolderMor = utils . getMorFolder ( vmInputs . getFolderN... | Method used to connect to specified data center and create a virtual machine using the inputs provided . |
130,478 | public Map < String , String > deleteVM ( HttpInputs httpInputs , VmInputs vmInputs ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { ManagedObjectReference vmMor = new MorObjectHandler ( ) . getMor ( connectionResources , ManagedObjectType . VIRTUA... | Method used to connect to specified data center and delete the virtual machine identified by the inputs provided . |
130,479 | public Map < String , String > listVMsAndTemplates ( HttpInputs httpInputs , VmInputs vmInputs , String delimiter ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { Map < String , ManagedObjectReference > virtualMachinesMorMap = new MorObjectHandler ... | Method used to connect to data center to retrieve a list with all the virtual machines and templates within . |
130,480 | public Map < String , String > getVMDetails ( HttpInputs httpInputs , VmInputs vmInputs ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { ManagedObjectReference vmMor = new MorObjectHandler ( ) . getMor ( connectionResources , ManagedObjectType . VI... | Method used to connect to data center to retrieve details of a virtual machine identified by the inputs provided . |
130,481 | public Map < String , String > updateVM ( HttpInputs httpInputs , VmInputs vmInputs ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { ManagedObjectReference vmMor = new MorObjectHandler ( ) . getMor ( connectionResources , ManagedObjectType . VIRTUA... | Method used to connect to data center to update existing devices of a virtual machine identified by the inputs provided . |
130,482 | public Map < String , String > cloneVM ( HttpInputs httpInputs , VmInputs vmInputs ) throws Exception { ConnectionResources connectionResources = new ConnectionResources ( httpInputs , vmInputs ) ; try { ManagedObjectReference vmMor = new MorObjectHandler ( ) . getMor ( connectionResources , ManagedObjectType . VIRTUAL... | Method used to connect to data center and clone a virtual machine identified by the inputs provided . |
130,483 | @ Action ( name = "Merge Arrays" , outputs = { @ Output ( OutputNames . RETURN_RESULT ) , @ Output ( OutputNames . RETURN_CODE ) , @ Output ( OutputNames . EXCEPTION ) } , responses = { @ Response ( text = ResponseNames . SUCCESS , field = OutputNames . RETURN_CODE , value = ReturnCodes . SUCCESS , matchType = MatchTyp... | This operation merge the contents of two JSON arrays . This operation does not modify either of the input arrays . The result is the contents or array1 and array2 merged into a single array . The merge operation add into the result the first array and then the second array . |
130,484 | public Map < String , String > runCommand ( WSManRequestInputs wsManRequestInputs ) throws RuntimeException , IOException , InterruptedException , ParserConfigurationException , TransformerException , XPathExpressionException , TimeoutException , URISyntaxException , SAXException { HttpClientService csHttpClient = new ... | Executes a command on a remote shell by communicating with the WinRM server from the remote host . Method creates a shell runs a command on the shell waits for the command execution to finnish retrieves the result then deletes the shell . |
130,485 | private static HttpClientInputs setCommonHttpInputs ( HttpClientInputs httpClientInputs , URL url , WSManRequestInputs wsManRequestInputs ) throws MalformedURLException { httpClientInputs . setUrl ( url . toString ( ) ) ; httpClientInputs . setUsername ( wsManRequestInputs . getUsername ( ) ) ; httpClientInputs . setPa... | Configures the HttpClientInputs object with the most common http parameters . |
130,486 | private Map < String , String > executeRequestWithBody ( HttpClientService csHttpClient , HttpClientInputs httpClientInputs , String body ) { httpClientInputs . setBody ( body ) ; Map < String , String > requestResponse = csHttpClient . execute ( httpClientInputs ) ; if ( UNAUTHORIZED_STATUS_CODE . equals ( requestResp... | This method executes a request with the given CSHttpClient HttpClientInputs and body . |
130,487 | private String createShell ( HttpClientService csHttpClient , HttpClientInputs httpClientInputs , WSManRequestInputs wsManRequestInputs ) throws RuntimeException , IOException , URISyntaxException , XPathExpressionException , SAXException , ParserConfigurationException { String document = ResourceLoader . loadAsString ... | Creates a shell on the remote server and returns the shell id . |
130,488 | private String executeCommand ( HttpClientService csHttpClient , HttpClientInputs httpClientInputs , String shellId , WSManRequestInputs wsManRequestInputs , String command ) throws RuntimeException , IOException , URISyntaxException , TransformerException , XPathExpressionException , SAXException , ParserConfiguration... | Executes a command on the given shell . |
130,489 | private Map < String , String > receiveCommandResult ( HttpClientService csHttpClient , HttpClientInputs httpClientInputs , String shellId , String commandId , WSManRequestInputs wsManRequestInputs ) throws RuntimeException , IOException , URISyntaxException , TransformerException , TimeoutException , XPathExpressionEx... | Waits for a specific command that is running on a remote shell to finnish it s execution . |
130,490 | private String getResourceId ( String response , String resourceResponseAction , String resourceIdXpath , String resourceIdExceptionMessage ) throws ParserConfigurationException , SAXException , XPathExpressionException , IOException { if ( WSManUtils . isSpecificResponseAction ( response , resourceResponseAction ) ) {... | This method retrieves the resource id from the create resource request response and throws the appropriate exceptions in case of failure . |
130,491 | private void deleteShell ( HttpClientService csHttpClient , HttpClientInputs httpClientInputs , String shellId , WSManRequestInputs wsManRequestInputs ) throws RuntimeException , IOException , URISyntaxException , TransformerException , XPathExpressionException , SAXException , ParserConfigurationException { String doc... | Deletes the remote shell . |
130,492 | private Map < String , String > processCommandExecutionResponse ( Map < String , String > receiveResult ) throws ParserConfigurationException , SAXException , XPathExpressionException , IOException { Map < String , String > scriptResults = new HashMap < > ( ) ; scriptResults . put ( RETURN_RESULT , buildResultFromRespo... | This method separates the stdout and stderr response streams from the received execution response . |
130,493 | private String buildResultFromResponseStreams ( String response , OutputStream outputStream ) throws ParserConfigurationException , SAXException , XPathExpressionException , IOException { StringBuilder commandResult = new StringBuilder ( ) ; int noOfStreams = WSManUtils . countStreamElements ( response ) ; for ( int st... | Constructs the executed command response from multiple streams of data containing the encoded result of the execution . |
130,494 | private boolean executionIsTimedOut ( long aStartTime , int aTimeout ) { if ( aTimeout != 0 ) { long now = System . currentTimeMillis ( ) / 1000 ; if ( ( now - aStartTime ) >= aTimeout ) { return true ; } } return false ; } | Check whether or not the command execution reach the timeout value . |
130,495 | public static String [ ] toArrayWithEscaped ( final String stringArray , final String delimiter ) { if ( StringUtils . isEmpty ( stringArray ) ) { return new String [ 0 ] ; } return StringUtils . splitByWholeSeparatorPreserveAllTokens ( stringArray , delimiter ) ; } | Splits the stringArray by the delimiter into an array of strings without ignoring the escaped delimiters |
130,496 | public static String [ ] toArray ( final String stringArray , final String delimiter ) { if ( StringUtils . isEmpty ( stringArray ) ) { return new String [ 0 ] ; } final String regex = "(?<!\\\\)" + Pattern . quote ( delimiter ) ; return stringArray . split ( regex ) ; } | Splits the stringArray by the delimiter into an array of strings ignoring the escaped delimiters |
130,497 | public static List < String > toListWithEscaped ( final String stringList , final String delimiter ) { return new ArrayList < > ( Arrays . asList ( toArrayWithEscaped ( stringList , delimiter ) ) ) ; } | Splits the stringList by the delimiter into a List of strings without ignoring the escaped delimiters |
130,498 | public static List < String > toList ( final String stringList , final String delimiter ) { return new ArrayList < > ( Arrays . asList ( toArray ( stringList , delimiter ) ) ) ; } | Splits the stringList by the delimiter into a List of strings ignoring the escaped delimiters |
130,499 | public static synchronized RequestBundle get ( SlingHttpServletRequest request ) { RequestBundle instance = ( RequestBundle ) request . getAttribute ( ATTRIBUTE_KEY ) ; if ( instance == null ) { instance = new RequestBundle ( request ) ; request . setAttribute ( ATTRIBUTE_KEY , instance ) ; } return instance ; } | returns the requests instance |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.