idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
145,600 | private ModelNode resolveExpressionStringRecursively ( final String expressionString , final boolean ignoreDMRResolutionFailure , final boolean initial ) throws OperationFailedException { ParseAndResolveResult resolved = parseAndResolve ( expressionString , ignoreDMRResolutionFailure ) ; if ( resolved . recursive ) { // Some part of expressionString resolved into a different expression. // So, start over, ignoring failures. Ignore failures because we don't require // that expressions must not resolve to something that *looks like* an expression but isn't return resolveExpressionStringRecursively ( resolved . result , true , false ) ; } else if ( resolved . modified ) { // Typical case return new ModelNode ( resolved . result ) ; } else if ( initial && EXPRESSION_PATTERN . matcher ( expressionString ) . matches ( ) ) { // We should only get an unmodified expression string back if there was a resolution // failure that we ignored. assert ignoreDMRResolutionFailure ; // expressionString came from a node of type expression, so since we did nothing send it back in the same type return new ModelNode ( new ValueExpression ( expressionString ) ) ; } else { // The string wasn't really an expression. Two possible cases: // 1) if initial == true, someone created a expression node with a non-expression string, which is legal // 2) if initial == false, we resolved from an ModelType.EXPRESSION to a string that looked like an // expression but can't be resolved. We don't require that expressions must not resolve to something that // *looks like* an expression but isn't, so we'll just treat this as a string return new ModelNode ( expressionString ) ; } } | Attempt to resolve the given expression string recursing if resolution of one string produces another expression . | 363 | 19 |
145,601 | private String resolveExpressionString ( final String unresolvedString ) throws OperationFailedException { // parseAndResolve should only be providing expressions with no leading or trailing chars assert unresolvedString . startsWith ( "${" ) && unresolvedString . endsWith ( "}" ) ; // Default result is no change from input String result = unresolvedString ; ModelNode resolveNode = new ModelNode ( new ValueExpression ( unresolvedString ) ) ; // Try plug-in resolution; i.e. vault resolvePluggableExpression ( resolveNode ) ; if ( resolveNode . getType ( ) == ModelType . EXPRESSION ) { // resolvePluggableExpression did nothing. Try standard resolution String resolvedString = resolveStandardExpression ( resolveNode ) ; if ( ! unresolvedString . equals ( resolvedString ) ) { // resolveStandardExpression made progress result = resolvedString ; } // else there is nothing more we can do with this string } else { // resolvePluggableExpression made progress result = resolveNode . asString ( ) ; } return result ; } | Resolve the given string using any plugin and the DMR resolve method | 220 | 14 |
145,602 | private static XMLStreamException unexpectedElement ( final XMLStreamReader reader ) { return SecurityManagerLogger . ROOT_LOGGER . unexpectedElement ( reader . getName ( ) , reader . getLocation ( ) ) ; } | Gets an exception reporting an unexpected XML element . | 46 | 10 |
145,603 | private static XMLStreamException unexpectedAttribute ( final XMLStreamReader reader , final int index ) { return SecurityManagerLogger . ROOT_LOGGER . unexpectedAttribute ( reader . getAttributeName ( index ) , reader . getLocation ( ) ) ; } | Gets an exception reporting an unexpected XML attribute . | 52 | 10 |
145,604 | public static byte [ ] storeContentAndTransformOperation ( OperationContext context , ModelNode operation , ContentRepository contentRepository ) throws IOException , OperationFailedException { if ( ! operation . hasDefined ( CONTENT ) ) { throw createFailureException ( DomainControllerLogger . ROOT_LOGGER . invalidContentDeclaration ( ) ) ; } final ModelNode content = operation . get ( CONTENT ) . get ( 0 ) ; if ( content . hasDefined ( HASH ) ) { // This should be handled as part of the OSH throw createFailureException ( DomainControllerLogger . ROOT_LOGGER . invalidContentDeclaration ( ) ) ; } final byte [ ] hash = storeDeploymentContent ( context , operation , contentRepository ) ; // Clear the contents and update with the hash final ModelNode slave = operation . clone ( ) ; slave . get ( CONTENT ) . setEmptyList ( ) . add ( ) . get ( HASH ) . set ( hash ) ; // Add the domain op transformer List < DomainOperationTransmuter > transformers = context . getAttachment ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS ) ; if ( transformers == null ) { context . attach ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS , transformers = new ArrayList <> ( ) ) ; } transformers . add ( new CompositeOperationAwareTransmuter ( slave ) ) ; return hash ; } | Store the deployment contents and attach a transformed slave operation to the operation context . | 319 | 15 |
145,605 | public static byte [ ] explodeContentAndTransformOperation ( OperationContext context , ModelNode operation , ContentRepository contentRepository ) throws OperationFailedException , ExplodedContentException { final Resource deploymentResource = context . readResource ( PathAddress . EMPTY_ADDRESS ) ; ModelNode contentItem = getContentItem ( deploymentResource ) ; ModelNode explodedPath = DEPLOYMENT_CONTENT_PATH . resolveModelAttribute ( context , operation ) ; byte [ ] oldHash = CONTENT_HASH . resolveModelAttribute ( context , contentItem ) . asBytes ( ) ; final byte [ ] hash ; if ( explodedPath . isDefined ( ) ) { hash = contentRepository . explodeSubContent ( oldHash , explodedPath . asString ( ) ) ; } else { hash = contentRepository . explodeContent ( oldHash ) ; } // Clear the contents and update with the hash final ModelNode slave = operation . clone ( ) ; ModelNode addedContent = new ModelNode ( ) . setEmptyObject ( ) ; addedContent . get ( HASH ) . set ( hash ) ; addedContent . get ( TARGET_PATH . getName ( ) ) . set ( "./" ) ; slave . get ( CONTENT ) . setEmptyList ( ) . add ( addedContent ) ; // Add the domain op transformer List < DomainOperationTransmuter > transformers = context . getAttachment ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS ) ; if ( transformers == null ) { context . attach ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS , transformers = new ArrayList <> ( ) ) ; } transformers . add ( new CompositeOperationAwareTransmuter ( slave ) ) ; return hash ; } | Explode the deployment contents and attach a transformed slave operation to the operation context . | 382 | 16 |
145,606 | public static byte [ ] addContentToExplodedAndTransformOperation ( OperationContext context , ModelNode operation , ContentRepository contentRepository ) throws OperationFailedException , ExplodedContentException { final Resource deploymentResource = context . readResource ( PathAddress . EMPTY_ADDRESS ) ; ModelNode contentItem = getContentItem ( deploymentResource ) ; byte [ ] oldHash = CONTENT_HASH . resolveModelAttribute ( context , contentItem ) . asBytes ( ) ; List < ModelNode > contents = CONTENT_PARAM_ALL_EXPLODED . resolveModelAttribute ( context , operation ) . asList ( ) ; final List < ExplodedContent > addedFiles = new ArrayList <> ( contents . size ( ) ) ; final ModelNode slave = operation . clone ( ) ; ModelNode slaveAddedfiles = slave . get ( UPDATED_PATHS . getName ( ) ) . setEmptyList ( ) ; for ( ModelNode content : contents ) { InputStream in ; if ( hasValidContentAdditionParameterDefined ( content ) ) { in = getInputStream ( context , content ) ; } else { in = null ; } String path = TARGET_PATH . resolveModelAttribute ( context , content ) . asString ( ) ; addedFiles . add ( new ExplodedContent ( path , in ) ) ; slaveAddedfiles . add ( path ) ; } final boolean overwrite = OVERWRITE . resolveModelAttribute ( context , operation ) . asBoolean ( true ) ; final byte [ ] hash = contentRepository . addContentToExploded ( oldHash , addedFiles , overwrite ) ; // Clear the contents and update with the hash ModelNode addedContent = new ModelNode ( ) . setEmptyObject ( ) ; addedContent . get ( HASH ) . set ( hash ) ; addedContent . get ( TARGET_PATH . getName ( ) ) . set ( "." ) ; slave . get ( CONTENT ) . setEmptyList ( ) . add ( addedContent ) ; // Add the domain op transformer List < DomainOperationTransmuter > transformers = context . getAttachment ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS ) ; if ( transformers == null ) { context . attach ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS , transformers = new ArrayList <> ( ) ) ; } transformers . add ( new CompositeOperationAwareTransmuter ( slave ) ) ; return hash ; } | Add contents to the deployment and attach a transformed slave operation to the operation context . | 533 | 16 |
145,607 | public static byte [ ] removeContentFromExplodedAndTransformOperation ( OperationContext context , ModelNode operation , ContentRepository contentRepository ) throws OperationFailedException , ExplodedContentException { final Resource deploymentResource = context . readResource ( PathAddress . EMPTY_ADDRESS ) ; ModelNode contentItemNode = getContentItem ( deploymentResource ) ; final byte [ ] oldHash = CONTENT_HASH . resolveModelAttribute ( context , contentItemNode ) . asBytes ( ) ; final List < String > paths = REMOVED_PATHS . unwrap ( context , operation ) ; final byte [ ] hash = contentRepository . removeContentFromExploded ( oldHash , paths ) ; // Clear the contents and update with the hash final ModelNode slave = operation . clone ( ) ; slave . get ( CONTENT ) . setEmptyList ( ) . add ( ) . get ( HASH ) . set ( hash ) ; slave . get ( CONTENT ) . add ( ) . get ( ARCHIVE ) . set ( false ) ; // Add the domain op transformer List < DomainOperationTransmuter > transformers = context . getAttachment ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS ) ; if ( transformers == null ) { context . attach ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS , transformers = new ArrayList <> ( ) ) ; } transformers . add ( new CompositeOperationAwareTransmuter ( slave ) ) ; return hash ; } | Remove contents from the deployment and attach a transformed slave operation to the operation context . | 331 | 16 |
145,608 | public static byte [ ] synchronizeSlaveHostController ( ModelNode operation , final PathAddress address , HostFileRepository fileRepository , ContentRepository contentRepository , boolean backup , byte [ ] oldHash ) { ModelNode operationContentItem = operation . get ( DeploymentAttributes . CONTENT_RESOURCE_ALL . getName ( ) ) . get ( 0 ) ; byte [ ] newHash = operationContentItem . require ( CONTENT_HASH . getName ( ) ) . asBytes ( ) ; if ( needRemoteContent ( fileRepository , contentRepository , backup , oldHash ) ) { // backup DC needs to pull the content fileRepository . getDeploymentFiles ( ModelContentReference . fromModelAddress ( address , newHash ) ) ; } return newHash ; } | Synchronize the required files to a slave HC from the master DC if this is required . | 167 | 19 |
145,609 | public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; for ( ResourceRoot resourceRoot : DeploymentUtils . allResourceRoots ( deploymentUnit ) ) { ResourceRootIndexer . indexResourceRoot ( resourceRoot ) ; } } | Process this deployment for annotations . This will use an annotation indexer to create an index of all annotations found in this deployment and attach it to the deployment unit context . | 73 | 33 |
145,610 | public static File newFile ( File baseDir , String ... segments ) { File f = baseDir ; for ( String segment : segments ) { f = new File ( f , segment ) ; } return f ; } | Return a new File object based on the baseDir and the segments . | 44 | 14 |
145,611 | public PasswordCheckResult check ( boolean isAdminitrative , String userName , String password ) { // TODO: allow custom restrictions? List < PasswordRestriction > passwordValuesRestrictions = getPasswordRestrictions ( ) ; final PasswordStrengthCheckResult strengthResult = this . passwordStrengthChecker . check ( userName , password , passwordValuesRestrictions ) ; final int failedRestrictions = strengthResult . getRestrictionFailures ( ) . size ( ) ; final PasswordStrength strength = strengthResult . getStrength ( ) ; final boolean strongEnough = assertStrength ( strength ) ; PasswordCheckResult . Result resultAction ; String resultMessage = null ; if ( isAdminitrative ) { if ( strongEnough ) { if ( failedRestrictions > 0 ) { resultAction = Result . WARN ; resultMessage = strengthResult . getRestrictionFailures ( ) . get ( 0 ) . getMessage ( ) ; } else { resultAction = Result . ACCEPT ; } } else { resultAction = Result . WARN ; resultMessage = ROOT_LOGGER . passwordNotStrongEnough ( strength . toString ( ) , this . acceptable . toString ( ) ) ; } } else { if ( strongEnough ) { if ( failedRestrictions > 0 ) { resultAction = Result . REJECT ; resultMessage = strengthResult . getRestrictionFailures ( ) . get ( 0 ) . getMessage ( ) ; } else { resultAction = Result . ACCEPT ; } } else { if ( failedRestrictions > 0 ) { resultAction = Result . REJECT ; resultMessage = strengthResult . getRestrictionFailures ( ) . get ( 0 ) . getMessage ( ) ; } else { resultAction = Result . REJECT ; resultMessage = ROOT_LOGGER . passwordNotStrongEnough ( strength . toString ( ) , this . acceptable . toString ( ) ) ; } } } return new PasswordCheckResult ( resultAction , resultMessage ) ; } | Method which performs strength checks on password . It returns outcome which can be used by CLI . | 415 | 18 |
145,612 | public String getCmdLineArg ( ) { StringBuilder builder = new StringBuilder ( " --server-groups=" ) ; boolean foundSelected = false ; for ( JCheckBox serverGroup : serverGroups ) { if ( serverGroup . isSelected ( ) ) { foundSelected = true ; builder . append ( serverGroup . getText ( ) ) ; builder . append ( "," ) ; } } builder . deleteCharAt ( builder . length ( ) - 1 ) ; // remove trailing comma if ( ! foundSelected ) return "" ; return builder . toString ( ) ; } | Return the command line argument | 124 | 5 |
145,613 | public static boolean isCompleteZip ( File file ) throws IOException , NonScannableZipException { FileChannel channel = null ; try { channel = new FileInputStream ( file ) . getChannel ( ) ; long size = channel . size ( ) ; if ( size < ENDLEN ) { // Obvious case return false ; } else if ( validateEndRecord ( file , channel , size - ENDLEN ) ) { // typical case where file is complete and end record has no comment return true ; } // Either file is incomplete or the end of central directory record includes an arbitrary length comment // So, we have to scan backwards looking for an end of central directory record return scanForEndSig ( file , channel ) ; } finally { safeClose ( channel ) ; } } | Scans the given file looking for a complete zip file format end of central directory record . | 162 | 18 |
145,614 | private static boolean scanForEndSig ( File file , FileChannel channel ) throws IOException , NonScannableZipException { // TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex ByteBuffer bb = getByteBuffer ( CHUNK_SIZE ) ; long start = channel . size ( ) ; long end = Math . max ( 0 , start - MAX_REVERSE_SCAN ) ; long channelPos = Math . max ( 0 , start - CHUNK_SIZE ) ; long lastChannelPos = channelPos ; boolean firstRead = true ; while ( lastChannelPos >= end ) { read ( bb , channel , channelPos ) ; int actualRead = bb . limit ( ) ; if ( firstRead ) { long expectedRead = Math . min ( CHUNK_SIZE , start ) ; if ( actualRead > expectedRead ) { // File is still growing return false ; } firstRead = false ; } int bufferPos = actualRead - 1 ; while ( bufferPos >= SIG_PATTERN_LENGTH ) { // Following is based on the Boyer Moore algorithm but simplified to reflect // a) the pattern is static // b) the pattern has no repeating bytes int patternPos ; for ( patternPos = SIG_PATTERN_LENGTH - 1 ; patternPos >= 0 && ENDSIG_PATTERN [ patternPos ] == bb . get ( bufferPos - patternPos ) ; -- patternPos ) { // empty loop while bytes match } // Switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm switch ( patternPos ) { case - 1 : { // Pattern matched. Confirm is this is the start of a valid end of central dir record long startEndRecord = channelPos + bufferPos - SIG_PATTERN_LENGTH + 1 ; if ( validateEndRecord ( file , channel , startEndRecord ) ) { return true ; } // wasn't a valid end record; continue scan bufferPos -= 4 ; break ; } case 3 : { // No bytes matched; the common case. // With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may // produce a shift greater than the "good suffix array" (which would shift 1 byte) int idx = bb . get ( bufferPos - patternPos ) - Byte . MIN_VALUE ; bufferPos -= END_BAD_BYTE_SKIP [ idx ] ; break ; } default : // 1 or more bytes matched bufferPos -= 4 ; } } // Move back a full chunk. If we didn't read a full chunk, that's ok, // it means we read all data and the outer while loop will terminate if ( channelPos <= bufferPos ) { break ; } lastChannelPos = channelPos ; channelPos -= Math . min ( channelPos - bufferPos , CHUNK_SIZE - bufferPos ) ; } return false ; } | Boyer Moore scan that proceeds backwards from the end of the file looking for ENDSIG | 626 | 18 |
145,615 | static void sendFailedResponse ( final ManagementRequestContext < RegistrationContext > context , final byte errorCode , final String message ) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader . create ( context . getRequestHeader ( ) ) ; final FlushableDataOutput output = context . writeMessage ( header ) ; try { // This is an error output . writeByte ( DomainControllerProtocol . PARAM_ERROR ) ; // send error code output . writeByte ( errorCode ) ; // error message if ( message == null ) { output . writeUTF ( "unknown error" ) ; } else { output . writeUTF ( message ) ; } // response end output . writeByte ( ManagementProtocol . RESPONSE_END ) ; output . close ( ) ; } finally { StreamUtils . safeClose ( output ) ; } } | Send a failed operation response . | 176 | 6 |
145,616 | public static boolean isOperationDefined ( final ModelNode operation ) { for ( final AttributeDefinition def : ROOT_ATTRIBUTES ) { if ( operation . hasDefined ( def . getName ( ) ) ) { return true ; } } return false ; } | Test whether the operation has a defined criteria attribute . | 58 | 10 |
145,617 | @ Deprecated private static ListAttributeDefinition wrapAsList ( final AttributeDefinition def ) { final ListAttributeDefinition list = new ListAttributeDefinition ( new SimpleListAttributeDefinition . Builder ( def . getName ( ) , def ) . setElementValidator ( def . getValidator ( ) ) ) { @ Override public ModelNode getNoTextDescription ( boolean forOperation ) { final ModelNode model = super . getNoTextDescription ( forOperation ) ; setValueType ( model ) ; return model ; } @ Override protected void addValueTypeDescription ( final ModelNode node , final ResourceBundle bundle ) { setValueType ( node ) ; } @ Override public void marshallAsElement ( final ModelNode resourceModel , final boolean marshalDefault , final XMLStreamWriter writer ) throws XMLStreamException { throw new RuntimeException ( ) ; } @ Override protected void addAttributeValueTypeDescription ( ModelNode node , ResourceDescriptionResolver resolver , Locale locale , ResourceBundle bundle ) { setValueType ( node ) ; } @ Override protected void addOperationParameterValueTypeDescription ( ModelNode node , String operationName , ResourceDescriptionResolver resolver , Locale locale , ResourceBundle bundle ) { setValueType ( node ) ; } private void setValueType ( ModelNode node ) { node . get ( ModelDescriptionConstants . VALUE_TYPE ) . set ( ModelType . STRING ) ; } } ; return list ; } | Wrap a simple attribute def as list . | 304 | 9 |
145,618 | private static int resolveDomainTimeoutAdder ( ) { String propValue = WildFlySecurityManager . getPropertyPrivileged ( DOMAIN_TEST_SYSTEM_PROPERTY , DEFAULT_DOMAIN_TIMEOUT_STRING ) ; if ( sysPropDomainValue == null || ! sysPropDomainValue . equals ( propValue ) ) { // First call or the system property changed sysPropDomainValue = propValue ; int number = - 1 ; try { number = Integer . valueOf ( sysPropDomainValue ) ; } catch ( NumberFormatException nfe ) { // ignored } if ( number > 0 ) { defaultDomainValue = number ; // this one is in ms } else { ControllerLogger . MGMT_OP_LOGGER . invalidDefaultBlockingTimeout ( sysPropDomainValue , DOMAIN_TEST_SYSTEM_PROPERTY , DEFAULT_DOMAIN_TIMEOUT_ADDER ) ; defaultDomainValue = DEFAULT_DOMAIN_TIMEOUT_ADDER ; } } return defaultDomainValue ; } | Allows testsuites to shorten the domain timeout adder | 218 | 11 |
145,619 | public TransformersSubRegistration getDomainRegistration ( final ModelVersionRange range ) { final PathAddress address = PathAddress . EMPTY_ADDRESS ; return new TransformersSubRegistrationImpl ( range , domain , address ) ; } | Get the sub registry for the domain . | 45 | 8 |
145,620 | public TransformersSubRegistration getHostRegistration ( final ModelVersionRange range ) { final PathAddress address = PathAddress . EMPTY_ADDRESS . append ( HOST ) ; return new TransformersSubRegistrationImpl ( range , domain , address ) ; } | Get the sub registry for the hosts . | 51 | 8 |
145,621 | public TransformersSubRegistration getServerRegistration ( final ModelVersionRange range ) { final PathAddress address = PathAddress . EMPTY_ADDRESS . append ( HOST , SERVER ) ; return new TransformersSubRegistrationImpl ( range , domain , address ) ; } | Get the sub registry for the servers . | 54 | 8 |
145,622 | public OperationTransformerRegistry resolveServer ( final ModelVersion mgmtVersion , final ModelNode subsystems ) { return resolveServer ( mgmtVersion , resolveVersions ( subsystems ) ) ; } | Resolve the server registry . | 40 | 6 |
145,623 | void addSubsystem ( final OperationTransformerRegistry registry , final String name , final ModelVersion version ) { final OperationTransformerRegistry profile = registry . getChild ( PathAddress . pathAddress ( PROFILE ) ) ; final OperationTransformerRegistry server = registry . getChild ( PathAddress . pathAddress ( HOST , SERVER ) ) ; final PathAddress address = PathAddress . pathAddress ( PathElement . pathElement ( ModelDescriptionConstants . SUBSYSTEM , name ) ) ; subsystem . mergeSubtree ( profile , Collections . singletonMap ( address , version ) ) ; if ( server != null ) { subsystem . mergeSubtree ( server , Collections . singletonMap ( address , version ) ) ; } } | Add a new subsystem to a given registry . | 154 | 9 |
145,624 | public synchronized void persistProperties ( ) throws IOException { beginPersistence ( ) ; // Read the properties file into memory // Shouldn't be so bad - it's a small file List < String > content = readFile ( propertiesFile ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( propertiesFile ) , StandardCharsets . UTF_8 ) ) ; try { for ( String line : content ) { String trimmed = line . trim ( ) ; if ( trimmed . length ( ) == 0 ) { bw . newLine ( ) ; } else { Matcher matcher = PROPERTY_PATTERN . matcher ( trimmed ) ; if ( matcher . matches ( ) ) { final String key = cleanKey ( matcher . group ( 1 ) ) ; if ( toSave . containsKey ( key ) || toSave . containsKey ( key + DISABLE_SUFFIX_KEY ) ) { writeProperty ( bw , key , matcher . group ( 2 ) ) ; toSave . remove ( key ) ; toSave . remove ( key + DISABLE_SUFFIX_KEY ) ; } else if ( trimmed . startsWith ( COMMENT_PREFIX ) ) { // disabled user write ( bw , line , true ) ; } } else { write ( bw , line , true ) ; } } } endPersistence ( bw ) ; } finally { safeClose ( bw ) ; } } | Saves changes in properties file . It reads the property file into memory modifies it and saves it back to the file . | 313 | 25 |
145,625 | protected void addLineContent ( BufferedReader bufferedFileReader , List < String > content , String line ) throws IOException { content . add ( line ) ; } | Add the line to the content | 35 | 6 |
145,626 | protected void endPersistence ( final BufferedWriter writer ) throws IOException { // Append any additional users to the end of the file. for ( Object currentKey : toSave . keySet ( ) ) { String key = ( String ) currentKey ; if ( ! key . contains ( DISABLE_SUFFIX_KEY ) ) { writeProperty ( writer , key , null ) ; } } toSave = null ; } | Method called to indicate persisting the properties file is now complete . | 89 | 13 |
145,627 | public List < String > getServiceImplementations ( String serviceTypeName ) { final List < String > strings = services . get ( serviceTypeName ) ; return strings == null ? Collections . < String > emptyList ( ) : Collections . unmodifiableList ( strings ) ; } | Get the service implementations for a given type name . | 59 | 10 |
145,628 | static synchronized LogContext configureLogContext ( final File logDir , final File configDir , final String defaultLogFileName , final CommandContext ctx ) { final LogContext embeddedLogContext = Holder . LOG_CONTEXT ; final Path bootLog = logDir . toPath ( ) . resolve ( Paths . get ( defaultLogFileName ) ) ; final Path loggingProperties = configDir . toPath ( ) . resolve ( Paths . get ( "logging.properties" ) ) ; if ( Files . exists ( loggingProperties ) ) { WildFlySecurityManager . setPropertyPrivileged ( "org.jboss.boot.log.file" , bootLog . toAbsolutePath ( ) . toString ( ) ) ; try ( final InputStream in = Files . newInputStream ( loggingProperties ) ) { // Attempt to get the configurator from the root logger Configurator configurator = embeddedLogContext . getAttachment ( "" , Configurator . ATTACHMENT_KEY ) ; if ( configurator == null ) { configurator = new PropertyConfigurator ( embeddedLogContext ) ; final Configurator existing = embeddedLogContext . getLogger ( "" ) . attachIfAbsent ( Configurator . ATTACHMENT_KEY , configurator ) ; if ( existing != null ) { configurator = existing ; } } configurator . configure ( in ) ; } catch ( IOException e ) { ctx . printLine ( String . format ( "Unable to configure logging from configuration file %s. Reason: %s" , loggingProperties , e . getLocalizedMessage ( ) ) ) ; } } return embeddedLogContext ; } | Configures the log context for the server and returns the configured log context . | 357 | 15 |
145,629 | static synchronized void clearLogContext ( ) { final LogContext embeddedLogContext = Holder . LOG_CONTEXT ; // Remove the configurator and clear the log context final Configurator configurator = embeddedLogContext . getLogger ( "" ) . detach ( Configurator . ATTACHMENT_KEY ) ; // If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext if ( configurator instanceof PropertyConfigurator ) { final LogContextConfiguration logContextConfiguration = ( ( PropertyConfigurator ) configurator ) . getLogContextConfiguration ( ) ; clearLogContext ( logContextConfiguration ) ; } else if ( configurator instanceof LogContextConfiguration ) { clearLogContext ( ( LogContextConfiguration ) configurator ) ; } else { // Remove all the handlers and close them as well as reset the loggers final List < String > loggerNames = Collections . list ( embeddedLogContext . getLoggerNames ( ) ) ; for ( String name : loggerNames ) { final Logger logger = embeddedLogContext . getLoggerIfExists ( name ) ; if ( logger != null ) { final Handler [ ] handlers = logger . clearHandlers ( ) ; if ( handlers != null ) { for ( Handler handler : handlers ) { handler . close ( ) ; } } logger . setFilter ( null ) ; logger . setUseParentFilters ( false ) ; logger . setUseParentHandlers ( true ) ; logger . setLevel ( Level . INFO ) ; } } } } | Attempts to clear the global log context used for embedded servers . | 324 | 12 |
145,630 | public static String matchOrigin ( HttpServerExchange exchange , Collection < String > allowedOrigins ) throws Exception { HeaderMap headers = exchange . getRequestHeaders ( ) ; String [ ] origins = headers . get ( Headers . ORIGIN ) . toArray ( ) ; if ( allowedOrigins != null && ! allowedOrigins . isEmpty ( ) ) { for ( String allowedOrigin : allowedOrigins ) { for ( String origin : origins ) { if ( allowedOrigin . equalsIgnoreCase ( sanitizeDefaultPort ( origin ) ) ) { return allowedOrigin ; } } } } String allowedOrigin = defaultOrigin ( exchange ) ; for ( String origin : origins ) { if ( allowedOrigin . equalsIgnoreCase ( sanitizeDefaultPort ( origin ) ) ) { return allowedOrigin ; } } ROOT_LOGGER . debug ( "Request rejected due to HOST/ORIGIN mis-match." ) ; ResponseCodeHandler . HANDLE_403 . handleRequest ( exchange ) ; return null ; } | Match the Origin header with the allowed origins . If it doesn t match then a 403 response code is set on the response and it returns null . | 215 | 29 |
145,631 | public static DeploymentReflectionIndex create ( ) { final SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { sm . checkPermission ( ServerPermission . CREATE_DEPLOYMENT_REFLECTION_INDEX ) ; } return new DeploymentReflectionIndex ( ) ; } | Construct a new instance . | 69 | 5 |
145,632 | @ Override public final Map < String , OperationEntry > getOperationDescriptions ( final PathAddress address , boolean inherited ) { if ( parent != null ) { RootInvocation ri = getRootInvocation ( ) ; return ri . root . getOperationDescriptions ( ri . pathAddress . append ( address ) , inherited ) ; } // else we are the root Map < String , OperationEntry > providers = new TreeMap < String , OperationEntry > ( ) ; getOperationDescriptions ( address . iterator ( ) , providers , inherited ) ; return providers ; } | Get all the handlers at a specific address . | 122 | 9 |
145,633 | boolean hasNoAlternativeWildcardRegistration ( ) { return parent == null || PathElement . WILDCARD_VALUE . equals ( valueString ) || ! parent . getChildNames ( ) . contains ( PathElement . WILDCARD_VALUE ) ; } | Gets whether this registration has an alternative wildcard registration | 55 | 11 |
145,634 | public static ModelNode getAccessControl ( ModelControllerClient client , OperationRequestAddress address , boolean operations ) { return getAccessControl ( client , null , address , operations ) ; } | Executed read - resource - description and returns access - control info . Returns null in case there was any kind of problem . | 37 | 25 |
145,635 | String generateSynopsis ( ) { synopsisOptions = buildSynopsisOptions ( opts , arg , domain ) ; StringBuilder synopsisBuilder = new StringBuilder ( ) ; if ( parentName != null ) { synopsisBuilder . append ( parentName ) . append ( " " ) ; } synopsisBuilder . append ( commandName ) ; if ( isOperation && ! opts . isEmpty ( ) ) { synopsisBuilder . append ( "(" ) ; } else { synopsisBuilder . append ( " " ) ; } boolean hasOptions = arg != null || ! opts . isEmpty ( ) ; if ( hasActions && hasOptions ) { synopsisBuilder . append ( " [" ) ; } if ( hasActions ) { synopsisBuilder . append ( " <action>" ) ; } if ( hasActions && hasOptions ) { synopsisBuilder . append ( " ] || [" ) ; } SynopsisOption opt ; while ( ( opt = retrieveNextOption ( synopsisOptions , false ) ) != null ) { String content = addSynopsisOption ( opt ) ; if ( content != null ) { synopsisBuilder . append ( content . trim ( ) ) ; if ( isOperation ) { if ( ! synopsisOptions . isEmpty ( ) ) { synopsisBuilder . append ( "," ) ; } else { synopsisBuilder . append ( ")" ) ; } } synopsisBuilder . append ( " " ) ; } } if ( hasActions && hasOptions ) { synopsisBuilder . append ( " ]" ) ; } return synopsisBuilder . toString ( ) ; } | main class entry point . | 316 | 5 |
145,636 | protected static InstallationModificationImpl . InstallationState load ( final InstalledIdentity installedIdentity ) throws IOException { final InstallationModificationImpl . InstallationState state = new InstallationModificationImpl . InstallationState ( ) ; for ( final Layer layer : installedIdentity . getLayers ( ) ) { state . putLayer ( layer ) ; } for ( final AddOn addOn : installedIdentity . getAddOns ( ) ) { state . putAddOn ( addOn ) ; } return state ; } | Load the installation state based on the identity | 106 | 8 |
145,637 | public static InstalledIdentity load ( final File jbossHome , final ProductConfig productConfig , final File ... repoRoots ) throws IOException { final InstalledImage installedImage = installedImage ( jbossHome ) ; return load ( installedImage , productConfig , Arrays . < File > asList ( repoRoots ) , Collections . < File > emptyList ( ) ) ; } | Load the layers based on the default setup . | 81 | 9 |
145,638 | public static InstalledIdentity load ( final InstalledImage installedImage , final ProductConfig productConfig , List < File > moduleRoots , final List < File > bundleRoots ) throws IOException { return LayersFactory . load ( installedImage , productConfig , moduleRoots , bundleRoots ) ; } | Load the InstalledIdentity configuration based on the module . path | 65 | 13 |
145,639 | public void shutdown ( ) { final Connection connection ; synchronized ( this ) { if ( shutdown ) return ; shutdown = true ; connection = this . connection ; if ( connectTask != null ) { connectTask . shutdown ( ) ; } } if ( connection != null ) { connection . closeAsync ( ) ; } } | Shutdown the connection manager . | 64 | 6 |
145,640 | private void onConnectionClose ( final Connection closed ) { synchronized ( this ) { if ( connection == closed ) { connection = null ; if ( shutdown ) { connectTask = DISCONNECTED ; return ; } final ConnectTask previous = connectTask ; connectTask = previous . connectionClosed ( ) ; } } } | Notification that a connection was closed . | 65 | 8 |
145,641 | public static ProtocolConnectionManager create ( final Connection connection , final ConnectionOpenHandler openHandler ) { return create ( new EstablishedConnection ( connection , openHandler ) ) ; } | Create a new connection manager based on an existing connection . | 35 | 11 |
145,642 | public void await ( ) { boolean intr = false ; final Object lock = this . lock ; try { synchronized ( lock ) { while ( ! readClosed ) { try { lock . wait ( ) ; } catch ( InterruptedException e ) { intr = true ; } } } } finally { if ( intr ) { Thread . currentThread ( ) . interrupt ( ) ; } } } | Wait for the read side to close . Used when the writer needs to know when the reader finishes consuming a message . | 80 | 23 |
145,643 | public void removeExtension ( Resource rootResource , String moduleName , ManagementResourceRegistration rootRegistration ) throws IllegalStateException { final ManagementResourceRegistration profileReg ; if ( rootRegistration . getPathAddress ( ) . size ( ) == 0 ) { //domain or server extension // Can't use processType.isServer() to determine where to look for profile reg because a lot of test infrastructure // doesn't add the profile mrr even in HC-based tests ManagementResourceRegistration reg = rootRegistration . getSubModel ( PathAddress . pathAddress ( PathElement . pathElement ( PROFILE ) ) ) ; if ( reg == null ) { reg = rootRegistration ; } profileReg = reg ; } else { //host model extension profileReg = rootRegistration ; } ManagementResourceRegistration deploymentsReg = processType . isServer ( ) ? rootRegistration . getSubModel ( PathAddress . pathAddress ( PathElement . pathElement ( DEPLOYMENT ) ) ) : null ; ExtensionInfo extension = extensions . remove ( moduleName ) ; if ( extension != null ) { //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized ( extension ) { Set < String > subsystemNames = extension . subsystems . keySet ( ) ; final boolean dcExtension = processType . isHostController ( ) ? rootRegistration . getPathAddress ( ) . size ( ) == 0 : false ; for ( String subsystem : subsystemNames ) { if ( hasSubsystemsRegistered ( rootResource , subsystem , dcExtension ) ) { // Restore the data extensions . put ( moduleName , extension ) ; throw ControllerLogger . ROOT_LOGGER . removingExtensionWithRegisteredSubsystem ( moduleName , subsystem ) ; } } for ( Map . Entry < String , SubsystemInformation > entry : extension . subsystems . entrySet ( ) ) { String subsystem = entry . getKey ( ) ; profileReg . unregisterSubModel ( PathElement . pathElement ( ModelDescriptionConstants . SUBSYSTEM , subsystem ) ) ; if ( deploymentsReg != null ) { deploymentsReg . unregisterSubModel ( PathElement . pathElement ( ModelDescriptionConstants . SUBSYSTEM , subsystem ) ) ; deploymentsReg . unregisterSubModel ( PathElement . pathElement ( ModelDescriptionConstants . SUBDEPLOYMENT , subsystem ) ) ; } if ( extension . xmlMapper != null ) { SubsystemInformationImpl subsystemInformation = SubsystemInformationImpl . class . cast ( entry . getValue ( ) ) ; for ( String namespace : subsystemInformation . getXMLNamespaces ( ) ) { extension . xmlMapper . unregisterRootElement ( new QName ( namespace , SUBSYSTEM ) ) ; } } } } } } | Cleans up a extension module s subsystems from the resource registration model . | 564 | 15 |
145,644 | protected void recordPreparedOperation ( final ServerIdentity identity , final TransactionalProtocolClient . PreparedOperation < ServerTaskExecutor . ServerOperation > prepared ) { final ModelNode preparedResult = prepared . getPreparedResult ( ) ; // Hmm do the server results need to get translated as well as the host one? // final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult); updatePolicy . recordServerResult ( identity , preparedResult ) ; executor . recordPreparedOperation ( prepared ) ; } | Record a prepared operation . | 112 | 5 |
145,645 | private static String resolveJavaCommand ( final Path javaHome ) { final String exe ; if ( javaHome == null ) { exe = "java" ; } else { exe = javaHome . resolve ( "bin" ) . resolve ( "java" ) . toString ( ) ; } if ( exe . contains ( " " ) ) { return "\"" + exe + "\"" ; } return exe ; } | Returns the Java executable command . | 92 | 6 |
145,646 | public String getRelativePath ( ) { final StringBuilder builder = new StringBuilder ( ) ; for ( final String p : path ) { builder . append ( p ) . append ( "/" ) ; } builder . append ( getName ( ) ) ; return builder . toString ( ) ; } | Get the relative path . | 62 | 5 |
145,647 | protected void runScript ( File script ) { if ( ! script . exists ( ) ) { JOptionPane . showMessageDialog ( cliGuiCtx . getMainPanel ( ) , script . getAbsolutePath ( ) + " does not exist." , "Unable to run script." , JOptionPane . ERROR_MESSAGE ) ; return ; } int choice = JOptionPane . showConfirmDialog ( cliGuiCtx . getMainPanel ( ) , "Run CLI script " + script . getName ( ) + "?" , "Confirm run script" , JOptionPane . YES_NO_OPTION ) ; if ( choice != JOptionPane . YES_OPTION ) return ; menu . addScript ( script ) ; cliGuiCtx . getTabs ( ) . setSelectedIndex ( 1 ) ; // set to Output tab to view the output output . post ( "\n" ) ; SwingWorker scriptRunner = new ScriptRunner ( script ) ; scriptRunner . execute ( ) ; } | Run a CLI script from a File . | 226 | 8 |
145,648 | private List < String > getCommandLines ( File file ) { List < String > lines = new ArrayList <> ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { String line = reader . readLine ( ) ; while ( line != null ) { lines . add ( line ) ; line = reader . readLine ( ) ; } } catch ( Throwable e ) { throw new IllegalStateException ( "Failed to process file " + file . getAbsolutePath ( ) , e ) ; } return lines ; } | read the file as a list of text lines | 122 | 9 |
145,649 | public Set < AttributeAccess . Flag > getFlags ( ) { if ( attributeAccess == null ) { return Collections . emptySet ( ) ; } return attributeAccess . getFlags ( ) ; } | Gets the flags associated with this attribute . | 41 | 9 |
145,650 | static ModelNode createOperation ( final ModelNode operationToValidate ) { PathAddress pa = PathAddress . pathAddress ( operationToValidate . require ( ModelDescriptionConstants . OP_ADDR ) ) ; PathAddress realmPA = null ; for ( int i = pa . size ( ) - 1 ; i > 0 ; i -- ) { PathElement pe = pa . getElement ( i ) ; if ( SECURITY_REALM . equals ( pe . getKey ( ) ) ) { realmPA = pa . subAddress ( 0 , i + 1 ) ; break ; } } assert realmPA != null : "operationToValidate did not have an address that included a " + SECURITY_REALM ; return Util . getEmptyOperation ( "validate-authentication" , realmPA . toModelNode ( ) ) ; } | Creates an operations that targets this handler . | 180 | 9 |
145,651 | public static ServiceName channelServiceName ( final ServiceName endpointName , final String channelName ) { return endpointName . append ( "channel" ) . append ( channelName ) ; } | Create the service name for a channel | 38 | 7 |
145,652 | public InetAddress getRemoteAddress ( ) { final Channel channel ; try { channel = strategy . getChannel ( ) ; } catch ( IOException e ) { return null ; } final Connection connection = channel . getConnection ( ) ; final InetSocketAddress peerAddress = connection . getPeerAddress ( InetSocketAddress . class ) ; return peerAddress == null ? null : peerAddress . getAddress ( ) ; } | Get the remote address . | 88 | 5 |
145,653 | public void addHandlerFactory ( ManagementRequestHandlerFactory factory ) { for ( ; ; ) { final ManagementRequestHandlerFactory [ ] snapshot = updater . get ( this ) ; final int length = snapshot . length ; final ManagementRequestHandlerFactory [ ] newVal = new ManagementRequestHandlerFactory [ length + 1 ] ; System . arraycopy ( snapshot , 0 , newVal , 0 , length ) ; newVal [ length ] = factory ; if ( updater . compareAndSet ( this , snapshot , newVal ) ) { return ; } } } | Add a management request handler factory to this context . | 113 | 10 |
145,654 | public boolean removeHandlerFactory ( ManagementRequestHandlerFactory instance ) { for ( ; ; ) { final ManagementRequestHandlerFactory [ ] snapshot = updater . get ( this ) ; final int length = snapshot . length ; int index = - 1 ; for ( int i = 0 ; i < length ; i ++ ) { if ( snapshot [ i ] == instance ) { index = i ; break ; } } if ( index == - 1 ) { return false ; } final ManagementRequestHandlerFactory [ ] newVal = new ManagementRequestHandlerFactory [ length - 1 ] ; System . arraycopy ( snapshot , 0 , newVal , 0 , index ) ; System . arraycopy ( snapshot , index + 1 , newVal , index , length - index - 1 ) ; if ( updater . compareAndSet ( this , snapshot , newVal ) ) { return true ; } } } | Remove a management request handler factory from this context . | 180 | 10 |
145,655 | public String translatePath ( String path ) { String translated ; // special character: ~ maps to the user's home directory if ( path . startsWith ( "~" + File . separator ) ) { translated = System . getProperty ( "user.home" ) + path . substring ( 1 ) ; } else if ( path . startsWith ( "~" ) ) { String userName = path . substring ( 1 ) ; translated = new File ( new File ( System . getProperty ( "user.home" ) ) . getParent ( ) , userName ) . getAbsolutePath ( ) ; // Keep the path separator in translated or add one if no user home specified translated = userName . isEmpty ( ) || path . endsWith ( File . separator ) ? translated + File . separator : translated ; } else if ( ! new File ( path ) . isAbsolute ( ) ) { translated = ctx . getCurrentDir ( ) . getAbsolutePath ( ) + File . separator + path ; } else { translated = path ; } return translated ; } | Translate a path that has previously been unescaped and unquoted . That is called at command execution when the calue is retrieved prior to be used as ModelNode value . | 229 | 37 |
145,656 | private static String clearPath ( String path ) { try { ExpressionBaseState state = new ExpressionBaseState ( "EXPR" , true , false ) ; if ( Util . isWindows ( ) ) { // to not require escaping FS name separator state . setDefaultHandler ( WordCharacterHandler . IGNORE_LB_ESCAPE_OFF ) ; } else { state . setDefaultHandler ( WordCharacterHandler . IGNORE_LB_ESCAPE_ON ) ; } // Remove escaping characters path = ArgumentWithValue . resolveValue ( path , state ) ; } catch ( CommandFormatException ex ) { // XXX OK, continue translation } // Remove quote to retrieve candidates. if ( path . startsWith ( "\"" ) ) { path = path . substring ( 1 ) ; } // Could be an escaped " character. We don't take into account this corner case. // concider it the end of the quoted part. if ( path . endsWith ( "\"" ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } return path ; } | Unescape and unquote the path . Ready for translation . | 230 | 13 |
145,657 | @ Override public synchronized void resume ( ) { this . paused = false ; ServerActivityCallback listener = listenerUpdater . get ( this ) ; if ( listener != null ) { listenerUpdater . compareAndSet ( this , listener , null ) ; } while ( ! taskQueue . isEmpty ( ) && ( activeRequestCount < maxRequestCount || maxRequestCount < 0 ) ) { runQueuedTask ( false ) ; } } | Unpause the server allowing it to resume normal operations | 93 | 10 |
145,658 | public synchronized void pauseDeployment ( final String deployment , ServerActivityCallback listener ) { final List < ControlPoint > eps = new ArrayList < ControlPoint > ( ) ; for ( ControlPoint ep : entryPoints . values ( ) ) { if ( ep . getDeployment ( ) . equals ( deployment ) ) { if ( ! ep . isPaused ( ) ) { eps . add ( ep ) ; } } } CountingRequestCountCallback realListener = new CountingRequestCountCallback ( eps . size ( ) , listener ) ; for ( ControlPoint ep : eps ) { ep . pause ( realListener ) ; } } | Pauses a given deployment | 134 | 5 |
145,659 | public synchronized void resumeDeployment ( final String deployment ) { for ( ControlPoint ep : entryPoints . values ( ) ) { if ( ep . getDeployment ( ) . equals ( deployment ) ) { ep . resume ( ) ; } } } | resumed a given deployment | 51 | 5 |
145,660 | public synchronized void resumeControlPoint ( final String entryPoint ) { for ( ControlPoint ep : entryPoints . values ( ) ) { if ( ep . getEntryPoint ( ) . equals ( entryPoint ) ) { ep . resume ( ) ; } } } | Resumes a given entry point type ; | 53 | 8 |
145,661 | public synchronized ControlPoint getControlPoint ( final String deploymentName , final String entryPointName ) { ControlPointIdentifier id = new ControlPointIdentifier ( deploymentName , entryPointName ) ; ControlPoint ep = entryPoints . get ( id ) ; if ( ep == null ) { ep = new ControlPoint ( this , deploymentName , entryPointName , trackIndividualControlPoints ) ; entryPoints . put ( id , ep ) ; } ep . increaseReferenceCount ( ) ; return ep ; } | Gets an entry point for the given deployment . If one does not exist it will be created . If the request controller is disabled this will return null . | 103 | 31 |
145,662 | public synchronized void removeControlPoint ( ControlPoint controlPoint ) { if ( controlPoint . decreaseReferenceCount ( ) == 0 ) { ControlPointIdentifier id = new ControlPointIdentifier ( controlPoint . getDeployment ( ) , controlPoint . getEntryPoint ( ) ) ; entryPoints . remove ( id ) ; } } | Removes the specified entry point | 68 | 6 |
145,663 | private boolean runQueuedTask ( boolean hasPermit ) { if ( ! hasPermit && beginRequest ( paused ) == RunResult . REJECTED ) { return false ; } QueuedTask task = null ; if ( ! paused ) { task = taskQueue . poll ( ) ; } else { //the container is suspended, but we still need to run any force queued tasks task = findForcedTask ( ) ; } if ( task != null ) { if ( ! task . runRequest ( ) ) { decrementRequestCount ( ) ; } return true ; } else { decrementRequestCount ( ) ; return false ; } } | Runs a queued task if the queue is not already empty . | 134 | 14 |
145,664 | static Property getProperty ( String propName , ModelNode attrs ) { String [ ] arr = propName . split ( "\\." ) ; ModelNode attrDescr = attrs ; for ( String item : arr ) { // Remove list part. if ( item . endsWith ( "]" ) ) { int i = item . indexOf ( "[" ) ; if ( i < 0 ) { return null ; } item = item . substring ( 0 , i ) ; } ModelNode descr = attrDescr . get ( item ) ; if ( ! descr . isDefined ( ) ) { if ( attrDescr . has ( Util . VALUE_TYPE ) ) { ModelNode vt = attrDescr . get ( Util . VALUE_TYPE ) ; if ( vt . has ( item ) ) { attrDescr = vt . get ( item ) ; continue ; } } return null ; } attrDescr = descr ; } return new Property ( propName , attrDescr ) ; } | package for testing purpose | 224 | 4 |
145,665 | private LoggingConfigurationService configure ( final ResourceRoot root , final VirtualFile configFile , final ClassLoader classLoader , final LogContext logContext ) throws DeploymentUnitProcessingException { InputStream configStream = null ; try { LoggingLogger . ROOT_LOGGER . debugf ( "Found logging configuration file: %s" , configFile ) ; // Get the filname and open the stream final String fileName = configFile . getName ( ) ; configStream = configFile . openStream ( ) ; // Check the type of the configuration file if ( isLog4jConfiguration ( fileName ) ) { final ClassLoader current = WildFlySecurityManager . getCurrentContextClassLoaderPrivileged ( ) ; final LogContext old = logContextSelector . getAndSet ( CONTEXT_LOCK , logContext ) ; try { WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( classLoader ) ; if ( LOG4J_XML . equals ( fileName ) || JBOSS_LOG4J_XML . equals ( fileName ) ) { new DOMConfigurator ( ) . doConfigure ( configStream , org . apache . log4j . JBossLogManagerFacade . getLoggerRepository ( logContext ) ) ; } else { final Properties properties = new Properties ( ) ; properties . load ( new InputStreamReader ( configStream , ENCODING ) ) ; new org . apache . log4j . PropertyConfigurator ( ) . doConfigure ( properties , org . apache . log4j . JBossLogManagerFacade . getLoggerRepository ( logContext ) ) ; } } finally { logContextSelector . getAndSet ( CONTEXT_LOCK , old ) ; WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( current ) ; } return new LoggingConfigurationService ( null , resolveRelativePath ( root , configFile ) ) ; } else { // Create a properties file final Properties properties = new Properties ( ) ; properties . load ( new InputStreamReader ( configStream , ENCODING ) ) ; // Attempt to see if this is a J.U.L. configuration file if ( isJulConfiguration ( properties ) ) { LoggingLogger . ROOT_LOGGER . julConfigurationFileFound ( configFile . getName ( ) ) ; } else { // Load non-log4j types final PropertyConfigurator propertyConfigurator = new PropertyConfigurator ( logContext ) ; propertyConfigurator . configure ( properties ) ; return new LoggingConfigurationService ( propertyConfigurator . getLogContextConfiguration ( ) , resolveRelativePath ( root , configFile ) ) ; } } } catch ( Exception e ) { throw LoggingLogger . ROOT_LOGGER . failedToConfigureLogging ( e , configFile . getName ( ) ) ; } finally { safeClose ( configStream ) ; } return null ; } | Configures the log context . | 620 | 6 |
145,666 | public void validateOperations ( final List < ModelNode > operations ) { if ( operations == null ) { return ; } for ( ModelNode operation : operations ) { try { validateOperation ( operation ) ; } catch ( RuntimeException e ) { if ( exitOnError ) { throw e ; } else { System . out . println ( "---- Operation validation error:" ) ; System . out . println ( e . getMessage ( ) ) ; } } } } | Validates operations against their description providers | 95 | 7 |
145,667 | public void validateOperation ( final ModelNode operation ) { if ( operation == null ) { return ; } final PathAddress address = PathAddress . pathAddress ( operation . get ( OP_ADDR ) ) ; final String name = operation . get ( OP ) . asString ( ) ; OperationEntry entry = root . getOperationEntry ( address , name ) ; if ( entry == null ) { throwOrWarnAboutDescriptorProblem ( ControllerLogger . ROOT_LOGGER . noOperationEntry ( name , address ) ) ; } //noinspection ConstantConditions if ( entry . getType ( ) == EntryType . PRIVATE || entry . getFlags ( ) . contains ( OperationEntry . Flag . HIDDEN ) ) { return ; } if ( entry . getOperationHandler ( ) == null ) { throwOrWarnAboutDescriptorProblem ( ControllerLogger . ROOT_LOGGER . noOperationHandler ( name , address ) ) ; } final DescriptionProvider provider = getDescriptionProvider ( operation ) ; final ModelNode description = provider . getModelDescription ( null ) ; final Map < String , ModelNode > describedProperties = getDescribedRequestProperties ( operation , description ) ; final Map < String , ModelNode > actualParams = getActualRequestProperties ( operation ) ; checkActualOperationParamsAreDescribed ( operation , describedProperties , actualParams ) ; checkAllRequiredPropertiesArePresent ( description , operation , describedProperties , actualParams ) ; checkParameterTypes ( description , operation , describedProperties , actualParams ) ; //TODO check ranges } | Validates an operation against its description provider | 340 | 8 |
145,668 | private void throwOrWarnAboutDescriptorProblem ( String message ) { if ( validateDescriptions ) { throw new IllegalArgumentException ( message ) ; } ControllerLogger . ROOT_LOGGER . warn ( message ) ; } | Throws an exception or logs a message | 51 | 8 |
145,669 | public static String buildDynamicCapabilityName ( String baseName , String dynamicNameElement ) { return buildDynamicCapabilityName ( baseName , new String [ ] { dynamicNameElement } ) ; } | todo remove here only for binary compatibility of elytron subsystem drop once it is in . | 41 | 20 |
145,670 | public static String buildDynamicCapabilityName ( String baseName , String ... dynamicNameElement ) { assert baseName != null ; assert dynamicNameElement != null ; assert dynamicNameElement . length > 0 ; StringBuilder sb = new StringBuilder ( baseName ) ; for ( String part : dynamicNameElement ) { sb . append ( "." ) . append ( part ) ; } return sb . toString ( ) ; } | Constructs a full capability name from a static base name and a dynamic element . | 90 | 16 |
145,671 | public OperationBuilder addInputStream ( final InputStream in ) { Assert . checkNotNullParam ( "in" , in ) ; if ( inputStreams == null ) { inputStreams = new ArrayList < InputStream > ( ) ; } inputStreams . add ( in ) ; return this ; } | Associate an input stream with the operation . Closing the input stream is the responsibility of the caller . | 65 | 20 |
145,672 | @ Override public InstalledIdentity getInstalledIdentity ( String productName , String productVersion ) throws PatchingException { final String defaultIdentityName = defaultIdentity . getIdentity ( ) . getName ( ) ; if ( productName == null ) { productName = defaultIdentityName ; } final File productConf = new File ( installedImage . getInstallationMetadata ( ) , productName + Constants . DOT_CONF ) ; final String recordedProductVersion ; if ( ! productConf . exists ( ) ) { recordedProductVersion = null ; } else { final Properties props = loadProductConf ( productConf ) ; recordedProductVersion = props . getProperty ( Constants . CURRENT_VERSION ) ; } if ( defaultIdentityName . equals ( productName ) ) { if ( recordedProductVersion != null && ! recordedProductVersion . equals ( defaultIdentity . getIdentity ( ) . getVersion ( ) ) ) { // this means the patching history indicates that the current version is different from the one specified in the server's version module, // which could happen in case: // - the last applied CP didn't include the new version module or // - the version module version included in the last CP didn't match the version specified in the CP's metadata, or // - the version module was updated from a one-off, or // - the patching history was edited somehow // In any case, here I decided to rely on the patching history. defaultIdentity = loadIdentity ( productName , recordedProductVersion ) ; } if ( productVersion != null && ! defaultIdentity . getIdentity ( ) . getVersion ( ) . equals ( productVersion ) ) { throw new PatchingException ( PatchLogger . ROOT_LOGGER . productVersionDidNotMatchInstalled ( productName , productVersion , defaultIdentity . getIdentity ( ) . getVersion ( ) ) ) ; } return defaultIdentity ; } if ( recordedProductVersion != null && ! Constants . UNKNOWN . equals ( recordedProductVersion ) ) { if ( productVersion != null ) { if ( ! productVersion . equals ( recordedProductVersion ) ) { throw new PatchingException ( PatchLogger . ROOT_LOGGER . productVersionDidNotMatchInstalled ( productName , productVersion , recordedProductVersion ) ) ; } } else { productVersion = recordedProductVersion ; } } return loadIdentity ( productName , productVersion ) ; } | This method returns the installed identity with the requested name and version . If the product name is null the default identity will be returned . | 516 | 26 |
145,673 | @ Override public List < InstalledIdentity > getInstalledIdentities ( ) throws PatchingException { List < InstalledIdentity > installedIdentities ; final File metadataDir = installedImage . getInstallationMetadata ( ) ; if ( ! metadataDir . exists ( ) ) { installedIdentities = Collections . singletonList ( defaultIdentity ) ; } else { final String defaultConf = defaultIdentity . getIdentity ( ) . getName ( ) + Constants . DOT_CONF ; final File [ ] identityConfs = metadataDir . listFiles ( new FileFilter ( ) { @ Override public boolean accept ( File pathname ) { return pathname . isFile ( ) && pathname . getName ( ) . endsWith ( Constants . DOT_CONF ) && ! pathname . getName ( ) . equals ( defaultConf ) ; } } ) ; if ( identityConfs == null || identityConfs . length == 0 ) { installedIdentities = Collections . singletonList ( defaultIdentity ) ; } else { installedIdentities = new ArrayList < InstalledIdentity > ( identityConfs . length + 1 ) ; installedIdentities . add ( defaultIdentity ) ; for ( File conf : identityConfs ) { final Properties props = loadProductConf ( conf ) ; String productName = conf . getName ( ) ; productName = productName . substring ( 0 , productName . length ( ) - Constants . DOT_CONF . length ( ) ) ; final String productVersion = props . getProperty ( Constants . CURRENT_VERSION ) ; InstalledIdentity identity ; try { identity = LayersFactory . load ( installedImage , new ProductConfig ( productName , productVersion , null ) , moduleRoots , bundleRoots ) ; } catch ( IOException e ) { throw new PatchingException ( PatchLogger . ROOT_LOGGER . failedToLoadInfo ( productName ) , e ) ; } installedIdentities . add ( identity ) ; } } } return installedIdentities ; } | This method will return a list of installed identities for which the corresponding . conf file exists under . installation directory . The list will also include the default identity even if the . conf file has not been created for it . | 433 | 43 |
145,674 | public StandaloneCommandBuilder setDebug ( final boolean suspend , final int port ) { debugArg = String . format ( DEBUG_FORMAT , ( suspend ? "y" : "n" ) , port ) ; return this ; } | Sets the debug JPDA remote socket debugging argument . | 48 | 11 |
145,675 | public StandaloneCommandBuilder addSecurityProperty ( final String key , final String value ) { securityProperties . put ( key , value ) ; return this ; } | Adds a security property to be passed to the server . | 33 | 11 |
145,676 | @ SuppressWarnings ( "deprecation" ) public BUILDER addAccessConstraint ( final AccessConstraintDefinition accessConstraint ) { if ( accessConstraints == null ) { accessConstraints = new AccessConstraintDefinition [ ] { accessConstraint } ; } else { accessConstraints = Arrays . copyOf ( accessConstraints , accessConstraints . length + 1 ) ; accessConstraints [ accessConstraints . length - 1 ] = accessConstraint ; } return ( BUILDER ) this ; } | Adds an access constraint to the set used with the attribute | 124 | 11 |
145,677 | public BUILDER setAttributeGroup ( String attributeGroup ) { assert attributeGroup == null || attributeGroup . length ( ) > 0 ; //noinspection deprecation this . attributeGroup = attributeGroup ; return ( BUILDER ) this ; } | Sets the name of the attribute group with which this attribute is associated . | 52 | 15 |
145,678 | @ SuppressWarnings ( "deprecation" ) public BUILDER setAllowedValues ( String ... allowedValues ) { assert allowedValues != null ; this . allowedValues = new ModelNode [ allowedValues . length ] ; for ( int i = 0 ; i < allowedValues . length ; i ++ ) { this . allowedValues [ i ] = new ModelNode ( allowedValues [ i ] ) ; } return ( BUILDER ) this ; } | Sets allowed values for attribute | 96 | 6 |
145,679 | protected LogContext getOrCreate ( final String loggingProfile ) { LogContext result = profileContexts . get ( loggingProfile ) ; if ( result == null ) { result = LogContext . create ( ) ; final LogContext current = profileContexts . putIfAbsent ( loggingProfile , result ) ; if ( current != null ) { result = current ; } } return result ; } | Get or create the log context based on the logging profile . | 80 | 12 |
145,680 | public void writeTo ( DataOutput outstream ) throws Exception { S3Util . writeString ( host , outstream ) ; outstream . writeInt ( port ) ; S3Util . writeString ( protocol , outstream ) ; } | Write the domain controller s data to an output stream . | 51 | 11 |
145,681 | public void readFrom ( DataInput instream ) throws Exception { host = S3Util . readString ( instream ) ; port = instream . readInt ( ) ; protocol = S3Util . readString ( instream ) ; } | Read the domain controller s data from an input stream . | 52 | 11 |
145,682 | protected int complete ( CommandContext ctx , ParsedCommandLine parsedCmd , OperationCandidatesProvider candidatesProvider , final String buffer , int cursor , List < String > candidates ) { if ( parsedCmd . isRequestComplete ( ) ) { return - 1 ; } // Headers completion if ( parsedCmd . endsOnHeaderListStart ( ) || parsedCmd . hasHeaders ( ) ) { return completeHeaders ( ctx , parsedCmd , candidatesProvider , buffer , cursor , candidates ) ; } // Completed. if ( parsedCmd . endsOnPropertyListEnd ( ) ) { return buffer . length ( ) ; } // Complete properties if ( parsedCmd . hasProperties ( ) || parsedCmd . endsOnPropertyListStart ( ) || parsedCmd . endsOnNotOperator ( ) ) { return completeProperties ( ctx , parsedCmd , candidatesProvider , buffer , candidates ) ; } // Complete Operation name if ( parsedCmd . hasOperationName ( ) || parsedCmd . endsOnAddressOperationNameSeparator ( ) ) { return completeOperationName ( ctx , parsedCmd , candidatesProvider , buffer , candidates ) ; } // Finally Complete address return completeAddress ( ctx , parsedCmd , candidatesProvider , buffer , candidates ) ; } | Complete both operations and commands . | 258 | 6 |
145,683 | private Collection < ? extends ResourceRoot > handleClassPathItems ( final DeploymentUnit deploymentUnit ) { final Set < ResourceRoot > additionalRoots = new HashSet < ResourceRoot > ( ) ; final ArrayDeque < ResourceRoot > toProcess = new ArrayDeque < ResourceRoot > ( ) ; final List < ResourceRoot > resourceRoots = DeploymentUtils . allResourceRoots ( deploymentUnit ) ; toProcess . addAll ( resourceRoots ) ; final Set < ResourceRoot > processed = new HashSet < ResourceRoot > ( resourceRoots ) ; while ( ! toProcess . isEmpty ( ) ) { final ResourceRoot root = toProcess . pop ( ) ; final List < ResourceRoot > classPathRoots = root . getAttachmentList ( Attachments . CLASS_PATH_RESOURCE_ROOTS ) ; for ( ResourceRoot cpRoot : classPathRoots ) { if ( ! processed . contains ( cpRoot ) ) { additionalRoots . add ( cpRoot ) ; toProcess . add ( cpRoot ) ; processed . add ( cpRoot ) ; } } } return additionalRoots ; } | Loops through all resource roots that have been made available transitively via Class - Path entries and adds them to the list of roots to be processed . | 237 | 31 |
145,684 | @ Override public ModelNode resolveValue ( ExpressionResolver resolver , ModelNode value ) throws OperationFailedException { // Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance // that's how this object is set up, turn undefined into a default list value. ModelNode superResult = value . getType ( ) == ModelType . LIST ? value : super . resolveValue ( resolver , value ) ; // If it's not a LIST (almost certainly UNDEFINED), then nothing more we can do if ( superResult . getType ( ) != ModelType . LIST ) { return superResult ; } // Resolve each element. // Don't mess with the original value ModelNode clone = superResult == value ? value . clone ( ) : superResult ; ModelNode result = new ModelNode ( ) ; result . setEmptyList ( ) ; for ( ModelNode element : clone . asList ( ) ) { result . add ( valueType . resolveValue ( resolver , element ) ) ; } // Validate the entire list getValidator ( ) . validateParameter ( getName ( ) , result ) ; return result ; } | Overrides the superclass implementation to allow the value type s AttributeDefinition to in turn resolve each element . | 246 | 23 |
145,685 | public static ResourceDescriptionResolver getResourceDescriptionResolver ( final String ... keyPrefix ) { StringBuilder prefix = new StringBuilder ( SUBSYSTEM_NAME ) ; for ( String kp : keyPrefix ) { prefix . append ( ' ' ) . append ( kp ) ; } return new StandardResourceDescriptionResolver ( prefix . toString ( ) , RESOURCE_NAME , LoggingExtension . class . getClassLoader ( ) , true , false ) { @ Override public String getOperationParameterDescription ( final String operationName , final String paramName , final Locale locale , final ResourceBundle bundle ) { if ( DELEGATE_DESC_OPTS . contains ( operationName ) ) { return getResourceAttributeDescription ( paramName , locale , bundle ) ; } return super . getOperationParameterDescription ( operationName , paramName , locale , bundle ) ; } @ Override public String getOperationParameterValueTypeDescription ( final String operationName , final String paramName , final Locale locale , final ResourceBundle bundle , final String ... suffixes ) { if ( DELEGATE_DESC_OPTS . contains ( operationName ) ) { return getResourceAttributeDescription ( paramName , locale , bundle ) ; } return super . getOperationParameterValueTypeDescription ( operationName , paramName , locale , bundle , suffixes ) ; } @ Override public String getOperationParameterDeprecatedDescription ( final String operationName , final String paramName , final Locale locale , final ResourceBundle bundle ) { if ( DELEGATE_DESC_OPTS . contains ( operationName ) ) { return getResourceAttributeDeprecatedDescription ( paramName , locale , bundle ) ; } return super . getOperationParameterDeprecatedDescription ( operationName , paramName , locale , bundle ) ; } } ; } | Returns a resource description resolver that uses common descriptions for some attributes . | 383 | 14 |
145,686 | void parseWorkerThreadPool ( final XMLExtendedStreamReader reader , final ModelNode subsystemAdd ) throws XMLStreamException { final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { requireNoNamespaceAttribute ( reader , i ) ; final String value = reader . getAttributeValue ( i ) ; final Attribute attribute = Attribute . forName ( reader . getAttributeLocalName ( i ) ) ; switch ( attribute ) { case WORKER_READ_THREADS : if ( subsystemAdd . hasDefined ( CommonAttributes . WORKER_READ_THREADS ) ) { throw duplicateAttribute ( reader , CommonAttributes . WORKER_READ_THREADS ) ; } RemotingSubsystemRootResource . WORKER_READ_THREADS . parseAndSetParameter ( value , subsystemAdd , reader ) ; break ; case WORKER_TASK_CORE_THREADS : if ( subsystemAdd . hasDefined ( CommonAttributes . WORKER_TASK_CORE_THREADS ) ) { throw duplicateAttribute ( reader , CommonAttributes . WORKER_TASK_CORE_THREADS ) ; } RemotingSubsystemRootResource . WORKER_TASK_CORE_THREADS . parseAndSetParameter ( value , subsystemAdd , reader ) ; break ; case WORKER_TASK_KEEPALIVE : if ( subsystemAdd . hasDefined ( CommonAttributes . WORKER_TASK_KEEPALIVE ) ) { throw duplicateAttribute ( reader , CommonAttributes . WORKER_TASK_KEEPALIVE ) ; } RemotingSubsystemRootResource . WORKER_TASK_KEEPALIVE . parseAndSetParameter ( value , subsystemAdd , reader ) ; break ; case WORKER_TASK_LIMIT : if ( subsystemAdd . hasDefined ( CommonAttributes . WORKER_TASK_LIMIT ) ) { throw duplicateAttribute ( reader , CommonAttributes . WORKER_TASK_LIMIT ) ; } RemotingSubsystemRootResource . WORKER_TASK_LIMIT . parseAndSetParameter ( value , subsystemAdd , reader ) ; break ; case WORKER_TASK_MAX_THREADS : if ( subsystemAdd . hasDefined ( CommonAttributes . WORKER_TASK_MAX_THREADS ) ) { throw duplicateAttribute ( reader , CommonAttributes . WORKER_TASK_MAX_THREADS ) ; } RemotingSubsystemRootResource . WORKER_TASK_MAX_THREADS . parseAndSetParameter ( value , subsystemAdd , reader ) ; break ; case WORKER_WRITE_THREADS : if ( subsystemAdd . hasDefined ( CommonAttributes . WORKER_WRITE_THREADS ) ) { throw duplicateAttribute ( reader , CommonAttributes . WORKER_WRITE_THREADS ) ; } RemotingSubsystemRootResource . WORKER_WRITE_THREADS . parseAndSetParameter ( value , subsystemAdd , reader ) ; break ; default : throw unexpectedAttribute ( reader , i ) ; } } requireNoContent ( reader ) ; } | Adds the worker thread pool attributes to the subysystem add method | 691 | 13 |
145,687 | private static ModelNode createOperation ( ServerIdentity identity ) { // The server address final ModelNode address = new ModelNode ( ) ; address . add ( ModelDescriptionConstants . HOST , identity . getHostName ( ) ) ; address . add ( ModelDescriptionConstants . RUNNING_SERVER , identity . getServerName ( ) ) ; // final ModelNode operation = OPERATION . clone ( ) ; operation . get ( ModelDescriptionConstants . OP_ADDR ) . set ( address ) ; return operation ; } | Transform the operation into something the proxy controller understands . | 110 | 10 |
145,688 | private File buildDirPath ( final String serverConfigUserDirPropertyName , final String suppliedConfigDir , final String serverConfigDirPropertyName , final String serverBaseDirPropertyName , final String defaultBaseDir ) { String propertyDir = System . getProperty ( serverConfigUserDirPropertyName ) ; if ( propertyDir != null ) { return new File ( propertyDir ) ; } if ( suppliedConfigDir != null ) { return new File ( suppliedConfigDir ) ; } propertyDir = System . getProperty ( serverConfigDirPropertyName ) ; if ( propertyDir != null ) { return new File ( propertyDir ) ; } propertyDir = System . getProperty ( serverBaseDirPropertyName ) ; if ( propertyDir != null ) { return new File ( propertyDir ) ; } return new File ( new File ( stateValues . getOptions ( ) . getJBossHome ( ) , defaultBaseDir ) , "configuration" ) ; } | This method attempts to locate a suitable directory by checking a number of different configuration sources . | 195 | 17 |
145,689 | private void validatePermissions ( final File dirPath , final File file ) { // Check execute and read permissions for parent dirPath if ( ! dirPath . canExecute ( ) || ! dirPath . canRead ( ) ) { validFilePermissions = false ; filePermissionsProblemPath = dirPath . getAbsolutePath ( ) ; return ; } // Check read and write permissions for properties file if ( ! file . canRead ( ) || ! file . canWrite ( ) ) { validFilePermissions = false ; filePermissionsProblemPath = dirPath . getAbsolutePath ( ) ; } } | This method performs a series of permissions checks given a directory and properties file path . | 127 | 16 |
145,690 | protected Path normalizePath ( final Path parent , final String path ) { return parent . resolve ( path ) . toAbsolutePath ( ) . normalize ( ) ; } | Resolves the path relative to the parent and normalizes it . | 36 | 13 |
145,691 | void awaitStabilityUninterruptibly ( long timeout , TimeUnit timeUnit ) throws TimeoutException { boolean interrupted = false ; try { long toWait = timeUnit . toMillis ( timeout ) ; long msTimeout = System . currentTimeMillis ( ) + toWait ; while ( true ) { if ( interrupted ) { toWait = msTimeout - System . currentTimeMillis ( ) ; } try { if ( toWait <= 0 || ! monitor . awaitStability ( toWait , TimeUnit . MILLISECONDS , failed , problems ) ) { throw new TimeoutException ( ) ; } break ; } catch ( InterruptedException e ) { interrupted = true ; } } } finally { if ( interrupted ) { Thread . currentThread ( ) . interrupt ( ) ; } } } | Await service container stability ignoring thread interruption . | 167 | 9 |
145,692 | public static final PatchOperationTarget createLocal ( final File jbossHome , List < File > moduleRoots , List < File > bundlesRoots ) throws IOException { final PatchTool tool = PatchTool . Factory . createLocalTool ( jbossHome , moduleRoots , bundlesRoots ) ; return new LocalPatchOperationTarget ( tool ) ; } | Create a local target . | 73 | 5 |
145,693 | public static final PatchOperationTarget createStandalone ( final ModelControllerClient controllerClient ) { final PathAddress address = PathAddress . EMPTY_ADDRESS . append ( CORE_SERVICES ) ; return new RemotePatchOperationTarget ( address , controllerClient ) ; } | Create a standalone target . | 58 | 5 |
145,694 | public static final PatchOperationTarget createHost ( final String hostName , final ModelControllerClient client ) { final PathElement host = PathElement . pathElement ( HOST , hostName ) ; final PathAddress address = PathAddress . EMPTY_ADDRESS . append ( host , CORE_SERVICES ) ; return new RemotePatchOperationTarget ( address , client ) ; } | Create a host target . | 79 | 5 |
145,695 | public ResourceTransformerEntry resolveResourceTransformer ( final PathAddress address , final PlaceholderResolver placeholderResolver ) { return resolveResourceTransformer ( address . iterator ( ) , null , placeholderResolver ) ; } | Resolve a resource transformer for a given address . | 45 | 10 |
145,696 | public OperationTransformerEntry resolveOperationTransformer ( final PathAddress address , final String operationName , PlaceholderResolver placeholderResolver ) { final Iterator < PathElement > iterator = address . iterator ( ) ; final OperationTransformerEntry entry = resolveOperationTransformer ( iterator , operationName , placeholderResolver ) ; if ( entry != null ) { return entry ; } // Default is forward unchanged return FORWARD ; } | Resolve an operation transformer entry . | 87 | 7 |
145,697 | public void mergeSubsystem ( final GlobalTransformerRegistry registry , String subsystemName , ModelVersion version ) { final PathElement element = PathElement . pathElement ( SUBSYSTEM , subsystemName ) ; registry . mergeSubtree ( this , PathAddress . EMPTY_ADDRESS . append ( element ) , version ) ; } | Merge a new subsystem from the global registration . | 70 | 10 |
145,698 | public List < PathAddressTransformer > getPathTransformations ( final PathAddress address , PlaceholderResolver placeholderResolver ) { final List < PathAddressTransformer > list = new ArrayList < PathAddressTransformer > ( ) ; final Iterator < PathElement > iterator = address . iterator ( ) ; resolvePathTransformers ( iterator , list , placeholderResolver ) ; if ( iterator . hasNext ( ) ) { while ( iterator . hasNext ( ) ) { iterator . next ( ) ; list . add ( PathAddressTransformer . DEFAULT ) ; } } return list ; } | Get a list of path transformers for a given address . | 123 | 12 |
145,699 | public T addContentModification ( final ContentModification modification ) { if ( itemFilter . accepts ( modification . getItem ( ) ) ) { internalAddModification ( modification ) ; } return returnThis ( ) ; } | Add a content modification . | 46 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.