Examples of ServiceNotFoundException


Examples of javax.management.ServiceNotFoundException

            // Acquire the ModelMBeanOperationInfo information for
            // the requested operation
            OperationInfo opInfo = operations.get(aname);
            if (opInfo == null)
                throw new MBeanException(new ServiceNotFoundException(
                        "Cannot find operation " + aname),
                        "Cannot find operation " + aname);

            // Prepare the signature required by Java reflection APIs
            // FIXME - should we use the signature from opInfo?
View Full Code Here

Examples of javax.management.ServiceNotFoundException

      Logger logger = getLogger();

      // Find operation descriptor
      ModelMBeanInfo info = getModelMBeanInfo();
      if (info == null) throw new MBeanException(new ServiceNotFoundException("ModelMBeanInfo is null"));
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("ModelMBeanInfo is: " + info);

      // This is a clone, we use it read only
      ModelMBeanOperationInfo operInfo = info.getOperation(method);
      if (operInfo == null)
      {
         // Bug #940161 Required ModelMBean methods are not invoked
         try
         {
            // Look in RMMB public methods
            Class[] clzArgs = new Class[params.length];
            for (int i = 0; i < clzArgs.length; i++)
            {
               ClassLoader loader = getClass().getClassLoader();
               if (loader == null) loader = Thread.currentThread().getContextClassLoader();
               clzArgs[i] = loader.loadClass(params[i]);
            }

            // Class.getMethod only returns public methods
            Method invocationMethod = getClass().getMethod(method, clzArgs);
            operInfo = new ModelMBeanOperationInfo("", invocationMethod);
         }
         catch (Exception e)
         {
            throw new MBeanException(new ServiceNotFoundException("Cannot find ModelMBeanOperationInfo for operation " + method));
         }
      }
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Operation info is: " + operInfo);

      // This descriptor is a clone
      Descriptor operationDescriptor = operInfo.getDescriptor();
      if (operationDescriptor == null) throw new MBeanException(new ServiceNotFoundException("Operation descriptor for operation " + method + " cannot be null"));
      String role = (String)operationDescriptor.getFieldValue("role");
      if (role == null || !role.equals("operation")) throw new MBeanException(new ServiceNotFoundException("Operation descriptor field 'role' must be 'operation', not " + role));
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Operation descriptor is: " + operationDescriptor);

      // This returns a clone of the mbean descriptor, we use it read only
      Descriptor mbeanDescriptor = info.getMBeanDescriptor();
      if (mbeanDescriptor == null) throw new MBeanException(new ServiceNotFoundException("MBean descriptor cannot be null"));
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("MBean descriptor is: " + mbeanDescriptor);

      Object returnValue = null;

      String lastUpdateField = "lastReturnedTimeStamp";
View Full Code Here

Examples of javax.management.ServiceNotFoundException

      catch (NoSuchMethodException x)
      {
         realTarget = target;
      }

      if (realTarget == null) throw new MBeanException(new ServiceNotFoundException("Could not find target"));

      if (method == null)
      {
         try
         {
View Full Code Here

Examples of javax.management.ServiceNotFoundException

      return new RuntimeOperationsException(new NullPointerException("NullPointerException"), "RuntimeOperationsException");
   }

   public ServiceNotFoundException createServiceNotFoundException()
   {
      return new ServiceNotFoundException("ServiceNotFoundException");
   }
View Full Code Here

Examples of javax.management.ServiceNotFoundException

      return getMBeansFromURL(createURL(url));
   }

   public Set getMBeansFromURL(URL url) throws ServiceNotFoundException
   {
      if (url == null) throw new ServiceNotFoundException("Cannot load MBeans from null URL");

      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.TRACE)) logger.trace("MLet " + this + ", reading MLET file from " + url);

      InputStream is = null;
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      BufferedOutputStream os = new BufferedOutputStream(baos);
      try
      {
         is = url.openStream();
         readFromAndWriteTo(is, os);
      }
      catch (IOException x)
      {
         if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot read input stream from URL " + url, x);
         throw new ServiceNotFoundException(x.toString());
      }
      finally
      {
         try
         {
View Full Code Here

Examples of liquibase.exception.ServiceNotFoundException

                    returnObject = newInstance;
                }
            }

            if (returnObject == null) {
                throw new ServiceNotFoundException("Could not find implementation of " + requiredInterface.getName());
            }
            return returnObject.getClass();
        }

        if (classes.length != 1) {
            throw new ServiceNotFoundException("Could not find unique implementation of " + requiredInterface.getName() + ".  Found " + classes.length + " implementations");
        }

        return classes[0];
    }
View Full Code Here

Examples of org.apache.ambari.server.ServiceNotFoundException

    expect(injector.getInstance(Gson.class)).andReturn(null);
    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);

    // getServices
    expect(clusters.getCluster("cluster1")).andReturn(cluster);
    expect(cluster.getService("service1")).andThrow(new ServiceNotFoundException("custer1", "service1"));

    // replay mocks
    replay(maintHelper, injector, clusters, cluster);

    //test
View Full Code Here

Examples of org.apache.ambari.server.ServiceNotFoundException

    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);

    // getServices
    expect(clusters.getCluster("cluster1")).andReturn(cluster).times(4);
    expect(cluster.getService("service1")).andReturn(service1);
    expect(cluster.getService("service2")).andThrow(new ServiceNotFoundException("cluster1", "service2"));
    expect(cluster.getService("service3")).andThrow(new ServiceNotFoundException("cluster1", "service3"));
    expect(cluster.getService("service4")).andReturn(service2);

    expect(service1.convertToResponse()).andReturn(response);
    expect(service2.convertToResponse()).andReturn(response2);
    // replay mocks
View Full Code Here

Examples of org.apache.ambari.server.ServiceNotFoundException

    clusterGlobalLock.readLock().lock();
    try {
      readLock.lock();
      try {
        if (!services.containsKey(serviceName)) {
          throw new ServiceNotFoundException(getClusterName(), serviceName);
        }
        return services.get(serviceName);
      } finally {
        readLock.unlock();
      }
View Full Code Here

Examples of org.apache.ambari.server.ServiceNotFoundException

  @Override
  public synchronized Service getService(String serviceName)
      throws AmbariException {
    loadServices();
    if (!services.containsKey(serviceName)) {
      throw new ServiceNotFoundException(getClusterName(), serviceName);
    }
    return services.get(serviceName);
  }
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.