http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/persistence/QueryOperation.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/persistence/QueryOperation.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/persistence/QueryOperation.java
index 949764e..01eba63 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/persistence/QueryOperation.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/persistence/QueryOperation.java
@@ -1,24 +1,24 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.persistence;
-
-import javax.persistence.Query;
-
-public interface QueryOperation {
-    Query apply(final Query query);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.persistence;
+
+import javax.persistence.Query;
+
+public interface QueryOperation {
+    Query apply(final Query query);
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQFactory.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQFactory.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQFactory.java
index 19fc6df..52da2af 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQFactory.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQFactory.java
@@ -1,154 +1,154 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.resource.activemq;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.openejb.OpenEJBRuntimeException;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.Collection;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class ActiveMQFactory {
-
-    private static final AtomicBoolean initialized = new AtomicBoolean(false);
-    private static Method setThreadProperties;
-    private static Method createBroker;
-    private static Method getBrokers;
-    private static Object instance;
-    private static String brokerPrefix;
-
-    private static void init() {
-
-        synchronized (initialized) {
-
-            if (!initialized.getAndSet(true)) {
-
-                Class tmp;
-
-                try {
-                    tmp = 
Class.forName("org.apache.openejb.resource.activemq.ActiveMQ5Factory");
-                    brokerPrefix = "amq5factory:";
-                } catch (final Throwable t1) {
-                    try {
-                        tmp = 
Class.forName("org.apache.openejb.resource.activemq.ActiveMQ4Factory");
-                        brokerPrefix = "amq4factory:";
-                    } catch (final Throwable t2) {
-                        throw new OpenEJBRuntimeException("Unable to load 
ActiveMQFactory: Check ActiveMQ jar files are on classpath", t1);
-                    }
-                }
-
-                final Class clazz = tmp;
-
-                try {
-                    instance = clazz.newInstance();
-                } catch (final InstantiationException e) {
-                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory instance", e);
-                } catch (final IllegalAccessException e) {
-                    throw new OpenEJBRuntimeException("Unable to access 
ActiveMQFactory instance", e);
-                }
-
-                try {
-                    setThreadProperties = 
clazz.getDeclaredMethod("setThreadProperties", new Class[]{Properties.class});
-                } catch (final NoSuchMethodException e) {
-                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory setThreadProperties method", e);
-                }
-
-                try {
-                    createBroker = clazz.getDeclaredMethod("createBroker", new 
Class[]{URI.class});
-                } catch (final NoSuchMethodException e) {
-                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory createBroker method", e);
-                }
-
-                try {
-                    getBrokers = clazz.getDeclaredMethod("getBrokers", 
(Class[]) null);
-                } catch (final NoSuchMethodException e) {
-                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory createBroker method", e);
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns the prefix metafile name of the poperties file that ActiveMQ 
should be
-     * provided with. This file is located at 
META-INF/services/org/apache/activemq/broker/
-     * and defines the BrokerFactoryHandler to load.
-     *
-     * @return String name - will be either 'amq5factory:' or 'amq4factory:' - 
note the trailing ':'
-     */
-    public static String getBrokerMetaFile() {
-        ActiveMQFactory.init();
-        return brokerPrefix;
-    }
-
-    public static void setThreadProperties(final Properties p) {
-
-        ActiveMQFactory.init();
-
-        try {
-            setThreadProperties.invoke(instance, p);
-        } catch (final IllegalAccessException e) {
-            throw new 
OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalAccessException",
 e);
-        } catch (final IllegalArgumentException e) {
-            throw new 
OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalArgumentException",
 e);
-        } catch (final InvocationTargetException e) {
-            throw new 
OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.InvocationTargetException",
 e);
-        }
-    }
-
-    public static BrokerService createBroker(final URI brokerURI) throws 
Exception {
-
-        ActiveMQFactory.init();
-
-        try {
-            return (BrokerService) createBroker.invoke(instance, brokerURI);
-        } catch (final IllegalAccessException e) {
-            throw new 
Exception("ActiveMQFactory.createBroker.IllegalAccessException", e);
-        } catch (final IllegalArgumentException e) {
-            throw new 
Exception("ActiveMQFactory.createBroker.IllegalArgumentException", e);
-        } catch (final InvocationTargetException e) {
-            throw new 
Exception("ActiveMQFactory.createBroker.InvocationTargetException", e);
-        }
-    }
-
-    /**
-     * Returns a map of configured brokers.
-     * This intended for access upon RA shutdown in order to wait for the 
brokers to finish.
-     *
-     * @return Map(URI, BrokerService)
-     * @throws Exception On error
-     */
-    public static Collection<BrokerService> getBrokers() throws Exception {
-
-        ActiveMQFactory.init();
-
-        try {
-            //noinspection unchecked
-            return (Collection<BrokerService>) getBrokers.invoke(instance, 
(Object[]) null);
-        } catch (final IllegalAccessException e) {
-            throw new 
Exception("ActiveMQFactory.createBroker.IllegalAccessException", e);
-        } catch (final IllegalArgumentException e) {
-            throw new 
Exception("ActiveMQFactory.createBroker.IllegalArgumentException", e);
-        } catch (final InvocationTargetException e) {
-            throw new 
Exception("ActiveMQFactory.createBroker.InvocationTargetException", e);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.resource.activemq;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.openejb.OpenEJBRuntimeException;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class ActiveMQFactory {
+
+    private static final AtomicBoolean initialized = new AtomicBoolean(false);
+    private static Method setThreadProperties;
+    private static Method createBroker;
+    private static Method getBrokers;
+    private static Object instance;
+    private static String brokerPrefix;
+
+    private static void init() {
+
+        synchronized (initialized) {
+
+            if (!initialized.getAndSet(true)) {
+
+                Class tmp;
+
+                try {
+                    tmp = 
Class.forName("org.apache.openejb.resource.activemq.ActiveMQ5Factory");
+                    brokerPrefix = "amq5factory:";
+                } catch (final Throwable t1) {
+                    try {
+                        tmp = 
Class.forName("org.apache.openejb.resource.activemq.ActiveMQ4Factory");
+                        brokerPrefix = "amq4factory:";
+                    } catch (final Throwable t2) {
+                        throw new OpenEJBRuntimeException("Unable to load 
ActiveMQFactory: Check ActiveMQ jar files are on classpath", t1);
+                    }
+                }
+
+                final Class clazz = tmp;
+
+                try {
+                    instance = clazz.newInstance();
+                } catch (final InstantiationException e) {
+                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory instance", e);
+                } catch (final IllegalAccessException e) {
+                    throw new OpenEJBRuntimeException("Unable to access 
ActiveMQFactory instance", e);
+                }
+
+                try {
+                    setThreadProperties = 
clazz.getDeclaredMethod("setThreadProperties", new Class[]{Properties.class});
+                } catch (final NoSuchMethodException e) {
+                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory setThreadProperties method", e);
+                }
+
+                try {
+                    createBroker = clazz.getDeclaredMethod("createBroker", new 
Class[]{URI.class});
+                } catch (final NoSuchMethodException e) {
+                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory createBroker method", e);
+                }
+
+                try {
+                    getBrokers = clazz.getDeclaredMethod("getBrokers", 
(Class[]) null);
+                } catch (final NoSuchMethodException e) {
+                    throw new OpenEJBRuntimeException("Unable to create 
ActiveMQFactory createBroker method", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the prefix metafile name of the poperties file that ActiveMQ 
should be
+     * provided with. This file is located at 
META-INF/services/org/apache/activemq/broker/
+     * and defines the BrokerFactoryHandler to load.
+     *
+     * @return String name - will be either 'amq5factory:' or 'amq4factory:' - 
note the trailing ':'
+     */
+    public static String getBrokerMetaFile() {
+        ActiveMQFactory.init();
+        return brokerPrefix;
+    }
+
+    public static void setThreadProperties(final Properties p) {
+
+        ActiveMQFactory.init();
+
+        try {
+            setThreadProperties.invoke(instance, p);
+        } catch (final IllegalAccessException e) {
+            throw new 
OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalAccessException",
 e);
+        } catch (final IllegalArgumentException e) {
+            throw new 
OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalArgumentException",
 e);
+        } catch (final InvocationTargetException e) {
+            throw new 
OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.InvocationTargetException",
 e);
+        }
+    }
+
+    public static BrokerService createBroker(final URI brokerURI) throws 
Exception {
+
+        ActiveMQFactory.init();
+
+        try {
+            return (BrokerService) createBroker.invoke(instance, brokerURI);
+        } catch (final IllegalAccessException e) {
+            throw new 
Exception("ActiveMQFactory.createBroker.IllegalAccessException", e);
+        } catch (final IllegalArgumentException e) {
+            throw new 
Exception("ActiveMQFactory.createBroker.IllegalArgumentException", e);
+        } catch (final InvocationTargetException e) {
+            throw new 
Exception("ActiveMQFactory.createBroker.InvocationTargetException", e);
+        }
+    }
+
+    /**
+     * Returns a map of configured brokers.
+     * This intended for access upon RA shutdown in order to wait for the 
brokers to finish.
+     *
+     * @return Map(URI, BrokerService)
+     * @throws Exception On error
+     */
+    public static Collection<BrokerService> getBrokers() throws Exception {
+
+        ActiveMQFactory.init();
+
+        try {
+            //noinspection unchecked
+            return (Collection<BrokerService>) getBrokers.invoke(instance, 
(Object[]) null);
+        } catch (final IllegalAccessException e) {
+            throw new 
Exception("ActiveMQFactory.createBroker.IllegalAccessException", e);
+        } catch (final IllegalArgumentException e) {
+            throw new 
Exception("ActiveMQFactory.createBroker.IllegalArgumentException", e);
+        } catch (final InvocationTargetException e) {
+            throw new 
Exception("ActiveMQFactory.createBroker.InvocationTargetException", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/RoutedDataSource.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/RoutedDataSource.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/RoutedDataSource.java
index dd727c3..9e94cd2 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/RoutedDataSource.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/RoutedDataSource.java
@@ -1,129 +1,129 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.resource.jdbc;
-
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.resource.jdbc.router.Router;
-import org.apache.openejb.spi.ContainerSystem;
-import org.apache.openejb.util.reflection.Reflections;
-
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.logging.Logger;
-
-public class RoutedDataSource implements DataSource {
-    private static final String OPENEJB_RESOURCE_PREFIX = "openejb:Resource/";
-
-    private Router delegate;
-
-    public RoutedDataSource() {
-        // no-op
-    }
-
-    public RoutedDataSource(final String router) {
-        setRouter(router);
-    }
-
-    public void setRouter(final String router) {
-        final Object o;
-        try {
-            o = 
SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(OPENEJB_RESOURCE_PREFIX
 + router);
-        } catch (final NamingException e) {
-            throw new IllegalArgumentException("Can't find router [" + router 
+ "]", e);
-        }
-
-        if (Router.class.isInstance(o)) {
-            delegate = Router.class.cast(o);
-        } else {
-            throw new IllegalArgumentException(o + " is not a router");
-        }
-    }
-
-    public PrintWriter getLogWriter() throws SQLException {
-        if (getTargetDataSource() == null) {
-            return null;
-        }
-        return getTargetDataSource().getLogWriter();
-    }
-
-    public void setLogWriter(final PrintWriter out) throws SQLException {
-        if (getTargetDataSource() != null) {
-            getTargetDataSource().setLogWriter(out);
-        }
-    }
-
-    public void setLoginTimeout(final int seconds) throws SQLException {
-        if (getTargetDataSource() != null) {
-            getTargetDataSource().setLoginTimeout(seconds);
-        }
-    }
-
-    public int getLoginTimeout() throws SQLException {
-        if (getTargetDataSource() == null) {
-            return -1;
-        }
-        return getTargetDataSource().getLoginTimeout();
-    }
-
-    public <T> T unwrap(final Class<T> iface) throws SQLException {
-        if (getTargetDataSource() == null) {
-            return null;
-        }
-        return (T) Reflections.invokeByReflection(getTargetDataSource(), 
"unwrap",
-            new Class<?>[]{Class.class}, new Object[]{iface});
-    }
-
-    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
-        if (getTargetDataSource() == null) {
-            return null;
-        }
-        return (Logger) Reflections.invokeByReflection(getTargetDataSource(), 
"getParentLogger", new Class<?>[0], null);
-    }
-
-    public boolean isWrapperFor(final Class<?> iface) throws SQLException {
-        if (getTargetDataSource() == null) {
-            return false;
-        }
-        return (Boolean) Reflections.invokeByReflection(getTargetDataSource(), 
"isWrapperFor",
-            new Class<?>[]{Class.class}, new Object[]{iface});
-    }
-
-    public Connection getConnection() throws SQLException {
-        return getTargetDataSource().getConnection();
-    }
-
-    public Connection getConnection(final String username, final String 
password)
-        throws SQLException {
-        return getTargetDataSource().getConnection(username, password);
-    }
-
-    public Router getDelegate() {
-        if (delegate == null) {
-            throw new IllegalStateException("a router has to be defined");
-        }
-        return delegate;
-    }
-
-    private DataSource getTargetDataSource() {
-        return getDelegate().getDataSource();
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.resource.jdbc;
+
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.resource.jdbc.router.Router;
+import org.apache.openejb.spi.ContainerSystem;
+import org.apache.openejb.util.reflection.Reflections;
+
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.logging.Logger;
+
+public class RoutedDataSource implements DataSource {
+    private static final String OPENEJB_RESOURCE_PREFIX = "openejb:Resource/";
+
+    private Router delegate;
+
+    public RoutedDataSource() {
+        // no-op
+    }
+
+    public RoutedDataSource(final String router) {
+        setRouter(router);
+    }
+
+    public void setRouter(final String router) {
+        final Object o;
+        try {
+            o = 
SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(OPENEJB_RESOURCE_PREFIX
 + router);
+        } catch (final NamingException e) {
+            throw new IllegalArgumentException("Can't find router [" + router 
+ "]", e);
+        }
+
+        if (Router.class.isInstance(o)) {
+            delegate = Router.class.cast(o);
+        } else {
+            throw new IllegalArgumentException(o + " is not a router");
+        }
+    }
+
+    public PrintWriter getLogWriter() throws SQLException {
+        if (getTargetDataSource() == null) {
+            return null;
+        }
+        return getTargetDataSource().getLogWriter();
+    }
+
+    public void setLogWriter(final PrintWriter out) throws SQLException {
+        if (getTargetDataSource() != null) {
+            getTargetDataSource().setLogWriter(out);
+        }
+    }
+
+    public void setLoginTimeout(final int seconds) throws SQLException {
+        if (getTargetDataSource() != null) {
+            getTargetDataSource().setLoginTimeout(seconds);
+        }
+    }
+
+    public int getLoginTimeout() throws SQLException {
+        if (getTargetDataSource() == null) {
+            return -1;
+        }
+        return getTargetDataSource().getLoginTimeout();
+    }
+
+    public <T> T unwrap(final Class<T> iface) throws SQLException {
+        if (getTargetDataSource() == null) {
+            return null;
+        }
+        return (T) Reflections.invokeByReflection(getTargetDataSource(), 
"unwrap",
+            new Class<?>[]{Class.class}, new Object[]{iface});
+    }
+
+    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+        if (getTargetDataSource() == null) {
+            return null;
+        }
+        return (Logger) Reflections.invokeByReflection(getTargetDataSource(), 
"getParentLogger", new Class<?>[0], null);
+    }
+
+    public boolean isWrapperFor(final Class<?> iface) throws SQLException {
+        if (getTargetDataSource() == null) {
+            return false;
+        }
+        return (Boolean) Reflections.invokeByReflection(getTargetDataSource(), 
"isWrapperFor",
+            new Class<?>[]{Class.class}, new Object[]{iface});
+    }
+
+    public Connection getConnection() throws SQLException {
+        return getTargetDataSource().getConnection();
+    }
+
+    public Connection getConnection(final String username, final String 
password)
+        throws SQLException {
+        return getTargetDataSource().getConnection(username, password);
+    }
+
+    public Router getDelegate() {
+        if (delegate == null) {
+            throw new IllegalStateException("a router has to be defined");
+        }
+        return delegate;
+    }
+
+    private DataSource getTargetDataSource() {
+        return getDelegate().getDataSource();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PasswordCipher.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PasswordCipher.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PasswordCipher.java
index 2c67f7a..d9665ca 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PasswordCipher.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PasswordCipher.java
@@ -1,29 +1,29 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.cipher;
-
-/**
- * In order to reuse that same interface for every passwords in TomEE, it has 
been moved
- * to another package. Just keeping that interface for compatibility reasons.
- *
- * @See org.apache.openejb.cipher.PasswordCipher
- */
-@Deprecated
-public interface PasswordCipher extends 
org.apache.openejb.cipher.PasswordCipher {
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.cipher;
+
+/**
+ * In order to reuse that same interface for every passwords in TomEE, it has 
been moved
+ * to another package. Just keeping that interface for compatibility reasons.
+ *
+ * @See org.apache.openejb.cipher.PasswordCipher
+ */
+@Deprecated
+public interface PasswordCipher extends 
org.apache.openejb.cipher.PasswordCipher {
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PlainTextPasswordCipher.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PlainTextPasswordCipher.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PlainTextPasswordCipher.java
index df1fcea..6297a37 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PlainTextPasswordCipher.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/PlainTextPasswordCipher.java
@@ -1,22 +1,22 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.cipher;
-
-@Deprecated
-public class PlainTextPasswordCipher extends 
org.apache.openejb.cipher.PlainTextPasswordCipher implements PasswordCipher {
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.cipher;
+
+@Deprecated
+public class PlainTextPasswordCipher extends 
org.apache.openejb.cipher.PlainTextPasswordCipher implements PasswordCipher {
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java
index e62d00d..1a820c0 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java
@@ -1,23 +1,23 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.cipher;
-
-@Deprecated
-@SuppressWarnings("deprecation")
-public class StaticDESPasswordCipher extends 
org.apache.openejb.cipher.StaticDESPasswordCipher implements PasswordCipher {
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.cipher;
+
+@Deprecated
+@SuppressWarnings("deprecation")
+public class StaticDESPasswordCipher extends 
org.apache.openejb.cipher.StaticDESPasswordCipher implements PasswordCipher {
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/AbstractRouter.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/AbstractRouter.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/AbstractRouter.java
index 425a10d..c904670 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/AbstractRouter.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/AbstractRouter.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.router;
-
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.spi.ContainerSystem;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-public abstract class AbstractRouter implements Router {
-    private static final String OPENEJB_RESOURCE = "openejb:Resource/";
-
-    private final Context ctx;
-
-    public AbstractRouter() {
-        ctx = 
SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();
-    }
-
-    protected Object getJndiResource(final String name) throws NamingException 
{
-        return ctx.lookup(name);
-    }
-
-    protected Object getOpenEJBResource(final String name) throws 
NamingException {
-        return getJndiResource(OPENEJB_RESOURCE + name);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.router;
+
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.spi.ContainerSystem;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+public abstract class AbstractRouter implements Router {
+    private static final String OPENEJB_RESOURCE = "openejb:Resource/";
+
+    private final Context ctx;
+
+    public AbstractRouter() {
+        ctx = 
SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();
+    }
+
+    protected Object getJndiResource(final String name) throws NamingException 
{
+        return ctx.lookup(name);
+    }
+
+    protected Object getOpenEJBResource(final String name) throws 
NamingException {
+        return getJndiResource(OPENEJB_RESOURCE + name);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/Router.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/Router.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/Router.java
index ea00735..05e2683 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/Router.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/router/Router.java
@@ -1,37 +1,37 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.router;
-
-import org.apache.openejb.resource.jdbc.RoutedDataSource;
-
-import javax.sql.DataSource;
-
-/**
- * The Router interface is responsible for providing the target data source to 
the ${@link RoutedDataSource}}.
- * <p/>
- * $Rev:$
- */
-public interface Router {
-
-    /**
-     * Used by ${@link RoutedDataSource} to get the active data source.
-     *
-     * @return the data source to delegate to
-     */
-    DataSource getDataSource();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.resource.jdbc.router;
+
+import org.apache.openejb.resource.jdbc.RoutedDataSource;
+
+import javax.sql.DataSource;
+
+/**
+ * The Router interface is responsible for providing the target data source to 
the ${@link RoutedDataSource}}.
+ * <p/>
+ * $Rev:$
+ */
+public interface Router {
+
+    /**
+     * Used by ${@link RoutedDataSource} to get the active data source.
+     *
+     * @return the data source to delegate to
+     */
+    DataSource getDataSource();
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
index ac357a9..216819f 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
@@ -1,113 +1,113 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.openejb.rest;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.container.ResourceContext;
-import javax.ws.rs.container.ResourceInfo;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Configuration;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.SecurityContext;
-import javax.ws.rs.core.UriInfo;
-import javax.ws.rs.ext.ContextResolver;
-import javax.ws.rs.ext.Providers;
-import java.util.Map;
-
-public class ThreadLocalContextManager {
-    public static final ThreadLocalRequest REQUEST = new ThreadLocalRequest();
-    public static final ThreadLocalServletConfig SERVLET_CONFIG = new 
ThreadLocalServletConfig();
-    public static final ThreadLocalServletContext SERVLET_CONTEXT = new 
ThreadLocalServletContext();
-    public static final ThreadLocalServletRequest SERVLET_REQUEST = new 
ThreadLocalServletRequest();
-    public static final ThreadLocalHttpServletRequest HTTP_SERVLET_REQUEST = 
new ThreadLocalHttpServletRequest();
-    public static final ThreadLocalHttpServletResponse HTTP_SERVLET_RESPONSE = 
new ThreadLocalHttpServletResponse();
-    public static final ThreadLocalUriInfo URI_INFO = new ThreadLocalUriInfo();
-    public static final ThreadLocalHttpHeaders HTTP_HEADERS = new 
ThreadLocalHttpHeaders();
-    public static final ThreadLocalSecurityContext SECURITY_CONTEXT = new 
ThreadLocalSecurityContext();
-    public static final ThreadLocalContextResolver CONTEXT_RESOLVER = new 
ThreadLocalContextResolver();
-    public static final ThreadLocalProviders PROVIDERS = new 
ThreadLocalProviders();
-    public static final ThreadLocal<Application> APPLICATION = new 
ThreadLocal<>();
-    public static final ThreadLocalConfiguration CONFIGURATION = new 
ThreadLocalConfiguration();
-    public static final ThreadLocalResourceInfo RESOURCE_INFO = new 
ThreadLocalResourceInfo();
-    public static final ThreadLocalResourceContext RESOURCE_CONTEXT = new 
ThreadLocalResourceContext();
-    public static final ThreadLocal<Map<String, Object>> OTHERS = new 
ThreadLocal<Map<String, Object>>();
-
-    public static void reset() {
-        REQUEST.remove();
-        SERVLET_REQUEST.remove();
-        SERVLET_CONFIG.remove();
-        SERVLET_CONTEXT.remove();
-        HTTP_SERVLET_REQUEST.remove();
-        HTTP_SERVLET_RESPONSE.remove();
-        URI_INFO.remove();
-        HTTP_HEADERS.remove();
-        SECURITY_CONTEXT.remove();
-        CONTEXT_RESOLVER.remove();
-        PROVIDERS.remove();
-        APPLICATION.remove();
-        CONFIGURATION.remove();
-        RESOURCE_INFO.remove();
-        RESOURCE_CONTEXT.remove();
-
-        final Map<String, Object> map = OTHERS.get();
-        if (map != null) {
-            map.clear();
-        }
-        OTHERS.remove();
-    }
-
-    public static Object findThreadLocal(final Class<?> type) {
-        if (Request.class.equals(type)) {
-            return REQUEST;
-        } else if (UriInfo.class.equals(type)) {
-            return URI_INFO;
-        } else if (HttpHeaders.class.equals(type)) {
-            return HTTP_HEADERS;
-        } else if (SecurityContext.class.equals(type)) {
-            return SECURITY_CONTEXT;
-        } else if (ContextResolver.class.equals(type)) {
-            return CONTEXT_RESOLVER;
-        } else if (Providers.class.equals(type)) {
-            return PROVIDERS;
-        } else if (ServletRequest.class.equals(type)) {
-            return SERVLET_REQUEST;
-        } else if (HttpServletRequest.class.equals(type)) {
-            return HTTP_SERVLET_REQUEST;
-        } else if (HttpServletResponse.class.equals(type)) {
-            return HTTP_SERVLET_RESPONSE;
-        } else if (ServletConfig.class.equals(type)) {
-            return SERVLET_CONFIG;
-        } else if (ServletContext.class.equals(type)) {
-            return SERVLET_CONTEXT;
-        } else if (ResourceInfo.class.equals(type)) {
-            return RESOURCE_INFO;
-        } else if (ResourceContext.class.equals(type)) {
-            return RESOURCE_CONTEXT;
-        } else if (Application.class.equals(type)) {
-            return APPLICATION;
-        } else if (Configuration.class.equals(type)) {
-            return CONFIGURATION;
-        }
-        return null;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.rest;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.container.ResourceContext;
+import javax.ws.rs.container.ResourceInfo;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Configuration;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Providers;
+import java.util.Map;
+
+public class ThreadLocalContextManager {
+    public static final ThreadLocalRequest REQUEST = new ThreadLocalRequest();
+    public static final ThreadLocalServletConfig SERVLET_CONFIG = new 
ThreadLocalServletConfig();
+    public static final ThreadLocalServletContext SERVLET_CONTEXT = new 
ThreadLocalServletContext();
+    public static final ThreadLocalServletRequest SERVLET_REQUEST = new 
ThreadLocalServletRequest();
+    public static final ThreadLocalHttpServletRequest HTTP_SERVLET_REQUEST = 
new ThreadLocalHttpServletRequest();
+    public static final ThreadLocalHttpServletResponse HTTP_SERVLET_RESPONSE = 
new ThreadLocalHttpServletResponse();
+    public static final ThreadLocalUriInfo URI_INFO = new ThreadLocalUriInfo();
+    public static final ThreadLocalHttpHeaders HTTP_HEADERS = new 
ThreadLocalHttpHeaders();
+    public static final ThreadLocalSecurityContext SECURITY_CONTEXT = new 
ThreadLocalSecurityContext();
+    public static final ThreadLocalContextResolver CONTEXT_RESOLVER = new 
ThreadLocalContextResolver();
+    public static final ThreadLocalProviders PROVIDERS = new 
ThreadLocalProviders();
+    public static final ThreadLocal<Application> APPLICATION = new 
ThreadLocal<>();
+    public static final ThreadLocalConfiguration CONFIGURATION = new 
ThreadLocalConfiguration();
+    public static final ThreadLocalResourceInfo RESOURCE_INFO = new 
ThreadLocalResourceInfo();
+    public static final ThreadLocalResourceContext RESOURCE_CONTEXT = new 
ThreadLocalResourceContext();
+    public static final ThreadLocal<Map<String, Object>> OTHERS = new 
ThreadLocal<Map<String, Object>>();
+
+    public static void reset() {
+        REQUEST.remove();
+        SERVLET_REQUEST.remove();
+        SERVLET_CONFIG.remove();
+        SERVLET_CONTEXT.remove();
+        HTTP_SERVLET_REQUEST.remove();
+        HTTP_SERVLET_RESPONSE.remove();
+        URI_INFO.remove();
+        HTTP_HEADERS.remove();
+        SECURITY_CONTEXT.remove();
+        CONTEXT_RESOLVER.remove();
+        PROVIDERS.remove();
+        APPLICATION.remove();
+        CONFIGURATION.remove();
+        RESOURCE_INFO.remove();
+        RESOURCE_CONTEXT.remove();
+
+        final Map<String, Object> map = OTHERS.get();
+        if (map != null) {
+            map.clear();
+        }
+        OTHERS.remove();
+    }
+
+    public static Object findThreadLocal(final Class<?> type) {
+        if (Request.class.equals(type)) {
+            return REQUEST;
+        } else if (UriInfo.class.equals(type)) {
+            return URI_INFO;
+        } else if (HttpHeaders.class.equals(type)) {
+            return HTTP_HEADERS;
+        } else if (SecurityContext.class.equals(type)) {
+            return SECURITY_CONTEXT;
+        } else if (ContextResolver.class.equals(type)) {
+            return CONTEXT_RESOLVER;
+        } else if (Providers.class.equals(type)) {
+            return PROVIDERS;
+        } else if (ServletRequest.class.equals(type)) {
+            return SERVLET_REQUEST;
+        } else if (HttpServletRequest.class.equals(type)) {
+            return HTTP_SERVLET_REQUEST;
+        } else if (HttpServletResponse.class.equals(type)) {
+            return HTTP_SERVLET_RESPONSE;
+        } else if (ServletConfig.class.equals(type)) {
+            return SERVLET_CONFIG;
+        } else if (ServletContext.class.equals(type)) {
+            return SERVLET_CONTEXT;
+        } else if (ResourceInfo.class.equals(type)) {
+            return RESOURCE_INFO;
+        } else if (ResourceContext.class.equals(type)) {
+            return RESOURCE_CONTEXT;
+        } else if (Application.class.equals(type)) {
+            return APPLICATION;
+        } else if (Configuration.class.equals(type)) {
+            return CONFIGURATION;
+        }
+        return null;
+    }
+}

Reply via email to