public void setBeanProperty( Object target, String name, String val ) { if( val!=null ) val=IntrospectionUtils.replaceProperties( val, props, null ); if( log.isDebugEnabled()) log.debug( "setProperty " + target + " " + name + "=" + val ); IntrospectionUtils.setProperty( target, name, val ); }
/** * Process the end of this element. */ public void end() throws Exception { // Identify the objects to be used Object child = digester.peek(0); Object parent = digester.root; if (digester.log.isDebugEnabled()) { if (parent == null) { digester.log.debug("[SetRootRule]{" + digester.match + "} Call [NULL ROOT]." + methodName + "(" + child + ")"); } else { digester.log.debug("[SetRootRule]{" + digester.match + "} Call " + parent.getClass().getName() + "." + methodName + "(" + child + ")"); } } // Call the specified method IntrospectionUtils.callMethod1(parent, methodName, child, paramType, digester.getClassLoader()); }
public void _setExecutor(Connector con, Executor ex) throws Exception { Method m = IntrospectionUtils.findMethod(con.getProtocolHandler().getClass(),"setExecutor",new Class[] {java.util.concurrent.Executor.class}); if (m!=null) { m.invoke(con.getProtocolHandler(), new Object[] {ex}); }else { log.warn("Connector ["+con+"] does not support external executors. Method setExecutor(java.util.concurrent.Executor) not found."); } }
/** */ public static void setProperty(Object o, String name) { String setter = "set" + capitalize(name); try { Method methods[] = findMethods(o.getClass()); Method setPropertyMethod = null; // find setFoo() method for (int i = 0; i < methods.length; i++) { Class paramT[] = methods[i].getParameterTypes(); if (setter.equals(methods[i].getName()) && paramT.length == 0) { methods[i].invoke(o, new Object[] {}); return; } } } catch (Exception ex1) { if (dbg > 0) d("Exception for " + o.getClass() + " " + name); if (dbg > 1) ex1.printStackTrace(); } }
/** */ public static void setProperty(Object o, String name) { String setter = "set" + capitalize(name); try { Method methods[] = findMethods(o.getClass()); // find setFoo() method for (int i = 0; i < methods.length; i++) { Class<?> paramT[] = methods[i].getParameterTypes(); if (setter.equals(methods[i].getName()) && paramT.length == 0) { methods[i].invoke(o, new Object[] {}); return; } } } catch (Exception ex1) { if (log.isDebugEnabled()) log.debug("IntrospectionUtils: Exception for " + o.getClass() + " " + name, ex1); } }
if (paramCount > 0) { parameters = (Object[]) digester.popParams(); if (digester.log.isTraceEnabled()) { for (int i=0,size=parameters.length;i<size;i++) { digester.log.trace("[CallMethodRule](" + i + ")" + parameters[i]) ; IntrospectionUtils.convert((String) parameters[i], paramTypes[i]); } else { paramValues[i] = parameters[i]; target = digester.peek(targetOffset); } else { target = digester.peek( digester.getCount() + targetOffset ); if (digester.log.isDebugEnabled()) { StringBuffer sb = new StringBuffer("[CallMethodRule]{"); sb.append(digester.match); digester.log.debug(sb.toString()); Object result = IntrospectionUtils.callMethodN(target, methodName, paramValues, paramTypes); processMethodCallResult(result);
/** * unregister all cluster valve to host or engine * @throws Exception * @throws ClassNotFoundException */ protected void unregisterClusterValve() throws Exception { for (Iterator<Valve> iter = valves.iterator(); iter.hasNext();) { ClusterValve valve = (ClusterValve) iter.next(); if (log.isDebugEnabled()) log.debug("Invoking removeValve on " + getContainer() + " with class=" + valve.getClass().getName()); if (valve != null) { IntrospectionUtils.callMethodN(getContainer(), "removeValve", new Object[] { valve }, new Class[] { org.apache.catalina.Valve.class }); valve.setCluster(this); } } }
parameters = (Object[]) digester.popParams(); } else { parameters = new Object[0]; && !String.class.isAssignableFrom(paramTypes[i]))) { paramValues[i] = IntrospectionUtils.convert((String) parameters[i], paramTypes[i]); } else { paramValues[i] = parameters[i]; target = digester.peek(targetOffset); } else { target = digester.peek(digester.getCount() + targetOffset); IntrospectionUtils.callMethodN(target, methodName, paramValues, paramTypes); return; && !String.class.isAssignableFrom(paramTypes[multiParamIndex]))) { paramValues[multiParamIndex] = IntrospectionUtils.convert((String) param, paramTypes[multiParamIndex]); } else { paramValues[multiParamIndex] = param; IntrospectionUtils.callMethodN(target, methodName, paramValues, paramTypes);
/** * Handle the beginning of an XML element. * * @param attributes The attributes of this element * * @exception Exception if a processing error occurs */ @Override public void begin(String namespace, String nameX, Attributes attributes) throws Exception { for (int i = 0; i < attributes.getLength(); i++) { String name = attributes.getLocalName(i); if ("".equals(name)) { name = attributes.getQName(i); } String value = attributes.getValue(i); if ( !excludes.containsKey(name)) { if (!digester.isFakeAttribute(digester.peek(), name) && !IntrospectionUtils.setProperty(digester.peek(), name, value) && digester.getRulesValidation()) { digester.getLogger().warn("[SetAllPropertiesRule]{" + digester.getMatch() + "} Setting property '" + name + "' to '" + value + "' did not find a matching property."); } } } }
} else { catalinaHome = IntrospectionUtils.guessInstall (Globals.CATALINA_HOME_PROP, Globals.CATALINA_BASE_PROP, "catalina.jar"); if (catalinaHome == null) { catalinaHome = IntrospectionUtils.guessInstall ("tomcat.install", Globals.CATALINA_HOME_PROP, "tomcat.jar"); if (temp == null || (!(new File(temp)).exists()) || (!(new File(temp)).isDirectory())) { log.error(sm.getString("embedded.notmp", temp));
private void setClassLoaderProperty(String name, boolean value) { ClassLoader cl = getLoader().getClassLoader(); if (!IntrospectionUtils.setProperty(cl, name, Boolean.toString(value))) { // Failed to set log.info(sm.getString( "standardContext.webappClassLoader.missingProperty", name, Boolean.toString(value))); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { Enumeration<String> paramNames = filterConfig.getInitParameterNames(); while (paramNames.hasMoreElements()) { String paramName = paramNames.nextElement(); if (!IntrospectionUtils.setProperty(this, paramName, filterConfig.getInitParameter(paramName))) { getLogger().warn(sm.getString("filterbase.noSuchProperty", paramName, this.getClass().getName())); } } }
/** * Process the end of this element. */ public void end() throws Exception { // Identify the objects to be used Object child = digester.peek(0); Object parent = digester.peek(1); NamingResources namingResources = null; if (parent instanceof Context) { namingResources = ((Context) parent).getNamingResources(); } else { namingResources = (NamingResources) parent; } // Call the specified method IntrospectionUtils.callMethod1(namingResources, methodName, child, paramType, digester.getClassLoader()); }
public static Object getProperty(Object o, String name) { String getter = "get" + capitalize(name); String isGetter = "is" + capitalize(name); Method methods[] = findMethods(o.getClass()); Method getPropertyMethod = null; log.warn("IAE " + o + " " + name, ex2); } catch (SecurityException ex1) { if (dbg > 0)
private void guessHome() { String home= wEnv.getJkHome(); if( home != null ) return; home=IntrospectionUtils.guessInstall( "jk2.home","jk2.home", "tomcat-jk2.jar", CNAME ); if( home != null ) { log.info("Guessed home " + home ); wEnv.setJkHome( home ); } }
/** * Handle the beginning of an XML element. * * @param attributes The attributes of this element * * @exception Exception if a processing error occurs */ public void begin(String namespace, String nameX, Attributes attributes) throws Exception { for (int i = 0; i < attributes.getLength(); i++) { String name = attributes.getLocalName(i); if ("".equals(name)) { name = attributes.getQName(i); } String value = attributes.getValue(i); IntrospectionUtils.setProperty(digester.peek(), name, value); } }
/** * Find a method with the right name If found, call the method ( if param is * int or boolean we'll convert value to the right type before) - that means * you can have setDebug(1). */ public static boolean setProperty(Object o, String name, String value) { return setProperty(o,name,value,true); } public static boolean setProperty(Object o, String name, String value,
/** * Return a property from the protocol handler. * * @param name the property name * @return the property value */ public Object getProperty(String name) { if (protocolHandler == null) { return null; } return IntrospectionUtils.getProperty(protocolHandler, name); }
IntrospectionUtils.clear();
public static String guessInstall(String installSysProp, String homeSysProp, String jarName) { return guessInstall(installSysProp, homeSysProp, jarName, null); }