jpa/subsystem/src/main/java/org/jboss/as/jpa/processor/PersistenceUnitServiceHandler.java
private static void addManagementConsole(final DeploymentUnit deploymentUnit, final PersistenceUnitMetadata pu,
                                             final PersistenceProviderAdaptor adaptor, PersistenceAdaptorRemoval persistenceAdaptorRemoval) {
        ManagementAdaptor managementAdaptor = adaptor.getManagementAdaptor();
        // workaround for AS7-4441, if a custom hibernate.cache.region_prefix is specified, don't show the persistence
        // unit in management console.
        if (managementAdaptor != null &&
                adaptor.doesScopedPersistenceUnitNameIdentifyCacheRegionName(pu)) {
            final String providerLabel = managementAdaptor.getIdentificationLabel();
            final String scopedPersistenceUnitName = pu.getScopedPersistenceUnitName();
            Resource providerResource = JPAService.createManagementStatisticsResource(managementAdaptor, scopedPersistenceUnitName, deploymentUnit);

            // Resource providerResource = managementAdaptor.createPersistenceUnitResource(scopedPersistenceUnitName, providerLabel);
            ModelNode perPuNode = providerResource.getModel();
            perPuNode.get(SCOPED_UNIT_NAME.getName()).set(pu.getScopedPersistenceUnitName());
            // TODO this is a temporary hack into internals until DeploymentUnit exposes a proper Resource-based API
            final Resource deploymentResource = deploymentUnit.getAttachment(DeploymentModelUtils.DEPLOYMENT_RESOURCE);
            Resource subsystemResource;
            synchronized (deploymentResource) {
                subsystemResource = getOrCreateResource(deploymentResource, PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "jpa"));
            }
            synchronized (subsystemResource) {
                subsystemResource.registerChild(PathElement.pathElement(providerLabel, scopedPersistenceUnitName), providerResource);
                // save the subsystemResource reference + path to scoped pu, so we can remove it during undeploy
                persistenceAdaptorRemoval.registerManagementConsoleChild(subsystemResource, PathElement.pathElement(providerLabel, scopedPersistenceUnitName));
            }
        }
    }
private static void addManagementConsole(final DeploymentUnit deploymentUnit, final PersistenceUnitMetadata pu,
                                             final PersistenceProviderAdaptor adaptor, PersistenceAdaptorRemoval persistenceAdaptorRemoval) {
        ManagementAdaptor managementAdaptor = adaptor.getManagementAdaptor();
        // workaround for AS7-4441, if a custom hibernate.cache.region_prefix is specified, don't show the persistence
        // unit in management console.
        if (managementAdaptor != null &&
                adaptor.doesScopedPersistenceUnitNameIdentifyCacheRegionName(pu)) {
            final String providerLabel = managementAdaptor.getIdentificationLabel();
            final String scopedPersistenceUnitName = pu.getScopedPersistenceUnitName();
            Resource providerResource = JPAService.createManagementStatisticsResource(managementAdaptor, scopedPersistenceUnitName, deploymentUnit);

            // Resource providerResource = managementAdaptor.createPersistenceUnitResource(scopedPersistenceUnitName, providerLabel);
            ModelNode perPuNode = providerResource.getModel();
            perPuNode.get(SCOPED_UNIT_NAME.getName()).set(pu.getScopedPersistenceUnitName());
            // TODO this is a temporary hack into internals until DeploymentUnit exposes a proper Resource-based API
            final Resource deploymentResource = deploymentUnit.getAttachment(DeploymentModelUtils.DEPLOYMENT_RESOURCE);
            Resource subsystemResource;
            synchronized (deploymentResource) {
                subsystemResource = getOrCreateResource(deploymentResource, PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "jpa"));
            }
            synchronized (subsystemResource) {
                subsystemResource.registerChild(PathElement.pathElement(providerLabel, scopedPersistenceUnitName), providerResource);
                // save the subsystemResource reference + path to scoped pu, so we can remove it during undeploy
                persistenceAdaptorRemoval.registerManagementConsoleChild(subsystemResource, PathElement.pathElement(providerLabel, scopedPersistenceUnitName));
            }
        }
    }
private static void addManagementConsole ( final DeploymentUnit deploymentUnit , final PersistenceUnitMetadata pu , final PersistenceProviderAdaptor adaptor , PersistenceAdaptorRemoval persistenceAdaptorRemoval ) { ManagementAdaptor managementAdaptor = adaptor . getManagementAdaptor ( ) ; // workaround for AS7-4441, if a custom hibernate.cache.region_prefix is specified, don't show the persistence // unit in management console. if ( managementAdaptor != null && adaptor . doesScopedPersistenceUnitNameIdentifyCacheRegionName ( pu ) ) { final String providerLabel = managementAdaptor . getIdentificationLabel ( ) ; final String scopedPersistenceUnitName = pu . getScopedPersistenceUnitName ( ) ; Resource providerResource = JPAService . createManagementStatisticsResource ( managementAdaptor , scopedPersistenceUnitName , deploymentUnit ) ; // Resource providerResource = managementAdaptor.createPersistenceUnitResource(scopedPersistenceUnitName, providerLabel); ModelNode perPuNode = providerResource . getModel ( ) ; perPuNode . get ( SCOPED_UNIT_NAME . getName ( ) ) . set ( pu . getScopedPersistenceUnitName ( ) ) ; // TODO this is a temporary hack into internals until DeploymentUnit exposes a proper Resource-based API final Resource deploymentResource = deploymentUnit . getAttachment ( DeploymentModelUtils . DEPLOYMENT_RESOURCE ) ; Resource subsystemResource ; synchronized ( deploymentResource ) { subsystemResource = getOrCreateResource ( deploymentResource , PathElement . pathElement ( ModelDescriptionConstants . SUBSYSTEM , "jpa" ) ) ; } synchronized ( subsystemResource ) { subsystemResource . registerChild ( PathElement . pathElement ( providerLabel , scopedPersistenceUnitName ) , providerResource ) ; // save the subsystemResource reference + path to scoped pu, so we can remove it during undeploy persistenceAdaptorRemoval . registerManagementConsoleChild ( subsystemResource , PathElement . pathElement ( providerLabel , scopedPersistenceUnitName ) ) ; } } }
add to management console (if ManagementAdapter is supported for provider).
<p/>
full path to management data will be:
<p/>
/deployment=Deployment/subsystem=jpa/hibernate-persistence-unit=FullyAppQualifiedPath#PersistenceUnitName/cache=EntityClassName
<p/>
example of full path:
<p/>
/deployment=jpa_SecondLevelCacheTestCase.jar/subsystem=jpa/hibernate-persistence-unit=jpa_SecondLevelCacheTestCase.jar#mypc/
cache=org.jboss.as.test.integration.jpa.hibernate.Employee
@param deploymentUnit
@param pu
@param adaptor
@param persistenceAdaptorRemoval
add to management console ( if ManagementAdapter is supported for provider ) . <p / > full path to management data will be : <p / > / deployment = Deployment / subsystem = jpa / hibernate - persistence - unit = FullyAppQualifiedPath#PersistenceUnitName / cache = EntityClassName <p / > example of full path : <p / > / deployment = jpa_SecondLevelCacheTestCase . jar / subsystem = jpa / hibernate - persistence - unit = jpa_SecondLevelCacheTestCase . jar#mypc / cache = org . jboss . as . test . integration . jpa . hibernate . Employee