Parse the output of the Redis ROLE command and convert to a RedisInstance.

@param roleOutput output of the Redis ROLE command.
@return RedisInstance
507188
public static RedisInstance parse(List<?> roleOutput) {
        LettuceAssert.isTrue(roleOutput != null && !roleOutput.isEmpty(), "Empty role output");
        LettuceAssert.isTrue(roleOutput.get(0) instanceof String && ROLE_MAPPING.containsKey(roleOutput.get(0)),
                "First role element must be a string (any of " + ROLE_MAPPING.keySet() + ")");

        RedisInstance.Role role = ROLE_MAPPING.get(roleOutput.get(0));

        switch (role) {
            case MASTER:
                return parseMaster(roleOutput);

            case SLAVE:
                return parseReplica(roleOutput);

            case SENTINEL:
                return parseSentinel(roleOutput);
        }

        return null;

    }
1170068
public JsCodeBuilder setOutputVarInited() {
    outputVars.pop();
    outputVars.push(new OutputVar(currOutputVar, /* initialized= */ true));
    currOutputVarIsInited = true;
    return this;
  }
303649
public Processor setOutputDir(final URI output) {
        if (!output.isAbsolute()) {
            throw new IllegalArgumentException("Output directory URI must be absolute: " + output);
        }
        if (!output.getScheme().equals("file")) {
            throw new IllegalArgumentException("Only file scheme allowed as output directory URI: " + output);
        }
        args.put("output.dir", output.toString());
        return this;
    }
1228213
@Override
    protected void outputPass() {
        if(!prototype.isOutputSupported())
            return;

        // take a snapshot of the current container state.
        final LinkedList<Object> toOutput = new LinkedList<Object>(instances.keySet());

        final Executor executorService = getOutputExecutorService();
        final Semaphore taskLock = (executorService != null) ? new Semaphore(outputConcurrency) : null;

        // This keeps track of the number of concurrently running
        // output tasks so that this method can wait until they're
        // all done to return.
        //
        // It's also used as a condition variable signaling on its
        // own state changes.
        final AtomicLong numExecutingOutputs = new AtomicLong(0);

        final MutRef<WorkingQueueHolder> mref = new MutRef<>();

        // keep going until all of the outputs have been invoked
        while(toOutput.size() > 0 && isRunning.get()) {
            for(final Iterator<Object> iter = toOutput.iterator(); iter.hasNext();) {
                final Object key = iter.next();

                final InstanceWrapper wrapper = instances.get(key);

                if(wrapper != null) { // if the MP still exists
                    final WorkingQueueHolder mailbox = setIfAbsent(wrapper.mailbox, () -> mref.set(new WorkingQueueHolder(true)));
                    if(mailbox == null) { // this means I got it.
                        // it was created locked so no one else will be able to drop messages in the mailbox.
                        final Semaphore taskSepaphore = taskLock;

                        // This task will release the wrapper's lock.
                        final Runnable task = new Runnable() {

                            @Override
                            public void run() {
                                try {
                                    if(isRunning.get())
                                        invokeOperation(wrapper.instance, Operation.output, null);
                                } finally {
                                    wrapper.mailbox.set(null); // releases this back to the world

                                    // this signals that we're done.
                                    synchronized(numExecutingOutputs) {
                                        numExecutingOutputs.decrementAndGet();
                                        numExecutingOutputs.notifyAll();
                                    }
                                    if(taskSepaphore != null)
                                        taskSepaphore.release();
                                }
                            }
                        };

                        synchronized(numExecutingOutputs) {
                            numExecutingOutputs.incrementAndGet();
                        }

                        if(executorService != null) {
                            try {
                                taskSepaphore.acquire();
                                executorService.execute(task);
                            } catch(final RejectedExecutionException e) {
                                wrapper.mailbox.set(null); // we never got into the run so we need to release the lock
                                // this may happen because of a race condition between the
                                taskSepaphore.release();
                            } catch(final InterruptedException e) {
                                // this can happen while blocked in the semaphore.acquire.
                                // if we're no longer running we should just get out
                                // of here.
                                //
                                // Not releasing the taskSepaphore assumes the acquire never executed.
                                // if (since) the acquire never executed we also need to release the
                                // wrapper lock or that Mp will never be usable again.
                                wrapper.mailbox.set(null); // we never got into the run so we need to release the lock
                            }
                        } else
                            task.run();

                        iter.remove();

                    } // didn't get the lock
                } else { // end if mp exists. Otherwise the mp is already gone.
                    iter.remove();
                    LOGGER.warn("There was an attempt to output a non-existent Mp for key " + SafeString.objectDescription(key));
                }
            } // loop over every mp
        } // end while there are still Mps that haven't had output invoked.

        // =======================================================
        // now make sure all of the running tasks have completed
        synchronized(numExecutingOutputs) {
            while(numExecutingOutputs.get() > 0) {
                try {
                    numExecutingOutputs.wait();
                } catch(final InterruptedException e) {
                    // if we were interupted for a shutdown then just stop
                    // waiting for all of the threads to finish
                    if(!isRunning.get())
                        break;
                    // otherwise continue checking.
                }
            }
        }
        // =======================================================
    }
