[jboss-svn-commits] JBL Code SVN: r14196 - in labs/jbossesb/trunk/product/rosetta: src/org/jboss/soa/esb/client and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Aug 14 01:32:12 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-08-14 01:32:12 -0400 (Tue, 14 Aug 2007)
New Revision: 14196
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/ServiceNotFoundException.java
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/RegistryUtil.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/XAbstractFileGateway.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/Invoker.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/Registry.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java
Log:
JBESB-581 adding ServiceNotFoundException handling
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -21,6 +21,7 @@
*/
package org.jboss.internal.soa.esb.services.registry;
+import java.io.UnsupportedEncodingException;
import java.net.PasswordAuthentication;
import java.net.URLDecoder;
import java.net.URLEncoder;
@@ -57,10 +58,13 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
+import org.jboss.soa.esb.MarshalException;
+import org.jboss.soa.esb.UnmarshalException;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.services.registry.Registry;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
/**
* Utility class for the Registry.
* If need be we can extract the interface from here, add a factory and have JAXR as a plugin, allowing
@@ -153,14 +157,14 @@
* Remove an EPR from the Registry
*/
@SuppressWarnings("unchecked")
- public void unRegisterService(String category, String serviceName) throws RegistryException{
+ public void unRegisterService(String category, String serviceName) throws RegistryException, ServiceNotFoundException{
// first find the ServiceBindings for this service
Connection connection = JAXRRegistryImpl.getConnection();
Service service = null;
try {
service = findService(category, serviceName);
if (service==null) {
- throw new RegistryException("No such EPR found for service with name = "
+ throw new ServiceNotFoundException("No such EPR found for service with name = "
+ serviceName);
}
connection.setCredentials(JAXRRegistryImpl.creds);
@@ -169,7 +173,7 @@
Collection<Key> serviceKeys = new ArrayList<Key>();
serviceKeys.add(service.getKey());
blm.deleteServices(serviceKeys);
- } catch (Exception je) {
+ } catch (JAXRException je) {
throw new RegistryException(je.getLocalizedMessage(), je);
} finally {
closeConnection(connection);
@@ -198,43 +202,6 @@
serviceBinding.setDescription(blm.createInternationalString(eprDescription));
String xml = EPRHelper.toXMLString(epr);
serviceBinding.setAccessURI(URLEncoder.encode(xml,"UTF-8"));
-
-// The following code would store the EPR xml as an ExtrinsicObject, but scout does not
-// have an implementation for it.
-// DataHandler repositoryItem = new DataHandler(xml,"text/xml");
-// ExtrinsicObject eo = blm.createExtrinsicObject(repositoryItem);
-// eo.setName(blm.createInternationalString("EPR"));
-// eo.setMimeType("text/xml");
-// String conceptId = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExtrinsicObject:XML";
-// Concept objectTypeConcept = (Concept) bqm.getRegistryObject(conceptId);
-// ((ExtrinsicObjectImpl)eo).setObjectType(objectTypeConcept);
-
-// Concept specConcept = blm.createConcept(null, "HelloConcept", "");
-// String schemeName = "uddi-org:types";
-// ClassificationScheme uddiOrgTypes =
-// bqm.findClassificationSchemeByName(null, schemeName);
-// Classification wsdlSpecClassification =
-// blm.createClassification(uddiOrgTypes,
-// "eprSpec", xml);
-// specConcept.addClassification(wsdlSpecClassification);
-// Collection<Concept> concepts = new ArrayList<Concept>();
-// concepts.add(specConcept);
-// BulkResponse br=blm.saveConcepts(concepts);
-// Key conceptKey = null;
-// if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
-// Collection keys = br.getCollection();
-// for (Iterator i=keys.iterator();i.hasNext();){
-// conceptKey = (Key) i.next();
-// break;
-// }
-// } else {
-// throw new RegistryException("Could not save the EPR as Concept");
-// }
-// //now adding this concept to the binding
-// Concept specificationConcept = (Concept) bqm.getRegistryObject(conceptKey.getId(), LifeCycleManager.CONCEPT);
-// SpecificationLink specificationLink = blm.createSpecificationLink();
-// specificationLink.setSpecificationObject(specificationConcept);
-// serviceBinding.addSpecificationLink(specificationLink);
ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
serviceBindings.add(serviceBinding);
@@ -247,8 +214,12 @@
service.addClassification(classification);
saveRegistryObject(serviceBinding);
- } catch (Exception je) {
+ } catch (JAXRException je) {
throw new RegistryException(je.getLocalizedMessage(), je);
+ } catch (UnsupportedEncodingException uee) {
+ throw new RegistryException(uee.getLocalizedMessage(), uee);
+ } catch (MarshalException me) {
+ throw new RegistryException(me.getLocalizedMessage(), me);
} finally {
closeConnection(connection);
}
@@ -256,14 +227,14 @@
/**
* Remove an EPR from the Registry
*/
- public void unRegisterEPR(String category, String serviceName, EPR toBeDeletedEPR) throws RegistryException{
+ public void unRegisterEPR(String category, String serviceName, EPR toBeDeletedEPR) throws RegistryException, ServiceNotFoundException{
//first find the ServiceBindings for this service
Connection connection = JAXRRegistryImpl.getConnection();
Service service = null;
try {
service = findService(category, serviceName);
if (service==null) {
- throw new RegistryException("No such Service found for service with category= "
+ throw new ServiceNotFoundException("No such Service found for service with category= "
+ category + " and name = " + serviceName);
}
connection.setCredentials(JAXRRegistryImpl.creds);
@@ -283,8 +254,12 @@
}
throw new RegistryException("No such EPR found for service with name = "
+ serviceName + " and EPR=" + toBeDeletedEPR);
- } catch (Exception je) {
+ } catch (JAXRException je) {
throw new RegistryException(je.getLocalizedMessage(), je);
+ } catch (UnsupportedEncodingException uee) {
+ throw new RegistryException(uee.getLocalizedMessage(), uee);
+ } catch (MarshalException me) {
+ throw new RegistryException(me.getLocalizedMessage(), me);
} finally {
closeConnection(connection);
}
@@ -333,14 +308,14 @@
* @param service
* @return
*/
- public List<EPR> findEPRs(String category, String serviceName) throws RegistryException
+ public List<EPR> findEPRs(String category, String serviceName) throws RegistryException, ServiceNotFoundException
{
List<EPR> eprs = new ArrayList<EPR>();
Connection connection = JAXRRegistryImpl.getConnection();
try {
Service service = findService(category, serviceName);
if (service==null){
- throw new RegistryException("Could not find service with category=" + category + " and serviceName=" + serviceName);
+ throw new ServiceNotFoundException("Could not find service with category=" + category + " and serviceName=" + serviceName);
}
// Get registry service and business query manager
Collection<ServiceBinding> serviceBindings = findServiceBindings(service);
@@ -352,8 +327,12 @@
EPR epr = EPRHelper.fromXMLString(eprXML);
eprs.add(epr);
}
- } catch (Exception je) {
+ } catch (JAXRException je) {
throw new RegistryException(je.getLocalizedMessage(), je);
+ } catch (UnsupportedEncodingException uee) {
+ throw new RegistryException(uee.getLocalizedMessage(), uee);
+ } catch (UnmarshalException me) {
+ throw new RegistryException(me.getLocalizedMessage(), me);
} finally {
closeConnection(connection);
}
@@ -364,14 +343,14 @@
* @param service
* @return
*/
- public EPR findEPR(String category, String serviceName) throws RegistryException
+ public EPR findEPR(String category, String serviceName) throws RegistryException, ServiceNotFoundException
{
EPR epr = null;
Connection connection = JAXRRegistryImpl.getConnection();
try {
Service service = findService(category, serviceName);
if (service==null){
- throw new RegistryException("Could not find service with category=" + category + " and serviceName=" + serviceName);
+ throw new ServiceNotFoundException("Could not find service with category=" + category + " and serviceName=" + serviceName);
}
// Get registry service and business query manager
Collection<ServiceBinding> serviceBindings = findServiceBindings(service);
@@ -380,8 +359,12 @@
String eprXML = URLDecoder.decode(serviceBinding.getAccessURI(),"UTF-8");
epr = EPRHelper.fromXMLString(eprXML);
}
- } catch (Exception je) {
+ } catch (JAXRException je) {
throw new RegistryException(je.getLocalizedMessage(), je);
+ } catch (UnsupportedEncodingException uee) {
+ throw new RegistryException(uee.getLocalizedMessage(), uee);
+ } catch (UnmarshalException me) {
+ throw new RegistryException(me.getLocalizedMessage(), me);
} finally {
closeConnection(connection);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -19,6 +19,7 @@
*/
package org.jboss.soa.esb.client;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -47,6 +48,7 @@
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.persistence.MessageStore;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.jboss.soa.esb.util.ClassUtil;
/**
@@ -403,13 +405,16 @@
* @throws MessageDeliverException Registry lookup failure.
*/
public void loadServiceClusterInfo() throws MessageDeliverException {
+ List<EPR> serviceEprs = new ArrayList<EPR>();
try {
- List<EPR> serviceEprs = RegistryUtil.getEprs(service.getCategory(), service.getName());
- serviceClusterInfo = new ServiceClusterInfoImpl(service.getName(), serviceEprs);
- expirationDate = new Date(java.lang.System.currentTimeMillis() + 60000);
+ serviceEprs = RegistryUtil.getEprs(service.getCategory(), service.getName());
+ } catch (ServiceNotFoundException snfe) {
+ logger.info("Service: " + service + " not found in the registry");
} catch (RegistryException e) {
throw new MessageDeliverException(e.getMessage(), e);
}
+ serviceClusterInfo = new ServiceClusterInfoImpl(service.getName(), serviceEprs);
+ expirationDate = new Date(java.lang.System.currentTimeMillis() + 60000);
}
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/RegistryUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/RegistryUtil.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/RegistryUtil.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -37,6 +37,7 @@
import org.jboss.soa.esb.services.registry.Registry;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.services.registry.RegistryFactory;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import com.arjuna.common.util.propertyservice.PropertyManager;
@@ -166,6 +167,9 @@
final Registry registry = RegistryFactory.getRegistry() ;
registry.unRegisterEPR(category, name, epr) ;
}
+ catch (final ServiceNotFoundException snfe) {
+ logger.warn("Failed to unregister service", snfe);
+ }
catch (final RegistryException re)
{
logger.warn("Failed to unregister service", re) ;
@@ -186,7 +190,7 @@
* @throws RegistryException for registration errors.
*/
public static List<EPR> getEprs(final String category, final String name)
- throws RegistryException
+ throws RegistryException, ServiceNotFoundException
{
if ("eprManager".equalsIgnoreCase(category))
{
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -57,6 +57,7 @@
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.jboss.soa.esb.util.ClassUtil;
import org.jboss.soa.esb.util.Util;
@@ -106,6 +107,10 @@
throw new ManagedLifecycleException("EPR <"
+ _targetServiceName + "> not found in registry");
}
+ catch (ServiceNotFoundException snfe) {
+ throw new ManagedLifecycleException("EPR <" + _targetServiceCategory + " "
+ + _targetServiceName + "> not found in registry");
+ }
catch (final RegistryException re) {
throw new ManagedLifecycleException(
"Unexpected registry exception", re);
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -48,6 +48,7 @@
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.jboss.soa.esb.util.ClassUtil;
/**
@@ -104,6 +105,9 @@
m_targetEprs = RegistryUtil.getEprs(m_targetServiceCategory,m_targetServiceName);
if (null == m_targetEprs || m_targetEprs.size() < 1)
throw new ManagedLifecycleException("EPR <" + m_targetServiceName + "> not found in registry") ;
+ } catch (ServiceNotFoundException snfe) {
+ throw new ManagedLifecycleException("EPR <" + m_targetServiceName + " "
+ + m_targetServiceName + "> not found in registry");
} catch (final RegistryException re) {
throw new ManagedLifecycleException("Unexpected registry exception", re) ;
} catch (ConfigurationException e) {
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -61,6 +61,7 @@
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleThreadState;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.jboss.soa.esb.util.ClassUtil;
public class JmsGatewayListener extends AbstractThreadedManagedLifecycle {
@@ -68,7 +69,7 @@
* serial version uid for this class
*/
private static final long serialVersionUID = 5070422864110923930L;
-
+
public JmsGatewayListener(ConfigTree listenerConfig)
throws ConfigurationException {
super(listenerConfig);
@@ -88,7 +89,10 @@
if (null == _targetEprs || _targetEprs.size() < 1)
throw new ManagedLifecycleException("EPR <"
+ _targetServiceName + "> not found in registry");
- }
+ } catch (ServiceNotFoundException snfe) {
+ throw new ManagedLifecycleException("EPR <" + _targetServiceName + " "
+ + _targetServiceName + "> not found in registry");
+ }
catch (final RegistryException re) {
throw new ManagedLifecycleException(
"Unexpected registry exception", re);
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -64,6 +64,7 @@
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.jboss.soa.esb.util.ClassUtil;
import org.jboss.soa.esb.util.Util;
@@ -110,6 +111,10 @@
if (null == _targetEprs || _targetEprs.size() < 1)
throw new ManagedLifecycleException("EPR <"
+ _targetServiceName + "> not found in registry");
+
+ } catch (ServiceNotFoundException snfe) {
+ throw new ManagedLifecycleException("EPR <" + _targetServiceName + " "
+ + _targetServiceName + "> not found in registry");
}
catch (final RegistryException re) {
throw new ManagedLifecycleException(
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/XAbstractFileGateway.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/XAbstractFileGateway.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/XAbstractFileGateway.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -19,6 +19,7 @@
import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.addressing.util.DefaultReplyTo;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.apache.log4j.Logger;
import java.io.File;
@@ -79,6 +80,9 @@
if (null == _targetEprs || _targetEprs.size() < 1)
throw new ManagedLifecycleException("EPR <"
+ _targetServiceName + "> not found in registry");
+ } catch (ServiceNotFoundException snfe) {
+ throw new ManagedLifecycleException("EPR <" + _targetServiceName + " "
+ + _targetServiceName + "> not found in registry");
}
catch (final RegistryException re) {
throw new ManagedLifecycleException(
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/Invoker.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/Invoker.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/Invoker.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -40,6 +40,7 @@
import org.jboss.soa.esb.listeners.RegistryUtil;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
/**
@@ -62,7 +63,7 @@
* @throws CourierException
*/
public static void invoke(Message message, String category, String name)
- throws RegistryException, MalformedEPRException, CourierException
+ throws RegistryException, MalformedEPRException, CourierException, ServiceNotFoundException
{
try { invokeAndAwaitResponse(message,category,name,-1); }
catch (CourierTimeoutException e)
@@ -87,7 +88,7 @@
public static Message invokeAndAwaitResponse(Message message, String category, String name
,int maxWaitMillis)
- throws RegistryException, MalformedEPRException, CourierException, CourierTimeoutException
+ throws RegistryException, MalformedEPRException, CourierException, CourierTimeoutException, ServiceNotFoundException
{
Call call = message.getHeader().getCall();
Collection<EPR> eprs = RegistryUtil.getEprs(category, name);
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -324,7 +324,6 @@
pipeline = null ;
CourierUtil.cleanCourier(_pickUpCourier);
-
RegistryUtil.unregister(_eprCategoryName, _eprName, _epr) ;
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/Registry.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/Registry.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/Registry.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -38,7 +38,7 @@
* @param serviceName - name of the service, for example 'smooks'.
* @throws RegistryException
*/
- public void unRegisterService(String category, String serviceName) throws RegistryException;
+ public void unRegisterService(String category, String serviceName) throws RegistryException, ServiceNotFoundException;
/**
* Registers an EPR under the specified category and service. If the specified service does
* not exist, it will be created at the same time.
@@ -60,7 +60,7 @@
* @param epr - the EndPointReference (EPR) that needs to be unregistered.
* @throws RegistryException
*/
- public void unRegisterEPR(String serviceCategoryName, String serviceName, EPR epr) throws RegistryException;
+ public void unRegisterEPR(String serviceCategoryName, String serviceName, EPR epr) throws RegistryException, ServiceNotFoundException;
/**
* Find all Services assigned to the Red Hat/JBossESB organization.
* @return Collection of Strings containing the service names.
@@ -83,7 +83,7 @@
* @return Collection of EPRs.
* @throws RegistryException
*/
- public List<EPR> findEPRs(String serviceCategoryName, String serviceName) throws RegistryException;
+ public List<EPR> findEPRs(String serviceCategoryName, String serviceName) throws RegistryException, ServiceNotFoundException;
/**
* Returns the first EPR in the list that belong to a specific category and service combination.
*
@@ -92,5 +92,5 @@
* @return EPR.
* @throws RegistryException
*/
- public EPR findEPR(String serviceCategoryName, String serviceName) throws RegistryException;
+ public EPR findEPR(String serviceCategoryName, String serviceName) throws RegistryException, ServiceNotFoundException;
}
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/ServiceNotFoundException.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/ServiceNotFoundException.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/ServiceNotFoundException.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.esb.services.registry;
+
+/**
+ * @author kstam
+ *
+ */
+public class ServiceNotFoundException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ServiceNotFoundException(){
+ super();
+ }
+
+ public ServiceNotFoundException (String msg){
+ super(msg);
+ }
+
+ public ServiceNotFoundException (String msg, Throwable cause){
+ super (msg, cause);
+ }
+}
Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/registry/ServiceNotFoundException.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -53,6 +53,7 @@
import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.jboss.soa.esb.testutils.FileUtil;
import org.jboss.soa.esb.testutils.HsqldbUtil;
import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
@@ -133,7 +134,11 @@
epr, "EPR description");
registry.registerEPR("registry", "Registry Test ServiceName", "Registry Test Service Description",
epr, "EPR description");
- registry.unRegisterEPR("registry", "Registry Test ServiceName", epr);
+ try {
+ registry.unRegisterEPR("registry", "Registry Test ServiceName", epr);
+ } catch (ServiceNotFoundException snfe) {
+ logger.warn("Failed to find Service for unregistering.", snfe);
+ }
} catch (RegistryException re) {
logger.error(re.getLocalizedMessage(), re);
assertTrue(false);
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -26,6 +26,7 @@
import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
public class RegistryUtilUnitTest extends ListenerManagerBaseTest
{
@@ -88,6 +89,10 @@
{
RegistryUtil.getEprs("foobar", "test");
}
+ catch (ServiceNotFoundException ex)
+ {
+ exception = true;
+ }
catch (RegistryException ex)
{
exception = true;
@@ -130,6 +135,9 @@
fail();
}
+ catch (ServiceNotFoundException ex)
+ {
+ }
catch (RegistryException ex)
{
}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java 2007-08-14 04:38:35 UTC (rev 14195)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java 2007-08-14 05:32:12 UTC (rev 14196)
@@ -109,7 +109,7 @@
* Find the EPRs for this service.
*/
@Test
- public void findEPRs()
+ public void findEPRs() throws ServiceNotFoundException
{
try {
Registry registry = RegistryFactory.getRegistry();
More information about the jboss-svn-commits
mailing list