idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
10,400 | protected static char [ ] flags ( final CharSequence ... flagStrings ) { final StringBuilder sb = new StringBuilder ( ) ; for ( CharSequence flags : flagStrings ) sb . append ( flags ) ; return flags ( sb . toString ( ) ) ; } | Converts strings of flags into a sorted flag array that can be passed as a parameter to other utility methods . |
10,401 | protected static char [ ] flags ( final String flagString ) { if ( flagString == null || flagString . isEmpty ( ) ) { return NO_FLAGS ; } noDupsExcept ( flagString , NO_FLAGS ) ; final char [ ] flags = flagString . toCharArray ( ) ; Arrays . sort ( flags ) ; return flags ; } | Converts a string of flags into a sorted flag array that can be passed as a parameter to other utility methods . |
10,402 | protected void ensureNoFlags ( final String flags ) { if ( flags == null || flags . isEmpty ( ) ) return ; throw FormatException . formatFlagsMismatch ( flags , getFormatName ( ) ) ; } | Ensures no flags are given . |
10,403 | protected char selectFlag ( final String flags , final char [ ] choice ) { if ( flags == null ) return 0 ; StringBuilder conflict = null ; char found = 0 ; for ( int i = 0 ; i < flags . length ( ) ; i ++ ) { char f = flags . charAt ( i ) ; if ( oneOf ( f , choice ) ) { if ( found != 0 ) { if ( conflict == null ) confli... | Selects exactly one of the expected flags . |
10,404 | private void proxy ( final SipResponse msg ) { final ViaHeader via = msg . getViaHeader ( ) ; final Connection connection = this . stack . connect ( via . getHost ( ) , via . getPort ( ) ) ; connection . send ( msg ) ; } | Proxy the response to |
10,405 | private SipResponse processRegisterRequest ( final SipRequest request ) { final SipURI requestURI = ( SipURI ) request . getRequestUri ( ) ; final Buffer domain = requestURI . getHost ( ) ; final SipURI aor = getAOR ( request ) ; if ( ! validateDomain ( domain , aor ) ) { return request . createResponse ( 404 ) ; } fin... | Section 10 . 3 in RFC3261 outlines how to process a register request . For the purpose of this little exercise we are skipping many steps just to keep things simple . |
10,406 | private SipRequest generateAck ( final SipResponse response ) { final ContactHeader contact = response . getContactHeader ( ) ; final SipURI requestURI = ( SipURI ) contact . getAddress ( ) . getURI ( ) ; final ToHeader to = response . getToHeader ( ) ; final FromHeader from = response . getFromHeader ( ) ; final CSeqH... | Generating an ACK to a 2xx response is the same as any other subsequent request . However a subsequent request is generated in the context of what is known as a Dialog and since we currently are completely stateless this is not necessarily an easy thing to achieve but for now we will ignore many of the details . |
10,407 | public static ASN1OctetString getInstance ( Object obj ) { if ( obj == null || obj instanceof ASN1OctetString ) { return ( ASN1OctetString ) obj ; } if ( obj instanceof ASN1TaggedObject ) { return getInstance ( ( ( ASN1TaggedObject ) obj ) . getObject ( ) ) ; } if ( obj instanceof ASN1Sequence ) { Vector v = new Vector... | return an Octet String from the given object . |
10,408 | public static Logger get ( Class < ? > cls , String resourceBundleName ) { return Logger . getLogger ( cls . getPackage ( ) . getName ( ) , resourceBundleName ) ; } | Get a logger for the class s package that uses the resource bundle for localisation . |
10,409 | @ SuppressWarnings ( "unchecked" ) public static < T > T lookup ( String name ) { try { return ( T ) new InitialContext ( ) . lookup ( name ) ; } catch ( NamingException e ) { throw new IllegalStateException ( e ) ; } } | Get the named object in the starting context . |
10,410 | public SmbTransport getDc ( String domain , SmbExtendedAuthenticator authenticator , NtlmPasswordAuthentication auth ) throws SmbAuthException { if ( DISABLED ) return null ; try { UniAddress addr = UniAddress . getByName ( domain , true ) ; SmbTransport trans = SmbTransport . getSmbTransport ( addr , 0 ) ; DfsReferral... | >> SmbAuthenticator Fixed trusted domain issue . |
10,411 | public static boolean addAll ( LongCollection collection , long [ ] array ) { boolean changed = false ; for ( long element : array ) { changed |= collection . add ( element ) ; } return changed ; } | Add all elements in the array to the collection . |
10,412 | public static < T > T get ( T [ ] array , int index ) { return array != null && index >= 0 && index < array . length ? array [ index ] : null ; } | Get the element at the index in the array . |
10,413 | public static < T > T [ ] slice ( T [ ] array , int ... indexes ) { int length = indexes . length ; T [ ] slice = ObjectArrays . newArray ( array , length ) ; for ( int i = 0 ; i < length ; i ++ ) { slice [ i ] = array [ indexes [ i ] ] ; } return slice ; } | Get the elements in the array that are at the indexes . |
10,414 | public static < T > List < T > slice ( List < T > list , int ... indexes ) { List < T > slice = new ArrayList < > ( indexes . length ) ; for ( int i : indexes ) { slice . add ( list . get ( i ) ) ; } return slice ; } | Get the elements in the list that are at the indexes . |
10,415 | public static Class < ? > getClass ( Object obj ) { Class < ? > cls = obj . getClass ( ) ; return cls != Class . class ? cls : ( Class < ? > ) obj ; } | If the object is not a Class get its Class . Otherwise get the object as a Class . |
10,416 | public static Class < ? > getNamedClass ( Object obj ) { Class < ? > cls = getClass ( obj ) ; while ( cls != null && cls . isAnonymousClass ( ) ) { cls = cls . getEnclosingClass ( ) ; } return cls ; } | If the object is not a Class get its Class . Otherwise get the object as a Class . If the class is anonymous get a non - anonymous enclosing class . |
10,417 | public static Request request ( String url , String ... headers ) { Request . Builder request = new Request . Builder ( ) . url ( url ) ; if ( headers != null ) { int length = headers . length ; checkArgument ( length % 2 == 0 , "headers length must be a multiple of two" ) ; for ( int i = 0 ; i < length ; i += 2 ) { re... | Get a GET request for the URL and headers . |
10,418 | public Call call ( String url , String ... headers ) { return mCaller . newCall ( request ( url , headers ) ) ; } | Get a Call for a GET request for the URL and headers . |
10,419 | public Response response ( String url , String ... headers ) throws IOException { return call ( url , headers ) . execute ( ) ; } | Get a response to a GET request for the URL and headers . |
10,420 | public Response download ( String url , File destination ) throws IOException { return download ( url , destination , ( String [ ] ) null ) ; } | Download the resource at the URL and write it to the file . |
10,421 | public Response download ( String url , File destination , String ... headers ) throws IOException { try ( Response resp = response ( url , headers ) ) { if ( resp . isSuccessful ( ) ) { try ( BufferedSink sink = Okio . buffer ( Okio . sink ( destination ) ) ) { resp . body ( ) . source ( ) . readAll ( sink ) ; } } ret... | Download the resource at the URL with the headers and write it to the file . |
10,422 | public int getOffset ( ) { String value = getValue ( ) ; String superstring = getSuperstring ( ) ; return value != null && superstring != null ? superstring . indexOf ( value ) : - 1 ; } | Zero - based position of the first character of the substring within the superstring . |
10,423 | public String getString ( ) { StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i != string . length ; i ++ ) { buf . append ( table [ ( string [ i ] >>> 4 ) % 0xf ] ) ; buf . append ( table [ string [ i ] & 0xf ] ) ; } return buf . toString ( ) ; } | UniversalStrings have characters which are 4 bytes long - for the moment we just return them in Hex ... |
10,424 | public static int clamp ( int value , int min , int max ) { return Math . min ( Math . max ( min , value ) , max ) ; } | Get the value if it is between min and max min if the value is less than min or max if the value is greater than max . |
10,425 | public static String normalise ( String s ) { if ( sDiacritics == null ) { sDiacritics = Pattern . compile ( "\\p{InCombiningDiacriticalMarks}+" ) ; } return sDiacritics . matcher ( Normalizer . normalize ( s , NFD ) ) . replaceAll ( "" ) . toUpperCase ( US ) ; } | Remove diacritics from the string and convert it to upper case . |
10,426 | public static String distance ( String latitudeColumn , String longitudeColumn , String latitudeCosineColumn , double latitude , double longitude , MeasureUnit unit , String alias ) { double degree = unit == MILE ? LATITUDE_DEGREE_MI : LATITUDE_DEGREE_KM ; return String . format ( ( Locale ) null , sDistance , degree ,... | Get a result column for the squared distance from the row coordinates to the supplied coordinates . SQLite doesn t have a square root core function so this must be applied in Java when reading the result column value . |
10,427 | public static void sleep ( long length , TimeUnit unit ) { try { unit . sleep ( length ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } } | Sleep for the length of time . |
10,428 | boolean matches ( SmbExtendedAuthenticator authenticator , NtlmPasswordAuthentication auth ) { return matcheObject ( this . authenticator , authenticator ) && matcheObject ( this . auth , auth ) ; } | authenticator to decide whether or not reuse a session . |
10,429 | Key searchSessionKey ( Subject subject ) throws GSSException { if ( extendedGSSContextClass == null || inquireTypeSessionKey == null || inquireSecContext == null || gssContext == null ) { if ( log . level > 0 && ( ! deprecationWarningPrinted ) ) { log . print ( "WARNING: Kerberos Session Key is extracted from Kerberos ... | Extract the context session key from the gssContext . The subject is only used if no support for extraction of the session key is not possible with an API and is used as a fallback method . |
10,430 | static protected int getPadBits ( int bitString ) { int val ; if ( bitString == 0 ) { return 7 ; } if ( bitString > 255 ) { val = ( ( bitString >> 8 ) & 0xFF ) ; } else { val = ( bitString & 0xFF ) ; } int bits = 1 ; while ( ( ( val <<= 1 ) & 0xFF ) != 0 ) { bits ++ ; } return 8 - bits ; } | return the correct number of pad bits for a bit string defined in a 16 bit constant |
10,431 | static protected byte [ ] getBytes ( int bitString ) { if ( bitString > 255 ) { byte [ ] bytes = new byte [ 2 ] ; bytes [ 0 ] = ( byte ) ( bitString & 0xFF ) ; bytes [ 1 ] = ( byte ) ( ( bitString >> 8 ) & 0xFF ) ; return bytes ; } else { byte [ ] bytes = new byte [ 1 ] ; bytes [ 0 ] = ( byte ) ( bitString & 0xFF ) ; r... | return the correct number of bytes for a bit string defined in a 16 bit constant |
10,432 | public static PreparedStatement setStrings ( PreparedStatement stmt , String ... params ) throws SQLException { return setStrings ( 1 , stmt , params ) ; } | Set the statement parameters starting at 1 in the order of the params . |
10,433 | public static int firstInt ( PreparedStatement stmt ) throws SQLException { ResultSet rs = stmt . executeQuery ( ) ; int i = rs . next ( ) ? rs . getInt ( 1 ) : Integer . MIN_VALUE ; stmt . close ( ) ; return i ; } | Execute the query get the int value in the first row and column of the result set and close the statement . |
10,434 | public static long firstLong ( PreparedStatement stmt ) throws SQLException { ResultSet rs = stmt . executeQuery ( ) ; long l = rs . next ( ) ? rs . getLong ( 1 ) : Long . MIN_VALUE ; stmt . close ( ) ; return l ; } | Execute the query get the long value in the first row and column of the result set and close the statement . |
10,435 | public static String firstString ( PreparedStatement stmt ) throws SQLException { ResultSet rs = stmt . executeQuery ( ) ; String s = rs . next ( ) ? rs . getString ( 1 ) : null ; stmt . close ( ) ; return s ; } | Execute the query get the String value in the first row and column of the result set and close the statement . |
10,436 | @ SuppressWarnings ( "unchecked" ) public static List < String > firstStringRow ( PreparedStatement stmt ) throws SQLException { return ( List < String > ) firstRow ( stmt , String . class ) ; } | Execute the query get the String values in the first row of the result set and close the statement . |
10,437 | @ SuppressWarnings ( "unchecked" ) public static List < String > allStrings ( PreparedStatement stmt ) throws SQLException { return ( List < String > ) all ( stmt , String . class ) ; } | Execute the query get the String values in the first column of the result set and close the statement . |
10,438 | public static int firstIntKey ( PreparedStatement stmt ) throws SQLException { stmt . execute ( ) ; ResultSet rs = stmt . getGeneratedKeys ( ) ; int key = rs . next ( ) ? rs . getInt ( 1 ) : 0 ; stmt . close ( ) ; return key ; } | Execute the insert statement get the first generated key as an int and close the statement . |
10,439 | public static long firstLongKey ( PreparedStatement stmt ) throws SQLException { stmt . execute ( ) ; ResultSet rs = stmt . getGeneratedKeys ( ) ; long key = rs . next ( ) ? rs . getLong ( 1 ) : 0L ; stmt . close ( ) ; return key ; } | Execute the insert statement get the first generated key as a long and close the statement . |
10,440 | public static int update ( PreparedStatement stmt ) throws SQLException { int rows = stmt . executeUpdate ( ) ; stmt . close ( ) ; return rows ; } | Execute the insert update or delete statement get the number of rows affected and close the statement . |
10,441 | public static Cpe parse ( String cpeString , boolean lenient ) throws CpeParsingException { if ( cpeString == null ) { throw new CpeParsingException ( "CPE String is null and cannot be parsed" ) ; } else if ( cpeString . regionMatches ( 0 , "cpe:/" , 0 , 5 ) ) { return parse22 ( cpeString , lenient ) ; } else if ( cpeS... | Parses a CPE String into an object with the option of parsing CPE 2 . 2 URI strings in lenient mode - allowing for CPE values that do not adhere to the specification . |
10,442 | protected static Cpe parse22 ( String cpeString , boolean lenient ) throws CpeParsingException { if ( cpeString == null || cpeString . isEmpty ( ) ) { throw new CpeParsingException ( "CPE String is null ir enpty - unable to parse" ) ; } CpeBuilder cb = new CpeBuilder ( ) ; String [ ] parts = cpeString . split ( ":" ) ;... | Parses a CPE 2 . 2 URI . |
10,443 | protected static void unpackEdition ( String edition , CpeBuilder cb , boolean lenient ) throws CpeParsingException { if ( edition == null || edition . isEmpty ( ) ) { return ; } try { String [ ] unpacked = edition . split ( "~" ) ; if ( edition . startsWith ( "~" ) ) { if ( unpacked . length > 1 ) { cb . wfEdition ( C... | In a CPE 2 . 2 URI the new fields from CPE 2 . 3 may be packed into the edition field . If present each field will be preceeded by a ~ . Example ~edition~swEdition~targetSw~targetHw~other . |
10,444 | protected static Cpe parse23 ( String cpeString , boolean lenient ) throws CpeParsingException { if ( cpeString == null || cpeString . isEmpty ( ) ) { throw new CpeParsingException ( "CPE String is null ir enpty - unable to parse" ) ; } CpeBuilder cb = new CpeBuilder ( ) ; Cpe23PartIterator cpe = new Cpe23PartIterator ... | Parses a CPE 2 . 3 Formatted String . |
10,445 | public static Status component ( String value ) { if ( value != null && ! value . isEmpty ( ) ) { if ( "\\-" . equals ( value ) ) { return Status . SINGLE_QUOTED_HYPHEN ; } for ( int x = 0 ; x < value . length ( ) ; x ++ ) { char c = value . charAt ( x ) ; if ( c == '?' && x > 0 && x < value . length ( ) - 1 && ! ( ( v... | Validates the component to ensure it meets the CPE 2 . 3 specification of allowed values . |
10,446 | private static long countCharacter ( String value , char c ) { return value . chars ( ) . filter ( s -> s == c ) . count ( ) ; } | Counts the number of times the char c is contained in the value . |
10,447 | public static Status cpe ( String value ) { if ( "cpe:2.3:" . regionMatches ( 0 , value , 0 , 8 ) ) { return formattedString ( value ) ; } return cpeUri ( value ) ; } | Validates the given CPE string value to ensure it is either a valid CPE URI or Formatted String . |
10,448 | public static String fromWellFormed ( String value ) { if ( value == null ) { return LogicalValue . ANY . getAbbreviation ( ) ; } StringBuilder buffer = new StringBuilder ( value ) ; char p = ' ' ; for ( int x = 0 ; x < buffer . length ( ) - 1 ; x ++ ) { char c = buffer . charAt ( x ) ; if ( c == '\\' && p != '\\' ) { ... | Transforms the given well formed string into a non - escaped string . A well formed string has all non - alphanumeric characters escaped with a backslash . |
10,449 | public static String wellFormedToFS ( Part value ) { if ( value == null ) { return LogicalValue . ANY . getAbbreviation ( ) ; } return value . getAbbreviation ( ) ; } | Encodes the given value into the CPE 2 . 3 Formatted String representation . |
10,450 | public static Pattern wellFormedToPattern ( String value ) { StringBuilder sb = new StringBuilder ( value . length ( ) + 4 ) ; for ( int x = 0 ; x < value . length ( ) ; x ++ ) { if ( value . charAt ( x ) == '*' ) { sb . append ( ".*" ) ; } else if ( value . charAt ( x ) == '?' ) { sb . append ( "." ) ; } else if ( val... | Converts a well formed string into a regular expression pattern . |
10,451 | private void validate ( String vendor1 , String product1 , String version1 , String update1 , String edition1 , String language1 , String swEdition1 , String targetSw1 , String targetHw1 , String other1 ) throws CpeValidationException { Status status = Validate . component ( vendor1 ) ; if ( ! status . isValid ( ) ) { ... | Validates the CPE attributes . |
10,452 | public String toCpe22Uri ( ) throws CpeEncodingException { StringBuilder sb = new StringBuilder ( "cpe:/" ) ; sb . append ( Convert . wellFormedToCpeUri ( part ) ) . append ( ":" ) ; sb . append ( Convert . wellFormedToCpeUri ( vendor ) ) . append ( ":" ) ; sb . append ( Convert . wellFormedToCpeUri ( product ) ) . app... | Converts the CPE into the CPE 2 . 2 URI format . |
10,453 | public String toCpe23FS ( ) { return String . format ( "cpe:2.3:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s" , Convert . wellFormedToFS ( part ) , Convert . wellFormedToFS ( vendor ) , Convert . wellFormedToFS ( product ) , Convert . wellFormedToFS ( version ) , Convert . wellFormedToFS ( update ) , Convert . wellFormedToFS ( edi... | Converts the CPE into the CPE 2 . 3 Formatted String . |
10,454 | public boolean matches ( ICpe target ) { boolean result = true ; result &= compareAttributes ( this . part , target . getPart ( ) ) ; result &= compareAttributes ( this . vendor , target . getWellFormedVendor ( ) ) ; result &= compareAttributes ( this . product , target . getWellFormedProduct ( ) ) ; result &= compareA... | Determines if the CPE matches the given target CPE . This does not follow the CPE 2 . 3 Specification exactly as there are cases where undefined comparisons will result in either true or false . For instance ANY will match m + wild cards and NA will return false when the target has m + wild cards . |
10,455 | private static boolean containsSpecialCharacter ( String value ) { for ( int x = 0 ; x < value . length ( ) ; x ++ ) { char c = value . charAt ( x ) ; if ( c == '?' || c == '*' ) { return true ; } else if ( c == '\\' ) { x += 1 ; } } return false ; } | Determines if the string has an unquoted special character . |
10,456 | public int compareTo ( Object o ) { if ( o instanceof ICpe ) { ICpe otherObject = ( ICpe ) o ; final int before = - 1 ; final int equal = 0 ; final int after = 1 ; if ( this == otherObject ) { return equal ; } int r = getPart ( ) . getAbbreviation ( ) . compareTo ( otherObject . getPart ( ) . getAbbreviation ( ) ) ; if... | CompareTo is used for sorting this does not implement any CPE Matching rules . |
10,457 | protected static int compareVersions ( String left , String right ) { int result = 0 ; final List < String > subLeft = splitVersion ( left ) ; final List < String > subRight = splitVersion ( right ) ; final int subMax = ( subLeft . size ( ) <= subRight . size ( ) ) ? subLeft . size ( ) : subRight . size ( ) ; for ( int... | Compare version numbers to obtain the correct ordering . |
10,458 | protected void reset ( ) { part = Part . ANY ; vendor = LogicalValue . ANY . getAbbreviation ( ) ; product = LogicalValue . ANY . getAbbreviation ( ) ; version = LogicalValue . ANY . getAbbreviation ( ) ; update = LogicalValue . ANY . getAbbreviation ( ) ; edition = LogicalValue . ANY . getAbbreviation ( ) ; language =... | Resets the CPE Builder to a clean state . |
10,459 | public void add ( E element ) { if ( element == null ) throw new NullPointerException ( ) ; if ( root == null ) { root = new MutableNode < > ( element ) ; } else { MutableNode < E > node = root ; while ( ! node . getElement ( ) . equals ( element ) ) { int distance = distance ( node . getElement ( ) , element ) ; Mutab... | Adds the given element to this tree if it s not already present . |
10,460 | public Set < Match < ? extends E > > search ( E query , int maxDistance ) { if ( query == null ) throw new NullPointerException ( ) ; if ( maxDistance < 0 ) throw new IllegalArgumentException ( "maxDistance must be non-negative" ) ; Metric < ? super E > metric = tree . getMetric ( ) ; Set < Match < ? extends E > > matc... | Searches the tree for elements whose distance from the given query is less than or equal to the given maximum distance . |
10,461 | public boolean isLogger ( String loggerName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , LOGGING , LOGGER , loggerName ) ; return null != readResource ( addr ) ; } | Checks to see if there is already a logger with the given name . |
10,462 | public String getLoggerLevel ( String loggerName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , LOGGING , LOGGER , loggerName ) ; return getStringAttribute ( "level" , addr ) ; } | Returns the level of the given logger . |
10,463 | public void setLoggerLevel ( String loggerName , String level ) throws Exception { final Address addr = Address . root ( ) . add ( SUBSYSTEM , LOGGING , LOGGER , loggerName ) ; final ModelNode request ; if ( isLogger ( loggerName ) ) { request = createWriteAttributeRequest ( "level" , level , addr ) ; } else { final St... | Sets the logger to the given level . If the logger does not exist yet it will be created . |
10,464 | public boolean isWebSubsystem ( ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_WEB ) ; return null != readResource ( addr ) ; } | Checks to see if the web subsystem exists . This should always exist unless the server is just starting up and its web subsystem has not even initialized yet . |
10,465 | public void setEnableWelcomeRoot ( boolean enableFlag ) throws Exception { final Address address = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_WEB , VIRTUAL_SERVER , DEFAULT_HOST ) ; final ModelNode req = createWriteAttributeRequest ( "enable-welcome-root" , Boolean . toString ( enableFlag ) , address ) ; final Mo... | The enable - welcome - root setting controls whether or not to deploy JBoss welcome - content application at root context . If you want to deploy your own app at the root context you need to disable the enable - welcome - root setting on the default host virtual server . If you want to show the JBoss welcome screen you... |
10,466 | public boolean isConnector ( String name ) throws Exception { final Address address = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_WEB , CONNECTOR , name ) ; return null != readResource ( address ) ; } | Checks to see if there is already a connector with the given name . |
10,467 | public ModelNode getConnector ( String name ) throws Exception { final Address address = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_WEB , CONNECTOR , name ) ; return readResource ( address , true ) ; } | Returns the connector node with all its attributes . Will be null if it doesn t exist . |
10,468 | public void changeConnector ( String connectorName , String attribName , String attribValue ) throws Exception { final Address address = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_WEB , CONNECTOR , connectorName ) ; final ModelNode op = createWriteAttributeRequest ( attribName , attribValue , address ) ; final Mo... | Use this to modify an attribute for an existing connector . |
10,469 | public void removeConnector ( String doomedConnectorName ) throws Exception { final Address address = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_WEB , CONNECTOR , doomedConnectorName ) ; if ( isConnector ( doomedConnectorName ) ) { remove ( address ) ; } return ; } | Removes the given web connector . |
10,470 | public static ModelNode createWriteAttributeRequest ( String attributeName , String attributeValue , Address address ) { final ModelNode op = createRequest ( WRITE_ATTRIBUTE , address ) ; op . get ( NAME ) . set ( attributeName ) ; setPossibleExpression ( op , VALUE , attributeValue ) ; return op ; } | Convienence method that allows you to create request that writes a single attribute s string value to a resource . |
10,471 | public static ModelNode createRequest ( String operation , Address address ) { return createRequest ( operation , address , null ) ; } | Convienence method that builds a partial operation request node . |
10,472 | public static ModelNode createRequest ( String operation , Address address , ModelNode extra ) { final ModelNode request = ( extra != null ) ? extra . clone ( ) : new ModelNode ( ) ; request . get ( OPERATION ) . set ( operation ) ; request . get ( ADDRESS ) . set ( address . getAddressNode ( ) ) ; return request ; } | Convienence method that builds a partial operation request node with additional node properties supplied by the given node . |
10,473 | public static ModelNode createBatchRequest ( ModelNode ... steps ) { final ModelNode composite = new ModelNode ( ) ; composite . get ( OPERATION ) . set ( BATCH ) ; composite . get ( ADDRESS ) . setEmptyList ( ) ; final ModelNode stepsNode = composite . get ( BATCH_STEPS ) ; for ( ModelNode step : steps ) { if ( step !... | Creates a batch of operations that can be atomically invoked . |
10,474 | public static ModelNode getResults ( ModelNode operationResult ) { if ( ! operationResult . hasDefined ( RESULT ) ) { return new ModelNode ( ) ; } return operationResult . get ( RESULT ) ; } | If the given node has results those results are returned in a ModelNode . Otherwise an empty node is returned . |
10,475 | public ModelNode execute ( ModelNode request ) throws Exception { ModelControllerClient mcc = getModelControllerClient ( ) ; return mcc . execute ( request , OperationMessageHandler . logging ) ; } | Convienence method that executes the request . |
10,476 | public void remove ( Address doomedAddr ) throws Exception { final ModelNode request = createRequest ( REMOVE , doomedAddr ) ; final ModelNode response = execute ( request ) ; if ( ! isSuccess ( response ) ) { throw new FailureException ( response , "Failed to remove resource at address [" + doomedAddr + "]" ) ; } retu... | Removes the resource at the given address . |
10,477 | public void deploy ( String deploymentName , InputStream content , boolean enabled , Set < String > serverGroups , boolean forceDeploy ) { if ( serverGroups == null ) { serverGroups = Collections . emptySet ( ) ; } DeploymentResult result = null ; try { DeploymentManager dm = DeploymentManager . Factory . create ( getM... | Uploads the content to the app server s content repository and then deploys the content . If this is to be used for app servers in domain mode you have to pass in one or more server groups . If this is to be used to deploy an app in a standalone server the server groups should be empty . |
10,478 | public void undeploy ( String deploymentName , Set < String > serverGroups , boolean removeContent ) { if ( serverGroups == null ) { serverGroups = Collections . emptySet ( ) ; } DeploymentResult result = null ; try { DeploymentManager dm = DeploymentManager . Factory . create ( getModelControllerClient ( ) ) ; Undeplo... | Undeploys an app . If an empty set of server groups is passed in this will assume we are operating on a standalone server . |
10,479 | public boolean isVault ( ) throws Exception { Address addr = Address . root ( ) . add ( CORE_SERVICE , VAULT ) ; final ModelNode queryNode = createRequest ( READ_RESOURCE , addr ) ; final ModelNode results = execute ( queryNode ) ; if ( isSuccess ( results ) ) { return true ; } return false ; } | Checks to see if there is already a vault configured . |
10,480 | public String getVaultClass ( ) throws Exception { Address addr = Address . root ( ) . add ( CORE_SERVICE , VAULT ) ; ModelNode vaultNode = readResource ( addr ) ; if ( vaultNode == null ) { return null ; } ModelNode codeNode = vaultNode . get ( "code" ) ; if ( codeNode == null ) { return null ; } return codeNode . asS... | Attempts to retrieve the configured class for the vault . This method will return null if no vault is configured or if the vault does not have a custom vault class . |
10,481 | public ModelNode createNewVaultRequest ( String className ) { String dmrTemplate = "" + "{" + "\"code\" => \"%s\"" + "}" ; String dmr = String . format ( dmrTemplate , className ) ; Address addr = Address . root ( ) . add ( CORE_SERVICE , VAULT ) ; final ModelNode request = ModelNode . fromString ( dmr ) ; request . ge... | Returns a ModelNode that can be used to create the vault . Callers are free to tweak the queue request that is returned if they so choose before asking the client to execute the request . |
10,482 | public void setEnableAdminConsole ( boolean enableFlag ) throws Exception { final Address address = Address . root ( ) . add ( CORE_SERVICE , CORE_SERVICE_MGMT , MGMT_INTERFACE , MGMT_INTERFACE_HTTP ) ; final ModelNode req = createWriteAttributeRequest ( "console-enabled" , Boolean . toString ( enableFlag ) , address )... | Allows the caller to turn on or off complete access for the app server s admin console . |
10,483 | public Properties getSystemProperties ( ) throws Exception { final String [ ] address = { CORE_SERVICE , PLATFORM_MBEAN , "type" , "runtime" } ; final ModelNode op = createReadAttributeRequest ( true , "system-properties" , Address . root ( ) . add ( address ) ) ; final ModelNode results = execute ( op ) ; if ( isSucce... | This returns the system properties that are set in the AS JVM . This is not the system properties in the JVM of this client object - it is actually the system properties in the remote JVM of the AS instance that the client is talking to . |
10,484 | public void setAppServerDefaultDeploymentScanEnabled ( boolean enabled ) throws Exception { final String [ ] addressArr = { SUBSYSTEM , DEPLOYMENT_SCANNER , SCANNER , "default" } ; final Address address = Address . root ( ) . add ( addressArr ) ; final ModelNode req = createWriteAttributeRequest ( "scan-enabled" , Bool... | Enabled or disables the default deployment scanner . |
10,485 | public String getAppServerDefaultDeploymentDir ( ) throws Exception { final String [ ] addressArr = { SUBSYSTEM , DEPLOYMENT_SCANNER , SCANNER , "default" } ; final Address address = Address . root ( ) . add ( addressArr ) ; final ModelNode resourceAttributes = readResource ( address ) ; if ( resourceAttributes == null... | Returns the location where the default deployment scanner is pointing to . This is where EARs WARs and the like are deployed to . |
10,486 | public void setAppServerDefaultDeploymentTimeout ( long secs ) throws Exception { final String [ ] addressArr = { SUBSYSTEM , DEPLOYMENT_SCANNER , SCANNER , "default" } ; final Address address = Address . root ( ) . add ( addressArr ) ; final ModelNode req = createWriteAttributeRequest ( "deployment-timeout" , Long . t... | Sets the deployment timeout of the default deployment scanner . If a deployment takes longer than this value it will fail . |
10,487 | public void setSystemProperty ( String name , String value ) throws Exception { final ModelNode request = createRequest ( ADD , Address . root ( ) . add ( SYSTEM_PROPERTY , name ) ) ; request . get ( VALUE ) . set ( value ) ; final ModelNode response = execute ( request ) ; if ( ! isSuccess ( response ) ) { throw new F... | Set a runtime system property in the JVM that is managed by JBossAS . |
10,488 | public void addExtension ( String name ) throws Exception { final ModelNode request = createRequest ( ADD , Address . root ( ) . add ( EXTENSION , name ) ) ; request . get ( MODULE ) . set ( name ) ; final ModelNode response = execute ( request ) ; if ( ! isSuccess ( response ) ) { throw new FailureException ( response... | Adds a new module extension to the core system . |
10,489 | public boolean isExtension ( String name ) throws Exception { return null != readResource ( Address . root ( ) . add ( EXTENSION , name ) ) ; } | Returns true if the given extension is already in existence . |
10,490 | public boolean isSubsystem ( String name ) throws Exception { return null != readResource ( Address . root ( ) . add ( SUBSYSTEM , name ) ) ; } | Returns true if the given subsystem is already in existence . |
10,491 | public void reload ( boolean adminOnly ) throws Exception { final ModelNode request = createRequest ( "reload" , Address . root ( ) ) ; request . get ( "admin-only" ) . set ( adminOnly ) ; final ModelNode response = execute ( request ) ; if ( ! isSuccess ( response ) ) { throw new FailureException ( response ) ; } retu... | Invokes the management reload operation which will shut down all the app server services and restart them again potentially in admin - only mode . This does not shutdown the JVM itself . |
10,492 | public void shutdown ( boolean restart ) throws Exception { final ModelNode request = createRequest ( "shutdown" , Address . root ( ) ) ; request . get ( "restart" ) . set ( restart ) ; final ModelNode response = execute ( request ) ; if ( ! isSuccess ( response ) ) { throw new FailureException ( response ) ; } return ... | Invokes the management shutdown operation that kills the JVM completely with System . exit . If restart is set to true the JVM will immediately be restarted again . If restart is false the JVM is killed and will stay down . Note that in either case the caller may not be returned to since the JVM in which this call is m... |
10,493 | public boolean isQueue ( String queueName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_MESSAGING , HORNETQ_SERVER , "default" ) ; String haystack = JMS_QUEUE ; return null != findNodeInList ( addr , haystack , queueName ) ; } | Checks to see if there is already a queue with the given name . |
10,494 | public ModelNode createNewQueueRequest ( String name , Boolean durable , List < String > entryNames ) { String dmrTemplate = "" + "{" + "\"durable\" => \"%s\", " + "\"entries\" => [\"%s\"] " + "}" ; String dmr = String . format ( dmrTemplate , ( ( null == durable ) ? "true" : durable . toString ( ) ) , entryNames . get... | Returns a ModelNode that can be used to create a queue . Callers are free to tweak the queue request that is returned if they so choose before asking the client to execute the request . |
10,495 | @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] cloneArray ( T [ ] original ) { if ( original == null ) { return null ; } try { Class < ? > clazz = original . getClass ( ) . getComponentType ( ) ; T [ ] copy = ( T [ ] ) Array . newInstance ( clazz , original . length ) ; if ( copy . length != 0 ) { Constru... | Performs a deep copy of the given array by calling a copy constructor to build clones of each array element . |
10,496 | public boolean isSecurityDomain ( String securityDomainName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_SECURITY ) ; String haystack = SECURITY_DOMAIN ; return null != findNodeInList ( addr , haystack , securityDomainName ) ; } | Checks to see if there is already a security domain with the given name . |
10,497 | public void createNewSecureIdentitySecurityDomain72 ( String securityDomainName , String username , String password ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_SECURITY , SECURITY_DOMAIN , securityDomainName ) ; ModelNode addTopNode = createRequest ( ADD , addr ) ; addTopNode . ... | Create a new security domain using the SecureIdentity authentication method . This is used when you want to obfuscate a database password in the configuration . |
10,498 | public ModelNode getSecureIdentitySecurityDomainModuleOptions ( String securityDomainName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_SECURITY , SECURITY_DOMAIN , securityDomainName , AUTHENTICATION , CLASSIC ) ; ModelNode authResource = readResource ( addr ) ; List < ModelNode ... | Given the name of an existing security domain that uses the SecureIdentity authentication method this returns the module options for that security domain authentication method . This includes the username and password of the domain . |
10,499 | public void removeSecurityDomain ( String securityDomainName ) throws Exception { if ( ! isSecurityDomain ( securityDomainName ) ) { return ; } final Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_SECURITY , SECURITY_DOMAIN , securityDomainName ) ; ModelNode removeSecurityDomainNode = createRequest ( R... | Convenience method that removes a security domain by name . Useful when changing the characteristics of the login modules . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.