
com.threatconnect.sdk.client.writer.ExchangeWriterAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk Show documentation
Show all versions of java-sdk Show documentation
The ThreatConnect Java SDK. Used to communicate with teh ThreatConnect Threat Intelligence Platform
The newest version!
package com.threatconnect.sdk.client.writer;
import com.threatconnect.sdk.conn.Connection;
import com.threatconnect.sdk.exception.FailedResponseException;
import com.threatconnect.sdk.server.entity.SpaceState;
import com.threatconnect.sdk.server.response.entity.SpaceStateResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by dtineo on 9/12/15.
*/
public class ExchangeWriterAdapter extends AbstractWriterAdapter
{
public ExchangeWriterAdapter(Connection conn)
{
super(conn);
}
/*
public void uploadSpacesFile(int spaceId, String fileName, Path inputPath) throws FailedResponseException
{
uploadSpacesFile(spaceId, fileName, null, inputPath);
}
public void uploadSpacesFile(int spaceId, String fileName, String ownerName, Path inputPath) throws FailedResponseException
{
Map paramMap = new HashMap<>();
paramMap.put("id", spaceId);
paramMap.put("fileName", fileName);
try (InputStream in = uploadFile("v2.spaces.file", SpaceStateResponse.class, ownerName, paramMap))
{
Files.copy(in, inputPath, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e)
{
e.printStackTrace();
throw new FailedResponseException("Failed to download file");
}
}
*/
public SpaceState saveSpaceState(SpaceState spaceState, String ownerName) throws IOException, FailedResponseException {
Map paramMap = new HashMap<>();
paramMap.put("id", spaceState.getSpaceId());
SpaceStateResponse data = createItem("v2.spaces.state", SpaceStateResponse.class, ownerName, paramMap, spaceState);
return (SpaceState) data.getData().getData();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy