Package net.sf.pipet.api

Examples of net.sf.pipet.api.InvalidConfigurationException


      urlobj = new URL(current_dir, url);
      JarFile f = new JarFile(new File(urlobj.toURI()));
     
      Manifest m = f.getManifest();
      if (m == null)
        throw new InvalidConfigurationException(String.format("Jar file '%s' has no manifest file.", urlobj.toString()));
   
      classname = m.getMainAttributes().getValue(MANIFEST_ENTRY);
      if (classname == null)
        throw new InvalidConfigurationException(String.format("Manifest file of '%s' has no '%s' entry.", f.getName(), MANIFEST_ENTRY));
     
      URLClassLoader loader = new URLClassLoader(new URL[] {urlobj});
      return loadClass(classname, loader, res);
    }
    catch (MalformedURLException e)
    {
      throw new InvalidConfigurationException(String.format("Malformed URL: %s", url));
    }
    catch (URISyntaxException e)
    {
      throw new InvalidConfigurationException(String.format("Malformed URL: %s", url));
    }
    catch (IOException e)
    {
      throw new InvalidConfigurationException(String.format("Read error: %s", urlobj.toString()));
    }
  }
View Full Code Here


     
      return plugin;
    }
    catch (java.lang.NoClassDefFoundError e)
    {
      throw new InvalidConfigurationException(String.format("Missing class definition while instantiating %s: %s", classname, e.getMessage()));
    }
    catch (ClassNotFoundException e)
    {
      throw new InvalidConfigurationException(String.format("Java class '%s' not found.", classname));
    }
    catch (ClassCastException e)
    {
      throw new InvalidConfigurationException(String.format("Class %s cannot be cast to %s.", classname, ModuleResourcePlugin.class.getName()));
    }
    catch (IllegalAccessException e)
    {
      throw new InvalidConfigurationException("Not permitted to instantiate class: "+classname, e);
    }
    catch (InstantiationException e)
    {
      throw new InvalidConfigurationException(String.format("Class %s cannot be instantiated - it is declared abstract?", classname));
    }
    catch(Exception e)
    {
      throw new InvalidConfigurationException(String.format("Java class '%s' could not be instantiated.", classname), e);
    }
  }
View Full Code Here

  public static ModuleInterface loadModuleInterface(String uri, Configuration cfg)
    throws InvalidConfigurationException, ResourceException
  {
    int sep = uri.indexOf(':');
    if (sep == -1)
      throw new InvalidConfigurationException("Invalid URI: "+uri);
   
    String pluginname = uri.substring(0, sep);
   
    ModuleResourcePlugin plugin = cfg.getModuleResourcePlugin(pluginname);
    if (plugin == null)
      throw new InvalidConfigurationException("No scheme available for loading module: "+uri);
   
    String modspec = uri.substring(sep+1);
    return plugin.getModuleInterface(modspec, cfg);
  }
View Full Code Here

    if (uri.startsWith(class_prefix))
      return loadClass(uri.substring(class_prefix.length()), ModuleLoader.class.getClassLoader(), res);
    else if (uri.startsWith(jar_prefix))
      return loadFromJar(uri.substring(jar_prefix.length()), res);
    else
      throw new InvalidConfigurationException("Unrecognized interface.");
  }
View Full Code Here

    for (int i=0 ; i<groupnodes.getLength() ; i++)
    {
      Element ge = (Element)groupnodes.item(i);
      String name = getAttribute(ge, "name");
      if (name == null)
        throw new InvalidConfigurationException("Group has no name.");
     
      auth.addGroup(name);
      parseMembers(auth, name, ge);
    }
  }
View Full Code Here

    for (int i=0 ; i<nodes.getLength() ; i++)
    {
      Element member = (Element)nodes.item(i);
      String name = getAttribute(member, "name");
      if (name == null)
        throw new InvalidConfigurationException("Group member has no name.");
     
      auth.addGroupMember(group, name);
    }
  }
View Full Code Here

    {
      Element user = (Element)unodes.item(i);
      String name = getAttribute(user, "name");
      String pass = getAttribute(user, "password");
      if (name == null)
        throw new InvalidConfigurationException("User has no name.");
     
      auth.addUser(name, pass);
    }
  }
View Full Code Here

      if (policyname == null)
        continue;
     
      CachePolicy policy = cfg.getCachePolicy(policyname);
      if (policy == null)
        throw new InvalidConfigurationException("Reference to unknown cache policy: "+policyname);
     
      return policy;
    }
   
    return null;
View Full Code Here

    String modid = getAttribute(modnode, "id");
    String modref = getAttribute(modnode, "ref");
    String url = getAttribute(modnode, "url");

    if (modid == null)
      throw new InvalidConfigurationException("Unnamed module.");

    if (url == null && modref == null)
      modref = modid; // compatibility

    ModuleDefinition parent;
    if (modref != null)
    {
      parent = id2mod.get(modref);
      if (parent == null)
        throw new InvalidConfigurationException(String.format("Module %s: Module interface specification is missing.", modid));
    }
    else
      parent = cfg.getRootModule();
   
    ModuleInterface iface = null;
    if (url!=null)
      iface = new ModuleInterfaceFrontend(cfg, url);
   
    Map<String,UntypedValue> atts = extractAttributes(modnode);
   
    if (pipeline_mods == null)
    {
      ModuleDefinition moddef = ModuleDefinition.create(parent, url, iface, extractCachePolicy(modnode), atts);
      if (moddef.getInterface() == null)
        throw new InvalidConfigurationException(String.format("Module %s: Incomplete module definition.", modid));
      mod2id.put(moddef, modid);
      if (!id2mod.containsKey(modid))
      {
        cfg.addModule(moddef);
        for (String path : extractExportPaths(modnode))
          cfg.getExports().put(path, moddef);

        id2mod.put(modid, moddef);
      }
     
      return moddef;
    }
    else
    {
      PipelineModule moddef = new PipelineModule(parent, extractCachePolicy(modnode), atts);
      if (moddef.getInterface() == null)
        throw new InvalidConfigurationException(String.format("Module %s: Incomplete module definition.", modid));
      pipeline_mods.put(modid, moddef);

      return moddef;
    }
  }
View Full Code Here

      XPath xpath = xpathfactory.newXPath();
      return (NodeList)xpath.evaluate(expression, dom, XPathConstants.NODESET);
    }
    catch (XPathExpressionException e)
    {
      throw new InvalidConfigurationException(String.format("Unable to evaluate X path expression: %s", expression), e);
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.pipet.api.InvalidConfigurationException

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.