All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.swiftmq.mgmt.CommandExecutor Maven / Gradle / Ivy

/*
 * Copyright 2019 IIT Software GmbH
 *
 * IIT Software GmbH licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.swiftmq.mgmt;

/**
 * A CommandExecutor is attached to a Command object and actually executes the commmand.
 *
 * @author IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
 * @see Command
 */
public interface CommandExecutor {

    /**
     * Called to execute the command.
     * This method is called from the MgmtSwiftlet when a user performs the command
     * with CLI or SwiftMQ Explorer. The context parameter contains the
     * current command context, that is, for example, String[]{"sys$queuemanager","queues"}
     * for "/sys$queuemanager/queues". The entity is the Entity object where the command
     * is attached to, and parameter are the parameters, given to this command.
     * For example, the command "new testqueue1 cache-size 200" will be translated into the
     * parameter String[]{"new","testqueue1","cache-size","200"}.

* This method has to validate the parameters and executes the command. It returns a * String array which is either null (means success) or the following structure:

*
  • String[0] contains "Error:" if an error has occured or * "Information:" if an information should be displayed to the user.
  • *
  • String[1] contains the error resp. the info message


* Examples:

*
  • return new String[]{"Information:", "To activate this Change, a Reboot of this Router is required."};
  • *
  • return new String[]{"Error:", "Mandatory Property '" + p.getName() + "' must be set."};
  • *
  • return new String[]{"Error:", e.getMessage()};
* * @param context current context. * @param entity parent entity. * @param parameter command parameter. * @return state structure. */ public String[] execute(String[] context, Entity entity, String[] parameter); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy