org.wso2.carbon.registry.app
Class Utils

java.lang.Object
  extended by org.wso2.carbon.registry.app.Utils

public class Utils
extends Object

Utility class containing various Registry APP (Atom Publishing Protocol) implementation related functionality.


Constructor Summary
Utils()
           
 
Method Summary
static String calculateEntityTag(Resource r)
          Calculate the entity tag based on the resource, this is equivalent to the RegistryAdapter::calculateEntityTag function which calculate entity tag based on the feed
static String encodeRegistryPath(String path)
          Method to encode a registry path.
static EmbeddedRegistryService getEmbeddedRegistryService()
          Method to obtain the embedded registry service instance.
static org.apache.abdera.model.Link getLinkWithRel(org.apache.abdera.model.Entry entry, String rel)
           
static UserRegistry getRegistry(javax.servlet.http.HttpServletRequest request)
          Method to obtain the registry from the session.
static String getUUID(String uri)
          Generates a UUID for the given URI.
static void setEmbeddedRegistry(EmbeddedRegistryService registryService)
          Method to set the embedded registry service instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

getRegistry

public static UserRegistry getRegistry(javax.servlet.http.HttpServletRequest request)
                                throws RegistryException
Method to obtain the registry from the session. If the registry is not available, it will be created and added to the session. If the tenant was changed, the registry on the session will not be changed, if it exists. The new instance will be created on the fly per each request made, until the session expires or the registry instance becomes unavailable. If the user does not send in the authorization information, an anonymous instance will be created.

Parameters:
request - the HTTP Servlet Request.
Returns:
the registry instance on the session.
Throws:
RegistryException - if the operation failed.

setEmbeddedRegistry

public static void setEmbeddedRegistry(EmbeddedRegistryService registryService)
Method to set the embedded registry service instance.

Parameters:
registryService - the embedded registry service instance.

getEmbeddedRegistryService

public static EmbeddedRegistryService getEmbeddedRegistryService()
                                                          throws RegistryException
Method to obtain the embedded registry service instance.

Returns:
the embedded registry service instance.
Throws:
RegistryException - if the embedded registry service is not available.

getUUID

public static String getUUID(String uri)
Generates a UUID for the given URI.

Parameters:
uri - the URI.
Returns:
the generated UUID.

encodeRegistryPath

public static String encodeRegistryPath(String path)
Method to encode a registry path.

Parameters:
path - the registry path.
Returns:
the encoded path.

calculateEntityTag

public static String calculateEntityTag(Resource r)
Calculate the entity tag based on the resource, this is equivalent to the RegistryAdapter::calculateEntityTag function which calculate entity tag based on the feed

Parameters:
r - Resource
Returns:
calculated entity tag as a string

getLinkWithRel

public static org.apache.abdera.model.Link getLinkWithRel(org.apache.abdera.model.Entry entry,
                                                          String rel)


Copyright © 2014 WSO2 Inc. All Rights Reserved.