Class ResourceHelper
- java.lang.Object
-
- org.apache.sling.event.impl.support.ResourceHelper
-
public abstract class ResourceHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringBUNDLE_EVENT_STARTEDstatic StringBUNDLE_EVENT_UPDATEDstatic StringPROPERTY_APPLICATIONstatic StringPROPERTY_DISTRIBUTEstatic StringPROPERTY_JOB_IDstatic StringPROPERTY_JOB_TOPICstatic StringPROPERTY_MARKER_READ_ERROR_LISTstatic StringPROPERTY_SCHEDULE_INFOstatic StringPROPERTY_SCHEDULE_INFO_TYPEstatic StringPROPERTY_SCHEDULE_NAMEstatic StringPROPERTY_SCHEDULE_SUSPENDEDstatic StringRESOURCE_TYPE_FOLDERstatic StringRESOURCE_TYPE_JOBstatic StringRESOURCE_TYPE_SCHEDULED_JOBWe use the same resource type as for timed events.
-
Constructor Summary
Constructors Constructor Description ResourceHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>cloneValueMap(org.apache.sling.api.resource.ValueMap vm)static org.apache.sling.api.resource.ResourcecreateAndCommitResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> props)Create the resource and commit itstatic StringfilterName(String resourceName)Filter the node name for not allowed characters and replace them.static StringfilterQueueName(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 voidgetOrCreateBasePath(org.apache.sling.api.resource.ResourceResolver resolver, String path)static org.apache.sling.api.resource.ResourcegetOrCreateResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> props)Creates or gets the resource at the given path.static org.apache.sling.api.resource.ValueMapgetValueMap(org.apache.sling.api.resource.Resource resource)static booleanignoreProperty(String name)Check if this property should be ignored
-
-
-
Field Detail
-
RESOURCE_TYPE_FOLDER
public static final String RESOURCE_TYPE_FOLDER
- See Also:
- Constant Field Values
-
RESOURCE_TYPE_JOB
public static final String RESOURCE_TYPE_JOB
- See Also:
- Constant Field Values
-
RESOURCE_TYPE_SCHEDULED_JOB
public static final String RESOURCE_TYPE_SCHEDULED_JOB
We use the same resource type as for timed events.- See Also:
- Constant Field Values
-
BUNDLE_EVENT_UPDATED
public static final String BUNDLE_EVENT_UPDATED
- See Also:
- Constant Field Values
-
BUNDLE_EVENT_STARTED
public static final String BUNDLE_EVENT_STARTED
- See Also:
- Constant Field Values
-
PROPERTY_SCHEDULE_NAME
public static final String PROPERTY_SCHEDULE_NAME
- See Also:
- Constant Field Values
-
PROPERTY_SCHEDULE_INFO
public static final String PROPERTY_SCHEDULE_INFO
- See Also:
- Constant Field Values
-
PROPERTY_SCHEDULE_INFO_TYPE
public static final String PROPERTY_SCHEDULE_INFO_TYPE
- See Also:
- Constant Field Values
-
PROPERTY_SCHEDULE_SUSPENDED
public static final String PROPERTY_SCHEDULE_SUSPENDED
- See Also:
- Constant Field Values
-
PROPERTY_JOB_ID
public static final String PROPERTY_JOB_ID
- See Also:
- Constant Field Values
-
PROPERTY_JOB_TOPIC
public static final String PROPERTY_JOB_TOPIC
- See Also:
- Constant Field Values
-
PROPERTY_DISTRIBUTE
public static final String PROPERTY_DISTRIBUTE
- See Also:
- Constant Field Values
-
PROPERTY_APPLICATION
public static final String PROPERTY_APPLICATION
- See Also:
- Constant Field Values
-
PROPERTY_MARKER_READ_ERROR_LIST
public static final String PROPERTY_MARKER_READ_ERROR_LIST
-
-
Method Detail
-
ignoreProperty
public static boolean ignoreProperty(String name)
Check if this property should be ignored
-
filterQueueName
public 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 filtered- Parameters:
queueName- the suggested queue name- Returns:
- the filtered queue name
-
filterName
public static String filterName(String resourceName)
Filter the node name for not allowed characters and replace them.- Parameters:
resourceName- The suggested resource name.- Returns:
- The filtered node name.
-
cloneValueMap
public static Map<String,Object> cloneValueMap(org.apache.sling.api.resource.ValueMap vm) throws InstantiationException
- Throws:
InstantiationException
-
getValueMap
public static org.apache.sling.api.resource.ValueMap getValueMap(org.apache.sling.api.resource.Resource resource) throws InstantiationException- Throws:
InstantiationException
-
getOrCreateBasePath
public static void getOrCreateBasePath(org.apache.sling.api.resource.ResourceResolver resolver, String path) throws org.apache.sling.api.resource.PersistenceException- Throws:
org.apache.sling.api.resource.PersistenceException
-
createAndCommitResource
public static org.apache.sling.api.resource.Resource createAndCommitResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> props) throws org.apache.sling.api.resource.PersistenceExceptionCreate the resource and commit it- Parameters:
resolver- The resource resolverpath- The path of the resourceprops- The properties- Returns:
- The created resource
- Throws:
org.apache.sling.api.resource.PersistenceException- If something goes wrong
-
getOrCreateResource
public static org.apache.sling.api.resource.Resource getOrCreateResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> props) throws org.apache.sling.api.resource.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:
org.apache.sling.api.resource.PersistenceException- If something goes wrong
-
-