protected final void initDestination() throws JMSException
{
// Security : a consumer destination may only be set at creation time
// so we check permissions here once and for all.
LocalConnection conn = (LocalConnection)session.getConnection();
if (conn.isSecurityEnabled())
{
if (destination instanceof Queue)
{
String queueName = ((Queue)destination).getQueueName();
if (conn.isRegisteredTemporaryQueue(queueName))
{
// OK, temporary destination
}
else
if (queueName.equals(FFMQConstants.ADM_REQUEST_QUEUE))
{
// Only the internal admin thread can consume on this queue
if (conn.getSecurityContext() != null)
throw new FFMQException("Access denied to administration queue "+queueName,"ACCESS_DENIED");
}
else
if (queueName.equals(FFMQConstants.ADM_REPLY_QUEUE))
{
conn.checkPermission(Resource.SERVER, Action.REMOTE_ADMIN);
}
else
{
// Standard queue
conn.checkPermission(destination,Action.CONSUME);
}
}
else
if (destination instanceof Topic)
{
String topicName = ((Topic)destination).getTopicName();
if (conn.isRegisteredTemporaryTopic(topicName))
{
// OK, temporary destination
}
else
{
// Standard topic
conn.checkPermission(destination,Action.CONSUME);
}
}
}
// Lookup a local destination object from the given reference