Package org.wso2.carbon.context
Class CarbonContext
java.lang.Object
org.wso2.carbon.context.CarbonContext
- Direct Known Subclasses:
PrivilegedCarbonContext
This provides the API for sub-tenant programming around
WSO2 Carbon and
WSO2 Stratos. Each CarbonContext will utilize an
underlying
CarbonContextDataHolder instance, which will store the actual data.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate a CarbonContext with the current CarbonContext holder.protectedCarbonContext(CarbonContextDataHolder carbonContextHolder) Creates a CarbonContext using the given CarbonContext holder as its backing instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.osgi.framework.FiltercreateFilter(org.osgi.framework.BundleContext bundleContext, Class clazz, Hashtable<String, String> props) Create filter from the bundle context adding class name and propertiesString[]Method to discover a set of service endpoints belonging the defined scopes..protected CarbonContextDataHolderUtility method to obtain the current CarbonContext holder after an instance of a CarbonContext has been created.Method to obtain a JNDI-context.getJNDIContext(Hashtable properties) Method to obtain a JNDI-context with the given initialization properties.Method to obtain the organization id on this CarbonContext instance.getOSGiService(Class clazz) Deprecated.getOSGiService(Class clazz, Hashtable<String, String> props) Obtain the first OSGi service found for interface or classclazzand propsgetOSGiServices(Class clazz) Deprecated.please usegetOSGiServices(Class, java.util.Hashtable)insteadgetOSGiServices(Class clazz, Hashtable<String, String> props) Obtain the OSGi services found for interface or classclazzand propsorg.wso2.carbon.queuing.CarbonQueue<?> Deprecated.org.wso2.carbon.registry.api.RegistrygetRegistry(RegistryType type) Method to obtain an instance of a registry on this CarbonContext instance.Method to obtain the tenant domain on this CarbonContext instance.intMethod to obtain the tenant id on this CarbonContext instance.static CarbonContextMethod to obtain the user id on this CarbonContext instance.Method to obtain the username on this CarbonContext instance.org.wso2.carbon.user.api.UserRealmMethod to obtain the user realm on this CarbonContext instance.Method to obtain the user's resident organization ID on this CarbonContext instance.
-
Constructor Details
-
CarbonContext
Creates a CarbonContext using the given CarbonContext holder as its backing instance.- Parameters:
carbonContextHolder- the CarbonContext holder that backs this CarbonContext object.- See Also:
-
CarbonContext
protected CarbonContext()Instantiate a CarbonContext with the current CarbonContext holder.
-
-
Method Details
-
getCarbonContextDataHolder
Utility method to obtain the current CarbonContext holder after an instance of a CarbonContext has been created.- Returns:
- the current CarbonContext holder
-
getThreadLocalCarbonContext
-
getTenantId
public int getTenantId()Method to obtain the tenant id on this CarbonContext instance.- Returns:
- the tenant id.
-
getUsername
Method to obtain the username on this CarbonContext instance.- Returns:
- the username.
-
getUserId
Method to obtain the user id on this CarbonContext instance.- Returns:
- the user id.
-
getTenantDomain
Method to obtain the tenant domain on this CarbonContext instance.- Returns:
- the tenant domain.
-
getOrganizationId
Method to obtain the organization id on this CarbonContext instance.- Returns:
- The organization id.
-
getUserResidentOrganizationId
Method to obtain the user's resident organization ID on this CarbonContext instance.- Returns:
- The user's resident organization ID.
-
getRegistry
Method to obtain an instance of a registry on this CarbonContext instance.- Parameters:
type- the type of registry required.- Returns:
- the requested registry instance.
-
getUserRealm
public org.wso2.carbon.user.api.UserRealm getUserRealm()Method to obtain the user realm on this CarbonContext instance.- Returns:
- the user realm instance.
-
getQueue
Deprecated.Method to obtain a named queue instance.- Parameters:
name- the name of the queue instance.- Returns:
- the queue instance.
-
getJNDIContext
Method to obtain a JNDI-context with the given initialization properties.- Parameters:
properties- the properties required to create the JNDI-contNDext instance.- Returns:
- the JNDI-context.
- Throws:
NamingException- if the operation failed.
-
getJNDIContext
Method to obtain a JNDI-context.- Returns:
- the JNDI-context.
- Throws:
NamingException- if the operation failed.
-
discover
Method to discover a set of service endpoints belonging the defined scopes..- Parameters:
scopes- the scopes in which to look-up for the service.- Returns:
- a list of service endpoints.
-
getOSGiService
Deprecated.please usegetOSGiService(Class, java.util.Hashtable)insteadObtain the first OSGi service found for interface or classclazz- Parameters:
clazz- The type of the OSGi service- Returns:
- The OSGi service
-
getOSGiServices
Deprecated.please usegetOSGiServices(Class, java.util.Hashtable)insteadObtain the OSGi services found for interface or classclazz- Parameters:
clazz- The type of the OSGi service- Returns:
- The List of OSGi services
-
getOSGiService
Obtain the first OSGi service found for interface or classclazzand props- Parameters:
clazz- The type of the OSGi serviceprops- attribute list that filter the service- Returns:
- The OSGi service
-
getOSGiServices
Obtain the OSGi services found for interface or classclazzand props- Parameters:
clazz- The type of the OSGi serviceprops- attribute list that filter the service list- Returns:
- The List of OSGi services
-
createFilter
protected org.osgi.framework.Filter createFilter(org.osgi.framework.BundleContext bundleContext, Class clazz, Hashtable<String, String> props) throws org.osgi.framework.InvalidSyntaxExceptionCreate filter from the bundle context adding class name and properties- Parameters:
bundleContext- BundleContextclazz- The type of the OSGi serviceprops- attribute list that filter the service list- Returns:
- Filter
- Throws:
org.osgi.framework.InvalidSyntaxException
-
getApplicationName
-
getOSGiService(Class, java.util.Hashtable)instead