Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*/
package org.hibernate.agroal.internal;

import java.util.Collections;

import org.hibernate.boot.registry.selector.SimpleStrategyRegistrationImpl;
import org.hibernate.boot.registry.selector.StrategyRegistration;
import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;

import static java.util.Collections.singleton;

/**
* Provides the {@link AgroalConnectionProvider} to the
* {@link org.hibernate.boot.registry.selector.spi.StrategySelector} service.
Expand All @@ -20,16 +20,15 @@
public final class StrategyRegistrationProviderImpl implements StrategyRegistrationProvider {

@Override
public Iterable<StrategyRegistration> getStrategyRegistrations() {
final SimpleStrategyRegistrationImpl<ConnectionProvider> strategyRegistration = new SimpleStrategyRegistrationImpl<>(
public Iterable<StrategyRegistration<?>> getStrategyRegistrations() {
return singleton( new SimpleStrategyRegistrationImpl<>(
ConnectionProvider.class,
AgroalConnectionProvider.class,
AgroalConnectionProvider.class.getSimpleName(),
"agroal",
"Agroal",
// for consistency's sake
"org.hibernate.connection.AgroalConnectionProvider"
);
return Collections.singleton( strategyRegistration );
) );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*/
package org.hibernate.c3p0.internal;

import java.util.Collections;

import org.hibernate.boot.registry.selector.SimpleStrategyRegistrationImpl;
import org.hibernate.boot.registry.selector.StrategyRegistration;
import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;

import static java.util.Collections.singleton;

