juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject juddi git commit: JUDDI-903 fixed sql injection JUDDI-902 fixed, subscriptions are now deleted JUDDI-901 progress JUDDI-706 finishing up most of the newer functions
Date Mon, 22 Dec 2014 00:09:45 GMT
Repository: juddi
Updated Branches:
  refs/heads/master d158cca2a -> 5fb73fd3f


JUDDI-903 fixed sql injection
JUDDI-902 fixed, subscriptions are now deleted
JUDDI-901 progress
JUDDI-706 finishing up most of the newer functions


Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/5fb73fd3
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/5fb73fd3
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/5fb73fd3

Branch: refs/heads/master
Commit: 5fb73fd3f067b4368a1981938b21731b1da70727
Parents: d158cca
Author: Alex <alexoree@apache.org>
Authored: Sun Dec 21 19:09:36 2014 -0500
Committer: Alex <alexoree@apache.org>
Committed: Sun Dec 21 19:09:36 2014 -0500

----------------------------------------------------------------------
 .../org/apache/juddi/api/impl/JUDDIApiImpl.java | 105 ++++-
 .../apache/juddi/mapping/MappingModelToApi.java |  26 +-
 .../org/apache/juddi/model/BusinessEntity.java  |   2 +
 .../src/main/resources/messages.properties      |   2 +-
 .../api/impl/API_110_FindBusinessTest.java      |   5 +-
 juddi-gui/src/main/webapp/csrf.jsp              |  14 +-
 .../adminconsole/hub/JUDDIRequestsAsXML.java    | 203 +++++++++
 .../juddi/adminconsole/hub/UddiAdminHub.java    | 456 ++++++++++++++++++-
 juddiv3-war/src/main/webapp/admin/admin.jsp     | 157 +++++--
 .../src/main/webapp/admin/ajax/advanced.jsp     |  39 ++
 10 files changed, 941 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java b/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
index 1b6b019..6425f2b 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
+++ b/juddi-core/src/main/java/org/apache/juddi/api/impl/JUDDIApiImpl.java
@@ -26,6 +26,8 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.jws.WebService;
 import javax.persistence.EntityManager;
@@ -35,6 +37,7 @@ import javax.xml.bind.JAXB;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Marshaller;
 import javax.xml.ws.Holder;
+import org.apache.commons.configuration.ConfigurationException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -67,10 +70,12 @@ import org.apache.juddi.api_v3.SavePublisher;
 import org.apache.juddi.api_v3.SubscriptionWrapper;
 import org.apache.juddi.api_v3.SyncSubscription;
 import org.apache.juddi.api_v3.SyncSubscriptionDetail;
+import org.apache.juddi.config.AppConfig;
 import org.apache.juddi.config.PersistenceManager;
 import org.apache.juddi.config.Property;
 import org.apache.juddi.mapping.MappingApiToModel;
 import org.apache.juddi.mapping.MappingModelToApi;
+import org.apache.juddi.model.BusinessEntity;
 import org.apache.juddi.model.ClientSubscriptionInfo;
 import org.apache.juddi.model.Node;
 import org.apache.juddi.model.Publisher;
@@ -95,6 +100,7 @@ import org.uddi.api_v3.BusinessInfo;
 import org.uddi.api_v3.BusinessInfos;
 import org.uddi.api_v3.Contact;
 import org.uddi.api_v3.DeleteTModel;
+import org.uddi.api_v3.DiscardAuthToken;
 import org.uddi.api_v3.DispositionReport;
 import org.uddi.api_v3.GetRegisteredInfo;
 import org.uddi.api_v3.InfoSelection;
@@ -102,6 +108,7 @@ import org.uddi.api_v3.KeyType;
 import org.uddi.api_v3.PersonName;
 import org.uddi.api_v3.RegisteredInfo;
 import org.uddi.api_v3.Result;
+import org.uddi.api_v3.SaveBusiness;
 import org.uddi.api_v3.SaveTModel;
 import org.uddi.api_v3.TModelInfo;
 import org.uddi.api_v3.TModelInfos;
@@ -190,11 +197,14 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
 
         /**
          * Deletes publisher(s) from the persistence layer. This method is
-         * specific to jUDDI. Administrative privilege required.
+         * specific to jUDDI. Administrative privilege required. Also removes all
+         * registered business entities of the user and marks all created tModels as "deleted"
+         * but not does not remove the tModel from persistence. All subscriptions are also destroyed
          *
          * @param body
          * @throws DispositionReportFaultMessage
          */
+        @Override
         public void deletePublisher(DeletePublisher body)
                 throws DispositionReportFaultMessage {
                 long startTime = System.currentTimeMillis();
@@ -244,7 +254,12 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
                                         }
                                 }
                                 log.info("remove all persisted AuthTokens for publisher " + entityKey + ".");
-                                Query q1 = em.createQuery("DELETE FROM AuthToken auth WHERE auth.authorizedName = '" + entityKey + "'");
+                                Query q1 = em.createQuery("DELETE FROM AuthToken auth WHERE auth.authorizedName = ?");
+                                q1.setParameter(1, entityKey);
+                                q1.executeUpdate();
+                                log.info("remove all subscriptions for publisher " + entityKey + ".");
+                                q1 = em.createQuery("DELETE FROM Subscription s WHERE s.authorizedName = ?");
+                                q1.setParameter(1, entityKey);
                                 q1.executeUpdate();
 
                                 log.info("removing publisher " + entityKey + ".");
@@ -395,6 +410,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
          * @param body
          * @throws DispositionReportFaultMessage
          */
