You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2013/11/28 14:01:37 UTC
svn commit: r1546360 - in /juddi/trunk: ./
juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/
juddi-core/src/test/java/org/apache/juddi/api/impl/
juddi-gui/src/main/webapp/ juddi-migration-tool/ juddi-migration-tool/src/
juddi-migration-too...
Author: alexoree
Date: Thu Nov 28 13:01:36 2013
New Revision: 1546360
URL: http://svn.apache.org/r1546360
Log:
JUDDI-729 first cut
JUDDI-637 src doc added to EntityCreator and PrintUDDI
JUDDI-723 fixed again
JUDDI-730 fixed
JUDDI-731 done
Added:
juddi/trunk/juddi-migration-tool/ (with props)
juddi/trunk/juddi-migration-tool/pom.xml
juddi/trunk/juddi-migration-tool/src/
juddi/trunk/juddi-migration-tool/src/main/
juddi/trunk/juddi-migration-tool/src/main/java/
juddi/trunk/juddi-migration-tool/src/main/java/org/
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/App.java
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Common.java
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Export.java
juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Import.java
juddi/trunk/juddi-migration-tool/src/main/resources/
juddi/trunk/juddi-migration-tool/src/main/resources/uddi.xml
- copied unchanged from r1545511, juddi/trunk/juddi-examples/more-uddi-samples/src/main/resources/META-INF/simple-publish-uddi.xml
juddi/trunk/juddi-migration-tool/src/test/
juddi/trunk/juddi-migration-tool/src/test/java/
juddi/trunk/juddi-migration-tool/src/test/java/org/
juddi/trunk/juddi-migration-tool/src/test/java/org/apache/
juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/
juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/
juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/migration/
juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/migration/tool/
juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/migration/tool/AppTest.java
Modified:
juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java
juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java
juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp
juddi/trunk/juddi-gui/src/main/webapp/serviceEditor.jsp
juddi/trunk/juddi-gui/src/main/webapp/tmodelEditor.jsp
juddi/trunk/pom.xml
juddi/trunk/uddi-client-dist/pom.xml
juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/EntityCreator.java
juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/PrintUDDI.java
Modified: juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java (original)
+++ juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java Thu Nov 28 13:01:36 2013
@@ -89,7 +89,7 @@ public class WSDLinaUDDIRegistryTest {
//now compare to the spec example
String porttypeXml = "wsdl/uddiv3-xml/3_2_1_porttype.xml";
- TModel specTModel = (org.uddi.api_v3.TModel)EntityCreator.buildFromDoc(porttypeXml, "org.uddi.api_v3");
+ TModel specTModel = (org.uddi.api_v3.TModel)EntityCreator.buildFromDoc(porttypeXml, EntityCreator.UDDIv3_Package);
//making sure the names are the same
Assert.assertEquals(specTModel.getName().getValue(),tModel.getName().getValue());
@@ -139,7 +139,7 @@ public class WSDLinaUDDIRegistryTest {
//Compare to the spec example
String bindingtmodelXml = "wsdl/uddiv3-xml/3_2_2_bindingtmodel.xml";
- TModel specTModel = (org.uddi.api_v3.TModel)EntityCreator.buildFromDoc(bindingtmodelXml, "org.uddi.api_v3");
+ TModel specTModel = (org.uddi.api_v3.TModel)EntityCreator.buildFromDoc(bindingtmodelXml, EntityCreator.UDDIv3_Package);
//Make sure the names are the same
Assert.assertEquals(specTModel.getName().getValue(),tModel.getName().getValue());
@@ -185,7 +185,7 @@ public class WSDLinaUDDIRegistryTest {
//Compare to the spec example
String businessServiceXml = "wsdl/uddiv3-xml/3_2_3_business_service.xml";
- BusinessService specBusinessService = (org.uddi.api_v3.BusinessService)EntityCreator.buildFromDoc(businessServiceXml, "org.uddi.api_v3");
+ BusinessService specBusinessService = (org.uddi.api_v3.BusinessService)EntityCreator.buildFromDoc(businessServiceXml, EntityCreator.UDDIv3_Package);
//Make sure the names are the same
Assert.assertEquals(specBusinessService.getName().get(0).getValue(),businessService.getName().get(0).getValue());
Modified: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java (original)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_010_PublisherTest.java Thu Nov 28 13:01:36 2013
@@ -144,7 +144,7 @@ public class API_010_PublisherTest {
logger.debug("Saving new publisher: " + publisherXML);
SavePublisher sp = new SavePublisher();
sp.setAuthInfo(authInfo);
- Publisher pubIn = (Publisher)EntityCreator.buildFromDoc(publisherXML, "org.apache.juddi.api_v3");
+ Publisher pubIn = (Publisher)EntityCreator.buildFromDoc(publisherXML, EntityCreator.JUDDIv3_Package);
sp.getPublisher().add(pubIn);
publisher.savePublisher(sp);
Modified: juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp Thu Nov 28 13:01:36 2013
@@ -160,7 +160,7 @@
out.write("<div id=\"" + PostBackConstants.NAME + i + "\" style=\"border-width:1px; border-style:solid\" >");
out.write("<div style=\"float:left; height:100%\"><a href=\"javascript:Remove('Name" + i + "');\"><i class=\"icon-trash icon-large\"></i></a></div>");
out.write("<div style=\"float:left\"> " + ResourceLoader.GetResource(session, "items.value") + ": </div>"
- + "<div class=\"edit\" id=\"" + PostBackConstants.NAME + i + PostBackConstants.VALUE + "\">" + (bd.getName().get(i).getValue()!=null ? StringEscapeUtils.escapeHtml(bd.getName().get(i).getValue()) : "") + "</div>");
+ + "<div class=\"edit\" id=\"" + PostBackConstants.NAME + i + PostBackConstants.VALUE + "\">" + (bd.getName().get(i).getValue() != null ? StringEscapeUtils.escapeHtml(bd.getName().get(i).getValue()) : "") + "</div>");
out.write("<div style=\"float:left\">" + ResourceLoader.GetResource(session, "items.lang") + " </div>"
+ "<div class=\"edit\" id=\"" + PostBackConstants.NAME + i + PostBackConstants.LANG + "\">");
if (bd.getName().get(i).getLang() != null) {
@@ -523,10 +523,10 @@
out.write(ResourceLoader.GetResource(session, "items.signed") + " " + bd.getSignature().size());
%>
<table class="table table-hover">
- <tr><th>#</th>
- <th><%=ResourceLoader.GetResource(session, "pages.signatures.signedby")%></th>
- <th></th>
- <th><%=ResourceLoader.GetResource(session, "pages.signatures.status")%></th></tr>
+ <tr><th>#</th>
+ <th><%=ResourceLoader.GetResource(session, "pages.signatures.signedby")%></th>
+ <th></th>
+ <th><%=ResourceLoader.GetResource(session, "pages.signatures.status")%></th></tr>
<%
for (int k = 0; k < bd.getSignature().size(); k++) {
@@ -560,12 +560,18 @@
</div>
<div class="tab-pane" id="opinfo">
+ <%
+ if (!newitem) {
+ %>
<script type="text/javascript">
$.get("ajax/opInfo.jsp?id=<%=StringEscapeUtils.escapeJavaScript(bd.getBusinessKey())%>", function(data) {
$("#opinfodiv").html(data);
})
</script>
<div id="opinfodiv"></div>
+ <%
+ }
+ %>
</div>
<div class="tab-pane" id="relations">
@@ -610,7 +616,10 @@
<%
if (bd.getSignature().isEmpty()) {
%>
- <a class="btn btn-primary " href="javascript:saveBusiness();"><i class="icon-save icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.save")%></a>
+ <a class="btn btn-primary " href="javascript:saveBusiness();"><i class="icon-save icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.s e
+
+
+ )%></a>
<% } else {
%>
<a href="#confirmDialog" role="button" class="btn btn-primary" data-toggle="modal"><i class="icon-save icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.save")%></a>
@@ -624,7 +633,7 @@
<a class="btn btn-info " href="editSubscription.jsp?bizid=<%=URLEncoder.encode(bizid, "UTF-8")%>" title="<%=ResourceLoader.GetResource(session, "actions.subscribe.description")%>"><i class="icon-rss icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.subscribe")%></a> |
<a class="btn btn-warning " href="transfer.jsp?biz=<%=URLEncoder.encode(bizid, "UTF-8")%>" title="<%=ResourceLoader.GetResource(session, "actions.transfer.description")%>"><i class="icon-exchange icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.transfer")%></a> |
<a class="btn " href="javascript:ViewAsXML();"><i class="icon-screenshot icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.asxml")%></a>
-
+
<%
//TODO for 3.2.1 <a class="btn " href="javascript:Copy();"><i class="icon-copy icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.copy")% ></a>
}
@@ -690,9 +699,9 @@
</div>
</div>
<script type="text/javascript">
-
+
</script>
-
+
<%
}
%>
Modified: juddi/trunk/juddi-gui/src/main/webapp/serviceEditor.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/serviceEditor.jsp?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/serviceEditor.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/serviceEditor.jsp Thu Nov 28 13:01:36 2013
@@ -163,13 +163,13 @@
<br>
<script type="text/javascript">
- var currentNameEntries=<%= bd.getName().size() - 1%>;
+ var currentNameEntries =<%= bd.getName().size() - 1%>;
var currentbindingtemplatesInstance =<%=currentbindingtemplatesInstance%>;
- var currentDescriptionEntries=<%= bd.getDescription().size() - 1%>;
- var currentcatkeyrefBT=<%=currentcatkeyrefBT%>;
- var currentcatkeyref=<%=bd.getCategoryBag().getKeyedReference().size()%>;
- var currentcatkeyrefgrpBT=<%=currentcatkeyrefgrpBT%>;
- var currentcatkeyrefgrp=<%=bd.getCategoryBag().getKeyedReferenceGroup().size()%>;
+ var currentDescriptionEntries =<%= bd.getDescription().size() - 1%>;
+ var currentcatkeyrefBT =<%=currentcatkeyrefBT%>;
+ var currentcatkeyref =<%=bd.getCategoryBag().getKeyedReference().size()%>;
+ var currentcatkeyrefgrpBT =<%=currentcatkeyrefgrpBT%>;
+ var currentcatkeyrefgrp =<%=bd.getCategoryBag().getKeyedReferenceGroup().size()%>;
var currentbindingtemplates = <%=bd.getBindingTemplates().getBindingTemplate().size()%>;
var currentOverviewDocs = <%=currentOverviewDocs%>;
</script>
@@ -186,30 +186,30 @@
<li><a href="#opinfo" ><%=ResourceLoader.GetResource(session, "pages.editor.tabnav.opinfo")%></a></li>
</ul>
<script>
- $(function () {
+ $(function() {
$('#myTab').tab;//('show');
})
- $('#myTab a[href=#general]').click(function (e) {
+ $('#myTab a[href=#general]').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
- $('#myTab a[href=#categories]').click(function (e) {
+ $('#myTab a[href=#categories]').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
- $('#myTab a[href=#bindingtemplates]').click(function (e) {
+ $('#myTab a[href=#bindingtemplates]').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
- $('#myTab a[href=#signatures]').click(function (e) {
+ $('#myTab a[href=#signatures]').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
- $('#myTab a[href=#opinfo]').click(function (e) {
+ $('#myTab a[href=#opinfo]').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
-
+
</script>
<div class="tab-content">
<div class="tab-pane active" id="general">
@@ -599,9 +599,9 @@
out.write("</td><td><div id=\"digsig" + k + "\">" + ResourceLoader.GetResource(session, "items.loading") + "</div>");
%>
<script type="text/javascript">
- $.get("ajax/validateSignature.jsp?type=service&id=<%=StringEscapeUtils.escapeJavaScript(bd.getServiceKey())%>", function(data){
+ $.get("ajax/validateSignature.jsp?type=service&id=<%=StringEscapeUtils.escapeJavaScript(bd.getServiceKey())%>", function(data) {
$("#digsig<%=k%>").html(data);
- if (data.indexOf("invalid") !== -1 )
+ if (data.indexOf("invalid") !== -1)
{
$("#sigtagheader").html($("#sigtagheader").html() + "<i class=\"icon-thumbs-down icon-large\" style=\"color:red\"></i>");
}
@@ -609,7 +609,7 @@
{
$("#sigtagheader").html($("#sigtagheader").html() + "<i class=\"icon-thumbs-up icon-large\" style=\"color:green\"></i>");
}
- } )
+ })
</script>
<%
out.write("</td></tr>");
@@ -628,9 +628,9 @@
%>
<script type="text/javascript">
- $.get("ajax/opInfo.jsp?id=<%=StringEscapeUtils.escapeJavaScript(bd.getServiceKey())%>", function(data){
+ $.get("ajax/opInfo.jsp?id=<%=StringEscapeUtils.escapeJavaScript(bd.getServiceKey())%>", function(data) {
$("#opinfodiv").html(data);
- } )
+ })
</script>
<div id="opinfodiv"></div>
<%
@@ -643,7 +643,7 @@
<script type="text/javascript">
- var currentDescriptionSpecific=<%=totalBTDescriptions%>;
+ var currentDescriptionSpecific =<%=totalBTDescriptions%>;
</script>
<Br><br>
<%
@@ -669,12 +669,12 @@
<script type="text/javascript">
function ViewAsXML()
{
- $.get("ajax/toXML.jsp?id=<%=URLEncoder.encode(serviceid, "UTF-8")%>&type=service", function(data){
- window.console && console.log('asXml success');
+ $.get("ajax/toXML.jsp?id=<%=URLEncoder.encode(serviceid, "UTF-8")%>&type=service", function(data) {
+ window.console && console.log('asXml success');
$("#viewAsXmlContent").html(safe_tags_replace(data));
- $( "#viewAsXml" ).modal('show');
+ $("#viewAsXml").modal('show');
});
-
+
}
</script>
<%
@@ -709,7 +709,7 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%=ResourceLoader.GetResource(session, "actions.asxml")%> </h3>
</div>
-
+
<div class="modal-body" id="viewAsXmlContent">
@@ -722,7 +722,9 @@
<%
}
%>
-<!-- container div is in header bottom-->
+
<%@include file="tmodelChooser.jsp" %>
+<%@include file="keyHelpModal.jsp" %>
+<!-- container div is in header bottom-->
<%@include file="header-bottom.jsp" %>
-<%@include file="keyHelpModal.jsp" %>
\ No newline at end of file
+
Modified: juddi/trunk/juddi-gui/src/main/webapp/tmodelEditor.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/tmodelEditor.jsp?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/tmodelEditor.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/tmodelEditor.jsp Thu Nov 28 13:01:36 2013
@@ -60,7 +60,7 @@
<li><a href="#signatures" id="sigtagheader"><%=ResourceLoader.GetResource(session, "pages.editor.tabnav.signatures")%></a></li>
<li><a href="#Instances" ><%=ResourceLoader.GetResource(session, "pages.editor.tmodel.instances")%></a></li>
-
+ <li><a href="#opinfo" ><%=ResourceLoader.GetResource(session, "pages.editor.tabnav.opinfo")%></a></li>
</ul>
<script type="text/javascript">
@@ -94,6 +94,11 @@
$(this).tab('show');
});
+ $('#myTab a[href=#opinfo]').click(function(e) {
+ e.preventDefault();
+ $(this).tab('show');
+ });
+
var currentDescriptionEntries =<%=bd.getDescription().size()%>;
var currentOverviewDocs =<%=bd.getOverviewDoc().size()%>;
<%
@@ -281,7 +286,7 @@
out.write(ResourceLoader.GetResource(session, "items.signed") + " " + bd.getSignature().size());
%>
<table class="table table-hover">
- <tr><th>#</th>
+ <tr><th>#</th>
<th><%=ResourceLoader.GetResource(session, "pages.signatures.signedby")%></th>
<th></th>
<th><%=ResourceLoader.GetResource(session, "pages.signatures.status")%></th></tr>
@@ -342,9 +347,9 @@
return;
}
var searchcontent = "<%
- if (bd.getTModelKey() != null) {
- out.write(StringEscapeUtils.escapeJavaScript(bd.getTModelKey()));
- }
+ if (bd.getTModelKey() != null) {
+ out.write(StringEscapeUtils.escapeJavaScript(bd.getTModelKey()));
+ }
%>";
var url = 'ajax/search.jsp';
@@ -402,80 +407,99 @@
</script>
<div id="InstancesContainer" style="border-width: 2px; border-style: solid;" >
</div>
- </div>
- <div><br>
- <%
- if (bd.getSignature().isEmpty()) {
- %>
- <a class="btn btn-primary " href="javascript:savetModel();"><i class="icon-save icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.save")%></a>
- <% } else {
- %>
- <a href="#confirmDialog" role="button" class="btn btn-primary" data-toggle="modal"><i class="icon-save icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.save")%></a>
-
- <% }
- %>
-
+ </div>
+ <div class="tab-pane" id="opinfo">
<%
if (!newitem) {
- %> |
- <a class="btn btn-danger " href="javascript:deletetModel();"><i class="icon-trash icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.delete")%></a> |
- <a class="btn btn-success " href="signer.jsp?id=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>&type=tmodel"><i class="icon-pencil icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.sign")%></a> |
- <a class="btn btn-info " href="editSubscription.jsp?tid=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>" title="<%=ResourceLoader.GetResource(session, "actions.subscribe.description")%>"><i class="icon-rss icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.subscribe")%></a> |
- <a class="btn btn-warning " href="transfer.jsp?biz=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>" title="<%=ResourceLoader.GetResource(session, "actions.transfer.description")%>"><i class="icon-exchange icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.transfer")%></a> |
- <a class="btn " href="javascript:ViewAsXML();"><i class="icon-screenshot icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.asxml")%></a>
+ %>
+ <script type="text/javascript">
+ $.get("ajax/opInfo.jsp?id=<%=StringEscapeUtils.escapeJavaScript(bd.getTModelKey())%>", function(data) {
+ $("#opinfodiv").html(data);
+ })
+ </script>
+ <div id="opinfodiv"></div>
<%
}
%>
-
-
</div>
-
-
-
</div>
- <script src="js/tmodeledit.js"></script>
- <script src="js/businessEditor.js"></script>
- <script type="text/javascript">
- Reedit();
+ <div><br>
<%
- if (!newitem) {
+ if (bd.getSignature().isEmpty()) {
+ %>
+ <a class="btn btn-primary " href="javascript:savetModel();"><i class="icon-save icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.save")%></a>
+ <% } else {
%>
+ <a href="#confirmDialog" role="button" class="btn btn-primary" data-toggle="modal"><i class="icon-save icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.save")%></a>
+
+ <% }
+ %>
+
- function ViewAsXML()
- {
- $.get("ajax/toXML.jsp?id=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>&type=tmodel", function(data) {
- window.console && console.log('asXml success');
- $("#viewAsXmlContent").html(safe_tags_replace(data));
- $("#viewAsXml").modal('show');
- });
- }
+ <%
+ if (!newitem) {
+ %> |
+ <a class="btn btn-danger " href="javascript:deletetModel();"><i class="icon-trash icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.delete")%></a> |
+ <a class="btn btn-success " href="signer.jsp?id=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>&type=tmodel"><i class="icon-pencil icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.sign")%></a> |
+ <a class="btn btn-info " href="editSubscription.jsp?tid=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>" title="<%=ResourceLoader.GetResource(session, "actions.subscribe.description")%>"><i class="icon-rss icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.subscribe")%></a> |
+ <a class="btn btn-warning " href="transfer.jsp?biz=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>" title="<%=ResourceLoader.GetResource(session, "actions.transfer.description")%>"><i class="icon-exchange icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.transfer")%></a> |
+ <a class="btn " href="javascript:ViewAsXML();"><i class="icon-screenshot icon-large"></i> <%=ResourceLoader.GetResource(session, "actions.asxml")%></a>
<%
}
%>
- </script>
+
+
+ </div>
+
+
</div>
+ <script src="js/tmodeledit.js"></script>
+ <script src="js/businessEditor.js"></script>
+ <script type="text/javascript">
+ Reedit();
+ <%
+ if (!newitem) {
+ %>
+
+ function ViewAsXML()
+ {
+ $.get("ajax/toXML.jsp?id=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>&type=tmodel", function(data) {
+ window.console && console.log('asXml success');
+ $("#viewAsXmlContent").html(safe_tags_replace(data));
+ $("#viewAsXml").modal('show');
+ });
- <div class="modal hide fade container" id="confirmDialog">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <h3><%=ResourceLoader.GetResource(session, "modal.digitalsignaturewarning.title")%></h3>
- </div>
- <div class="modal-body">
- <p><%=ResourceLoader.GetResource(session, "modal.digitalsignaturewarning.body")%></p>
- </div>
- <div class="modal-footer">
- <a href="#" class="btn"><%=ResourceLoader.GetResource(session, "modal.close")%></a>
- <a href="javascript:savetModel();$('#confirmDialog').modal('hide');" class="btn btn-primary">
- <%=ResourceLoader.GetResource(session, "modal.savechanges")%></a>
- </div>
+ }
+ <%
+ }
+ %>
+ </script>
+
+
+ </div>
+
+ <div class="modal hide fade container" id="confirmDialog">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h3><%=ResourceLoader.GetResource(session, "modal.digitalsignaturewarning.title")%></h3>
+ </div>
+ <div class="modal-body">
+ <p><%=ResourceLoader.GetResource(session, "modal.digitalsignaturewarning.body")%></p>
+ </div>
+ <div class="modal-footer">
+ <a href="#" class="btn"><%=ResourceLoader.GetResource(session, "modal.close")%></a>
+ <a href="javascript:savetModel();$('#confirmDialog').modal('hide');" class="btn btn-primary">
+ <%=ResourceLoader.GetResource(session, "modal.savechanges")%></a>
</div>
</div>
+
+
<%
if (!newitem) {
@@ -489,7 +513,7 @@
</div>
-
+
<div class="modal-footer">
<a href="ajax/toXML.jsp?id=<%=URLEncoder.encode(bd.getTModelKey(), "UTF-8")%>&type=tmodel" class="btn btn-primary" target="_blank">Popout</a>
<a href="javascript:closeXmlPop('viewAsXml');" class="btn"><%=ResourceLoader.GetResource(session, "modal.close")%></a>
@@ -500,5 +524,5 @@
%>
<%@include file="tmodelChooser.jsp" %>
<%@include file="keyHelpModal.jsp" %>
+
<%@include file="header-bottom.jsp" %>
-
\ No newline at end of file
Propchange: juddi/trunk/juddi-migration-tool/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov 28 13:01:36 2013
@@ -0,0 +1 @@
+target
Added: juddi/trunk/juddi-migration-tool/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-migration-tool/pom.xml?rev=1546360&view=auto
==============================================================================
--- juddi/trunk/juddi-migration-tool/pom.xml (added)
+++ juddi/trunk/juddi-migration-tool/pom.xml Thu Nov 28 13:01:36 2013
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>juddi-parent</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>juddi-migration-tool</artifactId>
+ <version>3.2-SNAPSHOT</version>
+ <name>UDDI Migration tool</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>juddi-client</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}-${version}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <copy file="${basedir}/src/main/resources/uddi.xml" tofile="${basedir}/target/uddi.xml"/>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.juddi.v3.migration.tool.App</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/App.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/App.java?rev=1546360&view=auto
==============================================================================
--- juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/App.java (added)
+++ juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/App.java Thu Nov 28 13:01:36 2013
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.v3.migration.tool;
+
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+
+/**
+ * Main entry point for the UDDI migration tool
+ *
+ * @author Alex O'Ree
+ * @since 3.2
+ *
+ */
+public class App {
+
+ public static void main(String[] args) throws ParseException, Exception {
+ System.out.println("This tool is used to export and import UDDI data from a UDDI v3 registry");
+
+ Options options = new Options();
+ options.addOption("import", false, "Imports data into a UDDIv3 registry");
+ options.addOption("export", false, "Exports data into a UDDIv3 registry");
+ options.addOption("user", true, "Username, if not defined, those is uddi.xml will be used");
+ options.addOption("pass", true, "Password, if not defined, those is uddi.xml will be used");
+ //options.addOption("safeMode", false, "Prevents overriding existing entities, saves items one at a time");
+ options.addOption("config", true, "Use an alternate config file default is 'uddi.xml'");
+ options.addOption("node", true, "The node 'name' in the config, default is 'default'");
+ options.addOption("isJuddi", false, "Is this a jUDDI registry? Is so we can in/export more stuff");
+ options.addOption("tmodel", true, "Im/Export for tmodels, default is 'tmodel-export.xml'");
+ options.addOption("business", true, "Im/Export option, default is 'business-export.xml'");
+ options.addOption("mappings", true, "Im/Export option, default is 'entityusermappings.properties'");
+ options.addOption("publishers", true, "jUDDI only - In/Export option, default is 'publishers-export.xml'");
+ options.addOption("myItemsOnly", false, "Export option, Only export items owned by yourself");
+ // options.addOption("preserveOwnership", false, "Im/Export option, Only export items owned by yourself");
+ // options.addOption("credFile", true, "Used with -preserveOwnership, this is a properties file mapping with user=pass");
+
+
+ // create the parser
+ CommandLineParser parser = new BasicParser();
+ CommandLine line = null;
+ try {
+ // parse the command line arguments
+ line = parser.parse(options, args);
+
+ if (line.hasOption("import") && line.hasOption("export")) {
+ ShowHelp(options);
+ return;
+ }
+ if (!line.hasOption("import") && !line.hasOption("export")) {
+ ShowHelp(options);
+ return;
+ }
+ String config = line.getOptionValue("config", "uddi.xml");
+ String node = line.getOptionValue("node", "default");
+
+ String pass = line.getOptionValue("pass", null);
+ String user = line.getOptionValue("user", null);
+
+ String tmodel = line.getOptionValue("tmodel", "tmodel-export.xml");
+ String business = line.getOptionValue("business", "business-export.xml");
+ String publishers = line.getOptionValue("publishers", "publishers-export.xml");
+
+ String mappings = line.getOptionValue("mappings", "entityusermappings.properties");
+ boolean preserveOwnership = false;//line.hasOption("preserveOwnership");
+ boolean juddi = line.hasOption("isJuddi");
+ boolean myItemsOnly = line.hasOption("myItemsOnly");
+ boolean safe = true;//line.hasOption("safeMode");
+ if (line.hasOption("export")) //CommandLine cmd = parser.parse(options, args);
+ {
+ System.out.println("Exporting...");
+ new Export().Execute(config, node, user, pass, tmodel, business, juddi, safe, publishers, myItemsOnly, mappings);
+ }
+ if (line.hasOption("import")) //CommandLine cmd = parser.parse(options, args);
+ {
+ System.out.println("Importing...");
+ new Import().Execute(config, node, user, pass, tmodel, business, juddi, safe, publishers, preserveOwnership, mappings);
+ }
+
+
+ } catch (Exception exp) {
+ // oops, something went wrong
+ ShowHelp(options);
+ System.err.println("Failed!");
+ exp.printStackTrace();
+ }
+
+
+ }
+
+ private static void ShowHelp(Options options) {
+ HelpFormatter formatter = new HelpFormatter();
+ formatter.printHelp("java -jar juddi-migration-tool-(VERSION)-jar-with-dependencies.jar", options);
+ }
+}
Added: juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Common.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Common.java?rev=1546360&view=auto
==============================================================================
--- juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Common.java (added)
+++ juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Common.java Thu Nov 28 13:01:36 2013
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.v3.migration.tool;
+
+import java.rmi.RemoteException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetOperationalInfo;
+import org.uddi.api_v3.OperationalInfos;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * Some common functions for the migration tool
+ *
+ * @author Alex O'Ree
+ * @since 3.2
+ */
+public class Common {
+
+ public static String GetOwner(String key, String token, UDDIInquiryPortType inquiry) {
+ GetOperationalInfo goi = new GetOperationalInfo();
+ goi.setAuthInfo(token);
+ goi.getEntityKey().add(key);
+ OperationalInfos operationalInfo = null;
+ try {
+ operationalInfo = inquiry.getOperationalInfo(goi);
+ return operationalInfo.getOperationalInfo().get(0).getAuthorizedName();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String GetAuthToken(String username, String password, UDDISecurityPortType sec) {
+ try {
+ GetAuthToken getAuthTokenRoot = new GetAuthToken();
+ getAuthTokenRoot.setUserID(username);
+ getAuthTokenRoot.setCred(password);
+ return sec.getAuthToken(getAuthTokenRoot).getAuthInfo();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+}
Added: juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Export.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Export.java?rev=1546360&view=auto
==============================================================================
--- juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Export.java (added)
+++ juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Export.java Thu Nov 28 13:01:36 2013
@@ -0,0 +1,278 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.v3.migration.tool;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+import javax.xml.bind.JAXB;
+import org.apache.juddi.api_v3.GetAllPublisherDetail;
+import org.apache.juddi.api_v3.PublisherDetail;
+import org.apache.juddi.api_v3.SavePublisher;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindQualifiers;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.GetTModelDetail;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.SaveBusiness;
+import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.TModel;
+import org.uddi.api_v3.TModelInfo;
+import org.uddi.api_v3.TModelList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * Provides UDDI export functions
+ *
+ * @author Alex O'Ree
+ * @since 3.2
+ */
+public class Export {
+
+ private static UDDISecurityPortType security = null;
+ private static JUDDIApiPortType juddiApi = null;
+ private static UDDIPublicationPortType publish = null;
+ private static UDDIInquiryPortType inquiry;
+ private JUDDIApiPortType juddi;
+ String token = null;
+ String username = null;
+ String tmodelfile = null;
+ String businessfile = null;
+ String publishersfile = null;
+ String mappingsfile = null;
+ boolean safemode = false;
+ boolean myitemsonly = false;
+ Set<String> usernames = new HashSet<String>();
+ Properties mapping = new Properties();
+
+ public void Execute(String config, String name, String user, String pass,
+ String tmodelout, String businessOut,
+ boolean isJuddi, boolean safe, String publishersFile,
+ boolean myItemsOnly,
+ String mappingsfile) throws Exception {
+ // create a manager and read the config in the archive;
+ // you can use your config file name
+ this.publishersfile = publishersFile;
+ this.tmodelfile = tmodelout;
+ this.businessfile = businessOut;
+ this.myitemsonly = myItemsOnly;
+ this.mappingsfile = mappingsfile;
+ UDDIClient clerkManager = new UDDIClient(config);
+ clerkManager.start();
+ UDDIClerk clerk = clerkManager.getClerk(name);
+
+ // register the clerkManager with the client side container
+ UDDIClientContainer.addClient(clerkManager); // a ClerkManager can be a client to multiple UDDI nodes, so
+ // a ClerkManager can be a client to multiple UDDI nodes, so
+ // supply the nodeName (defined in your uddi.xml.
+ // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
+ Transport transport = clerkManager.getTransport(name);
+ // Now you create a reference to the UDDI API
+ security = transport.getUDDISecurityService();
+ publish = transport.getUDDIPublishService();
+ inquiry = transport.getUDDIInquiryService();
+ juddi = transport.getJUDDIApiService();
+ this.username = user;
+ if (username == null || pass == null) {
+ username = clerk.getPublisher();
+ pass = clerk.getPassword();
+ }
+ if (username != null && pass != null
+ || username.length() != 0 && pass.length() != 0) {
+ GetAuthToken getAuthTokenRoot = new GetAuthToken();
+ getAuthTokenRoot.setUserID(username);
+ getAuthTokenRoot.setCred(pass);
+ token = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+ } else {
+ System.out.println("No credentials are available. This will probably fail spectacularly");
+
+ }
+
+
+ ExportTmodels();
+ ExportBusiness();
+
+ if (isJuddi) {
+ //optional juddi
+ ExportNodes();
+ ExportClerks();
+ ExportPublishers();
+ }
+ SaveProperties();
+ clerkManager.stop();
+ }
+
+ private void ExportBusiness() throws Exception {
+ FileOutputStream fos = new FileOutputStream(businessfile);
+ FindBusiness req = new FindBusiness();
+ req.setAuthInfo(token);
+ req.getName().add(new Name(UDDIConstants.WILDCARD, null));
+ req.setFindQualifiers(new FindQualifiers());
+ req.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+ int offset = 0;
+ int maxrows = 20;
+
+ //TODO param
+ req.setMaxRows(maxrows);
+ req.setListHead(offset);
+ BusinessList findTModel = null;
+ SaveBusiness sb = new SaveBusiness();
+ //TODO exclusion list
+ do {
+ findTModel = inquiry.findBusiness(req);
+ if (findTModel.getBusinessInfos() != null) {
+ for (int i = 0; i < findTModel.getBusinessInfos().getBusinessInfo().size(); i++) {
+ boolean go = true;
+ String owner = Common.GetOwner(findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey(), token, inquiry);
+ if (!usernames.contains(owner)) {
+ usernames.add(owner);
+ }
+ if (myitemsonly) {
+ if (owner == null || !owner.equalsIgnoreCase(username)) {
+ go = false;
+ System.out.println("skipping " + findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey() + " owned by " + owner);
+ }
+ }
+ if (go) {
+ mapping.setProperty(findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey(), owner);
+ System.out.println("Exporting " + findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey());
+ sb.getBusinessEntity().add(GetBusiness(findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey(), token));
+ }
+ }
+ }
+ //do stuff
+ offset = offset + maxrows;
+ req.setListHead(offset);
+
+ } while (findTModel.getListDescription().getIncludeCount() > 0);
+ System.out.println("Saving to disk");
+ JAXB.marshal(sb, fos);
+ fos.close();
+ System.out.println("Done with businesses");
+ }
+
+ private void ExportTmodels() throws Exception {
+ FileOutputStream fos = new FileOutputStream(tmodelfile);
+ FindTModel req = new FindTModel();
+ req.setName(new Name(UDDIConstants.WILDCARD, null));
+ req.setAuthInfo(token);
+ req.setFindQualifiers(new FindQualifiers());
+ req.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+ int offset = 0;
+ int maxrows = 20;
+
+ req.setMaxRows(maxrows);
+ req.setListHead(offset);
+ TModelList findTModel = null;
+ SaveTModel stm = new SaveTModel();
+ do {
+ findTModel = inquiry.findTModel(req);
+ if (findTModel.getTModelInfos() != null) {
+ for (int i = 0; i < findTModel.getTModelInfos().getTModelInfo().size(); i++) {
+ boolean go = true;
+ String owner = Common.GetOwner(findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey(), token, inquiry);
+ if (!usernames.contains(owner)) {
+ usernames.add(owner);
+ }
+ if (myitemsonly) {
+ if (owner == null || !owner.equalsIgnoreCase(username)) {
+ go = false;
+ }
+ }
+ if (go) {
+ mapping.setProperty(findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey(), owner);
+ System.out.println("Exporting " + findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey());
+ stm.getTModel().add(GetTmodel(findTModel.getTModelInfos().getTModelInfo().get(i), token));
+ }
+ }
+ }
+ offset = offset + maxrows;
+ req.setListHead(offset);
+ } while (findTModel.getListDescription().getIncludeCount() > 0);
+ System.out.println("Storing to disk ");
+ JAXB.marshal(stm, fos);
+ fos.close();
+ System.out.println("Done with tModels");
+ }
+
+ private TModel GetTmodel(TModelInfo get, String token) throws Exception {
+ GetTModelDetail r = new GetTModelDetail();
+ r.setAuthInfo(token);
+ r.getTModelKey().add(get.getTModelKey());
+ return inquiry.getTModelDetail(r).getTModel().get(0);
+ }
+
+ private BusinessEntity GetBusiness(String businessKey, String token) throws Exception {
+ GetBusinessDetail r = new GetBusinessDetail();
+ r.getBusinessKey().add(businessKey);
+ r.setAuthInfo(token);
+ return inquiry.getBusinessDetail(r).getBusinessEntity().get(0);
+ }
+
+ private void ExportNodes() {
+ }
+
+ private void ExportClerks() {
+ }
+
+ private void ExportPublishers() throws Exception {
+ FileOutputStream fos = new FileOutputStream(publishersfile);
+
+ GetAllPublisherDetail r = new GetAllPublisherDetail();
+ r.setAuthInfo(token);
+ PublisherDetail allPublisherDetail = juddi.getAllPublisherDetail(r);
+ SavePublisher saver = new SavePublisher();
+ saver.getPublisher().addAll(allPublisherDetail.getPublisher());
+ System.out.println("Storing to disk ");
+ JAXB.marshal(saver, fos);
+ fos.close();
+ System.out.println("Done with Publishers");
+ }
+
+ private void SaveProperties() throws FileNotFoundException {
+ StringBuilder sb = new StringBuilder();
+ Iterator<String> it = usernames.iterator();
+ while (it.hasNext()) {
+ sb.append(it.next());
+ if (it.hasNext()) {
+ sb.append(",");
+ }
+ }
+ mapping.put("usernames", sb.toString());
+ try {
+ FileOutputStream fos = new FileOutputStream(mappingsfile);
+ mapping.store(fos, token);
+ fos.close();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+}
Added: juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Import.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Import.java?rev=1546360&view=auto
==============================================================================
--- juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Import.java (added)
+++ juddi/trunk/juddi-migration-tool/src/main/java/org/apache/juddi/v3/migration/tool/Import.java Thu Nov 28 13:01:36 2013
@@ -0,0 +1,287 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.v3.migration.tool;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+import javax.xml.bind.JAXB;
+import org.apache.juddi.api_v3.GetPublisherDetail;
+import org.apache.juddi.api_v3.PublisherDetail;
+import org.apache.juddi.api_v3.SavePublisher;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.GetTModelDetail;
+import org.uddi.api_v3.SaveBusiness;
+import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.TModelDetail;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * Provides UDDI import functions
+ *
+ * @author Alex O'Ree
+ * @since 3.2
+ */
+public class Import {
+
+ private static UDDISecurityPortType security = null;
+ private static JUDDIApiPortType juddiApi = null;
+ private static UDDIPublicationPortType publish = null;
+ private static UDDIInquiryPortType inquiry;
+ private JUDDIApiPortType juddi;
+ String token = null;
+ String username = null;
+ String tmodelfile = null;
+ String businessfile = null;
+ String publishersfile = null;
+ String mappingsfile = null;
+ boolean safemode = false;
+ boolean preserveOwnership = false;
+ Set<String> usernames = new HashSet<String>();
+ Properties mapping = new Properties();
+
+ public void Execute(String config, String name, String username, String pass,
+ String tmodelIn, String businessIn,
+ boolean isJuddi, boolean safe, String publishersFile,
+ boolean preserveOwnership,
+ String mappingsfile) throws Exception {
+
+ this.publishersfile = publishersFile;
+ this.tmodelfile = tmodelIn;
+ this.businessfile = businessIn;
+ this.preserveOwnership = preserveOwnership;
+ this.mappingsfile = mappingsfile;
+
+ // create a manager and read the config in the archive;
+ // you can use your config file name
+ UDDIClient clerkManager = new UDDIClient(config);
+ clerkManager.start();
+ UDDIClerk clerk = clerkManager.getClerk(name);
+ // register the clerkManager with the client side container
+ UDDIClientContainer.addClient(clerkManager); // a ClerkManager can be a client to multiple UDDI nodes, so
+ // a ClerkManager can be a client to multiple UDDI nodes, so
+ // supply the nodeName (defined in your uddi.xml.
+ // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
+ Transport transport = clerkManager.getTransport(name);
+ // Now you create a reference to the UDDI API
+ security = transport.getUDDISecurityService();
+ publish = transport.getUDDIPublishService();
+ inquiry = transport.getUDDIInquiryService();
+ juddi = transport.getJUDDIApiService();
+ String token = null;
+ if (username == null || pass == null) {
+ username = clerk.getPublisher();
+ pass = clerk.getPassword();
+ }
+ if (username != null && pass != null) {
+ }
+
+
+ //load mapping files
+ //prompt for credentials
+ LoadProperties();
+
+ if (isJuddi) {
+ ImportPublishers();
+ }
+
+ if (preserveOwnership) {
+ //we'll need credentials for all the users
+ EnsureCredentials();
+ }
+
+
+
+ ImportTmodels();
+ ImportBusiness();
+
+
+
+ }
+
+ public String GetOwner(String key) {
+ return mapping.getProperty(key);
+ }
+
+ public String GetPwd(String key) {
+ return null;
+ }
+
+ private void ImportTmodels() throws Exception {
+ SaveTModel stm = JAXB.unmarshal(new File(tmodelfile), SaveTModel.class);
+ if (safemode) {
+ for (int i = 0; i < stm.getTModel().size(); i++) {
+ if (!TModelExists(stm.getTModel().get(i).getTModelKey(), token)) {
+ SaveTModel stm2 = new SaveTModel();
+ if (preserveOwnership) {
+ stm2.setAuthInfo(Common.GetAuthToken(GetOwner(stm.getTModel().get(i).getTModelKey()), GetPwd(GetOwner(stm.getTModel().get(i).getTModelKey())), security));
+ } else {
+ stm2.setAuthInfo(token);
+ }
+ stm2.getTModel().add(stm.getTModel().get(i));
+ try {
+ publish.saveTModel(stm2);
+ System.out.println(stm.getTModel().get(i).getTModelKey() + " saved");
+ } catch (Exception ex) {
+ System.out.println("Error saving " + stm.getTModel().get(i).getTModelKey() + " " + ex.getMessage());
+ }
+ } else {
+ System.out.println(stm.getTModel().get(i).getTModelKey() + " skipped, it exists already");
+ }
+ }
+ } else {
+ stm.setAuthInfo(token);
+ publish.saveTModel(stm);
+ System.out.println("All " + stm.getTModel().size() + " saved!");
+ }
+
+ }
+
+ private void ImportBusiness() throws Exception {
+ SaveBusiness stm = JAXB.unmarshal(new File(businessfile), SaveBusiness.class);
+ if (safemode) {
+ for (int i = 0; i < stm.getBusinessEntity().size(); i++) {
+ if (!BusinessExists(stm.getBusinessEntity().get(i).getBusinessKey(), token)) {
+ SaveBusiness stm2 = new SaveBusiness();
+ if (preserveOwnership) {
+ stm2.setAuthInfo(Common.GetAuthToken(GetOwner(stm.getBusinessEntity().get(i).getBusinessKey()), GetPwd(GetOwner(stm.getBusinessEntity().get(i).getBusinessKey())), security));
+ } else {
+ stm2.setAuthInfo(token);
+ }
+ stm2.getBusinessEntity().add(stm.getBusinessEntity().get(i));
+ try {
+ publish.saveBusiness(stm2);
+ System.out.println(stm.getBusinessEntity().get(i).getBusinessKey() + " saved");
+ } catch (Exception ex) {
+ System.out.println("Error saving " + stm.getBusinessEntity().get(i).getBusinessKey() + " " + ex.getMessage());
+ }
+ } else {
+ System.out.println(stm.getBusinessEntity().get(i).getBusinessKey() + " skipped, it exists already");
+ }
+ }
+ } else {
+ stm.setAuthInfo(token);
+ publish.saveBusiness(stm);
+ System.out.println("All " + stm.getBusinessEntity().size() + " businesses aved!");
+ }
+ }
+
+ private boolean TModelExists(String tModelKey, String token) {
+ GetTModelDetail r = new GetTModelDetail();
+ r.setAuthInfo(token);
+ r.getTModelKey().add(tModelKey);
+ try {
+ TModelDetail tModelDetail = inquiry.getTModelDetail(r);
+ if (tModelDetail != null && !tModelDetail.getTModel().isEmpty()) {
+ return true;
+ }
+ } catch (Exception ex) {
+ }
+ return false;
+ }
+
+ private boolean BusinessExists(String businessKey, String token) {
+ GetBusinessDetail r = new GetBusinessDetail();
+ r.setAuthInfo(token);
+ r.getBusinessKey().add(businessKey);
+ try {
+ BusinessDetail tModelDetail = inquiry.getBusinessDetail(r);
+ if (tModelDetail != null && !tModelDetail.getBusinessEntity().isEmpty()) {
+ return true;
+ }
+ } catch (Exception ex) {
+ }
+ return false;
+ }
+
+ private void ImportPublishers() throws Exception {
+
+ SavePublisher stm = JAXB.unmarshal(new File(publishersfile), SavePublisher.class);
+ if (safemode) {
+ for (int i = 0; i < stm.getPublisher().size(); i++) {
+ if (!PublisherExists(stm.getPublisher().get(i).getAuthorizedName(), token)) {
+ SavePublisher stm2 = new SavePublisher();
+ stm2.setAuthInfo(token);
+ stm2.getPublisher().add(stm.getPublisher().get(i));
+ try {
+ juddi.savePublisher(stm2);
+ System.out.println(stm.getPublisher().get(i).getAuthorizedName() + " saved");
+ } catch (Exception ex) {
+ System.out.println("Error saving " + stm.getPublisher().get(i).getAuthorizedName() + " " + ex.getMessage());
+ }
+ } else {
+ System.out.println(stm.getPublisher().get(i).getAuthorizedName() + " skipped, it exists already");
+ }
+ }
+ } else {
+ stm.setAuthInfo(token);
+ juddi.savePublisher(stm);
+ System.out.println("All " + stm.getPublisher().size() + " publishers saved!");
+ }
+ }
+
+ private boolean PublisherExists(String authorizedName, String token) {
+ GetPublisherDetail r = new GetPublisherDetail();
+ r.setAuthInfo(token);
+ r.getPublisherId().add(authorizedName);
+ try {
+ PublisherDetail publisherDetail = juddi.getPublisherDetail(r);
+ if (publisherDetail != null && !publisherDetail.getPublisher().isEmpty()) {
+ return true;
+ }
+ } catch (Exception ex) {
+ }
+ return false;
+ }
+
+ private void LoadProperties() {
+
+ StringBuilder sb = new StringBuilder();
+ Iterator<String> it = usernames.iterator();
+ while (it.hasNext()) {
+ sb.append(it.next());
+ if (it.hasNext()) {
+ sb.append(",");
+ }
+ }
+ mapping.put("usernames", sb.toString());
+ try {
+ FileInputStream fos = new FileInputStream(mappingsfile);
+ mapping.load(fos);
+ fos.close();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ mapping.getProperty("usernames");
+ }
+
+ private void EnsureCredentials() {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+}
Added: juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/migration/tool/AppTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/migration/tool/AppTest.java?rev=1546360&view=auto
==============================================================================
--- juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/migration/tool/AppTest.java (added)
+++ juddi/trunk/juddi-migration-tool/src/test/java/org/apache/juddi/juddi/migration/tool/AppTest.java Thu Nov 28 13:01:36 2013
@@ -0,0 +1,38 @@
+package org.apache.juddi.juddi.migration.tool;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
Modified: juddi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/pom.xml?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/pom.xml (original)
+++ juddi/trunk/pom.xml Thu Nov 28 13:01:36 2013
@@ -280,7 +280,7 @@
<module>juddi-gui</module>
<module>juddi-tomcat</module>
<module>uddi-tck</module>
-
+ <module>juddi-migration-tool</module>
</modules>
<distributionManagement>
<site>
Modified: juddi/trunk/uddi-client-dist/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/uddi-client-dist/pom.xml?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/uddi-client-dist/pom.xml (original)
+++ juddi/trunk/uddi-client-dist/pom.xml Thu Nov 28 13:01:36 2013
@@ -41,6 +41,11 @@
<version>${project.parent.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>juddi-migration-tool</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.juddi</groupId>
<artifactId>uddi-tck</artifactId>
<type>test-jar</type>
Modified: juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/EntityCreator.java
URL: http://svn.apache.org/viewvc/juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/EntityCreator.java?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/EntityCreator.java (original)
+++ juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/EntityCreator.java Thu Nov 28 13:01:36 2013
@@ -18,6 +18,7 @@ package org.apache.juddi.jaxb;
* @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
* @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
*/
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
@@ -32,14 +33,38 @@ import javax.xml.bind.Unmarshaller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+/**
+ * This class is the logical opposite of PrintUDDI. It will create
+ * UDDI objects from a string or file.
+ * @see PrintUDDI
+ * @author unknown, but probably Kurt Stam
+ */
public class EntityCreator {
+ public static final String UDDIv3_Package="org.uddi.api_v3";
+ public static final String JUDDIv3_Package="org.apache.juddi.api_v3";
+
private static Log logger = LogFactory.getLog(EntityCreator.class);
+ /**
+ * Builds UDDI data from a document, URL, file, etc
+ * @param fileName
+ * @param thePackage
+ * @return
+ * @throws JAXBException
+ * @throws IOException
+ */
@SuppressWarnings("rawtypes")
public static Object buildFromDoc(String fileName, String thePackage) throws JAXBException, IOException {
Object obj = null;
- URL url = Thread.currentThread().getContextClassLoader().getResource(fileName);
+ File f = new File(fileName);
+ URL url=null;
+ if (f.exists()){
+ url = f.toURI().toURL();
+ }
+ if (url==null) {
+ url = Thread.currentThread().getContextClassLoader().getResource(fileName);
+ }
if (url==null) {
logger.error("Could not find resource: " + fileName);
} else {
@@ -52,6 +77,14 @@ public class EntityCreator {
return obj;
}
+ /**
+ * converts a XML in a String to a UDDI entity
+ * @param source
+ * @param thePackage
+ * @return
+ * @throws JAXBException
+ * @throws IOException
+ */
@SuppressWarnings("rawtypes")
public static Object buildFromString(String source, String thePackage) throws JAXBException, IOException {
Object obj = null;
@@ -61,6 +94,14 @@ public class EntityCreator {
return obj;
}
+ /**
+ * Only use this class for debugging purposes. Output may not be valid XML
+ * @param obj
+ * @param thePackage
+ * @throws JAXBException
+ * @deprecated
+ */
+ @Deprecated
public static void outputEntity(Object obj, String thePackage) throws JAXBException {
JAXBContext jc = JAXBContext.newInstance(thePackage);
Marshaller marshaller = jc.createMarshaller();
Modified: juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/PrintUDDI.java
URL: http://svn.apache.org/viewvc/juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/PrintUDDI.java?rev=1546360&r1=1546359&r2=1546360&view=diff
==============================================================================
--- juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/PrintUDDI.java (original)
+++ juddi/trunk/uddi-ws/src/main/java/org/apache/juddi/jaxb/PrintUDDI.java Thu Nov 28 13:01:36 2013
@@ -23,8 +23,11 @@ import javax.xml.bind.Marshaller;
import javax.xml.namespace.QName;
/**
- * This is for printing UDDI v3 objects from the spec
+ * This is for printing UDDI v3 objects from the spec.<br><br>
+ * Note: This class should be used for troubleshooting purposes only.
+ * To marshall and unmarshall entites, use JAXB.marshal
* @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ * @see javax.xml.bind.JAXB
* @param <T>
*/
public class PrintUDDI<T> {
@@ -43,7 +46,17 @@ public class PrintUDDI<T> {
return marshaller;
}
+ /**
+ * Prints a UDDI entity. WARNING only use for debugging purposes. Resultant text
+ * may not be unmarshalable. Use JAXB.marshall(entity) if need to be able to unmarshall
+ * the content again.
+ * @param UDDIEntity
+ * @return Marshalled XML as a string
+ * @throws IllegalArgumentException
+ */
public String print(T UDDIEntity) {
+ if (UDDIEntity==null)
+ throw new IllegalArgumentException();
String xml = "";
@SuppressWarnings("unchecked")
Class<T> type = (Class<T>) UDDIEntity.getClass();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org