idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
22,200 | 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 ) ; if ( ! foundSelected ) return "" ; return builder . toString ( ) ; } | Return the command line argument |
22,201 | 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 ) { return false ; } else if ( validateEndRecord ( file , channel , size - ENDLEN ) ) { return true ; } return scanForEndSig ( file , channel ) ; } finally { safeClose ( channel ) ; } } | Scans the given file looking for a complete zip file format end of central directory record . |
22,202 | private static boolean scanForEndSig ( File file , FileChannel channel ) throws IOException , NonScannableZipException { 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 ) { return false ; } firstRead = false ; } int bufferPos = actualRead - 1 ; while ( bufferPos >= SIG_PATTERN_LENGTH ) { int patternPos ; for ( patternPos = SIG_PATTERN_LENGTH - 1 ; patternPos >= 0 && ENDSIG_PATTERN [ patternPos ] == bb . get ( bufferPos - patternPos ) ; -- patternPos ) { } switch ( patternPos ) { case - 1 : { long startEndRecord = channelPos + bufferPos - SIG_PATTERN_LENGTH + 1 ; if ( validateEndRecord ( file , channel , startEndRecord ) ) { return true ; } bufferPos -= 4 ; break ; } case 3 : { int idx = bb . get ( bufferPos - patternPos ) - Byte . MIN_VALUE ; bufferPos -= END_BAD_BYTE_SKIP [ idx ] ; break ; } default : bufferPos -= 4 ; } } 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 |
22,203 | 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 { output . writeByte ( DomainControllerProtocol . PARAM_ERROR ) ; output . writeByte ( errorCode ) ; if ( message == null ) { output . writeUTF ( "unknown error" ) ; } else { output . writeUTF ( message ) ; } output . writeByte ( ManagementProtocol . RESPONSE_END ) ; output . close ( ) ; } finally { StreamUtils . safeClose ( output ) ; } } | Send a failed operation response . |
22,204 | 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 . |
22,205 | private static ListAttributeDefinition wrapAsList ( final AttributeDefinition def ) { final ListAttributeDefinition list = new ListAttributeDefinition ( new SimpleListAttributeDefinition . Builder ( def . getName ( ) , def ) . setElementValidator ( def . getValidator ( ) ) ) { public ModelNode getNoTextDescription ( boolean forOperation ) { final ModelNode model = super . getNoTextDescription ( forOperation ) ; setValueType ( model ) ; return model ; } protected void addValueTypeDescription ( final ModelNode node , final ResourceBundle bundle ) { setValueType ( node ) ; } public void marshallAsElement ( final ModelNode resourceModel , final boolean marshalDefault , final XMLStreamWriter writer ) throws XMLStreamException { throw new RuntimeException ( ) ; } protected void addAttributeValueTypeDescription ( ModelNode node , ResourceDescriptionResolver resolver , Locale locale , ResourceBundle bundle ) { setValueType ( node ) ; } 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 . |
22,206 | private static int resolveDomainTimeoutAdder ( ) { String propValue = WildFlySecurityManager . getPropertyPrivileged ( DOMAIN_TEST_SYSTEM_PROPERTY , DEFAULT_DOMAIN_TIMEOUT_STRING ) ; if ( sysPropDomainValue == null || ! sysPropDomainValue . equals ( propValue ) ) { sysPropDomainValue = propValue ; int number = - 1 ; try { number = Integer . valueOf ( sysPropDomainValue ) ; } catch ( NumberFormatException nfe ) { } if ( number > 0 ) { defaultDomainValue = number ; } 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 |
22,207 | 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 . |
22,208 | 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 . |
22,209 | 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 . |
22,210 | public OperationTransformerRegistry resolveServer ( final ModelVersion mgmtVersion , final ModelNode subsystems ) { return resolveServer ( mgmtVersion , resolveVersions ( subsystems ) ) ; } | Resolve the server registry . |
22,211 | 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 . |
22,212 | public synchronized void persistProperties ( ) throws IOException { beginPersistence ( ) ; 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 ) ) { 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 . |
22,213 | protected void addLineContent ( BufferedReader bufferedFileReader , List < String > content , String line ) throws IOException { content . add ( line ) ; } | Add the line to the content |
22,214 | protected void endPersistence ( final BufferedWriter writer ) throws IOException { 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 . |
22,215 | 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 . |
22,216 | 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 ) ) { 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 . |
22,217 | static synchronized void clearLogContext ( ) { final LogContext embeddedLogContext = Holder . LOG_CONTEXT ; final Configurator configurator = embeddedLogContext . getLogger ( "" ) . detach ( Configurator . ATTACHMENT_KEY ) ; if ( configurator instanceof PropertyConfigurator ) { final LogContextConfiguration logContextConfiguration = ( ( PropertyConfigurator ) configurator ) . getLogContextConfiguration ( ) ; clearLogContext ( logContextConfiguration ) ; } else if ( configurator instanceof LogContextConfiguration ) { clearLogContext ( ( LogContextConfiguration ) configurator ) ; } else { 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 . |
22,218 | 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 . |
22,219 | 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 . |
22,220 | 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 ) ; } Map < String , OperationEntry > providers = new TreeMap < String , OperationEntry > ( ) ; getOperationDescriptions ( address . iterator ( ) , providers , inherited ) ; return providers ; } | Get all the handlers at a specific address . |
22,221 | 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 |
22,222 | 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 . |
22,223 | 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 . |
22,224 | 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 |
22,225 | 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 . |
22,226 | 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 |
22,227 | 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 . |
22,228 | 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 . |
22,229 | 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 . |
22,230 | 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 . |
22,231 | public void removeExtension ( Resource rootResource , String moduleName , ManagementResourceRegistration rootRegistration ) throws IllegalStateException { final ManagementResourceRegistration profileReg ; if ( rootRegistration . getPathAddress ( ) . size ( ) == 0 ) { ManagementResourceRegistration reg = rootRegistration . getSubModel ( PathAddress . pathAddress ( PathElement . pathElement ( PROFILE ) ) ) ; if ( reg == null ) { reg = rootRegistration ; } profileReg = reg ; } else { profileReg = rootRegistration ; } ManagementResourceRegistration deploymentsReg = processType . isServer ( ) ? rootRegistration . getSubModel ( PathAddress . pathAddress ( PathElement . pathElement ( DEPLOYMENT ) ) ) : null ; ExtensionInfo extension = extensions . remove ( moduleName ) ; if ( extension != null ) { 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 ) ) { 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 . |
22,232 | protected void recordPreparedOperation ( final ServerIdentity identity , final TransactionalProtocolClient . PreparedOperation < ServerTaskExecutor . ServerOperation > prepared ) { final ModelNode preparedResult = prepared . getPreparedResult ( ) ; updatePolicy . recordServerResult ( identity , preparedResult ) ; executor . recordPreparedOperation ( prepared ) ; } | Record a prepared operation . |
22,233 | 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 . |
22,234 | 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 . |
22,235 | 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 ) ; output . post ( "\n" ) ; SwingWorker scriptRunner = new ScriptRunner ( script ) ; scriptRunner . execute ( ) ; } | Run a CLI script from a File . |
22,236 | 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 |
22,237 | public Set < AttributeAccess . Flag > getFlags ( ) { if ( attributeAccess == null ) { return Collections . emptySet ( ) ; } return attributeAccess . getFlags ( ) ; } | Gets the flags associated with this attribute . |
22,238 | 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 . |
22,239 | public static ServiceName channelServiceName ( final ServiceName endpointName , final String channelName ) { return endpointName . append ( "channel" ) . append ( channelName ) ; } | Create the service name for a channel |
22,240 | 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 . |
22,241 | 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 . |
22,242 | 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 . |
22,243 | public String translatePath ( String path ) { String translated ; 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 ( ) ; 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 . |
22,244 | private static String clearPath ( String path ) { try { ExpressionBaseState state = new ExpressionBaseState ( "EXPR" , true , false ) ; if ( Util . isWindows ( ) ) { state . setDefaultHandler ( WordCharacterHandler . IGNORE_LB_ESCAPE_OFF ) ; } else { state . setDefaultHandler ( WordCharacterHandler . IGNORE_LB_ESCAPE_ON ) ; } path = ArgumentWithValue . resolveValue ( path , state ) ; } catch ( CommandFormatException ex ) { } if ( path . startsWith ( "\"" ) ) { path = path . substring ( 1 ) ; } if ( path . endsWith ( "\"" ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } return path ; } | Unescape and unquote the path . Ready for translation . |
22,245 | 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 |
22,246 | 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 |
22,247 | public synchronized void resumeDeployment ( final String deployment ) { for ( ControlPoint ep : entryPoints . values ( ) ) { if ( ep . getDeployment ( ) . equals ( deployment ) ) { ep . resume ( ) ; } } } | resumed a given deployment |
22,248 | 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 ; |
22,249 | 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 . |
22,250 | 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 |
22,251 | private boolean runQueuedTask ( boolean hasPermit ) { if ( ! hasPermit && beginRequest ( paused ) == RunResult . REJECTED ) { return false ; } QueuedTask task = null ; if ( ! paused ) { task = taskQueue . poll ( ) ; } else { 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 . |
22,252 | static Property getProperty ( String propName , ModelNode attrs ) { String [ ] arr = propName . split ( "\\." ) ; ModelNode attrDescr = attrs ; for ( String item : arr ) { 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 |
22,253 | 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 ) ; final String fileName = configFile . getName ( ) ; configStream = configFile . openStream ( ) ; 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 { final Properties properties = new Properties ( ) ; properties . load ( new InputStreamReader ( configStream , ENCODING ) ) ; if ( isJulConfiguration ( properties ) ) { LoggingLogger . ROOT_LOGGER . julConfigurationFileFound ( configFile . getName ( ) ) ; } else { 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 . |
22,254 | 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 |
22,255 | 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 ) ) ; } 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 ) ; } | Validates an operation against its description provider |
22,256 | private void throwOrWarnAboutDescriptorProblem ( String message ) { if ( validateDescriptions ) { throw new IllegalArgumentException ( message ) ; } ControllerLogger . ROOT_LOGGER . warn ( message ) ; } | Throws an exception or logs a message |
22,257 | 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 . |
22,258 | 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 . |
22,259 | 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 . |
22,260 | 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 ( ) ) ) { 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 . |
22,261 | 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 ( ) { 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 . |
22,262 | 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 . |
22,263 | 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 . |
22,264 | @ 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 |
22,265 | public BUILDER setAttributeGroup ( String attributeGroup ) { assert attributeGroup == null || attributeGroup . length ( ) > 0 ; this . attributeGroup = attributeGroup ; return ( BUILDER ) this ; } | Sets the name of the attribute group with which this attribute is associated . |
22,266 | @ 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 |
22,267 | 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 . |
22,268 | 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 . |
22,269 | 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 . |
22,270 | protected int complete ( CommandContext ctx , ParsedCommandLine parsedCmd , OperationCandidatesProvider candidatesProvider , final String buffer , int cursor , List < String > candidates ) { if ( parsedCmd . isRequestComplete ( ) ) { return - 1 ; } if ( parsedCmd . endsOnHeaderListStart ( ) || parsedCmd . hasHeaders ( ) ) { return completeHeaders ( ctx , parsedCmd , candidatesProvider , buffer , cursor , candidates ) ; } if ( parsedCmd . endsOnPropertyListEnd ( ) ) { return buffer . length ( ) ; } if ( parsedCmd . hasProperties ( ) || parsedCmd . endsOnPropertyListStart ( ) || parsedCmd . endsOnNotOperator ( ) ) { return completeProperties ( ctx , parsedCmd , candidatesProvider , buffer , candidates ) ; } if ( parsedCmd . hasOperationName ( ) || parsedCmd . endsOnAddressOperationNameSeparator ( ) ) { return completeOperationName ( ctx , parsedCmd , candidatesProvider , buffer , candidates ) ; } return completeAddress ( ctx , parsedCmd , candidatesProvider , buffer , candidates ) ; } | Complete both operations and commands . |
22,271 | 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 . |
22,272 | public ModelNode resolveValue ( ExpressionResolver resolver , ModelNode value ) throws OperationFailedException { ModelNode superResult = value . getType ( ) == ModelType . LIST ? value : super . resolveValue ( resolver , value ) ; if ( superResult . getType ( ) != ModelType . LIST ) { return superResult ; } ModelNode clone = superResult == value ? value . clone ( ) : superResult ; ModelNode result = new ModelNode ( ) ; result . setEmptyList ( ) ; for ( ModelNode element : clone . asList ( ) ) { result . add ( valueType . resolveValue ( resolver , element ) ) ; } getValidator ( ) . validateParameter ( getName ( ) , result ) ; return result ; } | Overrides the superclass implementation to allow the value type s AttributeDefinition to in turn resolve each element . |
22,273 | 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 ) { 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 ) ; } 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 ) ; } 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 . |
22,274 | 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 |
22,275 | private static ModelNode createOperation ( ServerIdentity identity ) { 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 . |
22,276 | 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 . |
22,277 | private void validatePermissions ( final File dirPath , final File file ) { if ( ! dirPath . canExecute ( ) || ! dirPath . canRead ( ) ) { validFilePermissions = false ; filePermissionsProblemPath = dirPath . getAbsolutePath ( ) ; return ; } 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 . |
22,278 | 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 . |
22,279 | 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 . |
22,280 | public static void addService ( final ServiceTarget serviceTarget , final Bootstrap . Configuration configuration , final ControlledProcessState processState , final BootstrapListener bootstrapListener , final RunningModeControl runningModeControl , final AbstractVaultReader vaultReader , final ManagedAuditLogger auditLogger , final DelegatingConfigurableAuthorizer authorizer , final ManagementSecurityIdentitySupplier securityIdentitySupplier , final SuspendController suspendController ) { final ThreadGroup threadGroup = new ThreadGroup ( "ServerService ThreadGroup" ) ; final String namePattern = "ServerService Thread Pool -- %t" ; final ThreadFactory threadFactory = doPrivileged ( new PrivilegedAction < ThreadFactory > ( ) { public ThreadFactory run ( ) { return new JBossThreadFactory ( threadGroup , Boolean . FALSE , null , namePattern , null , null ) ; } } ) ; final boolean forDomain = ProcessType . DOMAIN_SERVER == getProcessType ( configuration . getServerEnvironment ( ) ) ; final ServerExecutorService serverExecutorService = new ServerExecutorService ( threadFactory , forDomain ) ; serviceTarget . addService ( MANAGEMENT_EXECUTOR , serverExecutorService ) . addAliases ( Services . JBOSS_SERVER_EXECUTOR , ManagementRemotingServices . SHUTDOWN_EXECUTOR_NAME ) . install ( ) ; final ServerScheduledExecutorService serverScheduledExecutorService = new ServerScheduledExecutorService ( threadFactory ) ; serviceTarget . addService ( JBOSS_SERVER_SCHEDULED_EXECUTOR , serverScheduledExecutorService ) . addAliases ( JBOSS_SERVER_SCHEDULED_EXECUTOR ) . addDependency ( MANAGEMENT_EXECUTOR , ExecutorService . class , serverScheduledExecutorService . executorInjector ) . install ( ) ; final CapabilityRegistry capabilityRegistry = configuration . getCapabilityRegistry ( ) ; ServerService service = new ServerService ( configuration , processState , null , bootstrapListener , new ServerDelegatingResourceDefinition ( ) , runningModeControl , vaultReader , auditLogger , authorizer , securityIdentitySupplier , capabilityRegistry , suspendController ) ; ExternalManagementRequestExecutor . install ( serviceTarget , threadGroup , EXECUTOR_CAPABILITY . getCapabilityServiceName ( ) , service . getStabilityMonitor ( ) ) ; ServiceBuilder < ? > serviceBuilder = serviceTarget . addService ( Services . JBOSS_SERVER_CONTROLLER , service ) ; serviceBuilder . addDependency ( DeploymentMountProvider . SERVICE_NAME , DeploymentMountProvider . class , service . injectedDeploymentRepository ) ; serviceBuilder . addDependency ( ContentRepository . SERVICE_NAME , ContentRepository . class , service . injectedContentRepository ) ; serviceBuilder . addDependency ( Services . JBOSS_SERVICE_MODULE_LOADER , ServiceModuleLoader . class , service . injectedModuleLoader ) ; serviceBuilder . addDependency ( Services . JBOSS_EXTERNAL_MODULE_SERVICE , ExternalModuleService . class , service . injectedExternalModuleService ) ; serviceBuilder . addDependency ( PATH_MANAGER_CAPABILITY . getCapabilityServiceName ( ) , PathManager . class , service . injectedPathManagerService ) ; if ( configuration . getServerEnvironment ( ) . isAllowModelControllerExecutor ( ) ) { serviceBuilder . addDependency ( MANAGEMENT_EXECUTOR , ExecutorService . class , service . getExecutorServiceInjector ( ) ) ; } if ( configuration . getServerEnvironment ( ) . getLaunchType ( ) == ServerEnvironment . LaunchType . DOMAIN ) { serviceBuilder . addDependency ( HostControllerConnectionService . SERVICE_NAME , ControllerInstabilityListener . class , service . getContainerInstabilityInjector ( ) ) ; } serviceBuilder . install ( ) ; } | Add this service to the given service target . |
22,281 | 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 . |
22,282 | 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 . |
22,283 | 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 . |
22,284 | public ResourceTransformerEntry resolveResourceTransformer ( final PathAddress address , final PlaceholderResolver placeholderResolver ) { return resolveResourceTransformer ( address . iterator ( ) , null , placeholderResolver ) ; } | Resolve a resource transformer for a given address . |
22,285 | 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 ; } return FORWARD ; } | Resolve an operation transformer entry . |
22,286 | 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 . |
22,287 | 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 . |
22,288 | public T addContentModification ( final ContentModification modification ) { if ( itemFilter . accepts ( modification . getItem ( ) ) ) { internalAddModification ( modification ) ; } return returnThis ( ) ; } | Add a content modification . |
22,289 | public T addBundle ( final String moduleName , final String slot , final byte [ ] newHash ) { final ContentItem item = createBundleItem ( moduleName , slot , newHash ) ; addContentModification ( createContentModification ( item , ModificationType . ADD , NO_CONTENT ) ) ; return returnThis ( ) ; } | Add a bundle . |
22,290 | public T modifyBundle ( final String moduleName , final String slot , final byte [ ] existingHash , final byte [ ] newHash ) { final ContentItem item = createBundleItem ( moduleName , slot , newHash ) ; addContentModification ( createContentModification ( item , ModificationType . MODIFY , existingHash ) ) ; return returnThis ( ) ; } | Modify a bundle . |
22,291 | public T removeBundle ( final String moduleName , final String slot , final byte [ ] existingHash ) { final ContentItem item = createBundleItem ( moduleName , slot , NO_CONTENT ) ; addContentModification ( createContentModification ( item , ModificationType . REMOVE , existingHash ) ) ; return returnThis ( ) ; } | Remove a bundle . |
22,292 | public T addFile ( final String name , final List < String > path , final byte [ ] newHash , final boolean isDirectory ) { return addFile ( name , path , newHash , isDirectory , null ) ; } | Add a misc file . |
22,293 | public T modifyFile ( final String name , final List < String > path , final byte [ ] existingHash , final byte [ ] newHash , final boolean isDirectory ) { return modifyFile ( name , path , existingHash , newHash , isDirectory , null ) ; } | Modify a misc file . |
22,294 | public T removeFile ( final String name , final List < String > path , final byte [ ] existingHash , final boolean isDirectory ) { return removeFile ( name , path , existingHash , isDirectory , null ) ; } | Remove a misc file . |
22,295 | public T addModule ( final String moduleName , final String slot , final byte [ ] newHash ) { final ContentItem item = createModuleItem ( moduleName , slot , newHash ) ; addContentModification ( createContentModification ( item , ModificationType . ADD , NO_CONTENT ) ) ; return returnThis ( ) ; } | Add a module . |
22,296 | public T modifyModule ( final String moduleName , final String slot , final byte [ ] existingHash , final byte [ ] newHash ) { final ContentItem item = createModuleItem ( moduleName , slot , newHash ) ; addContentModification ( createContentModification ( item , ModificationType . MODIFY , existingHash ) ) ; return returnThis ( ) ; } | Modify a module . |
22,297 | public T removeModule ( final String moduleName , final String slot , final byte [ ] existingHash ) { final ContentItem item = createModuleItem ( moduleName , slot , NO_CONTENT ) ; addContentModification ( createContentModification ( item , ModificationType . REMOVE , existingHash ) ) ; return returnThis ( ) ; } | Remove a module . |
22,298 | private static String getLogManagerLoggerName ( final String name ) { return ( name . equals ( RESOURCE_NAME ) ? CommonAttributes . ROOT_LOGGER_NAME : name ) ; } | Returns the logger name that should be used in the log manager . |
22,299 | public static XMLStreamException unexpectedEndElement ( final XMLExtendedStreamReader reader ) { return ControllerLogger . ROOT_LOGGER . unexpectedEndElement ( reader . getName ( ) , reader . getLocation ( ) ) ; } | Get an exception reporting an unexpected end tag for an XML element . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.