Class RemoteReader
- java.lang.Object
-
- com.composum.sling.nodes.mount.remote.RemoteReader
-
public class RemoteReader extends Object
reads the resource data using default Sling GET servlet JSON requests
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classRemoteReader.RemoteBinary
-
Field Summary
Fields Modifier and Type Field Description static Map<String,Boolean>BOOLEAN_VALUESstatic String[]DATE_FORMATSstatic PatternDAV_HREFstatic StringDAV_NSstatic StringDAV_TYPE_FOLDERstatic StringDAV_TYPE_UNKNOWNstatic StringNS_PREFIX_JCRprotected RemoteProviderproviderstatic PatternSTRING_TYPE_PREFIX
-
Constructor Summary
Constructors Constructor Description RemoteReader(@NotNull RemoteProvider provider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDavProperty(@NotNull RemoteResource resource, @NotNull org.apache.jackrabbit.webdav.property.DavProperty<?> property)protected voidaddDavProperty(@NotNull RemoteResource resource, @Nullable String ns, @NotNull org.apache.jackrabbit.webdav.property.DavProperty<?> property)protected voidadjustDavType(@NotNull RemoteResource resource, boolean isFolder)@NotNull StringgetDavUrl(@NotNull RemoteResource resource)@NotNull StringgetDavUrl(@NotNull String resourcePath)@NotNull StringgetJsonUrl(@NotNull RemoteResource resource)@NotNull StringgetJsonUrl(@NotNull String path)protected intloadDavResource(@NotNull RemoteResource resource, @NotNull org.apache.http.client.HttpClient httpClient)In the case that a servlet at the remote system blocks the JSON access a WebDAV request is used as fallback to retrieve the resources properties and children.protected voidloadDavResource(@NotNull RemoteResource resource, @NotNull org.apache.jackrabbit.webdav.MultiStatusResponse response)protected voidloadJsonResource(@NotNull RemoteResource resource, @NotNull com.google.gson.stream.JsonReader jsonReader)protected intloadJsonResource(@NotNull RemoteResource resource, @NotNull org.apache.http.client.HttpClient httpClient)The preferred resource loading using the default Sling GET servlet to read the properties and children of the resource to load.@Nullable RemoteResourceloadResource(@NotNull RemoteResource resource, boolean isKnownChild)Loads the properties and children into the given resource@NotNull StringremotePath(@NotNull RemoteResource resource)static @Nullable BooleantoBoolean(@NotNull String string)static @Nullable CalendartoDate(@NotNull String string)Objecttransform(String string)
-
-
-
Field Detail
-
NS_PREFIX_JCR
public static final String NS_PREFIX_JCR
- See Also:
- Constant Field Values
-
DAV_HREF
public static final Pattern DAV_HREF
-
provider
protected final RemoteProvider provider
-
DAV_NS
public static final String DAV_NS
- See Also:
- Constant Field Values
-
DAV_TYPE_FOLDER
public static final String DAV_TYPE_FOLDER
- See Also:
- Constant Field Values
-
DAV_TYPE_UNKNOWN
public static final String DAV_TYPE_UNKNOWN
- See Also:
- Constant Field Values
-
STRING_TYPE_PREFIX
public static final Pattern STRING_TYPE_PREFIX
-
DATE_FORMATS
public static final String[] DATE_FORMATS
-
-
Constructor Detail
-
RemoteReader
public RemoteReader(@NotNull @NotNull RemoteProvider provider)
-
-
Method Detail
-
remotePath
@NotNull public @NotNull String remotePath(@NotNull @NotNull RemoteResource resource)
- Returns:
- the resoures repository path on the remote system
-
loadResource
@Nullable public @Nullable RemoteResource loadResource(@NotNull @NotNull RemoteResource resource, boolean isKnownChild)
Loads the properties and children into the given resource- Parameters:
resource- the resource to load / updateisKnownChild- 'true' if the resource is cached already (as a child of another resource) and cannot be ignored- Returns:
- the loaded resource; 'null' if the resource couldn't be loaded
-
getDavUrl
@NotNull public @NotNull String getDavUrl(@NotNull @NotNull RemoteResource resource)
-
loadDavResource
protected int loadDavResource(@NotNull @NotNull RemoteResource resource, @NotNull @NotNull org.apache.http.client.HttpClient httpClient)In the case that a servlet at the remote system blocks the JSON access a WebDAV request is used as fallback to retrieve the resources properties and children.- Parameters:
resource- the resource to load / updatehttpClient- the client instance to execute the request- Returns:
- the status code of the request response
-
adjustDavType
protected void adjustDavType(@NotNull @NotNull RemoteResource resource, boolean isFolder)
-
loadDavResource
protected void loadDavResource(@NotNull @NotNull RemoteResource resource, @NotNull @NotNull org.apache.jackrabbit.webdav.MultiStatusResponse response)
-
addDavProperty
protected void addDavProperty(@NotNull @NotNull RemoteResource resource, @NotNull @NotNull org.apache.jackrabbit.webdav.property.DavProperty<?> property)
-
addDavProperty
protected void addDavProperty(@NotNull @NotNull RemoteResource resource, @Nullable @Nullable String ns, @NotNull @NotNull org.apache.jackrabbit.webdav.property.DavProperty<?> property)
-
getJsonUrl
@NotNull public @NotNull String getJsonUrl(@NotNull @NotNull RemoteResource resource)
-
loadJsonResource
protected int loadJsonResource(@NotNull @NotNull RemoteResource resource, @NotNull @NotNull org.apache.http.client.HttpClient httpClient)The preferred resource loading using the default Sling GET servlet to read the properties and children of the resource to load.- Parameters:
resource- the resource to load / updatehttpClient- the client instance to execute the request- Returns:
- the status code of the request response
-
loadJsonResource
protected void loadJsonResource(@NotNull @NotNull RemoteResource resource, @NotNull @NotNull com.google.gson.stream.JsonReader jsonReader) throws IOException- Throws:
IOException
-
-