private void addVolumesFrom(Container container, BindMode mode) { volumesFroms.add(new VolumesFrom(container.getContainerName(), mode.accessMode)); }
@Override public VolumesFrom deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return VolumesFrom.parse(node.asText()); } }
@Override public boolean equals(Object obj) { if (obj instanceof VolumesFrom) { VolumesFrom other = (VolumesFrom) obj; return new EqualsBuilder().append(container, other.getContainer()) .append(accessMode, other.getAccessMode()).isEquals(); } else { return super.equals(obj); } }
@Override public void serialize(VolumesFrom volumeFrom, JsonGenerator jsonGen, SerializerProvider serProvider) throws IOException, JsonProcessingException { jsonGen.writeString(volumeFrom.toString()); }
@Override public void serialize(VolumesFrom volumeFrom, JsonGenerator jsonGen, SerializerProvider serProvider) throws IOException, JsonProcessingException { jsonGen.writeString(volumeFrom.toString()); }
/** * Parses a volume from specification to a {@link VolumesFrom}. * * @param serialized * the specification, e.g. <code>container:ro</code> * @return a {@link VolumesFrom} matching the specification * @throws IllegalArgumentException * if the specification cannot be parsed */ public static VolumesFrom parse(String serialized) { try { String[] parts = serialized.split(":"); switch (parts.length) { case 1: { return new VolumesFrom(parts[0]); } case 2: { return new VolumesFrom(parts[0], AccessMode.valueOf(parts[1])); } default: { throw new IllegalArgumentException(); } } } catch (Exception e) { throw new IllegalArgumentException("Error parsing Bind '" + serialized + "'"); } }
private static final VolumesFrom[] toVolumesFrom(Collection<String> volumesFromList) { VolumesFrom[] volumesFrom = new VolumesFrom[volumesFromList.size()]; int i = 0; for (String volumesFromm : volumesFromList) { volumesFrom[i] = VolumesFrom.parse(volumesFromm); i++; } return volumesFrom; }
@Override public boolean equals(Object obj) { if (obj instanceof VolumesFrom) { VolumesFrom other = (VolumesFrom) obj; return new EqualsBuilder().append(container, other.getContainer()) .append(accessMode, other.getAccessMode()).isEquals(); } else { return super.equals(obj); } }
private void addVolumesFrom(Container container, BindMode mode) { volumesFroms.add(new VolumesFrom(container.getContainerName(), mode.accessMode)); }
private static final VolumesFrom[] toVolumesFrom(Collection<String> volumesFromList) { VolumesFrom[] volumesFrom = new VolumesFrom[volumesFromList.size()]; int i = 0; for (String volumesFromm : volumesFromList) { volumesFrom[i] = VolumesFrom.parse(volumesFromm); i++; } return volumesFrom; }
/** * Parses a volume from specification to a {@link VolumesFrom}. * * @param serialized * the specification, e.g. <code>container:ro</code> * @return a {@link VolumesFrom} matching the specification * @throws IllegalArgumentException * if the specification cannot be parsed */ public static VolumesFrom parse(String serialized) { try { String[] parts = serialized.split(":"); switch (parts.length) { case 1: { return new VolumesFrom(parts[0]); } case 2: { return new VolumesFrom(parts[0], AccessMode.valueOf(parts[1])); } default: { throw new IllegalArgumentException(); } } } catch (Exception e) { throw new IllegalArgumentException("Error parsing Bind '" + serialized + "'"); } }
@Override public VolumesFrom deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return VolumesFrom.parse(node.asText()); } }
private VolumesFrom[] volumesFrom(Id id) { final List<com.alexecollins.docker.orchestration.model.VolumeFrom> volumes = conf(id).getVolumesFrom(); final VolumesFrom[] out = new VolumesFrom[volumes.size()]; for (int i = 0; i < volumes.size(); i++) { com.alexecollins.docker.orchestration.model.VolumeFrom volume = volumes.get(i); final Container container = findContainer(volume.getId()); if (container == null) { throw new OrchestrationException(String.format( "Can not use volume %s, unable to find corresponding container.", volume.getId())); } final AccessMode accessMode = AccessMode.fromBoolean(volume.isReadWrite()); out[i] = new VolumesFrom(volume.getId().toString(), accessMode); } return out; }
public FormValidation doCheckVolumesFromString(@QueryParameter String volumesFromString) { try { final String[] strings = splitAndFilterEmpty(volumesFromString, "\n"); for (String volFrom : strings) { VolumesFrom.parse(volFrom); } } catch (Throwable t) { return FormValidation.error(t.getMessage()); } return FormValidation.ok(); }
ArrayList<VolumesFrom> volFrom = new ArrayList<>(); for (String volFromStr : getVolumesFrom2()) { volFrom.add(new VolumesFrom(volFromStr));
createContainerCmd.withVolumesFrom(new VolumesFrom(getContainerId()));
createContainerCmd.withVolumesFrom(new VolumesFrom(getContainerId()));
createContainerCmd.withVolumesFrom(new VolumesFrom(dockerClient.getContainerId())); } else { String testFilesPath = KurentoTest.getTestFilesDiskPath();
createContainerCmd.withVolumesFrom(new VolumesFrom(dockerClient.getContainerId())); } else { String testFilesPath = KurentoTest.getTestFilesDiskPath();