/**
* Provides the {@link C3P0ConnectionProvider} to the
* {@link org.hibernate.boot.registry.selector.spi.StrategySelector} service.
Expand All @@ -20,8 +20,8 @@
public final class StrategyRegistrationProviderImpl implements StrategyRegistrationProvider {

@Override
public Iterable<StrategyRegistration> getStrategyRegistrations() {
final SimpleStrategyRegistrationImpl<ConnectionProvider> c3p0 = new SimpleStrategyRegistrationImpl<>(
public Iterable<StrategyRegistration<?>> getStrategyRegistrations() {
return singleton( new SimpleStrategyRegistrationImpl<>(
ConnectionProvider.class,
C3P0ConnectionProvider.class,
"c3p0",
Expand All @@ -30,7 +30,6 @@ public Iterable<StrategyRegistration> getStrategyRegistrations() {
"org.hibernate.connection.C3P0ConnectionProvider",
// legacy
"org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider"
);
return Collections.singleton( c3p0 );
) );
}
}
185 changes: 147 additions & 38 deletions hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@
package org.hibernate.boot;

import org.hibernate.Internal;
import org.hibernate.boot.jaxb.Origin;
import org.hibernate.boot.model.relational.Namespace;
import org.hibernate.internal.log.SubSystemLogging;

import java.io.File;
import java.io.FileNotFoundException;
import java.lang.invoke.MethodHandles;

import org.hibernate.type.SerializationException;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.jboss.logging.annotations.ValidIdRange;
import org.jboss.logging.annotations.ValidIdRanges;

import static org.jboss.logging.Logger.Level.DEBUG;
import static org.jboss.logging.Logger.Level.TRACE;
import static org.jboss.logging.Logger.Level.WARN;
import static org.jboss.logging.Logger.Level.INFO;

/**
* Logging related to Hibernate bootstrapping
Expand All @@ -34,7 +32,10 @@
description = "Logging related to bootstrapping of a SessionFactory / EntityManagerFactory"
)
@MessageLogger(projectCode = "HHH")
@ValidIdRange(min = 160101, max = 160200)
@ValidIdRanges({
@ValidIdRange(min = 160101, max = 160200),
@ValidIdRange(min = 160201, max = 160260)
})
@Internal
public interface BootLogging extends BasicLogger {
String NAME = SubSystemLogging.BASE + ".boot";
Expand All @@ -44,34 +45,6 @@ public interface BootLogging extends BasicLogger {
@Message(id = 160101, value = "Duplicate generator name %s")
void duplicateGeneratorName(String name);

@LogMessage(level = INFO)
@Message(id = 160102, value = "Reading mappings from file: %s")
void readingMappingsFromFile(String path);

@LogMessage(level = INFO)
@Message(id = 160103, value = "Reading mappings from cache file: %s")
void readingCachedMappings(File cachedFile);

@LogMessage(level = WARN)
@Message(id = 160104, value = "Could not deserialize cache file [%s]: %s")
void unableToDeserializeCache(String path, SerializationException error);

@LogMessage(level = WARN)
@Message(id = 160105, value = "I/O reported error writing cached file: [%s]: %s")
void unableToWriteCachedFile(String path, String message);

@LogMessage(level = WARN)
@Message(id = 160106, value = "Could not update cached file timestamp: [%s]")
@SuppressWarnings("unused")
void unableToUpdateCachedFileTimestamp(String path);

@LogMessage(level = WARN)
@Message(id = 160107, value = "I/O reported cached file could not be found: [%s]: %s")
void cachedFileNotFound(String path, FileNotFoundException error);

@LogMessage(level = INFO)
@Message(id = 160108, value = "Omitting cached file [%s] as the mapping file is newer")
void cachedFileObsolete(File cachedFile);

@LogMessage(level = DEBUG)
@Message(id = 160111, value = "Package not found or no package-info.java: %s")
Expand Down Expand Up @@ -268,10 +241,6 @@ public interface BootLogging extends BasicLogger {
@Message(id = 160178, value = "Mapping entity secondary table: %s -> %s")
void mappingEntitySecondaryTableToTable(String entityName, String tableName);

@LogMessage(level = TRACE)
@Message(id = 160179, value = "Writing cache file for: %s to: %s")
void writingCacheFile(String xmlPath, String serPath);

@LogMessage(level = DEBUG)
@Message(id = 160180, value = "Unexpected ServiceRegistry type [%s] encountered during building of MetadataSources; may cause problems later attempting to construct MetadataBuilder")
void unexpectedServiceRegistryType(String registryType);
Expand Down Expand Up @@ -313,6 +282,7 @@ public interface BootLogging extends BasicLogger {
void duplicatedFetchProfile(String name);

// EntityBinder discriminator handling

@LogMessage(level = TRACE)
@Message(id = 160190, value = "Ignoring explicit @DiscriminatorColumn annotation on: %s")
void ignoringExplicitDiscriminatorForJoined(String className);
Expand All @@ -321,7 +291,8 @@ public interface BootLogging extends BasicLogger {
@Message(id = 160191, value = "Inferring implicit @DiscriminatorColumn using defaults for: %s")
void inferringImplicitDiscriminatorForJoined(String className);

// GeneratorBinder additions
// GeneratorBinder

@LogMessage(level = TRACE)
@Message(id = 160192, value = "Added generator with name: %s, strategy: %s")
void addedGenerator(String name, String strategy);
Expand All @@ -340,4 +311,142 @@ public interface BootLogging extends BasicLogger {
ServiceRegistry passed to MetadataBuilder was a BootstrapServiceRegistry; \
this likely won't end well if attempt is made to build SessionFactory""")
void badServiceRegistry();

@LogMessage(level = DEBUG)
@Message(id = 160201, value = "Unable to close cfg.xml resource stream")
void unableToCloseCfgXmlResourceStream(@Cause Throwable e);

@LogMessage(level = DEBUG)
@Message(id = 160202, value = "Unable to close cfg.xml URL stream")
void unableToCloseCfgXmlUrlStream(@Cause Throwable e);

@LogMessage(level = DEBUG)
@Message(id = 160203, value = "Unable to close properties file stream [%s]")
void unableToClosePropertiesFileStream(String path, @Cause Throwable e);

@LogMessage(level = DEBUG)
@Message(id = 160204, value = "cfg.xml document did not define namespaces; wrapping in custom event reader to introduce namespace information")
void cfgXmlDocumentDidNotDefineNamespaces();

@LogMessage(level = DEBUG)
@Message(id = 160212, value = "Unable to adjust relative <jar-file/> URL [%s] relative to root URL [%s]")
void unableToAdjustRelativeJarFileUrl(String filePart, String rootPath, @Cause Throwable e);

@LogMessage(level = TRACE)
@Message(id = 160213, value = "JAR URL from URL Entry: %s >> %s")
void jarUrlFromUrlEntry(String url, String jarUrl);

@LogMessage(level = TRACE)
@Message(id = 160217, value = "Registering AttributeConverter '%s'")
void registeringAttributeConverter(String converter);

@LogMessage(level = DEBUG)
@Message(id = 160218, value = "Skipping registration of discovered AttributeConverter '%s' for auto-apply")
void skippingRegistrationAttributeConverterForAutoApply(String converter);

@LogMessage(level = DEBUG)
@Message(id = 160219, value = "Skipping duplicate '@ConverterRegistration' for '%s'")
void skippingDuplicateConverterRegistration(String converter);

@LogMessage(level = DEBUG)
@Message(id = 160220, value = "Removed potentially auto-applicable converter '%s' due to @ConverterRegistration")
void removedPotentiallyAutoApplicableConverterDueToRegistration(String converter);

@LogMessage(level = DEBUG)
@Message(id = 160221, value = "Overwrote existing registration [%s] for type definition.")
void overwroteExistingRegistrationForTypeDefinition(String name);

@LogMessage(level = TRACE)
@Message(id = 160222, value = "Injecting JPA temp ClassLoader [%s] into BootstrapContext; was [%s]")
void injectingJpaTempClassLoader(Object newLoader, Object oldLoader);

@LogMessage(level = TRACE)
@Message(id = 160223, value = "Injecting ScanOptions [%s] into BootstrapContext; was [%s]")
void injectingScanOptions(Object newOptions, Object oldOptions);

@LogMessage(level = TRACE)
@Message(id = 160224, value = "Injecting ScanEnvironment [%s] into BootstrapContext; was [%s]")
void injectingScanEnvironment(Object newEnv, Object oldEnv);

@LogMessage(level = TRACE)
@Message(id = 160225, value = "Injecting Scanner [%s] into BootstrapContext; was [%s]")
void injectingScanner(Object newScanner, Object oldScanner);

@LogMessage(level = TRACE)
@Message(id = 160226, value = "Injecting ArchiveDescriptorFactory [%s] into BootstrapContext; was [%s]")
void injectingArchiveDescriptorFactory(Object newFactory, Object oldFactory);

// Strategy selector

@LogMessage(level = TRACE)
@Message(id = 160227, value = "Strategy selector for %s: '%s' -> %s")
void strategySelectorMapping(String strategySimpleName, String name, String implementationName);

@LogMessage(level = TRACE)
@Message(id = 160228, value = "Strategy selector for %s: '%s' -> %s (replacing %s)")
void strategySelectorMappingReplacing(String strategySimpleName, String name, String implementationName, String oldImplementationName);

@LogMessage(level = DEBUG)
@Message(id = 160229, value = "Named strategy map did not exist on call to unregister")
void namedStrategyMapDidNotExistOnUnregister();

// LoadedConfig

@LogMessage(level = DEBUG)
@Message(id = 160230, value = "Listener [%s] defined as part of a group also defined event type")
void listenerDefinedAlsoDefinedEventType(String listenerClass);

@LogMessage(level = DEBUG)
@Message(id = 160231, value = "More than one cfg.xml file attempted to supply SessionFactory name: [%s], [%s]. Keeping initially discovered one [%s]")
void moreThanOneCfgXmlSuppliedSessionFactoryName(String first, String second, String keeping);

// HBM binding

@LogMessage(level = TRACE)
@Message(id = 160233, value = "Creating FetchProfile: %s")
void creatingFetchProfile(String name);

@LogMessage(level = TRACE)
@Message(id = 160234, value = "Processing <identifier-generator/> : %s")
void processingIdentifierGenerator(String name);

@LogMessage(level = TRACE)
@Message(id = 160235, value = "Processed type definition : %s -> %s")
void processedTypeDefinition(String name, String impl);

@LogMessage(level = TRACE)
@Message(id = 160236, value = "No temp ClassLoader provided; using live ClassLoader to load potentially unsafe class: %s")
void noTempClassLoaderProvidedUsingLiveClassLoader(String className);

@LogMessage(level = TRACE)
@Message(id = 160237, value = "Registering non-interface strategy : %s")
void registeringNonInterfaceStrategy(String roleName);

@LogMessage(level = TRACE)
@Message(id = 160238, value = "Indexing mapping document [%s] for purpose of building entity hierarchy ordering")
void indexingMappingDocumentForHierarchyOrdering(String mappingDocumentName);

@LogMessage(level = DEBUG)
@Message(id = 160239, value = "Applying filter definition with condition: %s")
void applyingFilterDefinitionCondition(String condition);

@LogMessage(level = TRACE)
@Message(id = 160240, value = "Processed filter definition: %s")
void processedFilterDefinition(String name);

@LogMessage(level = DEBUG)
@Message(id = 160241, value = "Entity supertype named as extends [%s] for subclass [%s:%s] not found")
void entitySupertypeExtendsNotFound(String extendsName, Origin origin, String subclassName);

@LogMessage(level = DEBUG)
@Message(id = 160242, value = "filter-def [name=%s, origin=%s] defined multiple conditions, accepting arbitrary one")
void filterDefDefinedMultipleConditions(String name, String origin);

@LogMessage(level = TRACE)
@Message(id = 160243, value = "Checking auto-apply AttributeConverter [%s] (domain-type=%s) for match against %s : %s.%s (type=%s)")
void checkingAutoApplyAttributeConverter(String converterClass, String domainTypeSignature, String siteDescriptor, String declaringType, String memberName, String memberTypeName);

@LogMessage(level = DEBUG)
@Message(id = 160244, value = "Skipping HBM processing of entity hierarchy [%s], as at least one entity [%s] has been processed")
void skippingHbmProcessingOfEntityHierarchy(String rootEntityName, String processedEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.hibernate.boot.archive.spi.ArchiveException;

import org.jboss.logging.Logger;

/**
* Helper for dealing with archives
Expand All @@ -23,7 +22,6 @@
* @author Steve Ebersole
*/
public class ArchiveHelper {
private static final Logger LOG = Logger.getLogger( ArchiveHelper.class );

/**
* Get the JAR URL of the JAR containing the given entry.
Expand Down Expand Up @@ -91,7 +89,7 @@ else if ( "zip".equals( protocol )
"Unable to determine JAR Url from " + url + ". Cause: " + e.getMessage()
);
}
LOG.tracef( "JAR URL from URL Entry: %s >> %s", url, jarUrl );
org.hibernate.boot.BootLogging.BOOT_LOGGER.jarUrlFromUrlEntry( String.valueOf(url), String.valueOf(jarUrl) );
return jarUrl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.hibernate.boot.archive.spi.JarFileEntryUrlAdjuster;
import org.hibernate.internal.util.StringHelper;

import org.jboss.logging.Logger;
import static org.hibernate.boot.BootLogging.BOOT_LOGGER;

/**
* Standard implementation of ArchiveDescriptorFactory
Expand All @@ -23,7 +23,6 @@
* @author Steve Ebersole
*/
public class StandardArchiveDescriptorFactory implements ArchiveDescriptorFactory, JarFileEntryUrlAdjuster {
private static final Logger LOG = Logger.getLogger( StandardArchiveDescriptorFactory.class );

/**
* Singleton access
Expand Down Expand Up @@ -129,14 +128,11 @@ public URL adjustJarFileEntryUrl(URL url, URL rootUrl) {
}
catch (MalformedURLException e) {
// allow to pass through to return the original URL
if ( LOG.isDebugEnabled() ) {
LOG.debugf(
e,
"Unable to adjust relative <jar-file/> URL [%s] relative to root URL [%s]",
filePart,
rootUrlFile.getAbsolutePath()
);
}
BOOT_LOGGER.unableToAdjustRelativeJarFileUrl(
filePart,
rootUrlFile.getAbsolutePath(),
e
);
}

return url;
Expand Down
Loading