net.shibboleth.idp.shell.IdpCommands.java Source code

Java tutorial

Introduction

Here is the source code for net.shibboleth.idp.shell.IdpCommands.java

Source

/*
 * Licensed to the University Corporation for Advanced Internet Development, 
 * Inc. (UCAID) under one or more contributor license agreements.  See the 
 * NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The UCAID 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 net.shibboleth.idp.shell;

import java.util.ArrayList;

import net.shibboleth.idp.attribute.cli.Main;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/** IdP shell commands. */
@Component
public class IdpCommands implements CommandMarker {

    /** Class logger. */
    private final Logger log = LoggerFactory.getLogger(IdpCommands.class);

    /**
     * Run the AACLI.
     * 
     * @param configDir the configuration directory
     * @return null
     */
    @CliCommand(value = "aacli", help = "aacli")
    public String aacli(
            @CliOption(key = "configDir", help = "Path to the configuration directory", unspecifiedDefaultValue = "../idp-attribute-cli/src/main/resources/conf") String configDir) {

        log.info("configDir '{}'", configDir);

        ArrayList<String> list = new ArrayList<String>();

        list.add("--configDir");
        list.add(configDir);

        String[] args = list.toArray(new String[] {});

        Main.main(args);

        return null;
    }
}