Search in sources :

Example 1 with SASLProvider

use of com.swiftmq.impl.amqp.sasl.provider.SASLProvider in project swiftmq-ce by iitsoftware.

the class AMQPSwiftlet method startup.

protected void startup(Configuration configuration) throws SwiftletException {
    ctx = new SwiftletContext(configuration, this);
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(getName(), "startup ...");
    Security.addProvider(new SASLProvider(SASLProvider.PROVIDER_NAME, 1.0, "SwiftMQ SASL Security Provider"));
    createListenerAdapter((EntityList) ctx.root.getEntity("listeners"));
    Property prop = ctx.root.getProperty("collect-interval");
    prop.setPropertyChangeListener(new PropertyChangeAdapter(null) {

        public void propertyChanged(Property property, Object oldValue, Object newValue) throws PropertyChangeException {
            collectInterval = ((Long) newValue).longValue();
            collectChanged(((Long) oldValue).longValue(), collectInterval);
        }
    });
    collectInterval = ((Long) prop.getValue()).longValue();
    if (collectOn) {
        if (collectInterval > 0) {
            if (ctx.traceSpace.enabled)
                ctx.traceSpace.trace(getName(), "startup: registering msg/s count collector");
            ctx.timerSwiftlet.addTimerListener(collectInterval, this);
        } else if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(getName(), "startup: collect interval <= 0; no msg/s count collector");
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(getName(), "registering MgmtListener ...");
    ctx.mgmtSwiftlet.addMgmtListener(this);
    ctx.usageList.setEntityRemoveListener(new EntityChangeAdapter(null) {

        public void onEntityRemove(Entity parent, Entity delEntity) throws EntityRemoveException {
            Connection myConnection = (Connection) delEntity.getDynamicObject();
            ConnectionManager connectionManager = ctx.networkSwiftlet.getConnectionManager();
            connectionManager.removeConnection(myConnection);
            if (ctx.traceSpace.enabled)
                ctx.traceSpace.trace(getName(), "onEntityRemove (Connection): " + myConnection);
        }
    });
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(getName(), "startup done.");
}
Also used : SASLProvider(com.swiftmq.impl.amqp.sasl.provider.SASLProvider) ConnectionManager(com.swiftmq.swiftlet.net.ConnectionManager) Connection(com.swiftmq.swiftlet.net.Connection)

Aggregations

SASLProvider (com.swiftmq.impl.amqp.sasl.provider.SASLProvider)1 Connection (com.swiftmq.swiftlet.net.Connection)1 ConnectionManager (com.swiftmq.swiftlet.net.ConnectionManager)1