Author: mmerz Date: Tue Nov 23 11:00:12 2004 New Revision: 106328 Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java Log: Contributor: Wolfgang
Don't allow service implementation bean to be a Java interface. Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java?view=diff&rev=106328&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r1=106327&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r2=106328 ============================================================================== --- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java (original) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java Tue Nov 23 11:00:12 2004 @@ -416,36 +416,47 @@ /** * Checks whether the implementation bean implements all the methods - * specified in the endpointInterface. + * specified by the endpoint interface. * * @throws ValidationException */ public void validate() throws ValidationException { + // note: load class here -- we might want to create the object model without a sib class file (from source) - // if we have a service endpoint interface - if (0 < seiClassName.length()) { - try { - // load endpoint interface - Class sibClass = Class.forName(sibClassName); + try { + + // load and verify service implementation bean + Class sibClass = Class.forName(sibClassName); + if (sibClass.isInterface()) { + throw new ValidationException( + "The service implementation bean (" + + sibClassName + + " ) cannot be an interface." + ); + } + + // load and verify service endpoint interface -- if we have one + if (0 < seiClassName.length()) { Class seiClass = Class.forName(seiClassName); - - // verify that bean implements all methods specified in interface for (Method m : seiClass.getMethods()) { - if (!doesImplement(sibClass, m)) { - throw new ValidationException("The implementation bean doesn't implement " + - m + - " as required by the interface: " + - getServiceImplementationBean()); + if (! doesImplement(sibClass, m)) { + throw new ValidationException( + "The implementation bean doesn't implement " + + m + + " as required by the interface: " + + getServiceImplementationBean() + ); } } - } catch (ClassNotFoundException e) { - throw new ValidationException("endpoint interface (" + - seiClassName + - ") or implementation bean (" + - sibClassName + - ") not on classpath"); } + } + catch (ClassNotFoundException e) { + throw new ValidationException( + "service implementation bean (" + sibClassName + ") " + + "or service endpoint interface (" + seiClassName + ") " + + "not on classpath" + ); } validateDuplicatedMethods();
