001/* 002 * Copyright (c) 2007-2022 The Cascading Authors. All Rights Reserved. 003 * 004 * Project and contact information: https://cascading.wensel.net/ 005 * 006 * This file is part of the Cascading project. 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020 021package cascading.local.tap.splunk; 022 023import java.io.InputStream; 024import java.io.OutputStream; 025import java.util.Properties; 026 027import cascading.flow.FlowProcess; 028import cascading.scheme.local.TextLine; 029import cascading.tap.Tap; 030import cascading.tuple.Fields; 031import com.splunk.JobExportArgs; 032 033/** 034 * Class SplunkRawLine is a {@link cascading.scheme.Scheme} that enables RAW export from a Splunk instance. 035 * <p> 036 * It is a sub-class of the {@link TextLine} Scheme, so is intended to sink and source full lines of (un-parsed) text. 037 * See {@link SplunkRawDelimited} for inline parsing of log lines. 038 * <p> 039 * This Tap does not support reading/writing headers. 040 */ 041public class SplunkRawLine extends TextLine implements SplunkScheme 042 { 043 /** 044 * Instantiates a new SplunkRawLine. 045 */ 046 public SplunkRawLine() 047 { 048 } 049 050 /** 051 * Instantiates a new SplunkRawLine. 052 * 053 * @param sourceFields the source fields 054 */ 055 public SplunkRawLine( Fields sourceFields ) 056 { 057 super( sourceFields ); 058 } 059 060 /** 061 * Instantiates a new SplunkRawLine. 062 * 063 * @param sourceFields the source fields 064 * @param charsetName the charset name 065 */ 066 public SplunkRawLine( Fields sourceFields, String charsetName ) 067 { 068 super( sourceFields, charsetName ); 069 } 070 071 /** 072 * Instantiates a new SplunkRawLine. 073 * 074 * @param sourceFields the source fields 075 * @param sinkFields the sink fields 076 */ 077 public SplunkRawLine( Fields sourceFields, Fields sinkFields ) 078 { 079 super( sourceFields, sinkFields ); 080 } 081 082 /** 083 * Instantiates a new SplunkRawLine. 084 * 085 * @param sourceFields the source fields 086 * @param sinkFields the sink fields 087 * @param charsetName the charset name 088 */ 089 public SplunkRawLine( Fields sourceFields, Fields sinkFields, String charsetName ) 090 { 091 super( sourceFields, sinkFields, charsetName ); 092 } 093 094 @Override 095 public void sourceConfInit( FlowProcess<? extends Properties> flowProcess, Tap<Properties, InputStream, OutputStream> tap, Properties conf ) 096 { 097 super.sourceConfInit( flowProcess, tap, conf ); 098 099 JobExportArgs args = new JobExportArgs(); 100 101 args.setOutputMode( JobExportArgs.OutputMode.RAW ); 102 103 conf.put( "args", args ); 104 } 105 }