Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat operation param #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj
case "newGraph": target.setNewGraph(property(camelContext, boolean.class, value)); return true;
case "ontologyformat":
case "ontologyFormat": target.setOntologyFormat(property(camelContext, java.lang.String.class, value)); return true;
case "operation": target.setOperation(property(camelContext, java.lang.String.class, value)); return true;
case "pathdatadir":
case "pathDataDir": target.setPathDataDir(property(camelContext, java.lang.String.class, value)); return true;
case "query": target.setQuery(property(camelContext, java.lang.String.class, value)); return true;
Expand Down Expand Up @@ -103,6 +104,7 @@ public Class<?> getOptionType(String name, boolean ignoreCase) {
case "newGraph": return boolean.class;
case "ontologyformat":
case "ontologyFormat": return java.lang.String.class;
case "operation": return java.lang.String.class;
case "pathdatadir":
case "pathDataDir": return java.lang.String.class;
case "query": return java.lang.String.class;
Expand Down Expand Up @@ -156,6 +158,7 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
case "newGraph": return target.isNewGraph();
case "ontologyformat":
case "ontologyFormat": return target.getOntologyFormat();
case "operation": return target.getOperation();
case "pathdatadir":
case "pathDataDir": return target.getPathDataDir();
case "query": return target.getQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class GraphEndpointUriFactory extends org.apache.camel.support.component.
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
Set<String> props = new HashSet<>(25);
Set<String> props = new HashSet<>(26);
props.add("allRules");
props.add("baseConfig");
props.add("baseIri");
Expand All @@ -39,6 +39,7 @@ public class GraphEndpointUriFactory extends org.apache.camel.support.component.
props.add("namedGraph");
props.add("newGraph");
props.add("ontologyFormat");
props.add("operation");
props.add("pathDataDir");
props.add("query");
props.add("rdfFormat");
Expand All @@ -64,7 +65,7 @@ public String buildUri(String scheme, Map<String, Object> properties, boolean en

Map<String, Object> copy = new HashMap<>(properties);

uri = buildPathParameter(syntax, uri, "name", null, true, copy);
uri = buildPathParameter(syntax, uri, "name", null, false, copy);
uri = buildQueryParameters(uri, copy, encode);
return uri;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"supportLevel": "Stable",
"groupId": "com.cefriel",
"artifactId": "camel-chimera-graph",
"version": "4.1.1-SNAPSHOT",
"version": "4.1.2-SNAPSHOT",
"scheme": "graph",
"extendsScheme": "",
"syntax": "graph:name",
Expand All @@ -28,7 +28,7 @@
"autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." }
},
"properties": {
"name": { "index": 0, "kind": "path", "displayName": "Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This parameter contains the name of the endpoint" },
"name": { "index": 0, "kind": "path", "displayName": "Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This parameter contains the name of the endpoint" },
"allRules": { "index": 1, "kind": "parameter", "displayName": "All Rules", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Parameter used to set certain InferenceRDFGraph rules" },
"baseConfig": { "index": 2, "kind": "parameter", "displayName": "Base Config", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.cefriel.component.GraphBean", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to set the base configuration of this endpoint" },
"baseIri": { "index": 3, "kind": "parameter", "displayName": "Base Iri", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "http:\/\/www.cefriel.com\/data\/", "description": "Parameter used to set the IRI of the graph you want to create" },
Expand All @@ -41,17 +41,18 @@
"namedGraph": { "index": 10, "kind": "parameter", "displayName": "Named Graph", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Can be used to pass multiple named graphs separated by ';'" },
"newGraph": { "index": 11, "kind": "parameter", "displayName": "New Graph", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Parameter set to true if you want to create a new graph with the result of a construct" },
"ontologyFormat": { "index": 12, "kind": "parameter", "displayName": "Ontology Format", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to express the rdfFormat you want to parse to ontologies" },
"pathDataDir": { "index": 13, "kind": "parameter", "displayName": "Path Data Dir", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a Native RDF Graph or an Inference RDF Graph" },
"query": { "index": 14, "kind": "parameter", "displayName": "Query", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This parameter contains a query that has to be applied to the graph" },
"rdfFormat": { "index": 15, "kind": "parameter", "displayName": "Rdf Format", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This parameter contains the rdfFormat you want to parse a file or an InputStream" },
"repoOff": { "index": 16, "kind": "parameter", "displayName": "Repo Off", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Parameter set to true if you want to shut down the repo" },
"repositoryID": { "index": 17, "kind": "parameter", "displayName": "Repository ID", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a HTTPRDFGraph" },
"routeOff": { "index": 18, "kind": "parameter", "displayName": "Route Off", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Parameter set to true if you want to stop the route" },
"serverUrl": { "index": 19, "kind": "parameter", "displayName": "Server Url", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a HTTPRDFGraph" },
"sparqlEndpoint": { "index": 20, "kind": "parameter", "displayName": "Sparql Endpoint", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a SPARQLEndpointGraph" },
"bridgeErrorHandler": { "index": 21, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"exceptionHandler": { "index": 22, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"exchangePattern": { "index": 23, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
"lazyStartProducer": { "index": 24, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }
"operation": { "index": 13, "kind": "parameter", "displayName": "Operation", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "GET", "ADD", "CONSTRUCT", "ASK", "SELECT", "INFERENCE", "DETACH", "DUMP", "SHACL" ], "deprecated": false, "autowired": false, "secret": false, "description": "Name of the operation to be executed. The name of the operations is not case sensitive." },
"pathDataDir": { "index": 14, "kind": "parameter", "displayName": "Path Data Dir", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a Native RDF Graph or an Inference RDF Graph" },
"query": { "index": 15, "kind": "parameter", "displayName": "Query", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This parameter contains a query that has to be applied to the graph" },
"rdfFormat": { "index": 16, "kind": "parameter", "displayName": "Rdf Format", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This parameter contains the rdfFormat you want to parse a file or an InputStream" },
"repoOff": { "index": 17, "kind": "parameter", "displayName": "Repo Off", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Parameter set to true if you want to shut down the repo" },
"repositoryID": { "index": 18, "kind": "parameter", "displayName": "Repository ID", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a HTTPRDFGraph" },
"routeOff": { "index": 19, "kind": "parameter", "displayName": "Route Off", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Parameter set to true if you want to stop the route" },
"serverUrl": { "index": 20, "kind": "parameter", "displayName": "Server Url", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a HTTPRDFGraph" },
"sparqlEndpoint": { "index": 21, "kind": "parameter", "displayName": "Sparql Endpoint", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Parameter used to create a SPARQLEndpointGraph" },
"bridgeErrorHandler": { "index": 22, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"exceptionHandler": { "index": 23, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"exchangePattern": { "index": 24, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
"lazyStartProducer": { "index": 25, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
public class GraphBean {

private String basePath = "./";

private String operation;

private List<String> resources = new ArrayList<>();
private ChimeraResourceBean chimeraResource;
private String rdfFormat;
Expand Down Expand Up @@ -51,7 +54,7 @@ public GraphBean(String basePath, List<String> resources, String rdfFormat, bool
String ontologyFormat, String namedGraph, String baseIri, boolean defaultGraph, String serverUrl,
String repositoryID, String sparqlEndpoint, String pathDataDir, String query,
boolean newGraph, boolean clear, boolean repoOff, boolean routeOff,
String dumpFormat, String filename) {
String dumpFormat, String filename, String operation) {
this.basePath = basePath;
this.resources = resources;
this.rdfFormat = rdfFormat;
Expand All @@ -71,6 +74,7 @@ public GraphBean(String basePath, List<String> resources, String rdfFormat, bool
this.routeOff = routeOff;
this.dumpFormat = dumpFormat;
this.filename = filename;
this.operation = operation;
}

public GraphBean(GraphBean configuration){
Expand All @@ -93,6 +97,7 @@ public GraphBean(GraphBean configuration){
this.routeOff = configuration.isRouteOff();
this.dumpFormat = configuration.getDumpFormat();
this.filename = configuration.getFilename();
this.operation = configuration.getOperation();
}

public String getBasePath() {
Expand Down Expand Up @@ -255,6 +260,14 @@ public void setChimeraResource(ChimeraResourceBean chimeraResources) {
this.chimeraResource = chimeraResources;
}

public String getOperation() {
return operation;
}

public void setOperation(String operation) {
this.operation = operation;
}

public void setEndpointParameters(GraphEndpoint endpoint){
if(endpoint.getChimeraResource()!=null){
this.setChimeraResource(endpoint.getChimeraResource());
Expand Down Expand Up @@ -308,5 +321,9 @@ public void setEndpointParameters(GraphEndpoint endpoint){
if(endpoint.getBasePath()!=null){
this.setBasePath(endpoint.getBasePath());
}

if(endpoint.getOperation() != null) {
this.setOperation(endpoint.getOperation());
}
}
}
Loading