Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron/pull/884#discussion_r158654707 --- Diff: metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/DefaultStellarShellExecutor.java --- @@ -0,0 +1,398 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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 org.apache.metron.stellar.common.shell; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.common.collect.Maps; +import org.apache.commons.collections.map.UnmodifiableMap; +import org.apache.commons.lang3.StringUtils; +import org.apache.curator.framework.CuratorFramework; +import org.apache.metron.stellar.common.StellarProcessor; +import org.apache.metron.stellar.common.configuration.ConfigurationsUtils; +import org.apache.metron.stellar.common.shell.StellarExecutionListeners.FunctionDefinedListener; +import org.apache.metron.stellar.common.shell.StellarExecutionListeners.SpecialDefinedListener; +import org.apache.metron.stellar.common.shell.StellarExecutionListeners.VariableDefinedListener; +import org.apache.metron.stellar.common.shell.specials.AssignmentCommand; +import org.apache.metron.stellar.common.shell.specials.Comment; +import org.apache.metron.stellar.common.shell.specials.DocCommand; +import org.apache.metron.stellar.common.shell.specials.MagicDefineGlobal; +import org.apache.metron.stellar.common.shell.specials.MagicListFunctions; +import org.apache.metron.stellar.common.shell.specials.MagicListGlobals; +import org.apache.metron.stellar.common.shell.specials.MagicListVariables; +import org.apache.metron.stellar.common.shell.specials.MagicUndefineGlobal; +import org.apache.metron.stellar.common.shell.specials.QuitCommand; +import org.apache.metron.stellar.common.shell.specials.SpecialCommand; +import org.apache.metron.stellar.common.utils.JSONUtils; +import org.apache.metron.stellar.dsl.Context; +import org.apache.metron.stellar.dsl.MapVariableResolver; +import org.apache.metron.stellar.dsl.StellarFunctionInfo; +import org.apache.metron.stellar.dsl.StellarFunctions; +import org.apache.metron.stellar.dsl.VariableResolver; +import org.apache.metron.stellar.dsl.functions.resolver.FunctionResolver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayInputStream; +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; + +import static org.apache.metron.stellar.common.configuration.ConfigurationsUtils.readGlobalConfigBytesFromZookeeper; +import static org.apache.metron.stellar.common.shell.StellarShellResult.noop; +import static org.apache.metron.stellar.common.shell.StellarShellResult.error; +import static org.apache.metron.stellar.common.shell.StellarShellResult.success; +import static org.apache.metron.stellar.dsl.Context.Capabilities.GLOBAL_CONFIG; +import static org.apache.metron.stellar.dsl.Context.Capabilities.STELLAR_CONFIG; +import static org.apache.metron.stellar.dsl.Context.Capabilities.ZOOKEEPER_CLIENT; + +/** + * Default implementation of a StellarShellExecutor. + */ +public class DefaultStellarShellExecutor implements StellarShellExecutor { + --- End diff -- This class provides the core execution logic for both the REPL and Zeppelin. It handles core Stellar in addition to the "extensions" like assignment, magics, docstrings, etc.
---