text:
package io.druid.server.http;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.smile.SmileMediaTypes;
import com.google.common.base.Strings;
import com.google.inject.Inject;

import io.druid.audit.AuditInfo;
import io.druid.audit.AuditManager;
import io.druid.common.utils.ServletResourceUtils;
import io.druid.guice.annotations.Json;
import io.druid.guice.annotations.Smile;
import io.druid.java.util.common.IAE;
import io.druid.java.util.common.RE;
import io.druid.java.util.common.logger.Logger;
import io.druid.server.lookup.cache.LookupCoordinatorManager;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

/**
 * Contains information about lookups exposed through the coordinator
 */
@Path("/druid/coordinator/v1/lookups")
public class LookupCoordinatorResource
{
  private static final Logger LOG = new Logger(LookupCoordinatorResource.class);
  private final LookupCoordinatorManager lookupCoordinatorManager;
  private final ObjectMapper smileMapper;
  private final ObjectMapper jsonMapper;

  @Inject
  public LookupCoordinatorResource(
      final LookupCoordinatorManager lookupCoordinatorManager,
      final @Smile ObjectMapper smileMapper,
      final @Json ObjectMapper jsonMapper
  )
  {
    this.smileMapper = smileMapper;
    this.jsonMapper = jsonMapper;
    this.lookupCoordinatorManager = lookupCoordinatorManager;
  }

  @GET
  @Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
  public Response getTiers(
      @DefaultValue("false") @QueryParam("discover") boolean discover
  )
  {
    try {
      if (discover) {
        return Response.ok().entity(lookupCoordinatorManager.discoverTiers()).build();
      }
      final Map<String, Map<String, Map<String, Object>>> knownLookups = lookupCoordinatorManager.getKnownLookups();
      if (knownLookups == null) {
        return Response.status(Response.Status.NOT_FOUND).build();
      } else {
        return Response.ok().entity(knownLookups.keySet()).build();
      }
    }
    catch (Exception e) {
      LOG.error(e, "Error getting list of lookups");
      return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build();
    }
  }

