private void setupEjbClientProps(String connectionPropertiesUrl) throws StartException { try { final File file = new File(connectionPropertiesUrl); final URL url; if (file.exists()) { url = file.toURI().toURL(); } else { url = new URL(connectionPropertiesUrl); } Properties properties = new Properties(); InputStream stream = null; try { stream = url.openStream(); properties.load(stream); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { //ignore } } } JBossEJBProperties ejbProps = JBossEJBProperties.fromProperties(connectionPropertiesUrl, properties); JBossEJBProperties.getContextManager().setGlobalDefault(ejbProps); } catch (Exception e) { throw new StartException(e); } }
builder.setEndpointName(getProperty(properties, PROPERTY_KEY_ENDPOINT_NAME, null, true)); final String defaultCallbackHandlerClassName = getProperty(properties, PROPERTY_KEY_CALLBACK_HANDLER_CLASS, null, true); builder.setCallbackHandlerClassName(defaultCallbackHandlerClassName); builder.setEndpointCreationOptions(getOptionMapFromProperties(properties, ENDPOINT_CREATION_OPTIONS_PREFIX, classLoader)); builder.setRemoteConnectionProviderCreationOptions(getOptionMapFromProperties(properties, REMOTE_CONNECTION_PROVIDER_CREATE_OPTIONS_PREFIX, classLoader)); builder.setInvocationTimeout(getLongValueFromProperties(properties, PROPERTY_KEY_INVOCATION_TIMEOUT, -1L)); builder.setReconnectTimeout(getLongValueFromProperties(properties, PROPERTY_KEY_RECONNECT_TASKS_TIMEOUT, -1L)); final String deploymentNodeSelectorClassName = getProperty(properties, PROPERTY_KEY_DEPLOYMENT_NODE_SELECTOR, null, true); if (deploymentNodeSelectorClassName != null) { builder.setDeploymentNodeSelectorClassName(deploymentNodeSelectorClassName); final String connectionsString = getProperty(properties, PROPERTY_KEY_REMOTE_CONNECTIONS, "", true).trim(); final List<ConnectionConfiguration> connectionList; final String clustersString = getProperty(properties, PROPERTY_KEY_CLUSTERS, "", true).trim(); final Map<String, ClusterConfiguration> clusterMap; return new JBossEJBProperties(builder);
public static JBossEJBProperties fromClassPath() throws IOException { return fromClassPath(JBossEJBProperties.class.getClassLoader(), DEFAULT_PATH_NAME); }
public void configure(final Consumer<DiscoveryProvider> discoveryProviderConsumer, final Consumer<RegistryProvider> registryProviderConsumer) { final JBossEJBProperties ejbProperties = JBossEJBProperties.getCurrent(); if (ejbProperties == null) { return; for (Map.Entry<String, JBossEJBProperties.ClusterConfiguration> entry : ejbProperties.getClusterConfigurations().entrySet()) { final String clusterName = entry.getKey(); final JBossEJBProperties.ClusterConfiguration configuration = entry.getValue();
public static void configure(final EJBClientContext.Builder builder) { final JBossEJBProperties properties = JBossEJBProperties.getCurrent(); if (properties != null) { Logs.MAIN.legacyEJBPropertiesEJBConfigurationInUse(); final List<JBossEJBProperties.ConnectionConfiguration> connectionList = properties.getConnectionList(); for (JBossEJBProperties.ConnectionConfiguration connectionConfiguration : connectionList) { final String host = connectionConfiguration.getHost(); final ExceptionSupplier<DeploymentNodeSelector, ReflectiveOperationException> deploymentNodeSelectorSupplier = properties.getDeploymentNodeSelectorSupplier(); if (deploymentNodeSelectorSupplier != null) { final DeploymentNodeSelector deploymentNodeSelector; deploymentNodeSelector = deploymentNodeSelectorSupplier.get(); } catch (ReflectiveOperationException e) { throw Logs.MAIN.cannotInstantiateDeploymentNodeSelector(properties.getDeploymentNodeSelectorClassName(), e); Map<String, JBossEJBProperties.ClusterConfiguration> clusters = properties.getClusterConfigurations(); if (clusters != null) { for (JBossEJBProperties.ClusterConfiguration cluster : clusters.values()) { if (properties.getInvocationTimeout() != -1L) { builder.setInvocationTimeout(properties.getInvocationTimeout());
public Endpoint getConfiguredEndpoint() { final JBossEJBProperties properties = JBossEJBProperties.getCurrent(); final String endpointName = properties.getEndpointName(); if (endpointName != null) { endpointBuilder.setEndpointName(endpointName); OptionMap endpointCreationOptions = properties.getEndpointCreationOptions(); if (endpointCreationOptions != null && endpointCreationOptions.size() > 0) { if (! endpointCreationOptions.contains(Options.THREAD_DAEMON)) { throw Logs.MAIN.failedToConstructEndpoint(e); final List<JBossEJBProperties.ConnectionConfiguration> connectionList = properties.getConnectionList(); for (JBossEJBProperties.ConnectionConfiguration connectionConfiguration : connectionList) { final OptionMap connectionOptions = connectionConfiguration.getConnectionOptions();
public AuthenticationContext getConfiguredAuthenticationContext() { AuthenticationContext context = AuthenticationContext.empty(); final JBossEJBProperties properties = JBossEJBProperties.getCurrent(); for (JBossEJBProperties.ConnectionConfiguration configuration : properties.getConnectionList()) { for (Map.Entry<String, JBossEJBProperties.ClusterConfiguration> entry : properties.getClusterConfigurations().entrySet()) { final String clusterName = entry.getKey(); final JBossEJBProperties.ClusterConfiguration configuration = entry.getValue();
public static <T> JBossEJBProperties fromResource(final String fileName, final ExceptionFunction<T, InputStream, IOException> streamSupplier, T param) throws IOException { return fromResource(fileName, ExceptionFunction::apply, streamSupplier, param); }
private static JBossEJBProperties fromResource(String fileName, InputStream stream) throws IOException { try (InputStream inputStream = stream) { try (BufferedInputStream bis = new BufferedInputStream(inputStream)) { try (InputStreamReader reader = new InputStreamReader(bis, StandardCharsets.UTF_8)) { final Properties properties = new Properties(); properties.load(reader); return fromProperties(fileName, properties); } } } }
/** * Get the context manager. * * @return the context manager (not {@code null}) */ @NotNull public ContextManager<JBossEJBProperties> getInstanceContextManager() { return getContextManager(); }
callbackHandler = callbackHandlerSupplier.get(); } catch (ReflectiveOperationException e) { throw Logs.MAIN.cannotInstantiateCallbackHandler(properties.getDefaultCallbackHandlerClassName(), e);
public static void configure(final EJBClientContext.Builder builder) { final JBossEJBProperties properties = JBossEJBProperties.getCurrent(); if (properties != null) { Logs.MAIN.legacyEJBPropertiesEJBConfigurationInUse(); final List<JBossEJBProperties.ConnectionConfiguration> connectionList = properties.getConnectionList(); for (JBossEJBProperties.ConnectionConfiguration connectionConfiguration : connectionList) { final String host = connectionConfiguration.getHost(); final ExceptionSupplier<DeploymentNodeSelector, ReflectiveOperationException> deploymentNodeSelectorSupplier = properties.getDeploymentNodeSelectorSupplier(); if (deploymentNodeSelectorSupplier != null) { final DeploymentNodeSelector deploymentNodeSelector; deploymentNodeSelector = deploymentNodeSelectorSupplier.get(); } catch (ReflectiveOperationException e) { throw Logs.MAIN.cannotInstantiateDeploymentNodeSelector(properties.getDeploymentNodeSelectorClassName(), e); Map<String, JBossEJBProperties.ClusterConfiguration> clusters = properties.getClusterConfigurations(); if (clusters != null) { for (JBossEJBProperties.ClusterConfiguration cluster : clusters.values()) { if (properties.getInvocationTimeout() != -1L) { builder.setInvocationTimeout(properties.getInvocationTimeout());
public Endpoint getConfiguredEndpoint() { final JBossEJBProperties properties = JBossEJBProperties.getCurrent(); final String endpointName = properties.getEndpointName(); if (endpointName != null) { endpointBuilder.setEndpointName(endpointName); OptionMap endpointCreationOptions = properties.getEndpointCreationOptions(); if (endpointCreationOptions != null && endpointCreationOptions.size() > 0) { if (! endpointCreationOptions.contains(Options.THREAD_DAEMON)) { throw Logs.MAIN.failedToConstructEndpoint(e); final List<JBossEJBProperties.ConnectionConfiguration> connectionList = properties.getConnectionList(); for (JBossEJBProperties.ConnectionConfiguration connectionConfiguration : connectionList) { final OptionMap connectionOptions = connectionConfiguration.getConnectionOptions();
public AuthenticationContext getConfiguredAuthenticationContext() { AuthenticationContext context = AuthenticationContext.empty(); final JBossEJBProperties properties = JBossEJBProperties.getCurrent(); for (JBossEJBProperties.ConnectionConfiguration configuration : properties.getConnectionList()) { for (Map.Entry<String, JBossEJBProperties.ClusterConfiguration> entry : properties.getClusterConfigurations().entrySet()) { final String clusterName = entry.getKey(); final JBossEJBProperties.ClusterConfiguration configuration = entry.getValue();
public static JBossEJBProperties fromResource(final String fileName, final ExceptionSupplier<InputStream, IOException> streamSupplier) throws IOException { return fromResource(fileName, ExceptionSupplier::get, streamSupplier); }
public void configure(final Consumer<DiscoveryProvider> discoveryProviderConsumer, final Consumer<RegistryProvider> registryProviderConsumer) { final JBossEJBProperties ejbProperties = JBossEJBProperties.getCurrent(); if (ejbProperties == null) { return; for (Map.Entry<String, JBossEJBProperties.ClusterConfiguration> entry : ejbProperties.getClusterConfigurations().entrySet()) { final String clusterName = entry.getKey(); final JBossEJBProperties.ClusterConfiguration configuration = entry.getValue();
private static JBossEJBProperties fromResource(String fileName, InputStream stream) throws IOException { try (InputStream inputStream = stream) { try (BufferedInputStream bis = new BufferedInputStream(inputStream)) { try (InputStreamReader reader = new InputStreamReader(bis, StandardCharsets.UTF_8)) { final Properties properties = new Properties(); properties.load(reader); return fromProperties(fileName, properties); } } } }
/** * Get the context manager. * * @return the context manager (not {@code null}) */ @NotNull public ContextManager<JBossEJBProperties> getInstanceContextManager() { return getContextManager(); }
callbackHandler = callbackHandlerSupplier.get(); } catch (ReflectiveOperationException e) { throw Logs.MAIN.cannotInstantiateCallbackHandler(properties.getDefaultCallbackHandlerClassName(), e);
public static void configure(final EJBClientContext.Builder builder) { final JBossEJBProperties properties = JBossEJBProperties.getCurrent(); if (properties != null) { Logs.MAIN.legacyEJBPropertiesEJBConfigurationInUse(); final List<JBossEJBProperties.ConnectionConfiguration> connectionList = properties.getConnectionList(); for (JBossEJBProperties.ConnectionConfiguration connectionConfiguration : connectionList) { final String host = connectionConfiguration.getHost(); final ExceptionSupplier<DeploymentNodeSelector, ReflectiveOperationException> deploymentNodeSelectorSupplier = properties.getDeploymentNodeSelectorSupplier(); if (deploymentNodeSelectorSupplier != null) { final DeploymentNodeSelector deploymentNodeSelector; deploymentNodeSelector = deploymentNodeSelectorSupplier.get(); } catch (ReflectiveOperationException e) { throw Logs.MAIN.cannotInstantiateDeploymentNodeSelector(properties.getDeploymentNodeSelectorClassName(), e); Map<String, JBossEJBProperties.ClusterConfiguration> clusters = properties.getClusterConfigurations(); if (clusters != null) { for (JBossEJBProperties.ClusterConfiguration cluster : clusters.values()) { if (properties.getInvocationTimeout() != -1L) { builder.setInvocationTimeout(properties.getInvocationTimeout());