use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.
the class GetProxyPropertiesHandler method doOperation.
/**
* This implementation could work with with any store and properties but gets ONLY the Proxy Properties value from the Proxy store.
*
* @param operation the {@link GetProxyProperties} to be executed
* @param context the operation chain context, containing the user who executed the operation
* @param store the {@link Store} the operation should be run on
* @return the proxy specific properties only.
* @throws OperationException Error making return string map
*/
@Override
public Map<String, Object> doOperation(final GetProxyProperties operation, final Context context, final Store store) throws OperationException {
try {
ProxyProperties properties = new ProxyProperties(store.getProperties().getProperties());
HashMap<String, Object> rtn = new HashMap<>();
rtn.put(GAFFER_CONTEXT_ROOT, properties.getGafferContextRoot());
rtn.put(GAFFER_HOST, properties.getGafferHost());
rtn.put(GAFFER_PORT, String.valueOf(properties.getGafferPort()));
rtn.put(CONNECT_TIMEOUT, String.valueOf(properties.getConnectTimeout()));
rtn.put(READ_TIMEOUT, String.valueOf(properties.getReadTimeout()));
rtn.put(URL_INFERRED, properties.getGafferUrl().toString());
return rtn;
} catch (final Exception e) {
throw new OperationException("Error making return string map", e);
}
}
use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.
the class DoubleProxyTest method setUpStores.
@BeforeEach
public void setUpStores() throws OperationException {
SingleUseProxyMapStore.cleanUp();
ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setStoreClass(SingleUseProxyMapStore.class);
// this direct Proxy to the RestMapStore can be ignored, unless adding elements is desired.
Graph ignore = new Graph.Builder().storeProperties(proxyProperties).config(new GraphConfig("RestApiGraph")).addSchema(Schema.fromJson(getClass().getResourceAsStream("/schema/basicEntitySchema.json"))).build();
federatedStoreGraph = new Graph.Builder().config(new GraphConfig("federatedStoreGraph")).storeProperties(new FederatedStoreProperties()).build();
connectGraphs("RestProxy1");
connectGraphs("RestProxy2");
}
use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.
the class FederatedStoreToFederatedStoreTest method setUpStores.
@BeforeEach
public void setUpStores() throws OperationException {
SingleUseFederatedStore.cleanUp();
ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setStoreClass(SingleUseFederatedStore.class);
restApiFederatedGraph = new Graph.Builder().storeProperties(proxyProperties).config(new GraphConfig("RestApiGraph")).addSchema(new Schema()).build();
federatedStoreGraph = new Graph.Builder().config(new GraphConfig("federatedStoreGraph")).storeProperties(new FederatedStoreProperties()).build();
connectGraphs();
addMapStore();
}
use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.
the class FederatedStoreRecursionIT method createInnerProxyToOuterFederatedStore.
protected void createInnerProxyToOuterFederatedStore() throws OperationException {
ProxyProperties storeProperties = new ProxyProperties();
storeProperties.setReadTimeout(120000);
storeProperties.setConnectTimeout(120000);
proxyToRestServiceFederatedGraph.execute(new FederatedOperationChain.Builder<>().operationChain(OperationChain.wrap(new AddGraph.Builder().graphId(INNER_PROXY).schema(new Schema()).storeProperties(storeProperties).build())).build(), user);
}
use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project gaffer-doc by gchq.
the class ExportToOtherGraphExample method simpleToOtherGafferRestApi.
public void simpleToOtherGafferRestApi() {
// ---------------------------------------------------------
final ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setStoreClass(ProxyStore.class);
proxyProperties.setStorePropertiesClass(ProxyProperties.class);
proxyProperties.setGafferHost("localhost");
proxyProperties.setGafferPort(8081);
proxyProperties.setGafferContextRoot("/rest/v1");
final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder().first(new GetAllElements.Builder().view(new View.Builder().edge("edge").build()).build()).then(new ExportToOtherGraph.Builder().graphId("otherGafferRestApiGraphId").storeProperties(proxyProperties).build()).build();
// ---------------------------------------------------------
showExample(opChain, "This example will export all Edges with group 'edge' to another Gaffer REST API." + "To export to another Gaffer REST API, we go via a Gaffer Proxy Store. We just need to tell the proxy store the host, port and context root of the REST API." + "Note that you will need to include the proxy-store module as a maven dependency to do this.");
}
Aggregations