Package hermes.config

Examples of hermes.config.ClasspathConfig


                            "Please choose", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
            final File[] files = fileChooser.getSelectedFiles();

            for (int i = 0; i < files.length; i++)
            {
               final ClasspathConfig lConfig = new ClasspathConfig();

                lastDirectory = new File(files[i].getPath());

                lConfig.setJar(files[i].getAbsolutePath());

                if ( n == JOptionPane.YES_OPTION)
                {
                    lConfig.setNoFactories(false);
                }
                else
                {
                    lConfig.setNoFactories(true);
                }

                model.addItem(lConfig);    
               
            }
View Full Code Here


                        for (int i = 0; i < rows.length; i++)
                        {
                            int row = rows[i];

                            ClasspathConfig cpConfig = model.getRowAt(row);

                            switch (action)
                            {
                            case COPY:
                                copy(cpConfig, config);
View Full Code Here

    *
    * @see hermes.impl.ConfigDAO#duplicate(hermes.config.ClasspathConfig)
    */
   public ClasspathConfig duplicate(ClasspathConfig cConfig) throws JAXBException
   {
      ClasspathConfig newCConfig = factory.createClasspathConfig();

      newCConfig.setFactories(cConfig.getFactories());
      newCConfig.setJar(cConfig.getJar());
      newCConfig.setNoFactories(cConfig.isNoFactories());

      return newCConfig;
   }
View Full Code Here

      URL[] urls = new URL[size];
      StringBuffer debug = new StringBuffer("URLClassLoader: ");

      for (Iterator iter = loaderConfigs.iterator(); iter.hasNext();)
      {
         ClasspathConfig lConfig = (ClasspathConfig) iter.next();

         URL url = null;

         if (lConfig.getJar().startsWith("http"))
         {
            url = new URL(TextUtils.replaceClasspathVariables(lConfig.getJar()));
         }
         else
         {
            url = new File(TextUtils.replaceClasspathVariables(lConfig.getJar())).toURL();

         }

         urls[index++] = url;
View Full Code Here

   {
      final List rval = new ArrayList();

      for (Iterator iter = loaderConfigs.iterator(); iter.hasNext();)
      {
         final ClasspathConfig lConfig = (ClasspathConfig) iter.next();

         if (lConfig.getFactories() != null)
         {
            log.debug("using cached " + lConfig.getFactories());

            for (StringTokenizer tokens = new StringTokenizer(lConfig.getFactories(), ","); tokens.hasMoreTokens();)
            {
               rval.add(tokens.nextToken());
            }
         }
         else if (lConfig.isNoFactories())
         {
            log.debug("previously scanned " + lConfig.getJar());
         }
         else
         {
            Runnable r = new Runnable()
            {
               public void run()
               {
                  final List localFactories = new ArrayList();
                  boolean foundFactory = false;
                  StringBuffer factoriesAsString = null;

                  try
                  {
                     log.debug("searching " + lConfig.getJar());

                     ClassLoader l = createClassLoader(loaderConfigs, baseLoader);
                     JarFile jarFile = new JarFile(lConfig.getJar());
                     ProgressMonitor monitor = null;
                     int entryNumber = 0;

                     if (HermesBrowser.getBrowser() != null)
                     {
                        monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Looking for factories in " + lConfig.getJar(), "Scanning...", 0, jarFile
                              .size());
                        monitor.setMillisToDecideToPopup(0);
                        monitor.setMillisToPopup(0);
                        monitor.setProgress(0);
                     }

                     for (Enumeration iter = jarFile.entries(); iter.hasMoreElements();)
                     {
                        ZipEntry entry = (ZipEntry) iter.nextElement();
                        entryNumber++;

                        if (monitor != null)
                        {
                           monitor.setProgress(entryNumber);
                           monitor.setNote("Checking entry " + entryNumber + " of " + jarFile.size());
                        }

                        if (entry.getName().endsWith(".class"))
                        {
                           String s = entry.getName().substring(0, entry.getName().indexOf(".class"));

                           s = s.replaceAll("/", ".");

                           try
                           {
                              if (s.startsWith("hermes.browser") || s.startsWith("hermes.impl") || s.startsWith("javax.jms"))
                              {
                                 // NOP
                              }
                              else
                              {
                                 Class clazz = l.loadClass(s);

                                 if (!clazz.isInterface())
                                 {

                                    if (implementsOrExtends(clazz, ConnectionFactory.class))
                                    {

                                       foundFactory = true;
                                       localFactories.add(s);

                                       if (factoriesAsString == null)
                                       {
                                          factoriesAsString = new StringBuffer();
                                          factoriesAsString.append(clazz.getName());
                                       }
                                       else
                                       {
                                          factoriesAsString.append(",").append(clazz.getName());
                                       }
                                       log.debug("found " + clazz.getName());
                                    }
                                 }

                                 /**
                                  * TODO: remove Class clazz = l.loadClass(s);
                                  * Class[] interfaces = clazz.getInterfaces();
                                  * for (int i = 0; i < interfaces.length; i++) {
                                  * if
                                  * (interfaces[i].equals(TopicConnectionFactory.class) ||
                                  * interfaces[i].equals(QueueConnectionFactory.class) ||
                                  * interfaces[i].equals(ConnectionFactory.class)) {
                                  * foundFactory = true; localFactories.add(s);
                                  * if (factoriesAsString == null) {
                                  * factoriesAsString = new
                                  * StringBuffer(clazz.getName()); } else {
                                  * factoriesAsString.append(",").append(clazz.getName()); }
                                  * log.debug("found " + clazz.getName()); } }
                                  */
                              }
                           }
                           catch (Throwable t)
                           {
                              // NOP
                           }
                        }
                     }
                  }
                  catch (IOException e)
                  {
                     log.error("unable to access jar/zip " + lConfig.getJar() + ": " + e.getMessage(), e);
                  }

                  if (!foundFactory)
                  {
                     lConfig.setNoFactories(true);
                  }
                  else
                  {
                     lConfig.setFactories(factoriesAsString.toString());
                     rval.addAll(localFactories);
                  }

               }
            };
View Full Code Here

         newGConfig.setId(gConfig.getId());
         rval.add(newGConfig);

         for (Iterator<ClasspathConfig> iter2 = gConfig.getLibrary().iterator(); iter2.hasNext();)
         {
            ClasspathConfig cConfig = iter2.next();
            ClasspathConfig newCConfig = duplicate(cConfig);

            newGConfig.getLibrary().add(newCConfig);
         }
      }
View Full Code Here

     *
     * @see javax.swing.table.TableModel#getValueAt(int, int)
     */
    public Object getValueAt(int y, int x)
    {
        ClasspathConfig cConfig = (ClasspathConfig) rows.get(y);

        if (x == 0)
        {
            return cConfig.getJar();
        }
        else
        {         
            return new Boolean(!cConfig.isNoFactories());
        }
    }
View Full Code Here

        return false;
    }

    public void setValueAt(Object value, int y, int x)
    {
        ClasspathConfig cConfig = (ClasspathConfig) rows.get(y);

        log.debug("value=" + value) ;
       
        if (x == 0)
        {
            cConfig.setJar((String) value);
        }
        else
        {
            cConfig.setNoFactories(((Boolean) value).booleanValue()) ;
        }

        fireTableRowsUpdated(y, y) ;
    }
View Full Code Here

TOP

Related Classes of hermes.config.ClasspathConfig

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.