@Override public Set<String> getChildrenNames(String childType) { try { Statistics statistics = getStatistics(); if (statistics.getChildrenNames().contains(childType)) { Statistics childStatistics = statistics.getChild(childType); Set<String>result = new HashSet<String>(); for(String name:childStatistics.getDynamicChildrenNames(entityManagerFactoryLookup, PathWrapper.path(puName))) { result.add(name); } return result; } else { return super.getChildrenNames(childType); } } catch (RuntimeException e) { // WFLY-2436 ignore unexpected exceptions (e.g. JIPI-27 may throw an IllegalStateException) // WFLY-10413 : also make sure to catch HibernateExceptions ROOT_LOGGER.unexpectedStatisticsProblem(e); return Collections.emptySet(); } }
@Override public boolean hasChildren(String childType) { try { Statistics statistics = getStatistics(); if (statistics.getChildrenNames().contains(childType)) { Statistics childStatistics = statistics.getChild(childType); return childStatistics != null && childStatistics.getNames().size() > 0; } else { return super.hasChildren(childType); } } catch (RuntimeException e) { // WFLY-2436 ignore unexpected exceptions (e.g. JIPI-27 may throw an IllegalStateException) // WFLY-10413 : also make sure to catch HibernateExceptions ROOT_LOGGER.unexpectedStatisticsProblem(e); return false; } }
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { super.registerChildren(resourceRegistration); for( final String sublevelChildName : statistics.getChildrenNames()) { Statistics sublevelStatistics = statistics.getChild(sublevelChildName); ResourceDescriptionResolver sublevelResourceDescriptionResolver = new StandardResourceDescriptionResolver( sublevelChildName, sublevelStatistics.getResourceBundleName(), sublevelStatistics.getClass().getClassLoader()); resourceRegistration.registerSubModel( new ManagementResourceDefinition(PathElement.pathElement(sublevelChildName), sublevelResourceDescriptionResolver, sublevelStatistics, entityManagerFactoryLookup)); } }
super.registerAttributes(resourceRegistration); for(final String statisticName: statistics.getNames()) { final ModelType modelType = getModelType(statistics.getType(statisticName)); final SimpleAttributeDefinitionBuilder simpleAttributeDefinitionBuilder = new SimpleAttributeDefinitionBuilder(statisticName, modelType, true) .setFlags(AttributeAccess.Flag.STORAGE_RUNTIME); if (statistics.isAttribute(statisticName)) { if (statistics.isWriteable(statisticName)) { OperationStepHandler writeHandler = new AbstractMetricsHandler() {
super.registerOperations(resourceRegistration); for(final String statisticName: statistics.getNames()) { final ModelType modelType = getModelType(statistics.getType(statisticName)); if(statistics.isOperation(statisticName)) { AttributeDefinition attributeDefinition = new SimpleAttributeDefinitionBuilder(statisticName, modelType, true)
Object oldSetting = statistics.getValue( statisticName, entityManagerFactoryLookup, if (Boolean.class.equals(statistics.getType(statisticName))) { statistics.setValue( statisticName, value.asBoolean(), StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); } else if(Integer.class.equals(statistics.getType(statisticName))) { statistics.setValue( statisticName, value.asInt(), StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); } else if(Long.class.equals(statistics.getType(statisticName))) { statistics.setValue( statisticName, value.asLong(), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); } else { statistics.setValue( statisticName, value.asString(),
@Override public Set<String> getChildTypes() { try { Set<String> result = new HashSet<String>(super.getChildTypes()); Statistics statistics = getStatistics(); result.addAll(statistics.getChildrenNames()); return result; } catch (RuntimeException e) { // WFLY-2436 ignore unexpected exceptions (e.g. JIPI-27 may throw an IllegalStateException) // WFLY-10413 : also make sure to catch HibernateExceptions ROOT_LOGGER.unexpectedStatisticsProblem(e); return Collections.emptySet(); } }
statistics.getResourceBundleKeyPrefix(), statistics.getResourceBundleName(), statistics.getClass().getClassLoader()){ private ResourceDescriptionResolver fallback = JPAExtension.getResourceDescriptionResolver();
@Override void handle(final ModelNode response, OperationContext context, final ModelNode operation) { Object result = statistics.getValue( statisticName, entityManagerFactoryLookup, StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); if (result != null) { setResponse(response, result, modelType); } } };
super.registerAttributes(resourceRegistration); for(final String statisticName: statistics.getNames()) { final ModelType modelType = getModelType(statistics.getType(statisticName)); final SimpleAttributeDefinitionBuilder simpleAttributeDefinitionBuilder = new SimpleAttributeDefinitionBuilder(statisticName, modelType, true) .setFlags(AttributeAccess.Flag.STORAGE_RUNTIME); if (statistics.isAttribute(statisticName)) { if (statistics.isWriteable(statisticName)) { OperationStepHandler writeHandler = new AbstractMetricsHandler() {
super.registerOperations(resourceRegistration); for(final String statisticName: statistics.getNames()) { final ModelType modelType = getModelType(statistics.getType(statisticName)); if(statistics.isOperation(statisticName)) { AttributeDefinition attributeDefinition = new SimpleAttributeDefinitionBuilder(statisticName, modelType, true)
Object oldSetting = statistics.getValue( statisticName, entityManagerFactoryLookup, if (Boolean.class.equals(statistics.getType(statisticName))) { statistics.setValue( statisticName, value.asBoolean(), StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); } else if(Integer.class.equals(statistics.getType(statisticName))) { statistics.setValue( statisticName, value.asInt(), StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); } else if(Long.class.equals(statistics.getType(statisticName))) { statistics.setValue( statisticName, value.asLong(), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); } else { statistics.setValue( statisticName, value.asString(),
@Override public Set<String> getChildTypes() { try { Set<String> result = new HashSet<String>(super.getChildTypes()); Statistics statistics = getStatistics(); result.addAll(statistics.getChildrenNames()); return result; } catch (RuntimeException e) { // WFLY-2436 ignore unexpected exceptions (e.g. JIPI-27 may throw an IllegalStateException) // WFLY-10413 : also make sure to catch HibernateExceptions ROOT_LOGGER.unexpectedStatisticsProblem(e); return Collections.emptySet(); } }
statistics.getResourceBundleKeyPrefix(), statistics.getResourceBundleName(), statistics.getClass().getClassLoader()){ private ResourceDescriptionResolver fallback = JPAExtension.getResourceDescriptionResolver();
@Override void handle(final ModelNode response, OperationContext context, final ModelNode operation) { Object result = statistics.getValue( statisticName, entityManagerFactoryLookup, StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); if (result != null) { setResponse(response, result, modelType); } } };
@Override public Set<String> getChildrenNames(String childType) { try { Statistics statistics = getStatistics(); if (statistics.getChildrenNames().contains(childType)) { Statistics childStatistics = statistics.getChild(childType); Set<String>result = new HashSet<String>(); for(String name:childStatistics.getDynamicChildrenNames(entityManagerFactoryLookup, PathWrapper.path(puName))) { result.add(name); } return result; } else { return super.getChildrenNames(childType); } } catch (RuntimeException e) { // WFLY-2436 ignore unexpected exceptions (e.g. JIPI-27 may throw an IllegalStateException) // WFLY-10413 : also make sure to catch HibernateExceptions ROOT_LOGGER.unexpectedStatisticsProblem(e); return Collections.emptySet(); } }
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { super.registerChildren(resourceRegistration); for( final String sublevelChildName : statistics.getChildrenNames()) { Statistics sublevelStatistics = statistics.getChild(sublevelChildName); ResourceDescriptionResolver sublevelResourceDescriptionResolver = new StandardResourceDescriptionResolver( sublevelChildName, sublevelStatistics.getResourceBundleName(), sublevelStatistics.getClass().getClassLoader()); resourceRegistration.registerSubModel( new ManagementResourceDefinition(PathElement.pathElement(sublevelChildName), sublevelResourceDescriptionResolver, sublevelStatistics, entityManagerFactoryLookup)); } }
@Override public boolean hasChildren(String childType) { try { Statistics statistics = getStatistics(); if (statistics.getChildrenNames().contains(childType)) { Statistics childStatistics = statistics.getChild(childType); return childStatistics != null && childStatistics.getNames().size() > 0; } else { return super.hasChildren(childType); } } catch (RuntimeException e) { // WFLY-2436 ignore unexpected exceptions (e.g. JIPI-27 may throw an IllegalStateException) // WFLY-10413 : also make sure to catch HibernateExceptions ROOT_LOGGER.unexpectedStatisticsProblem(e); return false; } }
@Override public Resource removeChild(PathElement address) { Statistics statistics = getStatistics(); if (statistics.getChildrenNames().contains(address.getKey())) { throw JpaLogger.ROOT_LOGGER.resourcesOfTypeCannotBeRemoved(address.getKey()); } else { return super.removeChild(address); } }
@Override void handle(final ModelNode response, OperationContext context, final ModelNode operation) { Object result = statistics.getValue( statisticName, entityManagerFactoryLookup, StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS)))); if (result != null) { setResponse(response, result, modelType); } } };