Search in sources :

Example 1 with DuplicateInstanceNameException

use of org.apache.rya.api.client.Install.DuplicateInstanceNameException in project incubator-rya by apache.

the class RyaAdminCommands method install.

@CliCommand(value = INSTALL_CMD, help = "Create a new instance of Rya interactively.")
public String install() {
    // Fetch the commands that are connected to the store.
    final RyaClient commands = state.getShellState().getConnectedCommands().get();
    String instanceName = null;
    InstallConfiguration installConfig = null;
    try {
        boolean verified = false;
        while (!verified) {
            // Use the install prompt to fetch the user's installation options.
            instanceName = installPrompt.promptInstanceName();
            installConfig = installPrompt.promptInstallConfiguration(instanceName);
            // Verify the configuration is what the user actually wants to do.
            verified = installPrompt.promptVerified(instanceName, installConfig);
        }
        // Execute the command.
        commands.getInstall().install(instanceName, installConfig);
        return String.format("The Rya instance named '%s' has been installed.", instanceName);
    } catch (final DuplicateInstanceNameException e) {
        throw new RuntimeException(String.format("A Rya instance named '%s' already exists. Try again with a different name.", instanceName), e);
    } catch (final IOException | RyaClientException e) {
        throw new RuntimeException("Could not install a new instance of Rya. Reason: " + e.getMessage(), e);
    }
}
Also used : DuplicateInstanceNameException(org.apache.rya.api.client.Install.DuplicateInstanceNameException) RyaClientException(org.apache.rya.api.client.RyaClientException) RyaClient(org.apache.rya.api.client.RyaClient) IOException(java.io.IOException) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) CliCommand(org.springframework.shell.core.annotation.CliCommand)

Example 2 with DuplicateInstanceNameException

use of org.apache.rya.api.client.Install.DuplicateInstanceNameException in project incubator-rya by apache.

the class RyaAdminCommands method installWithAccumuloParameters.

@CliCommand(value = INSTALL_ACCUMULO_PARAMETERS_CMD, help = "Create a new Accumulo instance of Rya with command line parameters.")
public String installWithAccumuloParameters(@CliOption(key = { "instanceName" }, mandatory = true, help = "The name of the Rya instance to create.") final String instanceName, @CliOption(key = { "enableTableHashPrefix" }, mandatory = false, help = "Use Shard Balancing (improves streamed input write speeds).", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableTableHashPrefix, @CliOption(key = { "enableEntityCentricIndex" }, mandatory = false, help = "Use Entity Centric Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableEntityCentricIndex, @CliOption(key = { "enableFreeTextIndex" }, mandatory = false, help = "Use Free Text Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableFreeTextIndex, @CliOption(key = { "enableTemporalIndex" }, mandatory = false, help = "Use Temporal Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableTemporalIndex, @CliOption(key = { "enablePcjIndex" }, mandatory = false, help = "Use Precomputed Join (PCJ) Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enablePcjIndex, @CliOption(key = { "fluoPcjAppName" }, mandatory = false, help = "Fluo Application Name for PCJ Index Updater (fluo app must be initialized and enablePcjIndex=true).") final String fluoPcjAppName) {
    // Fetch the commands that are connected to the store.
    final RyaClient commands = state.getShellState().getConnectedCommands().get();
    try {
        final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(enableTableHashPrefix).setEnableEntityCentricIndex(enableEntityCentricIndex).setEnableFreeTextIndex(enableFreeTextIndex).setEnableTemporalIndex(enableTemporalIndex).setEnablePcjIndex(enablePcjIndex).setFluoPcjAppName(fluoPcjAppName).build();
        // Verify the configuration is what the user actually wants to do.
        if (!installPrompt.promptVerified(instanceName, installConfig)) {
            return "Skipping Installation.";
        }
        // Execute the command.
        commands.getInstall().install(instanceName, installConfig);
        return String.format("The Rya instance named '%s' has been installed.", instanceName);
    } catch (final DuplicateInstanceNameException e) {
        throw new RuntimeException(String.format("A Rya instance named '%s' already exists. Try again with a different name.", instanceName), e);
    } catch (final IOException | RyaClientException e) {
        throw new RuntimeException("Could not install a new instance of Rya. Reason: " + e.getMessage(), e);
    }
}
Also used : DuplicateInstanceNameException(org.apache.rya.api.client.Install.DuplicateInstanceNameException) RyaClientException(org.apache.rya.api.client.RyaClientException) RyaClient(org.apache.rya.api.client.RyaClient) IOException(java.io.IOException) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) CliCommand(org.springframework.shell.core.annotation.CliCommand)

Example 3 with DuplicateInstanceNameException

use of org.apache.rya.api.client.Install.DuplicateInstanceNameException in project incubator-rya by apache.

the class RyaAdminCommands method installWithMongoParameters.

@CliCommand(value = INSTALL_MONGO_PARAMETERS_CMD, help = "Create a new MongoDB instance of Rya with command line parameters.")
public String installWithMongoParameters(@CliOption(key = { "instanceName" }, mandatory = true, help = "The name of the Rya instance to create.") final String instanceName, @CliOption(key = { "enableFreeTextIndex" }, mandatory = false, help = "Use Free Text Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableFreeTextIndex, @CliOption(key = { "enableTemporalIndex" }, mandatory = false, help = "Use Temporal Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableTemporalIndex, @CliOption(key = { "enablePcjIndex" }, mandatory = false, help = "Use Precomputed Join (PCJ) Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enablePcjIndex) {
    // Fetch the commands that are connected to the store.
    final RyaClient commands = state.getShellState().getConnectedCommands().get();
    try {
        final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableFreeTextIndex(enableFreeTextIndex).setEnableTemporalIndex(enableTemporalIndex).setEnablePcjIndex(enablePcjIndex).build();
        // Verify the configuration is what the user actually wants to do.
        if (!installPrompt.promptVerified(instanceName, installConfig)) {
            return "Skipping Installation.";
        }
        // Execute the command.
        commands.getInstall().install(instanceName, installConfig);
        return String.format("The Rya instance named '%s' has been installed.", instanceName);
    } catch (final DuplicateInstanceNameException e) {
        throw new RuntimeException(String.format("A Rya instance named '%s' already exists. Try again with a different name.", instanceName), e);
    } catch (final IOException | RyaClientException e) {
        throw new RuntimeException("Could not install a new instance of Rya. Reason: " + e.getMessage(), e);
    }
}
Also used : DuplicateInstanceNameException(org.apache.rya.api.client.Install.DuplicateInstanceNameException) RyaClientException(org.apache.rya.api.client.RyaClientException) RyaClient(org.apache.rya.api.client.RyaClient) IOException(java.io.IOException) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) CliCommand(org.springframework.shell.core.annotation.CliCommand)

Aggregations

IOException (java.io.IOException)3 DuplicateInstanceNameException (org.apache.rya.api.client.Install.DuplicateInstanceNameException)3 InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)3 RyaClient (org.apache.rya.api.client.RyaClient)3 RyaClientException (org.apache.rya.api.client.RyaClientException)3 CliCommand (org.springframework.shell.core.annotation.CliCommand)3