Package org.quartz.spi

Examples of org.quartz.spi.ClassLoadHelper


            }
        }

        ClassNotFoundException cnfe = null;
        Class clazz = null;
        ClassLoadHelper loadHelper = null;

        Iterator iter = loadHelpers.iterator();
        while (iter.hasNext()) {
            loadHelper = (ClassLoadHelper) iter.next();

            try {
                clazz = loadHelper.loadClass(name);
                break;
            } catch (ClassNotFoundException e) {
                cnfe = e;
            }
        }
View Full Code Here


                bestCandidate = null;
            }
        }

        URL result = null;
        ClassLoadHelper loadHelper = null;

        Iterator iter = loadHelpers.iterator();
        while (iter.hasNext()) {
            loadHelper = (ClassLoadHelper) iter.next();

            result = loadHelper.getResource(name);
            if (result != null) {
                break;
            }
        }
View Full Code Here

                bestCandidate = null;
            }
        }

        InputStream result = null;
        ClassLoadHelper loadHelper = null;

        Iterator iter = loadHelpers.iterator();
        while (iter.hasNext()) {
            loadHelper = (ClassLoadHelper) iter.next();

            result = loadHelper.getResourceAsStream(name);
            if (result != null) {
                break;
            }
        }
View Full Code Here

/*  86 */     this.loadHelpers.add(new ThreadContextClassLoadHelper());
/*  87 */     this.loadHelpers.add(new InitThreadContextClassLoadHelper());
/*     */
/*  89 */     Iterator iter = this.loadHelpers.iterator();
/*  90 */     while (iter.hasNext()) {
/*  91 */       ClassLoadHelper loadHelper = (ClassLoadHelper)iter.next();
/*  92 */       loadHelper.initialize();
/*     */     }
/*     */   }
View Full Code Here

/*     */       }
/*     */     }
/*     */
/* 109 */     ClassNotFoundException cnfe = null;
/* 110 */     Class clazz = null;
/* 111 */     ClassLoadHelper loadHelper = null;
/*     */
/* 113 */     Iterator iter = this.loadHelpers.iterator();
/* 114 */     while (iter.hasNext()) {
/* 115 */       loadHelper = (ClassLoadHelper)iter.next();
/*     */       try
/*     */       {
/* 118 */         clazz = loadHelper.loadClass(name);
/*     */       }
/*     */       catch (ClassNotFoundException e) {
/* 121 */         cnfe = e;
/*     */       }
/*     */     }
View Full Code Here

/* 144 */         this.bestCandidate = null;
/*     */       }
/*     */     }
/*     */
/* 148 */     URL result = null;
/* 149 */     ClassLoadHelper loadHelper = null;
/*     */
/* 151 */     Iterator iter = this.loadHelpers.iterator();
/* 152 */     while (iter.hasNext()) {
/* 153 */       loadHelper = (ClassLoadHelper)iter.next();
/*     */
/* 155 */       result = loadHelper.getResource(name);
/* 156 */       if (result != null) {
/* 157 */         break;
/*     */       }
/*     */     }
/*     */
View Full Code Here

/* 178 */         this.bestCandidate = null;
/*     */       }
/*     */     }
/*     */
/* 182 */     InputStream result = null;
/* 183 */     ClassLoadHelper loadHelper = null;
/*     */
/* 185 */     Iterator iter = this.loadHelpers.iterator();
/* 186 */     while (iter.hasNext()) {
/* 187 */       loadHelper = (ClassLoadHelper)iter.next();
/*     */
/* 189 */       result = loadHelper.getResourceAsStream(name);
/* 190 */       if (result != null) {
/* 191 */         break;
/*     */       }
/*     */     }
/*     */
View Full Code Here

