Author: kurtstam
Date: 2009-12-15 13:31:02 -0500 (Tue, 15 Dec 2009)
New Revision: 389
Added:
trunk/distribution/src/main/release/db/juddi/
trunk/distribution/src/main/release/db/juddi/esb.juddi.client.xml
trunk/distribution/src/main/release/db/juddi/jbossesb_BusinessEntity.xml
trunk/distribution/src/main/release/db/juddi/jbossesb_tModels.xml
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java
Modified:
trunk/distribution/src/main/release/db/bpel.properties
trunk/distribution/src/main/release/install/build.xml
trunk/runtime/engine-assembly/src/main/resources/bpel.properties
trunk/runtime/engine/pom.xml
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
Log:
RIFTSAW-11, adding jUDDI integration
Modified: trunk/distribution/src/main/release/db/bpel.properties
===================================================================
--- trunk/distribution/src/main/release/db/bpel.properties 2009-12-15 17:41:39 UTC (rev
388)
+++ trunk/distribution/src/main/release/db/bpel.properties 2009-12-15 18:31:02 UTC (rev
389)
@@ -87,6 +87,10 @@
bpel.db.mode=EXTERNAL
bpel.db.ext.dataSource=java:BPELDB
+# if set to true will self-register BPEL endpoints upon deployment to a UDDI.
+# this uses the juddi-client-3.0.0 and the uddi client config can be set in the uddi.xml
+# file
+bpel.uddi.registration=true
hibernate.dialect=@dialect@
hibernate.hbm2ddl.auto=update
Added: trunk/distribution/src/main/release/db/juddi/esb.juddi.client.xml
===================================================================
--- trunk/distribution/src/main/release/db/juddi/esb.juddi.client.xml
(rev 0)
+++ trunk/distribution/src/main/release/db/juddi/esb.juddi.client.xml 2009-12-15 18:31:02
UTC (rev 389)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<uddi>
+ <reloadDelay>5000</reloadDelay>
+ <manager name="test-manager">
+ <nodes>
+ <node>
+ <!-- required 'default' node -->
+ <name>default</name>
+ <description>Main jUDDI node</description>
+ <properties>
+ <property name="keyDomain"
value="esb.jboss.org"/>
+ <property name="businessKey"
value="redhat-jboss"/>
+ <property name="serviceDescription" value="BPEL
Service deployed by Riftsaw"/>
+ <property name="bindingDescription" value="BPEL
Endpoint deployed by Riftsaw"/>
+ </properties>
+ <!-- JAX-WS Transport
+
<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+
<custodyTransferUrl>http://${jboss.esb.bind.address}:8080/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+
<inquiryUrl>http://${jboss.esb.bind.address}:8080/juddiv3/services/inquiry?wsdl</inquiryUrl>
+
<publishUrl>http://${jboss.esb.bind.address}:8080/juddiv3/services/publish?wsdl</publishUrl>
+
<securityUrl>http://${jboss.esb.bind.address}:8080/juddiv3/services/security?wsdl</securityUrl>
+
<subscriptionUrl>http://${jboss.esb.bind.address}:8080/juddiv3/services/subscription?wsdl</subscriptionUrl>
+
<subscriptionListenerUrl>http://${jboss.esb.bind.address}:8080/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+
<juddiApiUrl>http://${jboss.esb.bind.address}:8080/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
+ -->
+ <!-- In VM Transport Settings -->
+
<proxyTransport>org.jboss.internal.soa.esb.registry.client.JuddiInVMTransport</proxyTransport>
+
<custodyTransferUrl>org.apache.juddi.api.impl.UDDICustodyTransferImpl</custodyTransferUrl>
+
<inquiryUrl>org.apache.juddi.api.impl.UDDIInquiryImpl</inquiryUrl>
+
<publishUrl>org.apache.juddi.api.impl.UDDIPublicationImpl</publishUrl>
+
<securityUrl>org.apache.juddi.api.impl.UDDISecurityImpl</securityUrl>
+
<subscriptionUrl>org.apache.juddi.api.impl.UDDISubscriptionImpl</subscriptionUrl>
+
<subscriptionListenerUrl>org.apache.juddi.api.impl.UDDISubscriptionListenerImpl</subscriptionListenerUrl>
+
<juddiApiUrl>org.apache.juddi.api.impl.JUDDIApiImpl</juddiApiUrl>
+ <!-- RMI Transport Settings
+
<proxyTransport>org.apache.juddi.v3.client.transport.RMITransport</proxyTransport>
+
<custodyTransferUrl>/juddiv3/UDDICustodyTransferService</custodyTransferUrl>
+ <inquiryUrl>/juddiv3/UDDIInquiryService</inquiryUrl>
+ <publishUrl>/juddiv3/UDDIPublicationService</publishUrl>
+ <securityUrl>/juddiv3/UDDISecurityService</securityUrl>
+
<subscriptionUrl>/juddiv3/UDDISubscriptionService</subscriptionUrl>
+
<subscriptionListenerUrl>/juddiv3/UDDISubscriptionListenerService</subscriptionListenerUrl>
+ <juddiApiUrl>/juddiv3/JUDDIApiService</juddiApiUrl>
+
<javaNamingFactoryInitial>org.jnp.interfaces.NamingContextFactory</javaNamingFactoryInitial>
+
<javaNamingFactoryUrlPkgs>org.jboss.naming</javaNamingFactoryUrlPkgs>
+
<javaNamingProviderUrl>jnp://${jboss.esb.bind.address}:1099</javaNamingProviderUrl>
+ -->
+ </node>
+ </nodes>
+ <clerks registerOnStartup="true">
+ <clerk name="BPELClerk" node="default"
publisher="jbossesb" password="jbossesb" />
+ </clerks>
+ </manager>
+</uddi>
Added: trunk/distribution/src/main/release/db/juddi/jbossesb_BusinessEntity.xml
===================================================================
--- trunk/distribution/src/main/release/db/juddi/jbossesb_BusinessEntity.xml
(rev 0)
+++ trunk/distribution/src/main/release/db/juddi/jbossesb_BusinessEntity.xml 2009-12-15
18:31:02 UTC (rev 389)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+ *
+ */ -->
+ <!--
+ This file contains the root business entity structure that represents your registry.
The key chosen (or generated) for this entity will serve
+ as the node id for all entities published within the registry. The services contained
within this business entity reflect the UDDI APIs that
+ you wish to support (adding or subtracting the services here will not enable/disable
them, simply add/omit them from being discovered via UDDI).
+
+ The top-level business entity and sub-entities all use keys as unique identifiers.
They are left blank by default which means the system will
+ generate a key (generated as root partition with GUID appended). You can choose to
create your own, human-readable keys but they must match
+ the root key generator created in the root_tModelKeyGen.xml file. Matching means they
must equal the root key generator with the keyword
+ "keygenerator" replaced by your own string.
+
+ Example:
+
+ root_tModelKeyGen.xml key is uddi:www.mycompany.com:registry:keygenerator
+
+ Legal user-defined keys are:
+
+ uddi:www.mycompany.com:registry:ubr-node (for the businessKey)
+ uddi:www.mycompany.com:registry:inquiry-service (for the inquiry service service key)
+ uddi:www.mycompany.com:registry:inquiry-service-wsdlDeployment (for the inquiry service
binding template that represents the WSDL)
+
+
+ See below for other fields that you may want to edit...
+ -->
+<businessEntity xmlns="urn:uddi-org:api_v3"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
businessKey="uddi:esb.jboss.org:redhat-jboss">
+ <name xml:lang="en">JBossESB Business</name>
+ <!-- Change the description field to provided a brief description of your registry
-->
+ <description xml:lang="en">The business that owns all the services
deployed by JBossESB and Riftsaw</description>
+</businessEntity>
+
+
+
+
Added: trunk/distribution/src/main/release/db/juddi/jbossesb_tModels.xml
===================================================================
--- trunk/distribution/src/main/release/db/juddi/jbossesb_tModels.xml
(rev 0)
+++ trunk/distribution/src/main/release/db/juddi/jbossesb_tModels.xml 2009-12-15 18:31:02
UTC (rev 389)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+ *
+ */ -->
+<save_tModel xmlns="urn:uddi-org:api_v3">
+ <tModel tModelKey="uddi:esb.jboss.org:keygenerator"
xmlns="urn:uddi-org:api_v3">
+ <name>esb-jboss-org:keyGenerator</name>
+ <description>JBossESB domain key generator</description>
+ <overviewDoc>
+ <overviewURL useType="text">
+
http://uddi.org/pubs/uddi_v3.htm#keyGen</overviewURL>
+ </overviewDoc>
+ <categoryBag>
+ <keyedReference tModelKey="uddi:uddi.org:categorization:types"
keyName="uddi-org:types:keyGenerator"
+ keyValue="keyGenerator" />
+ </categoryBag>
+ </tModel>
+ <tModel tModelKey="uddi:jboss.org:esb"
xmlns="urn:uddi-org:api_v3">
+ <name>org.jboss.soa.esb.:category</name>
+ <description>JBoss ESB category</description>
+ <overviewDoc>
+ <overviewURL useType="text">
+
http://www.jboss.org/community/wiki/JbossesbJAXR</overviewURL>
+ </overviewDoc>
+ <categoryBag>
+ <keyedReference tModelKey="uddi:uddi.org:categorization:types"
keyName="uddi-org:types:xml"
+ keyValue="xmlSpec" />
+ </categoryBag>
+ </tModel>
+</save_tModel>
Modified: trunk/distribution/src/main/release/install/build.xml
===================================================================
--- trunk/distribution/src/main/release/install/build.xml 2009-12-15 17:41:39 UTC (rev
388)
+++ trunk/distribution/src/main/release/install/build.xml 2009-12-15 18:31:02 UTC (rev
389)
@@ -87,6 +87,7 @@
<!--install appropriate db driver-->
<antcall target="internal.install.riftsaw.into.jboss.db.${database}"
/>
+ <antcall target="deploy.esb.uddi.config"/>
<!-- BPM Console -->
<mkdir dir="${deploy.dir}/bpel-console"/>
@@ -111,6 +112,7 @@
<!--uninstall appropriate db driver-->
<antcall target="internal.uninstall.riftsaw.into.jboss.db.${database}"
/>
+ <antcall target="undeploy.esb.uddi.config"/>
<delete dir="${deploy.dir}/bpel-console" />
<delete
file="${server.lib.dir}/gwt-console-server-integration.jar"/>
@@ -229,5 +231,32 @@
<echo> deleting the duplicated juddi service</echo>
<delete dir="${deploy.dir}/juddi-service.sar"/>
</target>
+
+ <target name="check.jbossesb">
+ <condition property="is.jbossesb">
+ <available file="${deploy.dir}/jbossesb.sar" />
+ </condition>
+ </target>
+
+ <target name="deploy.esb.uddi.config" if="is.jbossesb"
depends="check.jbossesb">
+ <echo>deploy jUDDI configuration</echo>
+ <move file="${deploy.dir}/jbossesb.sar/esb.juddi.client.xml"
tofile="${deploy.dir}/jbossesb.sar/esb.juddi.client.xml.old"/>
+ <copy file="../db/juddi/esb.juddi.client.xml"
+ todir="${deploy.dir}/jbossesb.sar" />
+ <move
file="${deploy.dir}/jbossesb-registry.sar/juddi_custom_install_data/jbossesb_tModels.xml"
+
tofile="${deploy.dir}/jbossesb-registry.sar/juddi_custom_install_data/jbossesb_tModels.xml.old"/>
+ <copy file="../db/juddi/jbossesb_tModels.xml"
+ todir="${deploy.dir}/jbossesb-registry.sar/juddi_custom_install_data/"
/>
+ <copy file="../db/juddi/jbossesb_BusinessEntity.xml"
+ todir="${deploy.dir}/jbossesb-registry.sar/juddi_custom_install_data/"
/>
+ </target>
+
+ <target name="undeploy.esb.uddi.config" if="is.jbossesb"
depends="check.jbossesb">
+ <echo>undeploy jUDDI configuration</echo>
+ <move file="${deploy.dir}/jbossesb.sar/esb.juddi.client.xml.old"
tofile="${deploy.dir}/jbossesb.sar/esb.juddi.client.xml"/>
+ <move
file="${deploy.dir}/jbossesb-registry.sar/juddi_custom_install_data/jbossesb_tModels.xml.old"
+
tofile="${deploy.dir}/jbossesb-registry.sar/juddi_custom_install_data/jbossesb_tModels.xml"/>
+ <delete
file="${deploy.dir}/jbossesb-registry.sar/juddi_custom_install_data/jbossesb_BusinessEntity.xml"
/>
+ </target>
</project>
Modified: trunk/runtime/engine/pom.xml
===================================================================
--- trunk/runtime/engine/pom.xml 2009-12-15 17:41:39 UTC (rev 388)
+++ trunk/runtime/engine/pom.xml 2009-12-15 18:31:02 UTC (rev 389)
@@ -125,8 +125,14 @@
<artifactId>h2</artifactId>
<scope>provided</scope>
</dependency>
+ <!-- UDDI v3 -->
+ <dependency>
+ <artifactId>juddi-client</artifactId>
+ <groupId>org.apache.juddi</groupId>
+ <version>3.0.0</version>
+ <scope>provided</scope>
+ </dependency>
-
</dependencies>
Added:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java
(rev 0)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java 2009-12-15
18:31:02 UTC (rev 389)
@@ -0,0 +1,272 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.runtime.engine.ode;
+
+import java.rmi.RemoteException;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.v3.annotations.AnnotationProcessor;
+import org.apache.juddi.v3.client.config.TokenResolver;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+import org.apache.juddi.v3.client.transport.TransportException;
+import org.jboss.soa.bpel.runtime.ws.EndpointMetaData;
+import org.jboss.soa.bpel.runtime.ws.ServiceEndpointReference;
+import org.jboss.soa.bpel.runtime.ws.WSDLReference;
+import org.uddi.api_v3.AccessPoint;
+import org.uddi.api_v3.BindingTemplate;
+import org.uddi.api_v3.BindingTemplates;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.TModelInstanceDetails;
+import org.uddi.api_v3.TModelInstanceInfo;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+
+/**
+ *
+ * * @author Kurt T Stam <kurt.stam(a)jboss.com>
+ *
+ */
+public class UDDIRegistration extends AnnotationProcessor {
+
+ protected static final Log log = LogFactory.getLog(UDDIRegistration.class);
+ public static final String BPEL_CLERK = "BPELClerk";
+ public static final String DEFAULT_SERVICE_KEY_FORMAT =
"uddi:${keyDomain}:bpel-services-";
+ public static final String DEFAULT_BINDING_KEY_FORMAT =
"uddi:${keyDomain}:bindings-";
+ //Can be set in the uddi.xml property section
+ public static final String LANG = "lang";
+ public static final String SERVICE_DESCRIPTION =
"serviceDescription";
+ public static final String SERVICE_CATEGORY_BAG =
"serviceCategoryBag";
+ public static final String BINDING_DESCRIPTION =
"bindingDescription";
+ public static final String BINDING_CATEGORY_BAG =
"bindingCategoryBag";
+ public static final String BINDING_TMODEL_KEYS =
"bindingTModelKeys";
+ public static final String SERVICE_KEY_FORMAT = "serviceKeyFormat";
+ public static final String BINDING_KEY_FORMAT = "bindingKeyFormat";
+
+
+ /**
+ * Registers a BPEL ServiceEndpointReference (EPR) into a UDDI registry using the jUDDI
client code.
+ * If the serviceKey does not already exist we register the service along with the EPR.
+ *
+ * @param EPR
+ * @param metaData
+ * @param wsdlRef
+ */
+ public void registerEPR(EndpointMetaData metaData, WSDLReference wsdlRef) {
+ boolean selfRegister = false;
+ try {
+ selfRegister = UDDIClerkManager.getClientConfig().isRegisterOnStartup();
+ if (selfRegister) {
+ Map<String,UDDIClerk> clerks =
UDDIClerkManager.getClientConfig().getUDDIClerks();
+ UDDIClerk bpelClerk = clerks.get(BPEL_CLERK);
+ if (bpelClerk!=null) {
+ try {
+ BusinessService service = createBusinessService(bpelClerk, metaData, wsdlRef);
+ bpelClerk.register(service, bpelClerk.getUDDINode().getApiNode());
+ } catch (Exception e) {
+ log.error("Unable to register service " + metaData.getServiceName()
+ + " ." + e.getMessage(),e);
+ } catch (Throwable t) {
+ log.error("Unable to register service " + metaData.getServiceName()
+ + " ." + t.getMessage(),t);
+ }
+ } else {
+ throw new ConfigurationException("Could not find UDDI Clerk named "+
BPEL_CLERK);
+ }
+ }
+ } catch (ConfigurationException ce) {
+ if (selfRegister) {
+ log.error(ce.getMessage(),ce);
+ } else {
+ log.info(ce.getMessage());
+ }
+ }
+ }
+ /**
+ * UnRegisters the binding from the UDDI Registry.
+ * @param EPR
+ * @param metaData
+ * @param wsdlRef
+ */
+ public void unRegisterEPR(QName service, String port) {
+ boolean selfRegister = false;
+ try {
+ selfRegister = UDDIClerkManager.getClientConfig().isRegisterOnStartup();
+ if (selfRegister) {
+ Map<String,UDDIClerk> clerks =
UDDIClerkManager.getClientConfig().getUDDIClerks();
+ UDDIClerk bpelClerk = clerks.get(BPEL_CLERK);
+ String bindingName = service.getLocalPart() + "-" + port;
+ if (bpelClerk!=null) {
+ try {
+ Properties properties = bpelClerk.getUDDINode().getProperties();
+ //Constructing the bindingKey
+ String bindingKey = TokenResolver.replaceTokens(DEFAULT_BINDING_KEY_FORMAT +
bindingName, properties);
+ if (properties.containsKey(BINDING_KEY_FORMAT)) {
+ bindingKey =
TokenResolver.replaceTokens((String)properties.get(BINDING_KEY_FORMAT) + bindingName,
properties);
+ }
+ bindingKey = bindingKey.toLowerCase();
+ //Lookup the binding
+ BindingTemplate binding = null;
+ try {
+ binding = bpelClerk.findServiceBinding(bindingKey,
bpelClerk.getUDDINode().getApiNode());
+ //TODO Kurt: Just delete this binding -not all bindings- upgrade the jUDDI client
to support this.
+ BusinessService businessService = bpelClerk.findService(binding.getServiceKey(),
bpelClerk.getUDDINode().getApiNode());
+ bpelClerk.unRegister(businessService, bpelClerk.getUDDINode().getApiNode());
+ } catch (Exception e) {
+ log.warn("Could not find BindingTemplate with key " + bindingKey +
" for unRegistration.");
+ }
+ } catch (Exception e) {
+ log.error("Unable to unRegister EPR " + bindingName
+ + " ." + e.getMessage(),e);
+ } catch (Throwable t) {
+ log.error("Unable to unRegister EPR " + bindingName
+ + " ." + t.getMessage(),t);
+ }
+ } else {
+ throw new ConfigurationException("Could not find UDDI Clerk named "+
BPEL_CLERK);
+ }
+ }
+ } catch (ConfigurationException ce) {
+ if (selfRegister) {
+ log.error(ce.getMessage(),ce);
+ } else {
+ log.info(ce.getMessage());
+ }
+ }
+ }
+
+ private BusinessService createBusinessService(UDDIClerk clerk,
+ EndpointMetaData metaData, WSDLReference wsdlRef)
+ throws DispositionReportFaultMessage, RemoteException, ConfigurationException,
TransportException {
+ Properties properties = clerk.getUDDINode().getProperties();
+ //Constructing the serviceKey
+ String serviceKey = TokenResolver.replaceTokens(DEFAULT_SERVICE_KEY_FORMAT +
metaData.getServiceName().getLocalPart(), properties);
+ if (properties.containsKey(SERVICE_KEY_FORMAT)) {
+ serviceKey = TokenResolver.replaceTokens((String)properties.get(SERVICE_KEY_FORMAT) +
metaData.getServiceName(), properties);
+ }
+ BusinessService service = null;
+ try {
+ //Checking if this serviceKey already exist
+ service = clerk.findService(serviceKey, clerk.getUDDINode().getApiNode());
+ log.debug("Service " + metaData.getServiceName() + " already present in
the UDDI Registry");
+ } catch (Exception e) {
+ //If it does not exist construct service information
+ log.debug("Constructing Service UDDI Information for " +
metaData.getServiceName());
+ service = new BusinessService();
+ service.setBusinessKey(TokenResolver.replaceTokens("uddi:${keyDomain}:${businessKey}",
properties));
+ service.setServiceKey(serviceKey);
+ if (properties.containsKey(SERVICE_DESCRIPTION)) {
+ Description description = new Description();
+ String lang = "en";
+ if (properties.containsKey(LANG)) lang = properties.getProperty(LANG);
+ description.setLang(lang);
+ description.setValue(properties.getProperty(SERVICE_DESCRIPTION));
+ Name serviceName = new Name();
+ serviceName.setLang(lang);
+ serviceName.setValue(metaData.getServiceName().getLocalPart());
+ service.getName().add(serviceName);
+ service.getDescription().add(description);
+ }
+ //default categoryBag on the binding
+ if (properties.containsKey(SERVICE_CATEGORY_BAG)) {
+ String defaultCategoryBag = properties.getProperty(SERVICE_CATEGORY_BAG);
+ log.info("Adding categoryBag: " + defaultCategoryBag);
+ CategoryBag categoryBag = parseCategoryBag(defaultCategoryBag);
+ service.setCategoryBag(categoryBag);
+ }
+ }
+ //Construct bindingTemplate
+ BindingTemplate binding = createBindingTemplate(clerk, metaData, wsdlRef);
+ //Add the bindingTemplate on the service
+ if (service.getBindingTemplates()==null) {
+ BindingTemplates bindingTemplates = new BindingTemplates();
+ service.setBindingTemplates(bindingTemplates);
+ }
+ service.getBindingTemplates().getBindingTemplate().add(binding);
+ return service;
+ }
+
+ private BindingTemplate createBindingTemplate(UDDIClerk clerk,
+ EndpointMetaData metaData, WSDLReference wsdlRef) {
+
+ Properties properties = clerk.getUDDINode().getProperties();
+ BindingTemplate bindingTemplate = new BindingTemplate();
+ //Constructing the bindingKey
+ String bindingKey = TokenResolver.replaceTokens(DEFAULT_BINDING_KEY_FORMAT +
metaData.getServiceName().getLocalPart() + "-"
+ + metaData.getPortName(), properties);
+ if (properties.containsKey(BINDING_KEY_FORMAT)) {
+ bindingKey = TokenResolver.replaceTokens((String)properties.get(BINDING_KEY_FORMAT) +
metaData.getServiceName().getLocalPart() + "-"
+ + metaData.getPortName(), properties);
+ }
+
+ bindingTemplate.setBindingKey(bindingKey);
+
+ String lang = "en";
+ if (properties.containsKey(LANG)) lang = properties.getProperty(LANG);
+ if (properties.containsKey(BINDING_DESCRIPTION)) {
+ Description bindingDescription = new Description();
+ bindingDescription.setLang(lang);
+ bindingDescription.setValue(properties.getProperty(BINDING_DESCRIPTION));
+ bindingTemplate.getDescription().add(bindingDescription);
+ }
+
+ AccessPoint accessPoint = new AccessPoint();
+ accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
+ accessPoint.setValue(wsdlRef.getWsdlFileURL().toString());
+ bindingTemplate.setAccessPoint(accessPoint);
+
+ //default tModelKeys on the binding
+ String defaultTModelKeys = properties.getProperty("tModelKeys");
+ if (defaultTModelKeys!=null && !"".equals(defaultTModelKeys)) {
+ String[] tModelKeys= defaultTModelKeys.split(",");
+ for (String tModelKey : tModelKeys) {
+ TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
+ instanceInfo.setTModelKey(tModelKey);
+ if (bindingTemplate.getTModelInstanceDetails()==null) {
+ bindingTemplate.setTModelInstanceDetails(new TModelInstanceDetails());
+ }
+ bindingTemplate.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
+ }
+ }
+ //default categoryBag on the binding
+ String defaultCategoryBag = properties.getProperty("bindingCategoryBag");
+ if (defaultCategoryBag!=null && !"".equals(defaultCategoryBag)) {
+ log.info("Adding categoryBag: " + defaultCategoryBag);
+ CategoryBag categoryBag = parseCategoryBag(defaultCategoryBag);
+ bindingTemplate.setCategoryBag(categoryBag);
+ }
+
+ return bindingTemplate;
+ }
+
+
+
+}
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2009-12-15
17:41:39 UTC (rev 388)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2009-12-15
18:31:02 UTC (rev 389)
@@ -21,8 +21,11 @@
*/
package org.jboss.soa.bpel.runtime.ws;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.client.spi.DeployerClient;
@@ -35,11 +38,13 @@
import org.jboss.kernel.Kernel;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.soa.bpel.runtime.engine.ode.ExecutionEnvironment;
+import org.jboss.soa.bpel.runtime.engine.ode.UDDIRegistration;
import org.jboss.soa.bpel.runtime.integration.KernelLocator;
import org.jboss.soa.bpel.runtime.integration.ServerConfig;
import org.jboss.soa.bpel.runtime.integration.ServerConfigFactory;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
+import org.uddi.api_v3.BusinessService;
import javax.xml.namespace.QName;
import java.io.File;
@@ -62,16 +67,22 @@
public class EndpointManager
{
protected final Log log = LogFactory.getLog(getClass());
+ // we should consider having our own OdeConfigProperties class if we need more
properties
+ private final static String BPEL_UDDI_REGISTRATION = "uddi.registration";
private Map<String, ServiceEndpointReference> endpointMapping = new
ConcurrentHashMap<String, ServiceEndpointReference>();
private ServerConfig serverConfig;
private ExecutionEnvironment executionEnvironment;
+ private UDDIRegistration uddiRegistration;
public EndpointManager(ExecutionEnvironment executionEnvironment)
{
this.executionEnvironment = executionEnvironment;
this.serverConfig = ServerConfigFactory.getServerConfig();
+ if (isUDDIRegistration()) {
+ uddiRegistration = new UDDIRegistration();
+ }
}
public EndpointReference createEndpoint(EndpointMetaData metaData, WSDLReference
wsdlRef, final ClassLoader classLoader)
@@ -135,6 +146,9 @@
createEndpointKey(metaData.getServiceName(), metaData.getPortName()),
ref
);
+ if (isUDDIRegistration()) {
+ uddiRegistration.registerEPR(metaData, wsdlRef);
+ }
return ref;
}
@@ -214,6 +228,9 @@
{
log.warn(ref.getArchiveLocation() + " cannot be removed (doesn't
exist).");
}
+ if (isUDDIRegistration()) {
+ uddiRegistration.unRegisterEPR(service, port);
+ }
}
catch (Exception e)
{
@@ -302,4 +319,9 @@
}
return( path.delete() );
}
+
+ public boolean isUDDIRegistration() {
+ return
Boolean.valueOf(executionEnvironment.getOdeConfig().getProperty(BPEL_UDDI_REGISTRATION,
"false"));
+ }
+
}
Modified: trunk/runtime/engine-assembly/src/main/resources/bpel.properties
===================================================================
--- trunk/runtime/engine-assembly/src/main/resources/bpel.properties 2009-12-15 17:41:39
UTC (rev 388)
+++ trunk/runtime/engine-assembly/src/main/resources/bpel.properties 2009-12-15 18:31:02
UTC (rev 389)
@@ -87,6 +87,10 @@
bpel.db.mode=EXTERNAL
bpel.db.ext.dataSource=java:BPELDB
+# if set to true will self-register BPEL endpoints upon deployment to a UDDI.
+# this uses the juddi-client-3.0.0 and the uddi client config can be set in the uddi.xml
+# file
+bpel.uddi.registration=true
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.hbm2ddl.auto=update