Implement launch functionality [release]

This commit is contained in:
crschnick 2023-02-11 14:22:07 +00:00
parent 197f5220af
commit c553dca81b
11 changed files with 92 additions and 6 deletions

View file

@ -35,6 +35,7 @@ It comes with the following main features:
- Comes with integrations for all commonly used terminals for all operating systems - Comes with integrations for all commonly used terminals for all operating systems
- Exclusively uses established CLI tools and therefore works out of the box on most systems and doesn't require any additional setup - Exclusively uses established CLI tools and therefore works out of the box on most systems and doesn't require any additional setup
- Allows you to customize the launched shell's init environment - Allows you to customize the launched shell's init environment
- Launch connections from the GUI or commandline
#### All your connections in one place #### All your connections in one place
@ -43,7 +44,7 @@ It comes with the following main features:
- Share connection configurations to any other trusted party through shareable URLs - Share connection configurations to any other trusted party through shareable URLs
- Create desktop shortcuts to open your connections - Create desktop shortcuts to open your connections
<img src="https://user-images.githubusercontent.com/72509152/213240153-3f742f03-1289-44c3-bf4d-626d9886ffcf.png" alt="drawing" height="450"/> <img src="https://user-images.githubusercontent.com/72509152/218159305-64e2ac2c-2d01-4087-89d2-907f2e3a6bed.png" alt="drawing" height="450"/>
## Data Explorer ## Data Explorer
@ -65,7 +66,7 @@ allows you to manage and work with all kinds of data sources:
your favorite programming languages using the X-Pipe APIs your favorite programming languages using the X-Pipe APIs
- Connect select third party applications directly to X-Pipe through extensions - Connect select third party applications directly to X-Pipe through extensions
<img src="https://user-images.githubusercontent.com/72509152/218159305-64e2ac2c-2d01-4087-89d2-907f2e3a6bed.png" alt="drawing" height="450"/> <img src="https://user-images.githubusercontent.com/72509152/213240736-7a27fb3c-e8c3-4c92-bcea-2a782e53dc31.png" alt="drawing" height="450"/>
## Repository Structure ## Repository Structure

View file

