What I forgot to say above is that the result of above will be an array (String[]) which is acceptable for String+.
- Ray On Fri, May 13, 2016 at 10:04 AM, Raymond Auge <[email protected]> wrote: > The syntax is simply to repeat the same property name as another pair: > > e.g. > > property = { > CommandProcessor.COMMAND_SCOPE + ":String=example", > CommandProcessor.COMMAND_FUNCTION + "=listProjects", > CommandProcessor.COMMAND_FUNCTION + "=getProject", > CommandProcessor.COMMAND_FUNCTION + "=addProject", > CommandProcessor.COMMAND_FUNCTION + "=removeProject" > } > > In OSGi this is commonly referred to as a property of type String+ > (pronounced "StringPlus") which means that any value of type String, > String[], or List<String> is acceptable. > > HTH > - Ray > > > On Fri, May 13, 2016 at 9:44 AM, Tom Quarendon < > [email protected]> wrote: > >> I’m trying to figure out how to register more than one command in the >> gogo shell from one java class, when using an osgi Component annotation. >> >> So for one command, it’s fine. I can do: >> >> import org.osgi.service.component.annotations.Component; // NB >> @Component( >> service = Object.class, >> property = { >> CommandProcessor.COMMAND_SCOPE + ":String=example", >> CommandProcessor.COMMAND_FUNCTION + "=listProjects" >> } >> ) >> public class ListProjectsCommand { >> public void listProjects() { >> System.out.println("listing Projects"); >> } >> } >> >> >> My question is, how do I register more? >> >> I can’t work out the syntax for passing in an array of names as the value >> of the COMMAND_FUNCTION property. >> I’ve tried “list*”, as hinted at in the doc (“A name may end with a *, >> this will then be calculated from all declared public methods in this >> service”), but that doesn’t work. >> Ideally I want to say “*” but that doesn’t seem to work either, as far as >> I can tell. >> >> I don’t really want to have to create one java class for each, trivial, >> command I want in the gogo shell. >> Any suggestions? >> Thanks. >> >> > > > -- > *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile> > (@rotty3000) > Senior Software Architect *Liferay, Inc.* <http://www.liferay.com> > (@Liferay) > Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> > (@OSGiAlliance) > -- *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile> (@rotty3000) Senior Software Architect *Liferay, Inc.* <http://www.liferay.com> (@Liferay) Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

