i_cmsresourcewrapper.java

来自「找了很久才找到到源代码」· Java 代码 · 共 372 行 · 第 1/2 页

JAVA
372
字号
     * @param res the resource to check
     * 
     * @return true if the resource will be handled by the wrapper otherwise false
     */
    boolean isWrappedResource(CmsObject cms, CmsResource res);

    /**
     * Locks a resource.<p>
     *
     * First should be a check if the resourcename is handled by this
     * resource wrapper.<p>
     * 
     * It is possible that the path in the resourcename is a virtual path and
     * so has to be translated into a valid path existing in the VFS to lock the resource.<p>
     * 
     * @see CmsObjectWrapper#lockResource(String)
     * @see CmsObject#lockResource(String)
     * 
     * @param cms the current users OpenCms context
     * @param resourcename the name of the resource to lock (full path)
     * 
     * @return true if this request could be handled by this wrapper or false if not
     * 
     * @throws CmsException if something goes wrong
     */
    boolean lockResource(CmsObject cms, String resourcename) throws CmsException;

    /**
     * Moves a resource to the given destination.<p>
     * 
     * First should be a check if the source and/or the destination are handled by this
     * resource wrapper.<p>
     * 
     * It is possible that the path in the source or in the destination are virtual paths and
     * so has to be translated into valid paths existing in the VFS to move the resource.<p>
     * 
     * @see CmsObjectWrapper#moveResource(String, String)
     * @see CmsObject#moveResource(String, String)
     * 
     * @param cms the current cms context
     * @param source the name of the resource to move
     * @param destination the destination resource name
     *
     * @throws CmsException if something goes wrong
     * @throws CmsIllegalArgumentException if the <code>source</code> argument is null or of length 0
     * 
     * @return true if the move action was handled by this resource wrapper otherwise false
     */
    boolean moveResource(CmsObject cms, String source, String destination)
    throws CmsException, CmsIllegalArgumentException;

    /**
     * Reads a file resource (including it's binary content) from the VFS,
     * using the specified resource filter.<p>
     * 
     * First should be a check if the resourcename is handled by this
     * resource wrapper.<p>
     * 
     * It is possible that the path in the resourcename is a virtual path and
     * so has to be translated into a valid path existing in the VFS to read the resource.<p>
     * 
     * @see CmsObjectWrapper#readFile(String, CmsResourceFilter)
     * @see CmsObject#readFile(String, CmsResourceFilter)
     * 
     * @param cms the current users OpenCms context
     * @param resourcename the name of the resource to read (full path)
     * @param filter the resource filter to use while reading
     * 
     * @return the file resource that was read or null if it could not be handled by this resource wrapper
     *
     * @throws CmsException if the file resource could not be read for any reason
     */
    CmsFile readFile(CmsObject cms, String resourcename, CmsResourceFilter filter) throws CmsException;

    /**
     * Reads a resource from the VFS, using the specified resource filter.<p>
     * 
     * First should be a check if the resourcename is handled by this
     * resource wrapper.<p>
     * 
     * It is possible that the path in the resourcename is a virtual path and
     * so has to be translated into a valid path existing in the VFS to read the resource.<p>
     * 
     * @see CmsObjectWrapper#readResource(String, CmsResourceFilter)
     * @see CmsObject#readResource(String, CmsResourceFilter)
     * 
     * @param cms the current users OpenCms context
     * @param resourcename The name of the resource to read (full path)
     * @param filter the resource filter to use while reading
     * 
     * @return the resource that was read or null if it could not be handled by this resource wrapper
     * 
     * @throws CmsException if the resource could not be read for any reason
     */
    CmsResource readResource(CmsObject cms, String resourcename, CmsResourceFilter filter) throws CmsException;

    /**
     * Returns the link to a existing resource in the VFS for the uri.<p>
     * 
     * Turns the virtual path into a real path to a resource in the VFS.<p>
     * 
     * @see #rewriteLink(CmsObject, CmsResource)
     * @see CmsObjectWrapper#restoreLink(String)
     * 
     * @param cms the initialized CmsObject
     * @param uri the (virtual) uri to be restored
     * 
     * @return the uri where to find the resource in the VFS or null if the wrapper is not responsible
     */
    String restoreLink(CmsObject cms, String uri);

    /**
     * Returns the link how it is for the resource after using this resource wrapper.<p>
     * 
     * For example: in the VFS: "/sites/default/index.html" and this resource wrapper 
     * adds the extension "jsp" then link returned should be "/sites/default/index.html.jsp".<p>
     * 
     * @see #restoreLink(CmsObject, String)
     * @see CmsObjectWrapper#rewriteLink(String)
     * 
     * @param cms the initialized CmsObject
     * @param res the resource where to rewrite the path
     * 
     * @return the rewritten path or null if the wrapper is not responsible
     */
    String rewriteLink(CmsObject cms, CmsResource res);

    /**
     * Unlocks a resource.<p>
     * 
     * First should be a check if the resourcename is handled by this
     * resource wrapper.<p>
     * 
     * It is possible that the path in the resourcename is a virtual path and
     * so has to be translated into a valid path existing in the VFS to unlock the resource.<p>
     * 
     * @see CmsObjectWrapper#unlockResource(String)
     * @see CmsObject#unlockResource(String)
     * 
     * @param cms the current users OpenCms context
     * @param resourcename the name of the resource to unlock (full path)
     * 
     * @return true if this request could be handled by this wrapper of false if not
     * 
     * @throws CmsException if something goes wrong
     */
    boolean unlockResource(CmsObject cms, String resourcename) throws CmsException;

    /**
     * Changes the given resource based on the implementation of this wrapper.<p>
     * 
     * For example, some resource types like {@link org.opencms.file.types.CmsResourceTypeJsp} 
     * just get a <code>.jsp</code> extension, while other types like 
     * {@link org.opencms.file.types.CmsResourceTypeXmlPage} are "exploded" into a folder / 
     * file structure.<p>
     * 
     * @see CmsObjectWrapper#getResourcesInFolder(String, CmsResourceFilter)
     * 
     * @param cms the current users OpenCms context
     * @param resource the resource to wrap
     * 
     * @return a wrapped {@link CmsResource} object or <code>null</code> to not change the resource
     */
    CmsResource wrapResource(CmsObject cms, CmsResource resource);

    /**
     * Writes a resource, including it's content.<p>
     * 
     * First should be a check if the resource is handled by this
     * resource wrapper.<p>
     * 
     * It is possible that the path in the resource is a virtual path and
     * so has to be translated into a valid path existing in the VFS to write the resource.<p>
     * 
     * @see CmsObjectWrapper#writeFile(CmsFile)
     * @see CmsObject#writeFile(CmsFile)
     * 
     * @param cms the current cms context
     * @param resource the resource to apply this operation to
     *
     * @return the written resource or null if the action could not be handled by this resource wrapper
     *
     * @throws CmsException if something goes wrong
     */
    CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?