@Override
    protected Destination createDestination(String destinationId, MessageBroker broker) {
        Assert.notNull(this.service, "The 'service' property is required.");
        String source = null;
        if (this.service instanceof String) {
            String beanId = (String) service;
            this.service = getBeanFactory().getBean(beanId);
            this.sourceClass = AopUtils.getTargetClass(this.service);
            //As of Spring 3.0.2, AopUtils is guaranteed not to return null
            if (this.sourceClass == null || Proxy.isProxyClass(this.sourceClass)) {
                this.sourceClass = getBeanFactory().getType(beanId);
            }
        } else {
            this.sourceClass = AopUtils.getTargetClass(this.service);
        }
        if (this.sourceClass != null) {
            source = this.sourceClass.getName();
        } else {
            if (log.isWarnEnabled()) {
                log.warn("The source class being exported as RemotingDestination with id '"+destinationId+"' cannot be calculated.");
            }
        }

        // Look up the remoting service
        RemotingService remotingService = (RemotingService) broker.getServiceByType(RemotingService.class.getName());
        Assert.notNull(remotingService, "Could not find a proper RemotingService in the Flex MessageBroker.");

        // Register and start the destination
        RemotingDestination destination = (RemotingDestination) remotingService.createDestination(destinationId);

        destination.setFactory(this);
        destination.setSource(source);

        if (log.isInfoEnabled()) {
            log.info("Created remoting destination with id '" + destinationId + "'");
        }

        return destination;
    }
@ Override protected Destination createDestination ( String destinationId , MessageBroker broker ) { Assert . notNull ( this . service , "The 'service' property is required." ) ; String source = null ; if ( this . service instanceof String ) { String beanId = ( String ) service ; this . service = getBeanFactory ( ) . getBean ( beanId ) ; this . sourceClass = AopUtils . getTargetClass ( this . service ) ; if ( this . sourceClass == null || Proxy . isProxyClass ( this . sourceClass ) ) { this . sourceClass = getBeanFactory ( ) . getType ( beanId ) ; } } else { this . sourceClass = AopUtils . getTargetClass ( this . service ) ; } if ( this . sourceClass != null ) { source = this . sourceClass . getName ( ) ; } else { if ( log . isWarnEnabled ( ) ) { log . warn ( "The source class being exported as RemotingDestination with id '" + destinationId + "' cannot be calculated." ) ; } } RemotingService remotingService = ( RemotingService ) broker . getServiceByType ( RemotingService . class . getName ( ) ) ; Assert . notNull ( remotingService , "Could not find a proper RemotingService in the Flex MessageBroker." ) ; RemotingDestination destination = ( RemotingDestination ) remotingService . createDestination ( destinationId ) ; destination . setFactory ( this ) ; destination . setSource ( source ) ; if ( log . isInfoEnabled ( ) ) { log . info ( "Created remoting destination with id '" + destinationId + "'" ) ; } return destination ; }
{@inheritDoc}