/*
* 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.zeppelin.interpreter;
import java.util.Properties;
import java.util.Random;
import org.apache.zeppelin.notebook.utility.IdHashes;
/**
* Interpreter settings
*/
public class InterpreterSetting {
private String id;
private String name;
private String group;
private String description;
private Properties properties;
private InterpreterGroup interpreterGroup;
private InterpreterOption option;
public InterpreterSetting(String id, String name,
String group,
InterpreterOption option) {
this.id = id;
this.name = name;
this.group = group;
this.option = option;
}
public InterpreterSetting(String name,
String group,
InterpreterOption option) {
this(generateId(), name, group, option);
}
public String id() {
return id;
}
private static String generateId() {
return IdHashes.encode(System.currentTimeMillis() + new Random().nextInt());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String desc) {
this.description = desc;
}
public String getGroup() {
return group;
}
public InterpreterGroup getInterpreterGroup() {
return interpreterGroup;
}
public void setInterpreterGroup(InterpreterGroup interpreterGroup) {
this.interpreterGroup = interpreterGroup;
this.properties = interpreterGroup.getProperty();
}
public Properties getProperties() {
return properties;
}
public InterpreterOption getOption() {
if (option == null) {
option = new InterpreterOption();
}
return option;
}
public void setOption(InterpreterOption option) {
this.option = option;
}
}