+        @Override
         public void adminDeleteTModel(DeleteTModel body)
                 throws DispositionReportFaultMessage {
                 long startTime = System.currentTimeMillis();
@@ -407,6 +423,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
 
                         new ValidatePublish(publisher).validateAdminDeleteTModel(em, body);
 
+                        //TODO if referiental integrity is turned on, check to see if this is referenced anywhere and prevent the delete
                         List<String> entityKeyList = body.getTModelKey();
                         for (String entityKey : entityKeyList) {
                                 Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
@@ -1170,11 +1187,47 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
         @Override
         public DispositionReport adminSaveBusiness(String authInfo, List<AdminSaveBusinessWrapper> values) throws DispositionReportFaultMessage, RemoteException {
                 long startTime = System.currentTimeMillis();
-                long procTime = System.currentTimeMillis() - startTime;
-                serviceCounter.update(JUDDIQuery.ADMIN_SAVE_BUSINESS,
-                        QueryStatus.SUCCESS, procTime);
-                ValidatePublish.unsupportedAPICall();
-                return null;
+                EntityManager em = PersistenceManager.getEntityManager();
+                EntityTransaction tx = em.getTransaction();
+                try {
+                        tx.begin();
+                        UddiEntityPublisher requestor = this.getEntityPublisher(em, authInfo);
+                        if (!((Publisher) requestor).isAdmin()) {
+                                throw new UserMismatchException(new ErrorMessage("errors.AdminReqd"));
+                        }
+                               
+                        for (int i = 0; i < values.size(); i++) {
+                                //impersonate the user
+                                AuthToken authToken = sec.getAuthToken(values.get(i).getPublisherID());
+               
+                                SaveBusiness stm = new SaveBusiness();
+                                
+                                stm.setAuthInfo(authToken.getAuthInfo());
+                                stm.getBusinessEntity().addAll(values.get(i).getBusinessEntity());
+                                pub.saveBusiness(stm);
+                        }
+
+                        
+                        tx.commit();
+                        long procTime = System.currentTimeMillis() - startTime;
+                        serviceCounter.update(JUDDIQuery.ADMIN_SAVE_BUSINESS,
+                                QueryStatus.SUCCESS, procTime);
+                } catch (DispositionReportFaultMessage drfm) {
+                        long procTime = System.currentTimeMillis() - startTime;
+                        serviceCounter.update(JUDDIQuery.ADMIN_SAVE_BUSINESS,
+                                QueryStatus.FAILED, procTime);
+                        throw drfm;
+
+                } finally {
+                        if (tx.isActive()) {
+                                tx.rollback();
+                        }
+                        em.close();
+                }
+
+                DispositionReport r = new DispositionReport();
+                return r;
+            
         }
 
         @Override
@@ -1188,6 +1241,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
                         if (!((Publisher) requestor).isAdmin()) {
                                 throw new UserMismatchException(new ErrorMessage("errors.AdminReqd"));
                         }
+                        
                         for (int i = 0; i < values.size(); i++) {
                                 //impersonate the user
                                 AuthToken authToken = sec.getAuthToken(values.get(i).getPublisherID());
@@ -1379,6 +1433,9 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
                         throw drfm;
                 } catch (Exception ex) {
                         //possible that there is no config to return
+                         logger.warn("Error caught, is there a replication config is avaiable? Returning a default config (no replication): " + ex.getMessage());
+                        logger.debug("Error caught, is there a replication config is avaiable? Returning a default config (no replication): ", ex);
+                      
                         r.setCommunicationGraph(new CommunicationGraph());
                         Operator op = new Operator();
                         op.setOperatorNodeID(node);
@@ -1392,17 +1449,37 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
                         r.getOperator().add(op);
                         r.getCommunicationGraph().getNode().add(node);
                         r.getCommunicationGraph().getControlledMessage().add("*");
-                        logger.warn("Error caught, is there a replication config is avaiable? Returning a default config (no replication): " + ex.getMessage());
-                        logger.debug("Error caught, is there a replication config is avaiable? Returning a default config (no replication): ", ex);
-                        long procTime = System.currentTimeMillis() - startTime;
+                         long procTime = System.currentTimeMillis() - startTime;
                         r.setSerialNumber(0);
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddkkmmZ");
                         r.setTimeOfConfigurationUpdate(sdf.format(new Date()));
                         r.setRegistryContact(new org.uddi.repl_v3.ReplicationConfiguration.RegistryContact());
-                        //TODO pull from root business
-                        r.getRegistryContact().setContact(new Contact());
-                        r.getRegistryContact().getContact().getPersonName().add(new PersonName("Unknown", null));
+                        try {
+                                // pull from root business
+                                if (!tx.isActive()) {
+                                        tx = em.getTransaction();
+                                }
+
+                                BusinessEntity rootbiz = em.find(BusinessEntity.class, AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ROOT_BUSINESS));
+                                if (rootbiz != null) {
+                                        
+                                        for (int i = 0; i < rootbiz.getContacts().size(); i++) {
+                                                Contact c = new Contact();
+                                                MappingModelToApi.mapContact(rootbiz.getContacts().get(i), c);
+                                                r.getRegistryContact().setContact(c);
+                                                break;
+                                        }
+
+                                }
+                                tx.rollback();
 
+                        } catch (Exception ex1) {
+                                logger.warn("unexpected error", ex1);
+                        }
+                        if (r.getRegistryContact().getContact()==null){
+                                r.getRegistryContact().setContact(new Contact());
+                                r.getRegistryContact().getContact().getPersonName().add(new PersonName("Unknown", null));
+                        }
                         serviceCounter.update(JUDDIQuery.GET_REPLICATION_NODES,
                                 QueryStatus.FAILED, procTime);
 
@@ -1415,7 +1492,7 @@ public class JUDDIApiImpl extends AuthenticatedService implements JUDDIApiPortTy
 
                 r.setMaximumTimeToGetChanges(BigInteger.ONE);
                 r.setMaximumTimeToSyncRegistry(BigInteger.ONE);
-                JAXB.marshal(r, System.out);
+               // JAXB.marshal(r, System.out);
                 return r;
         }
 

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java b/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
index 481df3d..b100f05 100644
--- a/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
+++ b/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
@@ -435,6 +435,21 @@ public class MappingModelToApi {
                 }
                 apiBusinessEntity.setDiscoveryURLs(apiDiscUrls);
         }
