/** * Get the Service interface through which the mbean given by objectName will be managed. * * @param objectName the object name * @param server the mbean server * @return The Service value * @throws Exception for any error */ public static Service getServiceProxy(ObjectName objectName, MBeanServer server) throws Exception { return getServiceProxy(objectName, server, true); }
public ControllerState lifecycleInvocation(String name, Object[] parameters, String[] signature) throws Throwable { if (lifecycleInfo == null) lifecycleInfo = new LifecycleInfo(this); return lifecycleInfo.lifecycleInvocation(name, signature); }
/** * Create a new ServiceControllerContext. * * @param serviceController the service controller * @param name the name * @param target the target */ public ServiceControllerContext(ServiceController serviceController, ObjectName name, Object target) { super(name.getCanonicalName(), ServiceControllerContextActions.getInstance()); this.objectName = name; serviceContext.objectName = objectName; this.serviceController = serviceController; setTarget(target); setMode(ControllerMode.MANUAL); }
/** * Get the instance * * @return the actions */ public static ServiceControllerContextActions getInstance() { if (instance == null) { Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>(); actions.put(ControllerState.DESCRIBED, new DescribeAction()); actions.put(ControllerState.INSTANTIATED, new InstantiateAction()); actions.put(ControllerState.CONFIGURED, new ConfigureAction()); actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction()); actions.put(ControllerState.START, new StartStopLifecycleAction()); actions.put(ControllerState.INSTALLED, new InstallAction()); instance = new ServiceControllerContextActions(actions); } return instance; }
/** * Get the instance * * @return the actions */ public static ServiceControllerContextActions getLifecycleOnly() { if (lifecycleOnly == null) { Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>(); actions.put(ControllerState.INSTANTIATED, new OnlyUnregisterAction()); actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction()); actions.put(ControllerState.START, new StartStopLifecycleAction()); lifecycleOnly = new ServiceControllerContextActions(actions); } return lifecycleOnly; }
/** * Add the passed lifecycle dependencies to the context * * @param context the context * @param depends the dependencies */ private void addDependencies(ServiceControllerContext context, Collection<ObjectName> depends) { DependencyInfo info = context.getDependencyInfo(); for (ObjectName other : depends) { info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.CREATE)); info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.START)); } }
public ServiceContext getServiceContext(ObjectName serviceName) { ServiceControllerContext context = installed.get(serviceName); if (context != null) return context.getServiceContext(); return null; }
/** * Preprocess the metadata for this context */ protected void preprocessMetaData() { if (serviceMetaData == null) return; PreprocessMetaDataVisitor visitor = new PreprocessMetaDataVisitor(); AccessController.doPrivileged(visitor); }
public void setController(Controller controller) { super.setController(controller); if (controller != null) { preprocessMetaData(); serviceContext.state = ServiceContext.INSTALLED; } else serviceContext.state = ServiceContext.NOTYETINSTALLED; }
public Object invoke(String name, Object parameters[], String[] signature) throws Throwable { return getMBeanServer().invoke(objectName, name, parameters, signature); }
public void addDependency(DependencyItem dependency) { getDependencyInfo().addIDependOn(dependency); }
/** * Push context to MDR. * * @param context The ServiceControllerContext we are installing */ public void installAction(ServiceControllerContext context) throws Throwable { KernelMetaDataRepository repository = getRepository(context); repository.addMetaData(context); }
/** * Get the instance * * @return the actions */ public static ServiceControllerContextActions getInstance() { if (instance == null) { Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>(); actions.put(ControllerState.DESCRIBED, new DescribeAction()); actions.put(ControllerState.INSTANTIATED, new InstantiateAction()); actions.put(ControllerState.CONFIGURED, new ConfigureAction()); actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction()); actions.put(ControllerState.START, new StartStopLifecycleAction()); actions.put(ControllerState.INSTALLED, new InstallAction()); instance = new ServiceControllerContextActions(actions); } return instance; }
/** * Get the instance * * @return the actions */ public static ServiceControllerContextActions getLifecycleOnly() { if (lifecycleOnly == null) { Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>(); actions.put(ControllerState.INSTANTIATED, new OnlyUnregisterAction()); actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction()); actions.put(ControllerState.START, new StartStopLifecycleAction()); lifecycleOnly = new ServiceControllerContextActions(actions); } return lifecycleOnly; }
/** * Create a new ServiceControllerContext. * * @param serviceController the service controller * @param name the name * @param target the target */ public ServiceControllerContext(ServiceController serviceController, ObjectName name, Object target) { super(name.getCanonicalName(), ServiceControllerContextActions.getInstance()); this.objectName = name; serviceContext.objectName = objectName; this.serviceController = serviceController; setTarget(target); setMode(ControllerMode.MANUAL); }
/** * Get the Service interface through which the mbean given by objectName will be managed. * * @param objectName the object name * @param server the mbean server * @return The Service value * @throws Exception for any error */ public static Service getServiceProxy(ObjectName objectName, MBeanServer server) throws Exception { return getServiceProxy(objectName, server, true); }
public ServiceContext getServiceContext(ObjectName serviceName) { ServiceControllerContext context = installed.get(serviceName); if (context != null) return context.getServiceContext(); return null; }
/** * Preprocess the metadata for this context */ protected void preprocessMetaData() { if (serviceMetaData == null) return; PreprocessMetaDataVisitor visitor = new PreprocessMetaDataVisitor(); AccessController.doPrivileged(visitor); }
public void setController(Controller controller) { super.setController(controller); if (controller != null) { preprocessMetaData(); serviceContext.state = ServiceContext.INSTALLED; } else serviceContext.state = ServiceContext.NOTYETINSTALLED; }
/** * Remove context form MDR. * * @param context The ServiceControllerContext we are uninstalling */ public void uninstallAction(ServiceControllerContext context) { KernelMetaDataRepository repository = getRepository(context); repository.removeMetaData(context); } }