public static Class<? extends Subscription> translateSubscriptionType(String pubsubName) { Class<? extends Pubsub> pubsubClass = translatePubsubType(pubsubName); String subscriptionClassName = pubsubClass.getName().replaceAll("Pubsub", "Subscription"); try { return (Class<? extends Subscription>) Class.forName(subscriptionClassName); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("No subscription for class \"" + subscriptionClassName + "\" found", e); } } }
public void setEnabled() { enabled = getEnabled(); }
public static Supplier<Subscription> getSubscription(String deploymentName, String pubsubName, String subscriptionName, boolean validate) { return () -> { Object rawSubscription = ResponseUnwrapper.get(getService().getSubscription(deploymentName, pubsubName, subscriptionName, validate)); return getObjectMapper().convertValue(rawSubscription, Pubsubs.translateSubscriptionType(pubsubName)); }; }
public static Supplier<Publisher> getPublisher(String deploymentName, String pubsubName, String publisherName, boolean validate) { return () -> { Object rawPublisher = ResponseUnwrapper.get(getService().getPublisher(deploymentName, pubsubName, publisherName, validate)); return getObjectMapper().convertValue(rawPublisher, Pubsubs.translatePublisherType(pubsubName)); }; }
public void setPubsub(String deploymentName, Pubsub pubsub) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); Pubsubs pubsubs = deploymentConfiguration.getPubsub(); switch (pubsub.getPubsubType()) { case GOOGLE: pubsubs.setGoogle((GooglePubsub) pubsub); break; default: throw new IllegalArgumentException("Unknown pubsub type " + pubsub.getPubsubType()); } }
public Boolean getEnabled() { NodeIterator pubsubNodes = getChildren(); Pubsub pubsub; Boolean allEnabled = true; while ((pubsub = (Pubsub) pubsubNodes.getNext()) != null) { allEnabled &= pubsub.isEnabled(); } return allEnabled; }
public static Supplier<Subscription> getSubscription(String deploymentName, String pubsubName, String subscriptionName, boolean validate) { return () -> { Object rawSubscription = ResponseUnwrapper.get(getService().getSubscription(deploymentName, pubsubName, subscriptionName, validate)); return getObjectMapper().convertValue(rawSubscription, Pubsubs.translateSubscriptionType(pubsubName)); }; }
@RequestMapping(value = "/publisher/{publisherName:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setPublisher(@PathVariable String deploymentName, @PathVariable String pubsubName, @PathVariable String publisherName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawPublisher) { Publisher publisher = objectMapper.convertValue( rawPublisher, Pubsubs.translatePublisherType(pubsubName) ); return GenericUpdateRequest.<Publisher>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(s -> publisherService.setPublisher(deploymentName, pubsubName, publisherName, s)) .validator(() -> publisherService.validatePublisher(deploymentName, pubsubName, publisher.getName())) .description("Edit the " + publisherName + " publisher") .build() .execute(validationSettings, publisher); }
public void setPubsub(String deploymentName, Pubsub pubsub) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); Pubsubs pubsubs = deploymentConfiguration.getPubsub(); switch (pubsub.pubsubType()) { case GOOGLE: pubsubs.setGoogle((GooglePubsub) pubsub); break; default: throw new IllegalArgumentException("Unknown pubsub type " + pubsub.pubsubType()); } }
public Boolean getEnabled() { NodeIterator pubsubNodes = getChildren(); Pubsub pubsub; Boolean allEnabled = true; while ((pubsub = (Pubsub) pubsubNodes.getNext()) != null) { allEnabled &= pubsub.isEnabled(); } return allEnabled; }
public static Class<? extends Subscription> translateSubscriptionType(String pubsubName) { Class<? extends Pubsub> pubsubClass = translatePubsubType(pubsubName); String subscriptionClassName = pubsubClass.getName().replaceAll("Pubsub", "Subscription"); try { return (Class<? extends Subscription>) Class.forName(subscriptionClassName); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("No subscription for class \"" + subscriptionClassName + "\" found", e); } }
@RequestMapping(value = "/subscription/{subscriptionName:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setSubscription(@PathVariable String deploymentName, @PathVariable String pubsubName, @PathVariable String subscriptionName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawSubscription) { Subscription subscription = objectMapper.convertValue( rawSubscription, Pubsubs.translateSubscriptionType(pubsubName) ); return GenericUpdateRequest.<Subscription>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(s -> subscriptionService.setSubscription(deploymentName, pubsubName, subscriptionName, s)) .validator(() -> subscriptionService.validateSubscription(deploymentName, pubsubName, subscription.getName())) .description("Edit the " + subscriptionName + " subscription") .build() .execute(validationSettings, subscription); }
@RequestMapping(value = "/", method = RequestMethod.POST) DaemonTask<Halconfig, Void> addPublisher(@PathVariable String deploymentName, @PathVariable String pubsubName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawPublisher) { Publisher publisher = objectMapper.convertValue( rawPublisher, Pubsubs.translatePublisherType(pubsubName) ); return GenericUpdateRequest.<Publisher>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(s -> publisherService.addPublisher(deploymentName, pubsubName, s)) .validator(() -> publisherService.validatePublisher(deploymentName, pubsubName, publisher.getName())) .description("Add the " + publisher.getName() + " publisher") .build() .execute(validationSettings, publisher); } }
public void setEnabled() { enabled = getEnabled(); }
public static Class<? extends Publisher> translatePublisherType(String pubsubName) { Class<? extends Pubsub> pubsubClass = translatePubsubType(pubsubName); String publisherClassName = pubsubClass.getName().replaceAll("Pubsub", "Publisher"); try { return (Class<? extends Publisher>) Class.forName(publisherClassName); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("No publisher for class \"" + publisherClassName + "\" found", e); } } }
@RequestMapping(value = "/", method = RequestMethod.POST) DaemonTask<Halconfig, Void> addSubscription(@PathVariable String deploymentName, @PathVariable String pubsubName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawSubscription) { Subscription subscription = objectMapper.convertValue( rawSubscription, Pubsubs.translateSubscriptionType(pubsubName) ); return GenericUpdateRequest.<Subscription>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(s -> subscriptionService.addSubscription(deploymentName, pubsubName, s)) .validator(() -> subscriptionService.validateSubscription(deploymentName, pubsubName, subscription.getName())) .description("Add the " + subscription.getName() + " subscription") .build() .execute(validationSettings, subscription); } }
public static Supplier<Pubsub> getPubsub(String deploymentName, String pubsubName, boolean validate) { return () -> { Object pubsub = ResponseUnwrapper.get(getService().getPubsub(deploymentName, pubsubName, validate)); return getObjectMapper().convertValue(pubsub, Pubsubs.translatePubsubType(pubsubName)); }; }
public static Supplier<Pubsub> getPubsub(String deploymentName, String pubsubName, boolean validate) { return () -> { Object pubsub = ResponseUnwrapper.get(getService().getPubsub(deploymentName, pubsubName, validate)); return getObjectMapper().convertValue(pubsub, Pubsubs.translatePubsubType(pubsubName)); }; }
@RequestMapping(value = "/{pubsubName:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setPubsub(@PathVariable String deploymentName, @PathVariable String pubsubName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawPubsub) { Pubsub pubsub = objectMapper.convertValue( rawPubsub, Pubsubs.translatePubsubType(pubsubName) ); return GenericUpdateRequest.<Pubsub>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(p -> pubsubService.setPubsub(deploymentName, p)) .validator(() -> pubsubService.validatePubsub(deploymentName, pubsubName)) .description("Edit the " + pubsubName + " pubsub") .build() .execute(validationSettings, pubsub); }