+        
+        public static void mapContact(org.apache.juddi.model.Contact modelContact,
+                org.uddi.api_v3.Contact apiContact) throws DispositionReportFaultMessage {
+                if (apiContact == null) {
+                        apiContact = new org.uddi.api_v3.Contact();
+                }
+                apiContact.setUseType(modelContact.getUseType());
+
+                mapPersonNames(modelContact.getPersonNames(), apiContact.getPersonName());
+                mapContactDescriptions(modelContact.getContactDescrs(), apiContact.getDescription());
+                mapContactEmails(modelContact.getEmails(), apiContact.getEmail());
+                mapContactPhones(modelContact.getPhones(), apiContact.getPhone());
+                mapContactAddresses(modelContact.getAddresses(), apiContact.getAddress());
+
+        }
 
         public static void mapContacts(List<org.apache.juddi.model.Contact> modelContactList,
              org.uddi.api_v3.Contacts apiContacts,
@@ -453,14 +468,9 @@ public class MappingModelToApi {
 
                 for (org.apache.juddi.model.Contact modelContact : modelContactList) {
                         org.uddi.api_v3.Contact apiContact = new org.uddi.api_v3.Contact();
-                        apiContact.setUseType(modelContact.getUseType());
-
-                        mapPersonNames(modelContact.getPersonNames(), apiContact.getPersonName());
-                        mapContactDescriptions(modelContact.getContactDescrs(), apiContact.getDescription());
-                        mapContactEmails(modelContact.getEmails(), apiContact.getEmail());
-                        mapContactPhones(modelContact.getPhones(), apiContact.getPhone());
-                        mapContactAddresses(modelContact.getAddresses(), apiContact.getAddress());
-
+                        
+                        mapContact(modelContact,apiContact);
+                      
                         apiContactList.add(apiContact);
                 }
                 apiBusinessEntity.setContacts(apiContacts);

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java b/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java
index ce1d49c..794e1b5 100644
--- a/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java
+++ b/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java
@@ -82,6 +82,8 @@ public class BusinessEntity extends UddiEntity implements java.io.Serializable {
 	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "businessEntity")
 	@OrderBy
 	public List<Contact> getContacts() {
+                if (this.contacts==null)
+                        this.contacts = new ArrayList<Contact>();
 		return this.contacts;
 	}
 	public void setContacts(List<Contact> contacts) {

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddi-core/src/main/resources/messages.properties
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/resources/messages.properties b/juddi-core/src/main/resources/messages.properties
index fe79f62..3428580 100644
--- a/juddi-core/src/main/resources/messages.properties
+++ b/juddi-core/src/main/resources/messages.properties
@@ -226,7 +226,7 @@ errors.save.maxBusinessesExceeded=The maximum allowed number of businesses are e
 errors.save.maxServicesExceeded=The maximum allowed number of services are exceed for this business
 errors.save.maxBindingsExceeded=The maximum allowed number of bindings are exceed for this service
 errors.save.maxTModelsExceeded=The maximum allowed number of tmodels are exceed for this publisher
-errors.deletepublisher.AdminReqd=An account must have administrative privileges to delete publishers
+errors.deletepublisher.AdminReqd=An account must have administrative privileges to perform this action
 errors.publisher.NullInput=The Publisher structure cannot be blank
 errors.publisher.NoAuthorizedName=A valid publisher authorized name was not specified
 errors.publisher.NoPublisherName=A valid publisher name was not specified

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddi-core/src/test/java/org/apache/juddi/api/impl/API_110_FindBusinessTest.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/test/java/org/apache/juddi/api/impl/API_110_FindBusinessTest.java b/juddi-core/src/test/java/org/apache/juddi/api/impl/API_110_FindBusinessTest.java
index 3fc49d7..e2a5497 100644
--- a/juddi-core/src/test/java/org/apache/juddi/api/impl/API_110_FindBusinessTest.java
+++ b/juddi-core/src/test/java/org/apache/juddi/api/impl/API_110_FindBusinessTest.java
@@ -87,7 +87,10 @@ public class API_110_FindBusinessTest
 				Assert.fail("Could not obtain authInfo token.");
 	     } 
 	}
-	
+	/**
+         * JUDDI-398
+         * JUDDI-881
+         */
 	@Test
 	public void findBusinessByTModelBag() {
 		try {

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddi-gui/src/main/webapp/csrf.jsp
----------------------------------------------------------------------
diff --git a/juddi-gui/src/main/webapp/csrf.jsp b/juddi-gui/src/main/webapp/csrf.jsp
index 7fcab9e..0ae7f88 100644
--- a/juddi-gui/src/main/webapp/csrf.jsp
+++ b/juddi-gui/src/main/webapp/csrf.jsp
@@ -32,7 +32,10 @@
             session.removeAttribute("nonce");
             response.sendRedirect("index.jsp");
             UddiHub.log.warn( "CSRF Test failed, no nonce guid." + request.getRemoteAddr() + request.getRemoteUser());
-            throw new CrossSiteRequestForgeryException();
+            //throw new CrossSiteRequestForgeryException();
+             response.sendRedirect("index.jsp");
+                
+                return;
         } else {
 
             String noncestr = (String) session.getAttribute("nonce");
@@ -40,7 +43,10 @@
                 //no session variable to test against, reject it
                 UddiHub.log.warn( "CSRF Test failed, no session guid." + request.getRemoteAddr() + request.getRemoteUser());
                 session.removeAttribute("nonce");
-                throw new CrossSiteRequestForgeryException("Cross Site Request Forgery");
+                response.sendRedirect("index.jsp");
+                
+                return;
+                //throw new CrossSiteRequestForgeryException("Cross Site Request Forgery");
             }
             String postedstr = request.getParameter("nonce");
 
@@ -58,7 +64,9 @@
                 //mismatch, reject it
                 UddiHub.log.warn( "CSRF Test failed, session did not match nonce guid." + request.getRemoteAddr() + request.getRemoteUser());
                 session.removeAttribute("nonce");
-                throw new CrossSiteRequestForgeryException("Cross Site Request Forgery");
+                response.sendRedirect("index.jsp");
+                return;
+                //throw new CrossSiteRequestForgeryException("Cross Site Request Forgery");
             }
         }
     } else {

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/JUDDIRequestsAsXML.java
----------------------------------------------------------------------
diff --git a/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/JUDDIRequestsAsXML.java b/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/JUDDIRequestsAsXML.java
new file mode 100644
index 0000000..997e204
--- /dev/null
+++ b/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/JUDDIRequestsAsXML.java
@@ -0,0 +1,203 @@
+/*
+ * 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.adminconsole.hub;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.GregorianCalendar;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.bind.JAXB;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.api_v3.AdminSaveBusiness;
+import org.apache.juddi.api_v3.AdminSaveBusinessWrapper;
+import org.apache.juddi.api_v3.AdminSaveSubscriptionRequest;
+import org.apache.juddi.api_v3.AdminSaveTModel;
+import org.apache.juddi.api_v3.AdminSaveTModelWrapper;
+import org.apache.juddi.api_v3.Clerk;
+import org.apache.juddi.api_v3.ClientSubscriptionInfo;
+import org.apache.juddi.api_v3.SaveClientSubscriptionInfo;
+import org.apache.juddi.api_v3.SyncSubscription;
+import org.apache.juddi.config.AppConfig;
+import org.apache.juddi.config.Property;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.Contact;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.PersonName;
+import org.uddi.api_v3.TModel;
+import org.uddi.repl_v3.CommunicationGraph;
+import org.uddi.repl_v3.Operator;
+import org.uddi.repl_v3.OperatorStatusType;
+import org.uddi.repl_v3.ReplicationConfiguration;
+import org.uddi.sub_v3.CoveragePeriod;
+import org.uddi.sub_v3.GetSubscriptionResults;
+import org.uddi.sub_v3.Subscription;
+import org.uddi.sub_v3.SubscriptionFilter;
+
+/**
+ * This class generates XML as String objects for UDDI requests. This is used
+ * from the "advanced" web pages
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class JUDDIRequestsAsXML {
+
+        private static String PrettyPrintXML(String input) {
+                if (input == null || input.length() == 0) {
+                        return "";
+                }
+                try {
+                        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+                        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+                        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+                        //initialize StreamResult with File object to save to file
+                        StreamResult result = new StreamResult(new StringWriter());
+                        StreamSource source = new StreamSource(new StringReader(input.trim()));
+                        transformer.transform(source, result);
+                        String xmlString = result.getWriter().toString();
+                        return (xmlString);
+                } catch (Exception ex) {
+                }
+                return null;
+        }
+
+        public static String getSampleXML(String method) {
+                StringWriter sw = new StringWriter();
+
+                if (method.equalsIgnoreCase("save_ClientSubscriptionInfo")) {
+                        SaveClientSubscriptionInfo obj = new SaveClientSubscriptionInfo();
+                        obj.getClientSubscriptionInfo().add(new ClientSubscriptionInfo());
+                        obj.getClientSubscriptionInfo().get(0).setFromClerk(new Clerk());
+                        obj.getClientSubscriptionInfo().get(0).setToClerk(new Clerk());
+                        obj.getClientSubscriptionInfo().get(0).setSubscriptionKey("key");
+
+                        JAXB.marshal(obj, sw);
+                }
+                if (method.equalsIgnoreCase("invoke_SyncSubscription")) {
+                        SyncSubscription obj = new SyncSubscription();
+                        obj.getGetSubscriptionResultsList().add(new GetSubscriptionResults());
+                        obj.getGetSubscriptionResultsList().get(0).setSubscriptionKey("key");
+                        obj.getGetSubscriptionResultsList().get(0).setCoveragePeriod(new CoveragePeriod());
+                        DatatypeFactory newInstance;
+                        try {
+                                newInstance = DatatypeFactory.newInstance();
+                                obj.getGetSubscriptionResultsList().get(0).getCoveragePeriod().setEndPoint(newInstance.newXMLGregorianCalendar(new GregorianCalendar()));
+                                obj.getGetSubscriptionResultsList().get(0).getCoveragePeriod().setStartPoint(newInstance.newXMLGregorianCalendar(new GregorianCalendar()));
+
+                        } catch (DatatypeConfigurationException ex) {
+                                Logger.getLogger(JUDDIRequestsAsXML.class.getName()).log(Level.SEVERE, null, ex);
+                        }
+                        JAXB.marshal(obj, sw);
+                }
+                if (method.equalsIgnoreCase("admin_SaveBusiness")) {
+                        AdminSaveBusiness obj = new AdminSaveBusiness();
+                        obj.getValues().add(new AdminSaveBusinessWrapper());
+                        obj.getValues().get(0).setPublisherID("username");
+                        obj.getValues().get(0).getBusinessEntity().add(new BusinessEntity());
+                        obj.getValues().get(0).getBusinessEntity().get(0).getName().add(new Name("Business Name", "en"));
+                        JAXB.marshal(obj, sw);
+                }
+                if (method.equalsIgnoreCase("admin_SaveTModel")) {
+                        AdminSaveTModel obj = new AdminSaveTModel();
+                        obj.getValues().add(new AdminSaveTModelWrapper());
+                        obj.getValues().get(0).setPublisherID("username");
+                        obj.getValues().get(0).getTModel().add(new TModel());
+                        obj.getValues().get(0).getTModel().get(0).setName(new Name("TModel Name", "en"));
+                        JAXB.marshal(obj, sw);
+                }
+
+                if (method.equalsIgnoreCase("admin_SaveSubscription")) {
+                        AdminSaveSubscriptionRequest obj = new AdminSaveSubscriptionRequest();
+                        obj.setPublisherOrUsername("username");
+                        obj.getSubscriptions().add(new Subscription());
+                        obj.getSubscriptions().get(0).setSubscriptionFilter(new SubscriptionFilter());
+                        obj.getSubscriptions().get(0).setBrief(Boolean.TRUE);
+                        obj.getSubscriptions().get(0).getSubscriptionFilter().setFindBusiness(new FindBusiness());
+                        //obj.getSubscriptions().get(0).getSubscriptionFilter().getFindBusiness()
+                        JAXB.marshal(obj, sw);
+                }
+
+                if (method.equalsIgnoreCase("set_ReplicationNodes")) {
+                        ReplicationConfiguration replicationConfiguration = new ReplicationConfiguration();
+                        replicationConfiguration.setCommunicationGraph(new CommunicationGraph());
+                        String thisnode = "NODEID";
+                        try {
+                                thisnode = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID);
+                        } catch (ConfigurationException ex) {
+                                Logger.getLogger(JUDDIRequestsAsXML.class.getName()).log(Level.SEVERE, null, ex);
+                        }
+
+                        replicationConfiguration.getCommunicationGraph().getNode().add(thisnode);
+                        Operator op = new Operator();
+                        op.setOperatorNodeID(thisnode);
+
+                        op.setOperatorStatus(OperatorStatusType.NORMAL);
+                        String url = "http://localhost:8080/juddiv3/services/replication";
+                        try {
+                                url = AppConfig.getConfiguration().getString(Property.DEFAULT_BASE_URL_SECURE) + "/services/replication";
+                        } catch (ConfigurationException ex) {
+                                Logger.getLogger(JUDDIRequestsAsXML.class.getName()).log(Level.SEVERE, null, ex);
+                        }
+                        op.setSoapReplicationURL(url);
+
+                        replicationConfiguration.getOperator().add(op);
+                        replicationConfiguration.setRegistryContact(new ReplicationConfiguration.RegistryContact());
+                        replicationConfiguration.getRegistryContact().setContact(new Contact());
+                        replicationConfiguration.getRegistryContact().getContact().getPersonName().add(new PersonName("UNKNOWN", "en"));
+
+                        JAXB.marshal(replicationConfiguration, sw);
+                }
+
+                return PrettyPrintXML(sw.toString());
+        }
+
+        public static Object getObjectJuddi(String method, String content) {
+                StringReader sr = new StringReader(content);
+
+                if (method.equalsIgnoreCase("save_ClientSubscriptionInfo")) {
+                        return JAXB.unmarshal(sr, SaveClientSubscriptionInfo.class);
+                }
+                if (method.equalsIgnoreCase("invoke_SyncSubscription")) {
+                        return JAXB.unmarshal(sr, SyncSubscription.class);
+                }
+                if (method.equalsIgnoreCase("admin_SaveBusiness")) {
+                        return JAXB.unmarshal(sr, AdminSaveBusiness.class);
+                }
+                if (method.equalsIgnoreCase("admin_SaveTModel")) {
+                        //System.out.println(content);
+                        return JAXB.unmarshal(sr, AdminSaveTModel.class);
+                }
+
+                if (method.equalsIgnoreCase("admin_SaveSubscription")) {
+                        return JAXB.unmarshal(sr, AdminSaveSubscriptionRequest.class);
+                }
+
+                if (method.equalsIgnoreCase("set_ReplicationNodes")) {
+                        return JAXB.unmarshal(sr, ReplicationConfiguration.class);
+                }
+
+                return null;
+        }
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/UddiAdminHub.java
----------------------------------------------------------------------
diff --git a/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/UddiAdminHub.java b/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/UddiAdminHub.java
index b764e77..e21027b 100644
--- a/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/UddiAdminHub.java
+++ b/juddiv3-war/src/main/java/org/apache/juddi/adminconsole/hub/UddiAdminHub.java
@@ -21,6 +21,8 @@ import java.io.StringReader;
 import java.io.StringWriter;
 import java.net.URL;
 import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import javax.servlet.ServletContext;
@@ -34,6 +36,7 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Holder;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.logging.Log;
@@ -61,7 +64,15 @@ import org.apache.juddi.v3.client.transport.Transport;
 import org.apache.juddi.v3_service.JUDDIApiPortType;
 import org.apache.juddi.adminconsole.AES;
 import org.apache.juddi.adminconsole.resources.ResourceLoader;
+import org.apache.juddi.api_v3.AdminSaveBusiness;
+import org.apache.juddi.api_v3.AdminSaveSubscriptionRequest;
+import org.apache.juddi.api_v3.AdminSaveTModel;
+import org.apache.juddi.api_v3.ClerkList;
 import org.apache.juddi.api_v3.ClientSubscriptionInfo;
+import org.apache.juddi.api_v3.DeleteClerk;
+import org.apache.juddi.api_v3.DeleteNode;
+import org.apache.juddi.api_v3.NodeList;
+import org.apache.juddi.api_v3.SubscriptionWrapper;
 import org.apache.juddi.model.BindingTemplate;
 import org.apache.juddi.subscription.notify.SMTPNotifier;
 import org.uddi.api_v3.AuthToken;
@@ -72,6 +83,7 @@ import org.uddi.api_v3.FindBusiness;
 import org.uddi.api_v3.FindQualifiers;
 import org.uddi.api_v3.GetAuthToken;
 import org.uddi.api_v3.Name;
+import org.uddi.repl_v3.ReplicationConfiguration;
 import org.uddi.sub_v3.Subscription;
 import org.uddi.sub_v3.SubscriptionResultsList;
 import org.uddi.subr_v3.NotifySubscriptionListener;
@@ -350,28 +362,39 @@ public class UddiAdminHub {
                         if (action.equalsIgnoreCase("send_EmailTest")) {
                                 return sendTestEmail(parameters);
                         }
-                        /*if (action.equalsIgnoreCase("get_AllNodes")) {
+                        if (action.equalsIgnoreCase("get_AllNodes")) {
+                                return getAllNodes(parameters);
                         }
                         if (action.equalsIgnoreCase("get_AllClerks")) {
+                                return getAllClerks(parameters);
                         }
                         if (action.equalsIgnoreCase("delete_Node")) {
+                                return deleteNode(parameters);
                         }
                         if (action.equalsIgnoreCase("delete_Clerk")) {
+                                return deleteClerk(parameters);
                         }
                         if (action.equalsIgnoreCase("admin_DeleteSubscription")) {
+                                return deleteSubscription(parameters);
                         }
                         if (action.equalsIgnoreCase("admin_SaveBusiness")) {
+                                return adminSaveBusiness(parameters);
                         }
                         if (action.equalsIgnoreCase("admin_SaveTModel")) {
+                                return adminSaveTmodel(parameters);
                         }
                         if (action.equalsIgnoreCase("get_AllClientSubscriptionInfo")) {
+                                return getAllClientSubscriptionInfo(parameters);
                         }
                         if (action.equalsIgnoreCase("set_ReplicationNodes")) {
+                                return setReplicationConfig(parameters);
                         }
                         if (action.equalsIgnoreCase("get_ReplicationNodes")) {
+                                return getReplicationNodes(parameters);
                         }
                         if (action.equalsIgnoreCase("admin_SaveSubscription")) {
-                        }*/
+                                return adminSaveSubscription(parameters);
+                        }
                 } catch (Exception ex) {
                         return "Error!" + HandleException(ex);
                 }
