public class Utils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DISPLAY_CONTINUATION
Shown to user has a indication that the particular message has more content than shown in UI
|
static String |
DISPLAY_LENGTH_EXCEEDED
Message shown in UI if message content exceed the limit - Further enhancement,
these needs to read from a resource bundle
|
static Integer |
MESSAGE_DISPLAY_LENGTH_MAX
Maximum size a message will be displayed on UI
|
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static List<Queue> |
filterDomainSpecificQueues(List<Queue> fullList)
Filter queues to suit the tenant domain.
|
static Set<String> |
filterDomainSpecificQueues(Set<String> fullList)
Filter queue name list to suit the tenant domain
|
static List<Subscription> |
filterDomainSpecificSubscribers(List<Subscription> allSubscriptions)
Filters the domain specific subscriptions from a list of subscriptions
|
static Object[] |
getFilteredMessagesList(ArrayList msgArrayList,
int startingIndex,
int maxMsgCount)
Filter the whole message list to fit for the page range
|
static String[] |
getMessageContentAsString(javax.jms.Message message)
Gets the message content as a string, after verifying its type
|
static String |
getMsgContentType(javax.jms.Message message)
Determines the type of the JMS message
|
static String |
getMsgProperties(javax.jms.Message message)
Gets properties of a JMS message
|
static String |
getTCPConnectionURL(String userName,
String accessKey)
Gets the TCP connection url to reach the broker by using the currently logged in user and the
access key for the user, generated by andes Authentication Service
|
static String |
getTenantBasedQueueName(String queueName)
Gets tenant based queue name.
|
static String |
getTenantDomain()
Method to retrieve the tenant domain of the current user.
|
static org.wso2.carbon.registry.core.session.UserRegistry |
getUserRegistry()
Gets the user registry for the current tenant
|
static boolean |
isAdmin(String username)
Checks if a given user has admin privileges.
|
static boolean |
isOwnDomain(String tenantDomain,
String routingKey)
Check whether a queue/topic belongs to given domain in order to avoid other tenant domains'
users operate on the given queue/topic
|
static boolean |
isQueueInDomain(String queueName)
Method to check if the queue is allowed in the tenant domain.
|
static boolean |
isSSLOnly()
Finds whether only SSL is allowed
|
static Subscription |
parseStringToASubscription(String subscriptionInfo)
Parsing a string to a
Subscription |
public static final Integer MESSAGE_DISPLAY_LENGTH_MAX
public static final String DISPLAY_CONTINUATION
public static final String DISPLAY_LENGTH_EXCEEDED
public static org.wso2.carbon.registry.core.session.UserRegistry getUserRegistry() throws org.wso2.carbon.registry.core.exceptions.RegistryException
UserRegistry
org.wso2.carbon.registry.core.exceptions.RegistryException
public static String getTenantBasedQueueName(String queueName)
queueName
- queue namepublic static String getTenantDomain()
public static boolean isAdmin(String username) throws QueueManagerException
username
- Name of the userQueueManagerException
- if getting roles for the user failspublic static List<Queue> filterDomainSpecificQueues(List<Queue> fullList)
fullList
- Full queue listpublic static Set<String> filterDomainSpecificQueues(Set<String> fullList)
fullList
- Full queue name list to filterpublic static boolean isQueueInDomain(String queueName)
queueName
- The queue to check if allowedpublic static List<Subscription> filterDomainSpecificSubscribers(List<Subscription> allSubscriptions)
allSubscriptions
- input subscription listSubscription
public static Subscription parseStringToASubscription(String subscriptionInfo)
Subscription
subscriptionInfo
- subscription stringSubscription
public static Object[] getFilteredMessagesList(ArrayList msgArrayList, int startingIndex, int maxMsgCount)
msgArrayList
- - total message liststartingIndex
- - index of the first message of given pagemaxMsgCount
- - max messages count per a pagepublic static String getTCPConnectionURL(String userName, String accessKey) throws FileNotFoundException, XMLStreamException, UnknownHostException
userName
- - currently logged in useraccessKey
- - the key (uuid) generated by authentication serviceFileNotFoundException
XMLStreamException
UnknownHostException
public static String getMsgProperties(javax.jms.Message message) throws javax.jms.JMSException
message
- message objectjavax.jms.JMSException
public static String getMsgContentType(javax.jms.Message message)
message
- - input messagepublic static String[] getMessageContentAsString(javax.jms.Message message) throws javax.jms.JMSException
message
- - JMS Messagejavax.jms.JMSException
public static boolean isSSLOnly() throws FileNotFoundException, XMLStreamException
FileNotFoundException
XMLStreamException
public static boolean isOwnDomain(String tenantDomain, String routingKey)
tenantDomain
- - domain name of tenantroutingKey
- - queue/topic name to be verified against tenantDomainCopyright © 2017 WSO2. All rights reserved.