List of usage examples for org.springframework.util Assert hasText
public static void hasText(@Nullable String text, Supplier<String> messageSupplier)
From source file:com.rosy.bill.utils.jmx.JmxClientTemplate.java
/** * MBean?./*from w ww .ja va 2s . c om*/ */ public <T> T createMBeanProxy(final String mbeanName, final Class<T> mBeanInterface) { Assert.hasText(mbeanName, "mbeanName?"); assertConnected(); ObjectName objectName = buildObjectName(mbeanName); return MBeanServerInvocationHandler.newProxyInstance(connection, objectName, mBeanInterface, false); }
From source file:org.cleverbus.api.entity.Request.java
/** * Creates a new request./*from w w w . j a va 2 s.com*/ * * @param uri the target URI * @param responseJoinId the identifier for pairing/joining request and response together * @param request the request (envelope) itself * @param msg the message * @return request entity */ public static Request createRequest(String uri, String responseJoinId, String request, @Nullable Message msg) { Assert.hasText(uri, "uri must not be empty"); Assert.hasText(request, "request must not be empty"); Assert.hasText(responseJoinId, "responseJoinId must not be empty"); Date currDate = new Date(); Request req = new Request(); req.setUri(uri); req.setResponseJoinId(responseJoinId); req.setRequest(request); req.setMessage(msg); req.setReqTimestamp(currDate); return req; }
From source file:com.frank.search.solr.core.query.Criteria.java
/** * Creates a new Criteria for the given field * /*w ww. j av a 2 s .c o m*/ * @param field */ public Criteria(Field field) { Assert.notNull(field, "Field for criteria must not be null"); Assert.hasText(field.getName(), "Field.name for criteria must not be null/empty"); this.field = field; }
From source file:org.cleverbus.api.asynch.AsynchRouteBuilder.java
private AsynchRouteBuilder(String inUri, ServiceExtEnum serviceType, String operation, AsynchResponseProcessor responseProcessor, DataFormatDefinition responseMarshalling) { Assert.hasText(operation, "the operation must not be empty"); Assert.notNull(inUri, "the inUri must not be empty"); Assert.notNull(serviceType, "the serviceType must not be null"); Assert.notNull(responseProcessor, "the responseProcessor must not be null"); Assert.notNull(responseMarshalling, "the responseMarshalling must not be null"); this.inUri = inUri; this.serviceType = serviceType; this.operation = operation; this.responseProcessor = responseProcessor; this.responseMarshalling = responseMarshalling; }
From source file:de.itsvs.cwtrpc.security.AbstractRpcProcessingFilter.java
public void setFilterProcessesUrl(String filterProcessesUrl) { Assert.hasText(filterProcessesUrl, "'filterProcessesUrl' must not be null"); Assert.isTrue(UrlUtils.isValidRedirectUrl(filterProcessesUrl), filterProcessesUrl + " is not a valid URL"); this.filterProcessesUrl = filterProcessesUrl; }
From source file:oz.hadoop.yarn.api.core.ApplicationContainer.java
/** * //from w ww . j ava 2 s.c o m */ private void doLaunch() { ApplicationContainerProcessor applicationContainer = null; String command = this.containerSpec.getString(YayaConstants.COMMAND); if (StringUtils.hasText(command)) { applicationContainer = new ProcessLaunchingApplicationContainer(new CommandProcessLauncher(command)); } else { String appContainerImplClass = this.containerSpec.getString(YayaConstants.CONTAINER_IMPL); Assert.hasText(appContainerImplClass, "Invalid condition: 'appContainerImplClass' must not be null or empty. " + "Since this is coming from internal API it must be a bug. Please REPORT."); applicationContainer = (ApplicationContainerProcessor) ReflectionUtils .newDefaultInstance(appContainerImplClass); String containerArguments = this.containerSpec.getString(YayaConstants.CONTAINER_ARG); if (StringUtils.hasText(containerArguments)) { applicationContainer = new ProcessLaunchingApplicationContainer( new JavaProcessLauncher<ByteBuffer>(applicationContainer, containerArguments)); } } applicationContainer = new ExceptionHandlingApplicationContainer(applicationContainer); this.connectWithApplicationMaster(applicationContainer); logger.info("Awaiting Application Container's process to finish or termination signal from the client"); /* * Upon receiving a reply Server will check if application if finite and if so * it will close the connection which will force client to exit */ this.client.awaitShutdown(); logger.info("ApplicationContainerClient has been stopped"); }
From source file:fr.mby.portal.coreimpl.action.BasicUserAction.java
@Override public Iterable<String> getProperties(final String name) throws IllegalArgumentException { Assert.hasText(name, "No property name provided !"); return this.properties.get(name); }
From source file:com.azaptree.services.security.impl.SecurityCredentialsServiceImpl.java
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override//from w w w . ja v a 2s . com public byte[] convertCredentialToBytes(String name, Object credential) throws SecurityServiceException, UnsupportedCredentialTypeException { Assert.hasText(name, "name is required"); Assert.notNull(credential, "credential is required"); final CredentialToByteSourceConverter converter = credentialToByteSourceConverters.get(name); if (converter == null) { throw new UnsupportedCredentialTypeException( String.format("%s -> %s", name, credential.getClass().getName())); } return converter.convert(credential); }
From source file:$.DirectCallController.java
@RequestMapping(value = "/directCall", method = RequestMethod.POST) public String processCallForm(@ModelAttribute("model") ModelMap modelMap, @RequestParam("body") String body, @RequestParam("uri") String uri, @RequestParam("senderRef") String senderRef, @RequestParam("soapAction") @Nullable String soapAction, @RequestParam("header") String header) { Assert.hasText(body, "the body must not be empty"); Assert.hasText(uri, "the uri must not be empty"); Assert.hasText(senderRef, "the senderRef must not be empty"); // generate unique ID String callId = UUID.randomUUID().toString(); // save params into registry DirectCallParams params = new DirectCallParams(body, uri, senderRef, soapAction, StringUtils.trimToNull(header)); callRegistry.addParams(callId, params); // call external system via internal servlet route try {/*from w w w .j a va2 s .c om*/ Log.debug("Calling external system with callId=" + callId + ", params: " + params); String res = directCall.makeCall(callId); modelMap.put(CALL_RESULT_ATTR, MessageController.prettyPrintXML(res)); } catch (Exception ex) { // error occurred StringWriter strOut = new StringWriter(); PrintWriter resStr = new PrintWriter(strOut); ExceptionUtils.printRootCauseStackTrace(ex, resStr); modelMap.put(CALL_RESULT_ERR_ATTR, strOut.toString()); } modelMap.put("header", header); modelMap.put("body", body); modelMap.put("uri", uri); modelMap.put("senderRef", senderRef); modelMap.put("soapAction", soapAction); return VIEW_NAME; }
From source file:org.openwms.core.lang.I18n.java
/** * Create a new I18n.//from w w w . j a v a 2 s. c o m * * @param moduleName The name of the {@code Module} where this entity belongs to * @param key The key to access this translation * @param lang A set of languages * @throws IllegalArgumentException when the {@code moduleName} or the {@code key} is {@literal null} or empty */ public I18n(String moduleName, String key, I18nSet lang) { super(); Assert.hasText(moduleName, "Not allowed to create an I18n instance with an empty moduleName"); Assert.hasText(key, "Not allowed to create an I18n instance with an empty key"); this.moduleName = moduleName; this.key = key; this.lang = lang; }