You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2009/01/09 03:27:18 UTC

svn commit: r732911 - in /webservices/juddi/branches/v3_trunk: juddi-axis/ juddi-axis/src/main/webapp/ juddi-axis/src/main/webapp/WEB-INF/install/ juddi-core/src/main/java/org/apache/juddi/config/ juddi-core/src/main/java/org/apache/juddi/keygen/ juddi...

Author: jfaath
Date: Thu Jan  8 18:27:17 2009
New Revision: 732911

URL: http://svn.apache.org/viewvc?rev=732911&view=rev
Log:
JUDDI-155:  installation process work.  Users are now allowed to manually install with edited files, or just leave it at the default.

Added:
    webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/WEB-INF/install/
    webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml   (with props)
    webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/index.jsp   (with props)
    webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/juddi.css   (with props)
    webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/WEB-INF/install/
    webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml   (with props)
Removed:
    webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/happyjuddi.jsp
    webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/index.html
    webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/uddiget.jsp
Modified:
    webservices/juddi/branches/v3_trunk/juddi-axis/   (props changed)
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/AppConfig.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Constants.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/keygen/DefaultKeyGenerator.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIKey.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi_install_data/root_tModelKeyGen.xml
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
    webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/index.jsp
    webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/juddi.css

Propchange: webservices/juddi/branches/v3_trunk/juddi-axis/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan  8 18:27:17 2009
@@ -0,0 +1 @@
+target

Added: webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml?rev=732911&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml (added)
+++ webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml Thu Jan  8 18:27:17 2009
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<businessEntity xmlns="urn:uddi-org:api_v3" xmlns:xml="http://www.w3.org/XML/1998/namespace" businessKey="">
+  <name xml:lang="en">An Apache jUDDI Node</name>
+  <description xml:lang="en">This is a UDDI v3 registry node as implemented by Apache jUDDI.</description>
+  <discoveryURLs>
+    <discoveryURL useType="home">http://localhost:8080/juddi</discoveryURL>
+  </discoveryURLs>
+  <categoryBag>
+    <keyedReference tModelKey="uddi:uddi.org:categorization:nodes" keyValue="node" />
+  </categoryBag>
+  <businessServices>
+    <businessService serviceKey="" businessKey="">
+      <name xml:lang="en">UDDI Inquiry Service</name>
+      <description xml:lang="en">Web Service supporting UDDI Inquiry API</description>
+      <bindingTemplates>
+        <bindingTemplate bindingKey="" serviceKey="">
+          <description>UDDI Inquiry API V3</description>
+          <accessPoint useType="endpoint">http://localhost:8080/juddi/inquiry</accessPoint>
+          <tModelInstanceDetails>
+            <tModelInstanceInfo tModelKey="uddi:uddi.org:v3_inquiry">
+              <instanceDetails>
+                <instanceParms>
+                <![CDATA[
+                  <?xml version="1.0" encoding="utf-8" ?>
+                  <UDDIinstanceParmsContainer xmlns="urn:uddi-org:policy_v3_instanceParms">
+                    <defaultSortOrder>
+                      uddi:uddi.org:sortorder:binarysort
+                    </defaultSortOrder>
+                  </UDDIinstanceParmsContainer>
+                ]]>
+                </instanceParms>
+              </instanceDetails>
+            </tModelInstanceInfo>
+          </tModelInstanceDetails>
+        </bindingTemplate>
+      </bindingTemplates>
+    </businessService>
+    <businessService serviceKey="" businessKey="">
+      <name xml:lang="en">UDDI Publish Service</name>
+      <description xml:lang="en">Web Service supporting UDDI Publish API</description>
+      <bindingTemplates>
+        <bindingTemplate bindingKey="" serviceKey="">
+          <description>UDDI Publication API V3</description>
+          <accessPoint useType="endpoint">http://localhost:8080/juddi/publish</accessPoint>
+          <tModelInstanceDetails>
+            <tModelInstanceInfo tModelKey="uddi:uddi.org:v3_publication">
+              <instanceDetails>
+                <instanceParms>
+                <![CDATA[
+                  <?xml version="1.0" encoding="utf-8" ?>
+                  <UDDIinstanceParmsContainer xmlns="urn:uddi-org:policy_v3_instanceParms">
+                    <authInfoUse>required</authInfoUse>
+                  </UDDIinstanceParmsContainer>
+                ]]>
+                </instanceParms>
+              </instanceDetails>
+            </tModelInstanceInfo>
+          </tModelInstanceDetails>
+        </bindingTemplate>
+      </bindingTemplates>
+    </businessService>
+    <businessService serviceKey="" businessKey="">
+      <name xml:lang="en">UDDI Security Service</name>
+      <description xml:lang="en">Web Service supporting UDDI Security API</description>
+      <bindingTemplates>
+        <bindingTemplate bindingKey="" serviceKey="">
+          <description>UDDI Security API V3</description>
+          <accessPoint useType="endpoint">http://localhost:8080/juddi/security</accessPoint>
+          <tModelInstanceDetails>
+            <tModelInstanceInfo tModelKey="uddi:uddi.org:v3_security" />
+          </tModelInstanceDetails>
+        </bindingTemplate>
+      </bindingTemplates>
+    </businessService>
+  </businessServices>
+</businessEntity>
+
+
+
+

