/** * Return the value of the attribute in the node. Throws an exception if * missing attribute. * * @param n * the node * @param attName * the name of the attribute, must be non null * @return the value of the attribute (can be empty). * @throws NullPointerException * if attribute not found in the node */ public static String getRequiredAttributeValue(final Node n, final String attName) { String ret = null; if ((n != null) && !StringHelper.isNullOrEmpty(attName)) { NamedNodeMap atts = n.getAttributes(); Node att = atts.getNamedItem(attName); if (att == null) { throw new NullPointerException("Required attribute '" + attName + "' not found in the node."); } else { ret = att.getNodeValue(); } } return ret; }
/** * Split the given String path into String path elements. For example, the * following path "/foo/bar" will be split into two parts "foo" and "bar", * returned in List. If the given path includes empty path elements (Ex: * "/foo//bar//"), the returned List doesn't contain these elements (for * this exemple result will be "foo","bar"). * * @param path * the String path to split, can be null or empty (return an * empty ArrayList) * @return a List of String path elements, cannot be null, can be empty */ public static final List<String> splitPathElements(final String path) { List<String> pathElements = new ArrayList<String>(); if (!isNullOrEmpty(path)) { StringTokenizer tokenizer = new StringTokenizer(path, "/"); while (tokenizer.hasMoreTokens()) { pathElements.add(tokenizer.nextToken()); } } return pathElements; } }
if (!isNullOrEmpty(string) && !isNullOrEmpty(attribute)) { if (isNullOrEmpty(separator)) {
/** * Check SU identifier : must be non null, non empty and unique within the * SA * * @param suIds * the SU identifier list within the SA * @param suIdentifier * the service unit identifier * @param saName * the service assembly name * @throws Exception * if SU identifier is null, empty and non unique within the sa */ private void checkSUIdentifier(List<String> suIds, String suIdentifier, String saName) throws PetalsException { if (StringHelper.isNullOrEmpty(suIdentifier)) { throw new PetalsException("Name of service unit must be filled in the SA '" + saName + "'"); } if (suIds.contains(suIdentifier)) { throw new PetalsException("Name of service unit must be unique within the SA '" + saName + "'"); } }
/** * Check target artifact zip and target component entries : must be non null * and non empty * * @param artifactZip * the artefact zip path into the sa archive * @param suIdentifier * the service unit identifier * @param targetComponent * the targeted component name * @throws Exception * if target artifact zip or target component entries are null * or empty */ private void checkTargetComponentAndZip(String artifactZip, String suIdentifier, String targetComponent) throws PetalsException { String msg = ""; if (StringHelper.isNullOrEmpty(artifactZip)) { msg = "Target artifact zip of a service unit must be non null " + "and non empty (SU name : " + suIdentifier + ")."; log.error(msg); throw new PetalsException(msg); } if (StringHelper.isNullOrEmpty(targetComponent)) { msg = "Target component name of a service unit must be non null " + "and non empty (SU name : " + suIdentifier + ")."; log.error(msg); throw new PetalsException(msg); } }
/** * Check the classpath element of the jbi descriptor * * @param filePackage * the entity package root * @param classPath * a List of classpath elements to check * @throws PetalsException * if one of the classpath elements is null, empty or or missing */ public static final void checkClassPathElements(File filePackage, List<String> classPath) throws PetalsException { for (String pathElement : classPath) { // empty class-path elements is not alloweds if (StringHelper.isNullOrEmpty(pathElement)) { throw new PetalsException("Found empty class-path element in the JBI descriptor"); } // check if the specified path element exists within archive if (!".".equals(pathElement) && !hasEntry(filePackage, pathElement)) { throw new PetalsException("The class-path element '" + pathElement + "' declared in the " + "JBI descriptor cannot be resolved"); } } }
QName provService = connection.getProvider().getServiceName(); String provEndpoint = connection.getProvider().getEndpointName(); if (consInterface == null || StringHelper.isNullOrEmpty(consInterface.getLocalPart())) { if (StringHelper.isNullOrEmpty(consEndpoint) || consService == null || StringHelper.isNullOrEmpty(consService.getLocalPart())) { throw new PetalsException( "Either Consumer interface or (consumer service and consumer endpoint) " if (StringHelper.isNullOrEmpty(provEndpoint) || provService == null || StringHelper.isNullOrEmpty(provService.getLocalPart())) { throw new PetalsException( "Provider service and provider endpoint must be filled in a Provides connection");
if (StringHelper.isNullOrEmpty(slName)) { throw new PetalsException( "The Shared Library name must be non null and non empty :" + filePackage.getAbsolutePath()); if (StringHelper.isNullOrEmpty(slVersion)) { throw new PetalsException( "The Shared Library version must be non null and non empty :"
|| (StringHelper.isNullOrEmpty(jndiConfiguration.getJndiProviderUrl() .toASCIIString()))) { return result; result.setFactory(jndiConfiguration.getJndiFactory()); if (!StringHelper.isNullOrEmpty(jndiConfiguration.getJndiSecurityPrincipal())) { result.setSecurityPrincipal(jndiConfiguration.getJndiSecurityPrincipal()); if (!StringHelper.isNullOrEmpty(jndiConfiguration.getJndiSecurityCredentials())) { result.setSecurityPrincipal(jndiConfiguration.getJndiSecurityCredentials());
if (StringHelper.isNullOrEmpty(compName)) { throw new PetalsException( "The component name must be non null and non empty for the new component :"
if (StringHelper.isNullOrEmpty(saName)) { throw new PetalsException( "Name of a service assembly must not be null or empty for package '"