Gets the proxy factory.

@param persistentClass
the persistent class
@param interfaces
the interfaces
@return the proxy factory
@throws PersistenceException
the persistence exception
5740
public static Class getProxyFactory(Class persistentClass, Class[] interfaces) throws PersistenceException
    {
        Enhancer e = new Enhancer();
        e.setSuperclass(interfaces.length == 1 ? persistentClass : null);
        e.setInterfaces(interfaces);
        e.setCallbackTypes(new Class[] { InvocationHandler.class, NoOp.class, });
        e.setCallbackFilter(FINALIZE_FILTER);
        e.setUseFactory(false);
        e.setInterceptDuringConstruction(false);
        return e.createClass();
    }
71777
@Override
    protected Class<?> resolveProxyClass(String[] interfaceNames) throws ClassNotFoundException {
        ClassLoader proxyClassLoader = classLoader;
        Class<?>[] interfaces = new Class[interfaceNames.length];
        Class<?> nonPublicInterface = null;

        for (int i = 0; i < interfaceNames.length; i++) {
            Class<?> intf = loadClass(interfaceNames[i]);

            if (!Modifier.isPublic(intf.getModifiers())) {
                ClassLoader classLoader = getClassLoader(intf);
                if (nonPublicInterface != null) {
                    if (classLoader != proxyClassLoader) {
                        throw new IllegalAccessError(nonPublicInterface + " and " + intf + " both declared non-public in different class loaders");
                    }
                } else {
                    nonPublicInterface = intf;
                    proxyClassLoader = classLoader;
                }
            }

            interfaces[i] = intf;
        }

        try {
            return Proxy.getProxyClass(proxyClassLoader, interfaces);
        } catch (IllegalArgumentException ex) {
            throw new ClassNotFoundException(null, ex);
        }
    }
896320
@SuppressWarnings("unchecked")
    public <T> T proxy(final Object delegate, Class<?> [] interfaces)
    {
        return (T)Proxy.newProxyInstance
            (delegate.getClass().getClassLoader(),
             interfaces,
             new ProxyInvocationHandler(delegate));
    }
755900
public static <T> T create(Class<T> proxyInterface) {
    return create(proxyInterface, Thread.currentThread().getContextClassLoader());
  }
707512
@Override
  public <T> ConnectionFactory<T> getConnectionFactory(final Identifier connFactoryId) {
    final ConnectionFactory<T> connFactory = connFactoryMap.get(connFactoryId.toString());
    if (connFactory == null) {
      throw new RuntimeException("Cannot find ConnectionFactory of " + connFactoryId + ".");
    }
    return connFactory;
  }
483313
public PersistenceManager getPersistenceManager() {
        if (persistenceManager == null) {
            try {
                persistenceManager = getPresentationManager().newPersistenceManager();
            } catch (Exception ex) {
                getPresentationManager().error(ex);
                throw new ConnectionNotFoundException();
            }
        }
        return persistenceManager;
    }
874541
protected FactoryBuilderSupport getProxyBuilder() {
        FactoryBuilderSupport proxy = localProxyBuilder.get();
        if (proxy == null) {
            return globalProxyBuilder;
        } else {
            return proxy;
        }
    }
784478
public IRestfulClientFactory getRestfulClientFactory() {
		if (myRestfulClientFactory == null) {
			try {
				myRestfulClientFactory = (IRestfulClientFactory) ReflectionUtil.newInstance(Class.forName("ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory"), FhirContext.class, this);
			} catch (ClassNotFoundException e) {
				throw new ConfigurationException("hapi-fhir-client does not appear to be on the classpath");
			}
		}
		return myRestfulClientFactory;
	}
1137651
protected DbEntity cacheFilter(DbEntity persistentObject) {
    DbEntity cachedPersistentObject = dbEntityCache.get(persistentObject.getClass(), persistentObject.getId());
    if (cachedPersistentObject!=null) {
      return cachedPersistentObject;
    }
    else {
      return persistentObject;
    }

  }
