public class Helper extends Object implements HelperMBean
Modifier and Type | Field and Description |
---|---|
static String |
BUNDLE_CF_PROP |
static String |
BUNDLE_CLEANER_PERIOD_PROP |
static String |
BUNDLE_IDLE_TIMEOUT_PROP |
static String |
BUNDLE_JMS_IP_ALLOWED |
static String |
BUNDLE_JMS_PASS |
static String |
BUNDLE_JMS_USER |
static String |
BUNDLE_JNDI_FACTORY_HOST_PROP |
static String |
BUNDLE_JNDI_FACTORY_INITIAL_PROP |
static String |
BUNDLE_JNDI_FACTORY_PORT_PROP |
private static String |
BYTES_CLASS_NAME |
private String |
cfName |
private long |
cleanerPeriod |
private static AtomicLong |
counter |
static int |
DFLT_CLEANER_PERIOD |
private long |
globalIdleTimeout |
private static Helper |
helper |
private InitialContext |
ictx |
private String |
IPAllowed |
private IPFilter |
ipfilter |
private Properties |
jndiProps |
private long |
lastCleanTime |
static org.objectweb.util.monolog.api.Logger |
logger |
private Random |
rand |
private HashMap<String,RestClientContext> |
restClientCtxs |
private String |
restPass |
private String |
restUser |
private HashMap<String,SessionContext> |
sessionCtxs |
Modifier | Constructor and Description |
---|---|
private |
Helper() |
Modifier and Type | Method and Description |
---|---|
void |
acknowledgeAllMsg(String consName) |
void |
acknowledgeMsg(String consName,
long id) |
boolean |
authenticationRequired() |
boolean |
checkIPAddress(String addr)
Check if the addr is authorized (all local address is authorized).
|
void |
close(String clientId) |
void |
closeAll()
Should only be called in stop.
|
void |
closeSessionCtx(String ctxName) |
void |
commit(String name) |
Message |
consume(String consName,
long timeout,
boolean noLocal,
boolean durable,
boolean shared,
String name,
long msgId) |
String |
createClientId() |
String |
createConsumer(String userName,
String password,
String clientId,
String consName,
Destination dest,
int sessionMode,
String messageSelector,
boolean noLocal,
boolean durable,
boolean shared,
String name,
String destName,
boolean isQueue,
long idleTimeout) |
String |
createConsumerId() |
String |
createProducer(String userName,
String password,
String clientId,
String prodName,
Destination dest,
int sessionMode,
int deliveryMode,
long deliveryDelay,
String correlationID,
int priority,
long timeToLive,
String destName,
boolean isQueue,
long idleTimeout)
Create a producer
|
String |
createProducerId() |
String |
dumpContexts() |
String |
dumpSessions() |
long |
getCleanerPeriod() |
RestClientContext |
getClientContext(String id) |
long |
getDefaultIdleTimeout() |
static Helper |
getInstance() |
String |
getIPAllowed() |
String |
getLastCleanTime() |
int |
getNbContexts() |
HashMap<String,RestClientContext> |
getRestClientCtxs() |
String |
getRestPass() |
String |
getRestUser() |
SessionContext |
getSessionCtx(String name) |
(package private) static Object |
getValue(Map map,
String key) |
Object |
lookup(String name) |
Destination |
lookupDestination(String destName)
Lookup the destination
|
void |
rollback(String name) |
long |
send(String prodName,
String type,
Map<String,Object> jmsHeaders,
Map<String,Object> jmsProps,
Object jmsBody,
int deliveryMode,
long deliveryDelay,
int priority,
long timeToLive,
String correlationID) |
void |
setCleanerPeriod(long cleanerPeriod) |
void |
setConnectionFactoryName(String cfName) |
void |
setGlobalProperties(org.osgi.framework.BundleContext bundleContext) |
void |
setLastCleanTime() |
(package private) static void |
setMapMessage(Map<String,Object> jsonMap,
MapMessage msg) |
public static org.objectweb.util.monolog.api.Logger logger
private static final String BYTES_CLASS_NAME
public static final String BUNDLE_CF_PROP
public static final String BUNDLE_JNDI_FACTORY_INITIAL_PROP
public static final String BUNDLE_JNDI_FACTORY_HOST_PROP
public static final String BUNDLE_JNDI_FACTORY_PORT_PROP
public static final String BUNDLE_IDLE_TIMEOUT_PROP
public static final String BUNDLE_CLEANER_PERIOD_PROP
public static final String BUNDLE_JMS_USER
public static final String BUNDLE_JMS_PASS
public static final String BUNDLE_JMS_IP_ALLOWED
public static final int DFLT_CLEANER_PERIOD
private Random rand
private static final AtomicLong counter
private static Helper helper
private InitialContext ictx
private HashMap<String,RestClientContext> restClientCtxs
private HashMap<String,SessionContext> sessionCtxs
private String cfName
private long globalIdleTimeout
private Properties jndiProps
private String restUser
private String restPass
private String IPAllowed
private IPFilter ipfilter
private long lastCleanTime
private long cleanerPeriod
public static Helper getInstance()
public String getRestUser()
getRestUser
in interface HelperMBean
public String getRestPass()
public void setGlobalProperties(org.osgi.framework.BundleContext bundleContext) throws NamingException
NamingException
public String getIPAllowed()
getIPAllowed
in interface HelperMBean
public boolean checkIPAddress(String addr)
addr
- The ip address to checkUnknownHostException
SocketException
public boolean authenticationRequired()
public HashMap<String,RestClientContext> getRestClientCtxs()
public void setConnectionFactoryName(String cfName)
cfName
- the connection factory namepublic void setCleanerPeriod(long cleanerPeriod)
public long getCleanerPeriod()
getCleanerPeriod
in interface HelperMBean
public long getDefaultIdleTimeout()
getDefaultIdleTimeout
in interface HelperMBean
public void setLastCleanTime()
public String getLastCleanTime()
getLastCleanTime
in interface HelperMBean
public int getNbContexts()
getNbContexts
in interface HelperMBean
public String dumpContexts()
dumpContexts
in interface HelperMBean
public String dumpSessions()
dumpSessions
in interface HelperMBean
public void closeAll()
public void close(String clientId)
close
in interface HelperMBean
clientId
- the client idpublic void closeSessionCtx(String ctxName)
ctxName
- the producer or consumer namepublic Destination lookupDestination(String destName) throws NamingException
destName
- the destination nameNamingException
public Object lookup(String name) throws NamingException
NamingException
public String createProducer(String userName, String password, String clientId, String prodName, Destination dest, int sessionMode, int deliveryMode, long deliveryDelay, String correlationID, int priority, long timeToLive, String destName, boolean isQueue, long idleTimeout) throws Exception
userName
- the user namepassword
- the passwordclientId
- the client idprodName
- the producer namedest
- the JMS destinationsessionMode
- the session modedeliveryMode
- the delivery modedeliveryDelay
- the delivery delaycorrelationID
- the correlation idpriority
- the prioritytimeToLive
- the time to livedestName
- need for the jms createisQueue
- idleTimeout
- Exception
public String createConsumer(String userName, String password, String clientId, String consName, Destination dest, int sessionMode, String messageSelector, boolean noLocal, boolean durable, boolean shared, String name, String destName, boolean isQueue, long idleTimeout) throws Exception
Exception
static final void setMapMessage(Map<String,Object> jsonMap, MapMessage msg) throws Exception
Exception
public long send(String prodName, String type, Map<String,Object> jmsHeaders, Map<String,Object> jmsProps, Object jmsBody, int deliveryMode, long deliveryDelay, int priority, long timeToLive, String correlationID) throws Exception
prodName
- type
- jmsHeaders
- jmsProps
- jmsBody
- deliveryMode
- deliveryDelay
- priority
- timeToLive
- correlationID
- Exception
public Message consume(String consName, long timeout, boolean noLocal, boolean durable, boolean shared, String name, long msgId) throws Exception
Exception
public String createClientId()
public String createProducerId()
public String createConsumerId()
public SessionContext getSessionCtx(String name)
public RestClientContext getClientContext(String id)
Copyright © 2020 ScalAgent D.T.. All rights reserved.