Class AnnotationResourceFactory

java.lang.Object
io.milton.http.annotated.AnnotationResourceFactory
All Implemented Interfaces:
ResourceFactory

public final class AnnotationResourceFactory extends Object implements ResourceFactory
A resource factory which provides access to files in a file system. Using this with milton is equivalent to using the dav servlet in tomcat
  • Constructor Details

    • AnnotationResourceFactory

      public AnnotationResourceFactory()
  • Method Details

    • getResource

      public Resource getResource(String host, String url) throws NotAuthorizedException, BadRequestException
      Specified by:
      getResource in interface ResourceFactory
      Throws:
      NotAuthorizedException
      BadRequestException
    • findFromRoot

      public Resource findFromRoot(AnnoCollectionResource rootFolder, Path p) throws NotAuthorizedException, BadRequestException
      Throws:
      NotAuthorizedException
      BadRequestException
    • getRealm

      public String getRealm(String host)
    • setAuthenticationService

      public void setAuthenticationService(AuthenticationService authenticationService)
    • getAuthenticationService

      public AuthenticationService getAuthenticationService()
    • getCalendarSearchService

      public CalendarSearchService getCalendarSearchService()
    • setCalendarSearchService

      public void setCalendarSearchService(CalendarSearchService calendarSearchService)
    • isDoEarlyAuth

      public boolean isDoEarlyAuth()
      If true authentication will be attempted as soon as the root resource is located
      Returns:
    • setDoEarlyAuth

      public void setDoEarlyAuth(boolean doEarlyAuth)
    • setSecurityManager

      public void setSecurityManager(SecurityManager securityManager)
    • getSecurityManager

      public SecurityManager getSecurityManager()
    • setMaxAgeSeconds

      public void setMaxAgeSeconds(Long maxAgeSeconds)
    • getMaxAgeSeconds

      public Long getMaxAgeSeconds()
    • getLockManager

      public LockManager getLockManager()
    • setLockManager

      public void setLockManager(LockManager lockManager)
    • setContextPath

      public void setContextPath(String contextPath)
    • getContextPath

      public String getContextPath()
    • getValidContextPath

      public String getValidContextPath()
      Get a context path which is definitely valid as a path. Ie it always begins with a slash, and ends with a slash, and is a single slash if representing the root
      Returns:
    • stripContext

      public String stripContext(String url)
    • getControllers

      public Collection<Object> getControllers()
    • setControllers

      public void setControllers(Collection<Object> controllers)
    • getViewResolver

      public ViewResolver getViewResolver()
    • setViewResolver

      public void setViewResolver(ViewResolver viewResolver)
    • isCompatible

      public boolean isCompatible(Object source, Request.Method m)
    • buildInvokeArgs

      public Object[] buildInvokeArgs(AnnoResource sourceRes, Method m, Object... otherValues) throws Exception
      Parameters:
      sourceRes -
      m -
      otherValues - - any other values to be provided which can be mapped onto method arguments
      Returns:
      Throws:
      Exception
    • buildInvokeArgsExt

      public Object[] buildInvokeArgsExt(AnnoResource sourceRes, Object mandatorySecondArg, boolean forceUseSecondArg, Method m, Object... otherValues) throws Exception
      Parameters:
      sourceRes -
      mandatorySecondArg - - if present will be used as second arg. Used by AccessControlListAnnotationHandler to always provide user to second arg, even when null
      forceUseSecondArg -
      m -
      otherValues -
      Returns:
      Throws:
      Exception
    • findMethodForAnno

      public Method findMethodForAnno(Class sourceClass, Class annoClass)
    • instantiate

      public AnnoResource instantiate(Object childSource, AnnoCollectionResource parent, Method m)
      Create a Resource to wrap a source pojo object.
      Parameters:
      childSource -
      parent -
      m -
      Returns:
    • instantiate

      public CommonResource instantiate(LockHolder r, AnnoCollectionResource parent)
    • createLockHolder

      public LockHolder createLockHolder(AnnoCollectionResource parentCollection, String name, LockTimeout timeout, LockInfo lockInfo)
      Create an in-memory resource with the given timeout. The resource will not be persisted, but may be distributed among the cluster if configured as such. The resource may be flushed from the in-memory list after the given timeout if not-null The type of the object returned is not intended to have any significance and does not contain any meaningful content
      Parameters:
      parentCollection -
      name -
      timeout - - optional. The resource will be removed after this timeout expires
      lockInfo -
      Returns:
      - a temporary (not persistent) resource of an indeterminate type
    • getTempResourcesForParent

      public List<LockHolder> getTempResourcesForParent(AnnoCollectionResource parent)
      Null-safe method to get the list of lock holders for the given parent. These are resources created by a LOCK-null request, where resources are locked prior to being created. The lock-null resource is replaced following a PUT to that resource
      Parameters:
      parent -
      Returns:
    • getTempResourcesForParent

      public List<LockHolder> getTempResourcesForParent(String parentKey)
    • removeLockHolder

      public void removeLockHolder(AnnoCollectionResource parent, String name)
      Removes the LockHolder from memory and also from the parent which contains it (if loaded)
      Parameters:
      parent -
      name -
    • getMapOfTempResources

      public Map<String,List<LockHolder>> getMapOfTempResources()
    • setMapOfTempResources

      public void setMapOfTempResources(Map<String,List<LockHolder>> mapOfTempResources)
    • createAndAppend

      public void createAndAppend(Collection<AnnoResource> result, Object sources, AnnoCollectionResource parent, ControllerMethod cm)
      Process the source object (which may be a Collection of source objects), and for each one instantiate an AnnoResource and append it to the result set
      Parameters:
      result - - to append to
      sources - - single source object, or multiple source objects in a Collection
      parent - - the parent collection of these resource(s)
      cm - - the controller method they were found by
    • getCalendarDateRangeQueryAnnotationHandler

      public CalendarDateRangeQueryAnnotationHandler getCalendarDateRangeQueryAnnotationHandler()
    • getCalendarInvitationsAnnotationHandler

      public CalendarInvitationsAnnotationHandler getCalendarInvitationsAnnotationHandler()
    • getCalendarInvitationsCTagAnnotationHandler

      public CalendarInvitationsCTagAnnotationHandler getCalendarInvitationsCTagAnnotationHandler()
    • getFreeBusyQueryAnnotationHandler

      public FreeBusyQueryAnnotationHandler getFreeBusyQueryAnnotationHandler()
    • getUsersAnnotationHandler

      public UsersAnnotationHandler getUsersAnnotationHandler()