idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
21,900
public static boolean isMethodNode ( ASTNode node , String methodNamePattern , Integer numArguments , Class returnType ) { if ( ! ( node instanceof MethodNode ) ) { return false ; } if ( ! ( ( ( MethodNode ) node ) . getName ( ) . matches ( methodNamePattern ) ) ) { return false ; } if ( numArguments != null && ( ( Met...
Tells you if the ASTNode is a method node for the given name arity and return type .
21,901
public static boolean isVariable ( ASTNode expression , String pattern ) { return ( expression instanceof VariableExpression && ( ( VariableExpression ) expression ) . getName ( ) . matches ( pattern ) ) ; }
Tells you if the given ASTNode is a VariableExpression with the given name .
21,902
private static Class getClassForClassNode ( ClassNode type ) { Class primitiveType = getPrimitiveType ( type ) ; if ( primitiveType != null ) { return primitiveType ; } else if ( classNodeImplementsType ( type , String . class ) ) { return String . class ; } else if ( classNodeImplementsType ( type , ReentrantLock . cl...
This is private . It is a helper function for the utils .
21,903
public static int findFirstNonAnnotationLine ( ASTNode node , SourceCode sourceCode ) { if ( node instanceof AnnotatedNode && ! ( ( AnnotatedNode ) node ) . getAnnotations ( ) . isEmpty ( ) ) { AnnotationNode lastAnnotation = null ; for ( AnnotationNode annotation : ( ( AnnotatedNode ) node ) . getAnnotations ( ) ) { i...
gets the first non annotation line number of a node taking into account annotations .
21,904
protected boolean isFirstVisit ( Object expression ) { if ( visited . contains ( expression ) ) { return false ; } visited . add ( expression ) ; return true ; }
Return true if the AST expression has not already been visited . If it is the first visit register the expression so that the next visit will return false .
21,905
protected String sourceLineTrimmed ( ASTNode node ) { return sourceCode . line ( AstUtil . findFirstNonAnnotationLine ( node , sourceCode ) - 1 ) ; }
Return the trimmed source line corresponding to the specified AST node
21,906
protected String sourceLine ( ASTNode node ) { return sourceCode . getLines ( ) . get ( AstUtil . findFirstNonAnnotationLine ( node , sourceCode ) - 1 ) ; }
Return the raw source line corresponding to the specified AST node
21,907
public static < T > T buildJsonResponse ( Response response , Class < T > clazz ) throws IOException , SlackApiException { if ( response . code ( ) == 200 ) { String body = response . body ( ) . string ( ) ; DETAILED_LOGGER . accept ( new HttpResponseListener . State ( SlackConfig . DEFAULT , response , body ) ) ; retu...
use parseJsonResponse instead
21,908
public WebhookResponse send ( String url , Payload payload ) throws IOException { SlackHttpClient httpClient = getHttpClient ( ) ; Response httpResponse = httpClient . postJsonPostRequest ( url , payload ) ; String body = httpResponse . body ( ) . string ( ) ; httpClient . runHttpResponseListeners ( httpResponse , body...
Send a data to Incoming Webhook endpoint .
21,909
private void updateSession ( Session newSession ) { if ( this . currentSession == null ) { this . currentSession = newSession ; } else { synchronized ( this . currentSession ) { this . currentSession = newSession ; } } }
Overwrites the underlying WebSocket session .
21,910
public Class < E > getEventClass ( ) { if ( cachedClazz != null ) { return cachedClazz ; } Class < ? > clazz = this . getClass ( ) ; while ( clazz != Object . class ) { try { Type mySuperclass = clazz . getGenericSuperclass ( ) ; Type tType = ( ( ParameterizedType ) mySuperclass ) . getActualTypeArguments ( ) [ 0 ] ; c...
Returns the Class object of the Event implementation .
21,911
protected final String computeId ( final ITemplateContext context , final IProcessableElementTag tag , final String name , final boolean sequence ) { String id = tag . getAttributeValue ( this . idAttributeDefinition . getAttributeName ( ) ) ; if ( ! org . thymeleaf . util . StringUtils . isEmptyOrWhitespace ( id ) ) {...
This method is designed to be called from the diverse subclasses
21,912
public String code ( final String code ) { if ( this . theme == null ) { throw new TemplateProcessingException ( "Theme cannot be resolved because RequestContext was not found. " + "Are you using a Context object without a RequestContext variable?" ) ; } return this . theme . getMessageSource ( ) . getMessage ( code , ...
Looks up and returns the value of the given key in the properties file of the currently - selected theme .
21,913
private static DirectoryGrouping resolveDirectoryGrouping ( final ModelNode model , final ExpressionResolver expressionResolver ) { try { return DirectoryGrouping . forName ( HostResourceDefinition . DIRECTORY_GROUPING . resolveModelAttribute ( expressionResolver , model ) . asString ( ) ) ; } catch ( OperationFailedEx...
Returns the value of found in the model .
21,914
private String addPathProperty ( final List < String > command , final String typeName , final String propertyName , final Map < String , String > properties , final DirectoryGrouping directoryGrouping , final File typeDir , File serverDir ) { final String result ; final String value = properties . get ( propertyName )...
Adds the absolute path to command .
21,915
private String findLoggingProfile ( final ResourceRoot resourceRoot ) { final Manifest manifest = resourceRoot . getAttachment ( Attachments . MANIFEST ) ; if ( manifest != null ) { final String loggingProfile = manifest . getMainAttributes ( ) . getValue ( LOGGING_PROFILE ) ; if ( loggingProfile != null ) { LoggingLog...
Find the logging profile attached to any resource .
21,916
public static int getBytesToken ( ParsingContext ctx ) { String input = ctx . getInput ( ) . substring ( ctx . getLocation ( ) ) ; int tokenOffset = 0 ; int i = 0 ; char [ ] inputChars = input . toCharArray ( ) ; for ( ; i < input . length ( ) ; i += 1 ) { char c = inputChars [ i ] ; if ( c == ' ' ) { continue ; } if (...
handle white spaces .
21,917
public static void addOperation ( final OperationContext context ) { RbacSanityCheckOperation added = context . getAttachment ( KEY ) ; if ( added == null ) { if ( ! context . isNormalServer ( ) ) return ; context . addStep ( createOperation ( ) , INSTANCE , Stage . MODEL ) ; context . attach ( KEY , INSTANCE ) ; } }
Add the operation at the end of Stage MODEL if this operation has not already been registered .
21,918
public static ModelNode getFailureDescription ( final ModelNode result ) { if ( isSuccessfulOutcome ( result ) ) { throw ControllerClientLogger . ROOT_LOGGER . noFailureDescription ( ) ; } if ( result . hasDefined ( FAILURE_DESCRIPTION ) ) { return result . get ( FAILURE_DESCRIPTION ) ; } return new ModelNode ( ) ; }
Parses the result and returns the failure description .
21,919
public static ModelNode getOperationAddress ( final ModelNode op ) { return op . hasDefined ( OP_ADDR ) ? op . get ( OP_ADDR ) : new ModelNode ( ) ; }
Returns the address for the operation .
21,920
public static String getOperationName ( final ModelNode op ) { if ( op . hasDefined ( OP ) ) { return op . get ( OP ) . asString ( ) ; } throw ControllerClientLogger . ROOT_LOGGER . operationNameNotFound ( ) ; }
Returns the name of the operation .
21,921
public static ModelNode createReadResourceOperation ( final ModelNode address , final boolean recursive ) { final ModelNode op = createOperation ( READ_RESOURCE_OPERATION , address ) ; op . get ( RECURSIVE ) . set ( recursive ) ; return op ; }
Creates an operation to read a resource .
21,922
public ModelNode buildRequest ( ) throws OperationFormatException { ModelNode address = request . get ( Util . ADDRESS ) ; if ( prefix . isEmpty ( ) ) { address . setEmptyList ( ) ; } else { Iterator < Node > iterator = prefix . iterator ( ) ; while ( iterator . hasNext ( ) ) { OperationRequestAddress . Node node = ite...
Makes sure that the operation name and the address have been set and returns a ModelNode representing the operation request .
21,923
private void parseUsersAuthentication ( final XMLExtendedStreamReader reader , final ModelNode realmAddress , final List < ModelNode > list ) throws XMLStreamException { final ModelNode usersAddress = realmAddress . clone ( ) . add ( AUTHENTICATION , USERS ) ; list . add ( Util . getEmptyOperation ( ADD , usersAddress ...
The users element defines users within the domain model it is a simple authentication for some out of the box users .
21,924
public Set < Action . ActionEffect > getActionEffects ( ) { switch ( getImpact ( ) ) { case CLASSLOADING : case WRITE : return WRITES ; case READ_ONLY : return READS ; default : throw new IllegalStateException ( ) ; } }
Gets the effects of this action .
21,925
private ModelNode addLocalHost ( final ModelNode address , final List < ModelNode > operationList , final String hostName ) { String resolvedHost = hostName != null ? hostName : defaultHostControllerName ; address . add ( HOST , resolvedHost ) ; final ModelNode hostAddOp = new ModelNode ( ) ; hostAddOp . get ( OP ) . s...
Add the operation to add the local host definition .
21,926
public static byte [ ] hashPath ( MessageDigest messageDigest , Path path ) throws IOException { try ( InputStream in = getRecursiveContentStream ( path ) ) { return hashContent ( messageDigest , in ) ; } }
Hashes a path if the path points to a directory then hashes the contents recursively .
21,927
public synchronized ModelNode doCommand ( String command ) throws CommandFormatException , IOException { ModelNode request = cmdCtx . buildRequest ( command ) ; return execute ( request , isSlowCommand ( command ) ) . getResponseNode ( ) ; }
Submit a command to the server .
21,928
public synchronized Response doCommandFullResponse ( String command ) throws CommandFormatException , IOException { ModelNode request = cmdCtx . buildRequest ( command ) ; boolean replacedBytes = replaceFilePathsWithBytes ( request ) ; OperationResponse response = execute ( request , isSlowCommand ( command ) || replac...
User - initiated commands use this method .
21,929
private File [ ] getFilesFromProperty ( final String name , final Properties props ) { String sep = WildFlySecurityManager . getPropertyPrivileged ( "path.separator" , null ) ; String value = props . getProperty ( name , null ) ; if ( value != null ) { final String [ ] paths = value . split ( Pattern . quote ( sep ) ) ...
Get a File path list from configuration .
21,930
public boolean putAtomic ( C instance , K key , V value , Map < K , V > snapshot ) { Assert . checkNotNullParam ( "key" , key ) ; final Map < K , V > newMap ; final int oldSize = snapshot . size ( ) ; if ( oldSize == 0 ) { newMap = Collections . singletonMap ( key , value ) ; } else if ( oldSize == 1 ) { final Map . En...
Put a value if and only if the map has not changed since the given snapshot was taken . If the put fails it is the caller s responsibility to retry .
21,931
public void parseAndSetParameter ( String value , ModelNode operation , XMLStreamReader reader ) throws XMLStreamException { if ( value != null ) { for ( String element : value . split ( "," ) ) { parseAndAddParameterElement ( element . trim ( ) , operation , reader ) ; } } }
Parses whole value as list attribute
21,932
boolean lock ( final Integer permit , final long timeout , final TimeUnit unit ) { boolean result = false ; try { result = lockInterruptibly ( permit , timeout , unit ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } return result ; }
Attempts exclusive acquisition with a max wait time .
21,933
boolean lockShared ( final Integer permit , final long timeout , final TimeUnit unit ) { boolean result = false ; try { result = lockSharedInterruptibly ( permit , timeout , unit ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } return result ; }
Attempts shared acquisition with a max wait time .
21,934
void lockInterruptibly ( final Integer permit ) throws InterruptedException { if ( permit == null ) { throw new IllegalArgumentException ( ) ; } sync . acquireInterruptibly ( permit ) ; }
Acquire the exclusive lock allowing the acquisition to be interrupted .
21,935
void lockSharedInterruptibly ( final Integer permit ) throws InterruptedException { if ( permit == null ) { throw new IllegalArgumentException ( ) ; } sync . acquireSharedInterruptibly ( permit ) ; }
Acquire the shared lock allowing the acquisition to be interrupted .
21,936
boolean lockInterruptibly ( final Integer permit , final long timeout , final TimeUnit unit ) throws InterruptedException { if ( permit == null ) { throw new IllegalArgumentException ( ) ; } return sync . tryAcquireNanos ( permit , unit . toNanos ( timeout ) ) ; }
Acquire the exclusive lock with a max wait timeout to acquire .
21,937
boolean lockSharedInterruptibly ( final Integer permit , final long timeout , final TimeUnit unit ) throws InterruptedException { if ( permit == null ) { throw new IllegalArgumentException ( ) ; } return sync . tryAcquireSharedNanos ( permit , unit . toNanos ( timeout ) ) ; }
Acquire the shared lock with a max wait timeout to acquire .
21,938
CapabilityRegistry createShadowCopy ( ) { CapabilityRegistry result = new CapabilityRegistry ( forServer , this ) ; readLock . lock ( ) ; try { try { result . writeLock . lock ( ) ; copy ( this , result ) ; } finally { result . writeLock . unlock ( ) ; } } finally { readLock . unlock ( ) ; } return result ; }
Creates updateable version of capability registry that on publish pushes all changes to main registry this is used to create context local registry that only on completion commits changes to main registry
21,939
private void registerRequirement ( RuntimeRequirementRegistration requirement ) { assert writeLock . isHeldByCurrentThread ( ) ; CapabilityId dependentId = requirement . getDependentId ( ) ; if ( ! capabilities . containsKey ( dependentId ) ) { throw ControllerLogger . MGMT_OP_LOGGER . unknownCapabilityInContext ( depe...
This must be called with the write lock held .
21,940
public void removeCapabilityRequirement ( RuntimeRequirementRegistration requirementRegistration ) { writeLock . lock ( ) ; try { removeRequirement ( requirementRegistration , false ) ; removeRequirement ( requirementRegistration , true ) ; } finally { writeLock . unlock ( ) ; } }
Remove a previously registered requirement for a capability .
21,941
void publish ( ) { assert publishedFullRegistry != null : "Cannot write directly to main registry" ; writeLock . lock ( ) ; try { if ( ! modified ) { return ; } publishedFullRegistry . writeLock . lock ( ) ; try { publishedFullRegistry . clear ( true ) ; copy ( this , publishedFullRegistry ) ; pendingRemoveCapabilities...
Publish the changes to main registry
21,942
void rollback ( ) { if ( publishedFullRegistry == null ) { return ; } writeLock . lock ( ) ; try { publishedFullRegistry . readLock . lock ( ) ; try { clear ( true ) ; copy ( publishedFullRegistry , this ) ; modified = false ; } finally { publishedFullRegistry . readLock . unlock ( ) ; } } finally { writeLock . unlock ...
Discard the changes .
21,943
static void addOperationAddress ( final ModelNode operation , final PathAddress base , final String key , final String value ) { operation . get ( OP_ADDR ) . set ( base . append ( key , value ) . toModelNode ( ) ) ; }
Appends the key and value to the address and sets the address on the operation .
21,944
static String findNonProgressingOp ( Resource resource , boolean forServer , long timeout ) throws OperationFailedException { Resource . ResourceEntry nonProgressing = null ; for ( Resource . ResourceEntry child : resource . getChildren ( ACTIVE_OPERATION ) ) { ModelNode model = child . getModel ( ) ; if ( model . get ...
Separate from other findNonProgressingOp variant to allow unit testing without needing a mock OperationContext
21,945
void bootTimeScan ( final DeploymentOperations deploymentOperations ) { if ( ! checkDeploymentDir ( this . deploymentDir ) ) { DeploymentScannerLogger . ROOT_LOGGER . bootTimeScanFailed ( deploymentDir . getAbsolutePath ( ) ) ; return ; } this . establishDeployedContentList ( this . deploymentDir , deploymentOperations...
Perform a one - off scan during boot to establish deployment tasks to execute during boot
21,946
void scan ( ) { if ( acquireScanLock ( ) ) { boolean scheduleRescan = false ; try { scheduleRescan = scan ( false , deploymentOperations ) ; } finally { try { if ( scheduleRescan ) { synchronized ( this ) { if ( scanEnabled ) { rescanIncompleteTask = scheduledExecutor . schedule ( scanRunnable , 200 , TimeUnit . MILLIS...
Perform a normal scan
21,947
void forcedUndeployScan ( ) { if ( acquireScanLock ( ) ) { try { ROOT_LOGGER . tracef ( "Performing a post-boot forced undeploy scan for scan directory %s" , deploymentDir . getAbsolutePath ( ) ) ; ScanContext scanContext = new ScanContext ( deploymentOperations ) ; for ( Map . Entry < String , DeploymentMarker > missi...
Perform a post - boot scan to remove any deployments added during boot that failed to deploy properly . This method isn t private solely to allow a unit test in the same package to call it .
21,948
private boolean checkDeploymentDir ( File directory ) { if ( ! directory . exists ( ) ) { if ( deploymentDirAccessible ) { deploymentDirAccessible = false ; ROOT_LOGGER . directoryIsNonexistent ( deploymentDir . getAbsolutePath ( ) ) ; } } else if ( ! directory . isDirectory ( ) ) { if ( deploymentDirAccessible ) { dep...
Checks that given directory if readable & writable and prints a warning if the check fails . Warning is only printed once and is not repeated until the condition is fixed and broken again .
21,949
private static ModelNode createOperation ( final ModelNode operationToValidate ) { PathAddress pa = PathAddress . pathAddress ( operationToValidate . require ( OP_ADDR ) ) ; PathAddress validationAddress = pa . subAddress ( 0 , pa . size ( ) - 1 ) ; return Util . getEmptyOperation ( "validate-cache" , validationAddress...
Creates an operations that targets the valiadating handler .
21,950
public synchronized RegistrationPoint getOldestRegistrationPoint ( ) { return registrationPoints . size ( ) == 0 ? null : registrationPoints . values ( ) . iterator ( ) . next ( ) . get ( 0 ) ; }
Gets the registration point that been associated with the registration for the longest period .
21,951
public synchronized Set < RegistrationPoint > getRegistrationPoints ( ) { Set < RegistrationPoint > result = new HashSet < > ( ) ; for ( List < RegistrationPoint > registrationPoints : registrationPoints . values ( ) ) { result . addAll ( registrationPoints ) ; } return Collections . unmodifiableSet ( result ) ; }
Get all registration points associated with this registration .
21,952
public static boolean hasValidContentAdditionParameterDefined ( ModelNode operation ) { for ( String s : DeploymentAttributes . MANAGED_CONTENT_ATTRIBUTES . keySet ( ) ) { if ( operation . hasDefined ( s ) ) { return true ; } } return false ; }
Checks to see if a valid deployment parameter has been defined .
21,953
static InstalledIdentity load ( final InstalledImage image , final ProductConfig productConfig , final List < File > moduleRoots , final List < File > bundleRoots ) throws IOException { final String productVersion = productConfig . resolveVersion ( ) ; final String productName = productConfig . resolveName ( ) ; final ...
Load the available layers .
21,954
static ProcessedLayers process ( final InstalledConfiguration conf , final List < File > moduleRoots , final List < File > bundleRoots ) throws IOException { final ProcessedLayers layers = new ProcessedLayers ( conf ) ; final LayerPathSetter moduleSetter = new LayerPathSetter ( ) { public boolean setPath ( final LayerP...
Process the module and bundle roots and cross check with the installed information .
21,955
static void processRoot ( final File root , final ProcessedLayers layers , final LayerPathSetter setter ) throws IOException { final LayersConfig layersConfig = LayersConfig . getLayersConfig ( root ) ; final File layersDir = new File ( root , layersConfig . getLayersPath ( ) ) ; if ( ! layersDir . exists ( ) ) { if ( ...
Process a module or bundle root .
21,956
static AbstractLazyPatchableTarget createPatchableTarget ( final String name , final LayerPathConfig layer , final File metadata , final InstalledImage image ) throws IOException { return new AbstractLazyPatchableTarget ( ) { public InstalledImage getInstalledImage ( ) { return image ; } public File getModuleRoot ( ) {...
Create the actual patchable target .
21,957
public List < ModelNode > getAllowedValues ( ) { if ( allowedValues == null ) { return Collections . emptyList ( ) ; } return Arrays . asList ( this . allowedValues ) ; }
returns array with all allowed values
21,958
protected void addAllowedValuesToDescription ( ModelNode result , ParameterValidator validator ) { if ( allowedValues != null ) { for ( ModelNode allowedValue : allowedValues ) { result . get ( ModelDescriptionConstants . ALLOWED ) . add ( allowedValue ) ; } } else if ( validator instanceof AllowedValuesValidator ) { A...
Adds the allowed values . Override for attributes who should not use the allowed values .
21,959
public static ModelNode validateRequest ( CommandContext ctx , ModelNode request ) throws CommandFormatException { final Set < String > keys = request . keys ( ) ; if ( keys . size ( ) == 2 ) { return null ; } ModelNode outcome = ( ModelNode ) ctx . get ( Scope . REQUEST , DESCRIPTION_RESPONSE ) ; if ( outcome == null ...
return null if the operation has no params to validate
21,960
public static boolean reconnectContext ( RedirectException re , CommandContext ctx ) { boolean reconnected = false ; try { ConnectionInfo info = ctx . getConnectionInfo ( ) ; ControllerAddress address = null ; if ( info != null ) { address = info . getControllerAddress ( ) ; } if ( address != null && isHttpsRedirect ( ...
Reconnect the context if the RedirectException is valid .
21,961
public static String compactToString ( ModelNode node ) { Objects . requireNonNull ( node ) ; final StringWriter stringWriter = new StringWriter ( ) ; final PrintWriter writer = new PrintWriter ( stringWriter , true ) ; node . writeString ( writer , true ) ; return stringWriter . toString ( ) ; }
Build a compact representation of the ModelNode .
21,962
private void init ( ) { validatePreSignedUrls ( ) ; try { conn = new AWSAuthConnection ( access_key , secret_access_key ) ; if ( prefix != null && prefix . length ( ) > 0 ) { ListAllMyBucketsResponse bucket_list = conn . listAllMyBuckets ( null ) ; List buckets = bucket_list . entries ; if ( buckets != null ) { boolean...
Do the set - up that s needed to access Amazon S3 .
21,963
private List < DomainControllerData > readFromFile ( String directoryName ) { List < DomainControllerData > data = new ArrayList < DomainControllerData > ( ) ; if ( directoryName == null ) { return data ; } if ( conn == null ) { init ( ) ; } try { if ( usingPreSignedUrls ( ) ) { PreSignedUrlParser parsedPut = new PreSi...
Read the domain controller data from an S3 file .
21,964
private void writeToFile ( List < DomainControllerData > data , String domainName ) throws IOException { if ( domainName == null || data == null ) { return ; } if ( conn == null ) { init ( ) ; } try { String key = S3Util . sanitize ( domainName ) + "/" + S3Util . sanitize ( DC_FILE_NAME ) ; byte [ ] buf = S3Util . doma...
Write the domain controller data to an S3 file .
21,965
private void remove ( String directoryName ) { if ( ( directoryName == null ) || ( conn == null ) ) return ; String key = S3Util . sanitize ( directoryName ) + "/" + S3Util . sanitize ( DC_FILE_NAME ) ; try { Map headers = new TreeMap ( ) ; headers . put ( "Content-Type" , Arrays . asList ( "text/plain" ) ) ; if ( usin...
Remove the S3 file that contains the domain controller data .
21,966
public void mergeSubtree ( final OperationTransformerRegistry targetRegistry , final Map < PathAddress , ModelVersion > subTree ) { for ( Map . Entry < PathAddress , ModelVersion > entry : subTree . entrySet ( ) ) { mergeSubtree ( targetRegistry , entry . getKey ( ) , entry . getValue ( ) ) ; } }
Merge a subtree .
21,967
private static boolean isDisabledHandler ( final LogContext logContext , final String handlerName ) { final Map < String , String > disableHandlers = logContext . getAttachment ( CommonAttributes . ROOT_LOGGER_NAME , DISABLED_HANDLERS_KEY ) ; return disableHandlers != null && disableHandlers . containsKey ( handlerName...
Checks to see if a handler is disabled
21,968
static PathAddress toPathAddress ( String domain , ImmutableManagementResourceRegistration registry , ObjectName name ) { if ( ! name . getDomain ( ) . equals ( domain ) ) { return PathAddress . EMPTY_ADDRESS ; } if ( name . equals ( ModelControllerMBeanHelper . createRootObjectName ( domain ) ) ) { return PathAddress ...
Straight conversion from an ObjectName to a PathAddress .
21,969
private void stopDone ( ) { synchronized ( stopLock ) { final StopContext stopContext = this . stopContext ; this . stopContext = null ; if ( stopContext != null ) { stopContext . complete ( ) ; } stopLock . notifyAll ( ) ; } }
Callback from the worker when it terminates
21,970
public String getRejectionLogMessageId ( ) { String id = logMessageId ; if ( id == null ) { id = getRejectionLogMessage ( Collections . < String , ModelNode > emptyMap ( ) ) ; } logMessageId = id ; return logMessageId ; }
Returns the log message id used by this checker . This is used to group it so that all attributes failing a type of rejction end up in the same error message . This default implementation uses the formatted log message with an empty attribute map as the id .
21,971
public synchronized void stop ( final StopContext context ) { final boolean shutdownServers = runningModeControl . getRestartMode ( ) == RestartMode . SERVERS ; if ( shutdownServers ) { Runnable task = new Runnable ( ) { public void run ( ) { try { serverInventory . shutdown ( true , - 1 , true ) ; serverInventory = nu...
Stops all servers .
21,972
public boolean isResourceExcluded ( final PathAddress address ) { if ( ! localHostControllerInfo . isMasterDomainController ( ) && address . size ( ) > 0 ) { IgnoredDomainResourceRoot root = this . rootResource ; PathElement firstElement = address . getElement ( 0 ) ; IgnoreDomainResourceTypeResource typeResource = roo...
Returns whether this host should ignore operations from the master domain controller that target the given address .
21,973
VersionExcludeData getVersionIgnoreData ( int major , int minor , int micro ) { VersionExcludeData result = registry . get ( new VersionKey ( major , minor , micro ) ) ; if ( result == null ) { result = registry . get ( new VersionKey ( major , minor , null ) ) ; } return result ; }
Gets the host - ignore data for a slave host running the given version .
21,974
public static void copyRecursively ( final Path source , final Path target , boolean overwrite ) throws IOException { final CopyOption [ ] options ; if ( overwrite ) { options = new CopyOption [ ] { StandardCopyOption . COPY_ATTRIBUTES , StandardCopyOption . REPLACE_EXISTING } ; } else { options = new CopyOption [ ] { ...
Copy a path recursively .
21,975
public static void deleteSilentlyRecursively ( final Path path ) { if ( path != null ) { try { deleteRecursively ( path ) ; } catch ( IOException ioex ) { DeploymentRepositoryLogger . ROOT_LOGGER . cannotDeleteFile ( ioex , path ) ; } } }
Delete a path recursively not throwing Exception if it fails or if the path is null .
21,976
public static void deleteRecursively ( final Path path ) throws IOException { DeploymentRepositoryLogger . ROOT_LOGGER . debugf ( "Deleting %s recursively" , path ) ; if ( Files . exists ( path ) ) { Files . walkFileTree ( path , new FileVisitor < Path > ( ) { public FileVisitResult preVisitDirectory ( Path dir , Basic...
Delete a path recursively .
21,977
public static final Path resolveSecurely ( Path rootPath , String path ) { Path resolvedPath ; if ( path == null || path . isEmpty ( ) ) { resolvedPath = rootPath . normalize ( ) ; } else { String relativePath = removeSuperflousSlashes ( path ) ; resolvedPath = rootPath . resolve ( relativePath ) . normalize ( ) ; } if...
Resolve a path from the rootPath checking that it doesn t go out of the rootPath .
21,978
public static List < ContentRepositoryElement > listFiles ( final Path rootPath , Path tempDir , final ContentFilter filter ) throws IOException { List < ContentRepositoryElement > result = new ArrayList < > ( ) ; if ( Files . exists ( rootPath ) ) { if ( isArchive ( rootPath ) ) { return listZipContent ( rootPath , fi...
List files in a path according to the specified filter .
21,979
public static Path createTempDirectory ( Path dir , String prefix ) throws IOException { try { return Files . createTempDirectory ( dir , prefix ) ; } catch ( UnsupportedOperationException ex ) { } return Files . createTempDirectory ( dir , prefix ) ; }
Create a temporary directory with the same attributes as its parent directory .
21,980
public static void unzip ( Path zip , Path target ) throws IOException { try ( final ZipFile zipFile = new ZipFile ( zip . toFile ( ) ) ) { unzip ( zipFile , target ) ; } }
Unzip a file to a target directory .
21,981
public static ServiceController < String > addService ( final ServiceName name , final String path , boolean possiblyAbsolute , final String relativeTo , final ServiceTarget serviceTarget ) { if ( possiblyAbsolute && isAbsoluteUnixOrWindowsPath ( path ) ) { return AbsolutePathService . addService ( name , path , servic...
Installs a path service .
21,982
public List < File > getInactiveHistory ( ) throws PatchingException { if ( validHistory == null ) { walk ( ) ; } final File [ ] inactiveDirs = installedIdentity . getInstalledImage ( ) . getPatchesDir ( ) . listFiles ( new FileFilter ( ) { public boolean accept ( File pathname ) { return pathname . isDirectory ( ) && ...
Get the inactive history directories .
21,983
public List < File > getInactiveOverlays ( ) throws PatchingException { if ( referencedOverlayDirectories == null ) { walk ( ) ; } List < File > inactiveDirs = null ; for ( Layer layer : installedIdentity . getLayers ( ) ) { final File overlaysDir = new File ( layer . getDirectoryStructure ( ) . getModuleRoot ( ) , Con...
Get the inactive overlay directories .
21,984
public void deleteInactiveContent ( ) throws PatchingException { List < File > dirs = getInactiveHistory ( ) ; if ( ! dirs . isEmpty ( ) ) { for ( File dir : dirs ) { deleteDir ( dir , ALL ) ; } } dirs = getInactiveOverlays ( ) ; if ( ! dirs . isEmpty ( ) ) { for ( File dir : dirs ) { deleteDir ( dir , ALL ) ; } } }
Delete inactive contents .
21,985
public void bootstrap ( ) throws Exception { final HostRunningModeControl runningModeControl = environment . getRunningModeControl ( ) ; final ControlledProcessState processState = new ControlledProcessState ( true ) ; shutdownHook . setControlledProcessState ( processState ) ; ServiceTarget target = serviceContainer ....
Start the host controller services .
21,986
private void persistDecorator ( XMLExtendedStreamWriter writer , ModelNode model ) throws XMLStreamException { if ( shouldWriteDecoratorAndElements ( model ) ) { writer . writeStartElement ( decoratorElement ) ; persistChildren ( writer , model ) ; writer . writeEndElement ( ) ; } }
persist decorator and than continue to children without touching the model
21,987
public static PersistentResourceXMLBuilder decorator ( final String elementName ) { return new PersistentResourceXMLBuilder ( PathElement . pathElement ( elementName ) , null ) . setDecoratorGroup ( elementName ) ; }
Creates builder for passed path element
21,988
void rejectAttributes ( RejectedAttributesLogContext rejectedAttributes , ModelNode attributeValue ) { for ( RejectAttributeChecker checker : checks ) { rejectedAttributes . checkAttribute ( checker , name , attributeValue ) ; } }
Checks attributes for rejection
21,989
private OperationEntry getInheritableOperationEntryLocked ( final String operationName ) { final OperationEntry entry = operations == null ? null : operations . get ( operationName ) ; if ( entry != null && entry . isInherited ( ) ) { return entry ; } return null ; }
Only call with the read lock held
21,990
private void registerChildInternal ( IgnoreDomainResourceTypeResource child ) { child . setParent ( this ) ; children . put ( child . getName ( ) , child ) ; }
call with lock on children held
21,991
protected Channel awaitChannel ( ) throws IOException { Channel channel = this . channel ; if ( channel != null ) { return channel ; } synchronized ( lock ) { for ( ; ; ) { if ( state == State . CLOSED ) { throw ProtocolLogger . ROOT_LOGGER . channelClosed ( ) ; } channel = this . channel ; if ( channel != null ) { ret...
Get the underlying channel . This may block until the channel is set .
21,992
protected boolean prepareClose ( ) { synchronized ( lock ) { final State state = this . state ; if ( state == State . OPEN ) { this . state = State . CLOSING ; lock . notifyAll ( ) ; return true ; } } return false ; }
Signal that we are about to close the channel . This will not have any affect on the underlying channel however prevent setting a new channel .
21,993
protected boolean setChannel ( final Channel newChannel ) { if ( newChannel == null ) { return false ; } synchronized ( lock ) { if ( state != State . OPEN || channel != null ) { return false ; } this . channel = newChannel ; this . channel . addCloseHandler ( new CloseHandler < Channel > ( ) { public void handleClose ...
Set the channel . This will return whether the channel could be set successfully or not .
21,994
private boolean isRedeployAfterRemoval ( ModelNode operation ) { return operation . hasDefined ( DEPLOYMENT_OVERLAY_LINK_REMOVAL ) && operation . get ( DEPLOYMENT_OVERLAY_LINK_REMOVAL ) . asBoolean ( ) ; }
Check if this is a redeployment triggered after the removal of a link .
21,995
protected void createNewFile ( final File file ) { try { file . createNewFile ( ) ; setFileNotWorldReadablePermissions ( file ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
This creates a new audit log file with default permissions .
21,996
private void setFileNotWorldReadablePermissions ( File file ) { file . setReadable ( false , false ) ; file . setWritable ( false , false ) ; file . setExecutable ( false , false ) ; file . setReadable ( true , true ) ; file . setWritable ( true , true ) ; }
This procedure sets permissions to the given file to not allow everybody to read it .
21,997
protected synchronized ResourceRoot getSeamIntResourceRoot ( ) throws DeploymentUnitProcessingException { try { if ( seamIntResourceRoot == null ) { final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; Module extModule = moduleLoader . loadModule ( EXT_CONTENT_MODULE ) ; URL url = extModule . getExporte...
Lookup Seam integration resource loader .
21,998
public static PathAddress pathAddress ( final ModelNode node ) { if ( node . isDefined ( ) ) { final List < Property > props = new ArrayList < Property > ( ) ; String key = null ; for ( ModelNode element : node . asList ( ) ) { Property prop = null ; if ( element . getType ( ) == ModelType . PROPERTY || element . getTy...
Creates a PathAddress from the given ModelNode address . The given node is expected to be an address node .
21,999
public PathElement getElement ( int index ) { final List < PathElement > list = pathAddressList ; return list . get ( index ) ; }
Gets the element at the given index .