// Path: spi/src/main/java/org/jipijapa/management/spi/EntityManagerFactoryAccess.java
// public interface EntityManagerFactoryAccess {
//     /**
//      * returns the entity manager factory that statistics should be obtained for.
//      *
//      * @throws IllegalStateException if scopedPersistenceUnitName is not found
//      *
//      * @param scopedPersistenceUnitName is persistence unit name scoped to the current platform
//      *
//      * @return EntityManagerFactory
//      */
//     EntityManagerFactory entityManagerFactory(String scopedPersistenceUnitName) throws IllegalStateException;
// 
// }
// 
// Path: spi/src/main/java/org/jipijapa/management/spi/Operation.java
// public interface Operation {
// 
//     /**
//      * Invoke operation
//      * @param args will be passed to invoked operation
//      * @return
//      */
//     Object invoke(Object... args);
// }
// 
// Path: spi/src/main/java/org/jipijapa/management/spi/PathAddress.java
// public interface PathAddress {
// 
//     int size();
// 
//     String getValue(String name);
//     String getValue(int index);
// }
// 
// Path: spi/src/main/java/org/jipijapa/management/spi/Statistics.java
// public interface Statistics {
// 
// 
//     /**
//      * Get the statistics names
//      *
//      * @return The value
//      */
//     Set<String> getNames();
// 
//     Collection<String> getDynamicChildrenNames(EntityManagerFactoryAccess entityManagerFactoryAccess, PathAddress pathAddress);
// 
//     /**
//      * Get the type
//      *
//      * @param name of the statistic
//      * @return The value
//      */
//     Class getType(String name);
// 
//     /**
//      * return true if the specified name represents an operation.
//      *
//      * @param name of the statistic
//      * @return
//      */
//     boolean isOperation(String name);
// 
//     /**
//      * return true if the specified name represents an attribute.
//      *
//      * @param name of the statistic
//      * @return
//      */
//     boolean isAttribute(String name);
// 
//     /**
//      * return true if the specified name represents a writeable attribute
//      * @param name of the statistics
//      * @return
//      */
//     boolean isWriteable(String name);
// 
//     /**
//      * for loading descriptions of statistics/operations
//      *
//      * @return name of resource bundle name
//      */
//     String getResourceBundleName();
// 
//     /**
//      * gets the key prefix for referencing descriptions of statistics/operations
//      *
//      * @return
//      */
//     String getResourceBundleKeyPrefix();
// 
//     /**
//      * Get the value of the statistics
//      *
//      * @param name The name of the statistics
//      * @return The value
//      */
//     Object getValue(String name, EntityManagerFactoryAccess entityManagerFactoryAccess, StatisticName statisticName, PathAddress pathAddress);
// 
//     /**
//      * Set the value of the statistic (isWriteable must return true)
//      * @param name
//      * @param newValue
//      */
//     void setValue(String name, Object newValue, EntityManagerFactoryAccess entityManagerFactoryAccess, StatisticName statisticName, PathAddress pathAddress);
// 
//     /**
//      * get the names of the children statistic levels (if any)
//      * @return set of names
//      */
//     Set<String> getChildrenNames();
// 
//     /**
//      * get the specified children statistics
//      * @param childName name of the statistics to return
//      * @return
//      */
//     Statistics getChild(String childName);
// 
// 
// }