@@ -465,14 +488,15 @@ public class UddiAdminHub {
 
         private String sendTestEmail(HttpServletRequest parameters) {
                 try {
-                        
+
                         String to = parameters.getParameter("send_EmailTestEMAIL");
-                        if (!to.startsWith("mailto:"))
+                        if (!to.startsWith("mailto:")) {
                                 to = "mailto:" + to;
+                        }
                         BindingTemplate modellbt = new BindingTemplate("test", null, "endpoint", to, null, null, null, null, null);
                         org.apache.juddi.subscription.notify.SMTPNotifier smtp = new SMTPNotifier(modellbt);
                         NotifySubscriptionListener body = new NotifySubscriptionListener();
-                        
+
                         body.setSubscriptionResultsList(new SubscriptionResultsList());
                         body.getSubscriptionResultsList().setSubscription(new Subscription());
                         body.getSubscriptionResultsList().getSubscription().setSubscriptionKey("TEST");
@@ -483,6 +507,272 @@ public class UddiAdminHub {
                 }
         }
 
+        private String getAllNodes(HttpServletRequest parameters) {
+                NodeList allNodes = null;
+                try {
+
+                        allNodes = juddi.getAllNodes(GetToken());
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        allNodes = juddi.getAllNodes(GetToken());
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(allNodes, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
+        private String getAllClerks(HttpServletRequest parameters) {
+                ClerkList allNodes = null;
+                try {
+
+                        allNodes = juddi.getAllClerks(GetToken());
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        allNodes = juddi.getAllClerks(GetToken());
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(allNodes, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
+        private String getAllClientSubscriptionInfo(HttpServletRequest parameters) {
+                List<SubscriptionWrapper> allClientSubscriptionInfo = null;
+                try {
+
+                        allClientSubscriptionInfo = juddi.getAllClientSubscriptionInfo(GetToken());
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        allClientSubscriptionInfo = juddi.getAllClientSubscriptionInfo(GetToken());
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(allClientSubscriptionInfo, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
+        private String getReplicationNodes(HttpServletRequest parameters) {
+                ReplicationConfiguration cfg = null;
+                try {
+
+                        cfg = juddi.getReplicationNodes(GetToken());
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        cfg = juddi.getReplicationNodes(GetToken());
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(cfg, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
+        private String deleteNode(HttpServletRequest parameters) {
+                DeleteNode cfg = new DeleteNode();
+                cfg.setAuthInfo(GetToken());
+                cfg.setNodeID(parameters.getParameter("delete_NodeName"));
+                try {
+
+                        juddi.deleteNode(cfg);
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        cfg.setAuthInfo(GetToken());
+                                        juddi.deleteNode(cfg);
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+
+                return "Success";
+        }
+
+        private String deleteSubscription(HttpServletRequest parameters) {
+                List<String> keys = new ArrayList<String>();
+                keys.add(parameters.getParameter("admin_DeleteSubscriptionKey"));
+                try {
+
+                        juddi.adminDeleteSubscription(GetToken(), keys);
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        juddi.adminDeleteSubscription(GetToken(), keys);
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+
+                return "Success";
+        }
+
+        private String deleteClerk(HttpServletRequest parameters) {
+                DeleteClerk cfg = new DeleteClerk();
+                cfg.setAuthInfo(GetToken());
+                cfg.setClerkID(parameters.getParameter("delete_ClerkName"));
+                try {
+
+                        juddi.deleteClerk(cfg);
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        cfg.setAuthInfo(GetToken());
+                                        juddi.deleteClerk(cfg);
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+
+                return "Success";
+        }
+
+        private String setReplicationConfig(HttpServletRequest parameters) {
+                ReplicationConfiguration cfg = (ReplicationConfiguration) JUDDIRequestsAsXML.getObjectJuddi("set_ReplicationNodes", parameters.getParameter("set_ReplicationNodesXML"));
+                DispositionReport setReplicationNodes = null;
+                try {
+
+                        setReplicationNodes = juddi.setReplicationNodes(GetToken(), cfg);
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        setReplicationNodes = juddi.setReplicationNodes(GetToken(), cfg);
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(setReplicationNodes, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
+        private String adminSaveBusiness(HttpServletRequest parameters) {
+                //admin_SaveBusiness
+                AdminSaveBusiness cfg = (AdminSaveBusiness) JUDDIRequestsAsXML.getObjectJuddi("admin_SaveBusiness", parameters.getParameter("admin_SaveBusinessXML"));
+                DispositionReport setReplicationNodes = null;
+                try {
+
+                        setReplicationNodes = juddi.adminSaveBusiness(GetToken(), cfg.getValues());
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        setReplicationNodes = juddi.adminSaveBusiness(GetToken(), cfg.getValues());
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(setReplicationNodes, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
+        private String adminSaveTmodel(HttpServletRequest parameters) {
+                //admin_SaveTModel
+                AdminSaveTModel cfg = (AdminSaveTModel) JUDDIRequestsAsXML.getObjectJuddi("admin_SaveTModel", parameters.getParameter("admin_SaveTModelXML"));
+                //JAXB.marshal(cfg, System.out);
+                DispositionReport setReplicationNodes = null;
+                try {
+
+                        setReplicationNodes = juddi.adminSaveTModel(GetToken(), cfg.getValues());
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        setReplicationNodes = juddi.adminSaveTModel(GetToken(), cfg.getValues());
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(setReplicationNodes, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
+        private String adminSaveSubscription(HttpServletRequest parameters) {
+                //
+                AdminSaveSubscriptionRequest cfg = (AdminSaveSubscriptionRequest) JUDDIRequestsAsXML.getObjectJuddi("admin_SaveSubscription", parameters.getParameter("admin_SaveSubscriptionXML"));
+
+                Holder<List<Subscription>> holder = new Holder<List<Subscription>>(cfg.getSubscriptions());
+                try {
+
+                        juddi.adminSaveSubscription(GetToken(), cfg.getPublisherOrUsername(), holder);
+                } catch (Exception ex) {
+
+                        if (isExceptionExpiration(ex)) {
+                                token = null;
+                                try {
+                                        juddi.adminSaveSubscription(GetToken(), cfg.getPublisherOrUsername(), holder);
+                                } catch (Exception ex1) {
+                                        return HandleException(ex1);
+                                }
+                        } else {
+                                return HandleException(ex);
+                        }
+                }
+                StringWriter sw = new StringWriter();
+                JAXB.marshal(holder, sw);
+                return StringEscapeUtils.escapeHtml(sw.toString());
+        }
+
         public enum AuthStyle {
 
                 /**
@@ -564,7 +854,7 @@ public class UddiAdminHub {
                                 try {
                                         d = juddi.getAllPublisherDetail(sb);
                                 } catch (Exception ex1) {
-                                        return HandleException(ex);
+                                        return HandleException(ex1);
                                 }
 
                         } else {
@@ -632,7 +922,7 @@ public class UddiAdminHub {
                                 try {
                                         d = juddi.getPublisherDetail(sb);
                                 } catch (Exception ex1) {
-                                        return HandleException(ex);
+                                        return HandleException(ex1);
                                 }
 
                         } else {
@@ -671,7 +961,7 @@ public class UddiAdminHub {
                                 try {
                                         d = juddi.invokeSyncSubscription(sb);
                                 } catch (Exception ex1) {
-                                        return HandleException(ex);
+                                        return HandleException(ex1);
                                 }
 
                         } else {
@@ -770,7 +1060,7 @@ public class UddiAdminHub {
                                         try {
                                                 d = juddi.saveClientSubscriptionInfo(sb);
                                         } catch (Exception ex1) {
-                                                return HandleException(ex);
+                                                return HandleException(ex1);
                                         }
                                 }
                         } else {
@@ -880,7 +1170,7 @@ public class UddiAdminHub {
                                 try {
                                         d = juddi.savePublisher(sb);
                                 } catch (Exception ex1) {
-                                        return HandleException(ex);
+                                        return HandleException(ex1);
                                 }
                         } else {
                                 return HandleException(ex);
@@ -902,7 +1192,7 @@ public class UddiAdminHub {
                                 try {
                                         juddi.adminDeleteTModel(sb);
                                 } catch (Exception ex1) {
-                                        return HandleException(ex);
+                                        return HandleException(ex1);
                                 }
                         } else {
                                 return HandleException(ex);
@@ -924,7 +1214,7 @@ public class UddiAdminHub {
                                 try {
                                         juddi.deleteClientSubscriptionInfo(sb);
                                 } catch (Exception ex1) {
-                                        return HandleException(ex);
+                                        return HandleException(ex1);
                                 }
 
                         } else {
@@ -1015,4 +1305,146 @@ public class UddiAdminHub {
                 return "Unexpected error";
         }
 
+        public String SendAdvanced(Object request, String method) {
+                StringWriter sw = new StringWriter();
+                try {
+                        if (method.equalsIgnoreCase("save_ClientSubscriptionInfo")) {
+                                SaveClientSubscriptionInfo x = (SaveClientSubscriptionInfo) request;
+                                x.setAuthInfo(GetToken());
+                                ClientSubscriptionInfoDetail saveClientSubscriptionInfo = null;
+                                try {
+                                        saveClientSubscriptionInfo = juddi.saveClientSubscriptionInfo(x);
+                                        sw.append("Success:<br>");
+                                        JAXB.marshal(saveClientSubscriptionInfo, sw);
+                                } catch (Exception ex) {
+                                        if (isExceptionExpiration(ex)) {
+                                                token = null;
+                                                x.setAuthInfo(GetToken());
+                                                saveClientSubscriptionInfo = juddi.saveClientSubscriptionInfo(x);
+                                                sw.append("Success:<br>");
+                                                JAXB.marshal(saveClientSubscriptionInfo, sw);
+
+                                        } else {
+                                                throw ex;
+                                        }
+                                }
+
+                        }
+                        if (method.equalsIgnoreCase("invoke_SyncSubscription")) {
+                                SyncSubscription x = (SyncSubscription) request;
+                                x.setAuthInfo(GetToken());
+                                SyncSubscriptionDetail invokeSyncSubscription = null;
+                                try {
+                                        invokeSyncSubscription = juddi.invokeSyncSubscription(x);
+                                        sw.append("Success:<br>");
+                                        JAXB.marshal(invokeSyncSubscription, sw);
+                                } catch (Exception ex) {
+                                        if (isExceptionExpiration(ex)) {
+                                                token = null;
+                                                x.setAuthInfo(GetToken());
+                                                invokeSyncSubscription = juddi.invokeSyncSubscription(x);
+                                                sw.append("Success:<br>");
+                                                JAXB.marshal(invokeSyncSubscription, sw);
+
+                                        } else {
+                                                throw ex;
+                                        }
+                                }
+
+                        }
+                        if (method.equalsIgnoreCase("admin_SaveBusiness")) {
+                                AdminSaveBusiness x = (AdminSaveBusiness) request;
+
+                                DispositionReport adminSaveBusiness = null;
+
+                                try {
+                                        adminSaveBusiness = juddi.adminSaveBusiness(GetToken(), x.getValues());
+                                        sw.append("Success:<br>");
+                                        JAXB.marshal(adminSaveBusiness, sw);
+
+                                } catch (Exception ex) {
+                                        if (isExceptionExpiration(ex)) {
+                                                token = null;
+                                                x.setAuthInfo(GetToken());
+                                                adminSaveBusiness = juddi.adminSaveBusiness(GetToken(), x.getValues());
+                                                sw.append("Success:<br>");
+                                                JAXB.marshal(adminSaveBusiness, sw);
+
+                                        } else {
+                                                throw ex;
+                                        }
+                                }
+                        }
+                        if (method.equalsIgnoreCase("admin_SaveTModel")) {
+                                AdminSaveTModel x = (AdminSaveTModel) request;
+
+                                DispositionReport adminSaveTModel = null;
+                                try {
+                                        adminSaveTModel = juddi.adminSaveTModel(GetToken(), x.getValues());
+                                        sw.append("Success:<br>");
+                                        JAXB.marshal(adminSaveTModel, sw);
+
+                                } catch (Exception ex) {
+                                        if (isExceptionExpiration(ex)) {
+                                                token = null;
+                                                x.setAuthInfo(GetToken());
+                                                adminSaveTModel = juddi.adminSaveTModel(GetToken(), x.getValues());
+                                                sw.append("Success:<br>");
+                                                JAXB.marshal(adminSaveTModel, sw);
+
+                                        } else {
+                                                throw ex;
+                                        }
+                                }
+
+                        }
+
+                        if (method.equalsIgnoreCase("admin_SaveSubscription")) {
+                                AdminSaveSubscriptionRequest x = (AdminSaveSubscriptionRequest) request;
+                                Holder<List<Subscription>> holder = new Holder<List<Subscription>>(x.getSubscriptions());
+                                try {
+                                        juddi.adminSaveSubscription(GetToken(), x.getPublisherOrUsername(), holder);
+                                        sw.append("Success:<br>");
+                                        JAXB.marshal(holder, sw);
+                                } catch (Exception ex) {
+                                        if (isExceptionExpiration(ex)) {
+                                                token = null;
+
+                                                juddi.adminSaveSubscription(GetToken(), x.getPublisherOrUsername(), holder);
+                                                sw.append("Success:<br>");
+                                                JAXB.marshal(holder, sw);
+
+                                        } else {
+                                                throw ex;
+                                        }
+                                }
+                        }
+                        if (method.equalsIgnoreCase("set_ReplicationNodes")) {
+                                ReplicationConfiguration x = (ReplicationConfiguration) request;
+                                //    Holder<List<Subscription>> holder = new Holder<List<Subscription>>(x.getSubscriptions());
+                                try {
+                                        DispositionReport setReplicationNodes = juddi.setReplicationNodes(GetToken(), x);
+                                        sw.append("Success:<br>");
+                                        JAXB.marshal(setReplicationNodes, sw);
+                                } catch (Exception ex) {
+                                        if (isExceptionExpiration(ex)) {
+                                                token = null;
+
+                                                DispositionReport setReplicationNodes = juddi.setReplicationNodes(GetToken(), x);
+                                                sw.append("Success:<br>");
+                                                JAXB.marshal(setReplicationNodes, sw);
+
+                                        } else {
+                                                throw ex;
+                                        }
+                                }
+                        }
+
+                } catch (Exception ex) {
+                        return HandleException(ex);
+                }
+                return null;
+
+        }
+
 }

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddiv3-war/src/main/webapp/admin/admin.jsp
----------------------------------------------------------------------
diff --git a/juddiv3-war/src/main/webapp/admin/admin.jsp b/juddiv3-war/src/main/webapp/admin/admin.jsp
index 269539b..f6cd8d6 100644
--- a/juddiv3-war/src/main/webapp/admin/admin.jsp
+++ b/juddiv3-war/src/main/webapp/admin/admin.jsp
@@ -38,29 +38,43 @@
                         <%=ResourceLoader.GetResource(session, "pages.admin.content")%>
                         <br>
                         <select onchange="toggledivs();" id="divselector">
-                                <option>adminDelete_tmodel</option>
+                                
+                                <option>------ Subscription Management -----</option>
+                                <option>get_AllClientSubscriptionInfo</option>
                                 <option>delete_ClientSubscriptionInfo</option>
-                                <option>delete_publisher</option>
-                                <option>getAllPublisherDetail</option>
-                                <option>get_publisherDetail</option>
                                 <option>invoke_SyncSubscription</option>
-                                <option>save_Clerk</option>
                                 <option>save_ClientSubscriptionInfo</option>
-                                <option>save_Node</option>
-                                <option>save_publisher</option>
                                 
-                                <option>send_EmailTest</option>
+                                <option>admin_SaveSubscription</option>
+                                <option>admin_DeleteSubscription</option>
+                                
                                 <option>get_AllNodes</option>
-                                <option>get_AllClerks</option>
+                                <option>save_Node</option>
                                 <option>delete_Node</option>
+                                
+                                <option>get_AllClerks</option>
+                                <option>save_Clerk</option>
                                 <option>delete_Clerk</option>
-                                <option>admin_DeleteSubscription</option>
-                                <option>admin_SaveBusiness</option>
-                                <option>admin_SaveTModel</option>
-                                <option>get_AllClientSubscriptionInfo</option>
+                                
+                                <option>------ Publisher/User Management -----</option>
+                                <option>getAllPublisherDetail</option>
+                                <option>get_publisherDetail</option>
+                                <option>delete_publisher</option>
+                                <option>save_publisher</option>
+                                
+                                
+                                
+                                <option>------ Node Management -----</option>
                                 <option>set_ReplicationNodes</option>
                                 <option>get_ReplicationNodes</option>
-                                <option>admin_SaveSubscription</option>
+
+                                <option>------ Backup/Restore Management -----</option>
+                                <option>admin_SaveBusiness</option>
+                                <option>admin_SaveTModel</option>
+                                <option>adminDelete_tmodel</option>                                 
+                                <option>send_EmailTest</option>
+                               
+                                
                         </select>
 
                         <div>
@@ -149,17 +163,51 @@
                                 <div id="send_EmailTest" style="display:none">
                                 <%=ResourceLoader.GetResource(session, "items.email")%>  <input type="text" id="send_EmailTestEMAIL"  class="forminput" placeholder="Enter email"><br>    
                                 </div>
-                                <div id="get_AllNodes" style="display:none"></div>
-                                <div id="get_AllClerks" style="display:none"></div>
-                                <div id="delete_Node" style="display:none"></div>
-                                <div id="delete_Clerk" style="display:none"></div>
-                                <div id="admin_DeleteSubscription" style="display:none"></div>
-                                <div id="admin_SaveBusiness" style="display:none"></div>
-                                <div id="admin_SaveTModel" style="display:none"></div>
-                                <div id="get_AllClientSubscriptionInfo" style="display:none"></div>
-                                <div id="set_ReplicationNodes" style="display:none"></div>
-                                <div id="get_ReplicationNodes" style="display:none"></div>
-                                <div id="admin_SaveSubscription" style="display:none"></div>
+                                <div id="get_AllNodes" style="display:none">
+                                    No input required.
+                                </div>
+                                <div id="get_AllClerks" style="display:none">
+                                    No input required.
+                                </div>
+                                <div id="delete_Node" style="display:none">
+                                    Node name <input type="text" id="delete_NodeName"  class="forminput" placeholder="Node name"><br>
+                                </div>
+                                <div id="delete_Clerk" style="display:none">
+                                    Clerk name <input type="text" id="delete_ClerkName"  class="forminput" placeholder="Clerk name"><br>
+                                </div>
+                                <div id="admin_DeleteSubscription" style="display:none">
+                                   Subscription Key <input type="text" id="admin_DeleteSubscriptionKey"  class="forminput" placeholder="Subscription Key"><br>
+                                </div>
+                                <div id="admin_SaveBusiness" style="display:none">
+                                     <%=ResourceLoader.GetResource(session, "items.noauthtoken")%>  <br>
+                                        <textarea rows="4" cols="80" id="admin_SaveBusinessXML" class="forminput" placeholder="Enter save business XML"></textarea>
+
+                                </div>
+                                <div id="admin_SaveTModel" style="display:none">
+                                     <%=ResourceLoader.GetResource(session, "items.noauthtoken")%>  <br>
+                                        <textarea rows="4" cols="80" id="admin_SaveTModelXML" class="forminput" placeholder="Enter save tmodel XML"></textarea>
+
+                                </div>
+                                <div id="get_AllClientSubscriptionInfo" style="display:none">
+                                    No input required.
+                                </div>
+                                <div id="set_ReplicationNodes" style="display:none">
+                                    
+                                         <%=ResourceLoader.GetResource(session, "items.noauthtoken")%>  <br>
+                                        <textarea rows="4" cols="80" id="set_ReplicationNodesXML" class="forminput" placeholder="Enter replication config XML"></textarea>
+
+                                </div>
+                                <div id="get_ReplicationNodes" style="display:none">
+                                    No input required.
+                                </div>
+                                <div id="admin_SaveSubscription" style="display:none">
+                                    
+                                         <%=ResourceLoader.GetResource(session, "items.noauthtoken")%>  <br>
+                                        <textarea rows="4" cols="80" id="admin_SaveSubscriptionXML" class="forminput" placeholder="Enter save subscription XML"></textarea>
+
+                                </div>
+                                
+                               
 
                         </div>
                         <script type="text/javascript">
@@ -191,9 +239,58 @@
                                         $("#set_ReplicationNodes").hide();
                                         $("#get_ReplicationNodes").hide();
                                         $("#admin_SaveSubscription").hide();
-                        
+                                       
                         
                                         $("#" + x).show();
+                                        
+                                        //get a samle xml doc
+                                        
+                                       // var x = $("#" + select).val();
+                                        var url = 'ajax/advanced.jsp';
+
+                                        var postbackdata = new Array();
+
+
+                                        postbackdata.push({
+                                            name: "advancedaction",
+                                            value: "getdefaultrequest"
+                                        });
+
+                                        postbackdata.push({
+                                            name: "nonce",
+                                            value: $("#nonce").val()
+                                        });
+
+                                       
+                                        postbackdata.push({
+                                            name: "method",
+                                            value: x
+                                        });
+
+
+
+                                        var request = $.ajax({
+                                            url: url,
+                                            type: "POST",
+                                            //  data" + i18n_type + ": "html", 
+                                            cache: false,
+                                            //  processData: false,f
+                                            data: postbackdata
+                                        });
+
+
+                                        request.done(function(msg) {
+                                            window.console && console.log('postback done ' + url);
+                                            //trim it
+                                            $("#" + x + "XML").html(msg.replace(/^\s+|\s+$/g, ''));
+                                        });
+
+                                        request.fail(function(jqXHR, textStatus) {
+                                            window.console && console.log('postback failed ' + url + ' ' + jqXHR.responseText + textStatus);
+                                            //$("#adminresults").html(jqXHR.responseText + textStatus);
+
+
+                                        });
                                 }
                                 toggledivs();//run when the page loads
                                 function submitform() {
@@ -215,9 +312,9 @@
                                         $(".forminput").each(function()
                                         {
                                                 var id = $(this).attr("id");
-                                                var value = $(this).text();
+                                                var value = $(this).val();
                                                 if (value === null || value === "" || value === undefined)
-                                                        value = $(this).val();
+                                                        value=$(this).text();
                                                 postbackdata.push({
                                                         name: id,
                                                         value: value
@@ -263,7 +360,9 @@
                         <%=ResourceLoader.GetResource(session, "pages.admin.notes")%>
 
                         <br>
-                        <a href="javascript:submitform();" class="btn btn-primary"><%=ResourceLoader.GetResource(session, "actions.go")%></a>
+                        <a href="javascript:submitform();" class="btn btn-primary"><%=ResourceLoader.GetResource(session, "actions.go")%></a><br><br>
+                        <br>
+
                 </div>
         </div>
 

http://git-wip-us.apache.org/repos/asf/juddi/blob/5fb73fd3/juddiv3-war/src/main/webapp/admin/ajax/advanced.jsp
----------------------------------------------------------------------
diff --git a/juddiv3-war/src/main/webapp/admin/ajax/advanced.jsp b/juddiv3-war/src/main/webapp/admin/ajax/advanced.jsp
new file mode 100644
index 0000000..deac59a
--- /dev/null
+++ b/juddiv3-war/src/main/webapp/admin/ajax/advanced.jsp
@@ -0,0 +1,39 @@
+<%-- 
+    Document   : advanced
+    Created on : Aug 9, 2013, 4:09:06 PM
+    Author     : Alex O'Ree
+--%>
+
+<%@page import="org.apache.juddi.adminconsole.hub.JUDDIRequestsAsXML"%>
+<%@page import="org.apache.juddi.adminconsole.resources.ResourceLoader"%>
+<%@page import="org.apache.juddi.adminconsole.PostBackConstants"%>
+<%@page import="org.apache.juddi.adminconsole.hub.UddiAdminHub"%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@include  file="../csrf.jsp" %>
+<%
+    if (request.getMethod().equalsIgnoreCase("POST")) {
+        String action = request.getParameter("advancedaction");
+        if (action != null) {
+            String method = request.getParameter("method");
+            
+            UddiAdminHub x = UddiAdminHub.getInstance(application,session);
+            if (action.equalsIgnoreCase("getdefaultrequest")) {
+ 
+               
+                    out.write(JUDDIRequestsAsXML.getSampleXML(method));
+               
+            } else if (action.equalsIgnoreCase("senddata")) {
+                Object j=JUDDIRequestsAsXML.getObjectJuddi(method, request.getParameter("content"));
+                String msg=(x.SendAdvanced(j, method));
+                if (msg.contains(ResourceLoader.GetResource(session, "errors.generic")))
+                        response.setStatus(406);
+                out.write(msg);
+            }
+        }
+
+
+
+    }
+
+
+%>
\ No newline at end of file


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


Mime
View raw message