Search in sources :

Example 6 with NiFiRegistryClient

use of org.apache.nifi.registry.client.NiFiRegistryClient in project nifi by apache.

the class NiFiCLIMainRunner method main.

public static void main(String[] args) {
    final String[] cmdArgs = ("registry list-buckets help " + "").split("[ ]");
    final Session session = new InMemorySession();
    final ClientFactory<NiFiClient> niFiClientFactory = new NiFiClientFactory();
    final ClientFactory<NiFiRegistryClient> nifiRegClientFactory = new NiFiRegistryClientFactory();
    final Context context = new StandardContext.Builder().output(System.out).session(session).nifiClientFactory(niFiClientFactory).nifiRegistryClientFactory(nifiRegClientFactory).build();
    final Map<String, Command> commands = CommandFactory.createTopLevelCommands(context);
    final Map<String, CommandGroup> commandGroups = CommandFactory.createCommandGroups(context);
    final CommandProcessor processor = new CommandProcessor(commands, commandGroups, context);
    processor.process(cmdArgs);
}
Also used : StandardContext(org.apache.nifi.toolkit.cli.impl.context.StandardContext) Context(org.apache.nifi.toolkit.cli.api.Context) NiFiClientFactory(org.apache.nifi.toolkit.cli.impl.client.NiFiClientFactory) NiFiClient(org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient) NiFiRegistryClientFactory(org.apache.nifi.toolkit.cli.impl.client.NiFiRegistryClientFactory) CommandGroup(org.apache.nifi.toolkit.cli.api.CommandGroup) NiFiRegistryClient(org.apache.nifi.registry.client.NiFiRegistryClient) Command(org.apache.nifi.toolkit.cli.api.Command) InMemorySession(org.apache.nifi.toolkit.cli.impl.session.InMemorySession) StandardContext(org.apache.nifi.toolkit.cli.impl.context.StandardContext) CommandProcessor(org.apache.nifi.toolkit.cli.impl.command.CommandProcessor) Session(org.apache.nifi.toolkit.cli.api.Session) InMemorySession(org.apache.nifi.toolkit.cli.impl.session.InMemorySession)

Example 7 with NiFiRegistryClient

use of org.apache.nifi.registry.client.NiFiRegistryClient in project nifi by apache.

the class RestBasedFlowRegistry method getBucketClient.

private BucketClient getBucketClient(final NiFiUser user) {
    final String identity = getIdentity(user);
    final NiFiRegistryClient registryClient = getRegistryClient();
    final BucketClient bucketClient = identity == null ? registryClient.getBucketClient() : registryClient.getBucketClient(identity);
    return bucketClient;
}
Also used : BucketClient(org.apache.nifi.registry.client.BucketClient) NiFiRegistryClient(org.apache.nifi.registry.client.NiFiRegistryClient) JerseyNiFiRegistryClient(org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient)

Example 8 with NiFiRegistryClient

use of org.apache.nifi.registry.client.NiFiRegistryClient in project nifi-registry by apache.

the class UnsecuredNiFiRegistryClientIT method setup.

@Before
public void setup() {
    final String baseUrl = createBaseURL();
    LOGGER.info("Using base url = " + baseUrl);
    final NiFiRegistryClientConfig clientConfig = new NiFiRegistryClientConfig.Builder().baseUrl(baseUrl).build();
    Assert.assertNotNull(clientConfig);
    final NiFiRegistryClient client = new JerseyNiFiRegistryClient.Builder().config(clientConfig).build();
    Assert.assertNotNull(client);
    this.client = client;
}
Also used : NiFiRegistryClient(org.apache.nifi.registry.client.NiFiRegistryClient) JerseyNiFiRegistryClient(org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient) NiFiRegistryClientConfig(org.apache.nifi.registry.client.NiFiRegistryClientConfig) Before(org.junit.Before)

Example 9 with NiFiRegistryClient

use of org.apache.nifi.registry.client.NiFiRegistryClient in project nifi by apache.

the class RestBasedFlowRegistry method getFlowSnapshotClient.

private FlowSnapshotClient getFlowSnapshotClient(final NiFiUser user) {
    final String identity = getIdentity(user);
    final NiFiRegistryClient registryClient = getRegistryClient();
    final FlowSnapshotClient snapshotClient = identity == null ? registryClient.getFlowSnapshotClient() : registryClient.getFlowSnapshotClient(identity);
    return snapshotClient;
}
Also used : NiFiRegistryClient(org.apache.nifi.registry.client.NiFiRegistryClient) JerseyNiFiRegistryClient(org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient) FlowSnapshotClient(org.apache.nifi.registry.client.FlowSnapshotClient)

Example 10 with NiFiRegistryClient

use of org.apache.nifi.registry.client.NiFiRegistryClient in project nifi by apache.

the class RestBasedFlowRegistry method getFlowClient.

private FlowClient getFlowClient(final NiFiUser user) {
    final String identity = getIdentity(user);
    final NiFiRegistryClient registryClient = getRegistryClient();
    final FlowClient flowClient = identity == null ? registryClient.getFlowClient() : registryClient.getFlowClient(identity);
    return flowClient;
}
Also used : NiFiRegistryClient(org.apache.nifi.registry.client.NiFiRegistryClient) JerseyNiFiRegistryClient(org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient) FlowClient(org.apache.nifi.registry.client.FlowClient)

Aggregations

NiFiRegistryClient (org.apache.nifi.registry.client.NiFiRegistryClient)14 JerseyNiFiRegistryClient (org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient)6 NiFiClient (org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient)4 IOException (java.io.IOException)3 Properties (java.util.Properties)3 NiFiRegistryClientConfig (org.apache.nifi.registry.client.NiFiRegistryClientConfig)3 NiFiRegistryException (org.apache.nifi.registry.client.NiFiRegistryException)3 VersionedFlowSnapshotMetadata (org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata)3 Session (org.apache.nifi.toolkit.cli.api.Session)3 NiFiClientFactory (org.apache.nifi.toolkit.cli.impl.client.NiFiClientFactory)3 NiFiRegistryClientFactory (org.apache.nifi.toolkit.cli.impl.client.NiFiRegistryClientFactory)3 InMemorySession (org.apache.nifi.toolkit.cli.impl.session.InMemorySession)3 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 ParseException (org.apache.commons.cli.ParseException)2 FlowSnapshotClient (org.apache.nifi.registry.client.FlowSnapshotClient)2 VersionedFlowSnapshot (org.apache.nifi.registry.flow.VersionedFlowSnapshot)2 Command (org.apache.nifi.toolkit.cli.api.Command)2 CommandException (org.apache.nifi.toolkit.cli.api.CommandException)2 CommandGroup (org.apache.nifi.toolkit.cli.api.CommandGroup)2