ProtocolHandler getProtocolHandler( Object context, Protocol protocol ) { return getProtocolHandlers( context ).findHandlerFor( protocol ); }
public Tap createTapFor( TableDef tableDef, SinkMode sinkMode ) { Protocol protocol = tableDef.getActualProtocol(); Format format = tableDef.getActualFormat(); ProtocolHandler<Protocol, Format> protocolHandler = getProtocolHandlers( tableDef.getParentSchema() ).findHandlerFor( protocol ); FormatHandler<Protocol, Format> formatHandler = getFormatHandlersFor( tableDef.getParentSchema() ).findHandlerFor( protocol, format ); if( protocolHandler == null ) throw new IllegalArgumentException( "no protocol handler for protocol: " + protocol ); if( formatHandler == null ) throw new IllegalArgumentException( "no format handler for format: " + format ); // do not make loadable, tap loadable will handle dynamic classloader issues Scheme scheme = formatHandler.createScheme( tableDef.getStereotype(), protocol, format ); Resource<Protocol, Format, SinkMode> resource = tableDef.getResourceWith( sinkMode ); return ( (LingualProtocolHandler) protocolHandler ).createLoadableTap( scheme, resource ); }
private Tap createTapFor( SchemaDef schemaDef, Stereotype<Protocol, Format> stereotype, Resource<Protocol, Format, SinkMode> resource ) { ProtocolHandler<Protocol, Format> protocolHandler = getProtocolHandlers( schemaDef ).findHandlerFor( resource.getProtocol() ); FormatHandler<Protocol, Format> formatHandler = getFormatHandlersFor( schemaDef ).findHandlerFor( resource.getProtocol(), resource.getFormat() ); if( protocolHandler == null || formatHandler == null ) return null; // do not make loadable, tap loadable will handle dynamic classloader issues Scheme scheme = formatHandler.createScheme( stereotype, resource.getProtocol(), resource.getFormat() ); return ( (LingualProtocolHandler) protocolHandler ).createLoadableTap( scheme, resource ); }