public FormatHandlers<Protocol, Format> getFormatHandlers( Object context ) { if( !this.formatHandlers.containsKey( context ) ) this.formatHandlers.put( context, new FormatHandlers<Protocol, Format>() ); return this.formatHandlers.get( context ); }
FormatHandler getFormatHandler( Object context, Protocol protocol, Format format ) { return getFormatHandlers( context ).findHandlerFor( protocol, format ); }
public void addFormatHandlers( Object context, List<FormatHandler<Protocol, Format>> formatHandlers ) { getFormatHandlers( context ).addAll( formatHandlers ); }
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 ); }
public FormatHandlers<Protocol, Format> getFormatHandlersFor( SchemaDef schemaDef ) { if( schemaDef == null ) schemaDef = schemaCatalog.getRootSchemaDef(); return new FormatHandlers<Protocol, Format>( createFormatHandlers( schemaDef ) ); }
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 ); }