org.xwiki.extension.script.internal.safe
Class SafeSearchableExtensionRepository<T extends ExtensionRepository>

java.lang.Object
  extended by org.xwiki.extension.wrap.AbstractWrappingObject<T>
      extended by org.xwiki.extension.internal.safe.AbstractSafeObject<T>
          extended by org.xwiki.extension.script.internal.safe.AbstractNoExceptionSafeObject<T>
              extended by org.xwiki.extension.script.internal.safe.SafeExtensionRepository<T>
                  extended by org.xwiki.extension.script.internal.safe.SafeSearchableExtensionRepository<T>
Type Parameters:
T -
All Implemented Interfaces:
ExtensionRepository, Searchable
Direct Known Subclasses:
SafeCoreExtensionRepository, SafeInstalledExtensionRepository, SafeLocalExtensionRepository

public class SafeSearchableExtensionRepository<T extends ExtensionRepository>
extends SafeExtensionRepository<T>
implements Searchable

Provide a public script access to a Searchable extension repository.


Field Summary
 
Fields inherited from class org.xwiki.extension.script.internal.safe.AbstractNoExceptionSafeObject
hasProgrammingRight
 
Fields inherited from class org.xwiki.extension.internal.safe.AbstractSafeObject
FORBIDDEN, safeProvider
 
Constructor Summary
SafeSearchableExtensionRepository(T repository, ScriptSafeProvider<?> safeProvider, Execution execution, boolean hasProgrammingRight)
           
 
Method Summary
 IterableResult<Extension> search(String pattern, int offset, int nb)
          Search extension based of the provided pattern.
 
Methods inherited from class org.xwiki.extension.script.internal.safe.SafeExtensionRepository
exists, getDescriptor, getId, resolve, resolve, resolveVersions
 
Methods inherited from class org.xwiki.extension.script.internal.safe.AbstractNoExceptionSafeObject
getLastError, setError
 
Methods inherited from class org.xwiki.extension.internal.safe.AbstractSafeObject
safe
 
Methods inherited from class org.xwiki.extension.wrap.AbstractWrappingObject
equals, getWrapped, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SafeSearchableExtensionRepository

public SafeSearchableExtensionRepository(T repository,
                                         ScriptSafeProvider<?> safeProvider,
                                         Execution execution,
                                         boolean hasProgrammingRight)
Parameters:
repository - wrapped repository
safeProvider - the provider of instances safe for public scripts
execution - provide access to the current context
hasProgrammingRight - does the caller script has programming right
Method Detail

search

public IterableResult<Extension> search(String pattern,
                                        int offset,
                                        int nb)
                                 throws SearchException
Description copied from interface: Searchable
Search extension based of the provided pattern.

The pattern is a simple character chain.

Specified by:
search in interface Searchable
Parameters:
pattern - the pattern to search
offset - the offset from where to start returning search results
nb - the maximum number of search results to return
Returns:
the found extensions descriptors, empty list if nothing could be found
Throws:
SearchException - error when trying to search provided pattern