  @POST
  @Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
  @Consumes({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
  public Response updateAllLookups(
      InputStream in,
      @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
      @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
      @Context HttpServletRequest req
  )
  {
    try {
      final boolean isSmile = SmileMediaTypes.APPLICATION_JACKSON_SMILE.equals(req.getContentType());
      final ObjectMapper mapper = isSmile ? smileMapper : jsonMapper;
      final Map<String, Map<String, Map<String, Object>>> map;
      try {
        map = mapper.readValue(in, new TypeReference<Map<String, Map<String, Map<String, Object>>>>()
        {
        });
      }
      catch (IOException e) {
        return Response.status(Response.Status.BAD_REQUEST).entity(ServletResourceUtils.sanitizeException(e)).build();
      }
      if (lookupCoordinatorManager.updateLookups(map, new AuditInfo(author, comment, req.getRemoteAddr()))) {
        return Response.status(Response.Status.ACCEPTED).entity(map).build();
      } else {
        throw new RuntimeException("Unknown error updating configuration");
      }
    }
    catch (Exception e) {
      LOG.error(e, "Error creating new lookups");
      return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build();
    }
  }

  @DELETE
  @Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
  @Path("/{tier}/{lookup}")
  public Response deleteLookup(
      @PathParam("tier") String tier,
      @PathParam("lookup") String lookup,
      @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
      @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
      @Context HttpServletRequest req
  )
  {
    try {
      if (Strings.isNullOrEmpty(tier)) {
        return Response.status(Response.Status.BAD_REQUEST)
                       .entity(ServletResourceUtils.sanitizeException(new NullPointerException("`tier` required")))
                       .build();
      }

      if (Strings.isNullOrEmpty(lookup)) {
        return Response.status(Response.Status.BAD_REQUEST)
                       .entity(ServletResourceUtils.sanitizeException(new IAE("`lookup` required")))
                       .build();
      }

      if (lookupCoordinatorManager.deleteLookup(tier, lookup, new AuditInfo(author, comment, req.getRemoteAddr()))) {
        return Response.status(Response.Status.ACCEPTED).build();
      } else {
        return Response.status(Response.Status.NOT_FOUND).build();
      }
    }
    catch (Exception e) {
      LOG.error(e, "Error deleting lookup [%s]", lookup);
      return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build();
    }
  }

  @POST
  @Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
  @Path("/{tier}/{lookup}")
  public Response createOrUpdateLookup(
      @PathParam("tier") String tier,
      @PathParam("lookup") String lookup,
      @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
      @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
      InputStream in,
      @Context HttpServletRequest req
  )
  {
    try {
      if (Strings.isNullOrEmpty(tier)) {
        return Response.status(Response.Status.BAD_REQUEST)
                       .entity(ServletResourceUtils.sanitizeException(new NullPointerException("`tier` required")))
                       .build();
      }

      if (Strings.isNullOrEmpty(lookup)) {
        return Response.status(Response.Status.BAD_REQUEST)
                       .entity(ServletResourceUtils.sanitizeException(new IAE("`lookup` required")))
                       .build();
      }
      final boolean isSmile = SmileMediaTypes.APPLICATION_JACKSON_SMILE.equals(req.getContentType());
      final ObjectMapper mapper = isSmile ? smileMapper : jsonMapper;
      final Map<String, Object> lookupSpec;
      try {
        lookupSpec = mapper.readValue(in, new TypeReference<Map<String, Object>>()
        {
        });
      }
      catch (IOException e) {
        return Response.status(Response.Status.BAD_REQUEST).entity(ServletResourceUtils.sanitizeException(e)).build();
      }
      if (lookupCoordinatorManager.updateLookup(
          tier,
          lookup,
          lookupSpec,
          new AuditInfo(author, comment, req.getRemoteAddr())
      )) {
        return Response.status(Response.Status.ACCEPTED).build();
      } else {
        throw new RuntimeException("Unknown error updating configuration");
      }
    }
    catch (Exception e) {
      LOG.error(e, "Error updating tier [%s] lookup [%s]", tier, lookup);
      return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build();
    }
  }

  @GET
  @Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
  @Path("/{tier}/{lookup}")
  public Response getSpecificLookup(
      @PathParam("tier") String tier,
      @PathParam("lookup") String lookup
  )
  {
    try {
      if (Strings.isNullOrEmpty(tier)) {
        return Response.status(Response.Status.BAD_REQUEST)
                       .entity(ServletResourceUtils.sanitizeException(new NullPointerException("`tier` required")))
                       .build();
      }
      if (Strings.isNullOrEmpty(lookup)) {
        return Response.status(Response.Status.BAD_REQUEST)
                       .entity(ServletResourceUtils.sanitizeException(new NullPointerException("`lookup` required")))
                       .build();
      }
      final Map<String, Object> map = lookupCoordinatorManager.getLookup(tier, lookup);
      if (map == null) {
        return Response.status(Response.Status.NOT_FOUND)
                       .entity(ServletResourceUtils.sanitizeException(new RE("lookup [%s] not found", lookup)))
                       .build();
      }
      return Response.ok().entity(map).build();
    }
    catch (Exception e) {
      LOG.error(e, "Error getting lookup [%s]", lookup);
      return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build();
    }
  }

  @GET
  @Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
  @Path("/{tier}")
  public Response getSpecificTier(
      @PathParam("tier") String tier
  )
  {
    try {
      if (Strings.isNullOrEmpty(tier)) {
        return Response.status(Response.Status.BAD_REQUEST)
                       .entity(ServletResourceUtils.sanitizeException(new NullPointerException("`tier` required")))
                       .build();
      }
      final Map<String, Map<String, Map<String, Object>>> map = lookupCoordinatorManager.getKnownLookups();
      if (map == null) {
        return Response.status(Response.Status.NOT_FOUND)
                       .entity(ServletResourceUtils.sanitizeException(new RE("No lookups found")))
                       .build();
      }
      final Map<String, Map<String, Object>> tierLookups = map.get(tier);
      if (tierLookups == null) {
        return Response.status(Response.Status.NOT_FOUND)
                       .entity(ServletResourceUtils.sanitizeException(new RE("Tier [%s] not found", tier)))
                       .build();
      }
      return Response.ok().entity(tierLookups.keySet()).build();
    }
    catch (Exception e) {
      LOG.error(e, "Error getting tier [%s]", tier);
      return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build();
    }
  }
}


text:
package org.hibernate.engine.spi;

import java.io.Serializable;
import java.sql.Connection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.hibernate.CacheMode;
import org.hibernate.Criteria;
import org.hibernate.Filter;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.IdentifierLoadAccess;
import org.hibernate.Interceptor;
import org.hibernate.LobHelper;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.NaturalIdLoadAccess;
import org.hibernate.Query;
import org.hibernate.ReplicationMode;
import org.hibernate.SQLQuery;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.SharedSessionBuilder;
import org.hibernate.SimpleNaturalIdLoadAccess;
import org.hibernate.Transaction;
import org.hibernate.TypeHelper;
import org.hibernate.UnknownProfileException;
import org.hibernate.cache.spi.CacheKey;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.jdbc.spi.JdbcConnectionAccess;
import org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification;
import org.hibernate.engine.transaction.spi.TransactionCoordinator;
import org.hibernate.jdbc.ReturningWork;
import org.hibernate.jdbc.Work;
import org.hibernate.loader.custom.CustomQuery;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.stat.SessionStatistics;
import org.hibernate.type.Type;

/**
 * This class is meant to be extended.
 *
 * Wraps and delegates all methods to a {@link SessionImplementor} and
 * a {@link Session}. This is useful for custom implementations of this
 * API so that only some methods need to be overriden
 * (Used by Hibernate Search).
 *
 * @author Sanne Grinovero <sanne@hibernate.org> (C) 2012 Red Hat Inc.
 */
public class SessionDelegatorBaseImpl implements SessionImplementor, Session {

	protected final SessionImplementor sessionImplementor;
	protected final Session session;

	public SessionDelegatorBaseImpl(SessionImplementor sessionImplementor, Session session) {
		if ( sessionImplementor == null ) {
			throw new IllegalArgumentException( "Unable to create a SessionDelegatorBaseImpl from a null sessionImplementor object" );
		}
		if ( session == null ) {
			throw new IllegalArgumentException( "Unable to create a SessionDelegatorBaseImpl from a null session object" );
		}
		this.sessionImplementor = sessionImplementor;
		this.session = session;
	}

	// Delegates to SessionImplementor

	@Override
	public <T> T execute(Callback<T> callback) {
		return sessionImplementor.execute( callback );
	}

	@Override
	public String getTenantIdentifier() {
		return sessionImplementor.getTenantIdentifier();
	}

	@Override
	public JdbcConnectionAccess getJdbcConnectionAccess() {
		return sessionImplementor.getJdbcConnectionAccess();
	}

	@Override
	public EntityKey generateEntityKey(Serializable id, EntityPersister persister) {
		return sessionImplementor.generateEntityKey( id, persister );
	}

	@Override
	public CacheKey generateCacheKey(Serializable id, Type type, String entityOrRoleName) {
		return sessionImplementor.generateCacheKey( id, type, entityOrRoleName );
	}

	@Override
	public Interceptor getInterceptor() {
		return sessionImplementor.getInterceptor();
	}

	@Override
	public void setAutoClear(boolean enabled) {
		sessionImplementor.setAutoClear( enabled );
	}

	@Override
	public void disableTransactionAutoJoin() {
		sessionImplementor.disableTransactionAutoJoin();
	}

	@Override
	public boolean isTransactionInProgress() {
		return sessionImplementor.isTransactionInProgress();
	}

	@Override
	public void initializeCollection(PersistentCollection collection, boolean writing) throws HibernateException {
		sessionImplementor.initializeCollection( collection, writing );
	}

	@Override
	public Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) throws HibernateException {
		return sessionImplementor.internalLoad( entityName, id, eager, nullable );
	}

	@Override
	public Object immediateLoad(String entityName, Serializable id) throws HibernateException {
		return sessionImplementor.immediateLoad( entityName, id );
	}

	@Override
	public long getTimestamp() {
		return sessionImplementor.getTimestamp();
	}

	@Override
	public SessionFactoryImplementor getFactory() {
		return sessionImplementor.getFactory();
	}

	@Override
	public List list(String query, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.list( query, queryParameters );
	}

	@Override
	public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.iterate( query, queryParameters );
	}

