// Path: flume-core/src/main/java/com/cloudera/flume/conf/FlumeBuilder.java
// enum ASTNODE {
//   DEC, HEX, OCT, STRING, BOOL, FLOAT, // literals
//   FUNC, // function node
//   SINK, SOURCE, // sink or source
//   KWARG, // kwarg support
//   MULTI, DECO, BACKUP, ROLL, GEN, FAILCHAIN, // compound sinks
//   NODE, // combination of sink and source
// };


import java.util.ArrayList;
import java.util.List;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.tree.CommonTree;
import com.cloudera.flume.conf.FlumeBuilder.ASTNODE;
import com.cloudera.flume.master.FlumeNodeSpec;
import com.google.common.base.Preconditions;
/**
 * Licensed to Cloudera, Inc. under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  Cloudera, Inc. licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.cloudera.flume.conf;




/**
 * This regenerates flume specs from parsed ASTs.
 * 
 * The master node reads and parses commands. If they parse cleanly, this is
 * used to regenerated the code as a string so it can be sent to the nodes.
 */
public class FlumeSpecGen {

  static String genArg(CommonTree t) throws FlumeSpecException {
// Path: flume-core/src/main/java/com/cloudera/flume/conf/FlumeBuilder.java
// enum ASTNODE {
//   DEC, HEX, OCT, STRING, BOOL, FLOAT, // literals
//   FUNC, // function node
//   SINK, SOURCE, // sink or source
//   KWARG, // kwarg support
//   MULTI, DECO, BACKUP, ROLL, GEN, FAILCHAIN, // compound sinks
//   NODE, // combination of sink and source
// };


// Path: flume-core/src/main/java/com/cloudera/flume/conf/FlumeSpecGen.java
import java.util.ArrayList;
import java.util.List;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.tree.CommonTree;
import com.cloudera.flume.conf.FlumeBuilder.ASTNODE;
import com.cloudera.flume.master.FlumeNodeSpec;
import com.google.common.base.Preconditions;

/**
 * Licensed to Cloudera, Inc. under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  Cloudera, Inc. licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.cloudera.flume.conf;




/**
 * This regenerates flume specs from parsed ASTs.
 * 
 * The master node reads and parses commands. If they parse cleanly, this is
 * used to regenerated the code as a string so it can be sent to the nodes.
 */
public class FlumeSpecGen {

  static String genArg(CommonTree t) throws FlumeSpecException {
    ASTNODE type = ASTNODE.valueOf(t.getText()); // convert to enum