Package com.adito.extensions

Examples of com.adito.extensions.ExtensionException


        if (element.getName().equals(TYPE)) {

            // Plugin name
            String name = element.getAttributeValue("name");
            if (name == null || name.equals("")) {
                throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                    "The name attribute must be supplied for <languagePack> elements.");
            }

            // Create the definition
            packDefinition = new LanguagePackDefinition(descriptor, name);
            LanguagePackManager.getInstance().addLanguagePackDefinition(packDefinition);

            for (Iterator i = element.getChildren().iterator(); i.hasNext();) {
                Element el = (Element) i.next();
                if (el.getName().equals("classpath")) {
                    String path =  Util.trimmedBothOrBlank(el.getText());
                    if (path != null && !path.equals("")) {
                        File f = new File(descriptor.getApplicationBundle().getBaseDir(), path);
                        if (f.exists()) {
                            try {
                                URL u = f.toURL();
                                if (log.isInfoEnabled())
                                    log.info("Adding " + u + " to classpath");
                                packDefinition.addClassPath(u);
                            } catch (MalformedURLException murle) {
                            }
                        } else {
                            if (!"true".equals(SystemProperties.get("adito.useDevConfig"))) {
                                log.warn("Plugin classpath element " + f.getAbsolutePath() + " does not exist.");
                            }
                        }
                    }
                } else if (el.getName().equals("date")) {
                    String date = Util.trimmedBothOrBlank(el.getText());
                    if (Util.isNullOrTrimmedBlank(date)) {
                        throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                            "The content of the <date> must contain the creation date of the language in the pack.");
                    }
                    packDefinition.setDate(date);
                } else if (el.getName().equals("language")) {
                    String code = el.getAttributeValue("code");
                    if (code == null || code.equals("")) {
                        throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                            "The code attribute must be supplied for <language> elements.");
                    }
                    String description = Util.trimmedBothOrBlank(el.getText());
                    if (Util.isNullOrTrimmedBlank(description)) {
                        throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                            "The content of the <language> must contain the description of the language in the pack.");
                    }
                    packDefinition.addLanguage(new Language(packDefinition, code, description));
                } else {
                    throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                        "The <language> element only supports the nested <classpath> elements");
                }
            }
           
            // Now add the classpath. We will only do this once until the dynamic classloader is written
View Full Code Here


    public void startPlugin(PluginDefinition definition, ExtensionDescriptor descriptor, Element element) throws ExtensionException {
        super.startPlugin(definition, descriptor, element);
        try {
            initExtensionTypes();
        } catch (Exception e) {
            throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e);
        }
    }
View Full Code Here

      initPageTasks();
            CoreUtil.updateEventsTable(ApplicationsPlugin.MESSAGE_RESOURCES_KEY, ApplicationShortcutEventConstants.class);
      CoreServlet.getServlet().addCoreListener(this);
    } catch (Exception e) {
            e.printStackTrace();
      throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e);
    }
  }
View Full Code Here

            removeTableItemActions();
            removeMainMenu();
            removePageTasks();
            CoreServlet.getServlet().removeCoreListener(this);
        } catch (Exception e) {
            throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e, "Failed to start.");
        }
    }
View Full Code Here

            initMainMenu();
            initPageTasks();
            initService();
            CoreUtil.updateEventsTable(TunnelPlugin.MESSAGE_RESOURCES_KEY, TunnelsEventConstants.class);
        } catch (Exception e) {
            throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e, e.getLocalizedMessage());
        }
    }
View Full Code Here

            removeTableItemActions();
            removeMainMenu();
            removePageTasks();
            stopService();
        } catch (Exception e) {
            throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e);
        }
    }
View Full Code Here

TOP

Related Classes of com.adito.extensions.ExtensionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.