use of javax.ws.rs.core.MultivaluedMap in project cloudstack by apache.
the class MidoNetElement method getGuestNetworkRouter.
private Router getGuestNetworkRouter(long id, String accountUuid, boolean isVpc) {
MultivaluedMap qNetRouter = new MultivaluedMapImpl();
String routerName = getRouterName(isVpc, id);
qNetRouter.add("tenant_id", accountUuid);
for (Router router : api.getRouters(qNetRouter)) {
if (router.getName().equals(routerName)) {
return router;
}
}
return null;
}
use of javax.ws.rs.core.MultivaluedMap in project cloudstack by apache.
the class MidoNetElement method getNetworkBridge.
private Bridge getNetworkBridge(long networkID, String accountUuid) {
MultivaluedMap qNetBridge = new MultivaluedMapImpl();
String networkUUIDStr = String.valueOf(networkID);
qNetBridge.add("tenant_id", accountUuid);
for (Bridge b : this.api.getBridges(qNetBridge)) {
if (b.getName().equals(networkUUIDStr)) {
return b;
}
}
return null;
}
use of javax.ws.rs.core.MultivaluedMap in project cloudstack by apache.
the class MidoNetVifDriver method plug.
@Override
public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter) throws InternalErrorException, LibvirtException {
if (s_logger.isDebugEnabled()) {
s_logger.debug("nic=" + nic);
}
LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
String trafficLabel = nic.getName();
if (nic.getBroadcastType() == Networks.BroadcastDomainType.Mido && (nic.getType() == Networks.TrafficType.Guest || nic.getType() == Networks.TrafficType.Public)) {
/*
* create the tap.
*/
String tapName = addTap();
/*
* grab the tenant id and the network id from the Broadcast URI.
* We need to pluck the values out of the String. The string
* should look like "mido://[tenant_id].[bridge_name]"
*/
MultivaluedMap qNet = new MultivaluedMapImpl();
String nicAuthority = nic.getBroadcastUri().getAuthority();
String tenantId = nicAuthority.split("\\.")[0];
qNet.add("tenant_id", tenantId);
String url = nicAuthority.split("\\.")[1];
String netName = url.split(":")[0];
MidonetApi api = new MidonetApi(_midoApiLocation);
api.enableLogging();
for (Bridge b : api.getBridges(qNet)) {
if (b.getName().equals(netName)) {
for (BridgePort p : b.getPorts()) {
UUID pvif = p.getVifId();
if (pvif != null && p.getVifId().toString().equals(nic.getUuid())) {
getMyHost(api).addHostInterfacePort().interfaceName(tapName).portId(p.getId()).create();
break;
}
}
}
}
intf.defEthernet(tapName, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), "");
} else {
throw new InternalErrorException("Only NICs of BroadcastDomain type Mido are supported by the MidoNetVifDriver");
}
return intf;
}
use of javax.ws.rs.core.MultivaluedMap in project ddf by codice.
the class TestGetRecordsMessageBodyReader method testConfigurationArguments.
@Test
public void testConfigurationArguments() throws Exception {
CswSourceConfiguration config = new CswSourceConfiguration(encryptionService);
config.setMetacardCswMappings(DefaultCswRecordMap.getCswToMetacardAttributeNames());
config.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
config.setCswAxisOrder(CswAxisOrder.LAT_LON);
config.putMetacardCswMapping(Core.THUMBNAIL, CswConstants.CSW_REFERENCES);
config.putMetacardCswMapping(Core.RESOURCE_URI, CswConstants.CSW_SOURCE);
GetRecordsMessageBodyReader reader = new GetRecordsMessageBodyReader(mockProvider, config);
InputStream is = TestGetRecordsMessageBodyReader.class.getResourceAsStream("/getRecordsResponse.xml");
MultivaluedMap<String, String> httpHeaders = new MultivaluedHashMap<>();
ArgumentCaptor<UnmarshallingContext> captor = ArgumentCaptor.forClass(UnmarshallingContext.class);
reader.readFrom(CswRecordCollection.class, null, null, null, httpHeaders, is);
// Verify the context arguments were set correctly
verify(mockProvider, times(1)).unmarshal(any(HierarchicalStreamReader.class), captor.capture());
UnmarshallingContext context = captor.getValue();
// Assert the properties needed for CswRecordConverter
assertThat(context.get(CswConstants.CSW_MAPPING), notNullValue());
Object cswMapping = context.get(CswConstants.CSW_MAPPING);
assertThat(cswMapping, instanceOf(Map.class));
assertThat(context.get(Core.RESOURCE_URI), instanceOf(String.class));
assertThat(context.get(Core.RESOURCE_URI), is(CswConstants.CSW_SOURCE));
assertThat(context.get(Core.THUMBNAIL), instanceOf(String.class));
assertThat(context.get(Core.THUMBNAIL), is(CswConstants.CSW_REFERENCES));
assertThat(context.get(CswConstants.AXIS_ORDER_PROPERTY), instanceOf(CswAxisOrder.class));
assertThat(context.get(CswConstants.AXIS_ORDER_PROPERTY), is(CswAxisOrder.LAT_LON));
// Assert the output Schema is set.
assertThat(context.get(CswConstants.OUTPUT_SCHEMA_PARAMETER), instanceOf(String.class));
assertThat(context.get(CswConstants.OUTPUT_SCHEMA_PARAMETER), is(CswConstants.CSW_OUTPUT_SCHEMA));
assertThat(context.get(CswConstants.TRANSFORMER_LOOKUP_KEY), instanceOf(String.class));
assertThat(context.get(CswConstants.TRANSFORMER_LOOKUP_KEY), is(TransformerManager.SCHEMA));
assertThat(context.get(CswConstants.TRANSFORMER_LOOKUP_VALUE), instanceOf(String.class));
assertThat(context.get(CswConstants.TRANSFORMER_LOOKUP_VALUE), is(CswConstants.CSW_OUTPUT_SCHEMA));
}
use of javax.ws.rs.core.MultivaluedMap in project tika by apache.
the class TarWriter method writeTo.
public void writeTo(Map<String, byte[]> parts, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
TarArchiveOutputStream zip = new TarArchiveOutputStream(entityStream);
for (Map.Entry<String, byte[]> entry : parts.entrySet()) {
tarStoreBuffer(zip, entry.getKey(), entry.getValue());
}
zip.close();
}
Aggregations