All Downloads are FREE. Search and download functionalities are using the official Maven repository.

infinispan.com.mchange.v2.c3p0.impl.DriverManagerDataSourceBase Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
/*
 * This class autogenerated by com.mchange.v2.c3p0.codegen.BeangenDataSourceGenerator.
 * Fri Apr 04 04:08:15 MST 2014
 * DO NOT HAND EDIT!
 */

package com.mchange.v2.c3p0.impl;

import java.util.*;
import com.mchange.v2.c3p0.C3P0Registry;
import com.mchange.v2.c3p0.cfg.C3P0Config;
import com.mchange.v2.c3p0.impl.AuthMaskingProperties;
import com.mchange.v2.c3p0.impl.C3P0ImplUtils;
import com.mchange.v2.naming.JavaBeanObjectFactory;
import com.mchange.v2.naming.JavaBeanReferenceMaker;
import com.mchange.v2.naming.ReferenceIndirector;
import com.mchange.v2.naming.ReferenceMaker;
import com.mchange.v2.ser.IndirectlySerialized;
import com.mchange.v2.ser.Indirector;
import com.mchange.v2.ser.SerializableUtils;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.Referenceable;

/**
 * This class was generated by com.mchange.v2.c3p0.codegen.BeangenDataSourceGenerator.
 */
public abstract class DriverManagerDataSourceBase extends IdentityTokenResolvable implements Referenceable, Serializable
{
	protected PropertyChangeSupport pcs = new PropertyChangeSupport( this );
	
	protected PropertyChangeSupport getPropertyChangeSupport()
	{ return pcs; }
	protected String description;
	protected String driverClass = C3P0Config.initializeStringPropertyVar("driverClass", C3P0Defaults.driverClass());
	protected String factoryClassLocation = C3P0Config.initializeStringPropertyVar("factoryClassLocation", C3P0Defaults.factoryClassLocation());
	protected boolean forceUseNamedDriverClass = C3P0Config.initializeBooleanPropertyVar("forceUseNamedDriverClass", C3P0Defaults.forceUseNamedDriverClass());
	private volatile String identityToken;
	protected String jdbcUrl = C3P0Config.initializeStringPropertyVar("jdbcUrl", C3P0Defaults.jdbcUrl());
	protected Properties properties = new AuthMaskingProperties();
	
	public synchronized String getDescription()
	{ return description; }
	
	public synchronized void setDescription( String description )
	{
		this.description = description;
	}
	
	public synchronized String getDriverClass()
	{ return driverClass; }
	
	public synchronized void setDriverClass( String driverClass )
	{
		String oldVal = this.driverClass;
		this.driverClass = driverClass;
		if ( ! eqOrBothNull( oldVal, driverClass ) )
			pcs.firePropertyChange( "driverClass", oldVal, driverClass );
	}
	
	public synchronized String getFactoryClassLocation()
	{ return factoryClassLocation; }
	
	public synchronized void setFactoryClassLocation( String factoryClassLocation )
	{
		this.factoryClassLocation = factoryClassLocation;
	}
	
	public synchronized boolean isForceUseNamedDriverClass()
	{ return forceUseNamedDriverClass; }
	
	public synchronized void setForceUseNamedDriverClass( boolean forceUseNamedDriverClass )
	{
		this.forceUseNamedDriverClass = forceUseNamedDriverClass;
	}
	
	public String getIdentityToken()
	{ return identityToken; }
	
	public void setIdentityToken( String identityToken )
	{
		String oldVal = this.identityToken;
		this.identityToken = identityToken;
		if ( ! eqOrBothNull( oldVal, identityToken ) )
			pcs.firePropertyChange( "identityToken", oldVal, identityToken );
	}
	
	public synchronized String getJdbcUrl()
	{ return jdbcUrl; }
	
	public synchronized void setJdbcUrl( String jdbcUrl )
	{
		this.jdbcUrl = jdbcUrl;
	}
	
	public synchronized Properties getProperties()
	{ return (Properties) AuthMaskingProperties.fromAnyProperties( properties ); }
	
	public synchronized void setProperties( Properties properties )
	{
		Properties oldVal = this.properties;
		this.properties = (Properties) AuthMaskingProperties.fromAnyProperties( properties );
		if ( ! eqOrBothNull( oldVal, properties ) )
			pcs.firePropertyChange( "properties", oldVal, properties );
	}
	
	public void addPropertyChangeListener( PropertyChangeListener pcl )
	{ pcs.addPropertyChangeListener( pcl ); }
	
	public void addPropertyChangeListener( String propName, PropertyChangeListener pcl )
	{ pcs.addPropertyChangeListener( propName, pcl ); }
	
	public void removePropertyChangeListener( PropertyChangeListener pcl )
	{ pcs.removePropertyChangeListener( pcl ); }
	
	public void removePropertyChangeListener( String propName, PropertyChangeListener pcl )
	{ pcs.removePropertyChangeListener( propName, pcl ); }
	
	public PropertyChangeListener[] getPropertyChangeListeners()
	{ return pcs.getPropertyChangeListeners(); }
	private boolean eqOrBothNull( Object a, Object b )
	{
		return
			a == b ||
			(a != null && a.equals(b));
	}
	
	private static final long serialVersionUID = 1;
	private static final short VERSION = 0x0001;
	
	private void writeObject( ObjectOutputStream oos ) throws IOException
	{
		oos.writeShort( VERSION );
		oos.writeObject( description );
		oos.writeObject( driverClass );
		oos.writeObject( factoryClassLocation );
		oos.writeBoolean(forceUseNamedDriverClass);
		oos.writeObject( identityToken );
		oos.writeObject( jdbcUrl );
		oos.writeObject( properties );
	}
	
	private void readObject( ObjectInputStream ois ) throws IOException, ClassNotFoundException
	{
		short version = ois.readShort();
		switch (version)
		{
			case VERSION:
				this.description = (String) ois.readObject();
				this.driverClass = (String) ois.readObject();
				this.factoryClassLocation = (String) ois.readObject();
				this.forceUseNamedDriverClass = ois.readBoolean();
				this.identityToken = (String) ois.readObject();
				this.jdbcUrl = (String) ois.readObject();
				this.properties = (Properties) ois.readObject();
				this.pcs = new PropertyChangeSupport( this );
				break;
			default:
				throw new IOException("Unsupported Serialized Version: " + version);
		}
	}
	
	// JDK7 add-on
	public Logger getParentLogger() throws SQLFeatureNotSupportedException
	{ return C3P0ImplUtils.PARENT_LOGGER;}
	
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append( super.toString() );
		sb.append(" [ ");
		sb.append( "description -> " + description );
		sb.append( ", ");
		sb.append( "driverClass -> " + driverClass );
		sb.append( ", ");
		sb.append( "factoryClassLocation -> " + factoryClassLocation );
		sb.append( ", ");
		sb.append( "forceUseNamedDriverClass -> " + forceUseNamedDriverClass );
		sb.append( ", ");
		sb.append( "identityToken -> " + identityToken );
		sb.append( ", ");
		sb.append( "jdbcUrl -> " + jdbcUrl );
		sb.append( ", ");
		sb.append( "properties -> " + properties );
		
		String extraToStringInfo = this.extraToStringInfo();
		if (extraToStringInfo != null)
			sb.append( extraToStringInfo );
		sb.append(" ]");
		return sb.toString();
	}
	
	protected String extraToStringInfo()
	{ return null; }
	
	final static JavaBeanReferenceMaker referenceMaker = new com.mchange.v2.naming.JavaBeanReferenceMaker();
	
	static
	{
		referenceMaker.setFactoryClassName( "com.mchange.v2.c3p0.impl.C3P0JavaBeanObjectFactory" );
		referenceMaker.addReferenceProperty("description");
		referenceMaker.addReferenceProperty("driverClass");
		referenceMaker.addReferenceProperty("factoryClassLocation");
		referenceMaker.addReferenceProperty("forceUseNamedDriverClass");
		referenceMaker.addReferenceProperty("identityToken");
		referenceMaker.addReferenceProperty("jdbcUrl");
		referenceMaker.addReferenceProperty("properties");
	}
	
	public Reference getReference() throws NamingException
	{
		return referenceMaker.createReference( this );
	}
	
	private DriverManagerDataSourceBase()
	{}
	
	public DriverManagerDataSourceBase( boolean autoregister )
	{
		if (autoregister)
		{
			this.identityToken = C3P0ImplUtils.allocateIdentityToken( this );
			C3P0Registry.reregister( this );
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy