Package org.jwatch.domain.instance

Examples of org.jwatch.domain.instance.QuartzInstance


      MBeanServerConnection connection = connector.getMBeanServerConnection();

      // test connection
      ObjectName mBName = new ObjectName("quartz:type=QuartzScheduler,*");
      Set<ObjectName> names = connection.queryNames(mBName, null);
      QuartzInstance quartzInstance = new QuartzInstance(config);
      quartzInstance.setMBeanServerConnection(connection);
      quartzInstance.setJmxConnector(connector);

      // build scheduler list
      List<Scheduler> schList = new ArrayList<Scheduler>();
      for (ObjectName objectName : names)   // for each scheduler.
      {
         QuartzJMXAdapter jmxAdapter = QuartzJMXAdapterFactory.initQuartzJMXAdapter(objectName, connection);
         quartzInstance.setJmxAdapter(jmxAdapter);

         Scheduler scheduler = jmxAdapter.populateScheduler(quartzInstance, objectName);
         schList.add(scheduler);

         // attach listener
         Listener listener = new Listener();
         listener.setUUID(scheduler.getUuidInstance());
         connection.addNotificationListener(objectName, listener, null, null);
         log.info("added listener " + objectName.getCanonicalName());
         QuartzInstance.putListener(listener);
      }
      quartzInstance.setSchedulerList(schList);
      return quartzInstance;
   }
View Full Code Here


      //To change body of implemented methods use File | Settings | File Templates.
   }

   private Object callJMXAttribute(JMXInput jmxInput) throws Exception
   {
      QuartzInstance quartzInstance = jmxInput.getQuartzInstanceConnection();
      MBeanServerConnection connection = quartzInstance.getMBeanServerConnection();
      return (Object) connection.getAttribute(jmxInput.getObjectName(), jmxInput.getOperation());
   }
View Full Code Here

      return (Object) connection.getAttribute(jmxInput.getObjectName(), jmxInput.getOperation());
   }

   private Object callJMXOperation(JMXInput jmxInput) throws Exception
   {
      QuartzInstance quartzInstance = jmxInput.getQuartzInstanceConnection();
      MBeanServerConnection connection = quartzInstance.getMBeanServerConnection();
      return connection.invoke(jmxInput.getObjectName(), jmxInput.getOperation(), jmxInput.getParameters(), jmxInput.getSignature());
   }
View Full Code Here

        Map qMap = QuartzInstanceService.getQuartzInstanceMap();
        for (Iterator it = qMap.entrySet().iterator(); it.hasNext(); )
        {
            Map.Entry entry = (Map.Entry) it.next();
            String k = (String) entry.getKey();
            QuartzInstance quartzInstance = (QuartzInstance) qMap.get(k);
            try
            {
                quartzInstance.getJmxConnector().close();
            }
            catch (IOException e)
            {
                log.error("Failed to close Connection: " + quartzInstance, e);
            }
View Full Code Here

                JSONArray jsonArray = new JSONArray();
                for (Iterator it = qMap.entrySet().iterator(); it.hasNext(); )
                {
                    Map.Entry entry = (Map.Entry) it.next();
                    String k = (String) entry.getKey();
                    QuartzInstance quartzInstance = (QuartzInstance) qMap.get(k);
                    QuartzConfig quartzConfig = new QuartzConfig(quartzInstance);
                    JSONObject jo = JSONObject.fromObject(quartzConfig);
                    jsonArray.add(jo);
                }
                jsonObject.put(GlobalConstants.JSON_DATA_ROOT_KEY, jsonArray);
View Full Code Here

            if (StringUtils.trimToNull(host) != null)
            {
                QuartzConfig quartzConfig = new QuartzConfig(Tools.generateUUID(), host, port, username, password);
                QuartzConnectService quartzConnectService = new QuartzConnectServiceImpl();
                QuartzInstance quartzInstance = quartzConnectService.initInstance(quartzConfig);
                if (quartzInstance == null)
                {
                    log.error(GlobalConstants.MESSAGE_FAILED_CONNECT + " " + quartzConfig);
                    jsonObject = JSONUtil.buildError(GlobalConstants.MESSAGE_FAILED_CONNECT + " " + quartzConfig);
                    return jsonObject;
View Full Code Here

        JSONObject jsonObject = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        String qiid = StringUtils.trimToNull((String) map.get("uuid"));
        try
        {
            QuartzInstance quartzInstance = QuartzInstanceService.getQuartzInstanceByID(qiid);
            if (quartzInstance != null)
            {
                int totalCount = 0;
                List<Scheduler> schedulers = quartzInstance.getSchedulerList();
                if (schedulers != null && schedulers.size() > 0)
                {
                    totalCount = schedulers.size();
                    for (int i = 0; i < schedulers.size(); i++)
                    {
View Full Code Here

            if (uuidInstance != null)
            {
                String[] arr = uuidInstance.split("@@");
                String uuid = arr[0];
                String scheduleID = arr[1];
                QuartzInstance quartzInstance = QuartzInstanceService.getQuartzInstanceByID(uuid);
                if (quartzInstance != null)
                {
                    List<Job> jobs = quartzInstance.getJmxAdapter().getJobDetails(quartzInstance, scheduleID);
                    if (jobs != null && jobs.size() > 0)
                    {
                        totalCount = jobs.size();
                        for (int i = 0; i < jobs.size(); i++)
                        {
View Full Code Here

            if (uuidInstance != null)
            {
                String[] arr = uuidInstance.split("@@");
                String uuid = arr[0];
                String scheduleID = arr[1];
                QuartzInstance quartzInstance = QuartzInstanceService.getQuartzInstanceByID(uuid);
                if (quartzInstance != null)
                {
                    Scheduler scheduler = quartzInstance.getJmxAdapter().getScheduler(quartzInstance, scheduleID);
                    if (scheduler != null)
                    {
                        jsonObject = JSONObject.fromObject(scheduler);
                    }
                }
View Full Code Here

        String groupName = StringUtils.trimToNull((String) map.get("groupName"));
        String scheduleID = StringUtils.trimToNull((String) map.get("sid"));
        int totalCount = 0;
        try
        {
            QuartzInstance quartzInstance = QuartzInstanceService.getQuartzInstanceByID(qiid);
            List<Trigger> triggers = quartzInstance.getJmxAdapter().getTriggersForJob(quartzInstance, scheduleID, jobName, groupName);
            if (triggers != null && triggers.size() > 0)
            {
                totalCount = triggers.size();
                for (int i = 0; i < triggers.size(); i++)
                {
View Full Code Here

TOP

Related Classes of org.jwatch.domain.instance.QuartzInstance

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.