	@Override
	public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.scroll( query, queryParameters );
	}

	@Override
	public ScrollableResults scroll(Criteria criteria, ScrollMode scrollMode) {
		return sessionImplementor.scroll( criteria, scrollMode );
	}

	@Override
	public List list(Criteria criteria) {
		return sessionImplementor.list( criteria );
	}

	@Override
	public List listFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.listFilter( collection, filter, queryParameters );
	}

	@Override
	public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.iterateFilter( collection, filter, queryParameters );
	}

	@Override
	public EntityPersister getEntityPersister(String entityName, Object object) throws HibernateException {
		return sessionImplementor.getEntityPersister( entityName, object );
	}

	@Override
	public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException {
		return sessionImplementor.getEntityUsingInterceptor( key );
	}

	@Override
	public Serializable getContextEntityIdentifier(Object object) {
		return sessionImplementor.getContextEntityIdentifier( object );
	}

	@Override
	public String bestGuessEntityName(Object object) {
		return sessionImplementor.bestGuessEntityName( object );
	}

	@Override
	public String guessEntityName(Object entity) throws HibernateException {
		return sessionImplementor.guessEntityName( entity );
	}

	@Override
	public Object instantiate(String entityName, Serializable id) throws HibernateException {
		return sessionImplementor.instantiate( entityName, id );
	}

	@Override
	public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.listCustomQuery( customQuery, queryParameters );
	}

	@Override
	public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.scrollCustomQuery( customQuery, queryParameters );
	}

	@Override
	public List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.list( spec, queryParameters );
	}

	@Override
	public ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.scroll( spec, queryParameters );
	}

	@Override
	public Object getFilterParameterValue(String filterParameterName) {
		return sessionImplementor.getFilterParameterValue( filterParameterName );
	}

	@Override
	public Type getFilterParameterType(String filterParameterName) {
		return sessionImplementor.getFilterParameterType( filterParameterName );
	}

	@Override
	public Map getEnabledFilters() {
		return sessionImplementor.getEnabledFilters();
	}

	@Override
	public int getDontFlushFromFind() {
		return sessionImplementor.getDontFlushFromFind();
	}

	@Override
	public PersistenceContext getPersistenceContext() {
		return sessionImplementor.getPersistenceContext();
	}

	@Override
	public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.executeUpdate( query, queryParameters );
	}

	@Override
	public int executeNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters) throws HibernateException {
		return sessionImplementor.executeNativeUpdate( specification, queryParameters );
	}

	@Override
	public NonFlushedChanges getNonFlushedChanges() throws HibernateException {
		return sessionImplementor.getNonFlushedChanges();
	}

	@Override
	public void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges) throws HibernateException {
		sessionImplementor.applyNonFlushedChanges( nonFlushedChanges );
	}

	@Override
	public CacheMode getCacheMode() {
		return sessionImplementor.getCacheMode();
	}

	@Override
	public void setCacheMode(CacheMode cm) {
		sessionImplementor.setCacheMode( cm );
	}

	@Override
	public boolean isOpen() {
		return sessionImplementor.isOpen();
	}

	@Override
	public boolean isConnected() {
		return sessionImplementor.isConnected();
	}

	@Override
	public FlushMode getFlushMode() {
		return sessionImplementor.getFlushMode();
	}

	@Override
	public void setFlushMode(FlushMode fm) {
		sessionImplementor.setFlushMode( fm );
	}

	@Override
	public Connection connection() {
		return sessionImplementor.connection();
	}

	@Override
	public void flush() {
		sessionImplementor.flush();
	}

	@Override
	public Query getNamedQuery(String name) {
		return sessionImplementor.getNamedQuery( name );
	}

	@Override
	public Query getNamedSQLQuery(String name) {
		return sessionImplementor.getNamedSQLQuery( name );
	}

	@Override
	public boolean isEventSource() {
		return sessionImplementor.isEventSource();
	}

	@Override
	public void afterScrollOperation() {
		sessionImplementor.afterScrollOperation();
	}

	@Override
	public String getFetchProfile() {
		return sessionImplementor.getFetchProfile();
	}

	@Override
	public void setFetchProfile(String name) {
		sessionImplementor.setFetchProfile( name );
	}

	@Override
	public TransactionCoordinator getTransactionCoordinator() {
		return sessionImplementor.getTransactionCoordinator();
	}

	@Override
	public boolean isClosed() {
		return sessionImplementor.isClosed();
	}

	@Override
	public LoadQueryInfluencers getLoadQueryInfluencers() {
		return sessionImplementor.getLoadQueryInfluencers();
	}

	// Delegates to Session

	public Transaction beginTransaction() {
		return session.beginTransaction();
	}

	public Transaction getTransaction() {
		return session.getTransaction();
	}

	public Query createQuery(String queryString) {
		return session.createQuery( queryString );
	}

	public SQLQuery createSQLQuery(String queryString) {
		return session.createSQLQuery( queryString );
	}

	public Criteria createCriteria(Class persistentClass) {
		return session.createCriteria( persistentClass );
	}

	public Criteria createCriteria(Class persistentClass, String alias) {
		return session.createCriteria( persistentClass, alias );
	}

	public Criteria createCriteria(String entityName) {
		return session.createCriteria( entityName );
	}

	public Criteria createCriteria(String entityName, String alias) {
		return session.createCriteria( entityName, alias );
	}

	public SharedSessionBuilder sessionWithOptions() {
		return session.sessionWithOptions();
	}

	public SessionFactory getSessionFactory() {
		return session.getSessionFactory();
	}

	public Connection close() throws HibernateException {
		return session.close();
	}

	public void cancelQuery() throws HibernateException {
		session.cancelQuery();
	}

	public boolean isDirty() throws HibernateException {
		return session.isDirty();
	}

	public boolean isDefaultReadOnly() {
		return session.isDefaultReadOnly();
	}

	public void setDefaultReadOnly(boolean readOnly) {
		session.setDefaultReadOnly( readOnly );
	}

	public Serializable getIdentifier(Object object) {
		return session.getIdentifier( object );
	}

	public boolean contains(Object object) {
		return session.contains( object );
	}

	public void evict(Object object) {
		session.evict( object );
	}

	public Object load(Class theClass, Serializable id, LockMode lockMode) {
		return session.load( theClass, id, lockMode );
	}

	public Object load(Class theClass, Serializable id, LockOptions lockOptions) {
		return session.load( theClass, id, lockOptions );
	}

	public Object load(String entityName, Serializable id, LockMode lockMode) {
		return session.load( entityName, id, lockMode );
	}

	public Object load(String entityName, Serializable id, LockOptions lockOptions) {
		return session.load( entityName, id, lockOptions );
	}

	public Object load(Class theClass, Serializable id) {
		return session.load( theClass, id );
	}

	public Object load(String entityName, Serializable id) {
		return session.load( entityName, id );
	}

	public void load(Object object, Serializable id) {
		session.load( object, id );
	}

	public void replicate(Object object, ReplicationMode replicationMode) {
		session.replicate( object, replicationMode );
	}

	public void replicate(String entityName, Object object, ReplicationMode replicationMode) {
		session.replicate( entityName, object, replicationMode );
	}

	public Serializable save(Object object) {
		return session.save( object );
	}

	public Serializable save(String entityName, Object object) {
		return session.save( entityName, object );
	}

	public void saveOrUpdate(Object object) {
		session.saveOrUpdate( object );
	}

	public void saveOrUpdate(String entityName, Object object) {
		session.saveOrUpdate( entityName, object );
	}

	public void update(Object object) {
		session.update( object );
	}

	public void update(String entityName, Object object) {
		session.update( entityName, object );
	}

	public Object merge(Object object) {
		return session.merge( object );
	}

	public Object merge(String entityName, Object object) {
		return session.merge( entityName, object );
	}

	public void persist(Object object) {
		session.persist( object );
	}

	public void persist(String entityName, Object object) {
		session.persist( entityName, object );
	}

	public void delete(Object object) {
		session.delete( object );
	}

	public void delete(String entityName, Object object) {
		session.delete( entityName, object );
	}

	public void lock(Object object, LockMode lockMode) {
		session.lock( object, lockMode );
	}

	public void lock(String entityName, Object object, LockMode lockMode) {
		session.lock( entityName, object, lockMode );
	}

	public LockRequest buildLockRequest(LockOptions lockOptions) {
		return session.buildLockRequest( lockOptions );
	}

	public void refresh(Object object) {
		session.refresh( object );
	}

	public void refresh(String entityName, Object object) {
		session.refresh( entityName, object );
	}

	public void refresh(Object object, LockMode lockMode) {
		session.refresh( object, lockMode );
	}

	public void refresh(Object object, LockOptions lockOptions) {
		session.refresh( object, lockOptions );
	}

	public void refresh(String entityName, Object object, LockOptions lockOptions) {
		session.refresh( entityName, object, lockOptions );
	}

	public LockMode getCurrentLockMode(Object object) {
		return session.getCurrentLockMode( object );
	}

	public Query createFilter(Object collection, String queryString) {
		return session.createFilter( collection, queryString );
	}

	public void clear() {
		session.clear();
	}

	public Object get(Class clazz, Serializable id) {
		return session.get( clazz, id );
	}

	public Object get(Class clazz, Serializable id, LockMode lockMode) {
		return session.get( clazz, id, lockMode );
	}

	public Object get(Class clazz, Serializable id, LockOptions lockOptions) {
		return session.get( clazz, id, lockOptions );
	}

	public Object get(String entityName, Serializable id) {
		return session.get( entityName, id );
	}

	public Object get(String entityName, Serializable id, LockMode lockMode) {
		return session.get( entityName, id, lockMode );
	}

	public Object get(String entityName, Serializable id, LockOptions lockOptions) {
		return session.get( entityName, id, lockOptions );
	}

	public String getEntityName(Object object) {
		return session.getEntityName( object );
	}

	public IdentifierLoadAccess byId(String entityName) {
		return session.byId( entityName );
	}

	public IdentifierLoadAccess byId(Class entityClass) {
		return session.byId( entityClass );
	}

	public NaturalIdLoadAccess byNaturalId(String entityName) {
		return session.byNaturalId( entityName );
	}

	public NaturalIdLoadAccess byNaturalId(Class entityClass) {
		return session.byNaturalId( entityClass );
	}

	public SimpleNaturalIdLoadAccess bySimpleNaturalId(String entityName) {
		return session.bySimpleNaturalId( entityName );
	}

	public SimpleNaturalIdLoadAccess bySimpleNaturalId(Class entityClass) {
		return session.bySimpleNaturalId( entityClass );
	}

	public Filter enableFilter(String filterName) {
		return session.enableFilter( filterName );
	}

	public Filter getEnabledFilter(String filterName) {
		return session.getEnabledFilter( filterName );
	}

	public void disableFilter(String filterName) {
		session.disableFilter( filterName );
	}

	public SessionStatistics getStatistics() {
		return session.getStatistics();
	}

	public boolean isReadOnly(Object entityOrProxy) {
		return session.isReadOnly( entityOrProxy );
	}

	public void setReadOnly(Object entityOrProxy, boolean readOnly) {
		session.setReadOnly( entityOrProxy, readOnly );
	}

	public void doWork(Work work) throws HibernateException {
		session.doWork( work );
	}

	public <T> T doReturningWork(ReturningWork<T> work) throws HibernateException {
		return session.doReturningWork( work );
	}

	public Connection disconnect() {
		return session.disconnect();
	}

	public void reconnect(Connection connection) {
		session.reconnect( connection );
	}

	public boolean isFetchProfileEnabled(String name) throws UnknownProfileException {
		return session.isFetchProfileEnabled( name );
	}

	public void enableFetchProfile(String name) throws UnknownProfileException {
		session.enableFetchProfile( name );
	}

	public void disableFetchProfile(String name) throws UnknownProfileException {
		session.disableFetchProfile( name );
	}

	public TypeHelper getTypeHelper() {
		return session.getTypeHelper();
	}

	public LobHelper getLobHelper() {
		return session.getLobHelper();
	}

}