import org.jipijapa.management.spi.Statistics;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.Cache;
import javax.persistence.EntityManagerFactory;
import org.hibernate.SessionFactory;
import org.hibernate.jpa.HibernateEntityManagerFactory;
import org.jipijapa.management.spi.EntityManagerFactoryAccess;
import org.jipijapa.management.spi.Operation;
import org.jipijapa.management.spi.PathAddress;
    public Statistics getChild(String childName) {
        return childrenStatistics.get(childName);
    }

    static final org.hibernate.stat.Statistics getStatistics(final EntityManagerFactory entityManagerFactory) {
        HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
        SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
        if (sessionFactory != null) {
            return sessionFactory.getStatistics();
        }
        return null;
    }

    @Override
    public Collection<String> getDynamicChildrenNames(EntityManagerFactoryAccess entityManagerFactoryLookup, PathAddress pathAddress) {

        return Collections.EMPTY_LIST;
    }

    private Operation clear = new Operation() {
        @Override
        public Object invoke(Object... args) {
            getStatistics(getEntityManagerFactory(args)).clear();
            return null;
        }
    };

    private Operation label = new Operation() {
        @Override
        public Object invoke(Object... args) {
// Path: spi/src/main/java/org/jipijapa/management/spi/EntityManagerFactoryAccess.java
// public interface EntityManagerFactoryAccess {
//     /**
//      * returns the entity manager factory that statistics should be obtained for.
//      *
//      * @throws IllegalStateException if scopedPersistenceUnitName is not found
//      *
//      * @param scopedPersistenceUnitName is persistence unit name scoped to the current platform
//      *
//      * @return EntityManagerFactory
//      */
//     EntityManagerFactory entityManagerFactory(String scopedPersistenceUnitName) throws IllegalStateException;
// 
// }
// 
// Path: spi/src/main/java/org/jipijapa/management/spi/Operation.java
// public interface Operation {
// 
//     /**
//      * Invoke operation
//      * @param args will be passed to invoked operation
//      * @return
//      */
//     Object invoke(Object... args);
// }
// 
// Path: spi/src/main/java/org/jipijapa/management/spi/PathAddress.java
// public interface PathAddress {
// 
//     int size();
// 
//     String getValue(String name);
//     String getValue(int index);
// }
// 
// Path: spi/src/main/java/org/jipijapa/management/spi/Statistics.java
// public interface Statistics {
// 
// 
//     /**
//      * Get the statistics names
//      *
//      * @return The value
//      */
//     Set<String> getNames();
// 
//     Collection<String> getDynamicChildrenNames(EntityManagerFactoryAccess entityManagerFactoryAccess, PathAddress pathAddress);
// 
//     /**
//      * Get the type
//      *
//      * @param name of the statistic
//      * @return The value
//      */
//     Class getType(String name);
// 
//     /**
//      * return true if the specified name represents an operation.
//      *
//      * @param name of the statistic
//      * @return
//      */
//     boolean isOperation(String name);
// 
//     /**
//      * return true if the specified name represents an attribute.
//      *
//      * @param name of the statistic
//      * @return
//      */
//     boolean isAttribute(String name);
// 
//     /**
//      * return true if the specified name represents a writeable attribute
//      * @param name of the statistics
//      * @return
//      */
//     boolean isWriteable(String name);
// 
//     /**
//      * for loading descriptions of statistics/operations
//      *
//      * @return name of resource bundle name
//      */
//     String getResourceBundleName();
// 
//     /**
//      * gets the key prefix for referencing descriptions of statistics/operations
//      *
//      * @return
//      */
//     String getResourceBundleKeyPrefix();
// 
//     /**
//      * Get the value of the statistics
//      *
//      * @param name The name of the statistics
//      * @return The value
//      */
//     Object getValue(String name, EntityManagerFactoryAccess entityManagerFactoryAccess, StatisticName statisticName, PathAddress pathAddress);
// 
//     /**
//      * Set the value of the statistic (isWriteable must return true)
//      * @param name
//      * @param newValue
//      */
//     void setValue(String name, Object newValue, EntityManagerFactoryAccess entityManagerFactoryAccess, StatisticName statisticName, PathAddress pathAddress);
// 
//     /**
//      * get the names of the children statistic levels (if any)
//      * @return set of names
//      */
//     Set<String> getChildrenNames();
// 
//     /**
//      * get the specified children statistics
//      * @param childName name of the statistics to return
//      * @return
//      */
//     Statistics getChild(String childName);
// 
// 
// }


// Path: hibernate4_3/src/main/java/org/jboss/as/jpa/hibernate4/management/HibernateStatistics.java
import org.jipijapa.management.spi.Statistics;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.Cache;
import javax.persistence.EntityManagerFactory;
import org.hibernate.SessionFactory;
import org.hibernate.jpa.HibernateEntityManagerFactory;
import org.jipijapa.management.spi.EntityManagerFactoryAccess;
import org.jipijapa.management.spi.Operation;
import org.jipijapa.management.spi.PathAddress;

    public Statistics getChild(String childName) {
        return childrenStatistics.get(childName);
    }

    static final org.hibernate.stat.Statistics getStatistics(final EntityManagerFactory entityManagerFactory) {
        HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
        SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
        if (sessionFactory != null) {
            return sessionFactory.getStatistics();
        }
        return null;
    }

    @Override
    public Collection<String> getDynamicChildrenNames(EntityManagerFactoryAccess entityManagerFactoryLookup, PathAddress pathAddress) {

        return Collections.EMPTY_LIST;
    }

    private Operation clear = new Operation() {
        @Override
        public Object invoke(Object... args) {
            getStatistics(getEntityManagerFactory(args)).clear();
            return null;
        }
    };

    private Operation label = new Operation() {
        @Override
        public Object invoke(Object... args) {
            PathAddress pathAddress = getPathAddress(args);