public class RestResourceRegistry extends GenericService
Modifier and Type | Class and Description |
---|---|
static class |
RestResourceRegistry.EndpointSettings
A container for storing the settings of an endpoint method.
|
static class |
RestResourceRegistry.ResourceHolder
Internal class that provides various maps for information on a rest resource.
|
static class |
RestResourceRegistry.ResourceSettings
A container for the setting of a RestResource class/component.
|
static class |
RestResourceRegistry.RestResourceRegistryAdminServlet
Endpoint registry admin servlet.
|
class |
RestResourceRegistry.SubresourceLocatorSettings
Inner class to hold details about a subresource locator method for a resource
|
protected static interface |
RestResourceRegistry.TreeCheckCondition
Interface for checking the condition of a class for use with the tree checker.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string.
|
static java.lang.String |
COLON |
static java.lang.String |
DEFAULT_ACCESS_CONTROLLER_MAP_KEY
Map key for default access controller id configured on endpoint annotation
|
static java.lang.String |
DOC_ENDPOINTS |
static java.lang.String |
DOC_IMPL_CLASS |
static java.lang.String |
DOC_PATH_PARAMS |
static java.lang.String |
DOC_REQUEST |
static java.lang.String |
DOC_RESOURCE_DESCRIPTION |
static java.lang.String |
DOC_RESOURCE_DISPLAY_NAME |
static java.lang.String |
DOC_RESPONSE |
static java.lang.String |
DOC_SAMPLE_REQUEST |
static java.lang.String |
DOC_SAMPLE_RESPONSE |
static java.lang.String |
DOUBLE_SLASH |
static java.lang.String |
JAXRS_ANNOTATIONS_PACKAGE_NAME |
static java.lang.String |
LEFT_CURLY |
protected java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.Object>> |
mClassToResourceMap
Map from implementation class to corresponding json.
|
protected java.util.Map<java.lang.String,java.lang.Class<?>> |
mComponentClasses
Map of nucleus rest resource classes keyed by nucleus component path
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
mEndpointsByIdMap
Map containing all endpoints keyed by endpoint id.
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings>> |
mEndpointsByPathMap
Map containing all endpoints keyed on the template path.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
mEndpointsMap
Map containing all endpoints keyed by class/method key, see
createKey(Class,Method) . |
protected boolean |
mFullPaths
property: fullPaths - boolean flag, true to render full paths for uris
|
protected java.util.Map<java.lang.String,java.lang.Object> |
mGlobalComponents
Map of global nucleus rest resource component instances keyed by nucleus path
|
protected JAXRSApplicationRegistry |
mJAXRSApplicationRegistry
property: jaxrsApplicationRegistry.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
mKnownLinkRelations
Map holding known link relations.
|
protected LinkUtils |
mLinkUtils
property: linkUtils.
|
protected java.lang.Object[] |
mNucleusProviders
property: nucleusProviders.
|
protected java.lang.String[] |
mProviderClassNames
property: providerClassNames.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
mPublicEndpointsMap
Map containing public only endpoints.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.ResourceHolder> |
mResourceHolders
Map of all resource holder keyed by resource id.
|
protected java.lang.Class<? extends RestContext> |
mRestContextClass
property: restContextClass.
|
protected java.lang.Class<?>[] |
mRestResourceClasses
property: restResourceClasses.
|
protected RestUtils |
mRestUtils
property: restUtils.
|
protected java.util.Set<RestResourceRegistry.ResourceHolder> |
mRootResourceHolders
Set of top level root resource infos, i.e.
|
protected boolean |
mWarnForWrongContext
property: warnForWrongContext.
|
static java.lang.String |
PARAM_PLACEHOLDER |
protected static java.lang.String |
RESOURCE_BUNDLE_NAME
Resource Bundle Name.
|
static java.lang.String |
RIGHT_CURLY |
static java.lang.String |
SLASH |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
RestResourceRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
addResourceHolder(RestResourceRegistry.ResourceHolder pResourceHolder)
Adds a new resource holder to the map of all resource holder keyed by resource id.
|
protected void |
addRootResourceHolder(java.lang.String pResourceId)
Sets a resource holder as a root, i.e.
|
protected java.lang.Object |
atgJsonToOrgJson(java.lang.Object pObject)
Convert from atgJson to standard JSON.
|
java.util.Set<java.lang.String> |
buildResourcePaths(RestResourceRegistry.ResourceHolder pResourceHolder) |
java.lang.String |
buildResourceUriTemplatePath(java.lang.String pContextPath,
java.lang.String pResourceId,
boolean pSingular,
java.lang.String... pPathParams)
Constructs a template path for a resource.
|
protected void |
buildTemplates(RestResourceRegistry.ResourceHolder pResourceHolder)
Build all the endpoint uri templates for the given resource info.
|
protected java.lang.String |
checkForHttpMethod(java.lang.reflect.Method pMethod)
Check that the passed in method is annotated with a http method
and returns the String equivalent.
|
protected java.lang.reflect.Method |
checkForPostMatchMethod(java.lang.reflect.Method pEndpointMethod,
java.lang.Class<?> pResourceClass)
Checks for any post action methods for the endpoint method passed in.
|
protected java.lang.reflect.Method |
checkForPreMatchMethod(java.lang.reflect.Method pEndpointMethod,
java.lang.Class<?> pResourceClass)
Checks for any pre action methods for the endpoint method passed in.
|
protected void |
checkForRequestResponseTypes(java.lang.reflect.Method pMethod,
RestResourceRegistry.EndpointSettings pEndpoint)
Checks the method for request/response annotations and sets the
passed in endpoint setting object appropriately.
|
protected void |
checkForWrongContext()
Outputs a warning log message if this registry does not have a context root that matches the current rest context
registry.
|
protected javax.servlet.Servlet |
createAdminServlet()
Creates the admin servlet that can be used to display information
about the RestResource registry in dyn/admin.
|
protected RestResourceRegistry.EndpointSettings |
createEndpointSettings(RestResourceRegistry.ResourceSettings pResourceSettings,
java.lang.reflect.Method pMethod,
java.lang.String pHttpMethod)
Creates the endpoint settings for an endpoint method.
|
java.lang.String |
createKey()
Returns the key to the rest resource in the current rest context.
|
java.lang.String |
createKey(java.lang.Class pClass,
java.lang.reflect.Method pMethod)
Generates a key that can be used to identify an endpoint.
|
RestContext |
createRestContext()
Instantiates a new RestContext for a request.
|
protected void |
doScanEndpoints()
Builds up a number of maps containing endpoint information.
|
void |
doStartService()
Executes when the service starts up.
|
protected java.lang.Class |
findAnnotatedClass(java.lang.Class<?> pClass,
java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotation)
Scans the up the hierarchy of the class specified to find a class with the annotation
specified.
|
protected java.lang.reflect.Method |
findAnnotatedMethod(java.lang.reflect.Method pMethod,
java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotation)
Scans the up the hierarchy of the class specified to find a method with the annotation
specified.
|
java.util.Set<java.lang.Class<?>> |
getAllResourceClasses()
Gets a set of all the resource classes in the registry.
|
java.lang.String[] |
getAuthRequiredAccessTypes()
get AuthRequiredAccessTypes.
|
protected java.lang.annotation.Annotation |
getClassAnnotation(java.lang.Class<?> pClass,
java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotationClass)
Searches the given class and its super classes/interfaces to find an annotation for the given annotation class.
|
protected java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.Object>> |
getClassToResourceMap()
Returns the implementation class to corresponding json.
|
java.lang.String |
getContextRoot()
Get ContextRoot.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
getEndpointsByIdMap()
Get all the endpoints keyed by endpoint id.
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings>> |
getEndpointsByPathMap()
Get all the endpoints keyed and sorted by template path.
|
RestResourceRegistry.EndpointSettings |
getEndpointSettings()
Gets the current endpoint settings based on the current rest resource in
the current rest context.
|
RestResourceRegistry.EndpointSettings |
getEndpointSettings(java.lang.String pPath,
java.lang.String pHttpMethod)
Gets the endpoint settings for a specific path and http method.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
getEndpointsMap()
Get all of the endpoints keyed by class/method key.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getGlobalNucleusRestResourceComponents()
Returns references to any global nucleus rest resource components.
|
protected static java.util.Set<java.lang.Class<?>> |
getInheritance(java.lang.Class<?> pClass)
Utility method to get the inherited classes and implemented interfaces
of the specified class.
|
JAXRSApplicationRegistry |
getJAXRSApplicationRegistry()
Reference to the jaxrs application registry.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
getKnownLinkRelations()
Returns a map of known link relations keyed by relation with value of endpoint settings.
|
LinkUtils |
getLinkUtils()
Reference to a link utils component.
|
int |
getMaxWildcards()
Returns MaxWildcards.
|
protected java.lang.String |
getMethodPath(java.lang.reflect.Method pMethod)
Determines the uri path for an endpoint method by looking for a Path annotation.
|
protected java.lang.Class<?>[] |
getNonGlobalNucleusRestResourceClasses()
Returns the classes for any configured non global nucleus rest resources.
|
java.lang.Object[] |
getNucleusProviders()
Get an array of configured provider nucleus component instances, e.g.
|
protected java.util.Map<java.lang.String,java.lang.Class<?>> |
getNucleusRestResourceClasses()
Gets a map of all nucleus rest resource classes in the registry keyed by component path.
|
java.lang.String[] |
getNucleusRestResources()
Get the component paths for the nucleus rest resources.
|
protected int |
getNumberOfWildcardsInPath(java.lang.String pPath)
Returns a count of the number of wildcards in the template path.
|
RestResourceRegistry.ResourceSettings |
getOrCreateResourceSettings(java.lang.String pResourceId,
java.lang.Class<?> pResourceClass)
Get a resource settings by id or create a new entry if needed.
|
protected java.lang.Class<?>[] |
getProviderClasses()
Get the provider classes.
|
java.lang.String[] |
getProviderClassNames()
Get the provider class names.
|
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> |
getPublicEndpointsMap()
Get the public endpoints keyed by class/method key.
|
RelationsRegistry |
getRelationsRegistry()
Get RelationsRegistry.
|
atg.service.jaxrs.cache.RepresentationCache |
getRepresentationCache()
Returns the representationCache property.
|
protected static java.lang.String |
getResource(java.lang.String pResourceKey)
Returns a user message from the resource bundle based on the user's locale.
|
protected static java.lang.String |
getResource(java.lang.String pResourceKey,
java.lang.Object... pArgs)
Returns a user message from the resource bundle based on the user's locale.
|
RestResourceRegistry.ResourceHolder |
getResourceHolder(java.lang.String pResourceId)
Gets the resource holder for the given resource id
|
java.util.Map<java.lang.String,RestResourceRegistry.ResourceHolder> |
getResourceHolders()
Gets the map of all resource holder keyed by resource id.
|
atg.service.jaxrs.ResourceLookupService |
getResourceLookupService()
Get ResourceLookupService.
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> |
getResourceMap()
Get ResourceMap.
|
java.lang.Class<? extends RestContext> |
getRestContextClass()
Class to instantiate to hold the rest context for a request.
|
atg.service.jaxrs.RestLockService |
getRestLockService()
Returns the restLockService property.
|
java.lang.Class<?>[] |
getRestResourceClasses()
Get the classes for rest resources that cannot be nucleus components, usually because they want their scope to be
managed by the jaxrs provider instead.
|
RestUtils |
getRestUtils()
Reference to a
RestUtils component. |
java.util.Set<RestResourceRegistry.ResourceHolder> |
getRootResourceHolders()
Gets the set of resource holder for the root resources, i.e.
|
java.lang.Object |
getSubresource(java.lang.String pSubresourceId)
Returns an object that can be returned from a subresource locator method for the given subresource id.
|
java.lang.Object |
getSubresourceByEndpointId(java.lang.String pEndpointId)
Returns an object that can be returned from a subresource locator method for the given endpoint method id.
|
java.lang.String |
getTerminationDate()
Returns a string describing when the api version represented by this registry will not become deprecated and
will not be actively supported.
|
protected java.lang.String |
getTopUrl(java.lang.Class pClass)
Returned the URL as specified by the path annotation on the class.
|
javax.transaction.TransactionManager |
getTransactionManager()
Get TransactionManager.
|
atg.service.jaxrs.ValidationService |
getValidationService() |
java.lang.String |
getVersion()
Method to try and parse the version from the context root.
|
boolean |
getWarnForWrongContext()
Flag, true if this registry should output a warning log if public methods are accessed and this registry
context root does not match the current rest context registry context root.
|
protected boolean |
hasAnnotation(java.lang.Class<?> pClass,
java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotation)
Determines whether a class contains an annotation.
|
protected boolean |
hasJAXRSFieldAnnotation(java.lang.Class pClass)
Determines if the class has an JAXRS specific annotation.
|
boolean |
isActive()
Returns true if the api version represented by this registry has not been deprecated and is actively supported.
|
boolean |
isAddJsonDocSkeletons()
Returns property addJsonDocSkeletons.
|
boolean |
isEnableCrossDomainRequests()
Get EnableCrossDomainRequests.
|
boolean |
isPublicOnlyEndpoints()
Get PublicOnlyEndpoints.
|
protected java.lang.String |
methodPathPlaceholderParams(java.lang.String pPath)
Get a method path with any param levels turned into generic placeholders.
|
protected RestResourceRegistry.ResourceSettings |
processRestResourceClass(java.lang.Class pClass,
java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pTempPublicEndpointsMap,
java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pTempEndpointsMap,
java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pTempEndpointsByIdMap)
Processes each rest resource class to extract endpoint information from them.
|
protected java.util.Set<java.lang.String> |
recursePaths(RestResourceRegistry.ResourceHolder pResource,
java.util.Set<java.lang.String> pPaths) |
protected void |
scanEndpoints()
Builds up a number of maps containing endpoint information.
|
void |
setActive(boolean pActive)
Set to true if the api version represented by this registry has not been deprecated and is actively supported.
|
void |
setAddJsonDocSkeletons(boolean pAddJsonDocSkeletons)
Sets property addJsonDocSkeletons.
|
void |
setAuthRequiredAccessTypes(java.lang.String[] pAuthRequiredAccessTypes)
set AuthRequiredAccessTypes.
|
void |
setContextRoot(java.lang.String pContextRoot)
Set ContextRoot.
|
void |
setEnableCrossDomainRequests(boolean pEnableCrossDomainRequests)
Set EnableCrossDomainRequests.
|
void |
setFullPaths(boolean pFullPaths)
Setter for the boolean property which is true if full paths should be used rather than absolute paths.
|
void |
setJAXRSApplicationRegistry(JAXRSApplicationRegistry pJAXRSApplicationRegistry)
Reference to the jaxrs application registry.
|
void |
setLinkUtils(LinkUtils pLinkUtils)
Reference to a
LinkUtils component. |
void |
setMaxWildcards(int pMaxWildcards)
Set MaxWildcards property.
|
void |
setNucleusProviders(java.lang.Object[] pNucleusProviders)
Set an array of configured provider component instances, e.g.
|
void |
setNucleusRestResources(java.lang.String[] pNucleusRestResources)
Set the component paths for the nucleus rest resources.
|
void |
setProviderClassNames(java.lang.String[] pProviderClassNames)
Set the provider class names.
|
void |
setPublicOnlyEndpoints(boolean pPublicOnlyEndpoints)
Set PublicOnlyEndpoints.
|
void |
setRelationsRegistry(RelationsRegistry pRelationsRegistry)
Set RelationsRegistry.
|
void |
setRepresentationCache(atg.service.jaxrs.cache.RepresentationCache pRepresentationCache)
Returns the representationcache property.
|
void |
setResourceHolders(java.util.Map<java.lang.String,RestResourceRegistry.ResourceHolder> pResourceHolders)
Sets the map of all resource holder keyed by resource id.
|
void |
setResourceLookupService(atg.service.jaxrs.ResourceLookupService pResourceLookupService)
Set ResourceLookupService.
|
protected void |
setResourceMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> pResourceMap)
Set ResourceMap.
|
void |
setRestContextClass(java.lang.Class<? extends RestContext> pRestContextClass)
Class to instantiate to hold the rest context for a request.
|
void |
setRestLockService(atg.service.jaxrs.RestLockService pRestLockService)
Returns the restLockService property.
|
void |
setRestResourceClasses(java.lang.Class<?>[] pRestResourceClasses)
Set the classes for rest resources that cannot be nucleus components, usually because they want their scope to be
managed by the jaxrs provider instead.
|
void |
setRestUtils(RestUtils pRestUtils)
Reference to a
RestUtils component. |
void |
setTerminationDate(java.lang.String pTerminationDate)
Sets a string describing when the api version represented by this registry will not become deprecated and
will not be actively supported.
|
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
set TransactionManager.
|
void |
setValidationService(atg.service.jaxrs.ValidationService pValidationService) |
void |
setWarnForWrongContext(boolean pWarnForWrongContext)
Flag, true if this registry should output a warning log if public methods are accessed and this registry
context root does not match the current rest context registry context root.
|
boolean |
useFullPaths()
Getter for the boolean property which is true if full paths should be used rather than absolute paths.
|
addLogListener, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService, toString
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static final java.lang.String CLASS_VERSION
protected static final java.lang.String RESOURCE_BUNDLE_NAME
public static final java.lang.String LEFT_CURLY
public static final java.lang.String RIGHT_CURLY
public static final java.lang.String SLASH
public static final java.lang.String DOUBLE_SLASH
public static final java.lang.String PARAM_PLACEHOLDER
public static final java.lang.String COLON
public static final java.lang.String DEFAULT_ACCESS_CONTROLLER_MAP_KEY
public static final java.lang.String DOC_RESOURCE_DISPLAY_NAME
public static final java.lang.String DOC_RESOURCE_DESCRIPTION
public static final java.lang.String DOC_ENDPOINTS
public static final java.lang.String DOC_IMPL_CLASS
public static final java.lang.String DOC_PATH_PARAMS
public static final java.lang.String DOC_SAMPLE_RESPONSE
public static final java.lang.String DOC_SAMPLE_REQUEST
public static final java.lang.String DOC_REQUEST
public static final java.lang.String DOC_RESPONSE
public static final java.lang.String JAXRS_ANNOTATIONS_PACKAGE_NAME
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> mPublicEndpointsMap
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> mEndpointsByIdMap
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> mEndpointsMap
createKey(Class,Method)
.protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings>> mEndpointsByPathMap
protected java.util.Map<java.lang.String,java.lang.Object> mGlobalComponents
protected java.util.Map<java.lang.String,java.lang.Class<?>> mComponentClasses
protected java.util.Map<java.lang.String,RestResourceRegistry.ResourceHolder> mResourceHolders
protected java.util.Set<RestResourceRegistry.ResourceHolder> mRootResourceHolders
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> mKnownLinkRelations
protected boolean mFullPaths
protected JAXRSApplicationRegistry mJAXRSApplicationRegistry
protected java.lang.Class<? extends RestContext> mRestContextClass
protected LinkUtils mLinkUtils
protected RestUtils mRestUtils
protected boolean mWarnForWrongContext
protected java.lang.String[] mProviderClassNames
protected java.lang.Object[] mNucleusProviders
protected java.lang.Class<?>[] mRestResourceClasses
protected java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.Object>> mClassToResourceMap
public java.util.Map<java.lang.String,RestResourceRegistry.ResourceHolder> getResourceHolders()
public void setResourceHolders(java.util.Map<java.lang.String,RestResourceRegistry.ResourceHolder> pResourceHolders)
pResourceHolders
- map of all resource holder keyed by resource id.public RestResourceRegistry.ResourceHolder getResourceHolder(java.lang.String pResourceId)
pResourceId
- id of the resource holder to returnpublic void addResourceHolder(RestResourceRegistry.ResourceHolder pResourceHolder)
pResourceHolder
- resource holder to addpublic java.util.Set<RestResourceRegistry.ResourceHolder> getRootResourceHolders()
protected void addRootResourceHolder(java.lang.String pResourceId)
pResourceId
- id of resource to make a rootpublic RestResourceRegistry.ResourceSettings getOrCreateResourceSettings(java.lang.String pResourceId, java.lang.Class<?> pResourceClass)
pResourceId
- resource idpublic boolean useFullPaths()
public void setFullPaths(boolean pFullPaths)
pFullPaths
- true if full paths should be usedpublic JAXRSApplicationRegistry getJAXRSApplicationRegistry()
public void setJAXRSApplicationRegistry(JAXRSApplicationRegistry pJAXRSApplicationRegistry)
pJAXRSApplicationRegistry
- JAXRSApplicationRegistry to register withpublic java.lang.Class<? extends RestContext> getRestContextClass()
RestContext
class.public void setRestContextClass(java.lang.Class<? extends RestContext> pRestContextClass)
RestContext
class.pRestContextClass
- RestContext class or subclass to use.public LinkUtils getLinkUtils()
public void setLinkUtils(LinkUtils pLinkUtils)
LinkUtils
component.
LinkUtils provides utility methods for managing links and resource references.pLinkUtils
- LinkUtils to usepublic RestUtils getRestUtils()
RestUtils
component.
RestUtils provides utility methods for endpoint developers.public void setRestUtils(RestUtils pRestUtils)
RestUtils
component.
RestUtils provides utility methods for endpoint developers.pRestUtils
- RestUtils to usepublic boolean getWarnForWrongContext()
public void setWarnForWrongContext(boolean pWarnForWrongContext)
pWarnForWrongContext
- true if this registry should output a warning log for incorrect context root.public void setProviderClassNames(java.lang.String[] pProviderClassNames)
pProviderClassNames
- the provider class namespublic java.lang.String[] getProviderClassNames()
protected java.lang.Class<?>[] getProviderClasses()
public java.lang.Object[] getNucleusProviders()
public void setNucleusProviders(java.lang.Object[] pNucleusProviders)
pNucleusProviders
- the provider instances to be made available.public void setRestResourceClasses(java.lang.Class<?>[] pRestResourceClasses)
pRestResourceClasses
- the array of rest resource classes.public java.lang.Class<?>[] getRestResourceClasses()
public void setNucleusRestResources(java.lang.String[] pNucleusRestResources)
pNucleusRestResources
- the array of nucleus paths.public java.lang.String[] getNucleusRestResources()
public void setMaxWildcards(int pMaxWildcards)
pMaxWildcards
- the MaxWildcards propertypublic int getMaxWildcards()
public void setAddJsonDocSkeletons(boolean pAddJsonDocSkeletons)
pAddJsonDocSkeletons
- Whether to add JSON Doc Skeletonspublic boolean isAddJsonDocSkeletons()
protected java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.Object>> getClassToResourceMap()
public atg.service.jaxrs.RestLockService getRestLockService()
public void setRestLockService(atg.service.jaxrs.RestLockService pRestLockService)
pRestLockService
- The restLockService property.public atg.service.jaxrs.cache.RepresentationCache getRepresentationCache()
public void setRepresentationCache(atg.service.jaxrs.cache.RepresentationCache pRepresentationCache)
pRepresentationCache
- The restLockService property.public void setAuthRequiredAccessTypes(java.lang.String[] pAuthRequiredAccessTypes)
pAuthRequiredAccessTypes
- the AuthRequiredAccessTypespublic java.lang.String[] getAuthRequiredAccessTypes()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
pTransactionManager
- the TransactionManagerpublic javax.transaction.TransactionManager getTransactionManager()
public void setContextRoot(java.lang.String pContextRoot)
pContextRoot
- the ContextRootpublic java.lang.String getContextRoot()
public java.lang.String getVersion()
public boolean isActive()
public void setActive(boolean pActive)
pActive
- true if supported else false if deprecatedpublic java.lang.String getTerminationDate()
public void setTerminationDate(java.lang.String pTerminationDate)
pTerminationDate
- string describing when this api version is not actively supportedprotected void setResourceMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> pResourceMap)
pResourceMap
- the ResourceMapprotected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getResourceMap()
public void setEnableCrossDomainRequests(boolean pEnableCrossDomainRequests)
pEnableCrossDomainRequests
- the EnableCrossDomainRequestspublic boolean isEnableCrossDomainRequests()
public void setPublicOnlyEndpoints(boolean pPublicOnlyEndpoints)
pPublicOnlyEndpoints
- the PublicOnlyEndpointspublic boolean isPublicOnlyEndpoints()
public void setRelationsRegistry(RelationsRegistry pRelationsRegistry)
pRelationsRegistry
- the RelationsRegistrypublic RelationsRegistry getRelationsRegistry()
public void setResourceLookupService(atg.service.jaxrs.ResourceLookupService pResourceLookupService)
pResourceLookupService
- the ResourceLookupServicepublic atg.service.jaxrs.ResourceLookupService getResourceLookupService()
public atg.service.jaxrs.ValidationService getValidationService()
public void setValidationService(atg.service.jaxrs.ValidationService pValidationService)
pValidationService
- the validationService to setprotected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> getPublicEndpointsMap()
createKey(Class,Method)
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> getEndpointsMap()
createKey(Class,Method)
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> getEndpointsByIdMap()
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings>> getEndpointsByPathMap()
protected java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> getKnownLinkRelations()
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting updoScanEndpoints()
public RestContext createRestContext()
protected void scanEndpoints()
doScanEndpoints()
protected void doScanEndpoints()
protected RestResourceRegistry.ResourceSettings processRestResourceClass(java.lang.Class pClass, java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pTempPublicEndpointsMap, java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pTempEndpointsMap, java.util.Map<java.lang.String,RestResourceRegistry.EndpointSettings> pTempEndpointsByIdMap) throws RestException
RestResourceRegistry.ResourceSettings
object that describes the
endpoint and adds this to the appropriate endpoint maps that the registry holds.pClass
- The class being processed.pTempPublicEndpointsMap
- The map that public endpoints will be added to.pTempEndpointsMap
- The map that all endpoints will be added to keyed by class/method key.pTempEndpointsByIdMap
- The map that all endpoints will be added to keyed by endpoint id.RestException
- Should a processing error happen.for information on how the endpoint setting are
created.
protected void buildTemplates(RestResourceRegistry.ResourceHolder pResourceHolder) throws RestException
pResourceHolder
- resource info for whose endpoints we will build templatesRestException
public java.util.Set<java.lang.String> buildResourcePaths(RestResourceRegistry.ResourceHolder pResourceHolder) throws RestException
RestException
protected java.util.Set<java.lang.String> recursePaths(RestResourceRegistry.ResourceHolder pResource, java.util.Set<java.lang.String> pPaths) throws RestException
RestException
protected RestResourceRegistry.EndpointSettings createEndpointSettings(RestResourceRegistry.ResourceSettings pResourceSettings, java.lang.reflect.Method pMethod, java.lang.String pHttpMethod) throws RestException
pResourceSettings
- The resource settings for the resource this endpoint belongs topMethod
- The method with the Endpoint annotation to process.pHttpMethod
- The http method of the endpoint, e.g. GETnull
.RestException
protected java.lang.reflect.Method checkForPreMatchMethod(java.lang.reflect.Method pEndpointMethod, java.lang.Class<?> pResourceClass)
pEndpointMethod
- the endpoint methodpResourceClass
- the resource classprotected java.lang.reflect.Method checkForPostMatchMethod(java.lang.reflect.Method pEndpointMethod, java.lang.Class<?> pResourceClass)
pEndpointMethod
- the endpoint methodpResourceClass
- the resource classpublic java.lang.Object getSubresource(java.lang.String pSubresourceId) throws RestException
getSubresourceByEndpointId(String)
method should be used.pSubresourceId
- The id of the subresource to be returned from the locator methodRestException
- for problems obtaining the subresource object or if the id is not a valid subresource idpublic java.lang.Object getSubresourceByEndpointId(java.lang.String pEndpointId) throws RestException
pEndpointId
- the endpoint id whose resource reference will be returnedRestException
- if the endpoint id is not valid or isn't within a subresourcepublic java.lang.String buildResourceUriTemplatePath(java.lang.String pContextPath, java.lang.String pResourceId, boolean pSingular, java.lang.String... pPathParams) throws RestException
pContextPath
- The uri for the current request context. Can be null if the target resource is not a sub-resource.pResourceId
- The id of the resource.pSingular
- true to return the singular uri for the given resource idRestException
- if the uri template could not be determined or the inputs were invalid.protected boolean hasAnnotation(java.lang.Class<?> pClass, java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotation)
pClass
- The class to check.pAnnotation
- The annotation to check for.true
if the annotation exists.protected java.lang.Class findAnnotatedClass(java.lang.Class<?> pClass, java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotation)
pClass
- The class to start from.pAnnotation
- The annotation to find.null
.protected java.lang.annotation.Annotation getClassAnnotation(java.lang.Class<?> pClass, java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotationClass)
pClass
- Initial class to search through it and its super classespAnnotationClass
- Annotation class to search forprotected java.lang.reflect.Method findAnnotatedMethod(java.lang.reflect.Method pMethod, java.lang.Class<? extends java.lang.annotation.Annotation> pAnnotation)
pMethod
- The method to search on.pAnnotation
- The annotation to search for.null
protected static java.util.Set<java.lang.Class<?>> getInheritance(java.lang.Class<?> pClass)
pClass
- The class to start with.protected boolean hasJAXRSFieldAnnotation(java.lang.Class pClass)
pClass
- The class being inspected.true
if there are annotations from the JAXRS package.protected java.lang.String getMethodPath(java.lang.reflect.Method pMethod)
pMethod
- The method to determine the path for.protected java.lang.String getTopUrl(java.lang.Class pClass)
pClass
- The class to get the URL from.null
will be returned.public java.lang.String createKey(java.lang.Class pClass, java.lang.reflect.Method pMethod)
pClass
- The name of the class from which the endpoint comes.pMethod
- The method implementing the endpoint.public java.lang.String createKey()
public RestResourceRegistry.EndpointSettings getEndpointSettings()
public RestResourceRegistry.EndpointSettings getEndpointSettings(java.lang.String pPath, java.lang.String pHttpMethod)
pPath
- The endpoint path, e.g. /order/{orderId}pHttpMethod
- The endpoint http method, e.g. GETnull
.protected void checkForWrongContext()
setWarnForWrongContext(boolean)
with false.protected java.lang.String checkForHttpMethod(java.lang.reflect.Method pMethod)
pMethod
- The endpoint method to check.protected java.lang.String methodPathPlaceholderParams(java.lang.String pPath)
/{orderId}/commerceitems
would change to /{}/commerceitems
pPath
- The path.protected int getNumberOfWildcardsInPath(java.lang.String pPath)
pPath
- the template pathprotected void checkForRequestResponseTypes(java.lang.reflect.Method pMethod, RestResourceRegistry.EndpointSettings pEndpoint)
pMethod
- The endpoint method to check for annotations.pEndpoint
- The endpoint settings object to store the annotation information in.protected javax.servlet.Servlet createAdminServlet()
createAdminServlet
in class GenericService
RestResourceRegistry.RestResourceRegistryAdminServlet
protected static java.lang.String getResource(java.lang.String pResourceKey)
pResourceKey
- The key of the resource to look in the bundle for.ResourceUtils
protected static java.lang.String getResource(java.lang.String pResourceKey, java.lang.Object... pArgs)
pResourceKey
- The key of the resource to look in the bundle for.pArgs
- The arguments to use in the formatted user message.ResourceUtils
protected java.lang.Object atgJsonToOrgJson(java.lang.Object pObject)
pObject
- The object containing atg JSON.protected java.util.Map<java.lang.String,java.lang.Object> getGlobalNucleusRestResourceComponents()
protected java.lang.Class<?>[] getNonGlobalNucleusRestResourceClasses()
protected java.util.Map<java.lang.String,java.lang.Class<?>> getNucleusRestResourceClasses()
public java.util.Set<java.lang.Class<?>> getAllResourceClasses()