List of usage examples for org.springframework.util StringUtils capitalize
public static String capitalize(String str)
From source file:com.phoenixnap.oss.ramlapisync.naming.NamingHelper.java
/** * Attempts to infer the name of an action (intent) from a resource's relative URL and action details * // w w w . j a v a 2 s . co m * @param controllerizedResource The resource that is mapped to the root controller * @param resource The child resource that will be mapped as a method of the root controller * @param action The RAML action object * @param actionType The ActionType/HTTP Verb for this Action * @return The java name of the method that will represent this Action */ public static String getActionName(RamlResource controllerizedResource, RamlResource resource, RamlAction action, RamlActionType actionType) { String url = resource.getUri(); //Since this will be part of a resource/controller, remove the parent portion of the URL if enough details remain //to infer a meaningful method name if (controllerizedResource != resource && StringUtils.countOccurrencesOf(url, "{") < StringUtils.countOccurrencesOf(url, "/") - 1) { url = url.replace(controllerizedResource.getUri(), ""); } //sanity check if (StringUtils.hasText(url)) { //Split the url into segments by seperator String[] splitUrl = url.split("/"); String name = ""; int nonIdsParsed = 0; int index = splitUrl.length - 1; boolean singularizeNext = false; //Parse segments until end is reached or we travers a maximum of 2 non Path Variable segments, these 2 should both have at least 1 //id path variable each otherwise they would have been typically part of the parent controller //or we have REALLY long URL nesting which isnt really a happy place. while (nonIdsParsed < 2 && index >= 0) { String segment = splitUrl[index]; //Lets check for ID path variables if (segment.contains("{") && segment.contains("}")) { //should we add this to Method name //peek if (index > 0 && index == splitUrl.length - 1) { String peek = splitUrl[index - 1].toLowerCase(); if (segment.toLowerCase().contains(Inflector.singularize(peek))) { //this is probably the Id name = name + "ById"; } else { name = name + "By" + StringUtils.capitalize(segment.substring(1, segment.length() - 1)); } } //Since we probably found an ID, it means that method acts on a single resource in the collection. probably :) singularizeNext = true; } else { segment = cleanNameForJava(segment); if (singularizeNext) { //consume singularisation if (!segment.endsWith("details")) { name = Inflector.singularize(StringUtils.capitalize(segment)) + name; } else { name = StringUtils.capitalize(segment) + name; } singularizeNext = false; } else { name = StringUtils.capitalize(segment) + name; } nonIdsParsed++; if (singularizeNext) { //consume singularisation singularizeNext = false; } } index--; } //Add the http verb into the mix boolean collection = false; String tail = splitUrl[splitUrl.length - 1]; if (!Inflector.singularize(tail).equals(tail) && !tail.endsWith("details")) { collection = true; } String prefix = convertActionTypeToIntent(actionType, collection); if (collection && RamlActionType.POST.equals(actionType)) { name = Inflector.singularize(name); } return prefix + name; } //Poop happened. return nothing return null; }
From source file:com.phoenixnap.oss.ramlapisync.parser.SpringMvcResourceParser.java
@Override protected void extractAndAppendResourceInfo(Method method, JavaDocEntry docEntry, RamlResource parentResource) { RamlModelFactory ramlModelFactory = RamlModelFactoryOfFactories.createRamlModelFactory(); Map<RamlActionType, String> methodActions = getHttpMethodAndName(method); for (Entry<RamlActionType, String> methodAction : methodActions.entrySet()) { RamlAction action = ramlModelFactory.createRamlAction(); RamlActionType apiAction = methodAction.getKey(); String apiName = methodAction.getValue(); //Method assumes that the name starts with / if (apiName != null && !apiName.startsWith("/")) { apiName = "/" + apiName; }//w w w .ja va 2s . c o m Map<String, String> pathDescriptions = getPathDescriptionsForMethod(method); logger.info("Added call: " + apiName + " " + apiAction + " from method: " + method.getName()); String responseComment = docEntry == null ? null : docEntry.getReturnTypeComment(); RamlResponse response = extractResponseFromMethod(method, responseComment); Map<String, String> parameterComments = (docEntry == null ? Collections.emptyMap() : docEntry.getParameterComments()); // Lets extract any query parameters (for Verbs that don't support bodies) and insert them in the Action // model action.addQueryParameters(extractQueryParameters(apiAction, method, parameterComments)); // Lets extract any request data that should go in the request body as json and insert it in the action // model action.setBody(extractRequestBodyFromMethod(apiAction, method, parameterComments)); // Add any headers we need for the method addHeadersForMethod(action, apiAction, method); String description = docEntry == null ? null : docEntry.getComment(); if (StringUtils.hasText(description)) { action.setDescription(description); } else { action.setDescription(method.getName()); } action.addResponse("200", response); RamlResource idResource = null; RamlResource leafResource = null; ApiParameterMetadata[] resourceIdParameters = extractResourceIdParameter(method); Map<String, ApiParameterMetadata> resourceIdParameterMap = new HashMap<>(); for (ApiParameterMetadata apiParameterMetadata : resourceIdParameters) { resourceIdParameterMap.put("{" + apiParameterMetadata.getName() + "}", apiParameterMetadata); } String[] splitUrl = apiName.replaceFirst("/", "").split("/"); for (String partialUrl : splitUrl) { if (leafResource == null) { leafResource = parentResource; } else { leafResource = idResource; } //Clean Path variable defaults partialUrl = cleanPathVariableRegex(partialUrl); String resourceName = "/" + partialUrl; idResource = leafResource.getResource(resourceName);// lets check if the parent resource already // contains a resource if (idResource == null) { idResource = ramlModelFactory.createRamlResource(); idResource.setRelativeUri(resourceName); String displayName = StringUtils.capitalize(partialUrl) + " Resource"; String resourceDescription = displayName; if (pathDescriptions.containsKey(partialUrl)) { resourceDescription = pathDescriptions.get(partialUrl); } if (resourceIdParameterMap.containsKey(partialUrl)) { displayName = "A specific " + StringUtils.capitalize(partialUrl).replace("{", "").replace("}", ""); ApiParameterMetadata resourceIdParameter = resourceIdParameterMap.get(partialUrl); RamlUriParameter uriParameter = ramlModelFactory .createRamlUriParameterWithName(resourceIdParameter.getName()); RamlParamType simpleType = SchemaHelper.mapSimpleType(resourceIdParameter.getType()); if (simpleType == null) { logger.warn("Only simple parameters are supported for URL Parameters, defaulting " + resourceIdParameter.getType() + " to String"); simpleType = RamlParamType.STRING; // TODO support Map<String, String implementations> or not? } uriParameter.setType(simpleType); uriParameter.setRequired(true); if (StringUtils.hasText(resourceIdParameter.getExample())) { uriParameter.setExample(resourceIdParameter.getExample()); } String paramComment = parameterComments.get(resourceIdParameter.getName()); if (StringUtils.hasText(paramComment)) { uriParameter.setDescription(paramComment); } idResource.addUriParameter(resourceIdParameter.getName(), uriParameter); } idResource.setDisplayName(displayName); // TODO allow the Api annotation to specify this stuff :) idResource.setDescription(resourceDescription); // TODO allow the Api annotation to specify this stuff :) idResource.setParentResource(leafResource); if (leafResource.getUri() != null) { String targetUri = leafResource.getUri(); if (targetUri.startsWith("null/")) { targetUri = targetUri.substring(5); } idResource.setParentUri(targetUri); } leafResource.addResource(resourceName, idResource); } } // Resources have been created. lets bind the action to the appropriate one RamlResource actionTargetResource; if (idResource != null) { actionTargetResource = idResource; } else if (leafResource != null) { actionTargetResource = leafResource; } else { actionTargetResource = parentResource; } action.setResource(actionTargetResource); action.setType(apiAction); if (actionTargetResource.getActions().containsKey(apiAction)) { //merge action RamlAction existingAction = actionTargetResource.getActions().get(apiAction); RamlHelper.mergeActions(existingAction, action); } else { actionTargetResource.addAction(apiAction, action); } } }
From source file:hudson.model.Descriptor.java
/** * If the field "xyz" of a {@link Describable} has the corresponding "doCheckXyz" method, * return the form-field validation string. Otherwise null. * <p>// www . ja v a 2 s . c om * This method is used to hook up the form validation method to */ public String getCheckUrl(String fieldName) { String capitalizedFieldName = StringUtils.capitalize(fieldName); Method method = checkMethods.get(fieldName); if (method == null) { method = NONE; String methodName = "doCheck" + capitalizedFieldName; for (Method m : getClass().getMethods()) { if (m.getName().equals(methodName)) { method = m; break; } } checkMethods.put(fieldName, method); } if (method == NONE) return null; StaplerRequest req = Stapler.getCurrentRequest(); Ancestor a = req.findAncestor(DescriptorByNameOwner.class); // a is always non-null because we already have Hudson as the sentinel return singleQuote( a.getUrl() + "/descriptorByName/" + clazz.getName() + "/check" + capitalizedFieldName + "?value=") + "+toValue(this)"; }
From source file:it.smartcommunitylab.weliveplayer.managers.WeLivePlayerManager.java
public Profile getUserProfile(String bearerHeader) throws WeLivePlayerCustomException { Profile profile = null;// w w w . j a v a 2 s .c om String aacUri = env.getProperty("ext.aacURL") + "/basicprofile/me"; try { String response = weLivePlayerUtils.sendGET(aacUri, "application/json", "application/json", bearerHeader, -1); if (response != null && !response.isEmpty()) { JSONObject root = new JSONObject(response.toString()); if (root.has("userId")) { // read userId. String userId = root.getString("userId"); // invoke cdv profile api. String url = env.getProperty("welive.cdv.getUserprofile.uri"); // url = url.replace("{id}", userId); String profileAPIResponse = weLivePlayerUtils.sendGET(url, "application/json", "application/json", bearerHeader, -1); if (profileAPIResponse != null && !profileAPIResponse.isEmpty()) { JSONObject profileJson = new JSONObject(profileAPIResponse); if (profileJson.has("name")) { profile = new Profile(); profile.setName(profileJson.getString("name")); // fields. if (profileJson.has("address") && !profileJson.isNull("address")) profile.setAddress(profileJson.getString("address")); if (profileJson.has("birthdate") && !profileJson.isNull("birthdate")) profile.setBirthdate(profileJson.getString("birthdate")); if (profileJson.has("ccUserID") && !profileJson.isNull("ccUserID")) profile.setCcUserID(profileJson.getString("ccUserID")); if (profileJson.has("city") && !profileJson.isNull("city")) profile.setCity(profileJson.getString("city")); if (profileJson.has("country") && !profileJson.isNull("country")) profile.setCountry(profileJson.getString("country")); if (profileJson.has("isDeveloper") && !profileJson.isNull("isDeveloper")) profile.setDeveloper(profileJson.getBoolean("isDeveloper")); if (profileJson.has("email") && !profileJson.isNull("email")) profile.setEmail(profileJson.getString("email")); if (profileJson.has("gender") && !profileJson.isNull("gender")) profile.setGender(profileJson.getString("gender")); if (profileJson.has("surname") && !profileJson.isNull("surname")) profile.setSurname(profileJson.getString("surname")); if (profileJson.has("zipCode") && !profileJson.isNull("zipCode")) profile.setZipCode(profileJson.getString("zipCode")); if (profileJson.has("referredPilot") && !profileJson.isNull("referredPilot")) profile.setReferredPilot(profileJson.getString("referredPilot")); if (profileJson.has("skills") && !profileJson.get("skills").toString().equalsIgnoreCase("[]")) { JSONArray skills = (JSONArray) profileJson.get("skills"); List<String> skillSet = new ArrayList<String>(); for (int i = 0; i < skills.length(); i++) { JSONObject skill = (JSONObject) skills.get(i); skillSet.add(String.valueOf(skill.get("skillName"))); } profile.setSkills(skillSet); } if (profileJson.has("languages") && !profileJson.get("languages").toString().equalsIgnoreCase("[]")) { profile.setLanguages( mapper.readValue(profileJson.get("languages").toString(), List.class)); for (int i = 0; i < profile.getLanguages().size(); i++) { String l = profile.getLanguages().get(i); profile.getLanguages().set(i, StringUtils.capitalize(l)); } } // get user tags. String userTagsUrl = env.getProperty("welive.cdv.getUserTags.uri"); userTagsUrl = userTagsUrl.replace("{id}", userId); String userTagResponse = weLivePlayerUtils.sendGET(userTagsUrl, null, null, authHeader, -1); if (userTagResponse != null && !userTagResponse.isEmpty()) { JSONObject userTagsJson = new JSONObject(userTagResponse); if (userTagsJson.has("userTags") && !userTagsJson.get("userTags").toString().equalsIgnoreCase("[]")) { profile.setUserTags( mapper.readValue(userTagsJson.get("userTags").toString(), List.class)); } } } } else { logger.info("WLP: Calling[" + url + "] " + response); } } else { logger.error("WLP: Calling[" + aacUri + "] user not found"); throw new WeLivePlayerCustomException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "user not found"); } } else { logger.info("WLP: Calling[" + aacUri + "] " + response); } } catch (Exception e) { logger.error("WLP: Calling[getUserProfile] " + e.getMessage()); throw new WeLivePlayerCustomException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } return profile; }
From source file:net.yasion.common.core.bean.wrapper.GenericTypeAwarePropertyDescriptor.java
public GenericTypeAwarePropertyDescriptor(Class<?> beanClass, String propertyName, Method readMethod, Method writeMethod, Class<?> propertyEditorClass) throws IntrospectionException { super(propertyName, null, null); if (beanClass == null) { throw new IntrospectionException("Bean class must not be null"); }//from w ww . j a va2 s . c o m this.beanClass = beanClass; Method readMethodToUse = BridgeMethodResolver.findBridgedMethod(readMethod); Method writeMethodToUse = BridgeMethodResolver.findBridgedMethod(writeMethod); if (writeMethodToUse == null && readMethodToUse != null) { // Fallback: Original JavaBeans introspection might not have found matching setter // method due to lack of bridge method resolution, in case of the getter using a // covariant return type whereas the setter is defined for the concrete property type. Method candidate = ClassUtils.getMethodIfAvailable(this.beanClass, "set" + StringUtils.capitalize(getName()), (Class<?>[]) null); if (candidate != null && candidate.getParameterTypes().length == 1) { writeMethodToUse = candidate; } } this.readMethod = readMethodToUse; this.writeMethod = writeMethodToUse; if (this.writeMethod != null) { if (this.readMethod == null) { // Write method not matched against read method: potentially ambiguous through // several overloaded variants, in which case an arbitrary winner has been chosen // by the JDK's JavaBeans Introspector... Set<Method> ambiguousCandidates = new HashSet<Method>(); for (Method method : beanClass.getMethods()) { if (method.getName().equals(writeMethodToUse.getName()) && !method.equals(writeMethodToUse) && !method.isBridge()) { ambiguousCandidates.add(method); } } if (!ambiguousCandidates.isEmpty()) { this.ambiguousWriteMethods = ambiguousCandidates; } } this.writeMethodParameter = new MethodParameter(this.writeMethod, 0); GenericTypeResolver.resolveParameterType(this.writeMethodParameter, this.beanClass); } if (this.readMethod != null) { this.propertyType = GenericTypeResolver.resolveReturnType(this.readMethod, this.beanClass); } else if (this.writeMethodParameter != null) { this.propertyType = this.writeMethodParameter.getParameterType(); } this.propertyEditorClass = propertyEditorClass; }
From source file:org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase.java
/** * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel() *///from w w w .j a v a2 s . c o m public String getLabel() { String label = I18NUtil.getMessage(this.getTitleKey()); if (label == null) { // default to the name of the action with first letter capitalised label = StringUtils.capitalize(this.name); } return label; }
From source file:org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase.java
/** * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription() *///from ww w.ja va 2 s . c om public String getDescription() { String desc = I18NUtil.getMessage(this.getDescriptionKey()); if (desc == null) { // default to the name of the action with first letter capitalised desc = StringUtils.capitalize(this.name); } return desc; }
From source file:org.apache.usergrid.tools.Command.java
/** * @param args/*from w w w . ja v a 2s.c o m*/ */ public static void main(String[] args) { if ((args == null) || (args.length < 1)) { System.out.println("No command specified"); return; } String command = args[0]; Class<?> clazz = null; try { clazz = Class.forName(command); } catch (ClassNotFoundException e) { } if (clazz == null) { try { clazz = Class.forName("org.apache.usergrid.tools." + command); } catch (ClassNotFoundException e) { } } if (clazz == null) { try { clazz = Class.forName("org.apache.usergrid.tools." + StringUtils.capitalize(command)); } catch (ClassNotFoundException e) { e.printStackTrace(); } } if (clazz == null) { System.out.println("Unable to find command"); return; } args = Arrays.copyOfRange(args, 1, args.length); try { if (ToolBase.class.isAssignableFrom(clazz)) { ToolBase tool = (ToolBase) clazz.newInstance(); tool.startTool(args); } else { MethodUtils.invokeStaticMethod(clazz, "main", (Object) args); } } catch (NoSuchMethodException e) { System.out.println("Unable to invoke command"); e.printStackTrace(); } catch (IllegalAccessException e) { System.out.println("Unable to invoke command"); e.printStackTrace(); } catch (InvocationTargetException e) { System.out.println("Error while invoking command"); e.printStackTrace(); } catch (InstantiationException e) { System.out.println("Error while instantiating tool object"); e.printStackTrace(); } }
From source file:org.hopen.framework.rewrite.GenericTypeAwarePropertyDescriptor.java
public GenericTypeAwarePropertyDescriptor(Class beanClass, String propertyName, Method readMethod, Method writeMethod, Class propertyEditorClass) throws IntrospectionException { super(propertyName, null, null); this.beanClass = beanClass; this.propertyEditorClass = propertyEditorClass; Method readMethodToUse = BridgeMethodResolver.findBridgedMethod(readMethod); Method writeMethodToUse = BridgeMethodResolver.findBridgedMethod(writeMethod); if (writeMethodToUse == null && readMethodToUse != null) { // Fallback: Original JavaBeans introspection might not have found matching setter // method due to lack of bridge method resolution, in case of the getter using a // covariant return type whereas the setter is defined for the concrete property type. writeMethodToUse = ClassUtils.getMethodIfAvailable(this.beanClass, "set" + StringUtils.capitalize(getName()), readMethodToUse.getReturnType()); }/* w w w . j a v a 2s.c o m*/ this.readMethod = readMethodToUse; this.writeMethod = writeMethodToUse; if (this.writeMethod != null && this.readMethod == null) { // Write method not matched against read method: potentially ambiguous through // several overloaded variants, in which case an arbitrary winner has been chosen // by the JDK's JavaBeans Introspector... Set<Method> ambiguousCandidates = new HashSet<Method>(); for (Method method : beanClass.getMethods()) { if (method.getName().equals(writeMethodToUse.getName()) && !method.equals(writeMethodToUse) && !method.isBridge()) { ambiguousCandidates.add(method); } } if (!ambiguousCandidates.isEmpty()) { this.ambiguousWriteMethods = ambiguousCandidates; } } }
From source file:org.openspaces.pu.container.jee.context.BootstrapWebApplicationContextListener.java
public void contextInitialized(ServletContextEvent servletContextEvent) { ServletContext servletContext = servletContextEvent.getServletContext(); Boolean bootstraped = (Boolean) servletContext.getAttribute(BOOTSTRAP_CONTEXT_KEY); if (bootstraped != null && bootstraped) { logger.debug("Already performed bootstrap, ignoring"); return;//from w ww. j a v a2s. c om } servletContext.setAttribute(BOOTSTRAP_CONTEXT_KEY, true); logger.info("Booting OpenSpaces Web Application Support"); logger.info(ClassLoaderUtils.getCurrentClassPathString("Web Class Loader")); final ProcessingUnitContainerConfig config = new ProcessingUnitContainerConfig(); InputStream is = servletContext.getResourceAsStream(MARSHALLED_CLUSTER_INFO); if (is != null) { try { config.setClusterInfo((ClusterInfo) objectFromByteBuffer(FileCopyUtils.copyToByteArray(is))); servletContext.setAttribute(JeeProcessingUnitContainerProvider.CLUSTER_INFO_CONTEXT, config.getClusterInfo()); } catch (Exception e) { logger.warn("Failed to read cluster info from " + MARSHALLED_CLUSTER_INFO, e); } } else { logger.debug("No cluster info found at " + MARSHALLED_CLUSTER_INFO); } is = servletContext.getResourceAsStream(MARSHALLED_BEAN_LEVEL_PROPERTIES); if (is != null) { try { config.setBeanLevelProperties( (BeanLevelProperties) objectFromByteBuffer(FileCopyUtils.copyToByteArray(is))); servletContext.setAttribute(JeeProcessingUnitContainerProvider.BEAN_LEVEL_PROPERTIES_CONTEXT, config.getBeanLevelProperties()); } catch (Exception e) { logger.warn("Failed to read bean level properties from " + MARSHALLED_BEAN_LEVEL_PROPERTIES, e); } } else { logger.debug("No bean level properties found at " + MARSHALLED_BEAN_LEVEL_PROPERTIES); } Resource resource = null; String realPath = servletContext.getRealPath("/META-INF/spring/pu.xml"); if (realPath != null) { resource = new FileSystemResource(realPath); } if (resource != null && resource.exists()) { logger.debug("Loading [" + resource + "]"); // create the Spring application context final ResourceApplicationContext applicationContext = new ResourceApplicationContext( new Resource[] { resource }, null, config); // "start" the application context applicationContext.refresh(); servletContext.setAttribute(JeeProcessingUnitContainerProvider.APPLICATION_CONTEXT_CONTEXT, applicationContext); String[] beanNames = applicationContext.getBeanDefinitionNames(); for (String beanName : beanNames) { if (applicationContext.getType(beanName) != null) servletContext.setAttribute(beanName, applicationContext.getBean(beanName)); } if (config.getClusterInfo() != null && SystemBoot.isRunningWithinGSC()) { final String key = config.getClusterInfo().getUniqueName(); SharedServiceData.addServiceDetails(key, new Callable() { public Object call() throws Exception { ArrayList<ServiceDetails> serviceDetails = new ArrayList<ServiceDetails>(); Map map = applicationContext.getBeansOfType(ServiceDetailsProvider.class); for (Iterator it = map.values().iterator(); it.hasNext();) { ServiceDetails[] details = ((ServiceDetailsProvider) it.next()).getServicesDetails(); if (details != null) { for (ServiceDetails detail : details) { serviceDetails.add(detail); } } } return serviceDetails.toArray(new Object[serviceDetails.size()]); } }); SharedServiceData.addServiceMonitors(key, new Callable() { public Object call() throws Exception { ArrayList<ServiceMonitors> serviceMonitors = new ArrayList<ServiceMonitors>(); Map map = applicationContext.getBeansOfType(ServiceMonitorsProvider.class); for (Iterator it = map.values().iterator(); it.hasNext();) { ServiceMonitors[] monitors = ((ServiceMonitorsProvider) it.next()) .getServicesMonitors(); if (monitors != null) { for (ServiceMonitors monitor : monitors) { serviceMonitors.add(monitor); } } } return serviceMonitors.toArray(new Object[serviceMonitors.size()]); } }); Map map = applicationContext.getBeansOfType(MemberAliveIndicator.class); for (Iterator it = map.values().iterator(); it.hasNext();) { final MemberAliveIndicator memberAliveIndicator = (MemberAliveIndicator) it.next(); if (memberAliveIndicator.isMemberAliveEnabled()) { SharedServiceData.addMemberAliveIndicator(key, new Callable<Boolean>() { public Boolean call() throws Exception { return memberAliveIndicator.isAlive(); } }); } } map = applicationContext.getBeansOfType(ProcessingUnitUndeployingListener.class); for (Iterator it = map.values().iterator(); it.hasNext();) { final ProcessingUnitUndeployingListener listener = (ProcessingUnitUndeployingListener) it .next(); SharedServiceData.addUndeployingEventListener(key, new Callable() { public Object call() throws Exception { listener.processingUnitUndeploying(); return null; } }); } map = applicationContext.getBeansOfType(InternalDumpProcessor.class); for (Iterator it = map.values().iterator(); it.hasNext();) { SharedServiceData.addDumpProcessors(key, it.next()); } } } else { logger.debug("No [" + ApplicationContextProcessingUnitContainerProvider.DEFAULT_PU_CONTEXT_LOCATION + "] to load"); } // load jee specific context listener if (config.getBeanLevelProperties() != null) { String jeeContainer = JeeProcessingUnitContainerProvider .getJeeContainer(config.getBeanLevelProperties()); String className = "org.openspaces.pu.container.jee." + jeeContainer + "." + StringUtils.capitalize(jeeContainer) + "WebApplicationContextListener"; Class clazz = null; try { clazz = Thread.currentThread().getContextClassLoader().loadClass(className); } catch (ClassNotFoundException e) { // no class, ignore } if (clazz != null) { try { jeeContainerContextListener = (ServletContextListener) clazz.newInstance(); } catch (Exception e) { throw new RuntimeException( "Failed to create JEE specific context listener [" + clazz.getName() + "]", e); } jeeContainerContextListener.contextInitialized(servletContextEvent); } } // set the class loader used so the service bean can use it if (config.getClusterInfo() != null && SystemBoot.isRunningWithinGSC()) { SharedServiceData.putWebAppClassLoader(config.getClusterInfo().getUniqueName(), Thread.currentThread().getContextClassLoader()); } }