List of usage examples for com.google.common.base Predicates or
public static <T> Predicate<T> or(Predicate<? super T> first, Predicate<? super T> second)
From source file:org.restexpress.route.RouteBuilder.java
/** * Attempts to find the actionName on the controller. * //from w w w .ja va 2 s .c o m * Assuming a signature of actionName(Request, Response), * actionName(Request), actionName(Response) or actionName(), and returns * the action as a Method to be used later when the route is invoked. * * * * @param controller * a pojo that implements a method named by the action, with * Request and Response as parameters. * @param actionName * the name of a method on the given controller pojo. * @return a Method instance referring to the action on the controller. * @throws ConfigurationException * if an error occurs. */ @SuppressWarnings("unchecked") private Method determineActionMethod(final Object controller, final String actionName) { try { Set<Method> methods = getAllMethods(controller.getClass(), Predicates.and(withName(actionName), withParameters(Request.class, Response.class), withParametersCount(2))); if (methods.size() == 1) { return methods.iterator().next(); } methods = getAllMethods(controller.getClass(), Predicates.and(withName(actionName), withParametersCount(1), // Predicates.or(withParameters(Request.class), withParameters(Response.class)))); if (methods.size() == 1) { return methods.iterator().next(); } methods = getAllMethods(controller.getClass(), Predicates.and(withName(actionName), withParametersCount(0))); if (methods.size() == 1) { return methods.iterator().next(); } throw new ConfigurationException( String.format("Method %s(Request request, Response response) NOT FOUND", actionName)); } catch (final Exception e) { throw new ConfigurationException(e); } }
From source file:org.eclipse.sirius.diagram.sequence.business.internal.layout.vertical.SequenceVerticalLayout.java
private Map<ISequenceEvent, Range> computeBasicRanges(Map<EventEnd, Integer> endLocations) { final Map<ISequenceEvent, Range> sequenceEventsToRange = new LinkedHashMap<ISequenceEvent, Range>(); Predicate<ISequenceEvent> notMoved = Predicates.not(Predicates.in(sequenceEventsToRange.keySet())); // CombinedFragments for (EventEnd sortedEnd : semanticOrdering) { Predicate<ISequenceEvent> frames = Predicates.and(notMoved, Predicates.or( Predicates.instanceOf(CombinedFragment.class), Predicates.instanceOf(InteractionUse.class))); for (ISequenceEvent ise : Iterables.filter(endToISequencEvents.get(sortedEnd), frames)) { computeFinalRange(endLocations, sequenceEventsToRange, ise); }/*from w w w .j a v a2 s .com*/ } // Operands for (EventEnd sortedEnd : semanticOrdering) { Predicate<ISequenceEvent> operands = Predicates.and(notMoved, Predicates.instanceOf(Operand.class)); for (ISequenceEvent ise : Iterables.filter(endToISequencEvents.get(sortedEnd), operands)) { computeFinalRange(endLocations, sequenceEventsToRange, ise); } } // Other sequence events for (EventEnd sortedEnd : semanticOrdering) { for (ISequenceEvent ise : Iterables.filter(endToISequencEvents.get(sortedEnd), notMoved)) { computeFinalRange(endLocations, sequenceEventsToRange, ise); } } return sequenceEventsToRange; }
From source file:com.b2international.snowowl.snomed.datastore.id.cis.CisSnomedIdentifierService.java
@Override public void publish(final Set<String> componentIds) { LOGGER.debug("Publishing {} component IDs.", componentIds.size()); final Map<String, SctId> sctIds = getSctIds(componentIds); final Map<String, SctId> problemSctIds = ImmutableMap.copyOf(Maps.filterValues(sctIds, Predicates.<SctId>not(Predicates.or(SctId::isAssigned, SctId::isPublished)))); HttpPut deprecateRequest = null;//ww w . j av a2 s .c om String currentNamespace = null; try { final Map<String, SctId> assignedSctIds = ImmutableMap .copyOf(Maps.filterValues(sctIds, SctId::isAssigned)); if (!assignedSctIds.isEmpty()) { if (assignedSctIds.size() > 1) { final Multimap<String, String> componentIdsByNamespace = toNamespaceMultimap( assignedSctIds.keySet()); for (final Entry<String, Collection<String>> entry : componentIdsByNamespace.asMap() .entrySet()) { currentNamespace = entry.getKey(); for (final Collection<String> bulkIds : Iterables.partition(entry.getValue(), BULK_LIMIT)) { LOGGER.debug( String.format("Sending bulk publication request for namespace %s with size %d.", currentNamespace, bulkIds.size())); deprecateRequest = httpPut(String.format("sct/bulk/publish?token=%s", getToken()), createBulkPublishData(currentNamespace, bulkIds)); execute(deprecateRequest); } } } else { final String componentId = Iterables.getOnlyElement(assignedSctIds.keySet()); currentNamespace = SnomedIdentifiers.getNamespace(componentId); deprecateRequest = httpPut(String.format("sct/publish?token=%s", getToken()), createPublishData(componentId)); execute(deprecateRequest); } } if (!problemSctIds.isEmpty()) { throw new SctIdStatusException( "Cannot publish %s component IDs because they are not assigned or already published.", problemSctIds); } } catch (IOException e) { throw new SnowowlRuntimeException( String.format("Exception while publishing IDs for namespace %s.", currentNamespace), e); } finally { release(deprecateRequest); } }
From source file:org.immutables.value.processor.meta.ValueType.java
public List<ValueAttribute> getSettableAttributes() { if (settableAttributes == null) { settableAttributes = attributes().filter(Predicates.or(ValueAttributeFunctions.isGenerateAbstract(), ValueAttributeFunctions.isGenerateDefault())).toList(); }//from w ww . ja v a2s .co m return settableAttributes; }
From source file:com.ardor3d.example.ExampleBase.java
protected void registerInputTriggers() { // check if this example worries about input at all if (_logicalLayer == null) { return;//ww w .ja v a 2 s . co m } _controlHandle = FirstPersonControl.setupTriggers(_logicalLayer, _worldUp, true); _logicalLayer.registerTrigger( new InputTrigger(new MouseButtonClickedCondition(MouseButton.RIGHT), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final Vector2 pos = Vector2.fetchTempInstance().set( inputStates.getCurrent().getMouseState().getX(), inputStates.getCurrent().getMouseState().getY()); final Ray3 pickRay = new Ray3(); _canvas.getCanvasRenderer().getCamera().getPickRay(pos, false, pickRay); Vector2.releaseTempInstance(pos); doPick(pickRay); } }, "pickTrigger")); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ESCAPE), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { exit(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.L), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _lightState.setEnabled(!_lightState.isEnabled()); // Either an update or a markDirty is needed here since we did not touch the affected spatial directly. _root.markDirty(DirtyType.RenderState); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F4), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _showDepth = !_showDepth; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.T), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _wireframeState.setEnabled(!_wireframeState.isEnabled()); // Either an update or a markDirty is needed here since we did not touch the affected spatial directly. _root.markDirty(DirtyType.RenderState); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.B), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _showBounds = !_showBounds; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.C), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { System.out.println("Camera: " + _canvas.getCanvasRenderer().getCamera()); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.N), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _showNormals = !_showNormals; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F1), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _doShot = true; } })); final Predicate<TwoInputStates> clickLeftOrRight = Predicates.or( new MouseButtonClickedCondition(MouseButton.LEFT), new MouseButtonClickedCondition(MouseButton.RIGHT)); _logicalLayer.registerTrigger(new InputTrigger(clickLeftOrRight, new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { System.err.println("clicked: " + inputStates.getCurrent().getMouseState().getClickCounts()); } })); _logicalLayer.registerTrigger( new InputTrigger(new MouseButtonPressedCondition(MouseButton.LEFT), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (_mouseManager.isSetGrabbedSupported()) { _mouseManager.setGrabbed(GrabbedState.GRABBED); } } })); _logicalLayer.registerTrigger( new InputTrigger(new MouseButtonReleasedCondition(MouseButton.LEFT), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (_mouseManager.isSetGrabbedSupported()) { _mouseManager.setGrabbed(GrabbedState.NOT_GRABBED); } } })); _logicalLayer.registerTrigger(new InputTrigger(new AnyKeyCondition(), new TriggerAction() { public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { System.out.println("Key character pressed: " + inputState.getCurrent().getKeyboardState().getKeyEvent().getKeyChar()); } })); }
From source file:org.jclouds.abiquo.domain.cloud.VirtualMachine.java
public VirtualMachineTask setNics(final Network<?> gatewayNetwork, final List<Ip<?, ?>> ips, final List<UnmanagedNetwork> unmanagedNetworks) { // Remove the gateway configuration and the current nics Iterables.removeIf(target.getLinks(), Predicates.or(LinkPredicates.isNic(), LinkPredicates.rel(ParentLinkName.NETWORK_GATEWAY))); // Add the given nics in the appropriate order int i = 0;/*from w w w .j av a 2s. c om*/ if (ips != null) { for (i = 0; i < ips.size(); i++) { RESTLink source = LinkUtils.getSelfLink(ips.get(i).unwrap()); RESTLink link = new RESTLink("nic" + i, source.getHref()); link.setType(ips.get(i).unwrap().getBaseMediaType()); target.addLink(link); } } // Add unmanaged network references, if given if (unmanagedNetworks != null) { for (UnmanagedNetwork unmanaged : unmanagedNetworks) { RESTLink source = checkNotNull(unmanaged.unwrap().searchLink("ips"), ValidationErrors.MISSING_REQUIRED_LINK + "ips"); RESTLink link = new RESTLink("nic" + i, source.getHref()); link.setType(UnmanagedIpDto.BASE_MEDIA_TYPE); target.addLink(link); i++; } } VirtualMachineTask task = update(true); if (gatewayNetwork == null) { return task; } // If there is a gateway network, we have to wait until the network // configuration links are // available if (task != null) { VirtualMachineState originalState = target.getState(); VirtualMachineMonitor monitor = context.utils().injector().getInstance(MonitoringService.class) .getVirtualMachineMonitor(); monitor.awaitState(originalState, this); } // Set the new network configuration // Refresh virtual machine, to get the new configuration links refresh(); VMNetworkConfigurationsDto configs = context.getApi().getCloudApi().listNetworkConfigurations(target); Iterables.removeIf(target.getLinks(), LinkPredicates.rel(ParentLinkName.NETWORK_GATEWAY)); for (VMNetworkConfigurationDto config : configs.getCollection()) { if (config.getGateway().equalsIgnoreCase(gatewayNetwork.getGateway())) { target.addLink(new RESTLink(ParentLinkName.NETWORK_GATEWAY, config.getEditLink().getHref())); break; } } return update(true); }
From source file:clocker.mesos.entity.MesosClusterImpl.java
@Override public MesosSlave getMesosSlave(String hostname) { Collection<Entity> slaves = sensors().get(MESOS_SLAVES).getMembers(); Optional<Entity> found = Iterables.tryFind(slaves, Predicates.or(EntityPredicates.attributeEqualTo(MesosSlave.HOSTNAME, hostname), EntityPredicates.attributeEqualTo(MesosSlave.ADDRESS, hostname))); if (found.isPresent()) { return (MesosSlave) found.get(); } else {//from w ww .j a v a 2 s . c o m throw new IllegalStateException("Cannot find slave for host: " + hostname); } }
From source file:ome.logic.AdminImpl.java
@RolesAllowed("user") @Transactional(readOnly = false)/*from w w w .j a v a 2 s.c o m*/ public void removeGroups(final Experimenter user, final ExperimenterGroup... groups) { if (user == null) { return; } if (groups == null) { return; } adminOrPiOfGroups(null, groups); final Roles roles = getSecurityRoles(); final boolean removeSystemOrUser = Iterators.any(Iterators.forArray(groups), Predicates.or(roles.IS_SYSTEM_GROUP, roles.IS_USER_GROUP)); if (removeSystemOrUser && roles.isRootUser(user)) { throw new ValidationException("experimenter '" + roles.getRootName() + "' may not be removed from the '" + roles.getSystemGroupName() + "' or '" + roles.getUserGroupName() + "' group"); } final EventContext eventContext = getEventContext(); final boolean userOperatingOnThemself = eventContext.getCurrentUserId().equals(user.getId()); if (removeSystemOrUser && userOperatingOnThemself) { throw new ValidationException("experimenters may not remove themselves from the '" + roles.getSystemGroupName() + "' or '" + roles.getUserGroupName() + "' group"); } /* The properly loaded user object is needed for collecting the group-experimenter map. */ final Experimenter loadedUser = userProxy(user.getId()); final Set<Long> resultingGroupIds = new HashSet<Long>(); for (final GroupExperimenterMap map : loadedUser.<GroupExperimenterMap>collectGroupExperimenterMap(null)) { resultingGroupIds.add(map.parent().getId()); } for (final ExperimenterGroup group : groups) { resultingGroupIds.remove(group.getId()); } if (resultingGroupIds.isEmpty()) { throw new ValidationException("experimenter must remain a member of some group"); } else if (resultingGroupIds.equals(Collections.singleton(roles.getUserGroupId()))) { throw new ValidationException("experimenter cannot be a member of only the '" + roles.getUserGroupName() + "' group, a different default group is also required"); } roleProvider.removeGroups(user, groups); getBeanHelper().getLogger().info(String.format("Removed user %s from groups %s", user, groups)); }
From source file:nl.mvdr.umvc3replayanalyser.controller.Umvc3ReplayManagerController.java
/** Updates the replay table. */ private void updateReplayTable() { log.debug("Updating replay table."); // Save the selected replay so we can reselect it later. Replay selectedReplay = replayTableView.getSelectionModel().getSelectedItem(); // Construct the filter predicate Predicate<Replay> sideOnePredicate = new MatchReplayPredicate(playerOneTextField.getText(), playerOneCharacterOneComboBox.getValue(), Assist.getType(playerOneAssistOneComboBox.getValue()), playerOneCharacterTwoComboBox.getValue(), Assist.getType(playerOneAssistTwoComboBox.getValue()), playerOneCharacterThreeComboBox.getValue(), Assist.getType(playerOneAssistThreeComboBox.getValue()), maintainCharacterOrderCheckBox.isSelected(), Side.PLAYER_ONE); Predicate<Replay> sideTwoPredicate = new MatchReplayPredicate(playerTwoTextField.getText(), playerTwoCharacterOneComboBox.getValue(), Assist.getType(playerTwoAssistOneComboBox.getValue()), playerTwoCharacterTwoComboBox.getValue(), Assist.getType(playerTwoAssistTwoComboBox.getValue()), playerTwoCharacterThreeComboBox.getValue(), Assist.getType(playerTwoAssistThreeComboBox.getValue()), maintainCharacterOrderCheckBox.isSelected(), Side.PLAYER_TWO); Predicate<Replay> predicate = Predicates.and(sideOnePredicate, sideTwoPredicate); if (!maintainPlayerOrderCheckBox.isSelected()) { sideOnePredicate = new MatchReplayPredicate(playerTwoTextField.getText(), playerTwoCharacterOneComboBox.getValue(), Assist.getType(playerTwoAssistOneComboBox.getValue()), playerTwoCharacterTwoComboBox.getValue(), Assist.getType(playerTwoAssistTwoComboBox.getValue()), playerTwoCharacterThreeComboBox.getValue(), Assist.getType(playerTwoAssistThreeComboBox.getValue()), maintainCharacterOrderCheckBox.isSelected(), Side.PLAYER_ONE); sideTwoPredicate = new MatchReplayPredicate(playerOneTextField.getText(), playerOneCharacterOneComboBox.getValue(), Assist.getType(playerOneAssistOneComboBox.getValue()), playerOneCharacterTwoComboBox.getValue(), Assist.getType(playerOneAssistTwoComboBox.getValue()), playerOneCharacterThreeComboBox.getValue(), Assist.getType(playerOneAssistThreeComboBox.getValue()), maintainCharacterOrderCheckBox.isSelected(), Side.PLAYER_TWO); predicate = Predicates.or(predicate, Predicates.and(sideOnePredicate, sideTwoPredicate)); }/*from w ww .j a v a 2 s . c o m*/ if (log.isDebugEnabled()) { log.debug("Using predicate to filter replays: " + predicate); } Iterable<Replay> filteredReplays = Iterables.filter(replays, predicate); List<Replay> viewReplays = replayTableView.getItems(); viewReplays.clear(); for (Replay replay : filteredReplays) { viewReplays.add(replay); } if (log.isDebugEnabled()) { log.debug(String.format("Filtered replays. Displaying %s of %s replays.", "" + viewReplays.size(), "" + this.replays.size())); } // Force a re-sort of the table. List<TableColumn<Replay, ?>> sortOrder = new ArrayList<>(replayTableView.getSortOrder()); replayTableView.getSortOrder().setAll(sortOrder); // Attempt to reselect the originally selected replay. int newIndex = replayTableView.getItems().indexOf(selectedReplay); replayTableView.getSelectionModel().select(newIndex); }
From source file:org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver.java
/** * Sets up a {@link ScriptHelper} to generate a script that controls the given phase * (<em>check-running</em>, <em>launching</em> etc.) including default header and * footer commands.// w w w. jav a 2s . c om * <p> * Supported flags: * <ul> * <li><strong>usePidFile</strong> - <em>true</em> or <em>filename</em> to save and retrieve the PID * <li><strong>processOwner</strong> - <em>username</em> that owns the running process * <li><strong>nonStandardLayout</strong> - <em>true</em> to omit all default commands * <li><strong>installIncomplete</strong> - <em>true</em> to prevent marking complete * <li><strong>debug</strong> - <em>true</em> to enable shell debug output * </li> * * @param flags a {@link Map} of flags to control script generation * @param phase the phase to create the ScriptHelper for * * @see #newScript(String) * @see #USE_PID_FILE * @see #PROCESS_OWNER * @see #NON_STANDARD_LAYOUT * @see #INSTALL_INCOMPLETE * @see #DEBUG */ protected ScriptHelper newScript(Map<String, ?> flags, String phase) { if (!Entities.isManaged(getEntity())) throw new IllegalStateException( getEntity() + " is no longer managed; cannot create script to run here (" + phase + ")"); if (!Iterables.all(flags.keySet(), StringPredicates.equalToAny(VALID_FLAGS))) { throw new IllegalArgumentException("Invalid flags passed: " + flags); } ScriptHelper s = new ScriptHelper(this, phase + " " + elvis(entity, this)); if (!groovyTruth(flags.get(NON_STANDARD_LAYOUT))) { if (groovyTruth(flags.get(DEBUG))) { s.header.prepend("set -x"); } if (INSTALLING.equals(phase)) { // mutexId should be global because otherwise package managers will contend with each other s.useMutex(getLocation(), "installation lock at host", "installing " + elvis(entity, this)); s.header.append("export INSTALL_DIR=\"" + getInstallDir() + "\"", "mkdir -p $INSTALL_DIR", "cd $INSTALL_DIR", "test -f BROOKLYN && exit 0"); if (!groovyTruth(flags.get(INSTALL_INCOMPLETE))) { s.footer.append("date > $INSTALL_DIR/BROOKLYN"); } // don't set vars during install phase, prevent dependency resolution s.environmentVariablesReset(); } if (ImmutableSet.of(CUSTOMIZING, LAUNCHING, CHECK_RUNNING, STOPPING, KILLING, RESTARTING) .contains(phase)) { s.header.append("export RUN_DIR=\"" + getRunDir() + "\"", "mkdir -p $RUN_DIR", "cd $RUN_DIR"); } } if (ImmutableSet.of(LAUNCHING, RESTARTING).contains(phase)) { s.failIfBodyEmpty(); } if (ImmutableSet.of(STOPPING, KILLING).contains(phase)) { // stopping and killing allowed to have empty body if pid file set if (!groovyTruth(flags.get(USE_PID_FILE))) s.failIfBodyEmpty(); } if (ImmutableSet.of(INSTALLING, LAUNCHING).contains(phase)) { s.updateTaskAndFailOnNonZeroResultCode(); } if (phase.equalsIgnoreCase(CHECK_RUNNING)) { s.setInessential(); s.setTransient(); s.setFlag(SshTool.PROP_CONNECT_TIMEOUT, Duration.TEN_SECONDS.toMilliseconds()); s.setFlag(SshTool.PROP_SESSION_TIMEOUT, Duration.THIRTY_SECONDS.toMilliseconds()); s.setFlag(SshTool.PROP_SSH_TRIES, 1); } if (groovyTruth(flags.get(USE_PID_FILE))) { Object usePidFile = flags.get(USE_PID_FILE); String pidFile = (usePidFile instanceof CharSequence ? usePidFile : Os.mergePathsUnix(getRunDir(), PID_FILENAME)).toString(); String processOwner = (String) flags.get(PROCESS_OWNER); if (LAUNCHING.equals(phase)) { entity.sensors().set(SoftwareProcess.PID_FILE, pidFile); s.footer.prepend("echo $! > " + pidFile); } else if (CHECK_RUNNING.equals(phase)) { // old method, for supplied service, or entity.id // "ps aux | grep ${service} | grep \$(cat ${pidFile}) > /dev/null" // new way, preferred? if (processOwner != null) { s.body.append(BashCommands.sudoAsUser(processOwner, "test -f " + pidFile) + " || exit 1", "ps -p $(" + BashCommands.sudoAsUser(processOwner, "cat " + pidFile) + ")"); } else { s.body.append("test -f " + pidFile + " || exit 1", "ps -p `cat " + pidFile + "`"); } // no pid, not running; 1 is not running s.requireResultCode(Predicates.or(Predicates.equalTo(0), Predicates.equalTo(1))); } else if (STOPPING.equals(phase)) { if (processOwner != null) { s.body.append("export PID=$(" + BashCommands.sudoAsUser(processOwner, "cat " + pidFile) + ")", "test -n \"$PID\" || exit 0", BashCommands.sudoAsUser(processOwner, "kill $PID"), BashCommands.sudoAsUser(processOwner, "kill -9 $PID"), BashCommands.sudoAsUser(processOwner, "rm -f " + pidFile)); } else { s.body.append("export PID=$(cat " + pidFile + ")", "test -n \"$PID\" || exit 0", "kill $PID", "kill -9 $PID", "rm -f " + pidFile); } } else if (KILLING.equals(phase)) { if (processOwner != null) { s.body.append("export PID=$(" + BashCommands.sudoAsUser(processOwner, "cat " + pidFile) + ")", "test -n \"$PID\" || exit 0", BashCommands.sudoAsUser(processOwner, "kill -9 $PID"), BashCommands.sudoAsUser(processOwner, "rm -f " + pidFile)); } else { s.body.append("export PID=$(cat " + pidFile + ")", "test -n \"$PID\" || exit 0", "kill -9 $PID", "rm -f " + pidFile); } } else if (RESTARTING.equals(phase)) { if (processOwner != null) { s.footer.prepend(BashCommands.sudoAsUser(processOwner, "test -f " + pidFile) + " || exit 1", "ps -p $(" + BashCommands.sudoAsUser(processOwner, "cat " + pidFile) + ") || exit 1"); } else { s.footer.prepend("test -f " + pidFile + " || exit 1", "ps -p $(cat " + pidFile + ") || exit 1"); } // no pid, not running; no process; can't restart, 1 is not running } else { log.warn(USE_PID_FILE + ": script option not valid for " + s.summary); } } return s; }