|
30 | 30 | import eu.tneitzel.beanshooter.plugin.providers.RMIProvider;
|
31 | 31 | import eu.tneitzel.beanshooter.plugin.providers.ResponseHandlerProvider;
|
32 | 32 | import eu.tneitzel.beanshooter.plugin.providers.SocketFactoryProvider;
|
| 33 | +import eu.tneitzel.beanshooter.plugin.providers.T3AuthenticationProvider; |
33 | 34 | import eu.tneitzel.beanshooter.plugin.providers.YsoSerialProvider;
|
34 | 35 | import eu.tneitzel.beanshooter.utils.Utils;
|
35 | 36 |
|
@@ -60,15 +61,17 @@ public class PluginSystem {
|
60 | 61 | */
|
61 | 62 | public static void init(String pluginPath)
|
62 | 63 | {
|
63 |
| - mBeanServerProvider = selectProvider(); |
| 64 | + mBeanServerProvider = selectMBeanProvider(); |
64 | 65 | socketFactoryProvider = new SocketFactoryProvider();
|
65 | 66 | payloadProvider = new YsoSerialProvider();
|
66 | 67 | argumentProvider = new ArgumentProvider();
|
67 | 68 | responseHandler = new ResponseHandlerProvider();
|
68 |
| - authenticationProvider = new AuthenticationProvider(); |
| 69 | + authenticationProvider = selectAuthProvider(); |
69 | 70 |
|
70 | 71 | if(pluginPath != null)
|
| 72 | + { |
71 | 73 | loadPlugin(pluginPath);
|
| 74 | + } |
72 | 75 | }
|
73 | 76 |
|
74 | 77 | /**
|
@@ -105,7 +108,9 @@ private static void loadPlugin(String pluginPath)
|
105 | 108 | jarStream.close();
|
106 | 109 |
|
107 | 110 | if(pluginClassName == null)
|
| 111 | + { |
108 | 112 | throw new MalformedPluginException();
|
| 113 | + } |
109 | 114 |
|
110 | 115 | }
|
111 | 116 |
|
@@ -179,20 +184,41 @@ private static void loadPlugin(String pluginPath)
|
179 | 184 | *
|
180 | 185 | * @return IMBeanServerProvider according to the specified command lien arguments.
|
181 | 186 | */
|
182 |
| - private static IMBeanServerProvider selectProvider() |
| 187 | + private static IMBeanServerProvider selectMBeanProvider() |
183 | 188 | {
|
184 | 189 | if (BeanshooterOption.CONN_JMXMP.getBool())
|
| 190 | + { |
185 | 191 | return new JMXMPProvider();
|
| 192 | + } |
186 | 193 |
|
187 | 194 | if (BeanshooterOption.CONN_JNDI.notNull())
|
| 195 | + { |
188 | 196 | return new JNDIProvider();
|
| 197 | + } |
189 | 198 |
|
190 | 199 | if (BeanshooterOption.CONN_JOLOKIA.getBool())
|
| 200 | + { |
191 | 201 | return new JolokiaProvider();
|
| 202 | + } |
192 | 203 |
|
193 | 204 | return new RMIProvider();
|
194 | 205 | }
|
195 | 206 |
|
| 207 | + /** |
| 208 | + * Returns the IAuthenticationProvider according to the specified command line arguments. |
| 209 | + * |
| 210 | + * @return IAuthenticationProvider according to the specified command lien arguments. |
| 211 | + */ |
| 212 | + private static IAuthenticationProvider selectAuthProvider() |
| 213 | + { |
| 214 | + if (BeanshooterOption.CONN_JNDI.getValue("").startsWith("service:jmx:t3")) |
| 215 | + { |
| 216 | + return new T3AuthenticationProvider(); |
| 217 | + } |
| 218 | + |
| 219 | + return new AuthenticationProvider(); |
| 220 | + } |
| 221 | + |
196 | 222 | /**
|
197 | 223 | * Attempt to obtain an MBeanServerConnection to the specified remote MBeanServer. Authentication related
|
198 | 224 | * exceptions are handled automatically. If this is not desired, the getMBeanServerConnectionUnmanaged function
|
|
0 commit comments