Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Add SmartNotebook #831

Merged
merged 2 commits into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<module>smart-engine</module>
<module>smart-server</module>
<module>smart-rule</module>
<module>smart-interpreter</module>
<module>smart-zeppelin</module>
<module>smart-agent</module>
<module>smart-hdfs</module>
Expand Down
42 changes: 42 additions & 0 deletions smart-interpreter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>smartdata-project</artifactId>
<groupId>org.smartdata</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>org.smartdata</groupId>
<artifactId>smart-interpreter</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.smartdata</groupId>
<artifactId>smart-engine</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<name>Interpreter</name>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.smartdata.interpreter;

package org.apache.zeppelin.display;
import org.smartdata.server.SmartEngine;

public class AngularObjectBuilder {
import java.io.IOException;

/**
* Created by zhiqiangx on 17-7-31.
*/
public abstract class SmartInterpreter {
private SmartEngine smartEngine;

public SmartInterpreter(SmartEngine smartEngine) {
this.smartEngine = smartEngine;
}

protected SmartEngine getSmartEngine() {
return smartEngine;
}

public abstract String excute(String cmd) throws IOException;

public static <T> AngularObject<T> build(String varName, T value, String noteId,
String paragraphId) {
return new AngularObject<>(varName, value, noteId, paragraphId, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.smartdata.interpreter.impl;

package org.apache.zeppelin
import org.smartdata.interpreter.SmartInterpreter;
import org.smartdata.server.SmartEngine;

import org.openqa.selenium.WebDriver
import org.scalatest.concurrent.Eventually._
import org.scalatest.time._
import org.scalatest.selenium.WebBrowser
import org.scalatest.{DoNotDiscover, FunSuite}
import AbstractFunctionalSuite.SERVER_ADDRESS
import java.io.IOException;

@DoNotDiscover
class WelcomePageSuite(implicit driver: WebDriver) extends FunSuite with WebBrowser {
public class ActionInterpreter extends SmartInterpreter {

test("Welcome sign is correct") {
eventually (timeout(Span(180, Seconds))) {
go to SERVER_ADDRESS
assert(find("welcome").isDefined)
public ActionInterpreter(SmartEngine smartEngine) {
super(smartEngine);
}
}

@Override
public String excute(String cmd) throws IOException {
getSmartEngine().getCmdletManager().submitCmdlet(cmd);
return "Success to add action";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.smartdata.interpreter.impl;

import org.smartdata.interpreter.SmartInterpreter;
import org.smartdata.model.RuleState;
import org.smartdata.server.SmartEngine;

import java.io.IOException;

/**
* Created by zhiqiangx on 17-7-31.
*/
public class RuleInterpreter extends SmartInterpreter {

public RuleInterpreter(SmartEngine smartEngine) {
super(smartEngine);
}

@Override
public String excute(String cmd) throws IOException {
long t =getSmartEngine().getRuleManager().submitRule(cmd, RuleState.DISABLED);
return "Success to add rule : " + t;
}
}
Loading