Search in sources :

Example 1 with OperationNotSupportedException

use of javax.naming.OperationNotSupportedException in project camel by apache.

the class Jt400Endpoint method createConsumer.

@Override
public Consumer createConsumer(Processor processor) throws Exception {
    if (Jt400Type.DTAQ == configuration.getType()) {
        Consumer consumer = new Jt400DataQueueConsumer(this, processor);
        configureConsumer(consumer);
        return consumer;
    } else {
        throw new OperationNotSupportedException();
    }
}
Also used : OperationNotSupportedException(javax.naming.OperationNotSupportedException) Consumer(org.apache.camel.Consumer)

Example 2 with OperationNotSupportedException

use of javax.naming.OperationNotSupportedException in project tomcat by apache.

the class GlobalResourcesLifecycleListener method createMBeans.

/**
     * Create the MBeans for the interesting global JNDI resources in
     * the specified naming context.
     *
     * @param prefix Prefix for complete object name paths
     * @param context Context to be scanned
     *
     * @exception NamingException if a JNDI exception occurs
     */
protected void createMBeans(String prefix, Context context) throws NamingException {
    if (log.isDebugEnabled()) {
        log.debug("Creating MBeans for Global JNDI Resources in Context '" + prefix + "'");
    }
    try {
        NamingEnumeration<Binding> bindings = context.listBindings("");
        while (bindings.hasMore()) {
            Binding binding = bindings.next();
            String name = prefix + binding.getName();
            Object value = context.lookup(binding.getName());
            if (log.isDebugEnabled()) {
                log.debug("Checking resource " + name);
            }
            if (value instanceof Context) {
                createMBeans(name + "/", (Context) value);
            } else if (value instanceof UserDatabase) {
                try {
                    createMBeans(name, (UserDatabase) value);
                } catch (Exception e) {
                    log.error("Exception creating UserDatabase MBeans for " + name, e);
                }
            }
        }
    } catch (RuntimeException ex) {
        log.error("RuntimeException " + ex);
    } catch (OperationNotSupportedException ex) {
        log.error("Operation not supported " + ex);
    }
}
Also used : Binding(javax.naming.Binding) InitialContext(javax.naming.InitialContext) Context(javax.naming.Context) OperationNotSupportedException(javax.naming.OperationNotSupportedException) UserDatabase(org.apache.catalina.UserDatabase) NamingException(javax.naming.NamingException) OperationNotSupportedException(javax.naming.OperationNotSupportedException)

Aggregations

OperationNotSupportedException (javax.naming.OperationNotSupportedException)2 Binding (javax.naming.Binding)1 Context (javax.naming.Context)1 InitialContext (javax.naming.InitialContext)1 NamingException (javax.naming.NamingException)1 Consumer (org.apache.camel.Consumer)1 UserDatabase (org.apache.catalina.UserDatabase)1