Class ResourceHelper
java.lang.Object
org.apache.sling.event.impl.support.ResourceHelper
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
We use the same resource type as for timed events. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Resource
createAndCommitResource
(ResourceResolver resolver, String path, Map<String, Object> props) Create the resource and commit itstatic String
filterName
(String resourceName) Filter the node name for not allowed characters and replace them.static String
filterQueueName
(String queueName) Filter the queue name for not allowed characters and replace them - with the exception of the main queue, which will not be filteredstatic void
getOrCreateBasePath
(ResourceResolver resolver, String path) static Resource
getOrCreateResource
(ResourceResolver resolver, String path, Map<String, Object> props) Creates or gets the resource at the given path.static ValueMap
getValueMap
(Resource resource) static boolean
ignoreProperty
(String name) Check if this property should be ignored
-
Field Details
-
RESOURCE_TYPE_FOLDER
- See Also:
-
RESOURCE_TYPE_JOB
- See Also:
-
RESOURCE_TYPE_SCHEDULED_JOB
We use the same resource type as for timed events.- See Also:
-
BUNDLE_EVENT_UPDATED
- See Also:
-
BUNDLE_EVENT_STARTED
- See Also:
-
PROPERTY_SCHEDULE_NAME
- See Also:
-
PROPERTY_SCHEDULE_INFO
- See Also:
-
PROPERTY_SCHEDULE_INFO_TYPE
- See Also:
-
PROPERTY_SCHEDULE_SUSPENDED
- See Also:
-
PROPERTY_JOB_ID
- See Also:
-
PROPERTY_JOB_TOPIC
- See Also:
-
PROPERTY_DISTRIBUTE
- See Also:
-
PROPERTY_APPLICATION
- See Also:
-
PROPERTY_MARKER_READ_ERROR_LIST
-
-
Constructor Details
-
ResourceHelper
public ResourceHelper()
-
-
Method Details
-
ignoreProperty
Check if this property should be ignored -
filterQueueName
Filter the queue name for not allowed characters and replace them - with the exception of the main queue, which will not be filtered- Parameters:
queueName
- the suggested queue name- Returns:
- the filtered queue name
-
filterName
Filter the node name for not allowed characters and replace them.- Parameters:
resourceName
- The suggested resource name.- Returns:
- The filtered node name.
-
cloneValueMap
- Throws:
InstantiationException
-
getValueMap
- Throws:
InstantiationException
-
getOrCreateBasePath
public static void getOrCreateBasePath(ResourceResolver resolver, String path) throws PersistenceException - Throws:
PersistenceException
-
createAndCommitResource
public static Resource createAndCommitResource(ResourceResolver resolver, String path, Map<String, Object> props) throws PersistenceExceptionCreate the resource and commit it- Parameters:
resolver
- The resource resolverpath
- The path of the resourceprops
- The properties- Returns:
- The created resource
- Throws:
PersistenceException
- If something goes wrong
-
getOrCreateResource
public static Resource getOrCreateResource(ResourceResolver resolver, String path, Map<String, Object> props) throws PersistenceExceptionCreates or gets the resource at the given path. If any resource along the parent path needs to be created, this is committed immediately. The resource itself is not committed. This is the task of the caller.- Parameters:
resolver
- The resource resolver to use for creationpath
- The full path to be createdprops
- The properties of the new resource.- Returns:
- The resource for the path.
- Throws:
PersistenceException
- If something goes wrong
-