redpajama_set_name: RedPajamaGithub


text:
namespace {
    enum class ShiftRegisterMode {
        // There are actually many more modes, but I think Vectrex only uses one
        ShiftOutUnder02
    };

    namespace Register {
        enum Type {
            PortB = 0x0,
            PortA = 0x1,
            DataDirB = 0x2,
            DataDirA = 0x3,
            Timer1Low = 0x4,
            Timer1High = 0x5,
            Timer1LatchLow = 0x6,
            Timer1LatchHigh = 0x7,
            Timer2Low = 0x8,
            Timer2High = 0x9,
            Shift = 0xA,
            AuxCntl = 0xB,
            PeriphCntl = 0xC,
            InterruptFlag = 0xD,
            InterruptEnable = 0xE,
            PortANoHandshake = 0xF,
        };
    }

    namespace PortB {
        const uint8_t MuxDisabled = BITS(0);
        const uint8_t MuxSelMask = BITS(1, 2);
        const uint8_t MuxSelShift = 1;
        const uint8_t SoundBC1 = BITS(3);  // Bus Control 1
        const uint8_t SoundBDir = BITS(4); // Bus Direction
        const uint8_t Comparator = BITS(5);
        const uint8_t RampDisabled = BITS(7);
    } // namespace PortB

    namespace AuxCntl {
        const uint8_t ShiftRegisterModeMask = BITS(2, 3, 4);
        const uint8_t ShiftRegisterModeShift = 2;
        const uint8_t Timer2PulseCounting = BITS(5); // 1=pulse counting, 0=one-shot
        const uint8_t Timer1FreeRunning = BITS(6);   // 1=free running, 0=one-shot
        const uint8_t PB7Flag = BITS(7);             // 1=enable PB7 output