/*  538 */       schedRep.bind(remoteScheduler);
/*      */
/*  540 */       return remoteScheduler;
/*      */     }
/*      */
/*  544 */     ClassLoadHelper loadHelper = null;
/*      */     try {
/*  546 */       loadHelper = (ClassLoadHelper)loadClass(classLoadHelperClass).newInstance();
/*      */     }
/*      */     catch (Exception e) {
/*  549 */       throw new SchedulerConfigException("Unable to instantiate class load helper class: " + e.getMessage(), e);
/*      */     }
/*      */
/*  553 */     loadHelper.initialize();
/*      */
/*  555 */     JobFactory jobFactory = null;
/*  556 */     if (jobFactoryClass != null) {
/*      */       try {
/*  558 */         jobFactory = (JobFactory)loadHelper.loadClass(jobFactoryClass).newInstance();
/*      */       }
/*      */       catch (Exception e) {
/*  561 */         throw new SchedulerConfigException("Unable to instantiate JobFactory class: " + e.getMessage(), e);
/*      */       }
/*      */
/*  566 */       tProps = this.cfg.getPropertyGroup("org.quartz.scheduler.jobFactory", true);
/*      */       try {
/*  568 */         setBeanProps(jobFactory, tProps);
/*      */       } catch (Exception e) {
/*  570 */         this.initException = new SchedulerException("JobFactory class '" + jobFactoryClass + "' props could not be configured.", e);
/*      */
/*  572 */         this.initException.setErrorCode(50);
/*      */
/*  574 */         throw this.initException;
/*      */       }
/*      */     }
/*      */
/*  578 */     InstanceIdGenerator instanceIdGenerator = null;
/*  579 */     if (instanceIdGeneratorClass != null) {
/*      */       try {
/*  581 */         instanceIdGenerator = (InstanceIdGenerator)loadHelper.loadClass(instanceIdGeneratorClass).newInstance();
/*      */       }
/*      */       catch (Exception e) {
/*  584 */         throw new SchedulerConfigException("Unable to instantiate InstanceIdGenerator class: " + e.getMessage(), e);
/*      */       }
/*      */
/*      */     }
/*      */
/*  593 */     String tpClass = this.cfg.getStringProperty("org.quartz.threadPool.class", null);
/*      */
/*  595 */     if (tpClass == null) {
/*  596 */       this.initException = new SchedulerException("ThreadPool class not specified. ", 50);
/*      */
/*  599 */       throw this.initException;
/*      */     }
/*      */     try
/*      */     {
/*  603 */       tp = (ThreadPool)loadHelper.loadClass(tpClass).newInstance();
/*      */     } catch (Exception e) {
/*  605 */       this.initException = new SchedulerException("ThreadPool class '" + tpClass + "' could not be instantiated.", e);
/*      */
/*  607 */       this.initException.setErrorCode(50);
/*      */
/*  609 */       throw this.initException;
/*      */     }
/*  611 */     tProps = this.cfg.getPropertyGroup("org.quartz.threadPool", true);
/*      */     try {
/*  613 */       setBeanProps(tp, tProps);
/*      */     } catch (Exception e) {
/*  615 */       this.initException = new SchedulerException("ThreadPool class '" + tpClass + "' props could not be configured.", e);
/*      */
/*  617 */       this.initException.setErrorCode(50);
/*      */
/*  619 */       throw this.initException;
/*      */     }
/*      */
/*  625 */     String jsClass = this.cfg.getStringProperty("org.quartz.jobStore.class", RAMJobStore.class.getName());
/*      */
/*  628 */     if (jsClass == null) {
/*  629 */       this.initException = new SchedulerException("JobStore class not specified. ", 50);
/*      */
/*  632 */       throw this.initException;
/*      */     }
/*      */     try
/*      */     {
/*  636 */       js = (JobStore)loadHelper.loadClass(jsClass).newInstance();
/*      */     } catch (Exception e) {
/*  638 */       this.initException = new SchedulerException("JobStore class '" + jsClass + "' could not be instantiated.", e);
/*      */
/*  640 */       this.initException.setErrorCode(50);
/*      */
/*  642 */       throw this.initException;
/*      */     }
/*  644 */     tProps = this.cfg.getPropertyGroup("org.quartz.jobStore", true);
/*      */     try {
/*  646 */       setBeanProps(js, tProps);
/*      */     } catch (Exception e) {
/*  648 */       this.initException = new SchedulerException("JobStore class '" + jsClass + "' props could not be configured.", e);
/*      */
/*  650 */       this.initException.setErrorCode(50);
/*      */
/*  652 */       throw this.initException;
/*      */     }
/*      */
/*  655 */     if ((js instanceof JobStoreSupport)) {
/*  656 */       ((JobStoreSupport)js).setInstanceId(schedInstId);
/*      */
/*  658 */       ((JobStoreSupport)js).setInstanceName(schedName);
/*      */     }
/*      */
/*  665 */     String[] dsNames = this.cfg.getPropertyGroups("org.quartz.dataSource");
/*  666 */     for (int i = 0; i < dsNames.length; i++) {
/*  667 */       PropertiesParser pp = new PropertiesParser(this.cfg.getPropertyGroup("org.quartz.dataSource." + dsNames[i], true));
/*      */
/*  670 */       String cpClass = pp.getStringProperty("connectionProvider.class", null);
/*      */
/*  673 */       if (cpClass != null) {
/*  674 */         ConnectionProvider cp = null;
/*      */         try {
/*  676 */           cp = (ConnectionProvider)loadHelper.loadClass(cpClass).newInstance();
/*      */         } catch (Exception e) {
/*  678 */           this.initException = new SchedulerException("ConnectionProvider class '" + cpClass + "' could not be instantiated.", e);
/*      */
/*  680 */           this.initException.setErrorCode(50);
/*      */
/*  682 */           throw this.initException;
/*      */         }
/*      */
/*      */         try
/*      */         {
/*  687 */           pp.getUnderlyingProperties().remove("connectionProvider.class");
/*      */
/*  690 */           setBeanProps(cp, pp.getUnderlyingProperties());
/*      */         } catch (Exception e) {
/*  692 */           this.initException = new SchedulerException("ConnectionProvider class '" + cpClass + "' props could not be configured.", e);
/*      */
/*  694 */           this.initException.setErrorCode(50);
/*      */
/*  696 */           throw this.initException;
/*      */         }
/*      */
/*  699 */         dbMgr = DBConnectionManager.getInstance();
/*  700 */         dbMgr.addConnectionProvider(dsNames[i], cp);
/*      */       }
/*      */       else {
/*  703 */         String dsDriver = pp.getStringProperty("driver", null);
/*      */
/*  705 */         String dsURL = pp.getStringProperty("URL", null);
/*  706 */         boolean dsAlwaysLookup = pp.getBooleanProperty("jndiAlwaysLookup", false);
/*      */
/*  708 */         String dsUser = pp.getStringProperty("user", "");
/*  709 */         String dsPass = pp.getStringProperty("password", "");
/*  710 */         int dsCnt = pp.getIntProperty("maxConnections", 10);
/*  711 */         String dsJndi = pp.getStringProperty("jndiURL", null);
/*      */
/*  713 */         String dsJndiInitial = pp.getStringProperty("java.naming.factory.initial", null);
/*      */
/*  715 */         String dsJndiProvider = pp.getStringProperty("java.naming.provider.url", null);
/*      */
/*  717 */         String dsJndiPrincipal = pp.getStringProperty("java.naming.security.principal", null);
/*      */
/*  719 */         String dsJndiCredentials = pp.getStringProperty("java.naming.security.credentials", null);
/*      */
/*  721 */         String dsValidation = pp.getStringProperty("validationQuery", null);
/*      */
/*  724 */         if (dsJndi != null) {
/*  725 */           Properties props = null;
/*  726 */           if ((null != dsJndiInitial) || (null != dsJndiProvider) || (null != dsJndiPrincipal) || (null != dsJndiCredentials))
/*      */           {
/*  728 */             props = new Properties();
/*  729 */             if (dsJndiInitial != null) {
/*  730 */               props.put("java.naming.factory.initial", dsJndiInitial);
/*      */             }
/*  732 */             if (dsJndiProvider != null) {
/*  733 */               props.put("java.naming.provider.url", dsJndiProvider);
/*      */             }
/*  735 */             if (dsJndiPrincipal != null) {
/*  736 */               props.put("java.naming.security.principal", dsJndiPrincipal);
/*      */             }
/*  738 */             if (dsJndiCredentials != null) {
/*  739 */               props.put("java.naming.security.credentials", dsJndiCredentials);
/*      */             }
/*      */           }
/*  742 */           JNDIConnectionProvider cp = new JNDIConnectionProvider(dsJndi, props, dsAlwaysLookup);
/*      */
/*  744 */           dbMgr = DBConnectionManager.getInstance();
/*  745 */           dbMgr.addConnectionProvider(dsNames[i], cp);
/*      */         } else {
/*  747 */           if (dsDriver == null) {
/*  748 */             this.initException = new SchedulerException("Driver not specified for DataSource: " + dsNames[i]);
/*      */
/*  751 */             throw this.initException;
/*      */           }
/*  753 */           if (dsURL == null) {
/*  754 */             this.initException = new SchedulerException("DB URL not specified for DataSource: " + dsNames[i]);
/*      */
/*  757 */             throw this.initException;
/*      */           }
/*      */           try {
/*  760 */             PoolingConnectionProvider cp = new PoolingConnectionProvider(dsDriver, dsURL, dsUser, dsPass, dsCnt, dsValidation);
/*      */
/*  763 */             dbMgr = DBConnectionManager.getInstance();
/*  764 */             dbMgr.addConnectionProvider(dsNames[i], cp);
/*      */           } catch (SQLException sqle) {
/*  766 */             this.initException = new SchedulerException("Could not initialize DataSource: " + dsNames[i], sqle);
/*      */
/*  769 */             throw this.initException;
/*      */           }
/*      */
/*      */         }
/*      */
/*      */       }
/*      */
/*      */     }
/*      */
/*  780 */     String[] pluginNames = this.cfg.getPropertyGroups("org.quartz.plugin");
/*  781 */     SchedulerPlugin[] plugins = new SchedulerPlugin[pluginNames.length];
/*  782 */     for (int i = 0; i < pluginNames.length; i++) {
/*  783 */       Properties pp = this.cfg.getPropertyGroup("org.quartz.plugin." + pluginNames[i], true);
/*      */
/*  786 */       String plugInClass = pp.getProperty("class", null);
/*      */
/*  788 */       if (plugInClass == null) {
/*  789 */         this.initException = new SchedulerException("SchedulerPlugin class not specified for plugin '" + pluginNames[i] + "'", 50);
/*      */
/*  793 */         throw this.initException;
/*      */       }
/*  795 */       SchedulerPlugin plugin = null;
/*      */       try {
/*  797 */         plugin = (SchedulerPlugin)loadHelper.loadClass(plugInClass).newInstance();
/*      */       }
/*      */       catch (Exception e) {
/*  800 */         this.initException = new SchedulerException("SchedulerPlugin class '" + plugInClass + "' could not be instantiated.", e);
/*      */
/*  803 */         this.initException.setErrorCode(50);
/*      */
/*  805 */         throw this.initException;
/*      */       }
/*      */       try {
/*  808 */         setBeanProps(plugin, pp);
/*      */       } catch (Exception e) {
/*  810 */         this.initException = new SchedulerException("JobStore SchedulerPlugin '" + plugInClass + "' props could not be configured.", e);
/*      */
/*  813 */         this.initException.setErrorCode(50);
/*      */
/*  815 */         throw this.initException;
/*      */       }
/*  817 */       plugins[i] = plugin;
/*      */     }
/*      */
/*  823 */     Class[] strArg = { String.class };
/*  824 */     String[] jobListenerNames = this.cfg.getPropertyGroups("org.quartz.jobListener");
/*  825 */     JobListener[] jobListeners = new JobListener[jobListenerNames.length];
/*  826 */     for (int i = 0; i < jobListenerNames.length; i++) {
/*  827 */       Properties lp = this.cfg.getPropertyGroup("org.quartz.jobListener." + jobListenerNames[i], true);
/*      */
/*  830 */       String listenerClass = lp.getProperty("class", null);
/*      */
/*  832 */       if (listenerClass == null) {
/*  833 */         this.initException = new SchedulerException("JobListener class not specified for listener '" + jobListenerNames[i] + "'", 50);
/*      */
/*  837 */         throw this.initException;
/*      */       }
/*  839 */       JobListener listener = null;
/*      */       try {
/*  841 */         listener = (JobListener)loadHelper.loadClass(listenerClass).newInstance();
/*      */       }
/*      */       catch (Exception e) {
/*  844 */         this.initException = new SchedulerException("JobListener class '" + listenerClass + "' could not be instantiated.", e);
/*      */
/*  847 */         this.initException.setErrorCode(50);
/*      */
/*  849 */         throw this.initException;
/*      */       }
/*      */       try {
/*  852 */         Method nameSetter = listener.getClass().getMethod("setName", strArg);
/*  853 */         if (nameSetter != null)
/*  854 */           nameSetter.invoke(listener, new Object[] { jobListenerNames[i] });
/*  855 */         setBeanProps(listener, lp);
/*      */       } catch (Exception e) {
/*  857 */         this.initException = new SchedulerException("JobListener '" + listenerClass + "' props could not be configured.", e);
/*      */
/*  860 */         this.initException.setErrorCode(50);
/*      */
/*  862 */         throw this.initException;
/*      */       }
/*  864 */       jobListeners[i] = listener;
/*      */     }
/*      */
/*  870 */     String[] triggerListenerNames = this.cfg.getPropertyGroups("org.quartz.triggerListener");
/*  871 */     TriggerListener[] triggerListeners = new TriggerListener[triggerListenerNames.length];
/*  872 */     for (int i = 0; i < triggerListenerNames.length; i++) {
/*  873 */       Properties lp = this.cfg.getPropertyGroup("org.quartz.triggerListener." + triggerListenerNames[i], true);
/*      */
/*  876 */       String listenerClass = lp.getProperty("class", null);
/*      */
/*  878 */       if (listenerClass == null) {
/*  879 */         this.initException = new SchedulerException("TriggerListener class not specified for listener '" + triggerListenerNames[i] + "'", 50);
/*      */
/*  883 */         throw this.initException;
/*      */       }
/*  885 */       TriggerListener listener = null;
/*      */       try {
/*  887 */         listener = (TriggerListener)loadHelper.loadClass(listenerClass).newInstance();
/*      */       }
/*      */       catch (Exception e) {
/*  890 */         this.initException = new SchedulerException("TriggerListener class '" + listenerClass + "' could not be instantiated.", e);
/*      */
/*  893 */         this.initException.setErrorCode(50);
View Full Code Here

/* 316 */     qrs.setRMIRegistryHost(rmiRegistryHost);
/* 317 */     qrs.setRMIRegistryPort(rmiRegistryPort);
/*     */
/* 319 */     QuartzScheduler qs = new QuartzScheduler(qrs, schedCtxt, idleWaitTime, dbFailureRetryInterval);
/*     */
/* 322 */     ClassLoadHelper cch = new CascadingClassLoadHelper();
/* 323 */     cch.initialize();
/*     */
/* 325 */     jobStore.initialize(cch, qs.getSchedulerSignaler());
/*     */
/* 327 */     Scheduler scheduler = new StdScheduler(qs, schedCtxt);
/*     */
View Full Code Here

        qrs.setRMIRegistryPort(rmiRegistryPort);

        QuartzScheduler qs = new QuartzScheduler(qrs, schedCtxt, idleWaitTime,
                dbFailureRetryInterval);

        ClassLoadHelper cch = new CascadingClassLoadHelper();
        cch.initialize();
       
        jobStore.initialize(cch, qs.getSchedulerSignaler());

        Scheduler scheduler = new StdScheduler(qs, schedCtxt);
View Full Code Here

TOP

Related Classes of org.quartz.spi.ClassLoadHelper

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.