juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r1102742 - /juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/Property.java
Date Fri, 13 May 2011 13:59:39 GMT
Author: kstam
Date: Fri May 13 13:59:39 2011
New Revision: 1102742

URL: http://svn.apache.org/viewvc?rev=1102742&view=rev
Log:
JUDDI-477 adding properties to support formatting keys according to a template based on some
configurational setting.

Modified:
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/Property.java

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/Property.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/Property.java?rev=1102742&r1=1102741&r2=1102742&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/Property.java
(original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/Property.java
Fri May 13 13:59:39 2011
@@ -16,14 +16,86 @@
  */
 package org.apache.juddi.v3.client.config;
 
-public interface Property 
+import java.util.Properties;
+
+import javax.xml.namespace.QName;
+
+public class Property 
 {
 	public final static String UDDI_RELOAD_DELAY  ="reloadDelay";
 	
-	
-	public final static String UDDI_PROXY_FACTORY_INITIAL       ="java.naming.factory.initial";
-	public final static String UDDI_PROXY_PROVIDER_URL          ="java.naming.provider.url";
-	public final static String UDDI_PROXY_FACTORY_URL_PKS       ="java.naming.factory.url.pkgs";
+	public final static String UDDI_PROXY_FACTORY_INITIAL       = "java.naming.factory.initial";
+	public final static String UDDI_PROXY_PROVIDER_URL          = "java.naming.provider.url";
+	public final static String UDDI_PROXY_FACTORY_URL_PKS       = "java.naming.factory.url.pkgs";
 
-	public final static String DEFAULT_UDDI_PROXY_TRANSPORT     ="org.uddi.api_v3.client.transport.JAXWSTransport";
+	public final static String DEFAULT_UDDI_PROXY_TRANSPORT     = "org.uddi.api_v3.client.transport.JAXWSTransport";
+	
+	//Properties that can be set in the uddi.xml
+	public static final String LANG                             = "lang";
+	public static final String BUSINESS_KEY                     = "businessKey";
+	public static final String KEY_DOMAIN                       = "keyDomain";
+	public static final String SERVICE_KEY_FORMAT               = "bpelServiceKeyFormat";
+	public static final String BUSINESS_KEY_FORMAT              = "businessKeyFormat";
+	public static final String BINDING_KEY_FORMAT               = "bindingKeyFormat";
+	public static final String SERVICE_DESCRIPTION              = "serviceDescription";
+	public static final String BINDING_DESCRIPTION              = "bindingDescription";
+	public static final String SERVICE_CATEGORY_BAG             = "serviceCategoryBag";
+	public static final String BINDING_CATEGORY_BAG             = "bindingCategoryBag";
+	
+	//Default Values
+	public static final String DEFAULT_LANG                     = "en:";
+	public static final String DEFAULT_BUSINESS_KEY_FORMAT      = "uddi:${keyDomain}:${businessName}";
+	public static final String DEFAULT_SERVICE_KEY_FORMAT       = "uddi:${keyDomain}:${serviceName}";
+	public static final String DEFAULT_BINDING_KEY_FORMAT       = "uddi:${keyDomain}:${nodeName}_${serviceName}_${portName}";
+	public static final String DEFAULT_SERVICE_DESCRIPTION      = "Default service description
when no <wsdl:document> element is defined inside the <wsdl:service> element.";
+	public static final String DEFAULT_BINDING_DESCRIPTION      = "Default binding description
when no <wsdl:document> element is defined inside the <wsdl:binding> element.";
+	/**
+	 * Constructs the serviceKey based on the bindingKeyFormat specified in the properties.
When no
+	 * businessKeyFormat is specific the default format of uddi:${keyDomain}:${businessName}
is used. The businessName
+	 * property needs to be set properties.
+	 * 
+	 * @param properties
+	 * @return the businessKey
+	 */
+	public static String getBusinessKey(Properties properties) {
+		String keyFormat = properties.getProperty(BUSINESS_KEY_FORMAT, DEFAULT_BUSINESS_KEY_FORMAT);
+		String businessKey = TokenResolver.replaceTokens(keyFormat, properties).toLowerCase();
+		return businessKey;
+	}
+	/**
+	 * Constructs the serviceKey based on the serviceKeyFormat specified in the properties.
When no
+	 * serviceKeyFormat is specific the default format of uddi:${keyDomain}:${serviceName} is
used.
+	 * 
+	 * @param properties
+	 * @param serviceName
+	 * @return the serviceKey
+	 */
+	public static String getServiceKey(Properties properties, QName serviceName) {
+		Properties tempProperties = new Properties();
+		tempProperties.putAll(properties);
+		tempProperties.put("serviceName", serviceName.getLocalPart());
+		//Constructing the serviceKey
+		String keyFormat = tempProperties.getProperty(SERVICE_KEY_FORMAT, DEFAULT_SERVICE_KEY_FORMAT);
+		String serviceKey = TokenResolver.replaceTokens(keyFormat, tempProperties).toLowerCase();
+		return serviceKey;
+	}
+	/**
+	 * Constructs the bindingKey based on the bindingKeyFormat specified in the properties.
When no
+	 * bindingKeyFormat is specific the default format of uddi:${keyDomain}:${nodeName}-${serviceName}-{portName}
is used.
+	 * 
+	 * @param properties
+	 * @param serviceName
+	 * @param portName
+	 * @return the bindingKey
+	 */
+	public static String getBindingKey(Properties properties, QName serviceName, String portName)
{
+		Properties tempProperties = new Properties();
+		tempProperties.putAll(properties);
+		tempProperties.put("serviceName", serviceName.getLocalPart());
+		tempProperties.put("portName", portName);
+		//Constructing the binding Key
+		String keyFormat = properties.getProperty(BINDING_KEY_FORMAT, DEFAULT_BINDING_KEY_FORMAT);
+		String bindingKey = TokenResolver.replaceTokens(keyFormat, tempProperties).toLowerCase();
+		return bindingKey;
+	}
 }



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


Mime
View raw message