001    /*
002     * Copyright 2009 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may      obtain a copy of the License at
007     *
008     *      http://www.osedu.org/licenses/ECL-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.student.mock.mojo;
017    
018    import org.apache.maven.plugin.MojoExecutionException;
019    import org.apache.maven.plugin.MojoFailureException;
020    import org.kuali.student.common.mojo.AbstractKSMojo;
021    import org.kuali.student.contract.model.ServiceContractModel;
022    import org.kuali.student.contract.writer.service.MockImplWriter;
023    
024    /**
025     *
026     * @author nwright
027     * 
028     *  @goal kscreatemock
029     *  @phase site
030     *  @requiresProject true
031     */
032    public class KSCreateMockImplMojo extends AbstractKSMojo {
033    
034        public KSCreateMockImplMojo() {
035        }
036     
037        
038        @Override
039            public void execute() throws MojoExecutionException, MojoFailureException {
040            ServiceContractModel model = getModel();
041            validate(model);
042            String targetDir = "target/generated-mock-impls";
043            boolean isR1 = false;
044            MockImplWriter instance =
045                    new MockImplWriter(model,
046                    targetDir,
047                    MockImplWriter.ROOT_PACKAGE,
048                    null,
049                    isR1);
050            instance.write();
051    
052        }
053    }