        inline ShiftRegisterMode GetShiftRegisterMode(uint8_t auxCntrl) {
            uint8_t result =
                ReadBitsWithShift(auxCntrl, ShiftRegisterModeMask, ShiftRegisterModeShift);
            if (result != 0b110) {
                ErrorHandler::Unsupported(
                    "ShiftRegisterMode expected to only support ShiftOutUnder02\n");
            }
            return ShiftRegisterMode::ShiftOutUnder02;
        }

        inline TimerMode GetTimer1Mode(uint8_t auxCntl) {
            return TestBits(auxCntl, Timer1FreeRunning) ? TimerMode::FreeRunning
                                                        : TimerMode::OneShot;
        }

        inline TimerMode GetTimer2Mode(uint8_t auxCntl) {
            return TestBits(auxCntl, Timer2PulseCounting) ? TimerMode::PulseCounting
                                                          : TimerMode::OneShot;
        }
    } // namespace AuxCntl

    namespace PeriphCntl {
        // CA1 -> SW7, 0=IRQ on low, 1=IRQ on high
        const uint8_t CA1 = BITS(0);

        // CA2 -> /ZERO, 110=low, 111=high
        const uint8_t CA2Mask = BITS(1, 2, 3);
        const uint8_t CA2Shift = 1;

        // CB1 -> nc, 0=IRQ on low, 1=IRQ on high
        const uint8_t CB1 = BITS(4);

        // CB2 -> /BLANK, 110=low, 111=high
        const uint8_t CB2Mask = BITS(5, 6, 7);
        const uint8_t CB2Shift = 5;

        inline bool IsZeroEnabled(uint8_t periphCntrl) {
            const uint8_t value = ReadBitsWithShift(periphCntrl, CA2Mask, CA2Shift);
            return value == 0b110;
        }

        inline bool IsBlankEnabled(uint8_t periphCntrl) {
            const uint8_t value = ReadBitsWithShift(periphCntrl, CB2Mask, CB2Shift);
            return value == 0b110;
        }
    } // namespace PeriphCntl

    namespace InterruptFlag {
        // How each IFR bit is cleared:
        // 0 CA2 interrupt flag            reading or writing port a i / o
        // 1 CA1 interrupt flag            reading or writing port a i / o
        // 2 shift register interrupt flag reading or writing shift register
        // 3 CB2 interrupt flag            reading or writing port b i / o
        // 4 CB1 interrupt flag            reading or writing port a i / o
        // 5 timer 2 interrupt flag        read t2 low or write t2 high
        // 6 timer 1 interrupt flag        read t1 count low or write t1 high
        // 7 irq status flag               write logic 0 to ier or ifr bit

        const uint8_t CA2 = BITS(0);
        const uint8_t CA1 = BITS(1);
        const uint8_t Shift = BITS(2);
        const uint8_t CB2 = BITS(3);
        const uint8_t CB1 = BITS(4);
        const uint8_t Timer2 = BITS(5);
        const uint8_t Timer1 = BITS(6);
        const uint8_t IrqEnabled = BITS(7);
    }; // namespace InterruptFlag

    namespace InterruptEnable {
        const uint8_t CA2 = BITS(0);
        const uint8_t CA1 = BITS(1);
        const uint8_t Shift = BITS(2);
        const uint8_t CB2 = BITS(3);
        const uint8_t CB1 = BITS(4);
        const uint8_t Timer2 = BITS(5);
        const uint8_t Timer1 = BITS(6);
        const uint8_t SetClearControl = BITS(7);
    } // namespace InterruptEnable

} // namespace

void Via::Init(MemoryBus& memoryBus) {
    memoryBus.ConnectDevice(*this, MemoryMap::Via.range, EnableSync::True);
}

void Via::Reset() {
    m_portB = m_portA = 0;
    m_dataDirB = m_dataDirA = 0;
    m_periphCntl = 0;
    m_interruptEnable = 0;

    m_screen = Screen{};
    m_psg.Reset();
    m_timer1 = Timer1{};
    m_timer2 = Timer2{};
    m_shiftRegister = ShiftRegister{};
    m_joystickButtonState = {};
    m_ca1Enabled = {};
    m_ca1InterruptFlag = {};
    m_firqEnabled = {};
    m_elapsedAudioCycles = {};
    m_directAudioSamples.Reset();

    SetBits(m_portB, PortB::RampDisabled, true);
}

void Via::DoSync(cycles_t cycles, const Input& input, RenderContext& renderContext,
                 AudioContext& audioContext) {
    // Update cached input state
    m_joystickButtonState = input.ButtonStateMask();

    // Analog input: update POT value if MUX is enabled, otherwise it keeps its last value
    const bool muxEnabled = !TestBits(m_portB, PortB::MuxDisabled);
    if (muxEnabled) {
        uint8_t muxSel = ReadBitsWithShift(m_portB, PortB::MuxSelMask, PortB::MuxSelShift);
        m_joystickPot = input.AnalogStateMask(muxSel);
    }

    // CA1 is set when joystick 2 button 4 is pressed, which is usually always on for peripherals
    // like the 3D imager goggles. Interrupt flag for CA1 is set when CA1 line goes from disabled to
    // enabled, and is cleared by read/write on Port A.
    const auto ca1Prev = m_ca1Enabled;
    m_ca1Enabled = input.IsButtonDown(1, 3);
    if (!ca1Prev && m_ca1Enabled)
        m_ca1InterruptFlag = true;

    m_firqEnabled = input.IsButtonDown(0, 3);

    // Audio update
    for (cycles_t i = 0; i < cycles; ++i) {
        m_psg.Update(1);
        m_psgAudioSamples.Add(m_psg.Sample());

        if (++m_elapsedAudioCycles >= audioContext.CpuCyclesPerAudioSample) {
            m_elapsedAudioCycles -= audioContext.CpuCyclesPerAudioSample;

            // Need a target sample...

            float psgSample = m_psgAudioSamples.AverageAndReset();
            float directSample = m_directAudioSamples.AverageAndReset();

            //@TODO: Is this right? Averaging means getting half the volume when only one source is
            // playing, which is most of the time.
            float targetSample = directSample != 0 ? directSample : psgSample;
            // float targetSample = (psgSample + directSample) / 2.f;

            audioContext.samples.push_back(targetSample);
        }
    }

    //@TODO: Move this code into a Clock() function and call it cycles number of times
    // For cycle-accurate drawing, we update our timers, shift register, and beam movement 1 cycle
    // at a time
    cycles_t cyclesLeft = cycles;
    cycles = 1;
    while (cyclesLeft-- > 0) {
        m_timer1.Update(cycles);
        m_timer2.Update(cycles);
        m_shiftRegister.Update(cycles);

        // Shift register's CB2 line drives /BLANK
        //@TODO: check some flag on the shift register to know whether it's active
        if (m_shiftRegister.Enabled()) {
            m_screen.SetBlankEnabled(m_shiftRegister.CB2Active());
        }

        // If the Timer1 PB7 flag is set, then PB7 drives /RAMP
        if (m_timer1.PB7Flag()) {
            SetBits(m_portB, PortB::RampDisabled, !m_timer1.PB7SignalLow());
        }

        if (PeriphCntl::IsZeroEnabled(m_periphCntl)) {
            m_screen.ZeroBeam();
        }

        // Integrators are enabled while RAMP line is active (low)
        m_screen.SetIntegratorsEnabled(!TestBits(m_portB, PortB::RampDisabled));

        // Update screen, which populates the lines in the renderContext
        m_screen.Update(cycles, renderContext);
    }
}

