You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/10/05 02:02:39 UTC

svn commit: r582032 - /geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/

Author: jdillon
Date: Thu Oct  4 17:02:37 2007
New Revision: 582032

URL: http://svn.apache.org/viewvc?rev=582032&view=rev
Log:
Add new descriptor bits moved out of api and removed dependency on plexus

Added:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/
      - copied from r580765, geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java
      - copied, changed from r581061, geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandDescriptor.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java   (with props)
Removed:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptorWriter.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/package-info.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java?rev=582032&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java Thu Oct  4 17:02:37 2007
@@ -0,0 +1,127 @@
+/*
+ * 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.descriptor;
+
+import java.util.Map;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+
+/**
+ * Describes arbitrary configuration for a command.
+ *
+ * @version $Rev$ $Date$
+ */
+@XStreamAlias("configuration")
+public class CommandConfiguration
+{
+    private String name;
+
+    private String value;
+
+    private Map<String,String> attributes;
+
+    private Map<String,CommandConfiguration> children;
+
+    public CommandConfiguration(final String name) {
+        this.name = name;
+    }
+
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public String getValue() throws CommandConfigurationException {
+        return value;
+    }
+
+    public String getValue(final String defaultValue) {
+        try {
+            return getValue();
+        }
+        catch (CommandConfigurationException e) {
+            return defaultValue;
+        }
+    }
+
+    public void setValue(final String value) {
+        this.value = value;
+    }
+
+    public Map<String, String> getAttributes() {
+        return attributes;
+    }
+
+    /*
+    String[] getAttributeNames();
+
+    String getAttribute(String paramName) throws CommandConfigurationException;
+
+    String getAttribute(String name, String defaultValue);
+
+    CommandConfiguration getChild(String child);
+
+    CommandConfiguration getChild(int i);
+
+    CommandConfiguration getChild(String child, boolean createChild);
+
+    CommandConfiguration[] getChildren();
+
+    CommandConfiguration[] getChildren(String name);
+
+
+    int getChildCount();
+    */
+
+    public void addChild(final CommandConfiguration configuration) {
+        assert configuration != null;
+
+        //
+        // TODO:
+        //
+    }
+
+    public void setAttributes(final Map<String, String> attributes) {
+        this.attributes = attributes;
+    }
+
+    // TODO: getAttribute()
+
+    public Map<String,CommandConfiguration> getChildren() {
+        return children;
+    }
+
+    public void setChildren(final Map<String,CommandConfiguration> children) {
+        this.children = children;
+    }
+
+    // TODO: getChild()
+
+    // TODO: addChild()
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java?rev=582032&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java Thu Oct  4 17:02:37 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.descriptor;
+
+/**
+ * Thrown to indicate a problem with a commands configuration.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CommandConfigurationException
+    extends Exception
+{
+    public CommandConfigurationException() {}
+
+    public CommandConfigurationException(final String msg) {
+        super(msg);
+    }
+
+    public CommandConfigurationException(final String msg, final Throwable cause) {
+        super(msg, cause);
+    }
+
+    public CommandConfigurationException(final Throwable cause) {
+        super(cause);
+    }
+}

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java?rev=582032&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java Thu Oct  4 17:02:37 2007
@@ -0,0 +1,77 @@
+/*
+ * 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.descriptor;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+
+/**
+ * Describes a dependency of a command.
+ *
+ * @version $Rev$ $Date$
+ */
+@XStreamAlias("dependency")
+public class CommandDependency
+{
+    private String groupId;
+
+    private String artifactId;
+
+    private String type;
+
+    private String version;
+
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(final String groupId) {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId() {
+        return artifactId;
+    }
+
+    public void setArtifactId(final String artifactId) {
+        this.artifactId = artifactId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(final String version) {
+        this.version = version;
+    }
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDependency.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java (from r581061, geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandDescriptor.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java?p2=geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java&p1=geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandDescriptor.java&r1=581061&r2=582032&rev=582032&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandDescriptor.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java Thu Oct  4 17:02:37 2007
@@ -17,36 +17,137 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.command.descriptor;
+package org.apache.geronimo.gshell.descriptor;
 
-import org.codehaus.plexus.component.repository.ComponentDescriptor;
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 
-//
-// TODO: Detach from Plexus' ComponentDescriptor
-//
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
 
 /**
- * Descriptor for a command.
+ * Describes a command.
  *
  * @version $Rev$ $Date$
  */
+@XStreamAlias("command")
 public class CommandDescriptor
-    extends ComponentDescriptor
 {
+    private URI source;
+
     private String id;
 
+    private String implementation;
+
+    private String description;
+
+    private String version;
+
+    private CommandConfiguration configuration;
+
+    private List<CommandRequirement> requirements;
+
+    private List<CommandDependency> dependencies;
+
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
+
+    public URI getSource() {
+        return source;
+    }
+
+    public void setSource(final URI source) {
+        this.source = source;
+    }
+
     public String getId() {
         return id;
     }
 
     public void setId(final String id) {
-        assert id != null;
-
         this.id = id;
     }
 
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this);
+    public String getImplementation() {
+        return implementation;
+    }
+
+    public void setImplementation(final String implementation) {
+        this.implementation = implementation;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(final String version) {
+        this.version = version;
+    }
+
+    public CommandConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(final CommandConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    public boolean hasConfiguration() {
+        return configuration != null;
+    }
+    
+    public List<CommandRequirement> getRequirements() {
+        return requirements;
+    }
+
+    public void setRequirements(final List<CommandRequirement> requirements) {
+        this.requirements = requirements;
+    }
+
+    public void addRequirement(final CommandRequirement requirement) {
+        assert requirement != null;
+
+        if (requirements == null) {
+            requirements = new ArrayList<CommandRequirement>();
+        }
+
+        requirements.add(requirement);
+    }
+
+    public boolean hasRequirements() {
+        return requirements != null;
+    }
+
+    public List<CommandDependency> getDependencies() {
+        return dependencies;
+    }
+
+    public void setDependencies(final List<CommandDependency> dependencies) {
+        this.dependencies = dependencies;
+    }
+
+    public void addDependency(final CommandDependency dependency) {
+        assert dependency != null;
+
+        if (dependencies == null) {
+            dependencies = new ArrayList<CommandDependency>();
+        }
+
+        dependencies.add(dependency);
+    }
+
+    public boolean hasDependencies() {
+        return dependencies != null;
     }
 }

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java?rev=582032&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java Thu Oct  4 17:02:37 2007
@@ -0,0 +1,77 @@
+/*
+ * 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.descriptor;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+
+/**
+ * Describes a required component of a command.
+ *
+ * @version $Rev$ $Date$
+ */
+@XStreamAlias("requirement")
+public class CommandRequirement
+{
+    private String name;
+
+    private String type;
+
+    private String id;
+
+    private Boolean collection;
+
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(final String id) {
+        this.id = id;
+    }
+
+    public boolean isCollection() {
+        return collection;
+    }
+
+    public void setCollection(final boolean collection) {
+        this.collection = collection;
+    }
+}

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java?rev=582032&r1=580765&r2=582032&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java Thu Oct  4 17:02:37 2007
@@ -17,32 +17,47 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.command.descriptor;
+package org.apache.geronimo.gshell.descriptor;
 
+import java.io.Reader;
+import java.io.Writer;
+import java.util.ArrayList;
 import java.util.List;
 
-import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.annotations.Annotations;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import com.thoughtworks.xstream.io.xml.DomDriver;
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 
 /**
- * Descriptor for a set of commands.
+ * Describes a set of commands.
  *
  * @version $Rev$ $Date$
  */
+@XStreamAlias("command-set")
 public class CommandSetDescriptor
-    extends ComponentSetDescriptor
 {
     private String id;
 
     private String description;
 
+    private List<CommandDescriptor> commands;
+
+    public CommandSetDescriptor(final String id) {
+        this.id = id;
+    }
+
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
+
     public String getId() {
         return id;
     }
 
     public void setId(final String id) {
-        assert id != null;
-
         this.id = id;
     }
 
@@ -53,18 +68,72 @@
     public void setDescription(final String description) {
         this.description = description;
     }
-    
-    public void addCommandDescriptor(final CommandDescriptor desc) {
-        assert desc != null;
 
-        addComponentDescriptor(desc);
+    public List<CommandDescriptor> getCommands() {
+        return commands;
     }
 
-    public List<CommandDescriptor> getCommandDescriptors() {
-        return getComponents();
+    public void setCommands(final List<CommandDescriptor> commands) {
+        this.commands = commands;
     }
 
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this);
+    public void addCommand(final CommandDescriptor command) {
+        assert command != null;
+
+        if (commands == null) {
+            commands = new ArrayList<CommandDescriptor>();
+        }
+
+        commands.add(command);
+    }
+
+    public int size() {
+        List<CommandDescriptor> list = getCommands();
+
+        if (list != null) {
+            return list.size();
+        }
+
+        return 0;
+    }
+
+    public boolean isEmpty() {
+        return size() == 0;
+    }
+
+    //
+    // XML Conversion
+    //
+
+    private static XStream createXStream() {
+        XStream xs = new XStream(new DomDriver());
+
+        Annotations.configureAliases(xs,
+                CommandSetDescriptor.class,
+                CommandDescriptor.class,
+                CommandRequirement.class,
+                CommandConfiguration.class,
+                CommandDependency.class);
+
+        return xs;
+    }
+
+    public static CommandSetDescriptor fromXML(final Reader input) {
+        assert input != null;
+
+        return (CommandSetDescriptor) createXStream().fromXML(input);
+    }
+
+    public static String toXML(final CommandSetDescriptor commands) {
+        assert commands != null;
+
+        return createXStream().toXML(commands);
+    }
+
+    public static void toXML(final CommandSetDescriptor commands, final Writer writer) {
+        assert commands != null;
+        assert writer != null;
+
+        createXStream().toXML(commands, writer);
     }
 }