Class PathCommandHandler

java.lang.Object
org.exoplatform.documents.storage.jcr.webdav.plugin.PathCommandHandler

@Component public class PathCommandHandler extends Object
  • Field Details

    • PROPERTY_NAMES

      public static final List<QName> PROPERTY_NAMES
    • IDENTITY_PATHS_FORMAT

      public static final String IDENTITY_PATHS_FORMAT
      See Also:
    • PATHS_CONCAT_FORMAT

      public static final String PATHS_CONCAT_FORMAT
      See Also:
    • SEGMENT_CHAR_REPLACEMENT

      public static final String SEGMENT_CHAR_REPLACEMENT
      See Also:
    • LOG

      protected static final org.exoplatform.services.log.Log LOG
    • identityManager

      @Autowired protected org.exoplatform.social.core.manager.IdentityManager identityManager
    • spaceService

      @Autowired protected org.exoplatform.social.core.space.spi.SpaceService spaceService
    • nodeHierarchyCreator

      @Autowired protected org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator
    • sessionProviderService

      @Autowired protected org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService
    • repositoryService

      @Autowired protected org.exoplatform.services.jcr.RepositoryService repositoryService
    • webDavPathMappingStorage

      @Autowired protected WebDavPathMappingStorage webDavPathMappingStorage
  • Constructor Details

    • PathCommandHandler

      public PathCommandHandler()
  • Method Details

    • init

      @PostConstruct public void init()
    • toWebDavSegment

      public static String toWebDavSegment(String segmentName)
      Last-resort guard keeping a drive name inside a single WebDAV path segment. The names fed to it — a Space pretty name, a username — are already URL-safe by construction (see getIdentitySegmentName(Identity)); this only makes sure an identity store that yields something unexpected cannot emit a '%2F', which is rejected before the request reaches any handler and which, once decoded, would split the drive into two segments so that the identity id can no longer be read back from the path.
      Parameters:
      segmentName - drive name, may be null
      Returns:
      the name with every character unusable in a path segment replaced by SEGMENT_CHAR_REPLACEMENT
    • getIdentityBaseJcrPath

      @Cacheable("webdav.identityJcrBasePath") public String getIdentityBaseJcrPath(String webDavPath)
    • getIdentityBaseFromJcrPath

      @Cacheable("webdav.identityJcrBasePath") public String getIdentityBaseFromJcrPath(String jcrPath, String username)
    • getIdentityBaseJcrPath

      @Cacheable("webdav.identityJcrBasePath") public String getIdentityBaseJcrPath(long identityId)
    • getIdentityIdFromJcrPath

      @Cacheable("webdav.identityIdByPath") public Long getIdentityIdFromJcrPath(String jcrPath, String username)
    • getIdentityIdFromWebDavPath

      @Cacheable("webdav.identityIdByPath") public Long getIdentityIdFromWebDavPath(String webDavPath)
    • resolveToJcrPath

      public String resolveToJcrPath(javax.jcr.Session session, String webDavPath) throws org.exoplatform.documents.webdav.model.WebDavException
      Throws:
      org.exoplatform.documents.webdav.model.WebDavException
    • getLastVisibleSegment

      public String getLastVisibleSegment(String webDavPath)
    • isIdentityRootWebDavPath

      public boolean isIdentityRootWebDavPath(String webDavPath)
    • getOrCreateWebDavPath

      public String getOrCreateWebDavPath(javax.jcr.Node node)
    • getOrCreateWebDavPath

      public String getOrCreateWebDavPath(String identityId, String identityBaseJcrPath, String identityRootWebDavPath, javax.jcr.Node node, String preferredVisibleName)
    • getVisibleName

      public String getVisibleName(javax.jcr.Node node) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • getParentVisibleNodeName

      public String getParentVisibleNodeName(javax.jcr.Node node) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • allocateTechnicalName

      public String allocateTechnicalName(javax.jcr.Session session, String parentJcrPath, String visibleName)
    • saveMapping

      public WebDavPathMappingEntity saveMapping(javax.jcr.Session session, String webDavPath, String visibleName, javax.jcr.Node node)
    • deleteMapping

      public void deleteMapping(String jcrPath)
    • refreshMappingOrDelete

      public void refreshMappingOrDelete(javax.jcr.Session session, String jcrPath)
    • isTitlePropertyPath

      public boolean isTitlePropertyPath(String eventPath)
    • getNodePathFromPropertyPath

      public String getNodePathFromPropertyPath(String propertyPath)
    • getIdentitySegmentName

      public static String getIdentitySegmentName(org.exoplatform.social.core.identity.model.Identity identity)
      Returns the name an identity contributes to its WebDAV drive segment:
      • a Space is addressed by its pretty name, the very name its drive is created under in JCR (/groups/spaces/<prettyName>/Documents): URL-safe by construction and frozen at creation, unlike the Space display name, which a rename can change and which may carry a '/';
      • a personal drive keeps the user full name, which reads far better than a username when the drive is mounted, and which toWebDavSegment(String) keeps inside a single path segment.
      Parameters:
      identity - Identity of the drive owner, may be null
      Returns:
      the name the drive is addressed by, never null