void Via::FrameUpdate(double frameTime) {
    m_screen.FrameUpdate(frameTime);
    m_psg.FrameUpdate(frameTime);
}

uint8_t Via::Read(uint16_t address) const {
    const uint16_t index = MemoryMap::Via.MapAddress(address);
    switch (index) {
    case Register::PortB: {
        uint8_t result = m_portB;

        // Set comparator bit to port A (DAC) value < joystick POT value
        auto portASigned = static_cast<int8_t>(m_portA);
        SetBits(result, PortB::Comparator, portASigned < m_joystickPot);

        SetBits(result, PortB::SoundBC1, m_psg.BC1());
        SetBits(result, PortB::SoundBDir, m_psg.BDIR());

        return result;
    }
    case Register::PortA: {
        m_ca1InterruptFlag = false; // Cleared by read/write of Port A

        uint8_t result = m_portA;

        // @TODO: Vectrex probably only ever reads from PSG to read joystick state. Right now we're
        // reading joystick inputs directly here in the Via, so we'll skip reading DA value from PSG
        // here. Eventually, we should move the joystick reading logic into PSG and clean this up.

        // Digital input
        if (!TestBits(m_portB, PortB::SoundBDir) && TestBits(m_portB, PortB::SoundBC1)) {
            if (m_dataDirA == 0) { // Input mode

                // @TODO: in this mode, we're reading the PSG's port A, not the
                // VIA's DAC, so this is probably wrong
                result = m_joystickButtonState;
            }
        }

        return result;
    }
    case Register::DataDirB:
        return m_dataDirB;

    case Register::DataDirA:
        return m_dataDirA;

    case Register::Timer1Low:
        return m_timer1.ReadCounterLow();

    case Register::Timer1High:
        return m_timer1.ReadCounterHigh();

    case Register::Timer1LatchLow:
        return m_timer1.ReadLatchLow();

    case Register::Timer1LatchHigh:
        return m_timer1.ReadLatchHigh();

    case Register::Timer2Low:
        return m_timer2.ReadCounterLow();

    case Register::Timer2High:
        return m_timer2.ReadCounterHigh();

    case Register::Shift:
        return m_shiftRegister.ReadValue();

    case Register::AuxCntl: {
        uint8_t auxCntl = 0;
        SetBits(auxCntl, 0b110 << AuxCntl::ShiftRegisterModeShift, true); //@HACK
        SetBits(auxCntl, AuxCntl::Timer1FreeRunning, m_timer1.Mode() == TimerMode::FreeRunning);
        SetBits(auxCntl, AuxCntl::Timer2PulseCounting, m_timer2.Mode() == TimerMode::PulseCounting);
        SetBits(auxCntl, AuxCntl::PB7Flag, m_timer1.PB7Flag());
        return auxCntl;
    }
    case Register::PeriphCntl:
        return m_periphCntl;

    case Register::InterruptFlag:
        return GetInterruptFlagValue();

    case Register::InterruptEnable:
        return m_interruptEnable;

    case Register::PortANoHandshake:
        ErrorHandler::Unsupported("A without handshake not implemented yet\n");
        break;

    default:
        FAIL();
        break;
    }
    return 0;
}

