// Path: messaging/src/main/java/org/projectodd/wunderboss/messaging/Messaging.java
// public interface Messaging extends Component {
// 
//     class CreateOption extends Option {
//         public static final CreateOption HOST = opt("host", CreateOption.class);
//         public static final CreateOption PORT = opt("port", CreateOption.class);
//     }
// 
//     class CreateQueueOption extends Option {
//         public static final CreateQueueOption CONTEXT = opt("context", CreateQueueOption.class);
//         public static final CreateQueueOption DURABLE   = opt("durable", true, CreateQueueOption.class);
//         public static final CreateQueueOption SELECTOR  = opt("selector", CreateQueueOption.class);
//     }
// 
//     Queue findOrCreateQueue(String name,
//                             Map<CreateQueueOption, Object> options) throws Exception;
// 
//     class CreateTopicOption extends Option {
//         public static final CreateTopicOption CONTEXT = opt("context", CreateTopicOption.class);
//     }
// 
//     Topic findOrCreateTopic(String name,
//                             Map<CreateTopicOption, Object> options) throws Exception;
// 
//     class CreateContextOption extends Option {
//         public static final CreateContextOption HOST = opt("host", CreateContextOption.class);
//         public static final CreateContextOption PORT = opt("port", 5445, CreateContextOption.class);
//         public static final CreateContextOption CLIENT_ID = opt("client_id", CreateContextOption.class);
//         public static final CreateContextOption USERNAME = opt("username", CreateContextOption.class);
//         public static final CreateContextOption PASSWORD = opt("password", CreateContextOption.class);
//         public static final CreateContextOption REMOTE_TYPE = opt("remote_type", CreateContextOption.class);
//         public static final CreateContextOption MODE = opt("mode", Context.Mode.AUTO_ACK, CreateContextOption.class);
// 
//         /**
//          * If true, an xa Context is returned.
//          */
//         public static final CreateContextOption XA = opt("xa", false, CreateContextOption.class);
// 
//         public static final CreateContextOption RECONNECT_RETRY_INTERVAL =
//                 opt("reconnect_retry_interval", 2000, CreateContextOption.class);
//         public static final CreateContextOption RECONNECT_RETRY_INTERVAL_MULTIPLIER =
//                 opt("reconnect_retry_interval_multiplier", 1.0, CreateContextOption.class);
//         public static final CreateContextOption RECONNECT_MAX_RETRY_INTERVAL =
//                 opt("reconnect_max_retry_interval", 2000, CreateContextOption.class);
//         public static final CreateContextOption RECONNECT_ATTEMPTS =
//                 opt("reconnect_attempts", 0, CreateContextOption.class);
//     }
// 
//     Context createContext(Map<CreateContextOption, Object> options) throws Exception;
// }
// 
// Path: messaging/src/main/java/org/projectodd/wunderboss/messaging/WithCloseables.java
// public class WithCloseables implements HasCloseables {
//     @Override
//     public void addCloseable(Object closeable) {
//         this.closeables.add(closeable);
//     }
// 
//     @Override
//     public void closeCloseables() throws Exception {
//         for(Object each: this.closeables) {
//             if (each instanceof AutoCloseable) {
//                 ((AutoCloseable) each).close();
//             } else {
//                 try {
//                     Method close = each.getClass().getMethod("close");
//                     close.invoke(each);
//                 } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
// 
//                     throw new RuntimeException("Can't close object of class " + each.getClass().getName(), e);
//                 }
//             }
//         }
// 
//         this.closeables.clear();
//     }
// 
//     private final List<Object> closeables = new ArrayList<>();
// }


import org.jboss.logging.Logger;
import org.projectodd.wunderboss.messaging.Messaging;
import org.projectodd.wunderboss.messaging.WithCloseables;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Session;
import java.util.UUID;
import java.util.concurrent.Callable;
/*
 * Copyright 2014-2016 Red Hat, Inc, and individual contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.projectodd.wunderboss.messaging.jms;



public class JMSContext extends WithCloseables implements JMSSpecificContext {
    public static final ThreadLocal<JMSSpecificContext> currentContext = new ThreadLocal<>();

    public JMSContext(final Connection jmsConnection,
// Path: messaging/src/main/java/org/projectodd/wunderboss/messaging/Messaging.java
// public interface Messaging extends Component {
// 
//     class CreateOption extends Option {
//         public static final CreateOption HOST = opt("host", CreateOption.class);
//         public static final CreateOption PORT = opt("port", CreateOption.class);
//     }
// 
//     class CreateQueueOption extends Option {
//         public static final CreateQueueOption CONTEXT = opt("context", CreateQueueOption.class);
//         public static final CreateQueueOption DURABLE   = opt("durable", true, CreateQueueOption.class);
//         public static final CreateQueueOption SELECTOR  = opt("selector", CreateQueueOption.class);
//     }
// 
//     Queue findOrCreateQueue(String name,
//                             Map<CreateQueueOption, Object> options) throws Exception;
// 
//     class CreateTopicOption extends Option {
//         public static final CreateTopicOption CONTEXT = opt("context", CreateTopicOption.class);
//     }
// 
//     Topic findOrCreateTopic(String name,
//                             Map<CreateTopicOption, Object> options) throws Exception;
// 
//     class CreateContextOption extends Option {
//         public static final CreateContextOption HOST = opt("host", CreateContextOption.class);
//         public static final CreateContextOption PORT = opt("port", 5445, CreateContextOption.class);
//         public static final CreateContextOption CLIENT_ID = opt("client_id", CreateContextOption.class);
//         public static final CreateContextOption USERNAME = opt("username", CreateContextOption.class);
//         public static final CreateContextOption PASSWORD = opt("password", CreateContextOption.class);
//         public static final CreateContextOption REMOTE_TYPE = opt("remote_type", CreateContextOption.class);
//         public static final CreateContextOption MODE = opt("mode", Context.Mode.AUTO_ACK, CreateContextOption.class);
// 
//         /**
//          * If true, an xa Context is returned.
//          */
//         public static final CreateContextOption XA = opt("xa", false, CreateContextOption.class);
// 
//         public static final CreateContextOption RECONNECT_RETRY_INTERVAL =
//                 opt("reconnect_retry_interval", 2000, CreateContextOption.class);
//         public static final CreateContextOption RECONNECT_RETRY_INTERVAL_MULTIPLIER =
//                 opt("reconnect_retry_interval_multiplier", 1.0, CreateContextOption.class);
//         public static final CreateContextOption RECONNECT_MAX_RETRY_INTERVAL =
//                 opt("reconnect_max_retry_interval", 2000, CreateContextOption.class);
//         public static final CreateContextOption RECONNECT_ATTEMPTS =
//                 opt("reconnect_attempts", 0, CreateContextOption.class);
//     }
// 
//     Context createContext(Map<CreateContextOption, Object> options) throws Exception;
// }
// 
// Path: messaging/src/main/java/org/projectodd/wunderboss/messaging/WithCloseables.java
// public class WithCloseables implements HasCloseables {
//     @Override
//     public void addCloseable(Object closeable) {
//         this.closeables.add(closeable);
//     }
// 
//     @Override
//     public void closeCloseables() throws Exception {
//         for(Object each: this.closeables) {
//             if (each instanceof AutoCloseable) {
//                 ((AutoCloseable) each).close();
//             } else {
//                 try {
//                     Method close = each.getClass().getMethod("close");
//                     close.invoke(each);
//                 } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
// 
//                     throw new RuntimeException("Can't close object of class " + each.getClass().getName(), e);
//                 }
//             }
//         }
// 
//         this.closeables.clear();
//     }
// 
//     private final List<Object> closeables = new ArrayList<>();
// }


// Path: messaging/src/main/java/org/projectodd/wunderboss/messaging/jms/JMSContext.java
import org.jboss.logging.Logger;
import org.projectodd.wunderboss.messaging.Messaging;
import org.projectodd.wunderboss.messaging.WithCloseables;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Session;
import java.util.UUID;
import java.util.concurrent.Callable;

/*
 * Copyright 2014-2016 Red Hat, Inc, and individual contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.projectodd.wunderboss.messaging.jms;



public class JMSContext extends WithCloseables implements JMSSpecificContext {
    public static final ThreadLocal<JMSSpecificContext> currentContext = new ThreadLocal<>();

    public JMSContext(final Connection jmsConnection,
                      final Messaging broker,