idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
145,500 | public String getModulePaths ( ) { final StringBuilder result = new StringBuilder ( ) ; if ( addDefaultModuleDir ) { result . append ( wildflyHome . resolve ( "modules" ) . toString ( ) ) ; } if ( ! modulesDirs . isEmpty ( ) ) { if ( addDefaultModuleDir ) result . append ( File . pathSeparator ) ; for ( Iterator < String > iterator = modulesDirs . iterator ( ) ; iterator . hasNext ( ) ; ) { result . append ( iterator . next ( ) ) ; if ( iterator . hasNext ( ) ) { result . append ( File . pathSeparator ) ; } } } return result . toString ( ) ; } | Returns the modules paths used on the command line . | 153 | 10 |
145,501 | public static ModelControllerClient createAndAdd ( final ManagementChannelHandler handler ) { final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient ( handler ) ; handler . addHandlerFactory ( client ) ; return client ; } | Create and add model controller handler to an existing management channel handler . | 49 | 13 |
145,502 | public static ModelControllerClient createReceiving ( final Channel channel , final ExecutorService executorService ) { final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy . create ( channel ) ; final ManagementChannelHandler handler = new ManagementChannelHandler ( strategy , executorService ) ; final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient ( handler ) ; handler . addHandlerFactory ( client ) ; channel . addCloseHandler ( new CloseHandler < Channel > ( ) { @ Override public void handleClose ( Channel closed , IOException exception ) { handler . shutdown ( ) ; try { handler . awaitCompletion ( 1 , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } finally { handler . shutdownNow ( ) ; } } } ) ; channel . receiveMessage ( handler . getReceiver ( ) ) ; return client ; } | Create a model controller client which is exclusively receiving messages on an existing channel . | 197 | 15 |
145,503 | @ Override protected void addLineContent ( BufferedReader bufferedFileReader , List < String > content , String line ) throws IOException { // Is the line an empty comment "#" ? if ( line . startsWith ( COMMENT_PREFIX ) && line . length ( ) == 1 ) { String nextLine = bufferedFileReader . readLine ( ) ; if ( nextLine != null ) { // Is the next line the realm name "#$REALM_NAME=" ? if ( nextLine . startsWith ( COMMENT_PREFIX ) && nextLine . contains ( REALM_COMMENT_PREFIX ) ) { // Realm name block detected! // The next line must be and empty comment "#" bufferedFileReader . readLine ( ) ; // Avoid adding the realm block } else { // It's a user comment... content . add ( line ) ; content . add ( nextLine ) ; } } else { super . addLineContent ( bufferedFileReader , content , line ) ; } } else { super . addLineContent ( bufferedFileReader , content , line ) ; } } | Remove the realm name block . | 236 | 6 |
145,504 | @ Deprecated public void validateOperation ( final ModelNode operation ) throws OperationFailedException { if ( operation . hasDefined ( ModelDescriptionConstants . OPERATION_NAME ) && deprecationData != null && deprecationData . isNotificationUseful ( ) ) { ControllerLogger . DEPRECATED_LOGGER . operationDeprecated ( getName ( ) , PathAddress . pathAddress ( operation . get ( ModelDescriptionConstants . OP_ADDR ) ) . toCLIStyleString ( ) ) ; } for ( AttributeDefinition ad : this . parameters ) { ad . validateOperation ( operation ) ; } } | Validates operation model against the definition and its parameters | 135 | 10 |
145,505 | @ SuppressWarnings ( "deprecation" ) @ Deprecated public final void validateAndSet ( ModelNode operationObject , final ModelNode model ) throws OperationFailedException { validateOperation ( operationObject ) ; for ( AttributeDefinition ad : this . parameters ) { ad . validateAndSet ( operationObject , model ) ; } } | validates operation against the definition and sets model for the parameters passed . | 72 | 14 |
145,506 | < P extends PatchingArtifact . ArtifactState , S extends PatchingArtifact . ArtifactState > PatchingArtifactStateHandler < S > getHandlerForArtifact ( PatchingArtifact < P , S > artifact ) { return handlers . get ( artifact ) ; } | Get a state handler for a given patching artifact . | 57 | 11 |
145,507 | public < V > V getAttachment ( final AttachmentKey < V > key ) { assert key != null ; return key . cast ( contextAttachments . get ( key ) ) ; } | Retrieves an object that has been attached to this context . | 40 | 13 |
145,508 | public < V > V attach ( final AttachmentKey < V > key , final V value ) { assert key != null ; return key . cast ( contextAttachments . put ( key , value ) ) ; } | Attaches an arbitrary object to this context . | 44 | 9 |
145,509 | public < V > V attachIfAbsent ( final AttachmentKey < V > key , final V value ) { assert key != null ; return key . cast ( contextAttachments . putIfAbsent ( key , value ) ) ; } | Attaches an arbitrary object to this context only if the object was not already attached . If a value has already been attached with the key provided the current value associated with the key is returned . | 50 | 38 |
145,510 | public < V > V detach ( final AttachmentKey < V > key ) { assert key != null ; return key . cast ( contextAttachments . remove ( key ) ) ; } | Detaches or removes the value from this context . | 38 | 10 |
145,511 | private void writeInterfaceCriteria ( final XMLExtendedStreamWriter writer , final ModelNode subModel , final boolean nested ) throws XMLStreamException { for ( final Property property : subModel . asPropertyList ( ) ) { if ( property . getValue ( ) . isDefined ( ) ) { writeInterfaceCriteria ( writer , property , nested ) ; } } } | Write the criteria elements extracting the information of the sub - model . | 79 | 13 |
145,512 | public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister ( final ConfigurationFile file , final HostControllerEnvironment environment , final ExecutorService executorService , final ExtensionRegistry hostExtensionRegistry , final LocalHostControllerInfo localHostControllerInfo ) { String defaultHostname = localHostControllerInfo . getLocalHostName ( ) ; if ( environment . getRunningModeControl ( ) . isReloaded ( ) ) { if ( environment . getRunningModeControl ( ) . getReloadHostName ( ) != null ) { defaultHostname = environment . getRunningModeControl ( ) . getReloadHostName ( ) ; } } HostXml hostXml = new HostXml ( defaultHostname , environment . getRunningModeControl ( ) . getRunningMode ( ) , environment . isUseCachedDc ( ) , Module . getBootModuleLoader ( ) , executorService , hostExtensionRegistry ) ; BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister ( file , new QName ( Namespace . CURRENT . getUriString ( ) , "host" ) , hostXml , hostXml , false ) ; for ( Namespace namespace : Namespace . domainValues ( ) ) { if ( ! namespace . equals ( Namespace . CURRENT ) ) { persister . registerAdditionalRootElement ( new QName ( namespace . getUriString ( ) , "host" ) , hostXml ) ; } } hostExtensionRegistry . setWriterRegistry ( persister ) ; return persister ; } | host . xml | 331 | 3 |
145,513 | public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister ( final ConfigurationFile file , ExecutorService executorService , ExtensionRegistry extensionRegistry , final HostControllerEnvironment environment ) { DomainXml domainXml = new DomainXml ( Module . getBootModuleLoader ( ) , executorService , extensionRegistry ) ; boolean suppressLoad = false ; ConfigurationFile . InteractionPolicy policy = file . getInteractionPolicy ( ) ; final boolean isReloaded = environment . getRunningModeControl ( ) . isReloaded ( ) ; if ( ! isReloaded && ( policy == ConfigurationFile . InteractionPolicy . NEW && ( file . getBootFile ( ) . exists ( ) && file . getBootFile ( ) . length ( ) != 0 ) ) ) { throw HostControllerLogger . ROOT_LOGGER . cannotOverwriteDomainXmlWithEmpty ( file . getBootFile ( ) . getName ( ) ) ; } if ( ! isReloaded && ( policy == ConfigurationFile . InteractionPolicy . NEW || policy == ConfigurationFile . InteractionPolicy . DISCARD ) ) { suppressLoad = true ; } BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister ( file , new QName ( Namespace . CURRENT . getUriString ( ) , "domain" ) , domainXml , domainXml , suppressLoad ) ; for ( Namespace namespace : Namespace . domainValues ( ) ) { if ( ! namespace . equals ( Namespace . CURRENT ) ) { persister . registerAdditionalRootElement ( new QName ( namespace . getUriString ( ) , "domain" ) , domainXml ) ; } } extensionRegistry . setWriterRegistry ( persister ) ; return persister ; } | domain . xml | 370 | 3 |
145,514 | public static ExtensibleConfigurationPersister createTransientDomainXmlConfigurationPersister ( ExecutorService executorService , ExtensionRegistry extensionRegistry ) { DomainXml domainXml = new DomainXml ( Module . getBootModuleLoader ( ) , executorService , extensionRegistry ) ; ExtensibleConfigurationPersister persister = new NullConfigurationPersister ( domainXml ) ; extensionRegistry . setWriterRegistry ( persister ) ; return persister ; } | slave = true | 99 | 3 |
145,515 | static void apply ( final String patchId , final Collection < ContentModification > modifications , final PatchEntry patchEntry , final ContentItemFilter filter ) { for ( final ContentModification modification : modifications ) { final ContentItem item = modification . getItem ( ) ; // Check if we accept the item if ( ! filter . accepts ( item ) ) { continue ; } final Location location = new Location ( item ) ; final ContentEntry contentEntry = new ContentEntry ( patchId , modification ) ; ContentTaskDefinition definition = patchEntry . get ( location ) ; if ( definition == null ) { definition = new ContentTaskDefinition ( location , contentEntry , false ) ; patchEntry . put ( location , definition ) ; } else { definition . setTarget ( contentEntry ) ; } } } | Apply modifications to a content task definition . | 161 | 8 |
145,516 | protected ServiceName serviceName ( final String name ) { return baseServiceName != null ? baseServiceName . append ( name ) : null ; } | The service name to be removed . Can be overridden for unusual service naming patterns | 30 | 16 |
145,517 | private boolean subModuleExists ( File dir ) { if ( isSlotDirectory ( dir ) ) { return true ; } else { File [ ] children = dir . listFiles ( File :: isDirectory ) ; for ( File child : children ) { if ( subModuleExists ( child ) ) { return true ; } } } return false ; } | depth - first search for any module - just to check that the suggestion has any chance of delivering correct result | 72 | 21 |
145,518 | private String tail ( String moduleName ) { if ( moduleName . indexOf ( MODULE_NAME_SEPARATOR ) > 0 ) { return moduleName . substring ( moduleName . indexOf ( MODULE_NAME_SEPARATOR ) + 1 ) ; } else { return "" ; } } | get all parts of module name apart from first | 62 | 9 |
145,519 | void resolveBootUpdates ( final ModelController controller , final ActiveOperation . CompletedCallback < ModelNode > callback ) throws Exception { connection . openConnection ( controller , callback ) ; // Keep a reference to the the controller this . controller = controller ; } | Resolve the boot updates and register at the local HC . | 51 | 12 |
145,520 | static VaultConfig loadExternalFile ( File f ) throws XMLStreamException { if ( f == null ) { throw new IllegalArgumentException ( "File is null" ) ; } if ( ! f . exists ( ) ) { throw new XMLStreamException ( "Failed to locate vault file " + f . getAbsolutePath ( ) ) ; } final VaultConfig config = new VaultConfig ( ) ; BufferedInputStream input = null ; try { final XMLMapper mapper = XMLMapper . Factory . create ( ) ; final XMLElementReader < VaultConfig > reader = new ExternalVaultConfigReader ( ) ; mapper . registerRootElement ( new QName ( VAULT ) , reader ) ; FileInputStream is = new FileInputStream ( f ) ; input = new BufferedInputStream ( is ) ; XMLStreamReader streamReader = XMLInputFactory . newInstance ( ) . createXMLStreamReader ( input ) ; mapper . parseDocument ( config , streamReader ) ; streamReader . close ( ) ; } catch ( FileNotFoundException e ) { throw new XMLStreamException ( "Vault file not found" , e ) ; } catch ( XMLStreamException t ) { throw t ; } finally { StreamUtils . safeClose ( input ) ; } return config ; } | In the 2 . 0 xsd the vault is in an external file which has no namespace using the output of the vault tool . | 274 | 26 |
145,521 | static VaultConfig readVaultElement_3_0 ( XMLExtendedStreamReader reader , Namespace expectedNs ) throws XMLStreamException { final VaultConfig config = new VaultConfig ( ) ; final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final String value = reader . getAttributeValue ( i ) ; String name = reader . getAttributeLocalName ( i ) ; if ( name . equals ( CODE ) ) { config . code = value ; } else if ( name . equals ( MODULE ) ) { config . module = value ; } else { unexpectedVaultAttribute ( reader . getAttributeLocalName ( i ) , reader ) ; } } if ( config . code == null && config . module != null ) { throw new XMLStreamException ( "Attribute 'module' was specified without an attribute" + " 'code' for element '" + VAULT + "' at " + reader . getLocation ( ) ) ; } readVaultOptions ( reader , config ) ; return config ; } | In the 3 . 0 xsd the vault configuration and its options are part of the vault xsd . | 224 | 21 |
145,522 | private Set < String > checkModel ( final ModelNode model , TransformationContext context ) throws OperationFailedException { final Set < String > attributes = new HashSet < String > ( ) ; AttributeTransformationRequirementChecker checker ; for ( final String attribute : attributeNames ) { if ( model . hasDefined ( attribute ) ) { if ( attributeCheckers != null && ( checker = attributeCheckers . get ( attribute ) ) != null ) { if ( checker . isAttributeTransformationRequired ( attribute , model . get ( attribute ) , context ) ) { attributes . add ( attribute ) ; } } else if ( SIMPLE_EXPRESSIONS . isAttributeTransformationRequired ( attribute , model . get ( attribute ) , context ) ) { attributes . add ( attribute ) ; } } } return attributes ; } | Check the model for expression values . | 173 | 7 |
145,523 | public void setValue ( String propName , Object value ) { for ( RequestProp prop : props ) { if ( prop . getName ( ) . equals ( propName ) ) { JComponent valComp = prop . getValueComponent ( ) ; if ( valComp instanceof JTextComponent ) { ( ( JTextComponent ) valComp ) . setText ( value . toString ( ) ) ; } if ( valComp instanceof AbstractButton ) { ( ( AbstractButton ) valComp ) . setSelected ( ( Boolean ) value ) ; } if ( valComp instanceof JComboBox ) { ( ( JComboBox ) valComp ) . setSelectedItem ( value ) ; } return ; } } } | Set the value of the underlying component . Note that this will not work for ListEditor components . Also note that for a JComboBox The value object must have the same identity as an object in the drop - down . | 151 | 45 |
145,524 | static void doDifference ( Map < String , String > left , Map < String , String > right , Map < String , String > onlyOnLeft , Map < String , String > onlyOnRight , Map < String , String > updated ) { onlyOnRight . clear ( ) ; onlyOnRight . putAll ( right ) ; for ( Map . Entry < String , String > entry : left . entrySet ( ) ) { String leftKey = entry . getKey ( ) ; String leftValue = entry . getValue ( ) ; if ( right . containsKey ( leftKey ) ) { String rightValue = onlyOnRight . remove ( leftKey ) ; if ( ! leftValue . equals ( rightValue ) ) { updated . put ( leftKey , leftValue ) ; } } else { onlyOnLeft . put ( leftKey , leftValue ) ; } } } | calculate the difference of the two maps so we know what was added removed & updated | 181 | 18 |
145,525 | public void close ( ) throws IOException { final ManagedBinding binding = this . socketBindingManager . getNamedRegistry ( ) . getManagedBinding ( this . name ) ; if ( binding == null ) { return ; } binding . close ( ) ; } | Closes the outbound socket binding connection . | 59 | 9 |
145,526 | public static boolean requiresReload ( final Set < Flag > flags ) { return flags . contains ( Flag . RESTART_ALL_SERVICES ) || flags . contains ( Flag . RESTART_RESOURCE_SERVICES ) ; } | Checks to see within the flags if a reload i . e . not a full restart is required . | 50 | 21 |
145,527 | @ Override protected void updateState ( final String name , final InstallationModificationImpl modification , final InstallationModificationImpl . InstallationState state ) { final PatchableTarget . TargetInfo identityInfo = modification . getModifiedState ( ) ; this . identity = new Identity ( ) { @ Override public String getVersion ( ) { return modification . getVersion ( ) ; } @ Override public String getName ( ) { return name ; } @ Override public TargetInfo loadTargetInfo ( ) throws IOException { return identityInfo ; } @ Override public DirectoryStructure getDirectoryStructure ( ) { return modification . getDirectoryStructure ( ) ; } } ; this . allPatches = Collections . unmodifiableList ( modification . getAllPatches ( ) ) ; this . layers . clear ( ) ; for ( final Map . Entry < String , MutableTargetImpl > entry : state . getLayers ( ) . entrySet ( ) ) { final String layerName = entry . getKey ( ) ; final MutableTargetImpl target = entry . getValue ( ) ; putLayer ( layerName , new LayerInfo ( layerName , target . getModifiedState ( ) , target . getDirectoryStructure ( ) ) ) ; } this . addOns . clear ( ) ; for ( final Map . Entry < String , MutableTargetImpl > entry : state . getAddOns ( ) . entrySet ( ) ) { final String addOnName = entry . getKey ( ) ; final MutableTargetImpl target = entry . getValue ( ) ; putAddOn ( addOnName , new LayerInfo ( addOnName , target . getModifiedState ( ) , target . getDirectoryStructure ( ) ) ) ; } } | Update the installed identity using the modified state from the modification . | 365 | 12 |
145,528 | public static Set < String > listAllLinks ( OperationContext context , String overlay ) { Set < String > serverGoupNames = listServerGroupsReferencingOverlay ( context . readResourceFromRoot ( PathAddress . EMPTY_ADDRESS ) , overlay ) ; Set < String > links = new HashSet <> ( ) ; for ( String serverGoupName : serverGoupNames ) { links . addAll ( listLinks ( context , PathAddress . pathAddress ( PathElement . pathElement ( SERVER_GROUP , serverGoupName ) , PathElement . pathElement ( DEPLOYMENT_OVERLAY , overlay ) ) ) ) ; } return links ; } | Returns all the deployment runtime names associated with an overlay accross all server groups . | 145 | 16 |
145,529 | public static Set < String > listLinks ( OperationContext context , PathAddress overlayAddress ) { Resource overlayResource = context . readResourceFromRoot ( overlayAddress ) ; if ( overlayResource . hasChildren ( DEPLOYMENT ) ) { return overlayResource . getChildrenNames ( DEPLOYMENT ) ; } return Collections . emptySet ( ) ; } | Returns all the deployment runtime names associated with an overlay . | 73 | 11 |
145,530 | public static void redeployDeployments ( OperationContext context , PathAddress deploymentsRootAddress , Set < String > deploymentNames ) throws OperationFailedException { for ( String deploymentName : deploymentNames ) { PathAddress address = deploymentsRootAddress . append ( DEPLOYMENT , deploymentName ) ; OperationStepHandler handler = context . getRootResourceRegistration ( ) . getOperationHandler ( address , REDEPLOY ) ; ModelNode operation = addRedeployStep ( address ) ; ServerLogger . AS_ROOT_LOGGER . debugf ( "Redeploying %s at address %s with handler %s" , deploymentName , address , handler ) ; assert handler != null ; assert operation . isDefined ( ) ; context . addStep ( operation , handler , OperationContext . Stage . MODEL ) ; } } | We are adding a redeploy operation step for each specified deployment runtime name . | 173 | 15 |
145,531 | public static void redeployLinksAndTransformOperation ( OperationContext context , ModelNode removeOperation , PathAddress deploymentsRootAddress , Set < String > runtimeNames ) throws OperationFailedException { Set < String > deploymentNames = listDeployments ( context . readResourceFromRoot ( deploymentsRootAddress ) , runtimeNames ) ; Operations . CompositeOperationBuilder opBuilder = Operations . CompositeOperationBuilder . create ( ) ; if ( deploymentNames . isEmpty ( ) ) { for ( String s : runtimeNames ) { ServerLogger . ROOT_LOGGER . debugf ( "We haven't found any deployment for %s in server-group %s" , s , deploymentsRootAddress . getLastElement ( ) . getValue ( ) ) ; } } if ( removeOperation != null ) { opBuilder . addStep ( removeOperation ) ; } for ( String deploymentName : deploymentNames ) { opBuilder . addStep ( addRedeployStep ( deploymentsRootAddress . append ( DEPLOYMENT , deploymentName ) ) ) ; } List < DomainOperationTransmuter > transformers = context . getAttachment ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS ) ; if ( transformers == null ) { context . attach ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS , transformers = new ArrayList <> ( ) ) ; } final ModelNode slave = opBuilder . build ( ) . getOperation ( ) ; transformers . add ( new OverlayOperationTransmuter ( slave , context . getCurrentAddress ( ) ) ) ; } | It will look for all the deployments under the deploymentsRootAddress with a runtimeName in the specified list of runtime names and then transform the operation so that every server having those deployments will redeploy the affected deployments . | 337 | 42 |
145,532 | public static Set < String > listDeployments ( Resource deploymentRootResource , Set < String > runtimeNames ) { Set < Pattern > set = new HashSet <> ( ) ; for ( String wildcardExpr : runtimeNames ) { Pattern pattern = DeploymentOverlayIndex . getPattern ( wildcardExpr ) ; set . add ( pattern ) ; } return listDeploymentNames ( deploymentRootResource , set ) ; } | Returns the deployment names with the specified runtime names at the specified deploymentRootAddress . | 89 | 16 |
145,533 | public void execute ( CommandHandler handler , int timeout , TimeUnit unit ) throws CommandLineException , InterruptedException , ExecutionException , TimeoutException { ExecutableBuilder builder = new ExecutableBuilder ( ) { CommandContext c = newTimeoutCommandContext ( ctx ) ; @ Override public Executable build ( ) { return ( ) -> { handler . handle ( c ) ; } ; } @ Override public CommandContext getCommandContext ( ) { return c ; } } ; execute ( builder , timeout , unit ) ; } | public for testing purpose | 109 | 4 |
145,534 | void execute ( ExecutableBuilder builder , int timeout , TimeUnit unit ) throws CommandLineException , InterruptedException , ExecutionException , TimeoutException { Future < Void > task = executorService . submit ( ( ) -> { builder . build ( ) . execute ( ) ; return null ; } ) ; try { if ( timeout <= 0 ) { //Synchronous task . get ( ) ; } else { // Guarded execution try { task . get ( timeout , unit ) ; } catch ( TimeoutException ex ) { // First make the context unusable CommandContext c = builder . getCommandContext ( ) ; if ( c instanceof TimeoutCommandContext ) { ( ( TimeoutCommandContext ) c ) . timeout ( ) ; } // Then cancel the task. task . cancel ( true ) ; throw ex ; } } } catch ( InterruptedException ex ) { // Could have been interrupted by user (Ctrl-C) Thread . currentThread ( ) . interrupt ( ) ; cancelTask ( task , builder . getCommandContext ( ) , null ) ; // Interrupt running operation. CommandContext c = builder . getCommandContext ( ) ; if ( c instanceof TimeoutCommandContext ) { ( ( TimeoutCommandContext ) c ) . interrupted ( ) ; } throw ex ; } } | The CommandContext can be retrieved thatnks to the ExecutableBuilder . | 268 | 15 |
145,535 | public String getOriginalValue ( ParsedCommandLine parsedLine , boolean required ) throws CommandFormatException { String value = null ; if ( parsedLine . hasProperties ( ) ) { if ( index >= 0 ) { List < String > others = parsedLine . getOtherProperties ( ) ; if ( others . size ( ) > index ) { return others . get ( index ) ; } } value = parsedLine . getPropertyValue ( fullName ) ; if ( value == null && shortName != null ) { value = parsedLine . getPropertyValue ( shortName ) ; } } if ( required && value == null && ! isPresent ( parsedLine ) ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "Required argument " ) ; buf . append ( ' ' ) . append ( fullName ) . append ( ' ' ) ; buf . append ( " is missing." ) ; throw new CommandFormatException ( buf . toString ( ) ) ; } return value ; } | Returns value as it appeared on the command line with escape sequences and system properties not resolved . The variables though are resolved during the initial parsing of the command line . | 208 | 32 |
145,536 | public static void logBeforeExit ( ExitLogger logger ) { try { if ( logged . compareAndSet ( false , true ) ) { logger . logExit ( ) ; } } catch ( Throwable ignored ) { // ignored } } | Invokes the exit logger if and only if no ExitLogger was previously invoked . | 49 | 17 |
145,537 | private String getName ( CommandContext ctx , boolean failInBatch ) throws CommandLineException { final ParsedCommandLine args = ctx . getParsedCommandLine ( ) ; final String name = this . name . getValue ( args , true ) ; if ( name == null ) { throw new CommandFormatException ( this . name + " is missing value." ) ; } if ( ! ctx . isBatchMode ( ) || failInBatch ) { if ( ! Util . isValidPath ( ctx . getModelControllerClient ( ) , Util . DEPLOYMENT_OVERLAY , name ) ) { throw new CommandFormatException ( "Deployment overlay " + name + " does not exist." ) ; } } return name ; } | Validate that the overlay exists . If it doesn t exist throws an exception if not in batch mode or if failInBatch is true . In batch mode we could be in the case that the overlay doesn t exist yet . | 163 | 46 |
145,538 | public static ServiceName moduleSpecServiceName ( ModuleIdentifier identifier ) { if ( ! isDynamicModule ( identifier ) ) { throw ServerLogger . ROOT_LOGGER . missingModulePrefix ( identifier , MODULE_PREFIX ) ; } return MODULE_SPEC_SERVICE_PREFIX . append ( identifier . getName ( ) ) . append ( identifier . getSlot ( ) ) ; } | Returns the corresponding ModuleSpec service name for the given module . | 85 | 12 |
145,539 | public static ServiceName moduleResolvedServiceName ( ModuleIdentifier identifier ) { if ( ! isDynamicModule ( identifier ) ) { throw ServerLogger . ROOT_LOGGER . missingModulePrefix ( identifier , MODULE_PREFIX ) ; } return MODULE_RESOLVED_SERVICE_PREFIX . append ( identifier . getName ( ) ) . append ( identifier . getSlot ( ) ) ; } | Returns the corresponding module resolved service name for the given module . | 89 | 12 |
145,540 | public static ServiceName moduleServiceName ( ModuleIdentifier identifier ) { if ( ! identifier . getName ( ) . startsWith ( MODULE_PREFIX ) ) { throw ServerLogger . ROOT_LOGGER . missingModulePrefix ( identifier , MODULE_PREFIX ) ; } return MODULE_SERVICE_PREFIX . append ( identifier . getName ( ) ) . append ( identifier . getSlot ( ) ) ; } | Returns the corresponding ModuleLoadService service name for the given module . | 92 | 13 |
145,541 | public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ServicesAttachment servicesAttachment = deploymentUnit . getAttachment ( Attachments . SERVICES ) ; if ( servicesAttachment == null || servicesAttachment . getServiceImplementations ( ServiceActivator . class . getName ( ) ) . isEmpty ( ) ) { return ; // Skip it if it has not been marked } final Module module = deploymentUnit . getAttachment ( Attachments . MODULE ) ; if ( module == null ) { return ; // Skip deployments with no module } AttachmentList < DeploymentUnit > duList = deploymentUnit . getAttachment ( Attachments . SUB_DEPLOYMENTS ) ; List < String > serviceAcitvatorList = new ArrayList < String > ( ) ; if ( duList != null && ! duList . isEmpty ( ) ) { for ( DeploymentUnit du : duList ) { ServicesAttachment duServicesAttachment = du . getAttachment ( Attachments . SERVICES ) ; for ( String serv : duServicesAttachment . getServiceImplementations ( ServiceActivator . class . getName ( ) ) ) { serviceAcitvatorList . add ( serv ) ; } } } ServiceRegistry serviceRegistry = phaseContext . getServiceRegistry ( ) ; if ( WildFlySecurityManager . isChecking ( ) ) { //service registry allows you to modify internal server state across all deployments //if a security manager is present we use a version that has permission checks serviceRegistry = new SecuredServiceRegistry ( serviceRegistry ) ; } final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl ( phaseContext . getServiceTarget ( ) , serviceRegistry ) ; final ClassLoader current = WildFlySecurityManager . getCurrentContextClassLoaderPrivileged ( ) ; try { WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( module . getClassLoader ( ) ) ; for ( ServiceActivator serviceActivator : module . loadService ( ServiceActivator . class ) ) { try { for ( String serv : servicesAttachment . getServiceImplementations ( ServiceActivator . class . getName ( ) ) ) { if ( serv . compareTo ( serviceActivator . getClass ( ) . getName ( ) ) == 0 && ! serviceAcitvatorList . contains ( serv ) ) { serviceActivator . activate ( serviceActivatorContext ) ; break ; } } } catch ( ServiceRegistryException e ) { throw new DeploymentUnitProcessingException ( e ) ; } } } finally { WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( current ) ; } } | If the deployment has a module attached it will ask the module to load the ServiceActivator services . | 585 | 20 |
145,542 | synchronized void openConnection ( final ModelController controller , final ActiveOperation . CompletedCallback < ModelNode > callback ) throws Exception { boolean ok = false ; final Connection connection = connectionManager . connect ( ) ; try { channelHandler . executeRequest ( new ServerRegisterRequest ( ) , null , callback ) ; // HC is the same version, so it will support sending the subject channelHandler . getAttachments ( ) . attach ( TransactionalProtocolClient . SEND_IDENTITY , Boolean . TRUE ) ; channelHandler . getAttachments ( ) . attach ( TransactionalProtocolClient . SEND_IN_VM , Boolean . TRUE ) ; channelHandler . addHandlerFactory ( new TransactionalProtocolOperationHandler ( controller , channelHandler , responseAttachmentSupport ) ) ; ok = true ; } finally { if ( ! ok ) { connection . close ( ) ; } } } | Connect to the HC and retrieve the current model updates . | 186 | 11 |
145,543 | synchronized void asyncReconnect ( final URI reconnectUri , String authKey , final ReconnectCallback callback ) { if ( getState ( ) != State . OPEN ) { return ; } // Update the configuration with the new credentials final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration . copy ( configuration ) ; config . setCallbackHandler ( createClientCallbackHandler ( userName , authKey ) ) ; config . setUri ( reconnectUri ) ; this . configuration = config ; final ReconnectRunner reconnectTask = this . reconnectRunner ; if ( reconnectTask == null ) { final ReconnectRunner task = new ReconnectRunner ( ) ; task . callback = callback ; task . future = executorService . submit ( task ) ; } else { reconnectTask . callback = callback ; } } | This continuously tries to reconnect in a separate thread and will only stop if the connection was established successfully or the server gets shutdown . If there is currently a reconnect task active the connection paramaters and callback will get updated . | 164 | 43 |
145,544 | synchronized boolean doReConnect ( ) throws IOException { // In case we are still connected, test the connection and see if we can reuse it if ( connectionManager . isConnected ( ) ) { try { final Future < Long > result = channelHandler . executeRequest ( ManagementPingRequest . INSTANCE , null ) . getResult ( ) ; result . get ( 15 , TimeUnit . SECONDS ) ; // Hmm, perhaps 15 is already too much return true ; } catch ( Exception e ) { ServerLogger . AS_ROOT_LOGGER . debugf ( e , "failed to ping the host-controller, going to reconnect" ) ; } // Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect final Connection connection = connectionManager . getConnection ( ) ; StreamUtils . safeClose ( connection ) ; if ( connection != null ) { try { // Wait for the connection to be closed connection . awaitClosed ( ) ; } catch ( InterruptedException e ) { throw new InterruptedIOException ( ) ; } } } boolean ok = false ; final Connection connection = connectionManager . connect ( ) ; try { // Reconnect to the host-controller final ActiveOperation < Boolean , Void > result = channelHandler . executeRequest ( new ServerReconnectRequest ( ) , null ) ; try { boolean inSync = result . getResult ( ) . get ( ) ; ok = true ; reconnectRunner = null ; return inSync ; } catch ( ExecutionException e ) { throw new IOException ( e ) ; } catch ( InterruptedException e ) { throw new InterruptedIOException ( ) ; } } finally { if ( ! ok ) { StreamUtils . safeClose ( connection ) ; } } } | Reconnect to the HC . | 368 | 7 |
145,545 | synchronized void started ( ) { try { if ( isConnected ( ) ) { channelHandler . executeRequest ( new ServerStartedRequest ( ) , null ) . getResult ( ) . await ( ) ; } } catch ( Exception e ) { ServerLogger . AS_ROOT_LOGGER . debugf ( e , "failed to send started notification" ) ; } } | Send the started notification | 81 | 4 |
145,546 | public int executeTask ( final TransactionalProtocolClient . TransactionalOperationListener < ServerOperation > listener , final ServerUpdateTask task ) { try { return execute ( listener , task . getServerIdentity ( ) , task . getOperation ( ) ) ; } catch ( OperationFailedException e ) { // Handle failures operation transformation failures final ServerIdentity identity = task . getServerIdentity ( ) ; final ServerOperation serverOperation = new ServerOperation ( identity , task . getOperation ( ) , null , null , OperationResultTransformer . ORIGINAL_RESULT ) ; final TransactionalProtocolClient . PreparedOperation < ServerOperation > result = BlockingQueueOperationListener . FailedOperation . create ( serverOperation , e ) ; listener . operationPrepared ( result ) ; recordExecutedRequest ( new ExecutedServerRequest ( identity , result . getFinalResult ( ) , OperationResultTransformer . ORIGINAL_RESULT ) ) ; return 1 ; // 1 ms timeout since there is no reason to wait for the locally stored result } } | Execute a server task . | 219 | 6 |
145,547 | protected boolean executeOperation ( final TransactionalProtocolClient . TransactionalOperationListener < ServerOperation > listener , TransactionalProtocolClient client , final ServerIdentity identity , final ModelNode operation , final OperationResultTransformer transformer ) { if ( client == null ) { return false ; } final OperationMessageHandler messageHandler = new DelegatingMessageHandler ( context ) ; final OperationAttachments operationAttachments = new DelegatingOperationAttachments ( context ) ; final ServerOperation serverOperation = new ServerOperation ( identity , operation , messageHandler , operationAttachments , transformer ) ; try { DomainControllerLogger . HOST_CONTROLLER_LOGGER . tracef ( "Sending %s to %s" , operation , identity ) ; final Future < OperationResponse > result = client . execute ( listener , serverOperation ) ; recordExecutedRequest ( new ExecutedServerRequest ( identity , result , transformer ) ) ; } catch ( IOException e ) { final TransactionalProtocolClient . PreparedOperation < ServerOperation > result = BlockingQueueOperationListener . FailedOperation . create ( serverOperation , e ) ; listener . operationPrepared ( result ) ; recordExecutedRequest ( new ExecutedServerRequest ( identity , result . getFinalResult ( ) , transformer ) ) ; } return true ; } | Execute the operation . | 277 | 5 |
145,548 | void recordPreparedOperation ( final TransactionalProtocolClient . PreparedOperation < ServerTaskExecutor . ServerOperation > preparedOperation ) { recordPreparedTask ( new ServerTaskExecutor . ServerPreparedResponse ( preparedOperation ) ) ; } | Record a prepare operation . | 52 | 5 |
145,549 | void recordOperationPrepareTimeout ( final BlockingQueueOperationListener . FailedOperation < ServerOperation > failedOperation ) { recordPreparedTask ( new ServerTaskExecutor . ServerPreparedResponse ( failedOperation ) ) ; // Swap out the submitted task so we don't wait for the final result. Use a future the returns // prepared response ServerIdentity identity = failedOperation . getOperation ( ) . getIdentity ( ) ; AsyncFuture < OperationResponse > finalResult = failedOperation . getFinalResult ( ) ; synchronized ( submittedTasks ) { submittedTasks . put ( identity , new ServerTaskExecutor . ExecutedServerRequest ( identity , finalResult ) ) ; } } | Record a prepare operation timeout . | 142 | 6 |
145,550 | public static ServiceController < InstallationManager > installService ( ServiceTarget serviceTarget ) { final InstallationManagerService service = new InstallationManagerService ( ) ; return serviceTarget . addService ( InstallationManagerService . NAME , service ) . addDependency ( JBOSS_PRODUCT_CONFIG_SERVICE , ProductConfig . class , service . productConfig ) . setInitialMode ( ServiceController . Mode . ACTIVE ) . install ( ) ; } | Install the installation manager service . | 93 | 6 |
145,551 | public Method getMethod ( Method method ) { return getMethod ( method . getReturnType ( ) , method . getName ( ) , method . getParameterTypes ( ) ) ; } | Get the canonical method declared on this object . | 38 | 9 |
145,552 | public Collection < Method > getAllMethods ( String name ) { final Map < ParamList , Map < Class < ? > , Method > > nameMap = methods . get ( name ) ; if ( nameMap == null ) { return Collections . emptySet ( ) ; } final Collection < Method > methods = new ArrayList < Method > ( ) ; for ( Map < Class < ? > , Method > map : nameMap . values ( ) ) { methods . addAll ( map . values ( ) ) ; } return methods ; } | Get a collection of methods declared on this object by method name . | 110 | 13 |
145,553 | public Collection < Method > getAllMethods ( String name , int paramCount ) { final Map < ParamList , Map < Class < ? > , Method > > nameMap = methods . get ( name ) ; if ( nameMap == null ) { return Collections . emptySet ( ) ; } final Collection < Method > methods = new ArrayList < Method > ( ) ; for ( Map < Class < ? > , Method > map : nameMap . values ( ) ) { for ( Method method : map . values ( ) ) { if ( method . getParameterTypes ( ) . length == paramCount ) { methods . add ( method ) ; } } } return methods ; } | Get a collection of methods declared on this object by method name and parameter count . | 139 | 16 |
145,554 | public static ServiceActivator create ( final ModelNode endpointConfig , final URI managementURI , final String serverName , final String serverProcessName , final String authKey , final boolean managementSubsystemEndpoint , final Supplier < SSLContext > sslContextSupplier ) { return new DomainServerCommunicationServices ( endpointConfig , managementURI , serverName , serverProcessName , authKey , managementSubsystemEndpoint , sslContextSupplier ) ; } | Create a new service activator for the domain server communication services . | 94 | 13 |
145,555 | public InetSocketAddress getMulticastSocketAddress ( ) { if ( multicastAddress == null ) { throw MESSAGES . noMulticastBinding ( name ) ; } return new InetSocketAddress ( multicastAddress , multicastPort ) ; } | Get the multicast socket address . | 57 | 7 |
145,556 | public ServerSocket createServerSocket ( ) throws IOException { final ServerSocket socket = getServerSocketFactory ( ) . createServerSocket ( name ) ; socket . bind ( getSocketAddress ( ) ) ; return socket ; } | Create and bind a server socket | 46 | 6 |
145,557 | public static void registerDeploymentResource ( final DeploymentResourceSupport deploymentResourceSupport , final LoggingConfigurationService service ) { final PathElement base = PathElement . pathElement ( "configuration" , service . getConfiguration ( ) ) ; deploymentResourceSupport . getDeploymentSubModel ( LoggingExtension . SUBSYSTEM_NAME , base ) ; final LogContextConfiguration configuration = service . getValue ( ) ; // Register the child resources if the configuration is not null in cases where a log4j configuration was used if ( configuration != null ) { registerDeploymentResource ( deploymentResourceSupport , base , HANDLER , configuration . getHandlerNames ( ) ) ; registerDeploymentResource ( deploymentResourceSupport , base , LOGGER , configuration . getLoggerNames ( ) ) ; registerDeploymentResource ( deploymentResourceSupport , base , FORMATTER , configuration . getFormatterNames ( ) ) ; registerDeploymentResource ( deploymentResourceSupport , base , FILTER , configuration . getFilterNames ( ) ) ; registerDeploymentResource ( deploymentResourceSupport , base , POJO , configuration . getPojoNames ( ) ) ; registerDeploymentResource ( deploymentResourceSupport , base , ERROR_MANAGER , configuration . getErrorManagerNames ( ) ) ; } } | Registers the deployment resources needed . | 264 | 7 |
145,558 | public static String constructUrl ( final HttpServerExchange exchange , final String path ) { final HeaderMap headers = exchange . getRequestHeaders ( ) ; String host = headers . getFirst ( HOST ) ; String protocol = exchange . getConnection ( ) . getSslSessionInfo ( ) != null ? "https" : "http" ; return protocol + "://" + host + path ; } | Based on the current request represented by the HttpExchange construct a complete URL for the supplied path . | 85 | 21 |
145,559 | public boolean matches ( Property property ) { return property . getName ( ) . equals ( key ) && ( value == WILDCARD_VALUE || property . getValue ( ) . asString ( ) . equals ( value ) ) ; } | Determine whether the given property matches this element . A property matches this element when property name and this key are equal values are equal or this element value is a wildcard . | 50 | 36 |
145,560 | public boolean matches ( PathElement pe ) { return pe . key . equals ( key ) && ( isWildcard ( ) || pe . value . equals ( value ) ) ; } | Determine whether the given element matches this element . An element matches this element when keys are equal values are equal or this element value is a wildcard . | 37 | 32 |
145,561 | public void setAppender ( final Appender appender ) { if ( this . appender != null ) { close ( ) ; } checkAccess ( this ) ; if ( applyLayout && appender != null ) { final Formatter formatter = getFormatter ( ) ; appender . setLayout ( formatter == null ? null : new FormatterLayout ( formatter ) ) ; } appenderUpdater . set ( this , appender ) ; } | Set the Log4j appender . | 96 | 8 |
145,562 | private ModelNode createOSNode ( ) throws OperationFailedException { String osName = getProperty ( "os.name" ) ; final ModelNode os = new ModelNode ( ) ; if ( osName != null && osName . toLowerCase ( ) . contains ( "linux" ) ) { try { os . set ( GnuLinuxDistribution . discover ( ) ) ; } catch ( IOException ex ) { throw new OperationFailedException ( ex ) ; } } else { os . set ( osName ) ; } return os ; } | Create a ModelNode representing the operating system the instance is running on . | 115 | 14 |
145,563 | private ModelNode createJVMNode ( ) throws OperationFailedException { ModelNode jvm = new ModelNode ( ) . setEmptyObject ( ) ; jvm . get ( NAME ) . set ( getProperty ( "java.vm.name" ) ) ; jvm . get ( JAVA_VERSION ) . set ( getProperty ( "java.vm.specification.version" ) ) ; jvm . get ( JVM_VERSION ) . set ( getProperty ( "java.version" ) ) ; jvm . get ( JVM_VENDOR ) . set ( getProperty ( "java.vm.vendor" ) ) ; jvm . get ( JVM_HOME ) . set ( getProperty ( "java.home" ) ) ; return jvm ; } | Create a ModelNode representing the JVM the instance is running on . | 167 | 14 |
145,564 | private ModelNode createCPUNode ( ) throws OperationFailedException { ModelNode cpu = new ModelNode ( ) . setEmptyObject ( ) ; cpu . get ( ARCH ) . set ( getProperty ( "os.arch" ) ) ; cpu . get ( AVAILABLE_PROCESSORS ) . set ( ProcessorInfo . availableProcessors ( ) ) ; return cpu ; } | Create a ModelNode representing the CPU the instance is running on . | 83 | 13 |
145,565 | private String getProperty ( String name ) { return System . getSecurityManager ( ) == null ? System . getProperty ( name ) : doPrivileged ( new ReadPropertyAction ( name ) ) ; } | Get a System property by its name . | 42 | 8 |
145,566 | public void explore ( ) { if ( isLeaf ) return ; if ( isGeneric ) return ; removeAllChildren ( ) ; try { String addressPath = addressPath ( ) ; ModelNode resourceDesc = executor . doCommand ( addressPath + ":read-resource-description" ) ; resourceDesc = resourceDesc . get ( "result" ) ; ModelNode response = executor . doCommand ( addressPath + ":read-resource(include-runtime=true,include-defaults=true)" ) ; ModelNode result = response . get ( "result" ) ; if ( ! result . isDefined ( ) ) return ; List < String > childrenTypes = getChildrenTypes ( addressPath ) ; for ( ModelNode node : result . asList ( ) ) { Property prop = node . asProperty ( ) ; if ( childrenTypes . contains ( prop . getName ( ) ) ) { // resource node if ( hasGenericOperations ( addressPath , prop . getName ( ) ) ) { add ( new ManagementModelNode ( cliGuiCtx , new UserObject ( node , prop . getName ( ) ) ) ) ; } if ( prop . getValue ( ) . isDefined ( ) ) { for ( ModelNode innerNode : prop . getValue ( ) . asList ( ) ) { UserObject usrObj = new UserObject ( innerNode , prop . getName ( ) , innerNode . asProperty ( ) . getName ( ) ) ; add ( new ManagementModelNode ( cliGuiCtx , usrObj ) ) ; } } } else { // attribute node UserObject usrObj = new UserObject ( node , resourceDesc , prop . getName ( ) , prop . getValue ( ) . asString ( ) ) ; add ( new ManagementModelNode ( cliGuiCtx , usrObj ) ) ; } } } catch ( Exception e ) { e . printStackTrace ( ) ; } } | Refresh children using read - resource operation . | 416 | 9 |
145,567 | public String addressPath ( ) { if ( isLeaf ) { ManagementModelNode parent = ( ManagementModelNode ) getParent ( ) ; return parent . addressPath ( ) ; } StringBuilder builder = new StringBuilder ( ) ; for ( Object pathElement : getUserObjectPath ( ) ) { UserObject userObj = ( UserObject ) pathElement ; if ( userObj . isRoot ( ) ) { // don't want to escape root builder . append ( userObj . getName ( ) ) ; continue ; } builder . append ( userObj . getName ( ) ) ; builder . append ( "=" ) ; builder . append ( userObj . getEscapedValue ( ) ) ; builder . append ( "/" ) ; } return builder . toString ( ) ; } | Get the DMR path for this node . For leaves the DMR path is the path of its parent . | 162 | 22 |
145,568 | private static boolean mayBeIPv6Address ( String input ) { if ( input == null ) { return false ; } boolean result = false ; int colonsCounter = 0 ; int length = input . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = input . charAt ( i ) ; if ( c == ' ' || c == ' ' ) { // IPv4 in IPv6 or Zone ID detected, end of checking. break ; } if ( ! ( ( c >= ' ' && c <= ' ' ) || ( c >= ' ' && c <= ' ' ) || ( c >= ' ' && c <= ' ' ) || c == ' ' ) ) { return false ; } else if ( c == ' ' ) { colonsCounter ++ ; } } if ( colonsCounter >= 2 ) { result = true ; } return result ; } | Heuristic check if string might be an IPv6 address . | 188 | 12 |
145,569 | public static void initializeDomainRegistry ( final TransformerRegistry registry ) { //The chains for transforming will be as follows //For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0 registerRootTransformers ( registry ) ; registerChainedManagementTransformers ( registry ) ; registerChainedServerGroupTransformers ( registry ) ; registerProfileTransformers ( registry ) ; registerSocketBindingGroupTransformers ( registry ) ; registerDeploymentTransformers ( registry ) ; } | Initialize the domain registry . | 131 | 6 |
145,570 | static boolean killProcess ( final String processName , int id ) { int pid ; try { pid = processUtils . resolveProcessId ( processName , id ) ; if ( pid > 0 ) { try { Runtime . getRuntime ( ) . exec ( processUtils . getKillCommand ( pid ) ) ; return true ; } catch ( Throwable t ) { ProcessLogger . ROOT_LOGGER . debugf ( t , "failed to kill process '%s' with pid '%s'" , processName , pid ) ; } } } catch ( Throwable t ) { ProcessLogger . ROOT_LOGGER . debugf ( t , "failed to resolve pid of process '%s'" , processName ) ; } return false ; } | Try to kill a given process . | 159 | 7 |
145,571 | public Launcher addEnvironmentVariable ( final String key , final String value ) { env . put ( key , value ) ; return this ; } | Adds an environment variable to the process being created . | 28 | 10 |
145,572 | private void buildTransformers_3_0 ( ResourceTransformationDescriptionBuilder builder ) { /* ====== Resource root address: ["subsystem" => "remoting"] - Current version: 4.0.0; legacy version: 3.0.0 ======= --- Problems for relative address to root ["configuration" => "endpoint"]: Different 'default' for attribute 'sasl-protocol'. Current: "remote"; legacy: "remoting" ## both are valid also for legacy servers --- Problems for relative address to root ["connector" => "*"]: Missing attributes in current: []; missing in legacy [sasl-authentication-factory, ssl-context] Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory, ssl-context] --- Problems for relative address to root ["http-connector" => "*"]: Missing attributes in current: []; missing in legacy [sasl-authentication-factory] Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory] --- Problems for relative address to root ["remote-outbound-connection" => "*"]: Missing attributes in current: []; missing in legacy [authentication-context] Different 'alternatives' for attribute 'protocol'. Current: ["authentication-context"]; legacy: undefined Different 'alternatives' for attribute 'security-realm'. Current: ["authentication-context"]; legacy: undefined Different 'alternatives' for attribute 'username'. Current: ["authentication-context"]; legacy: undefined Missing parameters for operation 'add' in current: []; missing in legacy [authentication-context] Different 'alternatives' for parameter 'protocol' of operation 'add'. Current: ["authentication-context"]; legacy: undefined Different 'alternatives' for parameter 'security-realm' of operation 'add'. Current: ["authentication-context"]; legacy: undefined Different 'alternatives' for parameter 'username' of operation 'add'. Current: ["authentication-context"]; legacy: undefined */ builder . addChildResource ( ConnectorResource . PATH ) . getAttributeBuilder ( ) . setDiscard ( DiscardAttributeChecker . UNDEFINED , ConnectorCommon . SASL_AUTHENTICATION_FACTORY , ConnectorResource . SSL_CONTEXT ) . addRejectCheck ( RejectAttributeChecker . DEFINED , ConnectorCommon . SASL_AUTHENTICATION_FACTORY , ConnectorResource . SSL_CONTEXT ) ; builder . addChildResource ( RemotingEndpointResource . ENDPOINT_PATH ) . getAttributeBuilder ( ) . setValueConverter ( new AttributeConverter . DefaultAttributeConverter ( ) { @ Override protected void convertAttribute ( PathAddress address , String attributeName , ModelNode attributeValue , TransformationContext context ) { if ( ! attributeValue . isDefined ( ) ) { attributeValue . set ( "remoting" ) ; //if value is not defined, set it to EAP 7.0 default valueRemotingSubsystemTransformersTestCase } } } , RemotingSubsystemRootResource . SASL_PROTOCOL ) ; builder . addChildResource ( HttpConnectorResource . PATH ) . getAttributeBuilder ( ) . setDiscard ( DiscardAttributeChecker . UNDEFINED , ConnectorCommon . SASL_AUTHENTICATION_FACTORY ) . addRejectCheck ( RejectAttributeChecker . DEFINED , ConnectorCommon . SASL_AUTHENTICATION_FACTORY ) ; builder . addChildResource ( RemoteOutboundConnectionResourceDefinition . ADDRESS ) . getAttributeBuilder ( ) . setDiscard ( DiscardAttributeChecker . UNDEFINED , ConnectorCommon . SASL_AUTHENTICATION_FACTORY ) . addRejectCheck ( RejectAttributeChecker . DEFINED , RemoteOutboundConnectionResourceDefinition . AUTHENTICATION_CONTEXT ) ; } | EAP 7 . 0 | 869 | 5 |
145,573 | private void buildTransformers_4_0 ( ResourceTransformationDescriptionBuilder builder ) { // We need to do custom transformation of the attribute in the root resource // related to endpoint configs, as these were moved to the root from a previous child resource EndPointWriteTransformer endPointWriteTransformer = new EndPointWriteTransformer ( ) ; builder . getAttributeBuilder ( ) . setDiscard ( DiscardAttributeChecker . ALWAYS , endpointAttrArray ) . end ( ) . addOperationTransformationOverride ( "add" ) //.inheritResourceAttributeDefinitions() // don't inherit as we discard . setCustomOperationTransformer ( new EndPointAddTransformer ( ) ) . end ( ) . addOperationTransformationOverride ( "write-attribute" ) //.inheritResourceAttributeDefinitions() // don't inherit as we discard . setCustomOperationTransformer ( endPointWriteTransformer ) . end ( ) . addOperationTransformationOverride ( "undefine-attribute" ) //.inheritResourceAttributeDefinitions() // don't inherit as we discard . setCustomOperationTransformer ( endPointWriteTransformer ) . end ( ) ; } | EAP 7 . 1 | 246 | 5 |
145,574 | ServerStatus getState ( ) { final InternalState requiredState = this . requiredState ; final InternalState state = internalState ; if ( requiredState == InternalState . FAILED ) { return ServerStatus . FAILED ; } switch ( state ) { case STOPPED : return ServerStatus . STOPPED ; case SERVER_STARTED : return ServerStatus . STARTED ; default : { if ( requiredState == InternalState . SERVER_STARTED ) { return ServerStatus . STARTING ; } else { return ServerStatus . STOPPING ; } } } } | Determine the current state the server is in . | 122 | 11 |
145,575 | synchronized boolean reload ( int permit , boolean suspend ) { return internalSetState ( new ReloadTask ( permit , suspend ) , InternalState . SERVER_STARTED , InternalState . RELOADING ) ; } | Reload a managed server . | 46 | 6 |
145,576 | synchronized void start ( final ManagedServerBootCmdFactory factory ) { final InternalState required = this . requiredState ; // Ignore if the server is already started if ( required == InternalState . SERVER_STARTED ) { return ; } // In case the server failed to start, try to start it again if ( required != InternalState . FAILED ) { final InternalState current = this . internalState ; if ( current != required ) { // TODO this perhaps should wait? throw new IllegalStateException ( ) ; } } operationID = CurrentOperationIdHolder . getCurrentOperationID ( ) ; bootConfiguration = factory . createConfiguration ( ) ; requiredState = InternalState . SERVER_STARTED ; ROOT_LOGGER . startingServer ( serverName ) ; transition ( ) ; } | Start a managed server . | 170 | 5 |
145,577 | synchronized void stop ( Integer timeout ) { final InternalState required = this . requiredState ; if ( required != InternalState . STOPPED ) { this . requiredState = InternalState . STOPPED ; ROOT_LOGGER . stoppingServer ( serverName ) ; // Only send the stop operation if the server is started if ( internalState == InternalState . SERVER_STARTED ) { internalSetState ( new ServerStopTask ( timeout ) , internalState , InternalState . PROCESS_STOPPING ) ; } else { transition ( false ) ; } } } | Stop a managed server . | 122 | 5 |
145,578 | synchronized void reconnectServerProcess ( final ManagedServerBootCmdFactory factory ) { if ( this . requiredState != InternalState . SERVER_STARTED ) { this . bootConfiguration = factory ; this . requiredState = InternalState . SERVER_STARTED ; ROOT_LOGGER . reconnectingServer ( serverName ) ; internalSetState ( new ReconnectTask ( ) , InternalState . STOPPED , InternalState . SEND_STDIN ) ; } } | Try to reconnect to a started server . | 102 | 8 |
145,579 | synchronized void removeServerProcess ( ) { this . requiredState = InternalState . STOPPED ; internalSetState ( new ProcessRemoveTask ( ) , InternalState . STOPPED , InternalState . PROCESS_REMOVING ) ; } | On host controller reload remove a not running server registered in the process controller declared as down . | 52 | 18 |
145,580 | synchronized void setServerProcessStopping ( ) { this . requiredState = InternalState . STOPPED ; internalSetState ( null , InternalState . STOPPED , InternalState . PROCESS_STOPPING ) ; } | On host controller reload remove a not running server registered in the process controller declared as stopping . | 50 | 18 |
145,581 | boolean awaitState ( final InternalState expected ) { synchronized ( this ) { final InternalState initialRequired = this . requiredState ; for ( ; ; ) { final InternalState required = this . requiredState ; // Stop in case the server failed to reach the state if ( required == InternalState . FAILED ) { return false ; // Stop in case the required state changed } else if ( initialRequired != required ) { return false ; } final InternalState current = this . internalState ; if ( expected == current ) { return true ; } try { wait ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; return false ; } } } } | Await a state . | 145 | 5 |
145,582 | boolean processUnstable ( ) { boolean change = ! unstable ; if ( change ) { // Only once until the process is removed. A process is unstable until removed. unstable = true ; HostControllerLogger . ROOT_LOGGER . managedServerUnstable ( serverName ) ; } return change ; } | Notification that the process has become unstable . | 64 | 9 |
145,583 | boolean callbackUnregistered ( final TransactionalProtocolClient old , final boolean shuttingDown ) { // Disconnect the remote connection. // WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't // be informed that the channel has closed protocolClient . disconnected ( old ) ; synchronized ( this ) { // If the connection dropped without us stopping the process ask for reconnection if ( ! shuttingDown && requiredState == InternalState . SERVER_STARTED ) { final InternalState state = internalState ; if ( state == InternalState . PROCESS_STOPPED || state == InternalState . PROCESS_STOPPING || state == InternalState . STOPPED ) { // In case it stopped we don't reconnect return true ; } // In case we are reloading, it will reconnect automatically if ( state == InternalState . RELOADING ) { return true ; } try { ROOT_LOGGER . logf ( DEBUG_LEVEL , "trying to reconnect to %s current-state (%s) required-state (%s)" , serverName , state , requiredState ) ; internalSetState ( new ReconnectTask ( ) , state , InternalState . SEND_STDIN ) ; } catch ( Exception e ) { ROOT_LOGGER . logf ( DEBUG_LEVEL , e , "failed to send reconnect task" ) ; } return false ; } else { return true ; } } } | Unregister the mgmt channel . | 308 | 7 |
145,584 | synchronized void processFinished ( ) { final InternalState required = this . requiredState ; final InternalState state = this . internalState ; // If the server was not stopped if ( required == InternalState . STOPPED && state == InternalState . PROCESS_STOPPING ) { finishTransition ( InternalState . PROCESS_STOPPING , InternalState . PROCESS_STOPPED ) ; } else { this . requiredState = InternalState . STOPPED ; if ( ! ( internalSetState ( getTransitionTask ( InternalState . PROCESS_STOPPING ) , internalState , InternalState . PROCESS_STOPPING ) && internalSetState ( getTransitionTask ( InternalState . PROCESS_REMOVING ) , internalState , InternalState . PROCESS_REMOVING ) && internalSetState ( getTransitionTask ( InternalState . STOPPED ) , internalState , InternalState . STOPPED ) ) ) { this . requiredState = InternalState . FAILED ; internalSetState ( null , internalState , InternalState . PROCESS_STOPPED ) ; } } } | Notification that the server process finished . | 244 | 8 |
145,585 | synchronized void transitionFailed ( final InternalState state ) { final InternalState current = this . internalState ; if ( state == current ) { // Revert transition and mark as failed switch ( current ) { case PROCESS_ADDING : this . internalState = InternalState . PROCESS_STOPPED ; break ; case PROCESS_STARTED : internalSetState ( getTransitionTask ( InternalState . PROCESS_STOPPING ) , InternalState . PROCESS_STARTED , InternalState . PROCESS_ADDED ) ; break ; case PROCESS_STARTING : this . internalState = InternalState . PROCESS_ADDED ; break ; case SEND_STDIN : case SERVER_STARTING : this . internalState = InternalState . PROCESS_STARTED ; break ; } this . requiredState = InternalState . FAILED ; notifyAll ( ) ; } } | Notification that a state transition failed . | 196 | 8 |
145,586 | private synchronized void finishTransition ( final InternalState current , final InternalState next ) { internalSetState ( getTransitionTask ( next ) , current , next ) ; transition ( ) ; } | Finish a state transition from a notification . | 40 | 8 |
145,587 | @ Override public void registerCapabilities ( ManagementResourceRegistration resourceRegistration ) { if ( capabilities != null ) { for ( RuntimeCapability c : capabilities ) { resourceRegistration . registerCapability ( c ) ; } } if ( incorporatingCapabilities != null ) { resourceRegistration . registerIncorporatingCapabilities ( incorporatingCapabilities ) ; } assert requirements != null ; resourceRegistration . registerRequirements ( requirements ) ; } | Register capabilities associated with this resource . | 86 | 7 |
145,588 | @ Deprecated @ SuppressWarnings ( "deprecation" ) protected void registerAddOperation ( final ManagementResourceRegistration registration , final OperationStepHandler handler , OperationEntry . Flag ... flags ) { if ( handler instanceof DescriptionProvider ) { registration . registerOperationHandler ( getOperationDefinition ( ModelDescriptionConstants . ADD , ( DescriptionProvider ) handler , OperationEntry . EntryType . PUBLIC , flags ) , handler ) ; } else { registration . registerOperationHandler ( getOperationDefinition ( ModelDescriptionConstants . ADD , new DefaultResourceAddDescriptionProvider ( registration , descriptionResolver , orderedChild ) , OperationEntry . EntryType . PUBLIC , flags ) , handler ) ; } } | Registers add operation | 141 | 4 |
145,589 | private static void handlePing ( final Channel channel , final ManagementProtocolHeader header ) throws IOException { final ManagementProtocolHeader response = new ManagementPongHeader ( header . getVersion ( ) ) ; final MessageOutputStream output = channel . writeMessage ( ) ; try { writeHeader ( response , output ) ; output . close ( ) ; } finally { StreamUtils . safeClose ( output ) ; } } | Handle a simple ping request . | 86 | 6 |
145,590 | public static String resolveOrOriginal ( String input ) { try { return resolve ( input , true ) ; } catch ( UnresolvedExpressionException e ) { return input ; } } | Attempts to substitute all the found expressions in the input with their corresponding resolved values . If any of the found expressions failed to resolve or if the input does not contain any expression the input is returned as is . | 38 | 41 |
145,591 | private OperationResponse executeForResult ( final OperationExecutionContext executionContext ) throws IOException { try { return execute ( executionContext ) . get ( ) ; } catch ( Exception e ) { throw new IOException ( e ) ; } } | Execute for result . | 49 | 5 |
145,592 | public static LayersConfig getLayersConfig ( final File repoRoot ) throws IOException { final File layersList = new File ( repoRoot , LAYERS_CONF ) ; if ( ! layersList . exists ( ) ) { return new LayersConfig ( ) ; } final Properties properties = PatchUtils . loadProperties ( layersList ) ; return new LayersConfig ( properties ) ; } | Process the layers . conf file . | 84 | 7 |
145,593 | private boolean parseRemoteDomainControllerAttributes_1_5 ( final XMLExtendedStreamReader reader , final ModelNode address , final List < ModelNode > list , boolean allowDiscoveryOptions ) throws XMLStreamException { final ModelNode update = new ModelNode ( ) ; update . get ( OP_ADDR ) . set ( address ) ; update . get ( OP ) . set ( RemoteDomainControllerAddHandler . OPERATION_NAME ) ; // Handle attributes AdminOnlyDomainConfigPolicy adminOnlyPolicy = AdminOnlyDomainConfigPolicy . DEFAULT ; boolean requireDiscoveryOptions = false ; final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final String value = reader . getAttributeValue ( i ) ; if ( ! isNoNamespaceAttribute ( reader , i ) ) { throw unexpectedAttribute ( reader , i ) ; } else { final Attribute attribute = Attribute . forName ( reader . getAttributeLocalName ( i ) ) ; switch ( attribute ) { case HOST : { DomainControllerWriteAttributeHandler . HOST . parseAndSetParameter ( value , update , reader ) ; break ; } case PORT : { DomainControllerWriteAttributeHandler . PORT . parseAndSetParameter ( value , update , reader ) ; break ; } case SECURITY_REALM : { DomainControllerWriteAttributeHandler . SECURITY_REALM . parseAndSetParameter ( value , update , reader ) ; break ; } case USERNAME : { DomainControllerWriteAttributeHandler . USERNAME . parseAndSetParameter ( value , update , reader ) ; break ; } case ADMIN_ONLY_POLICY : { DomainControllerWriteAttributeHandler . ADMIN_ONLY_POLICY . parseAndSetParameter ( value , update , reader ) ; ModelNode nodeValue = update . get ( DomainControllerWriteAttributeHandler . ADMIN_ONLY_POLICY . getName ( ) ) ; if ( nodeValue . getType ( ) != ModelType . EXPRESSION ) { adminOnlyPolicy = AdminOnlyDomainConfigPolicy . getPolicy ( nodeValue . asString ( ) ) ; } break ; } default : throw unexpectedAttribute ( reader , i ) ; } } } if ( ! update . hasDefined ( DomainControllerWriteAttributeHandler . HOST . getName ( ) ) ) { if ( allowDiscoveryOptions ) { requireDiscoveryOptions = isRequireDiscoveryOptions ( adminOnlyPolicy ) ; } else { throw ParseUtils . missingRequired ( reader , Collections . singleton ( Attribute . HOST . getLocalName ( ) ) ) ; } } if ( ! update . hasDefined ( DomainControllerWriteAttributeHandler . PORT . getName ( ) ) ) { if ( allowDiscoveryOptions ) { requireDiscoveryOptions = requireDiscoveryOptions || isRequireDiscoveryOptions ( adminOnlyPolicy ) ; } else { throw ParseUtils . missingRequired ( reader , Collections . singleton ( Attribute . PORT . getLocalName ( ) ) ) ; } } list . add ( update ) ; return requireDiscoveryOptions ; } | The only difference between version 1 . 5 and 1 . 6 of the schema were to make is possible to define discovery options this resulted in the host and port attributes becoming optional - this method also indicates if discovery options are required where the host and port were not supplied . | 662 | 53 |
145,594 | public static RemoteProxyController create ( final TransactionalProtocolClient client , final PathAddress pathAddress , final ProxyOperationAddressTranslator addressTranslator , final ModelVersion targetKernelVersion ) { return new RemoteProxyController ( client , pathAddress , addressTranslator , targetKernelVersion ) ; } | Create a new remote proxy controller . | 63 | 7 |
145,595 | @ Deprecated public static RemoteProxyController create ( final ManagementChannelHandler channelAssociation , final PathAddress pathAddress , final ProxyOperationAddressTranslator addressTranslator ) { final TransactionalProtocolClient client = TransactionalProtocolHandlers . createClient ( channelAssociation ) ; // the remote proxy return create ( client , pathAddress , addressTranslator , ModelVersion . CURRENT ) ; } | Creates a new remote proxy controller using an existing channel . | 84 | 12 |
145,596 | public ModelNode translateOperationForProxy ( final ModelNode op ) { return translateOperationForProxy ( op , PathAddress . pathAddress ( op . get ( OP_ADDR ) ) ) ; } | Translate the operation address . | 41 | 6 |
145,597 | private void flush ( final boolean propagate ) throws IOException { final int avail = baseNCodec . available ( context ) ; if ( avail > 0 ) { final byte [ ] buf = new byte [ avail ] ; final int c = baseNCodec . readResults ( buf , 0 , avail , context ) ; if ( c > 0 ) { out . write ( buf , 0 , c ) ; } } if ( propagate ) { out . flush ( ) ; } } | Flushes this output stream and forces any buffered output bytes to be written out to the stream . If propagate is true the wrapped stream will also be flushed . | 99 | 32 |
145,598 | @ Override public void close ( ) throws IOException { // Notify encoder of EOF (-1). if ( doEncode ) { baseNCodec . encode ( singleByte , 0 , EOF , context ) ; } else { baseNCodec . decode ( singleByte , 0 , EOF , context ) ; } flush ( ) ; out . close ( ) ; } | Closes this output stream and releases any system resources associated with the stream . | 81 | 15 |
145,599 | private ModelNode resolveExpressionsRecursively ( final ModelNode node ) throws OperationFailedException { if ( ! node . isDefined ( ) ) { return node ; } ModelType type = node . getType ( ) ; ModelNode resolved ; if ( type == ModelType . EXPRESSION ) { resolved = resolveExpressionStringRecursively ( node . asExpression ( ) . getExpressionString ( ) , lenient , true ) ; } else if ( type == ModelType . OBJECT ) { resolved = node . clone ( ) ; for ( Property prop : resolved . asPropertyList ( ) ) { resolved . get ( prop . getName ( ) ) . set ( resolveExpressionsRecursively ( prop . getValue ( ) ) ) ; } } else if ( type == ModelType . LIST ) { resolved = node . clone ( ) ; ModelNode list = new ModelNode ( ) ; list . setEmptyList ( ) ; for ( ModelNode current : resolved . asList ( ) ) { list . add ( resolveExpressionsRecursively ( current ) ) ; } resolved = list ; } else if ( type == ModelType . PROPERTY ) { resolved = node . clone ( ) ; resolved . set ( resolved . asProperty ( ) . getName ( ) , resolveExpressionsRecursively ( resolved . asProperty ( ) . getValue ( ) ) ) ; } else { resolved = node ; } return resolved ; } | Examine the given model node resolving any expressions found within including within child nodes . | 304 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.