Propchange: webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/index.jsp?rev=732911&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/index.jsp (added)
+++ webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/index.jsp Thu Jan  8 18:27:17 2009
@@ -0,0 +1,138 @@
+<%@ page session="false" %>
+<%@ page import="java.util.List,
+                 org.apache.juddi.config.Install,
+                 javax.xml.bind.JAXBException,
+                 org.uddi.v3_service.DispositionReportFaultMessage,
+                 org.apache.juddi.config.AppConfig,
+                 org.apache.juddi.config.Property,
+                 org.uddi.api_v3.BusinessEntity,
+                 org.uddi.api_v3.Name,
+                 org.uddi.api_v3.Description,
+                 java.io.IOException,
+                 org.apache.juddi.config.Release"
+%>
+
+<!-- index.jsp -->
+<%
+
+String errMsg = "";
+if (request.getParameter("install") != null) {
+    try {
+        Install.install(request.getRealPath("WEB-INF\\install"), request.getParameter("rootPartition"), true);
+    }
+    catch (JAXBException je) {
+        errMsg = "JAXBException occurred attempting to install jUDDI:  " + je.getMessage();
+        if (je.getLinkedException() != null)
+            errMsg = errMsg + "; linkedException=" + je.getLinkedException().getMessage();
+    }
+    catch (IOException ioe) {
+        errMsg = "An IOException occurred attempting to install jUDDI:  " + ioe.getMessage();
+    }
+    catch (DispositionReportFaultMessage drfm) {
+        errMsg = "An error occurred attempting to install jUDDI:  " + drfm.getMessage();
+    }
+}
+%>
+<html>
+<head>
+<title>Apache jUDDI Registry</title>
+<link rel="stylesheet" href="juddi.css" />
+</head>
+<body>
+<div class="header" align="right"><a href="http://ws.apache.org/juddi/" target="_top">jUDDI@Apache</a></div>
+<h1>Apache jUDDI version <%= Release.getRegistryVersion() %></h1>
+
+
+<h3><em>Welcome</em> to Apache jUDDI!</h3>
+<ul>
+    <li><a href="services">View</a> service listing</li>
+    <li><a href="http://ws.apache.org/juddi/">Visit</a> the Apache-jUDDI Home Page</li>
+</ul>
+
+<div class="install">
+  <h4>jUDDI Installation</h4>
+    <div class="content">
+<%
+if (Install.alreadyInstalled())  {
+    String rootPartition = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PARTITION);
+	String nodeId = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID);
+    String nodeName = "";
+    String nodeDescription = "";
+    
+    BusinessEntity be = Install.getNodeBusinessEntity(nodeId);
+    if (be != null) {
+        Name n = (Name) be.getName().get(0);
+        if (n != null)
+            nodeName = n.getValue();
+
+        List descList = be.getDescription();
+        if (descList != null && descList.size() > 0) {
+            Description d = (Description) descList.get(0);
+            if (d != null)
+                nodeDescription = d.getValue();
+        }
+    }
+%>
+    <div>jUDDI has been successfully installed!</div>
+    <p />
+    <h3>Node Information</h3>
+    <table>
+        <tr>
+            <td><b>Root Partition:</b></td>
+            <td><%= rootPartition %></td>
+        </tr>
+        <tr>
+            <td><b>Node Id:</b></td>
+            <td><%= nodeId %></td>
+        </tr>
+        <tr>
+            <td><b>Name:</b></td>
+            <td><%= nodeName %></td>
+        </tr>
+        <tr>
+            <td><b>Description:</b></td>
+            <td><%= nodeDescription %></td>
+        </tr>
+    </table>
+<%
+} else { 
+%>
+    <div>
+      jUDDI does not appear to have been installed.  In order for jUDDI to function properly, certain entities must be installed into the registry.
+      You can chose to edit the entities located in the <i>WEB-INF/install</i> directory and install manually by clicking the install button below.  
+      Or, you can leave everything as is, and the entities will automatically be installed with the default values.  Please read the setup documentation 
+      for more information.
+    </div>
+<% 
+if (errMsg != null && errMsg.length() > 0) {
+%> 
+    <br/>
+    <div class="error"><%= errMsg %></div>
+<%	
+}
+%>
+    <br/>
+    <div>
+      <form action="index.jsp" method="post">
+        Please enter the root partition for this node.  The root partition will serve as the prefix to all identifiers created in the node.<br/><br/>
+        uddi:<input type="text" value="" name="rootPartition" size="40" /> (Ex. juddi.apache.org, www.mycompany.com:registry)<br/><br/>
+        <input type="submit" value="Install" name = "install" />
+      </form>
+    </div>
+<% 
+} 
+%>
+  </div>
+</div>
+
+<hr />
+<table width="100%" border="0">
+    <tr>
+        <td height="50" align="center" valign="bottom" nowrap>
+        <div class="footer">&nbsp;</div>
+        </td>
+    </tr>
+</table>
+
+</body>
+</html>
\ No newline at end of file