723238
public void retrieveReferences(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException
    {
        Iterator i = cld.getObjectReferenceDescriptors().iterator();

        // turn off auto prefetching for related proxies
        final Class saveClassToPrefetch = classToPrefetch;
        classToPrefetch = null;

        pb.getInternalCache().enableMaterializationCache();
        try
        {
            while (i.hasNext())
            {
                ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
                retrieveReference(newObj, cld, rds, forced);
            }

            pb.getInternalCache().disableMaterializationCache();
        }
        catch(RuntimeException e)
        {
            pb.getInternalCache().doLocalClear();
            throw e;
        }
        finally
        {
            classToPrefetch = saveClassToPrefetch;
        }
    }
142761
public List<PersistenceContextRefType<InterceptorType<T>>> getAllPersistenceContextRef()
   {
      List<PersistenceContextRefType<InterceptorType<T>>> list = new ArrayList<PersistenceContextRefType<InterceptorType<T>>>();
      List<Node> nodeList = childNode.get("persistence-context-ref");
      for(Node node: nodeList)
      {
         PersistenceContextRefType<InterceptorType<T>>  type = new PersistenceContextRefTypeImpl<InterceptorType<T>>(this, "persistence-context-ref", childNode, node);
         list.add(type);
      }
      return list;
   }
167010
@Override
    protected Client<?> instantiateClient(String persistenceUnit)
    {
        return new DSClient(this, persistenceUnit, externalProperties, kunderaMetadata, reader, timestampGenerator);
    }
165816
public Class getPersistentFieldClass()
    {
        if (m_persistenceClass == null)
        {
            Properties properties = new Properties();
            try
            {
                this.logWarning("Loading properties file: " + getPropertiesFile());
                properties.load(new FileInputStream(getPropertiesFile()));
            }
            catch (IOException e)
            {
                this.logWarning("Could not load properties file '" + getPropertiesFile()
                        + "'. Using PersistentFieldDefaultImpl.");
                e.printStackTrace();
            }
            try
            {
                String className = properties.getProperty("PersistentFieldClass");

                m_persistenceClass = loadClass(className);
            }
            catch (ClassNotFoundException e)
            {
                e.printStackTrace();
                m_persistenceClass = PersistentFieldPrivilegedImpl.class;
            }
            logWarning("PersistentFieldClass: " + m_persistenceClass.toString());
        }
        return m_persistenceClass;
    }
1024804
public SheetMapperFactory getterFactory(GetterFactory<Row, CsvColumnKey> getterFactory) {
        return super.addGetterFactory(new ContextualGetterFactoryAdapter<Row, CsvColumnKey>(getterFactory));
    }
10377
public JdbcMapperFactory getterFactory(final GetterFactory<ResultSet, JdbcColumnKey> getterFactory) {
		return addGetterFactory(new ContextualGetterFactoryAdapter<ResultSet, JdbcColumnKey>(getterFactory));
	}
1031895
public static QueryRunner createProxy(final DataSourceFactory dataSourceFactory) {
        final QueryRunnerInterceptor handler = new QueryRunnerInterceptor(dataSourceFactory);

        final Enhancer e = new Enhancer();

        // make sure we're Serializable and have a write replace method
        e.setInterfaces(new Class[] { Serializable.class, IWriteReplace.class });
        e.setSuperclass(QueryRunner.class);
        e.setCallback(handler);
        e.setNamingPolicy(new DefaultNamingPolicy() {
            @Override
            public String getClassName(final String prefix,
                                       final String source,
                                       final Object key,
                                       final Predicate names) {
                return super.getClassName("PROXY_" + prefix, source, key, names);
            }
        });

        LOG.trace("Created proxy for an EntityManager");

        return (QueryRunner)e.create();

    }
1230456
protected <T> T createProxy(Class<T> interfaceClass) throws Exception {
        return createProxy(interfaceClass, getSession());
    }