azkaban-developers
Changes
azkaban-common/build.gradle 19(+19 -0)
azkaban-spi/build.gradle 23(+23 -0)
azkaban-spi/README.md 8(+8 -0)
settings.gradle 18(+18 -0)
Details
azkaban-common/build.gradle 19(+19 -0)
diff --git a/azkaban-common/build.gradle b/azkaban-common/build.gradle
index 50452ce..da495e9 100644
--- a/azkaban-common/build.gradle
+++ b/azkaban-common/build.gradle
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.
+ *
+ */
+
apply plugin: 'c'
model {
components {
@@ -15,6 +32,8 @@ model {
}
dependencies {
+ compile project(':azkaban-spi')
+
compile('com.google.guava:guava:13.0.1')
compile('commons-collections:commons-collections:3.2.2')
compile('commons-dbcp:commons-dbcp:1.4')
azkaban-spi/build.gradle 23(+23 -0)
diff --git a/azkaban-spi/build.gradle b/azkaban-spi/build.gradle
new file mode 100644
index 0000000..4087b7b
--- /dev/null
+++ b/azkaban-spi/build.gradle
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.
+ *
+ */
+
+dependencies {
+ /**
+ * The dependency list of the spi package should be NONE or VERY MINIMAL!! See @README.md of this package.
+ **/
+}
azkaban-spi/README.md 8(+8 -0)
diff --git a/azkaban-spi/README.md b/azkaban-spi/README.md
new file mode 100644
index 0000000..3e3b176
--- /dev/null
+++ b/azkaban-spi/README.md
@@ -0,0 +1,8 @@
+Azkaban SPI
+========
+The SPI module is the contract between other Azkaban sub-modules. It mainly contains the top level interfaces and
+exceptions that are shared across the entire application.
+
+##Dependencies
+The SPI package is ideally intended to be kept DEPENDENCY FREE (or have a VERY MINIMAL set) so that other
+components can easily depend on it.
\ No newline at end of file
diff --git a/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/AzkabanException.java b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/AzkabanException.java
new file mode 100644
index 0000000..f57cbdf
--- /dev/null
+++ b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/AzkabanException.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.linkedin.azkaban.spi;
+
+public class AzkabanException extends RuntimeException {
+ public AzkabanException(String message) {
+ this(message, null);
+ }
+
+ public AzkabanException(Throwable throwable) {
+ this(null, throwable);
+ }
+
+ public AzkabanException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AzkabanException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+ @Override
+ public String getMessage() {
+ String message = super.getMessage();
+ if (message == null && getCause() != null) {
+ message = getCause().getMessage();
+ }
+ return message;
+ }
+}
diff --git a/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/KeyAlreadyExistsException.java b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/KeyAlreadyExistsException.java
new file mode 100644
index 0000000..be31401
--- /dev/null
+++ b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/KeyAlreadyExistsException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.linkedin.azkaban.spi;
+
+import java.net.URI;
+
+
+/**
+ * This exception is thrown when there is an attempt to create a duplicate storage key via the {@link Storage}
+ * interface.
+ */
+public class KeyAlreadyExistsException extends StorageException {
+ public KeyAlreadyExistsException(URI key) {
+ super("Storage key already present: " + key);
+ }
+
+}
diff --git a/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/KeyDoesNotExistException.java b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/KeyDoesNotExistException.java
new file mode 100644
index 0000000..d7bcaa5
--- /dev/null
+++ b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/KeyDoesNotExistException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.linkedin.azkaban.spi;
+
+import java.net.URI;
+
+
+/**
+ * This exception is thrown when there is an attempt to create a duplicate storage key via the {@link Storage}
+ * interface.
+ */
+public class KeyDoesNotExistException extends StorageException {
+ public KeyDoesNotExistException(URI key) {
+ super("Storage key not present: " + key);
+ }
+
+}
diff --git a/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/Storage.java b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/Storage.java
new file mode 100644
index 0000000..d409836
--- /dev/null
+++ b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/Storage.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.linkedin.azkaban.spi;
+
+import java.io.InputStream;
+import java.net.URI;
+
+
+/**
+ * The Azkaban Storage interface would facilitate getting and putting objects into a storage mechanism of choice.
+ * By default, this is set to the MySQL database. However, users can have the ability to choose between multiple
+ * storage types in future.
+ *
+ * This is different from storing Azkaban state in MySQL which would typically be maintained in a different database.
+ *
+ * Note: This is a synchronous interface.
+ */
+public interface Storage {
+
+ /**
+ * Check if key exists in storage.
+ *
+ * @param key The key is a URI pointing to the blob in Storage.
+ * @return true if key exists. false otherwise.
+ */
+ boolean containsKey(URI key);
+
+ /**
+ * Get an InputStream object by providing a key. Throws {@link KeyDoesNotExistException} if key is not present.
+ *
+ * @param key The key is a URI pointing to the blob in Storage.
+ * @return InputStream for fetching the blob.
+ *
+ */
+ InputStream get(URI key) throws KeyDoesNotExistException;
+
+ /**
+ * Put an object into Storage against a key. If the key already exists, then it throws
+ * {@link KeyAlreadyExistsException;}.
+ *
+ * @param key The key is a URI pointing to the blob in Storage.
+ * @param is The input stream from which the value is read to the store. The value is read completely
+ */
+ void put(URI key, InputStream is) throws KeyAlreadyExistsException;
+
+ /**
+ * Delete an object from Storage. Throws {@link KeyDoesNotExistException} if key is not present.
+ *
+ * @param key The key is a URI pointing to the blob in Storage.
+ */
+ void delete(URI key) throws KeyDoesNotExistException;
+}
diff --git a/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/StorageException.java b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/StorageException.java
new file mode 100644
index 0000000..d02eb94
--- /dev/null
+++ b/azkaban-spi/src/main/java/com/linkedin/azkaban/spi/StorageException.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.linkedin.azkaban.spi;
+
+/**
+ * Super class to capture any exceptions related to {@link Storage}
+ */
+public class StorageException extends AzkabanException {
+ public StorageException(String message) {
+ this(message, null);
+ }
+
+ public StorageException(Throwable throwable) {
+ this(null, throwable);
+ }
+
+ public StorageException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StorageException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+}
settings.gradle 18(+18 -0)
diff --git a/settings.gradle b/settings.gradle
index 31b7a16..4704814 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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.
+ *
+ */
+
+include 'azkaban-spi'
include 'azkaban-common'
include 'azkaban-exec-server'
include 'azkaban-hadoop-security-plugin'