@Override public void postConstruct() { super.postConstruct(); delete = targetMethod.getAnnotation(Delete.class); resolverType = delete.resolver(); try { // we pass false for "useAnnotations" as the @Param declarations on // the target type are not used for the Delete method parameters. model = new GenericCommandModel(targetType, false, delete.cluster(), delete.i18n(), new LocalStringManagerImpl(targetType), habitat.<DomDocument>getService(DomDocument.class), commandName, AnnotationUtil.presentTransitive(ManagedJob.class, delete.decorator()), delete.resolver(), delete.decorator()); if (logger.isLoggable(level)) { for (String paramName : model.getParametersNames()) { CommandModel.ParamModel param = model.getModelFor(paramName); logger.log(Level.FINE, "I take {0} parameters", param.getName()); } } } catch(Exception e) { String msg = localStrings.getLocalString(GenericCrudCommand.class, "GenericCreateCommand.command_model_exception", "Exception while creating the command model for the generic command {0} : {1}", commandName, e.getMessage()); LogHelper.log(logger, Level.SEVERE, ConfigApiLoggerInfo.GENERIC_CREATE_CMD_FAILED, e, new Object[] {commandName}); throw new RuntimeException(msg, e); } }
/** * Return the list of clusters currently configured * * @return list of {@link Cluster } */ @Element @Create(value="create-cluster", decorator=Cluster.Decorator.class, i18n=@I18n("create.cluster.command")) @Delete(value="delete-cluster", resolver= TypeAndNameResolver.class, decorator=Cluster.DeleteDecorator.class , i18n=@I18n("delete.cluster.command")) public List<Cluster> getCluster();
@Override public Class getDecoratorClass() { if (delete != null) { return delete.decorator(); } else { return null; } } }
@Element("server-pool-master") // @Create(value = "create-serverPool-manager", resolver = VirtResolver.class, i18n = @I18n("org.glassfish.virtualization.create-serverPool-manager")) @Listing(value = "list-group-master", resolver = VirtResolver.class, i18n = @I18n("org.glassfish.virtualization.list-serverPool-managers")) @Delete(value="delete-group-master", resolver= TypeAndNameResolver.class, i18n = @I18n("org.glassfish.virtualization.delete-serverPool-manager")) List<GroupManager> getServerPoolMaster();
@Override public Object run(ConfigBeanProxy parentProxy) throws PropertyVetoException, TransactionFailure { ConfigSupport._deleteChild(child.parent(), (WriteableView) Proxy.getInvocationHandler(parentProxy), child); DeletionDecorator<ConfigBeanProxy, ConfigBeanProxy> decorator = habitat.getService(delete.decorator()); if (decorator==null) { String msg = localStrings.getLocalString(GenericCrudCommand.class, "GenericCreateCommand.deletion_decorator_not_found", "The DeletionDecorator {0} could not be found in the habitat,is it annotated with @Service ?", delete.decorator().toString()); result.failure(logger, msg); throw new TransactionFailure(msg); } else { // inject the decorator with any parameters from the initial CLI invocation manager.inject(decorator, paramResolver); // invoke the decorator decorator.decorate(context, parentProxy, tgt); } return null; } }, parentProxy);
/** * Return the list of nodes currently configured * * @return list of {@link Node } */ @Element @Create(value="_create-node", decorator=Node.Decorator.class, i18n=@I18n("_create.node.command") ) @Delete(value="_delete-node", resolver= TypeAndNameResolver.class, decorator=Node.DeleteDecorator.class, i18n=@I18n("delete.node.command")) public List<Node> getNode();
@Override public void postConstruct() { super.postConstruct(); delete = targetMethod.getAnnotation(Delete.class); resolverType = delete.resolver(); try { // we pass false for "useAnnotations" as the @Param declarations on // the target type are not used for the Delete method parameters. model = new GenericCommandModel(targetType, false, delete.cluster(), delete.i18n(), new LocalStringManagerImpl(targetType), habitat.getComponent(DomDocument.class), commandName, delete.resolver(), delete.decorator()); if (logger.isLoggable(level)) { for (String paramName : model.getParametersNames()) { CommandModel.ParamModel param = model.getModelFor(paramName); logger.fine("I take " + param.getName() + " parameters"); } } } catch(Exception e) { String msg = localStrings.getLocalString(GenericCrudCommand.class, "GenericCreateCommand.command_model_exception", "Exception while creating the command model for the generic command {0} : {1}", commandName, e.getMessage()); logger.severe(msg); throw new ComponentException(msg, e); } }
@Override public Object run(ConfigBeanProxy parentProxy) throws PropertyVetoException, TransactionFailure { ConfigSupport._deleteChild(child.parent(), (WriteableView) Proxy.getInvocationHandler(parentProxy), child); DeletionDecorator<ConfigBeanProxy, ConfigBeanProxy> decorator = habitat.getComponent(delete.decorator()); if (decorator==null) { String msg = localStrings.getLocalString(GenericCrudCommand.class, "GenericCreateCommand.deletion_decorator_not_found", "The DeletionDecorator {0} could not be found in the habitat,is it annotated with @Service ?", delete.decorator().toString()); result.failure(logger, msg); throw new TransactionFailure(msg); } else { // inject the decorator with any parameters from the initial CLI invocation manager.inject(decorator, paramResolver); // invoke the decorator decorator.decorate(context, parentProxy, target); } return null; } }, parentProxy);
/** * Return the list of clusters currently configured * * @return list of {@link Cluster } */ @Element @Create(value="create-cluster", decorator=Cluster.Decorator.class, i18n=@I18n("create.cluster.command")) @Delete(value="delete-cluster", resolver= TypeAndNameResolver.class, decorator=Cluster.DeleteDecorator.class , i18n=@I18n("delete.cluster.command")) public List<Cluster> getCluster();
/** * Returns the list of registered templates for this virtualization infrastructure. Such template * are image files that can be duplicated to create virtual machines. * * @return list of registered templates */ @Element("template") @Listing(value = "list-templates", resolver = VirtResolver.class, i18n = @I18n("org.glassfish.virtualization.list-templates")) @Delete(value="remove-template", resolver = TypeAndNameResolver.class, i18n = @I18n("org.glassfish.virtualization.remove-template")) List<Template> getTemplates();
/** * Return the list of nodes currently configured * * @return list of {@link Node } */ @Element @Create(value="_create-node", decorator=Node.Decorator.class, i18n=@I18n("_create.node.command") ) @Delete(value="_delete-node", resolver= TypeAndNameResolver.class, decorator=Node.DeleteDecorator.class, i18n=@I18n("delete.node.command")) public List<Node> getNode();
/** * Return the list of currently configured server. Servers can * be added or removed by using the returned {@link java.util.List} * instance * * @return the list of configured {@link Server} */ @Element // example below on how to annotate a CRUD command with cluster specific data. @Create(value="_register-instance", resolver= TypeResolver.class, decorator= Server.CreateDecorator.class, cluster=@org.glassfish.api.admin.ExecuteOn(value = RuntimeType.DAS), i18n=@I18n("_register.instance.command")) @Delete(value="_unregister-instance", resolver= TypeAndNameResolver.class, decorator=Server.DeleteDecorator.class, cluster=@org.glassfish.api.admin.ExecuteOn(value = {RuntimeType.DAS,RuntimeType.INSTANCE}), i18n=@I18n("_unregister.instance.command")) public List<Server> getServer();
/** * Return the list of currently configured server. Servers can * be added or removed by using the returned {@link java.util.List} * instance * * @return the list of configured {@link Server} */ @Element // example below on how to annotate a CRUD command with cluster specific data. @Create(value="_register-instance", resolver= TypeResolver.class, decorator= Server.CreateDecorator.class, cluster=@org.glassfish.api.admin.ExecuteOn(value = RuntimeType.DAS), i18n=@I18n("_register.instance.command")) @Delete(value="_unregister-instance", resolver= TypeAndNameResolver.class, decorator=Server.DeleteDecorator.class, cluster=@org.glassfish.api.admin.ExecuteOn(value = {RuntimeType.DAS,RuntimeType.INSTANCE}), i18n=@I18n("_unregister.instance.command")) public List<Server> getServer();
/** * Gets the value of the loadBalancer property. * <p/> * <p/> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the loadBalancer property. * <p/> * <p/> * For example, to add a new item, do as follows: * <pre> * getLoadBalancer().add(newItem); * </pre> * <p/> * <p/> * <p/> * Objects of the following type(s) are allowed in the list * {@link LoadBalancer } */ @Element @Delete(value="delete-http-lb", resolver= TypeAndNameResolver.class, decorator=LoadBalancer.DeleteDecorator.class, i18n=@I18n("delete.http.lb.command")) @Listing(value="list-http-lbs", i18n=@I18n("list.http.lbs.command")) public List<LoadBalancer> getLoadBalancer();
@Element @Create(value="enable-secure-admin-principal", decorator=SecureAdminPrincipal.CrDecorator.class, i18n=@I18n("enable.secure.admin.principal.command")) @Delete(value="disable-secure-admin-principal", resolver=SecureAdminPrincipal.Resolver.class, i18n=@I18n("disable.secure.admin.principal.command")) @Listing(value="list-secure-admin-principals", resolver=SecureAdminPrincipal.Resolver.class, i18n=@I18n("list.secure.admin.principals.command")) public List<SecureAdminPrincipal> getSecureAdminPrincipal();
@Element @Create(value="enable-secure-admin-internal-user", decorator=SecureAdminInternalUser.CrDecorator.class, i18n=@I18n("enable.secure.admin.internal.user.command")) @Delete(value="disable-secure-admin-internal-user", resolver=TypeAndNameResolver.class, i18n=@I18n("disable.secure.admin.internal.user.command")) @Listing(value="list-secure-admin-internal-users", resolver=TypeAndNameResolver.class, i18n=@I18n("list.secure.admin.internal.user.command")) public List<SecureAdminInternalUser> getSecureAdminInternalUser();
/** * Gets the value of the loadBalancer property. * <p/> * <p/> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the loadBalancer property. * <p/> * <p/> * For example, to add a new item, do as follows: * <pre> * getLoadBalancer().add(newItem); * </pre> * <p/> * <p/> * <p/> * Objects of the following type(s) are allowed in the list * {@link LoadBalancer } */ @Element @Delete(value="delete-http-lb", resolver= TypeAndNameResolver.class, decorator=LoadBalancer.DeleteDecorator.class, i18n=@I18n("delete.http.lb.command")) @Listing(value="list-http-lbs", i18n=@I18n("list.http.lbs.command")) public List<LoadBalancer> getLoadBalancer();
/** * This really should not be here mixing clients and providers information , but for prototyping * it's fine. */ @Element("server-pool") @Create(value = "create-server-pool", resolver = VirtResolver.class, decorator = ServerPoolDecorator.class, i18n = @I18n("org.glassfish.virtualization.create-virt-serverPool")) @Listing(value = "list-server-pools", resolver = VirtResolver.class, i18n = @I18n("org.glassfish.virtualization.list-virt-groups")) @Delete(value="delete-server-pool", resolver= TypeAndNameResolver.class, i18n = @I18n("org.glassfish.virtualization.list-virt-serverPool")) List<ServerPoolConfig> getServerPools();
@Element @Create(value = "create-machine", resolver = ServerPoolResolver.class, i18n = @I18n("org.glassfish.virtualization.create-machine")) @Listing(value = "list-machines", resolver = ServerPoolResolver.class, i18n = @I18n("org.glassfish.virtualization.list-machines")) @Delete(value="delete-machine", resolver= WithinGroupResolver.class, i18n = @I18n("org.glassfish.virtualization.delete-machine")) List<MachineConfig> getMachines();
/** * Gets the value of the lbConfig property. * <p/> * <p/> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the lbConfig property. * <p/> * <p/> * For example, to add a new item, do as follows: * <pre> * getLbConfig().add(newItem); * </pre> * <p/> * <p/> * <p/> * Objects of the following type(s) are allowed in the list * {@link LbConfig } */ @Element @Create(value="create-http-lb-config", decorator=LbConfig.Decorator.class, cluster=@org.glassfish.api.admin.ExecuteOn(value = RuntimeType.DAS), i18n=@I18n("create.http.lb.config.command")) @Delete(value="delete-http-lb-config", resolver= TypeAndNameResolver.class, decorator=LbConfig.DeleteDecorator.class, i18n=@I18n("delete.http.lb.config.command")) public List<LbConfig> getLbConfig();