/* * gvNIX is an open source tool for rapid application development (RAD). * Copyright (C) 2010 Generalitat Valenciana * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package org.gvnix.addon.jpa.addon; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Service; import org.springframework.roo.shell.CliAvailabilityIndicator; import org.springframework.roo.shell.CliCommand; import org.springframework.roo.shell.CommandMarker; /** * Sample of a command class. The command class is registered by the Roo shell * following an automatic classpath scan. You can provide simple user * presentation-related logic in this class. You can return any objects from * each method, or use the logger directly if you'd like to emit messages of * different severity (and therefore different colours on non-Windows systems). * * @author <a href="http://www.disid.com">DISID Corporation S.L.</a> made for <a * href="http://www.dgti.gva.es">General Directorate for Information * Technologies (DGTI)</a> * @since 1.1 */ @Component // Use these Apache Felix annotations to register your commands class in the Roo // container @Service public class JpaCommands implements CommandMarker { // All command types must // implement the // CommandMarker interface /** * Get a reference to the JpaOperations from the underlying OSGi container */ @Reference private JpaOperations operations; /** * Informs if jpa gvnix setup is avalilable * * @return true (default) if the command should be visible at this stage, * false otherwise */ @CliAvailabilityIndicator({ "jpa gvnix setup" }) public boolean isCommandAvailable() { return operations.isSetupAvailable(); } /** * Command to enable jpa gvnix utilities on project * * @param type */ @CliCommand(value = "jpa gvnix setup", help = "Setup the project dependencies that gvNIX JPA utilities need") public void setup() { operations.setup(); } }