Skip to content

Commit

Permalink
Merge branch 'feat/add-transformer' of https://github.com/emanuelaepu…
Browse files Browse the repository at this point in the history
…re10/hale-transformer-api into feat/add-transformer
  • Loading branch information
emanuelaepure10 committed Dec 15, 2023
2 parents ab55438 + 262ddbc commit d31f01b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 51 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ tasks.named('test') {

spotless {
java {
palantirJavaFormat()
/*palantirJavaFormat()
importOrder('java', 'javax', '')
removeUnusedImports()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
endWithNewline()*/

target 'src/*/java/**/*.java'
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/to/wetransform/hale/transformer/SourceConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import eu.esdihumboldt.hale.common.core.io.Value;

public record SourceConfig(
URI location, String providerId, Map<String, Value> settings, boolean transform, List<String> attachments) {
public record SourceConfig(URI location, String providerId, Map<String, Value> settings, boolean transform,
List<String> attachments) {

public SourceConfig(URI location, String providerId) {
this(location, providerId, new HashMap<>(), true, new ArrayList<>());
}
public SourceConfig(URI location, String providerId) {
this(location, providerId, new HashMap<>(), true, new ArrayList<>());
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package to.wetransform.hale.transformer;

public record TargetConfig(String filename, String preset, CustomTarget customTarget) {}
public record TargetConfig(String filename, String preset, CustomTarget customTarget) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,47 @@
@EnableScheduling
public class TransformerApiApplication {

// TODO Should be configurable
private static final String ROUTING_KEY = "hale.transformation.#";

// TODO Should be configurable
public static final String TOPIC_EXCHANGE_NAME = "hale-transformer-exchange";

// TODO Should be configurable
public static final String QUEUE_NAME = "hale-transformation";

@Bean
Queue queue() {
// TODO Queue should be declared passively, i.e. it should be created
// outside of this application
return new Queue(QUEUE_NAME, false);
}

@Bean
TopicExchange exchange() {
// TODO Exchange should be declared passively, i.e. it should be created
// outside of this application
return new TopicExchange(TOPIC_EXCHANGE_NAME);
}

@Bean
Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}

@Bean
public MessageConverter jsonMessageConverter() {
return new Jackson2JsonMessageConverter();
}

@Bean
public RabbitTemplate rabbitTemplate(final ConnectionFactory connectionFactory) {
final var rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setMessageConverter(jsonMessageConverter());
return rabbitTemplate;
}

public static void main(String[] args) {
SpringApplication.run(TransformerApiApplication.class, args);
}
// TODO Should be configurable
private static final String ROUTING_KEY = "hale.transformation.#";

// TODO Should be configurable
public static final String TOPIC_EXCHANGE_NAME = "hale-transformer-exchange";

// TODO Should be configurable
public static final String QUEUE_NAME = "hale-transformation";

@Bean
Queue queue() {
// TODO Queue should be declared passively, i.e. it should be created
// outside of this application
return new Queue(QUEUE_NAME, false);
}

@Bean
TopicExchange exchange() {
// TODO Exchange should be declared passively, i.e. it should be created
// outside of this application
return new TopicExchange(TOPIC_EXCHANGE_NAME);
}

@Bean
Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}

@Bean
public MessageConverter jsonMessageConverter() {
return new Jackson2JsonMessageConverter();
}

@Bean
public RabbitTemplate rabbitTemplate(final ConnectionFactory connectionFactory) {
final var rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setMessageConverter(jsonMessageConverter());
return rabbitTemplate;
}

public static void main(String[] args) {
SpringApplication.run(TransformerApiApplication.class, args);
}
}

0 comments on commit d31f01b

Please sign in to comment.