Examples of Plug


Examples of net.sf.pipet.api.Plug

      {
        JOptionPane.showMessageDialog(parent, "The destination module has no input ports.", "Cannot link modules", JOptionPane.ERROR_MESSAGE);
        return null;
      }
   
      Plug source = null;
      Plug dest = null;
      if (origin.getOutputPipeTypes().size() == 1 && target.getInputPipeTypes().size() == 1)
      {
        source = new Plug(origin, origin.getOutputPipeTypes().keySet().iterator().next());
        dest = new Plug(target, target.getInputPipeTypes().keySet().iterator().next());
      }
      else
      {
        CreateEdgeDialog dlg = new CreateEdgeDialog(origin, target);
        int result = JOptionPane.showConfirmDialog(parent, dlg, "Create a pipe", JOptionPane.OK_CANCEL_OPTION);
View Full Code Here

Examples of net.sf.pipet.api.Plug

      {
        Collection<Plug> plugs = e.getValue();
        if (plugs.isEmpty())
          continue;
       
        Plug plug = plugs.iterator().next();
        String ctype = is_input ?
            plug.getModule().getInputPipeTypes().get(plug.getPort()) :
            plug.getModule().getOutputPipeTypes().get(plug.getPort()) ;
       
        lst.add(String.format("%s[%s]", e.getKey(), ctype));
      }
     
      return StringUtils.join(lst, " ");
View Full Code Here

Examples of net.sf.pipet.api.Plug

    else for (String port : pipes.keySet())
    {
      //if (pane.getComponentCount() > 0)
      //  pane.add(new JSeparator(SwingConstants.HORIZONTAL));

      Plug plug = new Plug(mod, port);
      if (show_output_pipes)
        pane.add(createPipePane(port, getOutputPipes(port), getImportExportPorts(pipeline.getOutputPipes(), plug), plug, null));
      else
        pane.add(createPipePane(port, getInputPipes(port), getImportExportPorts(pipeline.getInputPipes(), plug), null, plug));
    }
View Full Code Here

Examples of net.sf.pipet.api.Plug

    if (source != null)
      options.add(new PlugOption("EXPORT"));
    if (target != null)
      options.add(new PlugOption("IMPORT"));
   
    Plug plug = source==null?target:source;
    try
    {
      String ctype = source==null ? plug.getModule().getInputPipeTypes().get(plug.getPort()) : plug.getModule().getOutputPipeTypes().get(plug.getPort());
      for (PipelineModule m : pipeline.getModules())
      {
        for (Entry<String,String> candidate : (source==null?m.getOutputPipeTypes():m.getInputPipeTypes()).entrySet())
        {
          if (cfg.getEnforceConnectorCompatibility() && !candidate.getValue().equals(ctype))
            continue;
 
          Plug opt = new Plug(m, candidate.getKey());
          if (source != null && getAnnotatedConnectors(source).contains(opt))
            continue;
          if (target != null && getAnnotatedConnectors(opt).contains(target))
            continue;
         
View Full Code Here

Examples of net.sf.pipet.api.Plug

    return result;
  }
 
  private Collection<Plug> getInputPipes(String port) throws ResourceException
  {
    Plug plug = new Plug(mod, port);
    Collection<Plug> plugs = new Vector<Plug>();
   
    for (Entry<Plug, Collection<Plug>> e : pipeline.getConnectors().entrySet())
    {
      for (Plug target : e.getValue())
View Full Code Here

Examples of net.sf.pipet.api.Plug

    return plugs;
  }

  private Collection<Plug> getOutputPipes(String port) throws ResourceException
  {
    Collection<Plug> plugs = pipeline.getConnectors().get(new Plug(mod, port));
    return plugs!=null ? plugs : Collections.<Plug>emptySet();
  }
View Full Code Here

Examples of net.sf.pipet.api.Plug

    out_edges = HashMultimap.create();
   
    try {
      for (Map.Entry<Plug,Collection<Plug>> e : pipeline.getConnectors().entrySet())
      {
        Plug source = e.getKey();
        String ctype;
        try {
          ctype = source.getModule().getOutputPipeTypes().get(source.getPort());
        } catch (ResourceException e1) {
          ctype = "";
        }
        for (Plug dest : e.getValue())
        {
          Edge link = new Edge(ctype, source, dest);
          in_edges.put(dest.getModule(), link);
          out_edges.put(source.getModule(), link);
        }
      }
    } catch (ResourceException e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of net.sf.pipet.api.Plug

    {
      if (e.getValue().isEmpty())
        types.put(e.getKey(), default_ctype);
      else
      {
        Plug plug = e.getValue().iterator().next();
        Map<String,String> modpipes = use_input ? plug.getModule().getInputPipeTypes() : plug.getModule().getOutputPipeTypes();
        String ctype = modpipes.get(plug.getPort());
        types.put(e.getKey(), ctype==null?default_ctype:ctype);
      }
    }
   
    return types;
View Full Code Here

Examples of net.sf.pipet.api.Plug

     
      OutputStream pipeline_out = data_access.getOutputPipes().get(e.getKey());
      if (pipeline_out == null)
        continue;

      Plug plug = e.getValue().iterator().next();
      ModuleWrapper source = mod2wrap.get(plug.getModule());
      if (source == null)
        throw new IllegalArgumentException(String.format("Trying to export %s/%s as %s, but there is no module by the name of '%s'", plug.getModule().toString(), plug.getPort(), e.getKey(), plug.getModule().toString()));

      OutputStreamSplitter splitter = source.oss.get(plug.getPort());
      if (splitter == null)
        throw new IllegalArgumentException(String.format("Trying to export %s/%s as %s, but %s has no output stream by the name of '%s'", plug.getModule().toString(), plug.getPort(), e.getKey(), plug.getModule().toString(), plug.getPort()));

      splitter.add(pipeline_out);
    }

    // create data importer threads
    if (data_access != null)
      for (Map.Entry<String,Collection<Plug>> e : pipeline.getInputPipes().entrySet())
    {
      Collection<? extends InputStream> pipeline_in = data_access.getInputPipes().get(e.getKey());
      if (pipeline_in == null)
        continue;
     
      for (InputStream is : pipeline_in)
      {
        OutputStreamSplitter os = new OutputStreamSplitter(true);
        splitters.add(new StreamConnector("data importer", is, os));
       
        for (Plug target : e.getValue())
        {
          ModuleWrapper target_wrapper = mod2wrap.get(target.getModule());
          target_wrapper.connect(target.getPort(), os);
        }
      }
    }
   
    // create module input streams
    for (Map.Entry<Plug,Collection<Plug>> e : pipeline.getConnectors().entrySet())
    {
      Plug source = e.getKey();
      ModuleWrapper source_wrapper = mod2wrap.get(source.getModule());
      OutputStreamSplitter source_stream = source_wrapper.oss.get(source.getPort());
     
      for (Plug target : e.getValue())
      {
        ModuleWrapper target_wrapper = mod2wrap.get(target.getModule());
        target_wrapper.connect(target.getPort(), source_stream);
View Full Code Here

Examples of net.sf.pipet.api.Plug

   
    if (!is_target && !mod.getOutputPipeNames().contains(port))
      throw new InvalidConfigurationException(String.format("Module %s has no output port named %s.", modid, port));
    */
   
    return new Plug(mod, port);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.