idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
6,800 | private String getResourceId ( String response , String resourceResponseAction , String resourceIdXpath , String resourceIdExceptionMessage ) throws ParserConfigurationException , SAXException , XPathExpressionException , IOException { if ( WSManUtils . isSpecificResponseAction ( response , resourceResponseAction ) ) {... | This method retrieves the resource id from the create resource request response and throws the appropriate exceptions in case of failure . |
6,801 | private void deleteShell ( HttpClientService csHttpClient , HttpClientInputs httpClientInputs , String shellId , WSManRequestInputs wsManRequestInputs ) throws RuntimeException , IOException , URISyntaxException , TransformerException , XPathExpressionException , SAXException , ParserConfigurationException { String doc... | Deletes the remote shell . |
6,802 | private Map < String , String > processCommandExecutionResponse ( Map < String , String > receiveResult ) throws ParserConfigurationException , SAXException , XPathExpressionException , IOException { Map < String , String > scriptResults = new HashMap < > ( ) ; scriptResults . put ( RETURN_RESULT , buildResultFromRespo... | This method separates the stdout and stderr response streams from the received execution response . |
6,803 | private String buildResultFromResponseStreams ( String response , OutputStream outputStream ) throws ParserConfigurationException , SAXException , XPathExpressionException , IOException { StringBuilder commandResult = new StringBuilder ( ) ; int noOfStreams = WSManUtils . countStreamElements ( response ) ; for ( int st... | Constructs the executed command response from multiple streams of data containing the encoded result of the execution . |
6,804 | private boolean executionIsTimedOut ( long aStartTime , int aTimeout ) { if ( aTimeout != 0 ) { long now = System . currentTimeMillis ( ) / 1000 ; if ( ( now - aStartTime ) >= aTimeout ) { return true ; } } return false ; } | Check whether or not the command execution reach the timeout value . |
6,805 | public static String [ ] toArrayWithEscaped ( final String stringArray , final String delimiter ) { if ( StringUtils . isEmpty ( stringArray ) ) { return new String [ 0 ] ; } return StringUtils . splitByWholeSeparatorPreserveAllTokens ( stringArray , delimiter ) ; } | Splits the stringArray by the delimiter into an array of strings without ignoring the escaped delimiters |
6,806 | public static String [ ] toArray ( final String stringArray , final String delimiter ) { if ( StringUtils . isEmpty ( stringArray ) ) { return new String [ 0 ] ; } final String regex = "(?<!\\\\)" + Pattern . quote ( delimiter ) ; return stringArray . split ( regex ) ; } | Splits the stringArray by the delimiter into an array of strings ignoring the escaped delimiters |
6,807 | public static List < String > toListWithEscaped ( final String stringList , final String delimiter ) { return new ArrayList < > ( Arrays . asList ( toArrayWithEscaped ( stringList , delimiter ) ) ) ; } | Splits the stringList by the delimiter into a List of strings without ignoring the escaped delimiters |
6,808 | public static List < String > toList ( final String stringList , final String delimiter ) { return new ArrayList < > ( Arrays . asList ( toArray ( stringList , delimiter ) ) ) ; } | Splits the stringList by the delimiter into a List of strings ignoring the escaped delimiters |
6,809 | public static synchronized RequestBundle get ( SlingHttpServletRequest request ) { RequestBundle instance = ( RequestBundle ) request . getAttribute ( ATTRIBUTE_KEY ) ; if ( instance == null ) { instance = new RequestBundle ( request ) ; request . setAttribute ( ATTRIBUTE_KEY , instance ) ; } return instance ; } | returns the requests instance |
6,810 | public static String getPrimaryType ( Resource resource ) { String result = null ; if ( resource != null ) { if ( resource instanceof JcrResource ) { result = ( ( JcrResource ) resource ) . getPrimaryType ( ) ; } else { Node node = resource . adaptTo ( Node . class ) ; if ( node != null ) { try { NodeType type = node .... | retrieves the primary type of the resources node |
6,811 | public static Resource getOrCreateChild ( Resource resource , String relPath , String primaryTypes ) throws RepositoryException { Resource child = null ; if ( resource != null ) { ResourceResolver resolver = resource . getResourceResolver ( ) ; String path = resource . getPath ( ) ; while ( relPath . startsWith ( "/" )... | Retrieves the resources child resource creates this child if not existing . |
6,812 | public static boolean isFile ( Resource resource ) { Node node = resource . adaptTo ( Node . class ) ; if ( node != null ) { try { NodeType type = node . getPrimaryNodeType ( ) ; if ( type != null ) { String typeName = type . getName ( ) ; switch ( typeName ) { case TYPE_FILE : return true ; case TYPE_RESOURCE : case T... | Returns true is this resource represents a file . |
6,813 | public void initialize ( BeanContext context ) { Resource resource = ConsoleUtil . getConsoleResource ( context ) ; initialize ( context , ResourceHandle . use ( resource ) ) ; } | extract the resource referenced to display in the browsers view as the components resource |
6,814 | protected void renderTagEnd ( ) { try { if ( StringUtils . isNotEmpty ( this . output ) ) { this . output = toString ( this . escape ? escape ( this . output ) : this . output ) ; JspWriter writer = this . pageContext . getOut ( ) ; boolean renderTag = renderTag ( ) && ( StringUtils . isNotBlank ( this . tagName ) || S... | is rendering the text and a tag around if tagName is set or CSS classes are specified |
6,815 | protected Object escape ( Object value ) { EscapeFunction function = ESCAPE_FUNCTION_MAP . get ( this . type ) ; return function != null ? function . escape ( TagUtil . getRequest ( this . pageContext ) , value ) : CpnlElFunctions . text ( toString ( value ) ) ; } | the extension hook for the various types of encoding ; must work with Object values to ensure that non String values can be used as is |
6,816 | public static void exportJson ( JsonWriter writer , Resource resource ) throws RepositoryException , IOException { exportJson ( writer , resource , MappingRules . getDefaultMappingRules ( ) ) ; } | Writes a resources JSON view to a writer using the default application rules for filtering . |
6,817 | public static JsonProperty parseJsonProperty ( JsonReader reader , String name ) throws RepositoryException , IOException { JsonToken token = reader . peek ( ) ; JsonProperty property = new JsonProperty ( ) ; property . name = name ; switch ( token ) { case BOOLEAN : property . type = PropertyType . nameFromValue ( Pro... | Parses a single property of the first element of an array and returns the result as a JSON POJO object . |
6,818 | public static String getValueString ( Object value , int type , MappingRules mapping ) { String string = value . toString ( ) ; if ( type != PropertyType . STRING && mapping . propertyFormat . embedType && mapping . propertyFormat . scope == MappingRules . PropertyFormat . Scope . value ) { string = "{" + PropertyType ... | Embeds the property type in the string value if the formats scope is value . |
6,819 | public static Value makeJcrValue ( Node node , int type , Object object , MappingRules mapping ) throws PropertyValueFormatException , RepositoryException { Session session = node . getSession ( ) ; ValueFactory factory = session . getValueFactory ( ) ; Value value = null ; if ( object != null ) { switch ( type ) { cas... | Create a JCR value from string value for the designated JCR type . |
6,820 | public static void setupGroupsAndUsers ( InstallContext ctx , Map < String , List < String > > groups , Map < String , List < String > > systemUsers , Map < String , List < String > > users ) throws PackageException { UserManagementService userManagementService = getService ( UserManagementService . class ) ; try { Jac... | Creates or updates a set of groups users and system users |
6,821 | @ SuppressWarnings ( "unchecked" ) public static < T > T getService ( Class < T > type ) { Bundle serviceBundle = FrameworkUtil . getBundle ( type ) ; BundleContext serviceBundleContext = serviceBundle . getBundleContext ( ) ; ServiceReference serviceReference = serviceBundleContext . getServiceReference ( type . getNa... | retrieve a service during setup |
6,822 | protected void alreadyProcessed ( ClientlibRef ref , VisitorMode mode , ClientlibResourceFolder folder ) { if ( mode == EMBEDDED ) { LOG . warn ( "Trying to embed already embedded / dependency {} again at {}" , ref , folder ) ; } } | Warns about everything that should be embedded but is already processed and not in this |
6,823 | public Authorizable getOrCreateUser ( JackrabbitSession session , UserManager userManager , String path , boolean systemUser ) throws RepositoryException { String [ ] pathAndName = pathAndName ( path ) ; Authorizable user = userManager . getAuthorizable ( pathAndName [ 1 ] ) ; LOG . debug ( "user.check: " + pathAndName... | Retrieves a user by its name ; if the user doesn t exist the user will be created . |
6,824 | public Group getOrCreateGroup ( JackrabbitSession session , UserManager userManager , String path ) throws RepositoryException { String [ ] pathAndName = pathAndName ( path ) ; Group group = ( Group ) userManager . getAuthorizable ( pathAndName [ 1 ] ) ; LOG . debug ( "group.check: " + pathAndName [ 1 ] + " - " + group... | Retrieves a group by their name ; if the group doesn t exist the group will be created . |
6,825 | public boolean isSatisfiedby ( ClientlibLink link ) { if ( ! type . equals ( link . type ) ) return false ; if ( isCategory ( ) ) { if ( ! link . isCategory ( ) || ! category . equals ( link . path ) ) return false ; } else if ( isExternalUri ( ) ) { if ( ! link . isExternalUri ( ) || ! externalUri . equals ( link . pa... | Checks whether the link matches this up to version patterns . |
6,826 | public boolean isSatisfiedby ( Collection < ClientlibLink > links ) { for ( ClientlibLink link : links ) if ( isSatisfiedby ( link ) ) return true ; return false ; } | Checks whether one of the links matches this up to version patterns . |
6,827 | public static String getAbsoluteUrl ( SlingHttpServletRequest request , String url ) { if ( ! isExternalUrl ( url ) && url . startsWith ( "/" ) ) { String scheme = request . getScheme ( ) . toLowerCase ( ) ; url = scheme + "://" + getAuthority ( request ) + url ; } return url ; } | Makes a URL already built external ; the url should be built by the getUrl method . |
6,828 | public static Resource resolveUrl ( SlingHttpServletRequest request , String url ) { return request . getResourceResolver ( ) . getResource ( url ) ; } | Returns the resource referenced by an URL . |
6,829 | public static String getFinalTarget ( Resource resource ) throws RedirectLoopException { ResourceHandle handle = ResourceHandle . use ( resource ) ; String finalTarget = getFinalTarget ( handle , new ArrayList < String > ( ) ) ; return finalTarget ; } | Retrieves the target for a resource if there are redirects declared . |
6,830 | protected static String getFinalTarget ( ResourceHandle resource , List < String > trace ) throws RedirectLoopException { String finalTarget = null ; if ( resource . isValid ( ) ) { String path = resource . getPath ( ) ; if ( trace . contains ( path ) ) { throw new RedirectLoopException ( trace , path ) ; } String redi... | Determines the final URL of a link to a resource by traversing along the redirect properties . |
6,831 | protected boolean checkConsoleAccess ( BeanContext context ) { String consolePath = getConsolePath ( context ) ; if ( StringUtils . isNotBlank ( consolePath ) ) { return context . getResolver ( ) . getResource ( consolePath ) != null ; } return true ; } | Check access rights to the servlets path - is checking ACLs of the console path |
6,832 | public ClientlibLink makeLink ( ) { return new ClientlibLink ( getType ( ) , ClientlibLink . Kind . CLIENTLIB , resource . getPath ( ) , null ) ; } | A link that matches this . |
6,833 | public static String child ( Resource base , String path ) { Resource child = base . getChild ( path ) ; return child != null ? child . getPath ( ) : path ; } | Returns the repository path of a child of a resource . |
6,834 | public static String map ( SlingHttpServletRequest request , String value ) { StringBuilder result = new StringBuilder ( ) ; Matcher matcher = HREF_PATTERN . matcher ( value ) ; int len = value . length ( ) ; int pos = 0 ; while ( matcher . find ( pos ) ) { String unmapped = matcher . group ( 3 ) ; String mapped = url ... | Replaces all href attribute values found in the text value by the resolver mapped value . |
6,835 | public static String path ( String value ) { return value != null ? LinkUtil . encodePath ( value ) : null ; } | Returns the encoded path of a of a repository path . |
6,836 | public static Format getFormatter ( final Locale locale , final String format , final Class < ? > ... type ) { Format formatter = null ; Pattern TEXT_FORMAT_STRING = Pattern . compile ( "^\\{([^}]+)}(.+)$" ) ; Matcher matcher = TEXT_FORMAT_STRING . matcher ( format ) ; if ( matcher . matches ( ) ) { switch ( matcher . ... | Creates the formatter for a describing string rule |
6,837 | public static ResourceHandle use ( Resource resource ) { return resource instanceof ResourceHandle ? ( ( ResourceHandle ) resource ) : new ResourceHandle ( resource ) ; } | The adaptTo like wrapping helper . |
6,838 | public static boolean isValid ( Resource resource ) { return resource instanceof ResourceHandle ? ( ( ResourceHandle ) resource ) . isValid ( ) : resource != null && resource . getResourceResolver ( ) . getResource ( resource . getPath ( ) ) != null ; } | the universal validation test |
6,839 | public boolean isValid ( ) { if ( valid == null ) { valid = ( this . resource != null ) ; if ( valid ) { valid = ( getResourceResolver ( ) . getResource ( getPath ( ) ) != null ) ; } } return valid ; } | a resource is valid if not null and resolvable |
6,840 | public String getId ( ) { if ( id == null ) { if ( isValid ( ) ) { id = getProperty ( ResourceUtil . PROP_UUID ) ; } if ( StringUtils . isBlank ( id ) ) { id = Base64 . encodeBase64String ( getPath ( ) . getBytes ( MappingRules . CHARSET ) ) ; } } return id ; } | Lazy getter for the ID of the resources . The ID is the UUID of the resources node if available otherwise the Base64 encoded path . |
6,841 | public List < ResourceHandle > getChildrenByType ( final String type ) { final ArrayList < ResourceHandle > children = new ArrayList < > ( ) ; if ( this . isValid ( ) ) { for ( final Resource child : this . resource . getChildren ( ) ) { ResourceHandle handle = ResourceHandle . use ( child ) ; if ( handle . isOfType ( ... | retrieves all children of a type |
6,842 | public String getId ( Node node ) { String id = null ; try { id = node . getIdentifier ( ) ; } catch ( RepositoryException e ) { id = node . toString ( ) ; } return id ; } | Retrieves the nodes id . |
6,843 | public static String getTitle ( Node node ) { String title = getNodeTitle ( node ) ; if ( StringUtils . isBlank ( title ) ) { try { title = node . getName ( ) ; } catch ( RepositoryException rex ) { LOG . error ( rex . getMessage ( ) , rex ) ; } } return title ; } | Retrieves the title with a fallback to the nodes name . |
6,844 | private static Manifest getManifest ( final RegisteredResource rsrc ) throws IOException { try ( final InputStream ins = rsrc . getInputStream ( ) ) { if ( ins != null ) { try ( JarInputStream jis = new JarInputStream ( ins ) ) { return jis . getManifest ( ) ; } } else { return null ; } } } | Read the manifest from supplied input stream which is closed before return . |
6,845 | public static < T > T readValue ( Value value , Class < T > type ) throws RepositoryException { try { if ( null == value ) return null ; if ( type . isAssignableFrom ( value . getClass ( ) ) ) return type . cast ( value ) ; if ( Long . class . equals ( type ) ) return type . cast ( value . getLong ( ) ) ; if ( Integer ... | Reads the value of a property as the given type . |
6,846 | private static MimeType getParentMimeType ( Resource resource ) { MimeType result = null ; if ( resource != null && ( resource = resource . getParent ( ) ) != null ) { ResourceHandle handle = ResourceHandle . use ( resource ) ; result = getMimeType ( handle . getProperty ( ResourceUtil . PROP_MIME_TYPE , "" ) ) ; if ( ... | a helper if the resource is a content node an should use its parent as a fallback |
6,847 | private static MimeType getContentMimeType ( Resource resource ) { MimeType result = null ; if ( resource != null && ( resource = resource . getChild ( ResourceUtil . CONTENT_NODE ) ) != null ) { ResourceHandle handle = ResourceHandle . use ( resource ) ; result = getMimeType ( handle . getProperty ( ResourceUtil . PRO... | a helper if the resource has a content node an should use this content as a fallback |
6,848 | public static MimeType getMimeType ( String value ) { if ( StringUtils . isNotBlank ( value ) ) { try { return getMimeTypes ( ) . forName ( value ) ; } catch ( MimeTypeException e ) { MediaType mediaType = getMediaType ( null , value ) ; if ( mediaType != null ) { try { return getMimeTypes ( ) . forName ( mediaType . t... | Retrieves the MimeType object according to a name value |
6,849 | public void initialize ( BeanContext context , Resource resource ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "initialize (" + context + ", " + resource + ")" ) ; } this . context = context ; this . resource = ResourceHandle . use ( resource ) ; } | This basic initialization sets up the context and resource attributes only all the other attributes are set lazy during their getter calls . |
6,850 | public ResourceHandle getParent ( String resourceType ) { ResourceHandle result = getResource ( ) ; while ( result . isValid ( ) && ! result . isResourceType ( resourceType ) ) { result = result . getParent ( ) ; } if ( ! result . isValid ( ) ) { result = getParent ( resourceType , getPath ( ) ) ; } return result ; } | Determine a typed parent resource . |
6,851 | public String getExtension ( ) { String extension = getSlingRequest ( ) . getRequestPathInfo ( ) . getExtension ( ) ; return StringUtils . isBlank ( extension ) ? "" : ( "." + extension ) ; } | Returns the request extension with a leading . if present . |
6,852 | public boolean isCurrentUserAdmin ( ) throws RepositoryException { boolean isAdmin = false ; final JackrabbitSession session = ( JackrabbitSession ) getSession ( ) ; final UserManager userManager = session . getUserManager ( ) ; Authorizable a = userManager . getAuthorizable ( getRequest ( ) . getUserPrincipal ( ) ) ; ... | Returns true if the current request user is the admin user . |
6,853 | public < T > Future < T > submit ( Callable < T > callable ) { return executorService . submit ( callable ) ; } | Schedules something for execution in the future . |
6,854 | public static < T extends Enum > T getExtension ( SlingHttpServletRequest request , T defaultValue ) { String extension = request . getRequestPathInfo ( ) . getExtension ( ) ; if ( extension != null ) { Class type = defaultValue . getClass ( ) ; try { T value = ( T ) T . valueOf ( type , extension . toLowerCase ( ) ) ;... | Returns the enum value of the requests extension if appropriate otherwise the default value . |
6,855 | public static < T extends Enum > T getSelector ( SlingHttpServletRequest request , T defaultValue ) { String [ ] selectors = request . getRequestPathInfo ( ) . getSelectors ( ) ; Class type = defaultValue . getClass ( ) ; for ( String selector : selectors ) { try { T value = ( T ) T . valueOf ( type , selector ) ; retu... | Returns an enum value from selectors if an appropriate selector can be found otherwise the default value given . |
6,856 | public static boolean checkSelector ( SlingHttpServletRequest request , String key ) { String [ ] selectors = request . getRequestPathInfo ( ) . getSelectors ( ) ; for ( String selector : selectors ) { if ( selector . equals ( key ) ) { return true ; } } return false ; } | Retrieves a key in the selectors and returns true is the key is present . |
6,857 | protected com . composum . sling . core . util . ExpressionUtil getExpressionUtil ( ) { if ( expressionUtil == null ) { expressionUtil = new ExpressionUtil ( pageContext ) ; } return expressionUtil ; } | Returns or creates the expressionUtil . Not null . |
6,858 | public HierarchyScanResult findOriginAndValue ( String name , Class < ? > type ) { Object value ; findEntryPoint ( ) ; String path = getRelativePath ( name ) ; for ( Resource parent = entryPoint ; parent != null ; parent = parent . getParent ( ) ) { ValueMap parentProps = parent . adaptTo ( ValueMap . class ) ; if ( pa... | Searches the value along the repositories hierarchy by the entry point and path determined before . |
6,859 | public ClientlibLink withHash ( String newHash ) { return new ClientlibLink ( type , kind , path , properties , newHash ) ; } | Creates a new link with parameters as this except hash . |
6,860 | public Calendar getLastUpdateTime ( ) { if ( null != lastUpdateTime && lastUpdateTime . after ( Calendar . getInstance ( ) ) ) { LOG . warn ( "Last update time newer than now {} for {}" , lastUpdateTime , owner ) ; return null ; } return lastUpdateTime ; } | Returns the last update time estimated from the file update times and clientlib folder create times . This is only a lower bound for the update time of the client library including its embedded files . |
6,861 | public static String appendHashSuffix ( String url , String hash ) { if ( null == hash ) return url ; Matcher matcher = FILENAME_PATTERN . matcher ( url ) ; String fname = "" ; if ( matcher . find ( ) ) fname = matcher . group ( 0 ) ; return url + "/" + hash + "/" + fname ; } | Appends a suffix containing the hash code if given . The file name is repeated to satisfy browsers with the correct type and file name though it is not used by the servlet . |
6,862 | public boolean isClientlibRendered ( ClientlibRef reference ) { for ( ClientlibLink link : renderedClientlibs ) { if ( reference . isSatisfiedby ( link ) ) { LOG . debug ( "already rendered: {} by {}" , reference , link . path ) ; return true ; } } return false ; } | Checks whether a referenced resource or client library is satisfied by an already rendered resource . |
6,863 | protected Class < ? extends SlingBean > getComponentType ( ) throws ClassNotFoundException { if ( componentType == null ) { String type = getType ( ) ; if ( StringUtils . isNotBlank ( type ) ) { componentType = ( Class < ? extends SlingBean > ) context . getType ( type ) ; } } return componentType ; } | get the content type class object |
6,864 | protected Object available ( ) throws ClassNotFoundException { Object result = null ; if ( getVar ( ) != null ) { Object value = pageContext . getAttribute ( getVar ( ) , getVarScope ( ) ) ; if ( value instanceof SlingBean ) { Class < ? > type = getComponentType ( ) ; if ( type != null && type . isAssignableFrom ( valu... | Check for an existing instance of the same var and assignable type |
6,865 | protected SlingBean createComponent ( ) throws ClassNotFoundException , IllegalAccessException , InstantiationException { SlingBean component = null ; Class < ? extends SlingBean > type = getComponentType ( ) ; if ( type != null ) { BeanFactory factoryRule = type . getAnnotation ( BeanFactory . class ) ; if ( factoryRu... | Create the requested component instance |
6,866 | protected Map < String , Object > getReplacedAttributes ( int scope ) { if ( replacedAttributes == null ) { replacedAttributes = new ArrayList < > ( ) ; } while ( replacedAttributes . size ( ) <= scope ) { replacedAttributes . add ( new HashMap < String , Object > ( ) ) ; } return replacedAttributes . get ( scope ) ; } | retrieves the registry for one scope |
6,867 | protected void setAttribute ( String key , Object value , int scope ) { Map < String , Object > replacedInScope = getReplacedAttributes ( scope ) ; if ( ! replacedInScope . containsKey ( key ) ) { Object current = pageContext . getAttribute ( key , scope ) ; replacedInScope . put ( key , current ) ; } pageContext . set... | each attribute set by a tag should use this method for attribute declaration ; an existing value with the same key is registered and restored if the tag rendering ends |
6,868 | protected void restoreAttributes ( ) { if ( replacedAttributes != null ) { for ( int scope = 0 ; scope < replacedAttributes . size ( ) ; scope ++ ) { Map < String , Object > replaced = replacedAttributes . get ( scope ) ; for ( Map . Entry < String , Object > entry : replaced . entrySet ( ) ) { String key = entry . get... | restores all replaced values and removes all attributes declared in this tag |
6,869 | public ServletOperation getOperation ( SlingHttpServletRequest request , Method method ) { ServletOperation operation = null ; E extension = RequestUtil . getExtension ( request , defaultExtension ) ; Map < E , O > extensionDefaults = operationDefaults . get ( method ) ; if ( extensionDefaults != null ) { O defaultOper... | Retrieves the servlet operation requested for the used HTTP method . Looks in the selectors for a operation and gives their implementation in the extensions context . |
6,870 | protected synchronized void bindFilterConfiguration ( final FilterConfiguration config ) { if ( filterConfigurations == null ) { filterConfigurations = new ArrayList < > ( ) ; } filterConfigurations . add ( config ) ; String key = config . getName ( ) ; ResourceFilter filter = config . getFilter ( ) ; if ( StringUtils ... | for each configured filter in the OSGi configuration a tree filter is added to the filter set |
6,871 | protected synchronized void unbindFilterConfiguration ( final FilterConfiguration config ) { nodeFilters . remove ( config . getName ( ) ) ; filterConfigurations . remove ( config ) ; } | removing of a configuration which is not longer available ; removes the corresponding tree filter also |
6,872 | protected ResourceFilter getNodeFilter ( SlingHttpServletRequest request ) { ResourceFilter filter = null ; String filterParam = RequestUtil . getParameter ( request , PARAM_FILTER , ( String ) null ) ; if ( StringUtils . isNotBlank ( filterParam ) ) { filter = nodeFilters . get ( filterParam ) ; } if ( filter == null ... | Determines the filter to use for node retrieval ; scans the request for filter parameter or selector . |
6,873 | protected List < Resource > prepareTreeItems ( ResourceHandle resource , List < Resource > items ) { if ( ! nodesConfig . getOrderableNodesFilter ( ) . accept ( resource ) ) { Collections . sort ( items , new Comparator < Resource > ( ) { public int compare ( Resource r1 , Resource r2 ) { return getSortName ( r1 ) . co... | sort children of orderable nodes |
6,874 | protected void activate ( ComponentContext context ) { Dictionary properties = context . getProperties ( ) ; name = ( String ) properties . get ( "name" ) ; filter = ResourceFilterMapping . fromString ( ( String ) properties . get ( "filter" ) ) ; } | creates the filter instance for the configured rule |
6,875 | public static ResourceHandle getResource ( SlingHttpServletRequest request ) { ResourceResolver resolver = request . getResourceResolver ( ) ; String path = getPath ( request ) ; ResourceHandle resource = ResourceHandle . use ( resolver . resolve ( path ) ) ; return resource ; } | Retrieves the resource using the suffix from the request . |
6,876 | public static Resource getConsoleResource ( BeanContext context ) { SlingHttpServletRequest request = context . getRequest ( ) ; ResourceResolver resolver = request . getResourceResolver ( ) ; String path = null ; Resource resource = context . getAttribute ( "resource" , Resource . class ) ; if ( resource == null ) { r... | determines the addressed resource by the suffix if the requests resource is the servlet itself |
6,877 | private boolean areClassesEqual ( Class < ? > c1 , Class < ? > c2 ) { if ( isMap ( c1 ) ) { return isMap ( c2 ) ; } else if ( isList ( c1 ) ) { return isList ( c2 ) ; } else { return c1 . equals ( c2 ) ; } } | When comparing literals allow subclasses of Maps and Lists to be directly compared even if they have different implementations . |
6,878 | protected MatchingPart toPart ( List < MatchingPart > leadingParts , String part ) { switch ( leadingParts . size ( ) ) { case 0 : MatchingPart resolvedPart = createEmoPermissionPart ( part , PartType . CONTEXT ) ; checkArgument ( resolvedPart instanceof ConstantPart || resolvedPart . impliesAny ( ) , "First part must ... | Override the logic in the parent to meet the requirements for EmoPermission . |
6,879 | private MatchingPart createEmoPermissionPart ( String part , PartType partType ) { part = unescapeSeparators ( part ) ; switch ( part . charAt ( 0 ) ) { case 'c' : if ( isTableResource ( partType ) && part . startsWith ( "createTable(" ) && part . endsWith ( ")" ) ) { String rison = part . substring ( 12 , part . lengt... | Creates a TableIdentificationPart for the third value in a data or blob store permission . |
6,880 | private boolean isJsonProcessingException ( Exception e ) { return e instanceof JsonProcessingException && ! ( e instanceof JsonParseException && e . getMessage ( ) != null && e . getMessage ( ) . startsWith ( "Unexpected end-of-input" ) ) ; } | Returns true if the exception is a JsonProcessingException whose root cause is not a premature end of data since this is more likely caused by a connection error . |
6,881 | public static boolean synchronousSync ( CuratorFramework curator , Duration timeout ) { try { final CountDownLatch latch = new CountDownLatch ( 1 ) ; curator . sync ( ) . inBackground ( new BackgroundCallback ( ) { public void processResult ( CuratorFramework curator , CuratorEvent event ) throws Exception { if ( event... | Performs a blocking sync operation . Returns true if the sync completed normally false if it timed out or was interrupted . |
6,882 | protected void initializePermission ( ) { try { List < MatchingPart > parts = Lists . newArrayList ( ) ; for ( String partString : split ( _permission ) ) { partString = partString . trim ( ) ; checkArgument ( ! "" . equals ( partString ) , "Permission cannot contain empty parts" ) ; MatchingPart part = toPart ( Collec... | Parses and initializes the permission s parts . By default this is performed by the constructor . If a subclass needs to perform its own initialization prior to initializing the permissions then it should call the constructor with the initialization parameter set to false and then call this method when ready . |
6,883 | private int getSeparatorIndex ( ByteBuffer buf ) { int colon = BufferUtils . indexOf ( buf , ( byte ) ':' ) ; if ( colon == - 1 ) { throw new IllegalStateException ( "Unknown encoding format: " + ByteBufferUtil . bytesToHex ( buf ) ) ; } return colon ; } | Returns the index of the colon that separates the encoding prefix from the body suffix . |
6,884 | public List < ScanRange > unwrapped ( ) { if ( compare ( _from , _to ) < 0 ) { return ImmutableList . of ( this ) ; } ImmutableList . Builder < ScanRange > ranges = ImmutableList . builder ( ) ; if ( compare ( _from , MAX_VALUE ) < 0 ) { ranges . add ( new ScanRange ( _from , MAX_VALUE ) ) ; } if ( compare ( _to , MIN_... | If necessary splits the scan range into two range such that from is less than to in each range . This is necessary if the scan range wraps the token range . |
6,885 | public void clear ( ) { _sample . clear ( ) ; _count = 0 ; _max = null ; _min = null ; _sum = BigDecimal . ZERO ; _m = - 1 ; _s = 0 ; } | Clears all recorded values . |
6,886 | public List < Token > resplitLocally ( String startToken , String endToken , int numResplits ) { List < Token > splitTokens = ImmutableList . of ( _tokenFactory . fromString ( startToken ) , _tokenFactory . fromString ( endToken ) ) ; for ( int i = 0 ; i < numResplits ; i ++ ) { List < Token > newTokens = new ArrayList... | Manually split the token ranges using ByteOrderedPartitioner s midpoint method |
6,887 | private Iterator < Record > rowQuery ( DeltaPlacement placement , List < Map . Entry < ByteBuffer , Key > > keys , ReadConsistency consistency ) { List < ByteBuffer > rowIds = Lists . transform ( keys , entryKeyFunction ( ) ) ; final Rows < ByteBuffer , DeltaKey > rows = execute ( placement . getKeyspace ( ) . prepareQ... | Queries for rows given an enumerated list of Cassandra row keys . |
6,888 | private Iterator < String > decodeKeys ( final Iterator < Row < ByteBuffer , DeltaKey > > iter ) { return new AbstractIterator < String > ( ) { protected String computeNext ( ) { while ( iter . hasNext ( ) ) { Row < ByteBuffer , DeltaKey > row = iter . next ( ) ; if ( ! row . getColumns ( ) . isEmpty ( ) ) { return Ast... | Decodes row keys returned by scanning a table . |
6,889 | private Iterator < Record > decodeRows ( List < Map . Entry < ByteBuffer , Key > > keys , final Rows < ByteBuffer , DeltaKey > rows , final int largeRowThreshold , final ReadConsistency consistency ) { return Iterators . transform ( keys . iterator ( ) , new Function < Map . Entry < ByteBuffer , Key > , Record > ( ) { ... | Decodes rows returned by querying for a specific set of rows . |
6,890 | private < T > Iterator < T > touch ( Iterator < T > iter ) { iter . hasNext ( ) ; return iter ; } | Force computation of the first item in an iterator so metrics calculations for a method reflect the cost of the first batch of results . |
6,891 | public ConsistencyLevel clamp ( ConsistencyLevel consistencyLevel ) { if ( ( consistencyLevel == ConsistencyLevel . CL_LOCAL_QUORUM || consistencyLevel == ConsistencyLevel . CL_EACH_QUORUM ) && ! _networkTopology ) { consistencyLevel = ConsistencyLevel . CL_QUORUM ; } if ( consistencyLevel == ConsistencyLevel . CL_LOCA... | Reduce the desired consistency level to be compatible with the deployed ring topology . |
6,892 | public < V > V getValue ( Serializer < V > serializer ) { return _content != null ? serializer . fromByteBuffer ( _content ) : _oldColumn . getValue ( serializer ) ; } | content will be null if delta fit in a single block as no stitching was performed |
6,893 | private static void startLocalCassandra ( String cassandraYamlPath ) throws IOException { System . setProperty ( "cassandra.config" , "file:" + cassandraYamlPath ) ; final CassandraDaemon cassandra = new CassandraDaemon ( ) ; cassandra . init ( null ) ; Futures . getUnchecked ( service . submit ( new Callable < Object ... | Start an in - memory Cassandra . |
6,894 | private static TestingServer startLocalZooKeeper ( ) throws Exception { ( ( Logger ) LoggerFactory . getLogger ( "org.apache.zookeeper" ) ) . setLevel ( Level . ERROR ) ; TestingServer zooKeeperServer = new TestingServer ( 2181 ) ; System . setProperty ( "dw.zooKeeper.connectString" , zooKeeperServer . getConnectString... | Start an in - memory copy of ZooKeeper . |
6,895 | public MigratorStatus resubmitWorkflowTasks ( String placement ) { MigratorStatus status = _statusDAO . getMigratorStatus ( placement ) ; if ( status == null ) { return null ; } if ( status . getCompleteTime ( ) == null ) { for ( ScanRangeStatus active : status . getActiveScanRanges ( ) ) { _workflow . addScanRangeTask... | Sometimes due to unexpected errors while submitting migrator ranges to the underlying queues a migration can get stuck . This method takes all available tasks for a migration and resubmits them . This method is safe because the underlying system is resilient to task resubmissions and concurrent work on the same task . |
6,896 | public Record read ( Key key , ReadConsistency consistency ) { checkNotNull ( key , "key" ) ; checkNotNull ( consistency , "consistency" ) ; AstyanaxTable table = ( AstyanaxTable ) key . getTable ( ) ; AstyanaxStorage storage = table . getReadStorage ( ) ; DeltaPlacement placement = ( DeltaPlacement ) storage . getPlac... | This CQL based read method works for a row with 64 deltas of 3 MB each . The same read with the AstyanaxDataReaderDAO would give Thrift frame errors . |
6,897 | public List < String > getSplits ( Table table , int recordsPerSplit , int localResplits ) throws TimeoutException { return _astyanaxReaderDAO . getSplits ( table , recordsPerSplit , localResplits ) ; } | support for this call using CQL . Therefore they must always defer to the Asytanax implementation . |
6,898 | private ScanStatus resplitPartiallyCompleteTasks ( ScanStatus status ) { boolean anyUpdated = false ; int nextTaskId = - 1 ; for ( ScanRangeStatus complete : status . getCompleteScanRanges ( ) ) { if ( complete . getResplitRange ( ) . isPresent ( ) ) { if ( nextTaskId == - 1 ) { nextTaskId = getNextTaskId ( status ) ; ... | Checks whether any completed tasks returned before scanning the entire range . If so then the unscanned ranges are resplit and new tasks are created from them . |
6,899 | public static < T > T getEntity ( InputStream in , Class < T > clazz ) { if ( clazz == InputStream . class ) { return ( T ) clazz ; } try { return JsonHelper . readJson ( in , clazz ) ; } catch ( IOException e ) { throw Throwables . propagate ( e ) ; } } | Reads the entity input stream and deserializes the JSON content to the given class . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.