Class PrincipalResource
java.lang.Object
org.apache.sling.api.adapter.SlingAdaptable
org.apache.sling.api.resource.AbstractResource
org.apache.sling.jackrabbit.usermanager.impl.resource.BaseResource
org.apache.sling.jackrabbit.usermanager.impl.resource.PrincipalResource
@Adaptable(adaptableClass=Resource.class,adapters={@Adapter({java.util.Map.class,ValueMap.class,java.security.Principal.class}),@Adapter(condition="If the resource is an PrincipalResource and represents a JCR principal",value=java.security.Principal.class)})
public class PrincipalResource
extends BaseResource
Resource implementation for Principal (SLING-11098)
-
Field Summary
FieldsFields inherited from class org.apache.sling.jackrabbit.usermanager.impl.resource.BaseResource
resourceResolver
Fields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
-
Constructor Summary
ConstructorsConstructorDescriptionPrincipalResource
(Principal principal, ResourceResolver resourceResolver, String path) -
Method Summary
Modifier and TypeMethodDescription<T> T
Calls into the registeredAdapterManager
to adapt this object to the desiredtype
.The resource type is meant to point to rendering/processing scripts, editing dialogs, etc.protected String
toResourceType
(Principal principal) determine the resource type for the principal.toString()
Methods inherited from class org.apache.sling.jackrabbit.usermanager.impl.resource.BaseResource
getPath, getResourceMetadata, getResourceResolver, getResourceSuperType
Methods inherited from class org.apache.sling.api.resource.AbstractResource
getChild, getChildren, getName, getParent, getValueMap, hasChildren, isResourceType, listChildren
Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable
setAdapterManager, unsetAdapterManager
-
Field Details
-
principal
-
-
Constructor Details
-
PrincipalResource
-
-
Method Details
-
toResourceType
determine the resource type for the principal.- Parameters:
principal
- the principal to consider- Returns:
- the resource type
-
getResourceType
Description copied from interface:Resource
The resource type is meant to point to rendering/processing scripts, editing dialogs, etc. It is usually a path in the repository, where scripts and other tools definitions are found, but theResourceResolver
is free to set this to any suitable value such as the primary node type of the JCR node from which the resource is created.If the resource instance represents a resource which is not actually existing, this method returns
Resource.RESOURCE_TYPE_NON_EXISTING
.- Returns:
- The resource type
-
adaptTo
Description copied from class:SlingAdaptable
Calls into the registeredAdapterManager
to adapt this object to the desiredtype
.This method implements a cache of adapters to improve performance. That is repeated calls to this method with the same class will result in the same object to be returned.
- Specified by:
adaptTo
in interfaceAdaptable
- Overrides:
adaptTo
in classSlingAdaptable
- Type Parameters:
T
- The generic type to which this resource is adapted to- Parameters:
type
- The Class object of the target type, such asjavax.jcr.Node.class
orjava.io.File.class
- Returns:
- The adapter target or
null
if the resource cannot adapt to the requested type
-
toString
-