List of usage examples for java.lang Throwable Throwable
public Throwable(Throwable cause)
From source file:org.apache.nifi.web.StandardNiFiServiceFacade.java
@Override public void deleteActions(Date endDate) { // get the user from the request NiFiUser user = NiFiUserUtils.getNiFiUser(); if (user == null) { throw new WebApplicationException(new Throwable("Unable to access details for current user.")); }/* w w w . j a v a 2 s . c o m*/ // create the purge details FlowChangePurgeDetails details = new FlowChangePurgeDetails(); details.setEndDate(endDate); // create a purge action to record that records are being removed FlowChangeAction purgeAction = new FlowChangeAction(); purgeAction.setUserIdentity(user.getIdentity()); purgeAction.setUserName(user.getUserName()); purgeAction.setOperation(Operation.Purge); purgeAction.setTimestamp(new Date()); purgeAction.setSourceId("Flow Controller"); purgeAction.setSourceName("History"); purgeAction.setSourceType(Component.Controller); purgeAction.setActionDetails(details); // purge corresponding actions auditService.purgeActions(endDate, purgeAction); }
From source file:microsoft.exchange.webservices.data.core.ExchangeService.java
/** * Builds a request to subscribe to pull notification in the * authenticated user's mailbox./* w ww.j a va 2 s.c o m*/ * * @param folderIds The Ids of the folder to subscribe to. * @param timeout The timeout, in minutes, after which the subscription expires. * Timeout must be between 1 and 1440 * @param watermark An optional watermark representing a previously opened * subscription * @param eventTypes The event types to subscribe to * @return A request to subscribe to pull notification in the authenticated * user's mailbox * @throws Exception the exception */ private SubscribeToPullNotificationsRequest buildSubscribeToPullNotificationsRequest( Iterable<FolderId> folderIds, int timeout, String watermark, EventType... eventTypes) throws Exception { if (timeout < 1 || timeout > 1440) { throw new IllegalArgumentException("timeout", new Throwable("Timeout must be a value between 1 and 1440.")); } EwsUtilities.validateParamCollection(eventTypes, "eventTypes"); SubscribeToPullNotificationsRequest request = new SubscribeToPullNotificationsRequest(this); if (folderIds != null) { request.getFolderIds().addRangeFolderId(folderIds); } request.setTimeOut(timeout); for (EventType event : eventTypes) { request.getEventTypes().add(event); } request.setWatermark(watermark); return request; }
From source file:org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.java
public void setEndpointAddress(String endpointAddress) { // REVIEW: Should this be called whenever BindingProvider.ENDPOINT_ADDRESS_PROPERTY is set by the client? if (!DescriptionUtils.isEmpty(endpointAddress)) { this.endpointAddress = endpointAddress; } else {//from w ww . ja va2 s.c o m // Since a port can be added without setting an endpoint address, this is not an error. if (log.isDebugEnabled()) log.debug("A null or empty endpoint address was attempted to be set", new Throwable("Stack Traceback")); } }
From source file:org.apache.nifi.web.StandardNiFiServiceFacade.java
@Override public ControllerDTO getController() { final NiFiUser user = NiFiUserUtils.getNiFiUser(); if (user == null) { throw new WebApplicationException(new Throwable("Unable to access details for current user.")); }//from w ww . j av a 2 s. c om // at this point we know that the user must have ROLE_NIFI because it's required // get to the endpoint that calls this method but we'll check again anyways final Set<Authority> authorities = user.getAuthorities(); if (!authorities.contains(Authority.ROLE_NIFI)) { throw new AccessDeniedException("User must have the NiFi role in order to access these details."); } // serialize the input ports this NiFi has access to final Set<PortDTO> inputPorts = new LinkedHashSet<>(); for (RootGroupPort inputPort : controllerFacade.getInputPorts()) { if (isUserAuthorized(user, inputPort)) { final PortDTO dto = new PortDTO(); dto.setId(inputPort.getIdentifier()); dto.setName(inputPort.getName()); dto.setComments(inputPort.getComments()); dto.setState(inputPort.getScheduledState().toString()); inputPorts.add(dto); } } // serialize the output ports this NiFi has access to final Set<PortDTO> outputPorts = new LinkedHashSet<>(); for (RootGroupPort outputPort : controllerFacade.getOutputPorts()) { if (isUserAuthorized(user, outputPort)) { final PortDTO dto = new PortDTO(); dto.setId(outputPort.getIdentifier()); dto.setName(outputPort.getName()); dto.setComments(outputPort.getComments()); dto.setState(outputPort.getScheduledState().toString()); outputPorts.add(dto); } } // get the root group final ProcessGroup rootGroup = processGroupDAO.getProcessGroup(controllerFacade.getRootGroupId()); final ProcessGroupCounts counts = rootGroup.getCounts(); // create the controller dto final ControllerDTO controllerDTO = new ControllerDTO(); controllerDTO.setId(controllerFacade.getRootGroupId()); controllerDTO.setInstanceId(controllerFacade.getInstanceId()); controllerDTO.setName(controllerFacade.getName()); controllerDTO.setComments(controllerFacade.getComments()); controllerDTO.setInputPorts(inputPorts); controllerDTO.setOutputPorts(outputPorts); controllerDTO.setInputPortCount(inputPorts.size()); controllerDTO.setOutputPortCount(outputPorts.size()); controllerDTO.setRunningCount(counts.getRunningCount()); controllerDTO.setStoppedCount(counts.getStoppedCount()); controllerDTO.setInvalidCount(counts.getInvalidCount()); controllerDTO.setDisabledCount(counts.getDisabledCount()); // determine the site to site configuration if (isClustered()) { controllerDTO.setRemoteSiteListeningPort(controllerFacade.getClusterManagerRemoteSiteListeningPort()); controllerDTO.setSiteToSiteSecure(controllerFacade.isClusterManagerRemoteSiteCommsSecure()); } else { controllerDTO.setRemoteSiteListeningPort(controllerFacade.getRemoteSiteListeningPort()); controllerDTO.setSiteToSiteSecure(controllerFacade.isRemoteSiteCommsSecure()); } return controllerDTO; }
From source file:org.apache.nifi.web.StandardNiFiServiceFacade.java
@Override public void deleteNode(String nodeId) { final NiFiUser user = NiFiUserUtils.getNiFiUser(); if (user == null) { throw new WebApplicationException(new Throwable("Unable to access details for current user.")); }//from w w w . ja va 2 s. c o m final String userDn = user.getIdentity(); clusterManager.deleteNode(nodeId, userDn); }
From source file:org.apache.brooklyn.location.jclouds.JcloudsLocation.java
/** @deprecated since 0.7.0 use {@link #registerJcloudsSshMachineLocation(ComputeService, NodeMetadata, LoginCredentials, Optional, ConfigBag)} */ @Deprecated//w w w .ja v a 2 s .c o m protected final JcloudsSshMachineLocation registerJcloudsSshMachineLocation(NodeMetadata node, String vmHostname, Optional<HostAndPort> sshHostAndPort, ConfigBag setup) throws IOException { LOG.warn("Using deprecated registerJcloudsSshMachineLocation: now wants computeService passed", new Throwable("source of deprecated registerJcloudsSshMachineLocation invocation")); return registerJcloudsSshMachineLocation(null, node, Optional.<Template>absent(), null, sshHostAndPort, setup); }