787021
public <S, L> MapReduceOutput<S, L> mapReduce(MapReduce.MapReduceCommand<S, L> command) throws MongoException {
        return new MapReduceOutput<S, L>(this, dbCollection.mapReduce(command.build(this)), command.getResultType(),
                command.getKeyType());
    }
518201
public synchronized Object removeRoleMapping(final String roleName) {
        /*
         * Would not expect this to happen during boot so don't offer the 'immediate' optimisation.
         */
        HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
        if (newRoles.containsKey(roleName)) {
            RoleMappingImpl removed = newRoles.remove(roleName);
            Object removalKey = new Object();
            removedRoles.put(removalKey, removed);
            roleMappings = Collections.unmodifiableMap(newRoles);

            return removalKey;
        }

        return null;
    }
101443
public String textOutput(SpatialReferenceSystem srs) {
		StringBuilder output = new StringBuilder();
		output.append("\tSRS " + SpatialReferenceSystem.COLUMN_ORGANIZATION
				+ ": " + srs.getOrganization());
		output.append("\n\tSRS "
				+ SpatialReferenceSystem.COLUMN_ORGANIZATION_COORDSYS_ID + ": "
				+ srs.getOrganizationCoordsysId());
		output.append("\n\tSRS " + SpatialReferenceSystem.COLUMN_DEFINITION
				+ ": " + srs.getDefinition());
		return output.toString();
	}
79822
public Map<String, String> getRoleMap() {
        if (mapAllMethods != null) {
            return getRoleMapFromAllMap();
        }
        Map<String, List<String>> outputRTMNormal = null;
        Map<String, List<String>> outputRTMOmission = null;

        if (mapMethod != null) {
            outputRTMNormal = getRoleToMethodMap(getMethod(mapMethod, ROLE, true));
            if (tc.isDebugEnabled())
                Tr.debug(tc, "outputRTMNormal: " + outputRTMNormal);
        }
        if (mapMethodOmission != null) {
            // it genereate output only following condition:
            // 1.role is assigned.
            // 2.neither unchecked or excluded.
            Map<String, MethodConstraint> omissionRole = getMethod(mapMethodOmission, ROLE_NO_CHECK, true);
            Map<String, MethodConstraint> validRole = getMethod(mapMethodOmission, EXCLUDED_OR_UNCHECKED_NO_ROLE, true);
            Map<String, MethodConstraint> uncheckedOrExcluded = getMethod(mapMethodOmission, EXCLUDED_OR_UNCHECKED, true);

            if (tc.isDebugEnabled())
                Tr.debug(tc, "omissionRole: " + omissionRole + " validRole : " + validRole + " uncheckedOrExcluded : " + uncheckedOrExcluded);
            if (omissionRole != null && ((uncheckedOrExcluded != null && validRole != null) || uncheckedOrExcluded == null)) {
                outputRTMOmission = getRoleToMethodMap(omissionRole);
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "outputRTMOmission: " + outputRTMOmission);
            }
        }

        // now merge both tables and generate method strings.
        Map<String, String> output = mergeRTM(outputRTMNormal, outputRTMOmission);
        if (tc.isDebugEnabled())
            Tr.debug(tc, "getRoleMap: output: " + output);
        return output;
    }