void Via::Write(uint16_t address, uint8_t value) {
    auto UpdateIntegrators = [&] {
        const bool muxEnabled = !TestBits(m_portB, PortB::MuxDisabled);

        if (muxEnabled) {
            switch (ReadBitsWithShift(m_portB, PortB::MuxSelMask, PortB::MuxSelShift)) {
            case 0: // Y-axis integrator
                m_screen.SetIntegratorY(static_cast<int8_t>(m_portA));
                break;
            case 1: // X,Y Axis integrator offset
                m_screen.SetIntegratorXYOffset(static_cast<int8_t>(m_portA));
                break;
            case 2: // Z Axis (Vector Brightness) level
                m_screen.SetBrightness(m_portA);
                break;
            case 3: // Connected to sound output line via divider network
                m_directAudioSamples.Add(static_cast<int8_t>(m_portA) / 128.f); // [-1,1]
                break;
            default:
                FAIL();
                break;
            }
        }

        // Always output to X-axis integrator
        m_screen.SetIntegratorX(static_cast<int8_t>(m_portA));
    };

    auto UpdatePsg = [&] {
        const bool muxEnabled = !TestBits(m_portB, PortB::MuxDisabled);

        if (!muxEnabled) {
            m_psg.SetBC1(TestBits(m_portB, PortB::SoundBC1));
            m_psg.SetBDIR(TestBits(m_portB, PortB::SoundBDir));
            // @TODO: not sure if we should always send port A value to PSG's DA bus, or just when
            // MUX disabled
            m_psg.WriteDA(m_portA);
        }
    };

    const uint16_t index = MemoryMap::Via.MapAddress(address);
    switch (index) {
    case Register::PortB:
        m_portB = value;
        UpdateIntegrators();
        UpdatePsg();
        break;

    case Register::PortA:
        m_ca1InterruptFlag = false; // Cleared by read/write of Port A

        // Port A is connected directly to the DAC, which in turn is connected to both a MUX with 4
        // outputs, and to the X-axis integrator.
        m_portA = value;
        if (m_dataDirA == 0xFF) {
            UpdateIntegrators();
        }
        break;

    case Register::DataDirB:
        m_dataDirB = value;
        break;

    case Register::DataDirA:
        m_dataDirA = value;
        if (!(m_dataDirA == 0 || m_dataDirA == 0xFF))
            ErrorHandler::Undefined("Expecting DDR for A to be either all 0s or all 1s");
        break;

    case Register::Timer1Low:
        m_timer1.WriteCounterLow(value);
        break;

    case Register::Timer1High:
        m_timer1.WriteCounterHigh(value);
        break;

    case Register::Timer1LatchLow:
        m_timer1.WriteLatchLow(value);
        break;

    case Register::Timer1LatchHigh:
        m_timer1.WriteLatchHigh(value);
        break;

    case Register::Timer2Low:
        m_timer2.WriteCounterLow(value);
        break;

    case Register::Timer2High:
        m_timer2.WriteCounterHigh(value);
        break;

    case Register::Shift:
        m_shiftRegister.SetValue(value);
        break;

    case Register::AuxCntl: {
        // For now just read the shift register mode, which will assert if it's invalid/unexpected
        auto shiftRegisterMode = AuxCntl::GetShiftRegisterMode(value);
        (void)shiftRegisterMode;

        ASSERT_MSG(AuxCntl::GetTimer1Mode(value) == TimerMode::OneShot,
                   "t1 assumed always on one-shot mode");
        ASSERT_MSG(AuxCntl::GetTimer2Mode(value) == TimerMode::OneShot,
                   "t2 assumed always on one-shot mode");
        m_timer1.SetTimerMode(AuxCntl::GetTimer1Mode(value));
        m_timer2.SetTimerMode(AuxCntl::GetTimer2Mode(value));

        m_timer1.SetPB7Flag(TestBits(value, AuxCntl::PB7Flag));

    } break;

    case Register::PeriphCntl: {
        ASSERT_MSG(ReadBitsWithShift(value, PeriphCntl::CA2Mask, PeriphCntl::CA2Shift) == 0b110 ||
                       ReadBitsWithShift(value, PeriphCntl::CA2Mask, PeriphCntl::CA2Shift) == 0b111,
                   "Unexpected value for CA2 bits");

        ASSERT_MSG(ReadBitsWithShift(value, PeriphCntl::CB2Mask, PeriphCntl::CB2Shift) == 0b110 ||
                       ReadBitsWithShift(value, PeriphCntl::CB2Mask, PeriphCntl::CB2Shift) == 0b111,
                   "Top 2 bits should always be 1 (right?)");

        m_periphCntl = value;
        if (!m_shiftRegister.Enabled()) {
            m_screen.SetBlankEnabled(PeriphCntl::IsBlankEnabled(m_periphCntl));
        }
    } break;

    case Register::InterruptFlag:
        // Clear interrupt flags for any bits that are enabled
        //@TODO: validate if this is the correct behaviour

        // Assert if trying to clear an interrupt we don't handle yet
#define ASSERT_UNHANDLED(flag)                                                                     \
    ASSERT_MSG(!TestBits(value, flag), "Write to clear interrupt not supported yet: %s", #flag)
        ASSERT_UNHANDLED(InterruptFlag::CA2);
        ASSERT_UNHANDLED(InterruptFlag::CB1);
        ASSERT_UNHANDLED(InterruptFlag::CB2);
#undef ASSERT_UNHANDLED

        if (TestBits(value, InterruptFlag::CA1))
            m_ca1InterruptFlag = false;
        if (TestBits(value, InterruptFlag::Shift))
            m_shiftRegister.SetInterruptFlag(false);
        if (TestBits(value, InterruptFlag::Timer2))
            m_timer2.SetInterruptFlag(false);
        if (TestBits(value, InterruptFlag::Timer1))
            m_timer1.SetInterruptFlag(false);
        break;

    case Register::InterruptEnable: {
        // When bit 7 = 0 : Each 1 in a bit position is cleared (disabled).
        // When bit 7 = 1 : Each 1 in a bit position enables that bit.
        // (Zeros in bit positions are left unchanged)
        SetBits(m_interruptEnable, (value & 0x7F), TestBits(value, BITS(7)));

        // Assert if trying to enable interrupt we don't handle yet
#define ASSERT_UNHANDLED(flag)                                                                     \
    ASSERT_MSG(!TestBits(m_interruptEnable, flag),                                                 \
               "Write to enable interrupt not supported yet: %s", #flag)
        ASSERT_UNHANDLED(InterruptFlag::CA2);
        ASSERT_UNHANDLED(InterruptFlag::CB1);
        ASSERT_UNHANDLED(InterruptFlag::CB2);
#undef ASSERT_UNHANDLED

    } break;

    case Register::PortANoHandshake:
        ErrorHandler::Unsupported("A without handshake not implemented yet\n");
        break;

    default:
        FAIL();
        break;
    }
}

void Via::Sync(cycles_t cycles) {
    DoSync(cycles, *m_syncContext.input, *m_syncContext.renderContext, *m_syncContext.audioContext);
}

bool Via::IrqEnabled() const {
    return TestBits(GetInterruptFlagValue(), InterruptFlag::IrqEnabled);
}

bool Via::FirqEnabled() const {
    return m_firqEnabled;
}

uint8_t Via::GetInterruptFlagValue() const {
    uint8_t result = 0;
    SetBits(result, InterruptFlag::CA1, m_ca1InterruptFlag);
    SetBits(result, InterruptFlag::Shift, m_shiftRegister.InterruptFlag());
    SetBits(result, InterruptFlag::Timer2, m_timer2.InterruptFlag());
    SetBits(result, InterruptFlag::Timer1, m_timer1.InterruptFlag());

    // Enable IRQ  bit if any IFR bits (set above) are also enabled in IER
    SetBits(result, InterruptFlag::IrqEnabled, ((result & m_interruptEnable) & 0x7F) != 0);

    return result;
}


text:
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;

namespace Azure.Analytics.Synapse.Artifacts.Models
{
    public partial class HiveLinkedService : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("type");
            writer.WriteStringValue(Type);
            if (ConnectVia != null)
            {
                writer.WritePropertyName("connectVia");
                writer.WriteObjectValue(ConnectVia);
            }
            if (Description != null)
            {
                writer.WritePropertyName("description");
                writer.WriteStringValue(Description);
            }
            if (Parameters != null)
            {
                writer.WritePropertyName("parameters");
                writer.WriteStartObject();
                foreach (var item in Parameters)
                {
                    writer.WritePropertyName(item.Key);
                    writer.WriteObjectValue(item.Value);
                }
                writer.WriteEndObject();
            }
            if (Annotations != null)
            {
                writer.WritePropertyName("annotations");
                writer.WriteStartArray();
                foreach (var item in Annotations)
                {
                    writer.WriteObjectValue(item);
                }
                writer.WriteEndArray();
            }
            writer.WritePropertyName("typeProperties");
            writer.WriteStartObject();
            writer.WritePropertyName("host");
            writer.WriteObjectValue(Host);
            if (Port != null)
            {
                writer.WritePropertyName("port");
                writer.WriteObjectValue(Port);
            }
            if (ServerType != null)
            {
                writer.WritePropertyName("serverType");
                writer.WriteStringValue(ServerType.Value.ToString());
            }
            if (ThriftTransportProtocol != null)
            {
                writer.WritePropertyName("thriftTransportProtocol");
                writer.WriteStringValue(ThriftTransportProtocol.Value.ToString());
            }
            writer.WritePropertyName("authenticationType");
            writer.WriteStringValue(AuthenticationType.ToString());
            if (ServiceDiscoveryMode != null)
            {
                writer.WritePropertyName("serviceDiscoveryMode");
                writer.WriteObjectValue(ServiceDiscoveryMode);
            }
            if (ZooKeeperNameSpace != null)
            {
                writer.WritePropertyName("zooKeeperNameSpace");
                writer.WriteObjectValue(ZooKeeperNameSpace);
            }
            if (UseNativeQuery != null)
            {
                writer.WritePropertyName("useNativeQuery");
                writer.WriteObjectValue(UseNativeQuery);
            }
            if (Username != null)
            {
                writer.WritePropertyName("username");
                writer.WriteObjectValue(Username);
            }
            if (Password != null)
            {
                writer.WritePropertyName("password");
                writer.WriteObjectValue(Password);
            }
            if (HttpPath != null)
            {
                writer.WritePropertyName("httpPath");
                writer.WriteObjectValue(HttpPath);
            }
            if (EnableSsl != null)
            {
                writer.WritePropertyName("enableSsl");
                writer.WriteObjectValue(EnableSsl);
            }
            if (TrustedCertPath != null)
            {
                writer.WritePropertyName("trustedCertPath");
                writer.WriteObjectValue(TrustedCertPath);
            }
            if (UseSystemTrustStore != null)
            {
                writer.WritePropertyName("useSystemTrustStore");
                writer.WriteObjectValue(UseSystemTrustStore);
            }
            if (AllowHostNameCNMismatch != null)
            {
                writer.WritePropertyName("allowHostNameCNMismatch");
                writer.WriteObjectValue(AllowHostNameCNMismatch);
            }
            if (AllowSelfSignedServerCert != null)
            {
                writer.WritePropertyName("allowSelfSignedServerCert");
                writer.WriteObjectValue(AllowSelfSignedServerCert);
            }
            if (EncryptedCredential != null)
            {
                writer.WritePropertyName("encryptedCredential");
                writer.WriteObjectValue(EncryptedCredential);
            }
            writer.WriteEndObject();
            foreach (var item in AdditionalProperties)
            {
                writer.WritePropertyName(item.Key);
                writer.WriteObjectValue(item.Value);
            }
            writer.WriteEndObject();
        }

        internal static HiveLinkedService DeserializeHiveLinkedService(JsonElement element)
        {
            string type = default;
            IntegrationRuntimeReference connectVia = default;
            string description = default;
            IDictionary<string, ParameterSpecification> parameters = default;
            IList<object> annotations = default;
            object host = default;
            object port = default;
            HiveServerType? serverType = default;
            HiveThriftTransportProtocol? thriftTransportProtocol = default;
            HiveAuthenticationType authenticationType = default;
            object serviceDiscoveryMode = default;
            object zooKeeperNameSpace = default;
            object useNativeQuery = default;
            object username = default;
            SecretBase password = default;
            object httpPath = default;
            object enableSsl = default;
            object trustedCertPath = default;
            object useSystemTrustStore = default;
            object allowHostNameCNMismatch = default;
            object allowSelfSignedServerCert = default;
            object encryptedCredential = default;
            IDictionary<string, object> additionalProperties = default;
            Dictionary<string, object> additionalPropertiesDictionary = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectVia"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value);
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("parameters"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecification>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property0.Value));
                        }
                    }
                    parameters = dictionary;
                    continue;
                }
                if (property.NameEquals("annotations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List<object> array = new List<object>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetObject());
                        }
                    }
                    annotations = array;
                    continue;
                }
                if (property.NameEquals("typeProperties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("host"))
                        {
                            host = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("port"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            port = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("serverType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            serverType = new HiveServerType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("thriftTransportProtocol"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            thriftTransportProtocol = new HiveThriftTransportProtocol(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("authenticationType"))
                        {
                            authenticationType = new HiveAuthenticationType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("serviceDiscoveryMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            serviceDiscoveryMode = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("zooKeeperNameSpace"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            zooKeeperNameSpace = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("useNativeQuery"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            useNativeQuery = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("username"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            username = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("password"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            password = SecretBase.DeserializeSecretBase(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("httpPath"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            httpPath = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("enableSsl"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            enableSsl = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("trustedCertPath"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            trustedCertPath = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("useSystemTrustStore"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            useSystemTrustStore = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("allowHostNameCNMismatch"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            allowHostNameCNMismatch = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("allowSelfSignedServerCert"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            allowSelfSignedServerCert = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("encryptedCredential"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            encryptedCredential = property0.Value.GetObject();
                            continue;
                        }
                    }
                    continue;
                }
                additionalPropertiesDictionary ??= new Dictionary<string, object>();
                if (property.Value.ValueKind == JsonValueKind.Null)
                {
                    additionalPropertiesDictionary.Add(property.Name, null);
                }
                else
                {
                    additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
                }
            }
            additionalProperties = additionalPropertiesDictionary;
            return new HiveLinkedService(type, connectVia, description, parameters, annotations, additionalProperties, host, port, serverType, thriftTransportProtocol, authenticationType, serviceDiscoveryMode, zooKeeperNameSpace, useNativeQuery, username, password, httpPath, enableSsl, trustedCertPath, useSystemTrustStore, allowHostNameCNMismatch, allowSelfSignedServerCert, encryptedCredential);
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="AppBundle\Entity\Motherboard" table="motherboard">
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="name" type="string" column="name" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="manufacturer" type="string" column="manufacturer" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="pcie" type="integer" column="pcie" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="pci" type="integer" column="pci" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="ramType" type="string" column="ramType" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="format" type="string" column="format" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="price" type="integer" column="price" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
  </entity>
</doctrine-mapping>