Propchange: webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/index.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/juddi.css
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/juddi.css?rev=732911&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/juddi.css (added)
+++ webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/juddi.css Thu Jan  8 18:27:17 2009
@@ -0,0 +1,157 @@
+body {
+  margin:      0px 10px 10px 10px;
+  font-family: "Trebuchet MS", sans-serif;
+  font-size:   10pt;
+  background:  #FFF;
+  color:       #000;
+}
+
+h1 {
+	font-family: "Trebuchet MS", sans-serif;
+	background: #00005A;
+	font-weight: normal;
+	color: White;
+	padding: 5px 10px;
+	margin: 0px -10px 10px -10px;
+}
+
+h2 {
+	font-family: "Trebuchet MS", sans-serif;
+	color: #00005A;
+}
+
+h3 {
+	font-family: "Trebuchet MS", sans-serif;
+	color: #00005A;
+}
+
+h4 {
+	font-family: "Trebuchet MS", sans-serif;
+	color: #00005A;
+}
+
+.sidebar {
+	border: 1px solid #00005A;
+	background: #EEE;
+	padding: 5px;
+} 
+
+pre.code_sample {
+  background: #EEE;
+  padding: 5px;
+}
+
+dt {
+  font-weight: bold;
+}
+
+dl {
+  margin-left: 3em;
+}
+
+td {
+  font-size:   10pt;
+}
+
+DIV.announcement dl {
+  margin-left: 0px;
+}
+
+div.LINK {
+  margin: 0px -10px;
+  padding: 2px 10px;
+  color: #000;
+  font-size: 10pt;
+}
+
+div.LINK A {
+  color: #6d0000;
+  text-decoration: none;
+}
+
+div.LINK A:hover {
+  color: #006200;
+  text-decoration: underline;
+}
+
+div.NAV {
+  background: #000;
+  margin: 0px -10px;
+  padding: 2px 10px;
+  color: #CCC;
+  font-size: 12pt;
+  font-weight: bold;
+}
+
+div.NAV A {
+  color: #CCC;
+  text-decoration: none;
+}
+
+div.NAV A:hover {
+  color: #FFF;
+}
+
+.msgs {
+	background-color: #FFD;
+	color: #005500;
+}
+
+.ednote {
+  color: #999;
+  font-style: italic;
+}
+
+.cvs_id {
+  color: #999;
+  font-size: 8pt;
+  border-top: solid 1px #999;
+}
+
+.author {
+  font-size: 14pt;
+  font-style: italic;
+}
+
+var {
+  font-style: italic;
+  color: #900;
+}
+
+div.footer { 
+  color: #666699; margin: 0px -10px; padding: 2px 10px; font-size: 8pt; font-weight: normal; 
+}
+
+div.footer a {
+  color: #666699; text-decoration: none; 
+}
+
+div.footer a:hover { 
+  color: #666699; text-decoration: underline; 
+}
+
+div.header { 
+  background: #000;
+  margin: 0px -10px;
+  padding: 2px 10px;
+  color: #CCC;
+  font-size: 8pt;
+  font-weight: bold;
+}
+
+div.header a {
+  color: #CCC;
+  text-decoration: none;
+}
+
+div.header a:hover { 
+  color: #FFF;
+}
+
+div.error {
+  color: #F00;
+}
+
+div.install {width:650px; background-color: #00005a;}
+div.install h4 {margin:0; padding:0; color: #fff;}
+div.install .content {margin:0; padding:4px 4px 0 4px; border-style:solid; border-color:#bbb; border-width:0 1px 1px 1px; background-color: #fff;}

Propchange: webservices/juddi/branches/v3_trunk/juddi-axis/src/main/webapp/juddi.css
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/AppConfig.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/AppConfig.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/AppConfig.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/AppConfig.java Thu Jan  8 18:27:17 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.juddi.config;
 
+import java.io.IOException;
+import java.util.List;
 import java.util.Properties;
 import java.util.Set;
 
@@ -33,8 +35,13 @@
 import org.apache.juddi.keygen.KeyGenerator;
 import org.apache.juddi.model.KeyGeneratorKey;
 import org.apache.juddi.model.UddiEntityPublisher;
+import org.apache.juddi.query.FindBusinessByCategoryQuery;
 import org.apache.juddi.query.PersistenceManager;
+import org.apache.juddi.query.util.FindQualifiers;
 import org.apache.log4j.Logger;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.ObjectFactory;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 
 /**
@@ -96,8 +103,7 @@
 		EntityTransaction tx = em.getTransaction();
 		tx.begin();
 
-		UddiEntityPublisher rootPublisher = em.find(UddiEntityPublisher.class, Constants.ROOT_PUBLISHER);
-		if (rootPublisher == null) {
+		if (!Install.alreadyInstalled(em)) {
 			log.info("The 'root' publisher was not found, loading...");
 			try {
 				Install.install();
@@ -105,27 +111,41 @@
 				throw new ConfigurationException(e);
 			} catch (DispositionReportFaultMessage e) {
 				throw new ConfigurationException(e);
+			} catch (IOException e) {
+				throw new ConfigurationException(e);
 			}
+
 		}
 		tx.commit();
 		tx.begin();
-		rootPublisher = em.find(UddiEntityPublisher.class, Constants.ROOT_PUBLISHER);
+		UddiEntityPublisher  rootPublisher = em.find(UddiEntityPublisher.class, Constants.ROOT_PUBLISHER);
 		Set<KeyGeneratorKey> rootKeyGenList = rootPublisher.getKeyGeneratorKeys();
 		if (rootKeyGenList == null || rootKeyGenList.size() == 0)
 			throw new ConfigurationException("The 'root' publisher key generator was not found.  Please make sure that the application is properly installed.");
 		
 		String rootKeyGen = rootKeyGenList.iterator().next().getKeygenTModelKey();
-		rootKeyGen = rootKeyGen.substring((KeyGenerator.UDDI_SCHEME + KeyGenerator.PARTITION_SEPARATOR).length());
+		//rootKeyGen = rootKeyGen.substring((KeyGenerator.UDDI_SCHEME + KeyGenerator.PARTITION_SEPARATOR).length());
 		rootKeyGen = rootKeyGen.substring(0, rootKeyGen.length() - (KeyGenerator.PARTITION_SEPARATOR + KeyGenerator.KEYGENERATOR_SUFFIX).length());
-		log.debug("root domain:  " + rootKeyGen);
-		
-		result.setProperty(Property.JUDDI_ROOT_DOMAIN, rootKeyGen);
+		log.debug("root partition:  " + rootKeyGen);
+
+		result.setProperty(Property.JUDDI_ROOT_PARTITION, rootKeyGen);
 		
-		// Get node id.  Do a findBusinessByCategory query and look for the node category key. It's ok if the value isn't found because on 
-		// initial startup, the node business entity won't exist.
+		// The node Id is defined as the business key of the business entity categorized as a node.  This entity is saved as part of the install.
+		// Only one business entity should be categorized as a node.
 		String nodeId = "";
-		result.setProperty(Property.JUDDI_NODE_ID, nodeId);
+		CategoryBag categoryBag = new CategoryBag();
+		KeyedReference keyedRef = new KeyedReference();
+		keyedRef.setTModelKey(Constants.NODE_CATEGORY_TMODEL);
+		keyedRef.setKeyValue(Constants.NODE_KEYVALUE);
+		categoryBag.getContent().add(new ObjectFactory().createKeyedReference(keyedRef));
+		List<?> keyList = FindBusinessByCategoryQuery.select(em, new FindQualifiers(), categoryBag, null);
+		if (keyList != null && keyList.size() > 1)
+			throw new ConfigurationException("Only one business entity can be categorized as the node.");
 		
+		if (keyList != null && keyList.size() > 0) {
+			nodeId = (String)keyList.get(0);
+		}
+		result.setProperty(Property.JUDDI_NODE_ID, nodeId);
 		
 		tx.commit();
 		em.close();

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Constants.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Constants.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Constants.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Constants.java Thu Jan  8 18:27:17 2009
@@ -28,4 +28,5 @@
 	
 	public static final String GENERAL_KEYWORD_TMODEL = "uddi:uddi-org:general_keywords";
 	public static final String NODE_CATEGORY_TMODEL = "uddi:uddi.org:categorization:nodes";
+	public static final String NODE_KEYVALUE = "node";
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java Thu Jan  8 18:27:17 2009
@@ -17,10 +17,15 @@
 
 package org.apache.juddi.config;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
 import java.util.List;
 import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.UUID;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
@@ -29,17 +34,22 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.juddi.api.datatype.Publisher;
-import org.apache.juddi.api.impl.UDDIPublicationImpl;
-import org.apache.juddi.api.impl.UDDISecurityImpl;
+import org.apache.juddi.api.impl.UDDIInquiryImpl;
 import org.apache.juddi.error.ErrorMessage;
 import org.apache.juddi.error.FatalErrorException;
+import org.apache.juddi.error.InvalidKeyPassedException;
+import org.apache.juddi.error.KeyUnavailableException;
+import org.apache.juddi.error.ValueNotAllowedException;
 import org.apache.juddi.keygen.KeyGenerator;
 import org.apache.juddi.mapping.MappingApiToModel;
 import org.apache.juddi.model.KeyGeneratorKey;
 import org.apache.juddi.model.KeyGeneratorKeyId;
 import org.apache.juddi.model.UddiEntityPublisher;
 import org.apache.juddi.query.PersistenceManager;
+import org.apache.juddi.validation.ValidatePublish;
+import org.apache.juddi.validation.ValidateUDDIKey;
 import org.apache.log4j.Logger;
 import org.uddi.api_v3.SaveTModel;
 import org.uddi.api_v3.TModel;
@@ -59,38 +69,70 @@
 	public static final String FILE_PERSISTENCE = "persistence.xml";
 	public static final String JUDDI_INSTALL_DATA_DIR = "juddi_install_data/";
 	public static Logger log = Logger.getLogger(Install.class);
+
+	public static void install() throws JAXBException, DispositionReportFaultMessage, IOException {
+		install(JUDDI_INSTALL_DATA_DIR, null, false);
+	}
 	
-	public static void install() throws JAXBException, DispositionReportFaultMessage {
-		
+	public static void install(String srcDir, String rootPartition, boolean reloadConfig) throws JAXBException, DispositionReportFaultMessage, IOException {
+		if (srcDir != null) {
+			if (srcDir.endsWith("\\") || srcDir.endsWith("/")) {
+				// Do nothing
+			}
+			else 
+				srcDir = srcDir + "\\";
+		}
+		else
+			srcDir = "";
+				
 		EntityManager em = PersistenceManager.getEntityManager();
 		EntityTransaction tx = em.getTransaction();
+		
+		UddiEntityPublisher rootPublisher = null;
+		UddiEntityPublisher uddiPublisher = null;
 		try {
 			tx.begin();
 	
 			if (alreadyInstalled(em))
 				throw new FatalErrorException(new ErrorMessage("errors.install.AlreadyInstalled"));
 			
-			UddiEntityPublisher rootPublisher = installPublisher(em, JUDDI_INSTALL_DATA_DIR + FILE_ROOT_PUBLISHER);
-			UddiEntityPublisher uddiPublisher = installPublisher(em, JUDDI_INSTALL_DATA_DIR + FILE_UDDI_PUBLISHER);
+			rootPublisher = installPublisher(em, JUDDI_INSTALL_DATA_DIR + FILE_ROOT_PUBLISHER);
+			uddiPublisher = installPublisher(em, JUDDI_INSTALL_DATA_DIR + FILE_UDDI_PUBLISHER);
+
+			installUDDITModels(em, JUDDI_INSTALL_DATA_DIR + FILE_UDDI_TMODELS, uddiPublisher);
 			
-			installPublisherKeyGen(em, JUDDI_INSTALL_DATA_DIR + FILE_ROOT_TMODELKEYGEN, rootPublisher);
+			installRootPublisherKeyGen(em, JUDDI_INSTALL_DATA_DIR + FILE_ROOT_TMODELKEYGEN, rootPartition, rootPublisher);
+
+			// This entity is installed through the API so validation can be performed.
+			installRootBusinessEntity(em, srcDir + FILE_ROOT_BUSINESSENTITY, rootPublisher);
 			
-			installUDDITModels(em, JUDDI_INSTALL_DATA_DIR + FILE_UDDI_TMODELS, uddiPublisher);
 			tx.commit();
-			//TODO why does this need it's own tx?
-			tx.begin();
-			installRootBusinessEntity(em, JUDDI_INSTALL_DATA_DIR + FILE_ROOT_BUSINESSENTITY, rootPublisher);
-			tx.commit();
-		} catch (Exception e) {
-			log .error(e.getMessage(),e);
+		}
+		catch(DispositionReportFaultMessage dr) {
+			log .error(dr.getMessage(),dr);
 			tx.rollback();
-		} finally {
+			throw dr;
+		} 
+		catch (JAXBException je) {
+			log .error(je.getMessage(),je);
+			tx.rollback();
+			throw je;
+		} 
+		catch (IOException ie) {
+			log .error(ie.getMessage(),ie);
+			tx.rollback();
+			throw ie;
+		} 
+		finally {
 			if (em.isOpen()) {
 				em.close();
 			}
 		}
 
-		
+		// Now that all necessary persistent entities are loaded, the configuration must be reloaded to be sure all properties are set.
+		if (reloadConfig) {
+			try { AppConfig.reloadConfig(); } catch (ConfigurationException ce) { log.error(ce.getMessage(), ce); }
+		}
 		
 	}
 
@@ -117,23 +159,8 @@
 		
 		return result;
 	}
-	
-	public static org.uddi.api_v3.RegisteredInfo getRootRegisteredInfo() throws DispositionReportFaultMessage {
-		UDDIPublicationImpl publish = new UDDIPublicationImpl();
-		UDDISecurityImpl security = new UDDISecurityImpl();
 
-		// TODO:  What if user configures a different authenticator?  Passing no credentials will not work.
-		org.uddi.api_v3.GetAuthToken gat = new org.uddi.api_v3.GetAuthToken();
-		gat.setUserID(Constants.ROOT_PUBLISHER);
-		org.uddi.api_v3.AuthToken authToken = security.getAuthToken(gat);
-		
-		org.uddi.api_v3.GetRegisteredInfo gri = new org.uddi.api_v3.GetRegisteredInfo();
-		gri.setAuthInfo(authToken.getAuthInfo());
-
-		return publish.getRegisteredInfo(gri);
-	}
-	
-	private static boolean alreadyInstalled(EntityManager em) {
+	public static boolean alreadyInstalled(EntityManager em) {
 		
 		UddiEntityPublisher publisher = em.find(UddiEntityPublisher.class, Constants.ROOT_PUBLISHER);
 		if (publisher != null)
@@ -146,25 +173,170 @@
 		return false;
 	}
 	
-	private static void installRootBusinessEntity(EntityManager em, String resource, UddiEntityPublisher publisher) 
+	public static org.uddi.api_v3.BusinessEntity getNodeBusinessEntity(String businessKey) throws DispositionReportFaultMessage {
+		UDDIInquiryImpl inquiry = new UDDIInquiryImpl();
+		
+		org.uddi.api_v3.GetBusinessDetail gbd = new org.uddi.api_v3.GetBusinessDetail();
+		gbd.getBusinessKey().add(businessKey);
+		
+		org.uddi.api_v3.BusinessDetail bd = inquiry.getBusinessDetail(gbd);
+		if (bd != null) {
+			List<org.uddi.api_v3.BusinessEntity> beList = bd.getBusinessEntity();
+			if (beList != null && beList.size() > 0)
+				return beList.get(0);
+		}
+
+		return new org.uddi.api_v3.BusinessEntity();
+	}
+	
+	
+	private static void installRootBusinessEntity(EntityManager em, String resource, UddiEntityPublisher rootPublisher) 
 	throws JAXBException, DispositionReportFaultMessage, IOException {
-		UDDIPublicationImpl publish = new UDDIPublicationImpl();
-		UDDISecurityImpl security = new UDDISecurityImpl();
 
-		// TODO:  What if user configures a different authenticator?  Passing no credentials will not work.
-		org.uddi.api_v3.GetAuthToken gat = new org.uddi.api_v3.GetAuthToken();
-		gat.setUserID(publisher.getAuthorizedName());
-		org.uddi.api_v3.AuthToken authToken = security.getAuthToken(gat);
+		org.uddi.api_v3.BusinessEntity apiBusinessEntity = (org.uddi.api_v3.BusinessEntity)buildEntityFromDoc(resource, "org.uddi.api_v3");
+		validateRootBusinessEntity(apiBusinessEntity, rootPublisher);
 		
-		org.uddi.api_v3.SaveBusiness sb = new org.uddi.api_v3.SaveBusiness();
+		org.apache.juddi.model.BusinessEntity modelBusinessEntity = new org.apache.juddi.model.BusinessEntity();
+		MappingApiToModel.mapBusinessEntity(apiBusinessEntity, modelBusinessEntity);
+		
+		modelBusinessEntity.assignAuthorizedName(rootPublisher.getAuthorizedName());
+		em.persist(modelBusinessEntity);
 
-		org.uddi.api_v3.BusinessEntity apiBusinessEntity = (org.uddi.api_v3.BusinessEntity)buildEntityFromDoc(resource, "org.uddi.api_v3");
-		sb.getBusinessEntity().add(apiBusinessEntity);
-		sb.setAuthInfo(authToken.getAuthInfo());
+	}
+	
+	// A watered down version of ValidatePublish's validateBusinessEntity, designed for the specific condition that this is run upon the initial
+	// jUDDI install.
+	private static void validateRootBusinessEntity(org.uddi.api_v3.BusinessEntity businessEntity, UddiEntityPublisher rootPublisher) 
+	throws DispositionReportFaultMessage {
+
+		// A supplied businessService can't be null
+		if (businessEntity == null)
+			throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
+		
+		String rootPartition = rootPublisher.getKeyGeneratorKeys().iterator().next().getKeygenTModelKey();
+		rootPartition = rootPartition.substring(0, rootPartition.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR));
+		
+		String entityKey = businessEntity.getBusinessKey();
+		if (entityKey == null || entityKey.length() == 0) {
+			entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID();
+			businessEntity.setBusinessKey(entityKey);
+		}
+		else {
+			
+			ValidateUDDIKey.validateUDDIv3Key(entityKey, rootPartition);
+			if (!rootPublisher.isValidPublisherKey(entityKey))
+				throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
+		}
+
+		ValidatePublish validatePublish = new ValidatePublish(rootPublisher);
 		
-		publish.saveBusiness(sb);
+		validatePublish.validateNames(businessEntity.getName());
+		validatePublish.validateDiscoveryUrls(businessEntity.getDiscoveryURLs());
+		validatePublish.validateContacts(businessEntity.getContacts());
+		validatePublish.validateCategoryBag(businessEntity.getCategoryBag());
+		validatePublish.validateIdentifierBag(businessEntity.getIdentifierBag());
+
+		org.uddi.api_v3.BusinessServices businessServices = businessEntity.getBusinessServices();
+		if (businessServices != null) {
+			List<org.uddi.api_v3.BusinessService> businessServiceList = businessServices.getBusinessService();
+			if (businessServiceList == null || businessServiceList.size() == 0)
+				throw new ValueNotAllowedException(new ErrorMessage("errors.businessservices.NoInput"));
+			
+			for (org.uddi.api_v3.BusinessService businessService : businessServiceList) {
+				validateRootBusinessService(businessService, businessEntity, rootPublisher);
+			}
+		}
+
+	}
+	
+	// A watered down version of ValidatePublish's validateBusinessService, designed for the specific condition that this is run upon the initial
+	// jUDDI install.
+	private static void validateRootBusinessService(org.uddi.api_v3.BusinessService businessService, org.uddi.api_v3.BusinessEntity parent, UddiEntityPublisher rootPublisher) 
+	throws DispositionReportFaultMessage {
+
+		// A supplied businessService can't be null
+		if (businessService == null)
+			throw new ValueNotAllowedException(new ErrorMessage("errors.businessservice.NullInput"));
+	
+		// A business key doesn't have to be provided, but if it is, it should match the parent business's key
+		String parentKey = businessService.getBusinessKey();
+		if (parentKey != null && parentKey.length()> 0) {
+			if (!parentKey.equals(parent.getBusinessKey()))
+				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
+		}
+		
+		String rootPartition = rootPublisher.getKeyGeneratorKeys().iterator().next().getKeygenTModelKey();
+		rootPartition = rootPartition.substring(0, rootPartition.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR));
+
+		// Retrieve the service's passed key
+		String entityKey = businessService.getServiceKey();
+		if (entityKey == null || entityKey.length() == 0) {
+			entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID();
+			businessService.setServiceKey(entityKey);
+		}
+		else {
+			ValidateUDDIKey.validateUDDIv3Key(entityKey, rootPartition);
+			if (!rootPublisher.isValidPublisherKey(entityKey))
+				throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
+		}
+		
+		ValidatePublish validatePublish = new ValidatePublish(rootPublisher);
+		
+		validatePublish.validateNames(businessService.getName());
+		validatePublish.validateCategoryBag(businessService.getCategoryBag());
+
+		org.uddi.api_v3.BindingTemplates bindingTemplates = businessService.getBindingTemplates();
+		if (bindingTemplates != null) {
+			List<org.uddi.api_v3.BindingTemplate> bindingTemplateList = bindingTemplates.getBindingTemplate();
+			if (bindingTemplateList == null || bindingTemplateList.size() == 0)
+				throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplates.NoInput"));
+			
+			for (org.uddi.api_v3.BindingTemplate bindingTemplate : bindingTemplateList) {
+				validateRootBindingTemplate(bindingTemplate, businessService, rootPublisher);
+			}
+		}
+	}
+
+	// A watered down version of ValidatePublish's validatBindingTemplate, designed for the specific condition that this is run upon the initial
+	// jUDDI install.
+	private static void validateRootBindingTemplate(org.uddi.api_v3.BindingTemplate bindingTemplate, org.uddi.api_v3.BusinessService parent, UddiEntityPublisher rootPublisher) 
+	throws DispositionReportFaultMessage {
+
+		// A supplied businessService can't be null
+		if (bindingTemplate == null)
+			throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NullInput"));
+	
+		// A service key doesn't have to be provided, but if it is, it should match the parent service's key
+		String parentKey = bindingTemplate.getServiceKey();
+		if (parentKey != null && parentKey.length()> 0) {
+			if (!parentKey.equals(parent.getServiceKey()))
+				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentServiceNotFound", parentKey));
+		}
+		
+		String rootPartition = rootPublisher.getKeyGeneratorKeys().iterator().next().getKeygenTModelKey();
+		rootPartition = rootPartition.substring(0, rootPartition.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR));
+
+		// Retrieve the service's passed key
+		String entityKey = bindingTemplate.getBindingKey();
+		if (entityKey == null || entityKey.length() == 0) {
+			entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID();
+			bindingTemplate.setBindingKey(entityKey);
+		}
+		else {
+			ValidateUDDIKey.validateUDDIv3Key(entityKey, rootPartition);
+			if (!rootPublisher.isValidPublisherKey(entityKey))
+				throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
+		}
+		
+		ValidatePublish validatePublish = new ValidatePublish(rootPublisher);
+		
+		validatePublish.validateCategoryBag(bindingTemplate.getCategoryBag());
+		validatePublish.validateTModelInstanceDetails(bindingTemplate.getTModelInstanceDetails());
+
 	}
 	
+	
+	
 	private static void installUDDITModels(EntityManager em, String resource, UddiEntityPublisher publisher) 
 		throws JAXBException, DispositionReportFaultMessage, IOException {
 		SaveTModel apiSaveTModel = (SaveTModel)buildEntityFromDoc(resource, "org.uddi.api_v3");
@@ -202,9 +374,36 @@
 		
 	}
 
-	private static void installPublisherKeyGen(EntityManager em, String resource, UddiEntityPublisher publisher) 
+	private static void installRootPublisherKeyGen(EntityManager em, String resource, String rootPartition, UddiEntityPublisher publisher) 
 		throws JAXBException, DispositionReportFaultMessage, IOException {
 		TModel apiTModel = (TModel)buildEntityFromDoc(resource, "org.uddi.api_v3");
+		
+		if (rootPartition != null && rootPartition.length() > 0) {
+			// A root partition was provided by the user.  Must validate it.  The first component should be a domain key and the any following
+			// tokens should be a valid KSS.
+			rootPartition = rootPartition.trim();
+			if (rootPartition.endsWith(KeyGenerator.PARTITION_SEPARATOR) || rootPartition.startsWith(KeyGenerator.PARTITION_SEPARATOR))
+				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", rootPartition));
+			
+			StringTokenizer tokenizer = new StringTokenizer(rootPartition.toLowerCase(), KeyGenerator.PARTITION_SEPARATOR);
+			for(int count = 0; tokenizer.hasMoreTokens(); count++) {
+				String nextToken = tokenizer.nextToken();
+
+				if (count == 0) {
+					if(!ValidateUDDIKey.isValidDomainKey(nextToken))
+						throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", rootPartition));
+				}
+				else {
+					if (!ValidateUDDIKey.isValidKSS(nextToken))
+						throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", rootPartition));
+				}
+			}
+			
+			// If the user-supplied root partition checks out, we can use that as the key.
+			apiTModel.setTModelKey(KeyGenerator.UDDI_SCHEME + KeyGenerator.PARTITION_SEPARATOR + 
+					rootPartition + KeyGenerator.PARTITION_SEPARATOR + KeyGenerator.KEYGENERATOR_SUFFIX);
+		}
+		
 		installPublisherKeyGen(em, apiTModel, publisher);
 	}
 
@@ -230,8 +429,16 @@
 	}
 	
 	private static Object buildEntityFromDoc(String resource, String thePackage) throws JAXBException, IOException {
-		InputStream resourceStream =Thread.currentThread().getContextClassLoader().getResource(resource).openStream();
-
+		InputStream resourceStream = null;
+		
+		URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
+		if (url != null)
+			resourceStream = url.openStream();
+		
+		if (resourceStream == null) {
+			resourceStream = new FileInputStream(new File(resource));
+		}
+		
 		JAXBContext jc = JAXBContext.newInstance(thePackage);
 		Unmarshaller unmarshaller = jc.createUnmarshaller();
 		Object obj = ((JAXBElement<?>)unmarshaller.unmarshal(resourceStream)).getValue();

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java Thu Jan  8 18:27:17 2009
@@ -20,7 +20,7 @@
 	public final static String JUDDI_USERSFILE                   ="juddi.usersfile";
 	public final static String JUDDI_MAX_ROWS                    ="juddi.maxRows";
 	public final static String JUDDI_MAX_IN_CLAUSE               ="juddi.maxInClause";
-	public final static String JUDDI_ROOT_DOMAIN                 ="juddi.rootDomain";
+	public final static String JUDDI_ROOT_PARTITION              ="juddi.rootPartition";
 	public final static String JUDDI_NODE_ID                     ="juddi.nodeId";
 	
 	

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/keygen/DefaultKeyGenerator.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/keygen/DefaultKeyGenerator.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/keygen/DefaultKeyGenerator.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/keygen/DefaultKeyGenerator.java Thu Jan  8 18:27:17 2009
@@ -36,12 +36,12 @@
 public class DefaultKeyGenerator implements KeyGenerator {
 
 	public String generate() throws DispositionReportFaultMessage {
-		String rootDomain = "";
+		String rootPartition = "";
 		try 
-		{ rootDomain = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_DOMAIN); }
+		{ rootPartition = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PARTITION); }
 		catch(ConfigurationException ce) 
-		{ throw new FatalErrorException(new ErrorMessage("errors.configuration.Retrieval", Property.JUDDI_ROOT_DOMAIN));}
+		{ throw new FatalErrorException(new ErrorMessage("errors.configuration.Retrieval", Property.JUDDI_ROOT_PARTITION));}
 		
-		return UDDI_SCHEME + PARTITION_SEPARATOR + rootDomain + PARTITION_SEPARATOR +UUID.randomUUID();
+		return rootPartition + PARTITION_SEPARATOR + UUID.randomUUID();
 	}
 }
\ No newline at end of file

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java Thu Jan  8 18:27:17 2009
@@ -354,27 +354,30 @@
 	}
 
 	public static org.uddi.api_v3.CategoryBag mapCategoryBag(org.apache.juddi.model.CategoryBag modelCategoryBag, 
-											org.uddi.api_v3.CategoryBag apiCategoryBag) 
+															 org.uddi.api_v3.CategoryBag apiCategoryBag) 
 				   throws DispositionReportFaultMessage {
-		if (apiCategoryBag == null)
-			apiCategoryBag = new org.uddi.api_v3.CategoryBag();
 
-		List<JAXBElement<?>> apiCategoryList = apiCategoryBag.getContent();
-		apiCategoryList.clear();
+		if (modelCategoryBag != null) {
+			if (apiCategoryBag == null)
+				apiCategoryBag = new org.uddi.api_v3.CategoryBag();
+	
+			List<JAXBElement<?>> apiCategoryList = apiCategoryBag.getContent();
+			apiCategoryList.clear();
 		
-		for (org.apache.juddi.model.KeyedReference modelKeyedReference : modelCategoryBag.getKeyedReferences()) {
-			org.uddi.api_v3.KeyedReference apiKeyedReference = new org.uddi.api_v3.KeyedReference();
-			apiKeyedReference.setTModelKey(modelKeyedReference.getTmodelKeyRef());
-			apiKeyedReference.setKeyName(modelKeyedReference.getKeyName());
-			apiKeyedReference.setKeyValue(modelKeyedReference.getKeyValue());
-			apiCategoryList.add(new ObjectFactory().createKeyedReference(apiKeyedReference));
-		}
-		for (org.apache.juddi.model.KeyedReferenceGroup modelKeyedReferenceGroup : modelCategoryBag.getKeyedReferenceGroups()) {
-			org.uddi.api_v3.KeyedReferenceGroup apiKeyedReferenceGroup = new org.uddi.api_v3.KeyedReferenceGroup();
-
-			mapKeyedReferenceGroup(modelKeyedReferenceGroup, apiKeyedReferenceGroup);
-			
-			apiCategoryList.add(new ObjectFactory().createKeyedReferenceGroup(apiKeyedReferenceGroup));
+			for (org.apache.juddi.model.KeyedReference modelKeyedReference : modelCategoryBag.getKeyedReferences()) {
+				org.uddi.api_v3.KeyedReference apiKeyedReference = new org.uddi.api_v3.KeyedReference();
+				apiKeyedReference.setTModelKey(modelKeyedReference.getTmodelKeyRef());
+				apiKeyedReference.setKeyName(modelKeyedReference.getKeyName());
+				apiKeyedReference.setKeyValue(modelKeyedReference.getKeyValue());
+				apiCategoryList.add(new ObjectFactory().createKeyedReference(apiKeyedReference));
+			}
+			for (org.apache.juddi.model.KeyedReferenceGroup modelKeyedReferenceGroup : modelCategoryBag.getKeyedReferenceGroups()) {
+				org.uddi.api_v3.KeyedReferenceGroup apiKeyedReferenceGroup = new org.uddi.api_v3.KeyedReferenceGroup();
+	
+				mapKeyedReferenceGroup(modelKeyedReferenceGroup, apiKeyedReferenceGroup);
+				
+				apiCategoryList.add(new ObjectFactory().createKeyedReferenceGroup(apiKeyedReferenceGroup));
+			}
 		}
 		return apiCategoryBag;
 	}

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java Thu Jan  8 18:27:17 2009
@@ -628,6 +628,10 @@
 				if (entityKey.toUpperCase().contains(KeyGenerator.KEYGENERATOR_SUFFIX.toUpperCase())) {
 					ValidateUDDIKey.validateUDDIv3KeyGeneratorTModel(tModel);
 					
+					// The root publisher is only allowed one key generator.  This is published in the installation.
+					if (publisher.getAuthorizedName().equals(Constants.ROOT_PUBLISHER))
+						throw new FatalErrorException(new ErrorMessage("errors.tmodel.keygenerator.RootKeyGen"));
+					
 					// It's a valid Key Generator, but is it available for this publisher?
 					if (!publisher.isKeyGeneratorAvailable(em, entityKey))
 						throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIKey.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIKey.java?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIKey.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIKey.java Thu Jan  8 18:27:17 2009
@@ -38,46 +38,42 @@
 public class ValidateUDDIKey {
 
 	public static void validateUDDIv3Key(String key) throws DispositionReportFaultMessage {
+		String rootPartition = "";
+		try 
+		{ rootPartition = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PARTITION); }
+		catch(ConfigurationException ce) 
+		{ throw new FatalErrorException(new ErrorMessage("errors.configuration.Retrieval", Property.JUDDI_ROOT_PARTITION));}
+
+		validateUDDIv3Key(key, rootPartition);
+	}
+
+	public static void validateUDDIv3Key(String key, String rootPartition) throws DispositionReportFaultMessage {
 		if (key == null)
-			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NullKeys"));
+			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NullKey"));
 		
-		key = key.trim();
-		if (key.endsWith(KeyGenerator.PARTITION_SEPARATOR))
+		String keyToTest = key.trim();
+		if (keyToTest.endsWith(KeyGenerator.PARTITION_SEPARATOR))
 			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
 		
-		StringTokenizer tokenizer = new StringTokenizer(key.toLowerCase(), KeyGenerator.PARTITION_SEPARATOR);
-		int tokensCount = tokenizer.countTokens();
-		if(tokensCount <= 1)
+		// Key must be prefixed with the root partition
+		if (!keyToTest.toUpperCase().startsWith(rootPartition.toUpperCase()))
+			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
+
+		// Key must have at least one more partition beyond the root.
+		keyToTest = keyToTest.substring(rootPartition.length());
+		if (keyToTest.length() == 0 || !keyToTest.startsWith(KeyGenerator.PARTITION_SEPARATOR))
 			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
+		
+		keyToTest = keyToTest.substring(1);
+		StringTokenizer tokenizer = new StringTokenizer(key.toLowerCase(), KeyGenerator.PARTITION_SEPARATOR);
 		for(int count = 0; tokenizer.hasMoreTokens(); count++) {
 			String nextToken = tokenizer.nextToken();
 
-
-			if (count == 0) {
-				if (!ValidateUDDIKey.isValidUDDIScheme(nextToken))
-					throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
-			}
-			else if (count == 1) {
-				if(!ValidateUDDIKey.isValidDomainKey(nextToken))
-					throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
-				
-				String rootDomain = "";
-				try 
-				{ rootDomain = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_DOMAIN); }
-				catch(ConfigurationException ce) 
-				{ throw new FatalErrorException(new ErrorMessage("errors.configuration.Retrieval", Property.JUDDI_ROOT_DOMAIN));}
-				
-				if (!rootDomain.equalsIgnoreCase(nextToken))
-					throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
-
-			}
-			else {
-				if (!isValidKSS(nextToken))
-					throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
-			}
+			if (!isValidKSS(nextToken))
+				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.MalformedKey", key));
 		}
 	}
-
+	
 	public static void validateUDDIv3KeyGeneratorKey(String key) throws DispositionReportFaultMessage {
 		if (key == null)
 			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NullKeys"));
@@ -85,7 +81,7 @@
 		if ( !(key.toUpperCase().endsWith(KeyGenerator.KEYGENERATOR_SUFFIX.toUpperCase())) )
 			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.KeyGenSuffix", key));
 		
-		validateUDDIv3Key(key.substring(0, key.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR)- 1));
+		validateUDDIv3Key(key.substring(0, key.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR)));
 	}
 	
 	public static void validateUDDIv3KeyGeneratorTModel(org.uddi.api_v3.TModel tModel) throws DispositionReportFaultMessage {
@@ -115,8 +111,8 @@
 
 		throw new ValueNotAllowedException(new ErrorMessage("errors.tmodel.keygenerator.BadCategory"));
 	}
-
-	private static boolean isValidUDDIScheme(String token) {
+	
+	public static boolean isValidUDDIScheme(String token) {
 		if (token == null)
 			return false;
 		
@@ -127,7 +123,7 @@
 
 	}
 	
-	private static boolean isValidDomainKey(String token) {
+	public static boolean isValidDomainKey(String token) {
 		if(token.indexOf("..") != -1)
 			return false;
 
@@ -162,7 +158,7 @@
 		return Character.isLetter(token.charAt(0)) && (token.length() == 1 || isValidDomainLabel(token.substring(1)));
 	}
 	
-	private static boolean isValidKSS(String token) {
+	public static boolean isValidKSS(String token) {
 		if (token.length() == 0)
 			return false;
 

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi_install_data/root_tModelKeyGen.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi_install_data/root_tModelKeyGen.xml?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi_install_data/root_tModelKeyGen.xml (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi_install_data/root_tModelKeyGen.xml Thu Jan  8 18:27:17 2009
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <tModel tModelKey="uddi:juddi.apache.org:keygenerator" xmlns="urn:uddi-org:api_v3">
   <name>uddi-org:keyGenerator</name>
-  <description>UDDI domain key generator</description>
+  <description>Root domain key generator</description>
   <overviewDoc>
     <overviewURL useType="text">
       http://uddi.org/pubs/uddi_v3.htm#keyGen</overviewURL>

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties Thu Jan  8 18:27:17 2009
@@ -94,6 +94,7 @@
 errors.tmodel.NullInput=The tModel structure cannot be blank
 errors.tmodel.NoAccessPoint=A tModel must contain a name
 errors.tmodel.keygenerator.BadCategory=A Key Generator tModel must have exactly one 'types' category whose value is 'keyGenerator'
+errors.tmodel.keygenerator.RootKeyGen=A Key Generator cannot be added for the root publisher
 errors.pubassertion.NullInput=The publisherAssertion structure cannot be blank
 errors.pubassertion.BlankKeyedRef=The keyedReference of the publisherAssertion cannot be blank.  All fields must contain content.
 errors.pubassertion.BlankFromKey=The fromKey of the publisherAssertion cannot be blank.

Added: webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml?rev=732911&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml (added)
+++ webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml Thu Jan  8 18:27:17 2009
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<businessEntity xmlns="urn:uddi-org:api_v3" xmlns:xml="http://www.w3.org/XML/1998/namespace" businessKey="">
+  <name xml:lang="en">An Apache jUDDI Node</name>
+  <description xml:lang="en">This is a UDDI v3 registry node as implemented by Apache jUDDI.</description>
+  <discoveryURLs>
+    <discoveryURL useType="home">http://localhost:8080/juddi</discoveryURL>
+  </discoveryURLs>
+  <categoryBag>
+    <keyedReference tModelKey="uddi:uddi.org:categorization:nodes" keyValue="node" />
+  </categoryBag>
+  <businessServices>
+    <businessService serviceKey="" businessKey="">
+      <name xml:lang="en">UDDI Inquiry Service</name>
+      <description xml:lang="en">Web Service supporting UDDI Inquiry API</description>
+      <bindingTemplates>
+        <bindingTemplate bindingKey="" serviceKey="">
+          <description>UDDI Inquiry API V3</description>
+          <accessPoint useType="endpoint">http://localhost:8080/juddi/inquiry</accessPoint>
+          <tModelInstanceDetails>
+            <tModelInstanceInfo tModelKey="uddi:uddi.org:v3_inquiry">
+              <instanceDetails>
+                <instanceParms>
+                <![CDATA[
+                  <?xml version="1.0" encoding="utf-8" ?>
+                  <UDDIinstanceParmsContainer xmlns="urn:uddi-org:policy_v3_instanceParms">
+                    <defaultSortOrder>
+                      uddi:uddi.org:sortorder:binarysort
+                    </defaultSortOrder>
+                  </UDDIinstanceParmsContainer>
+                ]]>
+                </instanceParms>
+              </instanceDetails>
+            </tModelInstanceInfo>
+          </tModelInstanceDetails>
+        </bindingTemplate>
+      </bindingTemplates>
+    </businessService>
+    <businessService serviceKey="" businessKey="">
+      <name xml:lang="en">UDDI Publish Service</name>
+      <description xml:lang="en">Web Service supporting UDDI Publish API</description>
+      <bindingTemplates>
+        <bindingTemplate bindingKey="" serviceKey="">
+          <description>UDDI Publication API V3</description>
+          <accessPoint useType="endpoint">http://localhost:8080/juddi/publish</accessPoint>
+          <tModelInstanceDetails>
+            <tModelInstanceInfo tModelKey="uddi:uddi.org:v3_publication">
+              <instanceDetails>
+                <instanceParms>
+                <![CDATA[
+                  <?xml version="1.0" encoding="utf-8" ?>
+                  <UDDIinstanceParmsContainer xmlns="urn:uddi-org:policy_v3_instanceParms">
+                    <authInfoUse>required</authInfoUse>
+                  </UDDIinstanceParmsContainer>
+                ]]>
+                </instanceParms>
+              </instanceDetails>
+            </tModelInstanceInfo>
+          </tModelInstanceDetails>
+        </bindingTemplate>
+      </bindingTemplates>
+    </businessService>
+    <businessService serviceKey="" businessKey="">
+      <name xml:lang="en">UDDI Security Service</name>
+      <description xml:lang="en">Web Service supporting UDDI Security API</description>
+      <bindingTemplates>
+        <bindingTemplate bindingKey="" serviceKey="">
+          <description>UDDI Security API V3</description>
+          <accessPoint useType="endpoint">http://localhost:8080/juddi/security</accessPoint>
+          <tModelInstanceDetails>
+            <tModelInstanceInfo tModelKey="uddi:uddi.org:v3_security" />
+          </tModelInstanceDetails>
+        </bindingTemplate>
+      </bindingTemplates>
+    </businessService>
+  </businessServices>
+</businessEntity>
+
+
+
+

Propchange: webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/WEB-INF/install/root_BusinessEntity.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/index.jsp?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/index.jsp (original)
+++ webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/index.jsp Thu Jan  8 18:27:17 2009
@@ -1,18 +1,37 @@
 <%@ page session="false" %>
-<%@ page import="
-	java.util.List,
-	javax.xml.bind.JAXBException,
-	org.uddi.v3_service.DispositionReportFaultMessage,
-	org.apache.juddi.config.AppConfig,
-	org.apache.juddi.config.Property,
-	org.uddi.api_v3.RegisteredInfo,
-	org.uddi.api_v3.BusinessInfo,
-	org.uddi.api_v3.Name,
-	org.uddi.api_v3.Description"
+<%@ page import="java.util.List,
+                 org.apache.juddi.config.Install,
+                 javax.xml.bind.JAXBException,
+                 org.uddi.v3_service.DispositionReportFaultMessage,
+                 org.apache.juddi.config.AppConfig,
+                 org.apache.juddi.config.Property,
+                 org.uddi.api_v3.BusinessEntity,
+                 org.uddi.api_v3.Name,
+                 org.uddi.api_v3.Description,
+                 java.io.IOException,
+                 org.apache.juddi.config.Release"
 %>
 
 <!-- index.jsp -->
+<%
 
+String errMsg = "";
+if (request.getParameter("install") != null) {
+    try {
+        Install.install(request.getRealPath("WEB-INF\\install"), request.getParameter("rootPartition"), true);
+    }
+    catch (JAXBException je) {
+        errMsg = "JAXBException occurred attempting to install jUDDI:  " + je.getMessage();
+        if (je.getLinkedException() != null)
+            errMsg = errMsg + "; linkedException=" + je.getLinkedException().getMessage();
+    }
+    catch (IOException ioe) {
+        errMsg = "An IOException occurred attempting to install jUDDI:  " + ioe.getMessage();
+    }
+    catch (DispositionReportFaultMessage drfm) {
+        errMsg = "An error occurred attempting to install jUDDI:  " + drfm.getMessage();
+    }
+}
 %>
 <html>
 <head>
@@ -21,15 +40,8 @@
 </head>
 <body>
 <div class="header" align="right"><a href="http://ws.apache.org/juddi/" target="_top">jUDDI@Apache</a></div>
-<h1>Apache jUDDI version [add version info here!]</h1>
+<h1>Apache jUDDI version <%= Release.getRegistryVersion() %></h1>
 
-<%
-	if (errMsg != null && errMsg.length() > 0) {
-%> 
-<div class="error"><%=errMsg%></div>
-<%
-	}
-%>
 
 <h3><em>Welcome</em> to Apache jUDDI!</h3>
 <ul>
@@ -37,30 +49,27 @@
     <li><a href="http://ws.apache.org/juddi/">Visit</a> the Apache-jUDDI Home Page</li>
 </ul>
 
+<div class="install">
+  <h4>jUDDI Installation</h4>
+    <div class="content">
 <%
-	if (Install.alreadyInstalled())  {
-    String nodeKey = "";
+if (Install.alreadyInstalled())  {
+    String rootPartition = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PARTITION);
+	String nodeId = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID);
     String nodeName = "";
     String nodeDescription = "";
     
-    RegisteredInfo ri = Install.getRootRegisteredInfo();
-    if (ri != null) {
-        List biList = ri.getBusinessInfos().getBusinessInfo();
-        if (biList != null && biList.size() > 0) {
-            BusinessInfo bi = (BusinessInfo) biList.get(0);
-            nodeKey = bi.getBusinessKey();
-            Name n = (Name) bi.getName().get(0);
-            if (n != null)
-                nodeName = n.getValue();
-            
-            List descList = bi.getDescription();
-            if (descList != null && descList.size() > 0) {
-                Description d = (Description) descList.get(0);
-                if (d != null)
-                    nodeDescription = d.getValue();
-            }
-                
-            
+    BusinessEntity be = Install.getNodeBusinessEntity(nodeId);
+    if (be != null) {
+        Name n = (Name) be.getName().get(0);
+        if (n != null)
+            nodeName = n.getValue();
+
+        List descList = be.getDescription();
+        if (descList != null && descList.size() > 0) {
+            Description d = (Description) descList.get(0);
+            if (d != null)
+                nodeDescription = d.getValue();
         }
     }
 %>
@@ -69,12 +78,12 @@
     <h3>Node Information</h3>
     <table>
         <tr>
-            <td><b>Root Domain:</b></td>
-            <td><%= AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_DOMAIN) %></td>
+            <td><b>Root Partition:</b></td>
+            <td><%= rootPartition %></td>
         </tr>
         <tr>
-            <td><b>Business Key:</b></td>
-            <td><%= nodeKey %></td>
+            <td><b>Node Id:</b></td>
+            <td><%= nodeId %></td>
         </tr>
         <tr>
             <td><b>Name:</b></td>
@@ -90,11 +99,31 @@
 %>
     <div>
       jUDDI does not appear to have been installed.  In order for jUDDI to function properly, certain entities must be installed into the registry.
-      Please read the setup documentation for more information.
+      You can chose to edit the entities located in the <i>WEB-INF/install</i> directory and install manually by clicking the install button below.  
+      Or, you can leave everything as is, and the entities will automatically be installed with the default values.  Please read the setup documentation 
+      for more information.
+    </div>
+<% 
+if (errMsg != null && errMsg.length() > 0) {
+%> 
+    <br/>
+    <div class="error"><%= errMsg %></div>
+<%	
+}
+%>
+    <br/>
+    <div>
+      <form action="index.jsp" method="post">
+        Please enter the root partition for this node.  The root partition will serve as the prefix to all identifiers created in the node.<br/><br/>
+        uddi:<input type="text" value="" name="rootPartition" size="40" /> (Ex. juddi.apache.org, www.mycompany.com:registry)<br/><br/>
+        <input type="submit" value="Install" name = "install" />
+      </form>
     </div>
 <% 
 } 
 %>
+  </div>
+</div>
 
 <hr />
 <table width="100%" border="0">

Modified: webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/juddi.css
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/juddi.css?rev=732911&r1=732910&r2=732911&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/juddi.css (original)
+++ webservices/juddi/branches/v3_trunk/juddi-cxf/src/main/webapp/juddi.css Thu Jan  8 18:27:17 2009
@@ -151,3 +151,7 @@
 div.error {
   color: #F00;
 }
+
+div.install {width:650px; background-color: #00005a;}
+div.install h4 {margin:0; padding:0; color: #fff;}
+div.install .content {margin:0; padding:4px 4px 0 4px; border-style:solid; border-color:#bbb; border-width:0 1px 1px 1px; background-color: #fff;}



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org