/*
 * Copyright (C) 2013 Clarion Media, LLC
 *
 * 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 com.clarionmedia.jockey;

import com.clarionmedia.jockey.authentication.AuthenticationProvider;

public class Jockey {

    public static <T extends AuthenticationProvider> T to(Class<T> provider) {
        try {
            return provider.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException("AuthenticationProvider must have a public zero-argument constructor");
        } catch (IllegalAccessException e) {
            throw new RuntimeException("AuthenticationProvider must have a public zero-argument constructor");
        }
    }

}

@@ -705,16 +705,68 @@
 vider;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 public c
@@ -789,21 +789,22 @@
    p
-ublic
+rivate
  static 
 %3CT e
@@ -803,19 +803,13 @@
 tic 
-%3CT extends 
+List%3C
 Auth
@@ -832,412 +832,335 @@
 er%3E 
-T to(Class%3CT%3E provider) %7B%0A        try %7B%0A            return provider.newInstance
+sAuthProviderRegistry = new ArrayList%3CAuthenticationProvider%3E
 ();%0A
-  
+%0A
     
-  %7D catch (In
+public 
 sta
-n
 ti
-ationException e) %7B%0A            throw new RuntimeException(%22AuthenticationProvider must have a public zero-argument constructor%22);%0A        %7D catch (IllegalAccessException e) %7B%0A  
+c %3CT extends AuthenticationProvider%3E T to(T provider) %7B%0A        sAuthProviderRegistry.add(provider);%0A        return provider;%0A
     
- 
+%7D%0A%0A
     
- throw new RuntimeException(%22AuthenticationProvider must have a public zero-argument constructor%22);%0A        %7D
+public static List%3CAuthenticationProvider%3E getAuthProviderRegistry() %7B%0A        return sAuthProviderRegistry;
 %0A   

Add auth provider registry