Package com.dtolabs.rundeck.core.storage
Class StorageUtil
- java.lang.Object
-
- com.dtolabs.rundeck.core.storage.StorageUtil
-
public class StorageUtil extends java.lang.Object
Provides utility methods for use by the storage layer, or implementing plugins.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ISO_8601_FORMAT
Date format for stored date/timestatic java.lang.String
RES_META_RUNDECK_CONTENT_CREATION_TIME
Metadata key for the creation timestatic java.lang.String
RES_META_RUNDECK_CONTENT_LENGTH
Metadata key for the content sizestatic java.lang.String
RES_META_RUNDECK_CONTENT_MODIFY_TIME
Metadata key for the modification timestatic java.lang.String
RES_META_RUNDECK_CONTENT_TYPE
Metadata key for the content-type
-
Constructor Summary
Constructors Constructor Description StorageUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StorageTree
asStorageTree(org.rundeck.storage.api.Tree<ResourceMeta> impl)
Coerce a Tree of ResourceMeta into A StorageTreestatic ResourceMetaBuilder
create()
Create a new builderstatic ResourceMetaBuilder
create(java.util.Map<java.lang.String,java.lang.String> meta)
Create a new builder with a set of metadatastatic boolean
deletePathRecursive(org.rundeck.storage.api.Tree<ResourceMeta> tree, org.rundeck.storage.api.Path path)
Delete all resources and subdirectories of the given resource pathstatic org.rundeck.storage.api.ContentFactory<ResourceMeta>
factory()
static java.lang.String
formatDate(java.util.Date time)
static java.util.Date
parseDate(java.lang.String s, java.util.Date defval)
static <S> StorageTree
resolvedTree(S context, ExtTree<S,ResourceMeta> authStorage)
Create a StorageTree using authorization context and authorizing treestatic ResourceMeta
withStream(java.io.InputStream stream, java.util.Map<java.lang.String,java.lang.String> meta)
static ResourceMeta
withStream(org.rundeck.storage.api.HasInputStream stream, java.util.Map<java.lang.String,java.lang.String> meta)
-
-
-
Field Detail
-
RES_META_RUNDECK_CONTENT_TYPE
public static final java.lang.String RES_META_RUNDECK_CONTENT_TYPE
Metadata key for the content-type- See Also:
- Constant Field Values
-
RES_META_RUNDECK_CONTENT_LENGTH
public static final java.lang.String RES_META_RUNDECK_CONTENT_LENGTH
Metadata key for the content size- See Also:
- Constant Field Values
-
RES_META_RUNDECK_CONTENT_CREATION_TIME
public static final java.lang.String RES_META_RUNDECK_CONTENT_CREATION_TIME
Metadata key for the creation time- See Also:
- Constant Field Values
-
RES_META_RUNDECK_CONTENT_MODIFY_TIME
public static final java.lang.String RES_META_RUNDECK_CONTENT_MODIFY_TIME
Metadata key for the modification time- See Also:
- Constant Field Values
-
ISO_8601_FORMAT
public static final java.lang.String ISO_8601_FORMAT
Date format for stored date/time- See Also:
- Constant Field Values
-
-
Method Detail
-
factory
public static org.rundeck.storage.api.ContentFactory<ResourceMeta> factory()
- Returns:
- a factory for ResourceMeta
-
create
public static ResourceMetaBuilder create()
Create a new builder- Returns:
- builder
-
create
public static ResourceMetaBuilder create(java.util.Map<java.lang.String,java.lang.String> meta)
Create a new builder with a set of metadata- Parameters:
meta
- original metadata- Returns:
- builder
-
withStream
public static ResourceMeta withStream(org.rundeck.storage.api.HasInputStream stream, java.util.Map<java.lang.String,java.lang.String> meta)
- Parameters:
stream
- streammeta
- metadata- Returns:
- Construct a resource
-
withStream
public static ResourceMeta withStream(java.io.InputStream stream, java.util.Map<java.lang.String,java.lang.String> meta)
-
deletePathRecursive
public static boolean deletePathRecursive(org.rundeck.storage.api.Tree<ResourceMeta> tree, org.rundeck.storage.api.Path path)
Delete all resources and subdirectories of the given resource path- Parameters:
tree
- treepath
- path- Returns:
- true if all resources were deleted successfully.
-
asStorageTree
public static StorageTree asStorageTree(org.rundeck.storage.api.Tree<ResourceMeta> impl)
Coerce a Tree of ResourceMeta into A StorageTree- Parameters:
impl
- the tree- Returns:
- a StorageTree
-
parseDate
public static java.util.Date parseDate(java.lang.String s, java.util.Date defval)
-
formatDate
public static java.lang.String formatDate(java.util.Date time)
-
resolvedTree
public static <S> StorageTree resolvedTree(S context, ExtTree<S,ResourceMeta> authStorage)
Create a StorageTree using authorization context and authorizing tree- Type Parameters:
S
- context type- Parameters:
context
- auth contextauthStorage
- authorizing storage tree- Returns:
- StorageTree for the authorization context
-
-