public List<Pool> match(String jndiName, ManagementRepository repository) { ArrayList<org.jboss.jca.core.api.connectionmanager.pool.Pool> result = new ArrayList<Pool>(repository .getDataSources().size()); if (repository.getDataSources() != null) { for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName()) && ds.getPool() != null) { result.add(ds.getPool()); } } } result.trimToSize(); return result; } }
protected List<PoolConfiguration> getMatchingPoolConfigs(String poolName, ManagementRepository repository) { ArrayList<PoolConfiguration> result = new ArrayList<PoolConfiguration>(repository.getDataSources().size()); if (repository.getDataSources() != null) { for (DataSource ds : repository.getDataSources()) { if (poolName.equalsIgnoreCase(ds.getPool().getName())) { result.add(ds.getPoolConfiguration()); } } } result.trimToSize(); return result; }
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String parameterName, final ModelNode newValue, final ModelNode currentValue, final HandbackHolder<List<DataSource>> handbackHolder) throws OperationFailedException { final String jndiName = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().get(Constants.JNDI_NAME.getName()).asString(); final ServiceController<?> managementRepoService = context.getServiceRegistry(false).getService( ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE); Boolean boolValue = Constants.ENLISTMENT_TRACE.resolveValue(context, newValue).asBoolean(); try { final ManagementRepository repository = (ManagementRepository) managementRepoService.getValue(); if (repository.getDataSources() != null) { for (DataSource dataSource : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(dataSource.getJndiName())) { dataSource.setEnlistmentTrace(boolValue); } } List<DataSource> list = new ArrayList<>(); for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName())) { list.add(ds); } } handbackHolder.setHandback(list); } } catch (Exception e) { throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToSetAttribute(e.getLocalizedMessage())); } return false; }
/** * String representation * @return The string */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("DataSource@").append(Integer.toHexString(System.identityHashCode(this))); sb.append(" xa=").append(isXA()); sb.append(" jndiName=").append(getJndiName()); sb.append(" pool=").append(getPool()); sb.append(" poolconfiguration=").append(getPoolConfiguration()); sb.append(" statistics=").append(getStatistics()); sb.append("]"); return sb.toString(); } }
StatisticsPlugin jdbcStats = deploymentMD.getDataSources()[0].getStatistics(); StatisticsPlugin poolStats = deploymentMD.getDataSources()[0].getPool().getStatistics(); jdbcStats.setEnabled(statsEnabled); poolStats.setEnabled(statsEnabled);
protected List<PoolConfiguration> getMatchingPoolConfigs(String jndiName, ManagementRepository repository) { ArrayList<PoolConfiguration> result = new ArrayList<PoolConfiguration>(repository.getDataSources().size()); if (repository.getDataSources() != null) { for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName())) { result.add(ds.getPoolConfiguration()); } } } result.trimToSize(); return result; }
@Override protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String parameterName, ModelNode valueToRestore, ModelNode valueToRevert, List<DataSource> handback) throws OperationFailedException { Boolean value = Constants.ENLISTMENT_TRACE.resolveValue(context, valueToRestore).asBoolean(); if (handback != null) { for (DataSource ds : handback) { ds.setEnlistmentTrace(value); } } }
for (org.jboss.jca.core.api.management.DataSource mgtDs : mgtDses) String jndiName = mgtDs.getJndiName(); if (jndiName.indexOf("/") != -1) jndiName = jndiName.substring(jndiName.lastIndexOf("/") + 1); if (mgtDs.getPoolConfiguration() != null) DynamicMBean dsPCDMB = JMX.createMBean(mgtDs.getPoolConfiguration(), "Pool configuration"); ObjectName dsPCON = new ObjectName(dsPCName); if (mgtDs.getPool() != null) DynamicMBean dsPDMB = JMX.createMBean(mgtDs.getPool(), "Pool"); ObjectName dsPON = new ObjectName(dsPName); if (mgtDs.getPool().getStatistics() != null) DynamicMBean dsPSDMB = JMX.createMBean(mgtDs.getPool().getStatistics(), "PoolStatistics", writeAttributes, null, excludeAttributes, excludeOperations); if (mgtDs.getStatistics() != null) DynamicMBean dsSDMB = JMX.createMBean(mgtDs.getStatistics(), "Statistics", writeAttributes, null, excludeAttributes, excludeOperations); ObjectName dsSON = new ObjectName(dsSName);
StatisticsPlugin jdbcStats = deploymentMD.getDataSources()[0].getStatistics(); StatisticsPlugin poolStats = deploymentMD.getDataSources()[0].getPool().getStatistics(); jdbcStats.setEnabled(statsEnabled); poolStats.setEnabled(statsEnabled);
@Override protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String parameterName, ModelNode valueToRestore, ModelNode valueToRevert, List<DataSource> handback) throws OperationFailedException { Boolean value = Constants.ENLISTMENT_TRACE.resolveValue(context, valueToRestore).asBoolean(); if (handback != null) { for (DataSource ds : handback) { ds.setEnlistmentTrace(value); } } }
public List<Pool> match(String jndiName, ManagementRepository repository) { ArrayList<org.jboss.jca.core.api.connectionmanager.pool.Pool> result = new ArrayList<Pool>(repository .getDataSources().size()); if (repository.getDataSources() != null) { for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName()) && ds.getPool() != null) { result.add(ds.getPool()); } } } result.trimToSize(); return result; } }
StatisticsPlugin jdbcStats = deploymentMD.getDataSources()[0].getStatistics(); StatisticsPlugin poolStats = deploymentMD.getDataSources()[0].getPool().getStatistics(); int jdbcStatsSize = jdbcStats.getNames().size(); int poolStatsSize = poolStats.getNames().size();
protected List<PoolConfiguration> getMatchingPoolConfigs(String poolName, ManagementRepository repository) { ArrayList<PoolConfiguration> result = new ArrayList<PoolConfiguration>(repository.getDataSources().size()); if (repository.getDataSources() != null) { for (DataSource ds : repository.getDataSources()) { if (poolName.equalsIgnoreCase(ds.getPool().getName())) { result.add(ds.getPoolConfiguration()); } } } result.trimToSize(); return result; }
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String parameterName, final ModelNode newValue, final ModelNode currentValue, final HandbackHolder<List<DataSource>> handbackHolder) throws OperationFailedException { final String jndiName = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().get(Constants.JNDI_NAME.getName()).asString(); final ServiceController<?> managementRepoService = context.getServiceRegistry(false).getService( ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE); Boolean boolValue = Constants.ENLISTMENT_TRACE.resolveValue(context, newValue).asBoolean(); try { final ManagementRepository repository = (ManagementRepository) managementRepoService.getValue(); if (repository.getDataSources() != null) { for (DataSource dataSource : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(dataSource.getJndiName())) { dataSource.setEnlistmentTrace(boolValue); } } List<DataSource> list = new ArrayList<>(); for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName())) { list.add(ds); } } handbackHolder.setHandback(list); } } catch (Exception e) { throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToSetAttribute(e.getLocalizedMessage())); } return false; }
public List<Pool> match(String jndiName, ManagementRepository repository) { ArrayList<org.jboss.jca.core.api.connectionmanager.pool.Pool> result = new ArrayList<Pool>(repository .getDataSources().size()); if (repository.getDataSources() != null) { for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName()) && ds.getPool() != null) { result.add(ds.getPool()); } } } result.trimToSize(); return result; } }