Changeset 4233
- Timestamp:
- Apr 17, 2008, 3:05:50 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/ExtensionsControl.java
r4221 r4233 216 216 } 217 217 218 public static String getHomeUrl(String extensionId) 219 { 220 ExtensionsFile file = extensionsDir.getFileByExtensionId(extensionId); 221 return file == null ? null : extensionsDir.getResourcesUrl(file); 222 } 223 218 224 private final Set<Permission> permissions; 219 225 private ExtensionsControl(Set<Permission> permissions) -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/ExtensionsDirectory.java
r4221 r4233 584 584 for (ExtensionsFile extFile : installedFiles.values()) 585 585 { 586 // Update the last modified information587 extFile.resetModified();588 589 586 // Do not register extensions that has an error 590 587 if (extFile.hasError()) continue; … … 610 607 for (ExtensionsFile extFile : installedFiles.values()) 611 608 { 612 // Do not register extensions that has an error613 if (extFile.hasError()) continue;614 615 609 try 616 610 { 617 int num = extFile.registerExtensions(registry, forceUpdate); 618 results.addMessage(extFile, num + " extensions registered."); 619 } 620 catch (Throwable ex) 621 { 622 extFile.setError(true); 623 results.addErrorMessage(extFile, 624 "Could not register extensions: " + ex.getMessage()); 625 log.error("Could not register extensions from " + extFile.getName(), ex); 611 // Do not register extensions that has an error 612 if (extFile.hasError()) continue; 613 614 try 615 { 616 int num = extFile.registerExtensions(registry, forceUpdate); 617 results.addMessage(extFile, num + " extensions registered."); 618 } 619 catch (Throwable ex) 620 { 621 extFile.setError(true); 622 results.addErrorMessage(extFile, 623 "Could not register extensions: " + ex.getMessage()); 624 log.error("Could not register extensions from " + extFile.getName(), ex); 625 } 626 } 627 finally 628 { 629 // Update the last modified information 630 extFile.resetModified(); 626 631 } 627 632 } -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/menu/PermissionMenuItemFactory.java
r4207 r4233 129 129 { 130 130 SessionControl sc = context.getClientContext().getSessionControl(); 131 boolean is Enabled= hasPermission(sc, visiblePermission);132 return is Enabled&& super.prepareContext(context);131 boolean isVisible = hasPermission(sc, visiblePermission); 132 return isVisible && super.prepareContext(context); 133 133 } 134 134 // ------------------------------------ -
trunk/src/core/net/sf/basedb/util/ClassUtil.java
r3820 r4233 27 27 28 28 import java.lang.reflect.Constructor; 29 import java.lang.reflect.Method; 29 30 import java.util.Set; 30 31 import java.util.HashSet; … … 145 146 return clazz; 146 147 } 148 149 /** 150 Find a method in a <code>clazz</code> with the given <code>name</code> 151 that takes the given list of <code>arguments</code>. This method is 152 just calling {@link Class#getMethod(String, Class...)} but returns 153 null instead of throwing an exception in case the method is not found. 154 155 @param clazz The class to look for the method in 156 @param name The name of the method 157 @param arguments The class types of the arguments 158 @return The method or null if not found 159 @since 2.7 160 */ 161 public static Method findMethod(Class<?> clazz, String name, Class<?>... arguments) 162 { 163 Method m = null; 164 try 165 { 166 m = clazz.getMethod(name, arguments); 167 } 168 catch (NoSuchMethodException ex) 169 {} 170 return m; 171 } 147 172 148 173 } -
trunk/src/core/net/sf/basedb/util/extensions/ExtensionsInvoker.java
r4207 r4233 57 57 { 58 58 59 private static final org.apache.log4j.Logger log = 60 org.apache.log4j.LogManager.getLogger("net.sf.basedb.util.extensions.ExtensionsInvoker"); 61 59 62 final Collection<InvokationContext<A>> contexts; 60 63 … … 90 93 while (it.hasNext()) 91 94 { 92 A action = it.next();93 Renderer<? super A> renderer = it.getRenderer();94 if (renderer == null)95 A action = null; 96 Renderer<? super A> renderer = null; 97 try 95 98 { 96 throw new NullPointerException("No renderer for extension: " + it.getExtension()); 99 action = it.next(); 100 renderer = it.getRenderer(); 101 if (renderer == null) 102 { 103 throw new NullPointerException("No renderer for extension: " + it.getExtension()); 104 } 105 renderer.render(action); 97 106 } 98 renderer.render(action); 107 catch (RuntimeException ex) 108 { 109 log.error("Could not render action '" + action + "' with renderer '" + 110 renderer + "'", ex); 111 } 99 112 } 100 113 } … … 113 126 while (it.hasNext()) 114 127 { 115 renderer.render(it.next()); 128 A action = null; 129 try 130 { 131 action = it.next(); 132 renderer.render(action); 133 } 134 catch (RuntimeException ex) 135 { 136 log.error("Could not render action '" + action + "' with renderer '" + 137 renderer + "'", ex); 138 } 116 139 } 117 140 } -
trunk/src/core/net/sf/basedb/util/extensions/Registry.java
r4208 r4233 151 151 throw new InvalidUseOfNullException("extensionPoint.id of " + extensionPoint); 152 152 } 153 Class<A> ac = extensionPoint.getActionClass();154 if (ac == null)153 Class<A> actionClass = extensionPoint.getActionClass(); 154 if (actionClass == null) 155 155 { 156 156 throw new InvalidUseOfNullException("Action class of extensionPoint[id=" + id + "]"); 157 157 } 158 if (!Action.class.isAssignableFrom(ac ))159 { 160 throw new ClassCastException("Action class '" + ac .getName() +158 if (!Action.class.isAssignableFrom(actionClass)) 159 { 160 throw new ClassCastException("Action class '" + actionClass.getName() + 161 161 "' of extensionPoint[id=" + id + "] doesn't implement the 'Action' class"); 162 162 } … … 254 254 throw new InvalidUseOfNullException("extension.id of " + extension); 255 255 } 256 if (extension.getActionFactory() == null) 257 { 258 throw new InvalidUseOfNullException("Action factory of extension[id=" + id + "]"); 256 ActionFactory<?> actionFactory = extension.getActionFactory(); 257 if (actionFactory == null) 258 { 259 throw new InvalidUseOfNullException("Action factory for extension '" + id + "' is null."); 259 260 } 260 261 -
trunk/src/core/net/sf/basedb/util/extensions/xml/VariableConverter.java
r4198 r4233 90 90 String variable = m.group(1); 91 91 String value = variables.get(variable); 92 m.appendReplacement(sb, value == null ? m.group() : value); 92 if (value == null) value = m.group(); 93 m.appendReplacement(sb, Matcher.quoteReplacement(value)); 93 94 } 94 95 m.appendTail(sb);
Note: See TracChangeset
for help on using the changeset viewer.