Skip to content
Permalink
Browse files
JUDDI-926 fixed
  • Loading branch information
spyhunter99 committed Feb 3, 2015
1 parent 09abb1b commit 5eda4a714c86584b24576a51a9995d72240fa55c
Showing 7 changed files with 564 additions and 191 deletions.
@@ -460,6 +460,12 @@ public UDDINode getHomeNode() throws ConfigurationException {
throw new ConfigurationException("One of the node elements in the client configuration needs to a 'isHomeJUDDI=\"true\"' attribute.");
}

/**
* returns the named uddi node from config or throws if one is not found
* @param nodeName
* @return
* @throws ConfigurationException
*/
public UDDINode getUDDINode(String nodeName) throws ConfigurationException {
if (!uddiNodes.containsKey(nodeName)) {
throw new ConfigurationException("Node '" + nodeName
@@ -578,7 +584,8 @@ public Properties getDigitalSignatureConfiguration() throws Exception {
* adds a new node to the client configuration section. Don't forget to
* call save to persist the changes
*
* @param n
* @param node
* @throws org.apache.commons.configuration.ConfigurationException
* @since 3.3
*/
public void addUDDINode(UDDINode node) throws ConfigurationException {
@@ -592,7 +599,10 @@ public void addUDDINode(UDDINode node) throws ConfigurationException {
log.info("ClientName wasn't specified, I'll configure it with the defaults");
node.setClientName(this.clientName);
}
this.uddiNodes.put(node.getClientName(), node);
if (node.getName() == null || "".equalsIgnoreCase(node.getName())) {
throw new ConfigurationException("Node Name wasn't specified. It cannot be null");
}
this.uddiNodes.put(node.getName(), node);

}

@@ -420,7 +420,7 @@ public boolean isSecure() {

/**
* gets a reference to the current juddi client config file. this is a
* live instance changes can be stored to disk, usually
* live instance changes can be stored to disk
*
* @return client config
* @throws ConfigurationException g
@@ -449,7 +449,7 @@ private boolean NodeExists(String newnode) {
return true;
}
}
} catch (ConfigurationException ex) {
} catch (Exception ex) {
log.error(ex);
return false;
}
@@ -86,16 +86,27 @@ It currently does not use the ValueSet, jUDDI, Replication, or REST APIs
<securityUrl>https://localhost:8443/juddiv3/UDDISecurityService</securityUrl>
<subscriptionUrl>https://localhost:8443/juddiv3/UDDISubscriptionService</subscriptionUrl>
</node>
<node>
<name>jUDDI Cloud Prod</name>
<description>This node is a semi-production jUDDI instance.</description>
<!-- JAX-WS Transport -->
<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
<custodyTransferUrl>http://uddi-jbossoverlord.rhcloud.com/juddiv3/services/custody-transfer</custodyTransferUrl>
<inquiryUrl>http://uddi-jbossoverlord.rhcloud.com/juddiv3/services/inquiry</inquiryUrl>
<publishUrl>http://uddi-jbossoverlord.rhcloud.com/juddiv3/services/publish</publishUrl>
<securityUrl>http://uddi-jbossoverlord.rhcloud.com/juddiv3/services/security</securityUrl>
<subscriptionUrl>http://uddi-jbossoverlord.rhcloud.com/juddiv3/services/subscription</subscriptionUrl>
</node>
<node>
<name>jUDDI Cloud Sandbox</name>
<description>This node is maintained by the jUDDI team for you to test and experiment with.</description>
<!-- JAX-WS Transport -->
<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
<custodyTransferUrl>http://uddi-jbossoverlord.rhcloud.com/services/custody-transfer</custodyTransferUrl>
<inquiryUrl>http://uddi-jbossoverlord.rhcloud.com/services/inquiry</inquiryUrl>
<publishUrl>http://uddi-jbossoverlord.rhcloud.com/services/publish</publishUrl>
<securityUrl>http://uddi-jbossoverlord.rhcloud.com/services/security</securityUrl>
<subscriptionUrl>http://uddi-jbossoverlord.rhcloud.com/services/subscription</subscriptionUrl>
<custodyTransferUrl>http://uddiconsole-jbossoverlord.rhcloud.com/juddiv3/services/custody-transfer</custodyTransferUrl>
<inquiryUrl>http://uddiconsole-jbossoverlord.rhcloud.com/juddiv3/services/inquiry</inquiryUrl>
<publishUrl>http://uddiconsole-jbossoverlord.rhcloud.com/juddiv3/services/publish</publishUrl>
<securityUrl>http://uddiconsole-jbossoverlord.rhcloud.com/juddiv3/services/security</securityUrl>
<subscriptionUrl>http://uddiconsole-jbossoverlord.rhcloud.com/juddiv3/services/subscription</subscriptionUrl>
</node>
</nodes>
<signature>
@@ -450,3 +450,4 @@ actions.popout=Popout
items.categorizations=Categorizations
items.categorizations.uddi=UDDI Categorizations
actions.return=Return
items.settings.edit=Edit
@@ -452,3 +452,4 @@ actions.popout=Salir
items.categorizations=Categorizaciones
items.categorizations.uddi=UDDI Categorizaciones
actions.return=Volver
items.settings.edit=Editar
@@ -19,59 +19,146 @@
*/
--%>

<%@page import="org.apache.commons.lang.StringEscapeUtils"%>
<%@page import="org.apache.juddi.v3.client.config.UDDINode"%>
<%@page import="org.apache.juddi.webconsole.resources.ResourceLoader"%>
<%@page import="java.io.File"%>
<%@page import="java.io.FileOutputStream"%>
<%@page import="java.util.Properties"%>
<%@page import="java.util.Enumeration"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../csrf.jsp" %>
<%
UddiHub x = UddiHub.getInstance(application, session);
if (x.isAdminLocalhostOnly() &&
!request.getRemoteAddr().equalsIgnoreCase("localhost") &&
!request.getRemoteHost().equalsIgnoreCase("127.0.0.1") &&
!request.getRemoteHost().equalsIgnoreCase("0:0:0:0:0:0:0:1")) {
out.write(ResourceLoader.GetResource(session, "pages.settings.accessdenied.remote"));
UddiHub.log.fatal("Audit: FAILURE Attempt to alter configuration remotely from " +
request.getRemoteAddr() + " " +
request.getRemoteHost() + " " +
request.getRemoteUser());
response.setStatus(403);
return;
} else {
//this is controlled by web.xml
<% UddiHub x = UddiHub.getInstance(application, session);
if (x.isAdminLocalhostOnly()
&& !request.getRemoteAddr().equalsIgnoreCase("localhost")
&& !request.getRemoteHost().equalsIgnoreCase("127.0.0.1")
&& !request.getRemoteHost().equalsIgnoreCase("0:0:0:0:0:0:0:1")) {
out.write(ResourceLoader.GetResource(session, "pages.settings.accessdenied.remote"));
UddiHub.log.fatal("Audit: FAILURE Attempt to alter configuration remotely from "
+ request.getRemoteAddr() + " "
+ request.getRemoteHost() + " "
+ request.getRemoteUser());
response.setStatus(403);
return;
} else {
//this is controlled by web.xml
/*if (!request.isUserInRole("uddiadmin")) {
out.write("Sorry, you need to have the 'uddiadmin' admin role to access this page.");
response.setStatus(403);
}*/
if (request.getMethod().equalsIgnoreCase("post")) {
UddiHub.log.info("Audit: SUCCESS Altering juddi config " +
request.getRemoteAddr() + " " +
request.getRemoteHost() + " " +
request.getRemoteUser());
Enumeration it = request.getParameterNames();
while (it.hasMoreElements()) {
String key = (String) it.nextElement();
String value = request.getParameter(key);
if (key.startsWith("client.") || key.startsWith("config.")) {
//its part of the juddi client config file
x.GetJuddiClientConfig().getConfiguration().setProperty(key, value);
//this just sets the runtime config
out.write("Sorry, you need to have the 'uddiadmin' admin role to access this page.");
response.setStatus(403);
}*/
if (request.getMethod().equalsIgnoreCase("post")) {
UddiHub.log.info("Audit: SUCCESS Altering juddi config "
+ request.getRemoteAddr() + " "
+ request.getRemoteHost() + " "
+ request.getRemoteUser());
try {
String formaction = request.getParameter("formaction");
if (formaction == null) {
response.setStatus(400);
return;
}
if ("settings".equalsIgnoreCase(formaction)) {
Enumeration it = request.getParameterNames();
while (it.hasMoreElements()) {
String key = (String) it.nextElement();
String value = request.getParameter(key);
if (key.startsWith("client.") || key.startsWith("config.")) {
if (!key.startsWith("client.nodes.")) {
//its part of the juddi client config file
x.GetJuddiClientConfig().getConfiguration().setProperty(key, value);
//this just sets the runtime config
// System.out.println(key + " = " + value);
}
}
}
} else if ("deleteNode".equalsIgnoreCase(formaction)) {
String nn = request.getParameter("nodename");
UDDINode un = x.GetJuddiClientConfig().getUDDINode(nn);
x.GetJuddiClientConfig().removeUDDINode(nn);
UddiHub.log.info("Deleting node config for " + nn);
} else if ("newNode".equalsIgnoreCase(formaction)) {
UddiHub.log.info("New node config");
UDDINode un = new UDDINode();
un.setName(request.getParameter("nodename"));
un.setClientName(x.GetJuddiClientConfig().getClientName());
un.setInquiryUrl(request.getParameter("inquiry"));
un.setProxyTransport(request.getParameter("transport"));
un.setPublishUrl(request.getParameter("publish"));
un.setDescription(request.getParameter("description"));
un.setCustodyTransferUrl(request.getParameter("custody"));
un.setSubscriptionUrl(request.getParameter("subscription"));
un.setSecurityUrl(request.getParameter("security"));
un.setFactoryInitial(request.getParameter("factoryinit"));
un.setFactoryNamingProvider(request.getParameter("factorynaming"));
un.setFactoryURLPkgs(request.getParameter("factoryurl"));
un.setInquiryRESTUrl(request.getParameter("inquiryrest"));
un.setReplicationUrl(request.getParameter("replication"));
un.setJuddiApiUrl(request.getParameter("juddiapi"));
x.GetJuddiClientConfig().addUDDINode(un);
} else if ("alterNode".equalsIgnoreCase(formaction)) {
String nn = request.getParameter("nodenameAlter");
UDDINode un = x.GetJuddiClientConfig().getUDDINode(nn);
UddiHub.log.info("Altering node config for " + nn);
un.setInquiryUrl(request.getParameter("inquiryAlter"));
un.setProxyTransport(request.getParameter("transportAlter"));
un.setPublishUrl(request.getParameter("publishAlter"));
un.setDescription(request.getParameter("descriptionAlter"));
un.setCustodyTransferUrl(request.getParameter("custodyAlter"));
un.setSubscriptionUrl(request.getParameter("subscriptionAlter"));
un.setSecurityUrl(request.getParameter("securityAlter"));
un.setFactoryInitial(request.getParameter("factoryinitAlter"));
un.setFactoryNamingProvider(request.getParameter("factorynamingAlter"));
un.setFactoryURLPkgs(request.getParameter("factoryurlAlter"));
un.setInquiryRESTUrl(request.getParameter("inquiryrestAlter"));
un.setReplicationUrl(request.getParameter("replicationAlter"));
un.setJuddiApiUrl(request.getParameter("juddiapiAlter"));
x.GetJuddiClientConfig().removeUDDINode(nn);
x.GetJuddiClientConfig().addUDDINode(un);
} else if ("getNode".equalsIgnoreCase(formaction)) {
String nn = request.getParameter("nodename");
UDDINode un = x.GetJuddiClientConfig().getUDDINode(nn);
UddiHub.log.info("Get node config for " + nn);
out.write("<table class=\"table table-hover\">");
out.write("<tr><td>Node Name</td><td><input class=\"crudnodeAlter\" type=text id=\"nodenameAlter\" value=\"" + StringEscapeUtils.escapeHtml(un.getName()) + "\"></td></tr>");
out.write("<tr><td>Description</td><td><input class=\"crudnodeAlter\" type=text id=\"descriptionAlter\" value=\"" + (un.getDescription() != null ? StringEscapeUtils.escapeHtml(un.getDescription()) : "") + "\"></td></tr>");
out.write("<tr><td>Transport</td><td><input class=\"crudnodeAlter\" type=text id=\"transportAlter\" value=\"" + (un.getProxyTransport() != null ? StringEscapeUtils.escapeHtml(un.getProxyTransport()) : "") + "\"></td></tr>");
out.write("<tr><td>Inquiry</td><td><input class=\"crudnodeAlter\" type=text id=\"inquiryAlter\" value=\"" + (un.getInquiryUrl() != null ? StringEscapeUtils.escapeHtml(un.getInquiryUrl()) : "") + "\"></td></tr>");
out.write("<tr><td>Publish</td><td><input class=\"crudnodeAlter\" type=text id=\"publishAlter\" value=\"" + (un.getPublishUrl() != null ? StringEscapeUtils.escapeHtml(un.getPublishUrl()) : "") + "\"></td></tr>");
out.write("<tr><td>Security</td><td><input class=\"crudnodeAlter\" type=text id=\"securityAlter\" value=\"" + (un.getSecurityUrl() != null ? StringEscapeUtils.escapeHtml(un.getSecurityUrl()) : "") + "\"></td></tr>");
out.write("<tr><td>Custody Transfer</td><td><input class=\"crudnodeAlter\" type=text id=\"custodyAlter\" value=\"" + (un.getCustodyTransferUrl() != null ? StringEscapeUtils.escapeHtml(un.getCustodyTransferUrl()) : "") + "\"></td></tr>");
out.write("<tr><td>Subscription</td><td><input class=\"crudnodeAlter\" type=text id=\"subscriptionAlter\" value=\"" + (un.getSubscriptionUrl() != null ? StringEscapeUtils.escapeHtml(un.getSubscriptionUrl()) : "") + "\"></td></tr>");
out.write("<tr><td colspan=2>Not used by juddi-gui</td></tr>");
out.write("<tr><td>Factory Initial</td><td><input type=text class=\"crudnodeAlter\" id=\"factoryinitAlter\" value=\"" + (un.getFactoryInitial() != null ? StringEscapeUtils.escapeHtml(un.getFactoryInitial()) : "") + "\"></td></tr>");
out.write("<tr><td>Factory Naming Provider</td><td><input class=\"crudnodeAlter\" type=text id=\"factorynamingAlter\" value=\"" + (un.getFactoryNamingProvider() != null ? StringEscapeUtils.escapeHtml(un.getFactoryNamingProvider()) : "") + "\"></td></tr>");
out.write("<tr><td>Factor URL Package</td><td><input class=\"crudnodeAlter\" type=text id=\"factoryurlAlter\" value=\"" + (un.getFactoryURLPkgs() != null ? StringEscapeUtils.escapeHtml(un.getFactoryURLPkgs()) : "") + "\"></td></tr>");
out.write("<tr><td>Inquiry REST</td><td><input class=\"crudnodeAlter\" type=text id=\"inquiryrestAlter\" value=\"" + (un.getInquiry_REST_Url() != null ? StringEscapeUtils.escapeHtml(un.getInquiry_REST_Url()) : "") + "\"></td></tr>");
out.write("<tr><td>Replication</td><td><input class=\"crudnodeAlter\" type=text id=\"replicationAlter\" value=\"" + (un.getReplicationUrl() != null ? StringEscapeUtils.escapeHtml(un.getReplicationUrl()) : "") + "\"></td></tr>");
out.write("<tr><td>jUDDI API</td><td><input class=\"crudnodeAlter\" type=text id=\"juddiapiAlter\" value=\"" + (un.getJuddiApiUrl() != null ? StringEscapeUtils.escapeHtml(un.getJuddiApiUrl()) : "") + "\"></td></tr>");
out.write("</table>");
return;
} else {
response.setStatus(400);
return;
}
x.GetJuddiClientConfig().saveConfig();
out.write(ResourceLoader.GetResource(session, "actions.saved"));
} catch (Exception ex) {
response.setStatus(406);
}
}
try {
x.GetJuddiClientConfig().saveConfigRaw();
out.write(ResourceLoader.GetResource(session, "actions.saved"));
} catch (Exception ex) {
response.setStatus(406);
out.write(x.HandleException(ex));
}
out.write(x.HandleException(ex));
}
}
}
}
%>

0 comments on commit 5eda4a7

Please sign in to comment.