You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2009/03/30 01:30:58 UTC
svn commit: r759799 - in
/webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets:
./ client/ server/
Author: kstam
Date: Sun Mar 29 23:30:58 2009
New Revision: 759799
URL: http://svn.apache.org/viewvc?rev=759799&view=rev
Log:
JUDDI-201 Listening the businesses for this publisher
Added:
webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationResponse.java
webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationService.java
webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationServiceAsync.java
webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/PublicationServiceImpl.java
Modified:
webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/UDDIBrowser.gwt.xml
webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDIBrowser.java
Modified: webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/UDDIBrowser.gwt.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/UDDIBrowser.gwt.xml?rev=759799&r1=759798&r2=759799&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/UDDIBrowser.gwt.xml (original)
+++ webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/UDDIBrowser.gwt.xml Sun Mar 29 23:30:58 2009
@@ -11,5 +11,6 @@
<servlet class="org.apache.juddi.portlets.server.SecurityServiceImpl" path="/security"/>
<servlet class="org.apache.juddi.portlets.server.InquiryServiceImpl" path="/inquiry"/>
+ <servlet class="org.apache.juddi.portlets.server.PublicationServiceImpl" path="/publication"/>
</module>
\ No newline at end of file
Added: webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationResponse.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationResponse.java?rev=759799&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationResponse.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationResponse.java Sun Mar 29 23:30:58 2009
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2001-2009 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.portlets.client;
+
+import java.util.List;
+/**
+ *
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ *
+ */
+public class PublicationResponse extends Response {
+
+ private static final long serialVersionUID = 1L;
+ List<String> businesses;
+
+ public List<String> getBusinesses() {
+ return businesses;
+ }
+ public void setBusinesses(List<String> businesses) {
+ this.businesses = businesses;
+ }
+
+}
Added: webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationService.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationService.java?rev=759799&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationService.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationService.java Sun Mar 29 23:30:58 2009
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2001-2009 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.portlets.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+/**
+ *
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ *
+ */
+@RemoteServiceRelativePath("publication")
+public interface PublicationService extends RemoteService {
+
+ public PublicationResponse getBusinesses(String authToken, String infoSelection);
+}
Added: webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationServiceAsync.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationServiceAsync.java?rev=759799&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationServiceAsync.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/PublicationServiceAsync.java Sun Mar 29 23:30:58 2009
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2001-2009 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.portlets.client;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.RemoteService;
+/**
+ *
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ *
+ */
+public interface PublicationServiceAsync extends RemoteService {
+ public void getBusinesses(String authToken, String infoSelection, AsyncCallback<PublicationResponse> callback);
+}
+
Modified: webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDIBrowser.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDIBrowser.java?rev=759799&r1=759798&r2=759799&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDIBrowser.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/client/UDDIBrowser.java Sun Mar 29 23:30:58 2009
@@ -16,6 +16,7 @@
*/
package org.apache.juddi.portlets.client;
+import java.util.List;
import java.util.Map;
import org.apache.juddi.portlets.client.SecurityService;
@@ -27,6 +28,7 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
@@ -42,18 +44,23 @@
*/
public class UDDIBrowser implements EntryPoint, ClickListener {
- Label tokenLabel = new Label("");
- Label tmodelLabel = new Label("");
private FlowPanel loginPanel = new FlowPanel();
- private VerticalPanel browsePanel = new VerticalPanel();
+ Label tokenLabel = new Label("");
private Button getTokenButton = new Button("Login");
- private Button getTModelButton = new Button("getTModel");
private TextBox usernameBox = new TextBox();
private PasswordTextBox passwordBox = new PasswordTextBox();
private String token = null;
private TextBox tmodelKeyBox = new TextBox();
private SecurityServiceAsync securityService = (SecurityServiceAsync) GWT.create(SecurityService.class);
+
+ private VerticalPanel tmodelPanel = new VerticalPanel();
+ Label tmodelLabel = new Label("");
+ private Button getTModelButton = new Button("getTModel");
private InquiryServiceAsync inquiryService = (InquiryServiceAsync) GWT.create(InquiryService.class);
+
+ private FlowPanel browsePanel = new FlowPanel();
+ private FlexTable businessTable = new FlexTable();
+ private PublicationServiceAsync publicationService = (PublicationServiceAsync) GWT.create(PublicationService.class);
/**
* This is the entry point method.
*/
@@ -73,21 +80,26 @@
getTokenButton.addClickListener(this);
getTokenButton.setStyleName(("portlet-form-button"));
loginPanel.add(getTokenButton);
-
+ RootPanel.get("token").add(tokenLabel); //TODO at some point we want to hide this
RootPanel.get("browser").add(loginPanel);
+
getTModelButton.addClickListener(this);
Label tmodel = new Label ("TModel Key:");
tmodel.setStyleName("portlet-form-field-label");
- browsePanel.add(tmodel);
+ tmodelPanel.add(tmodel);
tmodelKeyBox.setStyleName("portlet-form-input-field");
- browsePanel.add(tmodelKeyBox);
+ tmodelPanel.add(tmodelKeyBox);
getTModelButton.setStyleName(("portlet-form-button"));
- browsePanel.add(getTModelButton);
+ tmodelPanel.add(getTModelButton);
tmodelLabel.setStyleName("portlet-form-field-label");
- browsePanel.add(tmodelLabel);
+ tmodelPanel.add(tmodelLabel);
+
+ Label businesses = new Label ("Businesses");
+ businesses.setStyleName("portlet-form-field-label");
+ browsePanel.add(businesses);
+ browsePanel.add(businessTable);
- RootPanel.get("token").add(tokenLabel);
getToken();
}
@@ -116,9 +128,11 @@
public void onSuccess(SecurityResponse response) {
if (response.isSuccess) {
RootPanel.get("browser").clear();
- RootPanel.get("browser").add(browsePanel);
token = response.getResponse();
tokenLabel.setText("token: " + token);
+ //RootPanel.get("browser").add(tmodelPanel);
+ RootPanel.get("browser").add(browsePanel);
+ getBusinesses(token, "all");
} else {
tokenLabel.setText("error: " + response.getMessage());
}
@@ -137,9 +151,13 @@
public void onSuccess(SecurityResponse response) {
if (response.getResponse()!=null) {
RootPanel.get("browser").clear();
- RootPanel.get("browser").add(browsePanel);
token = response.getResponse();
tokenLabel.setText("token: " + token);
+ //RootPanel.get("browser").add(tmodelPanel);
+ RootPanel.get("browser").add(browsePanel);
+ getBusinesses(token, "all");
+
+
}
}
});
@@ -164,4 +182,29 @@
});
}
+ private void getBusinesses(String token, String infoSelection) {
+
+ publicationService.getBusinesses(token, infoSelection, new AsyncCallback<PublicationResponse>()
+ {
+ public void onFailure(Throwable caught) {
+ Window.alert("Could not connect to the UDDI registry.");
+ }
+
+ public void onSuccess(PublicationResponse response) {
+ if (response.isSuccess) {
+ List<String> businesses= response.getBusinesses();
+ System.out.println("Businesses=" + businesses);
+ businessTable.setTitle("Businesses");
+ int i=0;
+ for (String business : businesses) {
+ businessTable.setText(i++, 0, business);
+ }
+ //tmodelLabel.setText("tmodelMap: " + tModelMap);
+ } else {
+ //tmodelLabel.setText("error: " + response.getMessage());
+ }
+ }
+ });
+ }
+
}
Added: webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/PublicationServiceImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/PublicationServiceImpl.java?rev=759799&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/PublicationServiceImpl.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-console/uddi-portlets/src/main/java/org/apache/juddi/portlets/server/PublicationServiceImpl.java Sun Mar 29 23:30:58 2009
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2001-2009 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.portlets.server;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.juddi.portlets.client.PublicationResponse;
+import org.apache.juddi.portlets.client.PublicationService;
+import org.apache.log4j.Logger;
+import org.apache.log4j.helpers.Loader;
+import org.uddi.api_v3.BusinessInfo;
+import org.uddi.api_v3.GetRegisteredInfo;
+import org.uddi.api_v3.InfoSelection;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.RegisteredInfo;
+import org.uddi.api_v3.client.config.ClientConfig;
+import org.uddi.api_v3.client.config.Property;
+import org.uddi.api_v3.client.transport.Transport;
+import org.uddi.v3_service.UDDIPublicationPortType;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+/**
+ *
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ *
+ */
+public class PublicationServiceImpl extends RemoteServiceServlet implements PublicationService {
+
+ private Logger logger = Logger.getLogger(this.getClass());
+ private static final long serialVersionUID = 1L;
+
+ public PublicationResponse getBusinesses(String authToken, String infoSelection)
+ {
+ GetRegisteredInfo getRegistrationInfo = new GetRegisteredInfo();
+ getRegistrationInfo.setAuthInfo(authToken);
+ getRegistrationInfo.setInfoSelection(InfoSelection.ALL);
+
+ PublicationResponse response = new PublicationResponse();
+ logger.debug("GetRegistrationInfo " + getRegistrationInfo + " sending get Busineses request..");
+ List<String> businesses = new ArrayList<String>();
+ try {
+ String clazz = ClientConfig.getConfiguration().getString(Property.UDDI_PROXY_TRANSPORT,Property.DEFAULT_UDDI_PROXY_TRANSPORT);
+ Class<?> transportClass = Loader.loadClass(clazz);
+ Transport transport = (Transport) transportClass.newInstance();
+ UDDIPublicationPortType publicationService = transport.getPublishService();
+ RegisteredInfo info = publicationService.getRegisteredInfo(getRegistrationInfo);
+ for (BusinessInfo businessInfo : info.getBusinessInfos().getBusinessInfo()) {
+ List<Name> names = businessInfo.getName();
+ for (Name name : names) {
+ if ("en".equals(name.getLang())) {
+ String businessName = name.getValue();
+ businesses.add(businessName);
+ }
+ }
+ }
+ response.setSuccess(true);
+ response.setBusinesses(businesses);
+ } catch (Exception e) {
+ logger.error("Could not obtain token. " + e.getMessage(), e);
+ response.setSuccess(false);
+ response.setMessage(e.getMessage());
+ response.setErrorCode("102");
+ } catch (Throwable t) {
+ logger.error("Could not obtain token. " + t.getMessage(), t);
+ response.setSuccess(false);
+ response.setMessage(t.getMessage());
+ response.setErrorCode("102");
+ }
+ return response;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org