Package com.adito.extensions

Examples of com.adito.extensions.ExtensionException


      initUploadHandler();
      initTagLib();
      initService();
            CoreUtil.updateEventsTable(NetworkPlacePlugin.MESSAGE_RESOURCES_KEY, NetworkPlacesEventConstants.class);
    } catch (Exception e) {
      throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e, "Failed to start.");
    }
  }
View Full Code Here


            removePageTasks();
            removeFileSystems();
            removeUploadHandler();
            removeTagLib();
        } catch (Exception e) {
            throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e, "Failed to start.");
        }
    }
View Full Code Here

    void readConfiguration(ExtensionDescriptor descriptor, Element element) throws ExtensionException {

        // 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 <plugin> elements (" + descriptor.getApplicationBundle().getFile().getPath() + ").");
        }

        // Plugin classname
        String className = element.getAttributeValue("class");
        if (className == null || className.equals("")) {
            throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                "The class attribute must be supplied for <plugin> elements (" + descriptor.getApplicationBundle().getFile().getPath() + ").");
        }

        // Order
        String orderText = element.getAttributeValue("order");
        int order = 999;
        if (orderText != null && !orderText.equals("")) {
            order = Integer.parseInt(orderText);
        }
       
        isolate = "true".equals(element.getAttributeValue("isolate"));

        // Optional
        String dependencies = element.getAttributeValue("dependencies");
        if (dependencies != null) {
            log.warn("DEPRECATED. dependencies attribute in plugin definition in "
                + descriptor.getApplicationBundle().getFile().getAbsolutePath() + " should now use 'depends'.");
        } else {
            dependencies = element.getAttributeValue("depends");
        }

        def = new PluginDefinition(descriptor);

        // Required
        def.setName(name);
        def.setClassName(className);

        // Optional
        def.setOrder(order);

        /* If this is a dev extension, we generate the paths to add */
        if(!descriptor.getApplicationBundle().isDevExtension()) {
          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.equals("")) {
                      File f = new File(descriptor.getApplicationBundle().getBaseDir(), path);
                      if (f.exists()) {
                          try {
                  // NOTE - Do not fix this deprecation warning (Java 6+). It will break plugin JSP compiling. See brett
                              URL u = f.getCanonicalFile().toURL();
                              if (log.isInfoEnabled())
                                  log.info("Adding " + u + " to classpath");
                              def.addClassPath(u);
                          } catch (IOException murle) {
                              throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                                  murle, "Invalid classpath.");
                          }
                      } else {
                          if (!"true".equals(SystemProperties.get("adito.useDevConfig"))) {
                              log.warn("Plugin classpath element " + f.getAbsolutePath() + " does not exist.");
                          }
                      }
                  }
              } else if (el.getName().equals("resources")) {
                  File f = new File(descriptor.getApplicationBundle().getBaseDir(), el.getText());
                  if (f.exists() && f.isDirectory()) {
                      try {
                            // NOTE - Do not fix this deprecation warning (Java 6+). It will break plugin JSP compiling. See brett
                          def.addResourceBase(f.getCanonicalFile().toURL());
                      } catch (Exception ex) {
                          throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR, ex, "Invalid resource base.");
                      }
                  } else {
                      if (log.isInfoEnabled())
                          log.info("<resources> element does not point to a valid directory.");
                  }
              } else if (el.getName().equals("native")) {
                  File f = new File(descriptor.getApplicationBundle().getBaseDir(), el.getText());
                  if (f.exists() && f.isDirectory()) {
                      try {
                          def.addNativeDirectory(f.getCanonicalFile());
                      } catch (Exception ex) {
                          throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                              ex, "Invalid native directory.");
                      }
                  } else {
                      if (log.isInfoEnabled())
                          log.info("<native> element does not point to a valid directory.");
                  }
              } else {
                  throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                      "The <plugin> element only supports the nested <classpath>, <resources> or <native> elements");
              }
          }
        }
       
View Full Code Here

            log.info("Creating plugin " + def.getClassName());
          }
          Class pluginClass = Class.forName(def.getClassName(), true, classLoader);
            plugin = (Plugin) pluginClass.newInstance();
        } catch (Exception e) {
            throw new ExtensionException(ExtensionException.FAILED_TO_CREATE_PLUGIN_INSTANCE,
                def.getName(),
                def.getClassName(),
                e.getMessage(),
                e);
        }
View Full Code Here

            for (URL url : def.getResourceBases()) {
                ContextHolder.getContext().removeResourceBase(url);
            }
            throw e;
        } catch (ServletException se) {
            throw new ExtensionException(ExtensionException.INTERNAL_ERROR, se);
        }
    }
View Full Code Here

          if(descriptor.containsFile("launcher-en.jar")) {
            ContextHolder.getContext().addContextLoaderURL(descriptor.getFile("launcher-en.jar").toURL());
          }
        }
        catch(IOException ioe) {
            throw new ExtensionException(ExtensionException.INTERNAL_ERROR, ioe, "Failed to configure classpath for agent.");
        }
    }
View Full Code Here

                        HttpServletResponse response, Properties properties)
          throws JDOMException, Exception {
    try {
      SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request);
      if(session == null) {
        throw new ExtensionException(ExtensionException.INTERNAL_ERROR, "No session.");
      }
      sendApplicationDescriptor(app, request, response, session, properties);

    } catch (CoreException coreException) {
      String message = coreException.getLocalizedMessage(request.getSession());
View Full Code Here

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

            jre = element.getAttribute("jre").getValue();

            if (jre == null) {
                throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
                    "<application> element requires attribute 'jre'");
            }

            try {
                ExtensionDescriptor.getVersion(jre);
            } catch (Throwable ex) {
                throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR, "Invalid value '" + jre
                    + "' specified for 'jre' attribute");
            }

            for (Iterator it = element.getChildren().iterator(); it.hasNext();) {
                Element e = (Element) it.next();

                if (e.getName().equalsIgnoreCase("classpath")) {
                    verifyClasspath(e);
                } else if (e.getName().equalsIgnoreCase("main")) {
                    verifyMain(e);
                } else {
                    throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR, "Unexpected element <"
                        + e.getName() + "> found in <application>");
                }
            }

        }
View Full Code Here

            if (e.getName().equalsIgnoreCase("jar")) {
                descriptor.processFile(e);
            } else if (e.getName().equals("if")) {
                verifyClasspath(e);
            } else {
                throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR, "Invalid element <" + e.getName()
                    + "> found in <classpath>");
            }
        }
    }
View Full Code Here

        for (Iterator it = element.getChildren().iterator(); it.hasNext();) {
            Element e = (Element) it.next();
            if (e.getName().equalsIgnoreCase("if")) {
                verifyMain(e);
            } else if (!e.getName().equalsIgnoreCase("env"&& !e.getName().equalsIgnoreCase("arg") && !e.getName().equalsIgnoreCase("jvm")) {
                throw new ExtensionException(ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR, "Unexpected element <" + e.getName()
                    + "> found in <main>");
            }
        }
    }
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.