@ -136,7 +136,7 @@ run {
systemProperty 'io.xpipe.app.writeSysOut', "true" systemProperty 'io.xpipe.app.writeSysOut', "true"
systemProperty 'io.xpipe.app.developerMode', "true" systemProperty 'io.xpipe.app.developerMode', "true"
systemProperty 'io.xpipe.app.logLevel', "trace" systemProperty 'io.xpipe.app.logLevel', "trace"
systemProperty "io.xpipe.beacon.port", "21724" // systemProperty "io.xpipe.beacon.port", "21724"
// systemProperty "io.xpipe.beacon.printMessages", "true" // systemProperty "io.xpipe.beacon.printMessages", "true"
systemProperty "io.xpipe.app.extensions", extensionDirList systemProperty "io.xpipe.app.extensions", extensionDirList
// systemProperty 'io.xpipe.app.debugPlatform', "true" // systemProperty 'io.xpipe.app.debugPlatform', "true"

View file

@ -0,0 +1,24 @@
package io.xpipe.app.exchange;
import io.xpipe.beacon.BeaconHandler;
import io.xpipe.beacon.exchange.LaunchExchange;
import io.xpipe.core.store.LaunchableStore;
import org.apache.commons.exec.CommandLine;
import java.util.List;
public class LaunchExchangeImpl extends LaunchExchange
implements MessageExchangeImpl<LaunchExchange.Request, LaunchExchange.Response> {
@Override
public Response handleRequest(BeaconHandler handler, Request msg) throws Exception {
var store = getStoreEntryByName(msg.getName(), false);
if (store.getStore() instanceof LaunchableStore s) {
var command = s.prepareLaunchCommand();
var split = CommandLine.parse(command);
return Response.builder().command(List.of(split.toStrings())).build();
}
throw new IllegalArgumentException();
}
}

View file

@ -66,6 +66,7 @@ open module io.xpipe.app {
requires com.jfoenix; requires com.jfoenix;
requires org.kordamp.ikonli.javafx; requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.material; requires org.kordamp.ikonli.material;
requires commons.exec;
requires org.controlsfx.controls; requires org.controlsfx.controls;
requires io.sentry; requires io.sentry;
requires io.xpipe.beacon; requires io.xpipe.beacon;
@ -125,6 +126,7 @@ open module io.xpipe.app {
StoreProviderListExchangeImpl, StoreProviderListExchangeImpl,
ListCollectionsExchangeImpl, ListCollectionsExchangeImpl,
OpenExchangeImpl, OpenExchangeImpl,
LaunchExchangeImpl,
FocusExchangeImpl, FocusExchangeImpl,
ListEntriesExchangeImpl, ListEntriesExchangeImpl,
ProxyReadConnectionExchangeImpl, ProxyReadConnectionExchangeImpl,

View file

@ -0,0 +1,33 @@
package io.xpipe.beacon.exchange;
import io.xpipe.beacon.RequestMessage;
import io.xpipe.beacon.ResponseMessage;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
import java.util.List;
public class LaunchExchange implements MessageExchange {
@Override
public String getId() {
return "launch";
}
@Jacksonized
@Builder
@Value
public static class Request implements RequestMessage {
@NonNull
String name;
}
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
@NonNull List<String> command;
}
}

View file

@ -43,6 +43,7 @@ module io.xpipe.beacon {
provides Module with provides Module with
BeaconJacksonModule; BeaconJacksonModule;
provides io.xpipe.beacon.exchange.MessageExchange with provides io.xpipe.beacon.exchange.MessageExchange with
LaunchExchange,
ForwardExchange, ForwardExchange,
InstanceExchange, InstanceExchange,
EditStoreExchange, EditStoreExchange,

View file

@ -2,7 +2,12 @@ package io.xpipe.core.store;
import io.xpipe.core.process.CommandProcessControl; import io.xpipe.core.process.CommandProcessControl;
public interface CommandExecutionStore extends DataStore { public interface CommandExecutionStore extends DataStore, LaunchableStore {
@Override
default String prepareLaunchCommand() throws Exception {
return create().prepareTerminalOpen();
}
CommandProcessControl create() throws Exception; CommandProcessControl create() throws Exception;
} }

View file

@ -0,0 +1,6 @@
package io.xpipe.core.store;
public interface LaunchableStore extends DataStore {
String prepareLaunchCommand() throws Exception;
}

View file

@ -8,7 +8,7 @@ import io.xpipe.core.process.ShellType;
import java.nio.charset.Charset; import java.nio.charset.Charset;
public interface ShellStore extends DataStore, StatefulDataStore { public interface ShellStore extends DataStore, StatefulDataStore, LaunchableStore {
public static MachineStore local() { public static MachineStore local() {
return new LocalStore(); return new LocalStore();
@ -24,6 +24,11 @@ public interface ShellStore extends DataStore, StatefulDataStore {
return s instanceof LocalStore; return s instanceof LocalStore;
} }
@Override
default String prepareLaunchCommand() throws Exception {
return create().prepareTerminalOpen();
}
default ShellProcessControl create() { default ShellProcessControl create() {
var pc = createControl(); var pc = createControl();
pc.onInit(processControl -> { pc.onInit(processControl -> {

View file

@ -6,6 +6,7 @@ dependencies {
dep files("$buildDir/generated-modules/commons-lang3-3.12.0.jar") dep files("$buildDir/generated-modules/commons-lang3-3.12.0.jar")
dep files("$buildDir/generated-modules/commons-io-2.11.0.jar") dep files("$buildDir/generated-modules/commons-io-2.11.0.jar")
dep files("$buildDir/generated-modules/commons-math3-3.6.1.jar") dep files("$buildDir/generated-modules/commons-math3-3.6.1.jar")
dep files("$buildDir/generated-modules/commons-exec-1.3.jar")
} }
addDependenciesModuleInfo { addDependenciesModuleInfo {
@ -40,6 +41,14 @@ addDependenciesModuleInfo {
} }
''' '''
} }
module {
artifact 'org.apache.commons:commons-exec:1.3'
moduleInfoSource = '''
module commons.exec {
exports org.apache.commons.exec;
}
'''
}
module { module {
artifact 'org.apache.commons:commons-collections4:4.4' artifact 'org.apache.commons:commons-collections4:4.4'
moduleInfoSource = ''' moduleInfoSource = '''

View file

@ -1 +1 @@
0.4.27 0.4.28