List of usage examples for com.google.common.collect Iterables toString
public static String toString(Iterable<?> iterable)
From source file:edu.umn.msi.tropix.persistence.dao.hibernate.TropixObjectDaoImpl.java
public TropixObject getHomeDirectoryPath(final String userId, final List<String> pathParts) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("getPath called with userId %s and path parts %s", userId, Iterables.toString(pathParts))); }// w w w. jav a 2 s . c o m final StringBuilder joins = new StringBuilder(), wheres = new StringBuilder(); final ListIterator<String> pathPartsIter = pathParts.listIterator(pathParts.size()); final LinkedList<String> parameters = Lists.newLinkedList(); while (pathPartsIter.hasPrevious()) { int index = pathPartsIter.previousIndex() + 1; final String pathPart = pathPartsIter.previous(); int nextObjectBackIndex = pathPartsIter.previousIndex() + 1; joins.append(String.format(" inner join o%d.permissionParents as o%d ", index, nextObjectBackIndex)); wheres.append(String.format(" and o%d.deletedTime is null", index)); wheres.append(String.format(" and o%d.committed is true", index)); addConstraintForPathPart(pathPart, index, wheres, parameters); } final String queryString = String.format( "User u, TropixObject o%d %s where u.cagridId = :userId %s and u.homeFolder.id = o0.id", pathParts.size(), joins.toString(), wheres.toString()); return executePathQuery(userId, String.format("o%d", pathParts.size()), queryString, 1, parameters); }
From source file:com.google.devtools.build.lib.rules.objc.ObjcCommon.java
static Iterable<String> notInContainerErrors(Iterable<Artifact> artifacts, Iterable<FileType> containerTypes) { Set<String> errors = new HashSet<>(); for (Artifact artifact : artifacts) { boolean inContainer = nearestContainerMatching(containerTypes, artifact).isPresent(); if (!inContainer) { errors.add(String.format(NOT_IN_CONTAINER_ERROR_FORMAT, artifact.getExecPath(), Iterables.toString(containerTypes))); }/*from w w w . j av a2 s. c om*/ } return errors; }
From source file:clocker.docker.entity.DockerHostImpl.java
@Override public void preStop() { if (scan != null && scan.isActivated()) scan.stop();/* ww w. j a v a 2 s . c o m*/ super.preStop(); deleteLocation(); // Stop all Docker containers in parallel try { Group containers = getDockerContainerCluster(); // TODO filter out SDN containers LOG.debug("Stopping containers: {}", Iterables.toString(containers.getMembers())); Entities.invokeEffectorList(this, containers.getMembers(), Startable.STOP).get(Duration.ONE_MINUTE); } catch (Exception e) { LOG.warn("Error stopping containers", e); } EtcdNode etcd = sensors().get(ETCD_NODE); DockerUtils.stop(getInfrastructure(), etcd, Duration.THIRTY_SECONDS); }
From source file:org.jclouds.vcloud.director.v1_5.domain.Checks.java
public static void checkLdapSettings(OrgLdapSettings settings) { // Check optional fields // NOTE customUsersOu cannot be checked if (settings.getLdapMode() != null) { assertTrue(LdapMode.ALL.contains(settings.getLdapMode()), String.format(REQUIRED_VALUE_OBJECT_FMT, "LdapMode", "OrgLdapSettings", settings.getLdapMode(), Iterables.toString(OrgLdapSettings.LdapMode.ALL))); }//from w w w .j a v a 2 s . c om if (settings.getCustomOrgLdapSettings() != null) { checkCustomOrgLdapSettings(settings.getCustomOrgLdapSettings()); } // parent type checkResource(settings); }
From source file:org.jclouds.vcloud.director.v1_5.domain.Checks.java
public static void checkCustomOrgLdapSettings(CustomOrgLdapSettings settings) { // required//from w ww .j av a2 s . co m assertNotNull(settings.getHostName(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "hostName")); assertNotNull(settings.getPort(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "port")); assertTrue(settings.getPort() >= 0, String.format(OBJ_FIELD_GTE_0, "CustomOrgLdapSettings", "port", settings.getPort())); assertNotNull(settings.getAuthenticationMechanism(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "authenticationMechanism")); assertTrue(AuthenticationMechanism.ALL.contains(settings.getAuthenticationMechanism()), String.format(REQUIRED_VALUE_OBJECT_FMT, "AuthenticationMechanism", "CustomOrdLdapSettings", settings.getAuthenticationMechanism(), Iterables.toString(CustomOrgLdapSettings.AuthenticationMechanism.ALL))); assertNotNull(settings.isGroupSearchBaseEnabled(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "isGroupSearchBaseEnabled")); assertNotNull(settings.getConnectorType(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "connectorType")); assertTrue(ConnectorType.ALL.contains(settings.getConnectorType()), String.format(REQUIRED_VALUE_OBJECT_FMT, "ConnectorType", "CustomOrdLdapSettings", settings.getConnectorType(), Iterables.toString(CustomOrgLdapSettings.ConnectorType.ALL))); assertNotNull(settings.getUserAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "userAttributes")); checkUserAttributes("CustomOrdLdapSettings", settings.getUserAttributes()); assertNotNull(settings.getGroupAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "groupAttributes")); checkGroupAttributes("CustomOrdLdapSettings", settings.getGroupAttributes()); // optional // NOTE isSsl cannot be checked // NOTE isSSlAcceptAll cannot be checked // NOTE realm cannot be checked // NOTE searchBase cannot be checked // NOTE userName cannot be checked // NOTE password cannot be checked // NOTE groupSearchBase cannot be checked }
From source file:org.jclouds.vcloud.director.v1_5.domain.Checks.java
private static void checkNetworkConnection(NetworkConnection val) { assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "NetworkConnection")); // Check required fields assertNotNull(val.getNetwork(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Network", "NetworkConnection")); assertNotNull(val.getIpAddressAllocationMode(), String.format(NOT_NULL_OBJ_FIELD_FMT, "IpAddressAllocationMode", "NetworkConnection")); assertNotEquals(val.getIpAddressAllocationMode(), NetworkConnection.IpAddressAllocationMode.UNRECOGNIZED, String.format(REQUIRED_VALUE_OBJECT_FMT, "IpAddressAllocationMode", "NetworkConnection", val.getIpAddressAllocationMode(), Iterables.toString(NetworkConnection.IpAddressAllocationMode.ALL))); // Check optional fields if (val.getIpAddress() != null) { checkIpAddress(val.getIpAddress()); }/*from w ww. j av a 2 s. c o m*/ if (val.getExternalIpAddress() != null) { checkIpAddress(val.getExternalIpAddress()); } if (val.getMACAddress() != null) { checkMacAddress(val.getMACAddress()); } }