juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r821395 - in /webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets: client/ client/service/ server/service/
Date Sat, 03 Oct 2009 19:06:55 GMT
Author: kstam
Date: Sat Oct  3 19:06:54 2009
New Revision: 821395

URL: http://svn.apache.org/viewvc?rev=821395&view=rev
Log:
JUDDI-204, adding code to delete a subscription

Modified:
    webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/SubscriptionPanel.java
    webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDISubscription.java
    webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionService.java
    webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionServiceAsync.java
    webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/service/SubscriptionServiceImpl.java

Modified: webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/SubscriptionPanel.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/SubscriptionPanel.java?rev=821395&r1=821394&r2=821395&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/SubscriptionPanel.java
(original)
+++ webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/SubscriptionPanel.java
Sat Oct  3 19:06:54 2009
@@ -99,25 +99,29 @@
 		
 	}
 	
-//	protected void deleteSubscription(String token){
-//		if (subscription!=null) {
-//			juddiApiService.deletePublisher(token, publisher.getAuthorizedName(), new AsyncCallback<JUDDIApiResponse>()

-//			{
-//				public void onFailure(Throwable caught) {
-//					Window.alert("Could not connect to the UDDI registry. " + caught.getMessage());
-//				}
-//	
-//				public void onSuccess(JUDDIApiResponse response) {
-//					if (response.isSuccess()) {
-//						JUDDIPublisher.getInstance().hidePublisher();
-//					} else {
-//						Window.alert("error: " + response.getMessage() + ". Make sure the UDDI server is
up and running.");
-//					}
-//				}
-//			});
-//		}
-//	}
-//	
+	protected void deleteSubscription(){
+		if (subscription!=null) {
+			subscription.setSubscriptionKey(subscriptionKeyBox.getText());
+			subscription.setClerkName(clerkNameBox.getText());
+			
+			subscriptionServiceAsync.deleteSubscription(subscription, new AsyncCallback<SubscriptionResponse>()
+					{
+						public void onFailure(Throwable caught) {
+							Window.alert("Could not connect to the UDDI registry. " + caught.getMessage());
+						}
+			
+						public void onSuccess(SubscriptionResponse response) {
+							if (response.isSuccess()) {
+								UDDISubscription.getInstance().refreshSubscriptionTree();
+								UDDISubscription.getInstance().removeDetailPanel();
+							} else {
+								Window.alert("error: " + response.getMessage() + ". Make sure the UDDI server is
up and running.");
+							}
+						}
+					}); 
+		}
+	}
+	
 	protected void newSubscription(Node node){
 		subscription = new Subscription();
 		subscription.setSubscriptionKey("uddi:uddi.listeningforchanges.com:callthiskeytonotify");
@@ -165,7 +169,7 @@
 	
 				public void onSuccess(SubscriptionResponse response) {
 					if (response.isSuccess()) {
-						UDDISubscription.getInstance().displaySubscription(subscription);
+						UDDISubscription.getInstance().refreshSubscriptionTree();
 					} else {
 						Window.alert("error: " + response.getMessage() + ". Make sure the UDDI server is up
and running.");
 					}

Modified: webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDISubscription.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDISubscription.java?rev=821395&r1=821394&r2=821395&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDISubscription.java
(original)
+++ webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDISubscription.java
Sat Oct  3 19:06:54 2009
@@ -101,8 +101,6 @@
 		if (detailPanel!=null) {
 			detailPanel.saveSubscription();
 		}
-		treePanel.getSubscriptionTree().clear();
-		treePanel.loadSubscriptions();
 	}
 	
 	public void newSubscription() {
@@ -115,10 +113,19 @@
 	
 	public void deleteSubscription() {
 		if (detailPanel!=null) {
-	//		subscriptionPanel.deleteSubscription(getToken());
+			detailPanel.deleteSubscription();
 		}
 	}
 	
+	public void refreshSubscriptionTree() {
+		treePanel.getSubscriptionTree().clear();
+		treePanel.loadSubscriptions();
+	}
+	
+	public void removeDetailPanel() {
+		if (detailPanel!=null ) dockPanel.remove(detailPanel); 
+	}
+	
 	public void syncListedServices() {
 		
 	}

Modified: webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionService.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionService.java?rev=821395&r1=821394&r2=821395&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionService.java
(original)
+++ webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionService.java
Sat Oct  3 19:06:54 2009
@@ -30,4 +30,5 @@
 	
 	public SubscriptionResponse getSubscriptions();
 	public SubscriptionResponse saveSubscription(Subscription subscription);
+	public SubscriptionResponse deleteSubscription(Subscription subscription);
 }

Modified: webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionServiceAsync.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionServiceAsync.java?rev=821395&r1=821394&r2=821395&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionServiceAsync.java
(original)
+++ webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/service/SubscriptionServiceAsync.java
Sat Oct  3 19:06:54 2009
@@ -28,5 +28,7 @@
 public interface SubscriptionServiceAsync extends RemoteService {
 	public void getSubscriptions(AsyncCallback<SubscriptionResponse> callback);
 	public void saveSubscription(Subscription subscription, AsyncCallback<SubscriptionResponse>
callback);
+	public void deleteSubscription(Subscription subscription, AsyncCallback<SubscriptionResponse>
callback);
+	
 }
 

Modified: webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/service/SubscriptionServiceImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/service/SubscriptionServiceImpl.java?rev=821395&r1=821394&r2=821395&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/service/SubscriptionServiceImpl.java
(original)
+++ webservices/juddi/trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/service/SubscriptionServiceImpl.java
Sat Oct  3 19:06:54 2009
@@ -39,6 +39,7 @@
 import org.apache.juddi.v3.client.transport.Transport;
 import org.apache.log4j.Logger;
 import org.apache.log4j.helpers.Loader;
+import org.uddi.sub_v3.DeleteSubscription;
 import org.uddi.sub_v3.ObjectFactory;
 import org.uddi.sub_v3.SubscriptionFilter;
 import org.uddi.v3_service.UDDISubscriptionPortType;
@@ -165,12 +166,47 @@
 	       	 subscriptionService.saveSubscription(authToken, subscriptionHolder);
 	       	 response.setSuccess(true);
 	     } catch (Exception e) {
-	    	 logger.error("Could not obtain subscription. " + e.getMessage(), e);
+	    	 logger.error("Could not save subscription. " + e.getMessage(), e);
 	    	 response.setSuccess(false);
 	    	 response.setMessage(e.getMessage());
 	    	 response.setErrorCode("102");
 	     } catch (Throwable t) {
-	    	 logger.error("Could not obtain token subscription. " + t.getMessage(), t);
+	    	 logger.error("Could not save subscription. " + t.getMessage(), t);
+	    	 response.setSuccess(false);
+	    	 response.setMessage(t.getMessage());
+	    	 response.setErrorCode("102");
+	     } 
+		
+		return response;
+	}
+	
+public SubscriptionResponse deleteSubscription(Subscription modelSubscription) {
+		
+		HttpServletRequest request = getThreadLocalRequest();
+		HttpSession session = request.getSession();
+		SubscriptionResponse response = new SubscriptionResponse();
+	
+		logger.debug("Sending deleteSubscriptions request for subscriptionKey=" 
+				+ modelSubscription.getSubscriptionKey());
+		try {
+			 UDDIClerk clerk = ClientConfig.getInstance().getClerks().get(modelSubscription.getClerkName());
+	    	 String clazz = ClientConfig.getInstance().getNodes().get(clerk.getNode().getName()).getProxyTransport();
+	         Class<?> transportClass = Loader.loadClass(clazz);
+	       	 Transport transport = (Transport) transportClass.getConstructor(String.class).newInstance(clerk.getNode().getName());

+	       	 UDDISubscriptionPortType subscriptionService = transport.getUDDISubscriptionService();
+	       	 DeleteSubscription deleteSubscription = new DeleteSubscription();
+	       	 String authToken = (String) session.getAttribute(clerk.getName());
+	       	 deleteSubscription.setAuthInfo(authToken);
+	       	 deleteSubscription.getSubscriptionKey().add(modelSubscription.getSubscriptionKey());
+	       	 subscriptionService.deleteSubscription(deleteSubscription);
+	       	 response.setSuccess(true);
+	     } catch (Exception e) {
+	    	 logger.error("Could not delete subscription. " + e.getMessage(), e);
+	    	 response.setSuccess(false);
+	    	 response.setMessage(e.getMessage());
+	    	 response.setErrorCode("102");
+	     } catch (Throwable t) {
+	    	 logger.error("Could not delete subscription. " + t.getMessage(), t);
 	    	 response.setSuccess(false);
 	    	 response.setMessage(t.getMessage());
 	    	 response.setErrorCode("102");



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


Mime
View raw message