001    /*
002     * Created on 12-Aug-2005
003     */
004    package org.activemq.transport.https;
005    
006    import java.net.MalformedURLException;
007    import java.net.URI;
008    import java.net.URISyntaxException;
009    
010    import javax.jms.JMSException;
011    
012    import org.activemq.io.WireFormat;
013    import org.activemq.transport.TransportChannel;
014    import org.activemq.transport.http.HttpTransportChannelFactory;
015    import org.activemq.util.JMSExceptionHelper;
016    import org.apache.commons.logging.Log;
017    import org.apache.commons.logging.LogFactory;
018    
019    public class HttpsTransportChannelFactory extends HttpTransportChannelFactory {
020    
021            private static final Log log = LogFactory.getLog( HttpsTransportChannelFactory.class );
022    
023            public TransportChannel create( WireFormat wireFormat, URI remoteLocation ) throws JMSException {
024                    try {
025                            return create( wireFormat, remoteLocation, new URI( "https://localhost:0" ) );
026                    } catch ( URISyntaxException e ) {
027                            throw JMSExceptionHelper.newJMSException( e.getMessage(), e );
028                    }
029            }
030    
031            public TransportChannel create( WireFormat wireFormat, URI remoteLocation, URI localLocation ) throws JMSException {
032                    try {
033                            HttpsTransportChannel channel = new HttpsTransportChannel( asTextWireFormat( wireFormat ), remoteLocation.toString() );
034                            return populateProperties( channel, remoteLocation );
035                    } catch ( MalformedURLException e ) {
036                            throw JMSExceptionHelper.newJMSException( e.getMessage(), e );
037                    }
038            }
039    
040    }