From 1cbaa6cf5abf20ede73a32b1b5442dfb2e2f6112 Mon Sep 17 00:00:00 2001
From: Colin Coe <colin.coe@gmail.com>
Date: Thu, 25 Sep 2008 12:23:22 +0800
Subject: [PATCH] Include the API call

---
 .../system/profile/ServerProfileHandler.java       |   78 ++++++++++++++++++++
 1 files changed, 78 insertions(+), 0 deletions(-)
 create mode 100644 java/code/src/com/redhat/rhn/frontend/xmlrpc/system/profile/ServerProfileHandler.java

diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/profile/ServerProfileHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/profile/ServerProfileHandler.java
new file mode 100644
index 0000000..fc88815
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/profile/ServerProfileHandler.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2008 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ * 
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation. 
+ */
+package com.redhat.rhn.frontend.xmlrpc.system.profile;
+
+//import java.lang.Object;
+//import java.util.ArrayList;
+import java.util.Collections;
+//import java.util.Date;
+//import java.util.Iterator;
+//import java.util.LinkedList;
+//import java.util.List;
+//import java.util.Map;
+import java.util.SortedSet;
+
+import com.redhat.rhn.domain.kickstart.KickstartCommand;
+import com.redhat.rhn.domain.kickstart.KickstartData;
+import com.redhat.rhn.domain.kickstart.KickstartFactory;
+import com.redhat.rhn.domain.server.Server;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.xmlrpc.BaseHandler;
+import com.redhat.rhn.frontend.xmlrpc.serializer.KickstartCustomOptionSerializer;
+import com.redhat.rhn.frontend.xmlrpc.system.XmlRpcSystemHelper;
+
+/**
+ * ServerConfigChannelHandler
+ * @version $Rev$
+ * @xmlrpc.namespace system.config
+ * @xmlrpc.doc Provides methods to access and modify many aspects of 
+ * configuration channels and server association.
+ * basically system.config name space
+ */
+public class ServerProfileHandler extends BaseHandler {
+    /**
+     * List files in a given server
+     * @param sessionKey the session key
+     * @param sid the server id
+     * @param listLocal true if a list of paths in local override is desired
+     *                  false if  list of paths in sandbox channel is desired
+     * @return a list of dto's holding this info.
+     *
+     * @xmlrpc.doc Return the list of files in a given channel.
+     * @xmlrpc.param #session_key() 
+     * @xmlrpc.param #param("int","serverId")
+     * @xmlrpc.param #param("int","listLocal")
+     *      #options()
+     *          #item_desc ("1", "to return configuration files 
+     *              in the system's local override configuration channel")
+     *          #item_desc ("0", "to return configuration files 
+     *              in the system's sandbox configuration channel")
+     *      #options_end()
+     *  
+     * @xmlrpc.returntype
+     * #array()
+     * $ConfigFileDtoSerializer
+     * #array_end()
+     */
+
+    public Object[] getCustomOptions(String sessionKey, String ksLabel) {
+        User user = getLoggedInUser(sessionKey);
+        KickstartData k = KickstartFactory.lookupKickstartDataByLabelAndOrgId(
+                ksLabel, user.getOrg().getId());
+        SortedSet options = k.getCustomOptions();
+        return options.toArray();
+    }
+
+}
-- 
1.5.5.1