55408
public void setOutputDirectory( String outputDirectory ) {

		// Update the configuration
		this.logger.fine( "Output directory is now... " + outputDirectory );
		this.outputDIR = Utils.isEmptyOrWhitespaces( outputDirectory ) ? null : new File( outputDirectory );

		// Generate the files
		if( this.outputDIR != null && this.dm != null ) {
			for( ManagedApplication ma : this.dm.applicationMngr().getManagedApplications())
				application( ma.getApplication(), EventType.CHANGED );
		}
	}


	/**
	 * Binds the DM.
	 * @param dm
	 */
	public void bindManager( Manager dm ) {

		synchronized( this.generationLock ) {
			this.logger.fine( "The DM is now available in the templating manager." );
			this.dm = dm;
		}
	}


	/**
	 * Unbinds the DM.
	 * @param dm
	 */
	public void unbindManager( Manager dm ) {

		synchronized( this.generationLock ) {
			this.logger.fine( "The DM is NOT available anymore in the templating manager." );
			this.dm = null;
		}
	}


	// iPojo life cycle


	/**
	 * Starts the templating manager (invoked by iPojo).
	 */
	public void start() {

		synchronized( this.watcherLock ) {
			this.logger.config( "The templating manager is starting..." );
			resetWatcher();
		}
	}


	/**
	 * Stops the templating manager (invoked by iPojo).
	 */
	public void stop() {

		synchronized( this.watcherLock ) {
			this.logger.config( "The templating manager is stopping..." );
			stopWatcher();
		}
	}


	// Inherited methods


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener#getId()
	 */
	@Override
	public String getId() {
		return ID;
	}


	/* (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #application(net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType)
	 */
	@Override
	public void application( Application application, EventType eventType ) {

		if( this.outputDIR == null ) {
			this.logger.warning( "Generation from templates is skipped. Invalid output directory." );

		} else if( eventType == EventType.DELETED ) {
			synchronized( this.generationLock ) {
				TemplateUtils.deleteGeneratedFiles( application, this.outputDIR );
			}

		} else {
			generate( application );
		}
	}


	/* (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #applicationTemplate(net.roboconf.core.model.beans.ApplicationTemplate, net.roboconf.dm.management.events.EventType)
	 */
	@Override
	public void applicationTemplate( ApplicationTemplate tpl, EventType eventType ) {
		// nothing
	}


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #instance(net.roboconf.core.model.beans.Instance, net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType)
	 */
	@Override
	public void instance( Instance instance, Application application, EventType eventType ) {
		application( application, EventType.CHANGED );
	}


	/* (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #raw(java.lang.String, java.lang.Object[])
	 */
	@Override
	public void raw( String message, Object... data ) {
		// nothing
	}


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #enableNotifications()
	 */
	@Override
	public void enableNotifications() {
		// nothing
	}


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #disableNotifications()
	 */
	@Override
	public void disableNotifications() {
		// nothing
	}
97287
public static Path getOutputPath(JobConf conf) {
    String name = conf.get("mapred.output.dir");
    return name == null ? null: new Path(name);
  }
1341911
public java.util.Map<String, java.util.List<String>> getOutputs() {
        return outputs;
    }
780427
public JsCodeBuilder popOutputVar() {
    outputVars.pop();
    OutputVar top = outputVars.peek();  // null if outputVars is now empty
    if (top != null) {
      currOutputVar = top.name;
      currOutputVarIsInited = top.initialized;
    } else {
      currOutputVar = null;
      currOutputVarIsInited = false;
    }
    return this;
  }
58050
public T handle(List<QueryParameters> output) {
        T result = null;
        String parameterName = null;
        Object parameterValue = null;

        if (output.size() > 1) {
            if (this.columnName == null) {
                parameterName = output.get(1).getNameByPosition(columnIndex);
                parameterValue = output.get(1).getValue(parameterName);

                result = (T) parameterValue;
            } else {
                parameterValue = output.get(1).getValue(this.columnName);

                result = (T) parameterValue;
            }
        }

        return result;
    }
858226
@Override
	public String[] getUsersInRole(String role) {
		if (role_list.containsKey(role)) {
			return role_list.get(role).toArray(new String[0]);
		} else {
			return new String[0];
		}
	}
1020936
public ManagementGate getOutputGate(final int index) {

		if (index < this.outputGates.size()) {
			return this.outputGates.get(index);
		}

		return null;
	}
119402
def transform_aglistener_output(result):
    '''
    
    '''
    from collections import OrderedDict
    from msrestazure.tools import parse_resource_id
    try:
        resource_group = getattr(result, 'resource_group', None) or parse_resource_id(result.id)['resource_group']
        # Create a dictionary with the relevant parameters
        output = OrderedDict([('id', result.id),
                              ('name', result.name),
                              ('provisioningState', result.provisioning_state),
                              ('port', result.port),
                              ('resourceGroup', resource_group)])

        # Note, wsfcDomainCredentials will not display
        if result.load_balancer_configurations is not None:
            output['loadBalancerConfigurations'] = format_load_balancer_configuration_list(result.load_balancer_configurations)

        return output
    except AttributeError:
        # Return the response object if the formating fails
        return result
1199801
private JsonNode parseProcessOutput(String processOutput) {
        JsonNode credentialsJson = Jackson.jsonNodeOf(processOutput);

        if (!credentialsJson.isObject()) {
            throw new IllegalStateException("Process did not return a JSON object.");
        }

        JsonNode version = credentialsJson.get("Version");
        if (version == null || !version.isInt() || version.asInt() != 1) {
            throw new IllegalStateException("Unsupported credential version: " + version);
        }
        return credentialsJson;
    }