Branch 'ipv6' - 2 commits - java/code
by Milan Zazrivec
java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java | 2 -
java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java | 13 ++++++----
2 files changed, 9 insertions(+), 6 deletions(-)
New commits:
commit 95083d2744bca815e79c4b499b467190b65e58a5
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Nov 9 20:43:56 2011 +0100
IPv6: system.getNetwork() modifications (API)
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
index 8ddfc3d..7a5f67e 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
@@ -1371,19 +1371,20 @@ public class SystemHandler extends BaseHandler {
/**
- * Get the IP and hostname for a given server
+ * Get the addresses and hostname for a given server
* @param sessionKey The sessionKey containing the logged in user
* @param sid The id of the server in question
- * @return Returns a map containing the servers IP and hostname attributes
+ * @return Returns a map containing the servers addresses and hostname attributes
* @throws FaultException A FaultException is thrown if the server corresponding to
* sid cannot be found.
*
- * @xmlrpc.doc Get the IP address and hostname for a given server.
+ * @xmlrpc.doc Get the addresses and hostname for a given server.
* @xmlrpc.param #param("string", "sessionKey")
* @xmlrpc.param #param("int", "serverId")
* @xmlrpc.returntype
* #struct("network info")
- * #prop_desc("string", "ip", "IP address of server")
+ * #prop_desc("string", "ip", "IPv4 address of server")
+ * #prop_desc("string", "ip6", "IPv6 address of server")
* #prop_desc("string", "hostname", "Hostname of server")
* #struct_end()
*/
@@ -1392,13 +1393,15 @@ public class SystemHandler extends BaseHandler {
User loggedInUser = getLoggedInUser(sessionKey);
Server server = lookupServer(loggedInUser, sid);
- // Get the ip and hostname for the server
+ // Get the ip, ip6 and hostname for the server
String ip = server.getIpAddress();
+ String ip6 = server.getIp6Address();
String hostname = server.getHostname();
// Stick in a map and return
Map network = new HashMap();
network.put("ip", StringUtils.defaultString(ip));
+ network.put("ip6", StringUtils.defaultString(ip6));
network.put("hostname", StringUtils.defaultString(hostname));
return network;
commit e86552c9e3eeba42a6651c5a2aa00727977c51ed
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Nov 9 20:40:35 2011 +0100
IPv6: checkstyle fix (no tabs)
diff --git a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
index 8c9f474..b8f929a 100644
--- a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
+++ b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
@@ -253,7 +253,7 @@ public class NetworkInterface extends BaseDomainHelper implements
if (sa6 == null) {
Session session = HibernateFactory.getSession();
sa6 = (ArrayList<ServerNetAddress6>)
- session.getNamedQuery("ServerNetAddress6.lookup_by_id")
+ session.getNamedQuery("ServerNetAddress6.lookup_by_id")
.setParameter("interface_id", this.interfaceId).list();
}
12 years, 6 months
Branch 'ipv6' - java/code
by Milan Zazrivec
java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java | 17 ++
java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml | 3
java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemHardwareAction.java | 18 ++
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 7 +
java/code/webapp/WEB-INF/pages/systems/sdc/hardware.jsp | 70 ++++++++++
5 files changed, 114 insertions(+), 1 deletion(-)
New commits:
commit da02a8c05eba97f76aab7c1d731b67db7ef42520
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Nov 9 20:20:32 2011 +0100
IPv6: SystemHardware.do (webui) modifications
diff --git a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
index f80b018..8c9f474 100644
--- a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
+++ b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
@@ -25,6 +25,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
import org.hibernate.Session;
import java.io.Serializable;
+import java.util.ArrayList;
/**
* NetworkInterface
@@ -39,6 +40,7 @@ public class NetworkInterface extends BaseDomainHelper implements
private String hwaddr;
private String module;
private ServerNetAddress4 sa4 = null;
+ private ArrayList<ServerNetAddress6> sa6 = null;
/**
* @return Returns the interfaceid.
@@ -243,4 +245,19 @@ public class NetworkInterface extends BaseDomainHelper implements
getIpaddr().equals("0.0.0.0"));
}
+ /**
+ * Retrieve list of IPv6 addresses
+ * @return List of ServerNetAddress6 objects
+ */
+ public ArrayList<ServerNetAddress6> getIPv6Addresses() {
+ if (sa6 == null) {
+ Session session = HibernateFactory.getSession();
+ sa6 = (ArrayList<ServerNetAddress6>)
+ session.getNamedQuery("ServerNetAddress6.lookup_by_id")
+ .setParameter("interface_id", this.interfaceId).list();
+ }
+
+ return sa6;
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml
index 6994782..2ea121f 100644
--- a/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml
@@ -19,7 +19,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<query name="ServerNetAddress6.lookup_by_id">
<![CDATA[from com.redhat.rhn.domain.server.ServerNetAddress6 as sa
- where sa.interfaceId = :interface_id]]>
+ where sa.interfaceId = :interface_id
+ order by scope]]>
</query>
<query name="ServerNetAddress6.lookup_by_scope_and_id">
diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemHardwareAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemHardwareAction.java
index 9b893ee..3c38684 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemHardwareAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemHardwareAction.java
@@ -21,6 +21,7 @@ import com.redhat.rhn.domain.server.Device;
import com.redhat.rhn.domain.server.NetworkInterface;
import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.server.ServerFactory;
+import com.redhat.rhn.domain.server.ServerNetAddress6;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
@@ -131,6 +132,7 @@ public class SystemHardwareAction extends RhnAction {
request.setAttribute("network_hostname", server.getDecodedHostname());
request.setAttribute("network_ip_addr", server.getIpAddress());
+ request.setAttribute("network_ip6_addr", server.getIp6Address());
request.setAttribute("network_cnames", server.getDecodedCnames());
List<String> nicList = new ArrayList();
@@ -153,6 +155,22 @@ public class SystemHardwareAction extends RhnAction {
}
request.setAttribute("network_interfaces", nicList2);
+ List nicList3 = new ArrayList();
+ for (String nicName : nicList) {
+ NetworkInterface n = server.getNetworkInterface(nicName);
+ for (ServerNetAddress6 na6 : n.getIPv6Addresses()) {
+ Map nic = new HashMap();
+ nic.put("name", n.getName());
+ nic.put("hwaddr", n.getHwaddr());
+ nic.put("module", n.getModule());
+ nic.put("ip6", na6.getAddress());
+ nic.put("netmask", na6.getNetmask());
+ nic.put("scope", na6.getScope());
+ nicList3.add(nic);
+ }
+ }
+ request.setAttribute("ipv6_network_interfaces", nicList3);
+
List<String> hdd = new ArrayList();
List miscDevices = new ArrayList();
List videoDevices = new ArrayList();
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 3ff73ba..66c0e54 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -19678,6 +19678,13 @@ performing a kickstart or creating a new kickstart distribution.</strong>
</context-group>
</trans-unit>
+ <trans-unit id="sdc.details.hardware.network_ip6_addr">
+ <source>IPv6 Address:</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/systems/details/SystemHardware.do</context>
+ </context-group>
+ </trans-unit>
+
<trans-unit id="sdc.details.notes.message">
<source>The following notes are associated with this system.</source>
<context-group name="ctx">
diff --git a/java/code/webapp/WEB-INF/pages/systems/sdc/hardware.jsp b/java/code/webapp/WEB-INF/pages/systems/sdc/hardware.jsp
index 248cc4c..65fcfe9 100644
--- a/java/code/webapp/WEB-INF/pages/systems/sdc/hardware.jsp
+++ b/java/code/webapp/WEB-INF/pages/systems/sdc/hardware.jsp
@@ -174,6 +174,16 @@
${network_ip_addr}
</td>
</tr>
+
+ <tr>
+ <th>
+ <bean:message key="sdc.details.hardware.network_ip6_addr"/>
+ </th>
+ <td>
+ ${network_ip6_addr}
+ </td>
+ </tr>
+
</table>
<br/>
<table class="list compare-list" width="90%" cellspacing="0">
@@ -234,6 +244,66 @@
</tr>
</c:forEach>
</table>
+ <br/>
+ <table class="list compare-list" width="90%" cellspacing="0">
+ <thead>
+ <tr>
+ <th>Interface</th>
+ <th>IPv6 Address</th>
+ <th>Netmask</th>
+ <th>Scope</th>
+ <th>Hardware Address</th>
+ <th>Driver Module</th>
+ </tr>
+ </thead>
+ <c:forEach items="${ipv6_network_interfaces}" var="current" varStatus="loop">
+ <c:choose>
+ <c:when test ="${loop.count % 2 == 0}">
+ <c:set var ="style_class" value="list-row-even"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var ="style_class" value="list-row-odd"/>
+ </c:otherwise>
+ </c:choose>
+ <tr class="${style_class}">
+ <td>${current.name}</td>
+ <c:choose>
+ <c:when test="${empty current.ip6}">
+ <td><span class="no-details">(unknown)</span></td>
+ </c:when>
+ <c:otherwise>
+ <td>${current.ip6}</td>
+ </c:otherwise>
+ </c:choose>
+ <c:choose>
+ <c:when test="${empty current.netmask}">
+ <td><span class="no-details">(unknown)</span></td>
+ </c:when>
+ <c:otherwise>
+ <td>${current.netmask}</td>
+ </c:otherwise>
+ </c:choose>
+ <c:choose>
+ <c:when test="${empty current.scope}">
+ <td><span class="no-details">(unknown)</span></td>
+ </c:when>
+ <c:otherwise>
+ <td>${current.scope}</td>
+ </c:otherwise>
+ </c:choose>
+ <c:choose>
+ <c:when test="${empty current.hwaddr}">
+ <td><span class="no-details">(unknown)</span></td>
+ </c:when>
+ <c:otherwise>
+ <td>${current.hwaddr}</td>
+ </c:otherwise>
+ </c:choose>
+ <td>${current.module}</td>
+ </tr>
+ </c:forEach>
+
+ </table>
<c:if test="${not empty storageDevices}">
<h2><bean:message key="sdc.details.hardware.storage"/></h2>
12 years, 6 months
Branch 'ipv6' - java/code
by Milan Zazrivec
java/code/src/com/redhat/rhn/domain/server/NetworkInterface.hbm.xml | 5
java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java | 112 +++++-----
2 files changed, 68 insertions(+), 49 deletions(-)
New commits:
commit 07ec99378f8aaaab33f1373e4534875393393118
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Nov 9 18:18:33 2011 +0100
IPv6: update NetworkInterface.*
diff --git a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.hbm.xml b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.hbm.xml
index efa05bc..574a8b2 100644
--- a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.hbm.xml
@@ -11,10 +11,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
column="server_id" />
<key-property name="name" type="string" column="name" length="32"/>
</composite-id>
- <property name="ipaddr" column="ip_addr" type="string" length="64" />
- <property name="netmask" column="netmask" type="string" length="64" />
- <property name="broadcast" column="broadcast" type="string"
- length="64" />
+ <property name="interfaceId" column="id" type="long" />
<property name="hwaddr" column="hw_addr" type="string" length="18" />
<property name="module" column="module" type="string" length="128" />
<property name="created" column="created" type="timestamp"
diff --git a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
index 7becd6d..f80b018 100644
--- a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
+++ b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
@@ -14,6 +14,7 @@
*/
package com.redhat.rhn.domain.server;
+import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.domain.BaseDomainHelper;
import com.redhat.rhn.manager.kickstart.IpAddress;
@@ -21,6 +22,8 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.hibernate.Session;
+
import java.io.Serializable;
/**
@@ -30,27 +33,25 @@ import java.io.Serializable;
public class NetworkInterface extends BaseDomainHelper implements
Serializable {
+ private Long interfaceId;
private Server server;
private String name;
- private String ipaddr;
- private String netmask;
- private String broadcast;
private String hwaddr;
private String module;
-
+ private ServerNetAddress4 sa4 = null;
/**
- * @return Returns the broadcast.
+ * @return Returns the interfaceid.
*/
- public String getBroadcast() {
- return broadcast;
+ public Long getInterfaceId() {
+ return interfaceId;
}
/**
- * @param b The broadcast to set.
+ * @param id The interfaceId to set.
*/
- public void setBroadcast(String b) {
- this.broadcast = b;
+ public void setInterfaceId(Long id) {
+ this.interfaceId = id;
}
/**
@@ -68,20 +69,6 @@ public class NetworkInterface extends BaseDomainHelper implements
}
/**
- * @return Returns the ipddr.
- */
- public String getIpaddr() {
- return ipaddr;
- }
-
- /**
- * @param i The ipddr to set.
- */
- public void setIpaddr(String i) {
- this.ipaddr = i;
- }
-
- /**
* @return Returns the module.
*/
public String getModule() {
@@ -110,20 +97,6 @@ public class NetworkInterface extends BaseDomainHelper implements
}
/**
- * @return Returns the netmask.
- */
- public String getNetmask() {
- return netmask;
- }
-
- /**
- * @param n The netmask to set.
- */
- public void setNetmask(String n) {
- this.netmask = n;
- }
-
- /**
* @return Returns the server.
*/
public Server getServer() {
@@ -147,9 +120,6 @@ public class NetworkInterface extends BaseDomainHelper implements
NetworkInterface castOther = (NetworkInterface) other;
return new EqualsBuilder().append(this.getServer(), castOther.getServer())
.append(this.getName(), castOther.getName())
- .append(this.getIpaddr(), castOther.getIpaddr())
- .append(this.getNetmask(), castOther.getNetmask())
- .append(this.getBroadcast(), castOther.getBroadcast())
.append(this.getHwaddr(), castOther.getHwaddr())
.append(this.getModule(), castOther.getModule())
.isEquals();
@@ -161,9 +131,6 @@ public class NetworkInterface extends BaseDomainHelper implements
public int hashCode() {
return new HashCodeBuilder().append(this.getServer())
.append(this.getName())
- .append(this.getIpaddr())
- .append(this.getNetmask())
- .append(this.getBroadcast())
.append(this.getHwaddr())
.append(this.getModule())
.toHashCode();
@@ -173,7 +140,62 @@ public class NetworkInterface extends BaseDomainHelper implements
* {@inheritDoc}
*/
public String toString() {
- return "NetworkInterface - name: " + this.getName() + " ip: " + this.getIpaddr();
+ return "NetworkInterface - name: " + this.getName();
+ }
+
+
+ /**
+ * findServerNetAddress4
+ * @param id Id of the network interface to search on.
+ */
+ private void findServerNetAddress4(Long id) {
+ if (sa4 != null) {
+ return;
+ }
+
+ Session session = HibernateFactory.getSession();
+ sa4 = (ServerNetAddress4) session.getNamedQuery("ServerNetAddress4.lookup")
+ .setParameter("interface_id", this.interfaceId)
+ .uniqueResult();
+ }
+
+ /**
+ * @return Returns the IP address (IPv4 compatibility).
+ */
+ public String getIpaddr() {
+ findServerNetAddress4(this.getInterfaceId());
+
+ if (sa4 == null) {
+ return null;
+ }
+
+ return sa4.getAddress();
+ }
+
+ /**
+ * @return Returns the netmask (IPv4 compatibility).
+ */
+ public String getNetmask() {
+ findServerNetAddress4(this.getInterfaceId());
+
+ if (sa4 == null) {
+ return null;
+ }
+
+ return sa4.getNetmask();
+ }
+
+ /**
+ * @return Returns the broadcast (IPv4 compatibility).
+ */
+ public String getBroadcast() {
+ findServerNetAddress4(this.getInterfaceId());
+
+ if (sa4 == null) {
+ return null;
+ }
+
+ return sa4.getBroadcast();
}
/**
12 years, 6 months
Branch 'ipv6' - java/code
by Milan Zazrivec
java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.hbm.xml | 24 ++
java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.java | 116 ++++++++++
java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml | 30 ++
java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.java | 116 ++++++++++
4 files changed, 286 insertions(+)
New commits:
commit ee5e521fea5f28e78882117a63b9ae4bafebea0c
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Nov 9 18:11:15 2011 +0100
IPv6: updated hibernate mappings for network tables
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.hbm.xml b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.hbm.xml
new file mode 100644
index 0000000..a2e4b41
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.hbm.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping
+PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class name="com.redhat.rhn.domain.server.ServerNetAddress4"
+ table="rhnServerNetAddress4">
+ <composite-id>
+ <key-property name="interfaceId" column="interface_id" type="long" />
+ <key-property name="address" column="address" type="string" length="64"/>
+ </composite-id>
+ <property name="netmask" column="netmask" type="string" length="64"/>
+ <property name="broadcast" column="broadcast" type="string" length="64"/>
+ <property name="created" column="modified" type="timestamp"
+ insert="false" update="false"/>
+ <property name="modified" column="modified" type="timestamp"
+ insert="false" update="false"/>
+ </class>
+
+ <query name="ServerNetAddress4.lookup">
+ <![CDATA[from com.redhat.rhn.domain.server.ServerNetAddress4 as sa
+ where sa.interfaceId = :interface_id]]>
+ </query>
+</hibernate-mapping>
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.java b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.java
new file mode 100644
index 0000000..a58bd27
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress4.java
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2009--2011 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.domain.server;
+
+import com.redhat.rhn.domain.BaseDomainHelper;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+import java.io.Serializable;
+
+/**
+ * ServerNetAddress4
+ */
+
+public class ServerNetAddress4 extends BaseDomainHelper implements Serializable {
+
+ private Long interfaceId;
+ private String address;
+ private String netmask;
+ private String broadcast;
+
+ /**
+ * @return Returns the interfaceId.
+ */
+ public Long getInterfaceId() {
+ return interfaceId;
+ }
+
+ /**
+ * @param id Set the interfaceId.
+ */
+ public void setInterfaceId(Long id) {
+ this.interfaceId = id;
+ }
+
+ /**
+ * @return Returns the address.
+ */
+ public String getAddress() {
+ return address;
+ }
+
+ /**
+ * @param i The address to set.
+ */
+ public void setAddress(String i) {
+ this.address = i;
+ }
+
+ /**
+ * @return Returns the broadcast.
+ */
+ public String getBroadcast() {
+ return broadcast;
+ }
+
+ /**
+ * @param b The broadcast to set.
+ */
+ public void setBroadcast(String b) {
+ this.broadcast = b;
+ }
+
+ /**
+ * @return Returns the netmask.
+ */
+ public String getNetmask() {
+ return netmask;
+ }
+
+ /**
+ * @param n The netmask to set.
+ */
+ public void setNetmask(String n) {
+ this.netmask = n;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(final Object other) {
+ if (!(other instanceof ServerNetAddress4)) {
+ return false;
+ }
+
+ ServerNetAddress4 castOther = (ServerNetAddress4) other;
+ return new EqualsBuilder().append(this.getAddress(), castOther.getAddress())
+ .append(this.getBroadcast(), castOther.getBroadcast())
+ .append(this.getNetmask(), castOther.getNetmask())
+ .isEquals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode() {
+ return new HashCodeBuilder().append(this.getAddress())
+ .append(this.getBroadcast())
+ .append(this.getNetmask())
+ .toHashCode();
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml
new file mode 100644
index 0000000..6994782
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.hbm.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping
+PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class name="com.redhat.rhn.domain.server.ServerNetAddress6"
+ table="rhnServerNetAddress6">
+ <composite-id>
+ <key-property name="interfaceId" column="interface_id" type="long"/>
+ <key-property name="address" column="address" type="string" length="45"/>
+ <key-property name="scope" column="scope" type="string" length="64"/>
+ </composite-id>
+ <property name="netmask" column="netmask" type="string" length="49"/>
+ <property name="created" column="modified" type="timestamp"
+ insert="false" update="false"/>
+ <property name="modified" column="modified" type="timestamp"
+ insert="false" update="false"/>
+ </class>
+
+ <query name="ServerNetAddress6.lookup_by_id">
+ <![CDATA[from com.redhat.rhn.domain.server.ServerNetAddress6 as sa
+ where sa.interfaceId = :interface_id]]>
+ </query>
+
+ <query name="ServerNetAddress6.lookup_by_scope_and_id">
+ <![CDATA[from com.redhat.rhn.domain.server.ServerNetAddress6 as sa
+ where sa.interfaceId = :interface_id and
+ sa.scope = :scope]]>
+ </query>
+</hibernate-mapping>
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.java b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.java
new file mode 100644
index 0000000..8f80930
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerNetAddress6.java
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2009--2011 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.domain.server;
+
+import com.redhat.rhn.domain.BaseDomainHelper;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+import java.io.Serializable;
+
+/**
+ * ServerNetAddress6
+ */
+
+public class ServerNetAddress6 extends BaseDomainHelper implements Serializable {
+
+ private Long interfaceId;
+ private String address;
+ private String netmask;
+ private String scope;
+
+ /**
+ * @return Returns the interfaceId.
+ */
+ public Long getInterfaceId() {
+ return interfaceId;
+ }
+
+ /**
+ * @param id Set the interfaceId.
+ */
+ public void setInterfaceId(Long id) {
+ this.interfaceId = id;
+ }
+
+ /**
+ * @return Returns the address.
+ */
+ public String getAddress() {
+ return address;
+ }
+
+ /**
+ * @param i The address to set.
+ */
+ public void setAddress(String i) {
+ this.address = i;
+ }
+
+ /**
+ * @return Returns the scope.
+ */
+ public String getScope() {
+ return scope;
+ }
+
+ /**
+ * @param s The scope to set.
+ */
+ public void setScope(String s) {
+ this.scope = s;
+ }
+
+ /**
+ * @return Returns the netmask.
+ */
+ public String getNetmask() {
+ return netmask;
+ }
+
+ /**
+ * @param n The netmask to set.
+ */
+ public void setNetmask(String n) {
+ this.netmask = n;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(final Object other) {
+ if (!(other instanceof ServerNetAddress6)) {
+ return false;
+ }
+
+ ServerNetAddress6 castOther = (ServerNetAddress6) other;
+ return new EqualsBuilder().append(this.getAddress(), castOther.getAddress())
+ .append(this.getScope(), castOther.getScope())
+ .append(this.getNetmask(), castOther.getNetmask())
+ .isEquals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode() {
+ return new HashCodeBuilder().append(this.getAddress())
+ .append(this.getScope())
+ .append(this.getNetmask())
+ .toHashCode();
+ }
+}
12 years, 6 months
Changes to 'refs/tags/spacewalk-java-1.6.76-1'
by Tomas Lestach
Tag 'spacewalk-java-1.6.76-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2011-11-09 16:36 +0000
Tagging package [spacewalk-java] version [1.6.76-1] in directory [java/].
Changes since spacewalk-java-1.6.75-1:
Simon Lukasik (1):
This field is actually optional; it might not be specified.
Tomas Lestach (3):
699489 - regenerate affected kickstart profiles, when updating crypto key
682845 - check the input parameters for repo related APIs
Automatic commit of package [spacewalk-java] release [1.6.76-1].
---
java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml | 7
java/code/src/com/redhat/rhn/domain/kickstart/KickstartFactory.java | 13 +
java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidParameterException.java | 33 +++
java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchChannelException.java | 16 +
java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchContentSourceException.java | 45 ++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 97 ++++++----
java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/keys/CryptoKeysHandler.java | 7
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 2
java/spacewalk-java.spec | 10 -
rel-eng/packages/spacewalk-java | 2
10 files changed, 197 insertions(+), 35 deletions(-)
---
12 years, 6 months
java/spacewalk-java.spec rel-eng/packages
by Tomas Lestach
java/spacewalk-java.spec | 10 +++++++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
New commits:
commit 696fed72b4fe488baa306ea178a0507940a6ce30
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Nov 9 17:36:54 2011 +0100
Automatic commit of package [spacewalk-java] release [1.6.76-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index e0d4790..4eef533 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.6.75
+Version: 1.6.76
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -557,6 +557,14 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Wed Nov 09 2011 Tomas Lestach <tlestach(a)redhat.com> 1.6.76-1
+- 682845 - check the input parameters for repo related APIs
+ (tlestach(a)redhat.com)
+- 699489 - regenerate affected kickstart profiles, when updating crypto key
+ (tlestach(a)redhat.com)
+- This field is actually optional; it might not be specified.
+ (slukasik(a)redhat.com)
+
* Wed Nov 09 2011 Tomas Lestach <tlestach(a)redhat.com> 1.6.75-1
- precompile also apidoc jsp pages (tlestach(a)redhat.com)
- 682845 - fix channel.software.listUserRepos API doc (tlestach(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 6255e88..c1c893c 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.6.75-1 java/
+1.6.76-1 java/
12 years, 6 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidParameterException.java | 33 +++
java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchChannelException.java | 16 +
java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchContentSourceException.java | 45 ++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 97 ++++++----
4 files changed, 159 insertions(+), 32 deletions(-)
New commits:
commit ea76af3f3f4ea1672ce9990331380cc397ac42bb
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Nov 9 17:20:43 2011 +0100
682845 - check the input parameters for repo related APIs
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidParameterException.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidParameterException.java
new file mode 100644
index 0000000..f5e3e66
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidParameterException.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2011 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;
+
+import com.redhat.rhn.FaultException;
+
+
+/**
+ * InvalidParameterException
+ * @version $Rev$
+ */
+public class InvalidParameterException extends FaultException {
+
+ /**
+ * Constructor
+ * @param messageIn invalid parameter information
+ */
+ public InvalidParameterException(String messageIn) {
+ super(1213, "invalidParameter", messageIn);
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchChannelException.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchChannelException.java
index d5466d7..c114119 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchChannelException.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchChannelException.java
@@ -41,6 +41,22 @@ public class NoSuchChannelException extends FaultException {
// begin member variable initialization
}
+ /**
+ * Constructor
+ * @param channelLabel missing channel label
+ */
+ public NoSuchChannelException(String channelLabel) {
+ super(-210 , "noSuchChannel" , "No such channel: " + channelLabel);
+ }
+
+ /**
+ * Constructor
+ * @param channelId missing channel id
+ */
+ public NoSuchChannelException(Long channelId) {
+ super(-210 , "noSuchChannel" , "No such channel with id: " + channelId);
+ }
+
/**
* Constructor
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchContentSourceException.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchContentSourceException.java
new file mode 100644
index 0000000..99d7757
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/NoSuchContentSourceException.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 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;
+
+import com.redhat.rhn.FaultException;
+
+/**
+ * NoSuchContentSourceException
+ * @version $Rev$
+ */
+public class NoSuchContentSourceException extends FaultException {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = -5923024748409820830L;
+
+ /**
+ * Constructor
+ * @param repoLabel what repository label wasn't found
+ */
+ public NoSuchContentSourceException(String repoLabel) {
+ super(1213, "noSuchRepository", "No such repository: " + repoLabel);
+ }
+
+ /**
+ * Constructor
+ * @param repoId what repository id wasn't found
+ */
+ public NoSuchContentSourceException(Long repoId) {
+ super(1213, "noSuchRepository", "No such repository with id: " + repoId);
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
index cb69b56..e75d794 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
@@ -46,11 +46,15 @@ import com.redhat.rhn.frontend.xmlrpc.InvalidChannelArchException;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelException;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelLabelException;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelNameException;
+import com.redhat.rhn.frontend.xmlrpc.InvalidParameterException;
import com.redhat.rhn.frontend.xmlrpc.InvalidParentChannelException;
import com.redhat.rhn.frontend.xmlrpc.MultipleBaseChannelException;
import com.redhat.rhn.frontend.xmlrpc.NoSuchChannelException;
+import com.redhat.rhn.frontend.xmlrpc.NoSuchContentSourceException;
import com.redhat.rhn.frontend.xmlrpc.NoSuchPackageException;
import com.redhat.rhn.frontend.xmlrpc.PermissionCheckFailureException;
+import com.redhat.rhn.frontend.xmlrpc.channel.repo.InvalidRepoLabelException;
+import com.redhat.rhn.frontend.xmlrpc.channel.repo.InvalidRepoUrlException;
import com.redhat.rhn.frontend.xmlrpc.system.SystemHandler;
import com.redhat.rhn.frontend.xmlrpc.system.XmlRpcSystemHelper;
import com.redhat.rhn.frontend.xmlrpc.user.XmlRpcUserHelper;
@@ -496,7 +500,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
public Channel getDetails(String sessionKey, Integer id)
throws NoSuchChannelException {
User user = getLoggedInUser(sessionKey);
- return lookupChannelById(user, id);
+ return lookupChannelById(user, id.longValue());
}
/**
@@ -531,7 +535,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
*/
public int setDetails(String sessionKey, Integer channelId, Map details) {
User user = getLoggedInUser(sessionKey);
- Channel channel = lookupChannelById(user, channelId);
+ Channel channel = lookupChannelById(user, channelId.longValue());
Set<String> validKeys = new HashSet<String>();
validKeys.add("checksum_label");
@@ -1751,7 +1755,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
Channel channel = ChannelFactory.lookupByLabelAndUser(label, user);
if (channel == null) {
- throw new NoSuchChannelException();
+ throw new NoSuchChannelException(label);
}
return channel;
@@ -1764,18 +1768,18 @@ public class ChannelSoftwareHandler extends BaseHandler {
Channel channel = ChannelManager.lookupByLabel(
org, label);
if (channel == null) {
- throw new NoSuchChannelException();
+ throw new NoSuchChannelException(label);
}
return channel;
}
- private Channel lookupChannelById(User user, int id)
+ private Channel lookupChannelById(User user, Long id)
throws NoSuchChannelException {
Channel channel = ChannelManager.lookupByIdAndUser(new Long(id), user);
if (channel == null) {
- throw new NoSuchChannelException();
+ throw new NoSuchChannelException(id);
}
return channel;
@@ -2328,7 +2332,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
throws NoSuchChannelException {
User user = getLoggedInUser(sessionKey);
String repoLastBuild =
- ChannelManager.getRepoLastBuild(lookupChannelById(user, id));
+ ChannelManager.getRepoLastBuild(lookupChannelById(user, id.longValue()));
if (repoLastBuild == null) {
return "";
}
@@ -2410,8 +2414,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
**/
public Integer removeRepo(String sessionKey, Integer id) {
User user = getLoggedInUser(sessionKey);
- ContentSource repo = ChannelFactory.lookupContentSource(new Long(id.longValue()),
- user.getOrg());
+ ContentSource repo = lookupContentSourceById(id.longValue(), user.getOrg());
ChannelFactory.remove(repo);
return 1;
@@ -2430,8 +2433,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
**/
public Integer removeRepo(String sessionKey, String label) {
User user = getLoggedInUser(sessionKey);
- ContentSource repo = ChannelFactory.lookupContentSourceByOrgAndLabel(user.getOrg(),
- label);
+ ContentSource repo = lookupContentSourceByLabel(label, user.getOrg());
ChannelFactory.remove(repo);
return 1;
@@ -2453,8 +2455,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
public Channel associateRepo(String sessionKey, String chanLabel, String repoLabel) {
User user = getLoggedInUser(sessionKey);
Channel channel = lookupChannelByLabel(user, chanLabel);
- ContentSource repo = ChannelFactory.lookupContentSourceByOrgAndLabel(user.getOrg(),
- repoLabel);
+ ContentSource repo = lookupContentSourceByLabel(repoLabel, user.getOrg());
Set<ContentSource> set = channel.getSources();
set.add(repo);
@@ -2479,8 +2480,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
public Channel disassociateRepo(String sessionKey, String chanLabel, String repoLabel) {
User user = getLoggedInUser(sessionKey);
Channel channel = lookupChannelByLabel(user, chanLabel);
- ContentSource repo = ChannelFactory.lookupContentSourceByOrgAndLabel(user.getOrg(),
- repoLabel);
+ ContentSource repo = lookupContentSourceByLabel(repoLabel, user.getOrg());
Set<ContentSource> set = channel.getSources();
set.remove(repo);
@@ -2506,9 +2506,8 @@ public class ChannelSoftwareHandler extends BaseHandler {
**/
public ContentSource updateRepoUrl(String sessionKey, Integer id, String url) {
User user = getLoggedInUser(sessionKey);
- ContentSource repo = ChannelFactory.lookupContentSource(new Long(id.longValue()),
- user.getOrg());
- repo.setSourceUrl(url);
+ ContentSource repo = lookupContentSourceById(id.longValue(), user.getOrg());
+ setRepoUrl(repo, url);
ChannelFactory.save(repo);
return repo;
}
@@ -2528,9 +2527,8 @@ public class ChannelSoftwareHandler extends BaseHandler {
**/
public ContentSource updateRepoUrl(String sessionKey, String label, String url) {
User user = getLoggedInUser(sessionKey);
- ContentSource repo = ChannelFactory.lookupContentSourceByOrgAndLabel(user.getOrg(),
- label);
- repo.setSourceUrl(url);
+ ContentSource repo = lookupContentSourceByLabel(label, user.getOrg());
+ setRepoUrl(repo, url);
ChannelFactory.save(repo);
return repo;
}
@@ -2550,9 +2548,8 @@ public class ChannelSoftwareHandler extends BaseHandler {
**/
public ContentSource updateRepoLabel(String sessionKey, Integer id, String label) {
User user = getLoggedInUser(sessionKey);
- ContentSource repo = ChannelFactory.lookupContentSource(new Long(id.longValue()),
- user.getOrg());
- repo.setLabel(label);
+ ContentSource repo = lookupContentSourceById(id.longValue(), user.getOrg());
+ setRepoLabel(repo, label);
ChannelFactory.save(repo);
return repo;
}
@@ -2575,10 +2572,9 @@ public class ChannelSoftwareHandler extends BaseHandler {
public ContentSource updateRepo(String sessionKey, Integer id, String label,
String url) {
User user = getLoggedInUser(sessionKey);
- ContentSource repo = ChannelFactory.lookupContentSource(new Long(id.longValue()),
- user.getOrg());
- repo.setLabel(label);
- repo.setSourceUrl(url);
+ ContentSource repo = lookupContentSourceById(id.longValue(), user.getOrg());
+ setRepoLabel(repo, label);
+ setRepoUrl(repo, url);
ChannelFactory.save(repo);
return repo;
}
@@ -2597,7 +2593,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
*/
public ContentSource getRepoDetails(String sessionKey, String repoLabel) {
User user = getLoggedInUser(sessionKey);
- return ChannelFactory.lookupContentSourceByOrgAndLabel(user.getOrg(), repoLabel);
+ return lookupContentSourceByLabel(repoLabel, user.getOrg());
}
/**
@@ -2614,7 +2610,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
*/
public ContentSource getRepoDetails(String sessionKey, Integer id) {
User user = getLoggedInUser(sessionKey);
- return ChannelFactory.lookupContentSource(new Long(id.longValue()), user.getOrg());
+ return lookupContentSourceById(id.longValue(), user.getOrg());
}
/**
@@ -2633,8 +2629,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
*/
public List<ContentSource> listChannelRepos(String sessionKey, String channelLabel) {
User loggedInUser = getLoggedInUser(sessionKey);
- Channel channel = ChannelManager.lookupByLabel(loggedInUser.getOrg(),
- channelLabel);
+ Channel channel = lookupChannelByLabel(loggedInUser, channelLabel);
return ChannelFactory.lookupContentSources(loggedInUser.getOrg(), channel);
}
@@ -2701,4 +2696,42 @@ public class ChannelSoftwareHandler extends BaseHandler {
}
return cronExpr;
}
+
+ private ContentSource lookupContentSourceById(Long repoId, Org org) {
+ ContentSource cs = ChannelFactory.lookupContentSource(repoId, org);
+ if (cs == null) {
+ throw new NoSuchContentSourceException(repoId);
+ }
+ return cs;
+ }
+
+ private ContentSource lookupContentSourceByLabel(String repoLabel, Org org) {
+ ContentSource cs = ChannelFactory.lookupContentSourceByOrgAndLabel(org, repoLabel);
+ if (cs == null) {
+ throw new NoSuchContentSourceException(repoLabel);
+ }
+ return cs;
+ }
+
+ private void setRepoLabel(ContentSource cs, String repoLabel) {
+ if (StringUtils.isEmpty(repoLabel)) {
+ throw new InvalidParameterException("label might not be empty");
+ }
+ if (ChannelFactory.lookupContentSourceByOrgAndLabel(cs.getOrg(), repoLabel) !=
+ null) {
+ throw new InvalidRepoLabelException(repoLabel);
+ }
+ cs.setLabel(repoLabel);
+ }
+
+ private void setRepoUrl(ContentSource cs, String repoUrl) {
+ if (StringUtils.isEmpty(repoUrl)) {
+ throw new InvalidParameterException("url might not be empty");
+ }
+ if (!ChannelFactory.lookupContentSourceByOrgAndRepo(cs.getOrg(),
+ ChannelFactory.CONTENT_SOURCE_TYPE_YUM, repoUrl).isEmpty()) {
+ throw new InvalidRepoUrlException(repoUrl);
+ }
+ cs.setSourceUrl(repoUrl);
+ }
}
12 years, 6 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml | 7 +++++
java/code/src/com/redhat/rhn/domain/kickstart/KickstartFactory.java | 13 ++++++++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/keys/CryptoKeysHandler.java | 7 +++++
3 files changed, 27 insertions(+)
New commits:
commit c2454a83ef94bf4d3552c13ba210bd61507dbb68
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Nov 9 11:11:18 2011 +0100
699489 - regenerate affected kickstart profiles, when updating crypto key
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
index 7eb69f2..173897f 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
@@ -112,6 +112,13 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<query name="KickstartData.cobblerIds">
<![CDATA[select t.cobblerId from com.redhat.rhn.domain.kickstart.KickstartData as t]]>
</query>
+ <query name="KickstartData.findByCKeyDescription">
+ <![CDATA[
+ select kd from com.redhat.rhn.domain.kickstart.KickstartData kd,
+ com.redhat.rhn.domain.kickstart.crypto.CryptoKey ck
+ where ck.description = :ck_description
+ and ck in elements(kd.cryptoKeys)]]>
+ </query>
<sql-query name="commandSort">
<load-collection alias="sortcol" role="com.redhat.rhn.domain.kickstart.KickstartData.commands"/>
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartFactory.java b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartFactory.java
index 6e26939..4ce2872 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartFactory.java
@@ -608,6 +608,19 @@ public class KickstartFactory extends HibernateFactory {
}
/**
+ * List kickstart data by crypto key
+ * @param ckDescription crypto key description
+ * @return List of kickstart data with associated crypto key
+ */
+ public static List<KickstartData> listKickstartDataByCKeyDescription(
+ String ckDescription) {
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put("ck_description", ckDescription);
+ return singleton.listObjectsByNamedQuery(
+ "KickstartData.findByCKeyDescription", params, true);
+ }
+
+ /**
* list all kickstart trees stored in the satellite
* @return list of kickstart trees
*/
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/keys/CryptoKeysHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/keys/CryptoKeysHandler.java
index 32ce62c..8975746 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/keys/CryptoKeysHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/keys/CryptoKeysHandler.java
@@ -16,6 +16,8 @@ package com.redhat.rhn.frontend.xmlrpc.kickstart.keys;
import com.redhat.rhn.common.db.datasource.DataResult;
import com.redhat.rhn.common.validator.ValidatorError;
+import com.redhat.rhn.domain.kickstart.KickstartData;
+import com.redhat.rhn.domain.kickstart.KickstartFactory;
import com.redhat.rhn.domain.kickstart.crypto.CryptoKey;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.user.User;
@@ -167,6 +169,11 @@ public class CryptoKeysHandler extends BaseHandler {
cmd.setContents(content);
cmd.store(); // in this case we do not expect any error
// because we do not touch description
+
+ for (KickstartData kData :
+ KickstartFactory.listKickstartDataByCKeyDescription(description)) {
+ KickstartFactory.saveKickstartData(kData);
+ }
return 1;
}
12 years, 6 months
java/code
by Šimon Lukašík
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 7a013ccbd90eaa9a0eacb3124f799227cbafc090
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Wed Nov 9 08:46:15 2011 +0100
This field is actually optional; it might not be specified.
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
index 36b97f7..de9a0bf 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
@@ -53,7 +53,7 @@ import redstone.xmlrpc.XmlRpcSerializer;
* Present for files or directories only.")
* #prop_desc("string", "permissions_mode", "File Permissions.
* Present for files or directories only.")
- * #prop_desc("string", "selinux_ctx", "SELinux Context.")
+ * #prop_desc("string", "selinux_ctx", "SELinux Context (optional).")
* #prop_desc("boolean", "binary", "true/false , Present for files only.")
* #prop_desc("string", "md5", "File's md5 signature. Present for files only.")
* #prop_desc("string", "macro-start-delimiter",
12 years, 6 months
Changes to 'refs/tags/spacewalk-java-1.6.75-1'
by Tomas Lestach
Tag 'spacewalk-java-1.6.75-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2011-11-09 00:33 +0000
Tagging package [spacewalk-java] version [1.6.75-1] in directory [java/].
Changes since rhn-client-tools-1.6.34-1:
Tomas Lestach (4):
682845 - fix channel.software.getRepoSyncCronExpression API doc
682845 - fix channel.software.listUserRepos API doc
precompile also apidoc jsp pages
Automatic commit of package [spacewalk-java] release [1.6.75-1].
---
java/build.xml | 33 +++++++---
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 3
java/code/webapp/WEB-INF/web.xml | 1
java/spacewalk-java.spec | 10 ++-
rel-eng/packages/spacewalk-java | 2
5 files changed, 38 insertions(+), 11 deletions(-)
---
12 years, 6 months