L.S.,

Do you have any idea when we will have a -SNAPSHOT available on
people.apache.org that contains this change?  The last gshell-api SNAPSHOT
available at
http://people.apache.org/repo/m2-snapshot-repository/org/apache/geronimo/gshell/gshell-api/1.0-alpha-2-SNAPSHOT/
seems to be over a week old.

Regards,

Gert


Jason Dillon wrote:
> 
> Thx :-)
> 
> --jason
> 
> 
> On Dec 17, 2008, at 4:31 PM, gno...@apache.org wrote:
> 
>> Author: gnodet
>> Date: Wed Dec 17 01:31:44 2008
>> New Revision: 727321
>>
>> URL: http://svn.apache.org/viewvc?rev=727321&view=rev
>> Log:
>> GSHELL-154: Create interfaces to represent links and aliases
>>
>> Added:
>>    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Alias.java
>>    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Link.java
>>    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/command/AliasImpl.java
>>    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/command/LinkImpl.java
>> Modified:
>>    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java
>>    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/plugin/bundle/ 
>> CommandBundle.java
>>
>> Added: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Alias.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Alias.java?rev=727321&view=auto
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> ======================================================================
>> --- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Alias.java (added)
>> +++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Alias.java Wed Dec 17 01:31:44 2008
>> @@ -0,0 +1,33 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF 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 org.apache.geronimo.gshell.command;
>> +
>> +/**
>> + * Convenient way to register an alias.
>> + *
>> + * @version $Rev: 705507 $ $Date: 2008-10-17 10:22:12 +0200 (Fri,  
>> 17 Oct 2008) $
>> + */
>> +public interface Alias {
>> +
>> +    String getName();
>> +
>> +    String getAlias();
>> +
>> +}
>>
>> Added: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Link.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Link.java?rev=727321&view=auto
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> ======================================================================
>> --- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Link.java (added)
>> +++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/ 
>> geronimo/gshell/command/Link.java Wed Dec 17 01:31:44 2008
>> @@ -0,0 +1,33 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF 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 org.apache.geronimo.gshell.command;
>> +
>> +/**
>> + * Provides a convenient way to register a link
>> + *
>> + * @version $Rev: 705507 $ $Date: 2008-10-17 10:22:12 +0200 (Fri,  
>> 17 Oct 2008) $
>> + */
>> +public interface Link {
>> +
>> +    String getName();
>> +
>> +    String getTarget();
>> +
>> +}
>>
>> Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/ 
>> main/java/org/apache/geronimo/gshell/wisdom/command/AliasImpl.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasImpl.java?rev=727321&view=auto
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> ======================================================================
>> --- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/command/AliasImpl.java (added)
>> +++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/command/AliasImpl.java Wed  
>> Dec 17 01:31:44 2008
>> @@ -0,0 +1,47 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF 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 org.apache.geronimo.gshell.wisdom.command;
>> +
>> +import org.apache.geronimo.gshell.command.Alias;
>> +
>> +/**
>> + * Simpe implementation of {...@link Alias} interface.
>> + *
>> + * @version $Rev: 706889 $ $Date: 2008-10-22 10:12:04 +0200 (Wed,  
>> 22 Oct 2008) $
>> + */
>> +public class AliasImpl implements Alias {
>> +
>> +    private String name;
>> +    private String alias;
>> +
>> +    public AliasImpl(String name, String alias) {
>> +        this.name = name;
>> +        this.alias = alias;
>> +    }
>> +
>> +    public String getName() {
>> +        return name;
>> +    }
>> +
>> +    public String getAlias() {
>> +        return alias;
>> +    }
>> +}
>>
>> Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/ 
>> main/java/org/apache/geronimo/gshell/wisdom/command/LinkImpl.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/LinkImpl.java?rev=727321&view=auto
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> ======================================================================
>> --- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/command/LinkImpl.java (added)
>> +++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/command/LinkImpl.java Wed Dec  
>> 17 01:31:44 2008
>> @@ -0,0 +1,46 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF 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 org.apache.geronimo.gshell.wisdom.command;
>> +
>> +import org.apache.geronimo.gshell.command.Link;
>> +
>> +/**
>> + * Alias {...@link org.apache.geronimo.gshell.command.Command}  
>> component.
>> + *
>> + * @version $Rev: 706889 $ $Date: 2008-10-22 10:12:04 +0200 (Wed,  
>> 22 Oct 2008) $
>> + */
>> +public class LinkImpl implements Link {
>> +
>> +    private String name;
>> +    private String target;
>> +
>> +    public LinkImpl(String name, String target) {
>> +        this.name = name;
>> +        this.target = target;
>> +    }
>> +
>> +    public String getName() {
>> +        return name;
>> +    }
>> +
>> +    public String getTarget() {
>> +        return target;
>> +    }
>> +}
>>
>> Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/ 
>> main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java?rev=727321&r1=727320&r2=727321&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> ======================================================================
>> --- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java  
>> (original)
>> +++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java Wed  
>> Dec 17 01:31:44 2008
>> @@ -21,8 +21,12 @@
>>
>> import  
>> org 
>> .apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter;
>> import org.apache.geronimo.gshell.wisdom.command.LinkCommand;
>> +import org.apache.geronimo.gshell.wisdom.command.AliasImpl;
>> +import org.apache.geronimo.gshell.wisdom.command.LinkImpl;
>> import org.apache.geronimo.gshell.wisdom.plugin.bundle.CommandBundle;
>> import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
>> +import org.apache.geronimo.gshell.command.Alias;
>> +import org.apache.geronimo.gshell.command.Link;
>> import org.slf4j.Logger;
>> import org.slf4j.LoggerFactory;
>> import org.springframework.beans.factory.BeanDefinitionStoreException;
>> @@ -103,6 +107,8 @@
>>
>>     private static final String LINK = "link";
>>
>> +    private static final String LINKS = "links";
>> +
>>     private static final String TARGET = "target";
>>
>>     @Override
>> @@ -387,13 +393,16 @@
>>             ManagedList commands = new ManagedList();
>>             // noinspection unchecked
>>             commands.addAll(parseCommands(element));
>> -            // noinspection unchecked
>> -            commands.addAll(parseLinks(element));
>>             bundle.addPropertyValue(COMMANDS, commands);
>>
>> -            ManagedMap aliases = new ManagedMap();
>> +            ManagedList links = new ManagedList();
>>             // noinspection unchecked
>> -            aliases.putAll(parseAliases(element));
>> +            links.addAll(parseLinks(element));
>> +            bundle.addPropertyValue(LINKS, links);
>> +
>> +            ManagedList aliases = new ManagedList();
>> +            // noinspection unchecked
>> +            aliases.addAll(parseAliases(element));
>>             bundle.addPropertyValue(ALIASES, aliases);
>>
>>             return bundle;
>> @@ -543,27 +552,20 @@
>>         // <gshell:link>
>>         //
>>
>> -        private List<BeanDefinition> parseLinks(final Element  
>> element) {
>> +        private List<Link> parseLinks(final Element element) {
>>             assert element != null;
>>
>>             log.trace("Parse links; element; {}", element);
>>
>> -            List<BeanDefinition> links = new  
>> ArrayList<BeanDefinition>();
>> +            List<Link> links = new ArrayList<Link>();
>>
>>             List<Element> children = getChildElements(element, LINK);
>>
>>             for (Element child : children) {
>> -                BeanDefinitionBuilder link =  
>> BeanDefinitionBuilder.rootBeanDefinition(LinkCommand.class);
>> -                link.addConstructorArgReference("commandRegistry");
>> -                 
>> link.addConstructorArgValue(child.getAttribute(TARGET));
>> -
>>                 String name = child.getAttribute(NAME);
>> -                BeanDefinition def = new GenericBeanDefinition();
>> -                 
>> def.setBeanClassName(CommandLocationImpl.class.getName());
>> -                 
>> def.getConstructorArgumentValues().addGenericArgumentValue(name);
>> -                link.addPropertyValue(LOCATION, def);
>> +                String target = child.getAttribute(TARGET);
>>
>> -                links.add(link.getBeanDefinition());
>> +                links.add(new LinkImpl(name, target));
>>             }
>>
>>             return links;
>> @@ -573,12 +575,12 @@
>>         // <gshell:alias>
>>         //
>>
>> -        private Map<String,String> parseAliases(final Element  
>> element) {
>> +        private List<Alias> parseAliases(final Element element) {
>>             assert element != null;
>>
>>             log.trace("Parse aliases; element; {}", element);
>>
>> -            Map<String,String> aliases = new  
>> LinkedHashMap<String,String>();
>> +            List<Alias> aliases = new ArrayList<Alias>();
>>
>>             List<Element> children = getChildElements(element, ALIAS);
>>
>> @@ -586,7 +588,7 @@
>>                 String name = child.getAttribute(NAME);
>>                 String alias = child.getAttribute(ALIAS);
>>
>> -                aliases.put(name, alias);
>> +                aliases.add(new AliasImpl(name, alias));
>>             }
>>
>>             return aliases;
>>
>> Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/ 
>> main/java/org/apache/geronimo/gshell/wisdom/plugin/bundle/ 
>> CommandBundle.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/bundle/CommandBundle.java?rev=727321&r1=727320&r2=727321&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> ======================================================================
>> --- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/plugin/bundle/ 
>> CommandBundle.java (original)
>> +++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/ 
>> java/org/apache/geronimo/gshell/wisdom/plugin/bundle/ 
>> CommandBundle.java Wed Dec 17 01:31:44 2008
>> @@ -20,11 +20,16 @@
>> package org.apache.geronimo.gshell.wisdom.plugin.bundle;
>>
>> import org.apache.geronimo.gshell.command.Command;
>> +import org.apache.geronimo.gshell.command.Alias;
>> +import org.apache.geronimo.gshell.command.Link;
>> import org.apache.geronimo.gshell.registry.AliasRegistry;
>> import org.apache.geronimo.gshell.registry.CommandRegistry;
>> +import org.apache.geronimo.gshell.wisdom.command.LinkCommand;
>> +import  
>> org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
>>
>> import java.util.List;
>> import java.util.Map;
>> +import java.util.ArrayList;
>>
>> /**
>>  * A bundle of {...@link Command} instances.
>> @@ -40,7 +45,11 @@
>>
>>     private List<Command> commands;
>>
>> -    private Map<String,String> aliases;
>> +    private List<Link> links;
>> +
>> +    private List<Alias> aliases;
>> +
>> +    private List<Command> linkCommands;
>>
>>     public CommandBundle(final CommandRegistry commandRegistry,  
>> final AliasRegistry aliasRegistry, final String name) {
>>         super(name);
>> @@ -60,23 +69,47 @@
>>         this.commands = commands;
>>     }
>>
>> -    public Map<String, String> getAliases() {
>> +    public List<Link> getLinks() {
>> +        return links;
>> +    }
>> +
>> +    public void setLinks(List<Link> links) {
>> +        assert links != null;
>> +
>> +        this.links = links;
>> +    }
>> +
>> +    public List<Alias> getAliases() {
>>         return aliases;
>>     }
>>
>> -    public void setAliases(final Map<String,String> aliases) {
> 
>> +    public void setAliases(final List<Alias> aliases) {
>>         assert aliases != null;
>>
>>         this.aliases = aliases;
>>     }
>>
>>     protected void doEnable() throws Exception {
>> +        // Create links commands
>> +        if (linkCommands == null) {
>> +            linkCommands = new ArrayList<Command>();
>> +            for (Link link : links) {
>> +                LinkCommand cmd = new LinkCommand(commandRegistry,  
>> link.getTarget());
>> +                cmd.setLocation(new  
>> CommandLocationImpl(link.getName()));
>> +                linkCommands.add(cmd);
>> +            }
>> +        }
>> +
>>         for (Command command : commands) {
>>             commandRegistry.registerCommand(command);
>>         }
>>
>> -        for (String name : aliases.keySet()) {
>> -            aliasRegistry.registerAlias(name, aliases.get(name));
>> +        for (Command command : linkCommands) {
>> +            commandRegistry.registerCommand(command);
>> +        }
>> +
>> +        for (Alias alias : aliases) {
>> +            aliasRegistry.registerAlias(alias.getName(),  
>> alias.getAlias());
>>         }
>>     }
>>
>> @@ -85,8 +118,12 @@
>>             commandRegistry.removeCommand(command);
>>         }
>>
>> -        for (String name : aliases.keySet()) {
>> -            aliasRegistry.removeAlias(name);
>> +        for (Command command : linkCommands) {
>> +            commandRegistry.removeCommand(command);
>> +        }
>> +
>> +        for (Alias alias : aliases) {
>> +            aliasRegistry.removeAlias(alias.getName());
>>         }
>>     }
>> }
>> \ No newline at end of file
>>
>>
> 
> 
> 


-----
---
Gert Vanthienen
http://gertvanthienen.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/Re%3A-svn-commit%3A-r727321---in--geronimo-gshell-trunk%3A-gshell-api-src-main-java-org-apache-geronimo-gshell-command--gshell-wisdom-gshell-wisdom-core-src-main-java-org-apache-geronimo-gshell-wisdom-command--gshell-wisdom-gshell-wisdom-core-src-main-java-org-a...-tp21067909s134p21091483.html
Sent from the Apache Geronimo - Dev mailing list archive at Nabble.com.

Reply via email to