forked from spotify/heroic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core,shell] run shell components in core and remote shell
- Loading branch information
Showing
64 changed files
with
1,695 additions
and
945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
dependency-reduced-pom.xml | ||
target | ||
*.log | ||
.*.un~ | ||
*~ | ||
.*.swp | ||
*.pyc | ||
.classpath | ||
.project | ||
.settings | ||
bin | ||
/*.json | ||
/*.png | ||
/*.log | ||
/*.gz | ||
.* |
5 changes: 5 additions & 0 deletions
5
heroic-component/src/main/java/com/spotify/heroic/HeroicCoreInjector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.spotify.heroic; | ||
|
||
public interface HeroicCoreInjector { | ||
public <T> T inject(T instance); | ||
} |
40 changes: 40 additions & 0 deletions
40
heroic-component/src/main/java/com/spotify/heroic/shell/CommandDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import lombok.Data; | ||
import eu.toolchain.serializer.SerialReader; | ||
import eu.toolchain.serializer.SerialWriter; | ||
import eu.toolchain.serializer.Serializer; | ||
import eu.toolchain.serializer.SerializerFramework; | ||
|
||
|
||
@Data | ||
public class CommandDefinition { | ||
final String name; | ||
final List<String> aliases; | ||
final String usage; | ||
|
||
static Serializer<CommandDefinition> serializer(SerializerFramework s) { | ||
return new Serializer<CommandDefinition>() { | ||
final Serializer<String> string = s.string(); | ||
final Serializer<List<String>> aliases = s.list(s.string()); | ||
|
||
@Override | ||
public void serialize(SerialWriter buffer, CommandDefinition value) throws IOException { | ||
this.string.serialize(buffer, value.name); | ||
this.aliases.serialize(buffer, value.aliases); | ||
this.string.serialize(buffer, value.usage); | ||
} | ||
|
||
@Override | ||
public CommandDefinition deserialize(SerialReader buffer) throws IOException { | ||
final String name = this.string.deserialize(buffer); | ||
final List<String> aliases = this.aliases.deserialize(buffer); | ||
final String usage = this.string.deserialize(buffer); | ||
return new CommandDefinition(name, aliases, usage); | ||
} | ||
}; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
heroic-component/src/main/java/com/spotify/heroic/shell/CoreInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
import java.util.List; | ||
|
||
public interface CoreInterface { | ||
public CoreShellInterface setup(ShellInterface shell) throws Exception; | ||
|
||
public List<CommandDefinition> getCommands() throws Exception; | ||
|
||
public void shutdown() throws Exception; | ||
} |
10 changes: 10 additions & 0 deletions
10
heroic-component/src/main/java/com/spotify/heroic/shell/CoreShellInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
import java.io.PrintWriter; | ||
import java.util.List; | ||
|
||
import eu.toolchain.async.AsyncFuture; | ||
|
||
public interface CoreShellInterface { | ||
public AsyncFuture<Void> command(List<String> command, PrintWriter out) throws Exception; | ||
} |
5 changes: 5 additions & 0 deletions
5
heroic-component/src/main/java/com/spotify/heroic/shell/CoreShellTaskDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
public interface CoreShellTaskDefinition { | ||
TaskDefinition setup(ShellInterface shell, TaskContext ctx); | ||
} |
17 changes: 17 additions & 0 deletions
17
heroic-component/src/main/java/com/spotify/heroic/shell/CoreTaskDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
import java.util.List; | ||
|
||
import com.spotify.heroic.HeroicCoreInjector; | ||
|
||
public interface CoreTaskDefinition { | ||
String name(); | ||
|
||
List<String> aliases(); | ||
|
||
List<String> names(); | ||
|
||
String usage(); | ||
|
||
CoreShellTaskDefinition setup(HeroicCoreInjector core) throws Exception; | ||
} |
5 changes: 5 additions & 0 deletions
5
heroic-component/src/main/java/com/spotify/heroic/shell/ShellInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
|
||
public interface ShellInterface { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
heroic-component/src/main/java/com/spotify/heroic/shell/TaskContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
|
||
public interface TaskContext { | ||
} |
11 changes: 11 additions & 0 deletions
11
heroic-component/src/main/java/com/spotify/heroic/shell/TaskDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.spotify.heroic.shell; | ||
|
||
import java.io.PrintWriter; | ||
|
||
import eu.toolchain.async.AsyncFuture; | ||
|
||
public interface TaskDefinition { | ||
TaskParameters params(); | ||
|
||
AsyncFuture<Void> run(PrintWriter out, TaskParameters params) throws Exception; | ||
} |
35 changes: 35 additions & 0 deletions
35
heroic-component/src/main/java/com/spotify/heroic/shell/TaskName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2015 Spotify AB. | ||
* | ||
* 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 com.spotify.heroic.shell; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface TaskName { | ||
String value() default ""; | ||
|
||
String[] aliases() default {}; | ||
} |
2 changes: 1 addition & 1 deletion
2
...spotify/heroic/shell/ShellTaskParams.java → .../spotify/heroic/shell/TaskParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
heroic-core/src/main/java/com/spotify/heroic/shell/AbstractShellTask.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
heroic-core/src/main/java/com/spotify/heroic/shell/HeroicShellBridge.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.