You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2010/02/19 07:04:10 UTC
svn commit: r911704 - in
/synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse:
config/xml/ProxyServiceFactory.java config/xml/ProxyServiceSerializer.java
core/axis2/ProxyService.java
Author: hiranya
Date: Fri Feb 19 06:04:10 2010
New Revision: 911704
URL: http://svn.apache.org/viewvc?rev=911704&view=rev
Log:
Making the service group for proxy services configurable. (SYNAPSE-610)
Modified:
synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
Modified: synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java?rev=911704&r1=911703&r2=911704&view=diff
==============================================================================
--- synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java (original)
+++ synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java Fri Feb 19 06:04:10 2010
@@ -142,6 +142,12 @@
proxy.setStartOnLoad(true);
}
+ OMAttribute serviceGroup = elem.getAttribute(
+ new QName(XMLConfigConstants.NULL_NAMESPACE, "serviceGroup"));
+ if (serviceGroup != null) {
+ proxy.setServiceGroup(serviceGroup.getAttributeValue());
+ }
+
// setting the description of the proxy service
OMElement descriptionElement = elem.getFirstChildWithName(
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "description"));
Modified: synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java?rev=911704&r1=911703&r2=911704&view=diff
==============================================================================
--- synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java (original)
+++ synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java Fri Feb 19 06:04:10 2010
@@ -72,6 +72,11 @@
proxy.addAttribute(fac.createOMAttribute("transports", nullNS, transportStr));
}
+ if (service.getServiceGroup() != null) {
+ proxy.addAttribute(fac.createOMAttribute(
+ "serviceGroup", nullNS, service.getServiceGroup()));
+ }
+
List pinnedServers = service.getPinnedServers();
if (pinnedServers != null && !pinnedServers.isEmpty()) {
String pinnedServersStr = "" + pinnedServers.get(0);
Modified: synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?rev=911704&r1=911703&r2=911704&view=diff
==============================================================================
--- synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java (original)
+++ synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java Fri Feb 19 06:04:10 2010
@@ -208,6 +208,8 @@
private String fileName;
+ private String serviceGroup;
+
/**
* Constructor
*
@@ -542,8 +544,25 @@
try {
proxyService.addParameter(
SynapseConstants.SERVICE_TYPE_PARAM_NAME, SynapseConstants.PROXY_SERVICE_TYPE);
- auditInfo("Adding service " + name + " to the Axis2 configuration");
- axisCfg.addService(proxyService);
+ if (serviceGroup == null) {
+ auditInfo("Adding service " + name + " to the Axis2 configuration");
+ axisCfg.addService(proxyService);
+ } else {
+ auditInfo("Adding service " + name + " to the service group " + serviceGroup);
+ AxisServiceGroup proxyServiceGroup = axisCfg.getServiceGroup(serviceGroup);
+ if (proxyServiceGroup == null) {
+ // If the specified group does not exist we should create it
+ proxyServiceGroup = new AxisServiceGroup();
+ proxyServiceGroup.setServiceGroupName(serviceGroup);
+ proxyServiceGroup.setParent(axisCfg);
+ // Add the service to the new group and add the group the AxisConfiguration
+ proxyServiceGroup.addService(proxyService);
+ axisCfg.addServiceGroup(proxyServiceGroup);
+ } else {
+ // Simply add the service to the existing group
+ proxyServiceGroup.addService(proxyService);
+ }
+ }
this.setRunning(true);
} catch (AxisFault axisFault) {
try {
@@ -968,6 +987,14 @@
this.fileName = fileName;
}
+ public String getServiceGroup() {
+ return serviceGroup;
+ }
+
+ public void setServiceGroup(String serviceGroup) {
+ this.serviceGroup = serviceGroup;
+ }
+
@Override
public String toString() {
StringBuffer sb = new StringBuffer();