Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: s IT Solutions AT Spardat GmbH - initial API and implementation /
/*
 * Created on 16.05.2003
 */
package at.spardat.xma.boot.transport;
this is the interface for the low level xma transport layer used on xma-client side. At this time only an implementation for HTTP is provided, but additional protocols may be added in the future.

Author(s):
s2877, s3595
Version:
$Id: Transport.java 2084 2007-11-27 14:53:31Z s3460 $
public abstract class Transport {
    
cached implementation
    private static Transport impl;

    
Loads a resource from a server if it has been changed since modifiedSince.

Parameters:
session the session this event belongs to. may be null.
resource unique identification of the resource.
modifiedSince timestamp of last modification.
Returns:
a result that indicates the server response. If a new resource is loaded, the data is stored within the result. the content-length is set, and the buffer can be read by using the method getContent. If no resource is loaded, the result will only contain informational data about the request. e.g. a new expiration date.
Throws:
ConnectException if anything goes wrong in the communication with the server, befor the server changed its state.
ServerException if anything goes wrong in the communication with the server, after the server propably changed its state.
    abstract public Result getResource(IRtXMASessionClient sessionXMA_URI resource,long modifiedSinceString etagthrows CommunicationException;

    
Calls a server side event.

Parameters:
session the session this event belongs to.
eventHandler unique identification of the eventhandler.
input All data that can be read from this InputStream is propagated to the eventhandler.
Returns:
an InputStream pointing to the data send back by the enventhandler.
Throws:
ConnectException if anything goes wrong in the communication with the server, befor the server changed its state.
ServerException if anything goes wrong in the communication with the server, after the server propably changed its state.
    abstract public byte[] callServerEvent(IRtXMASessionClient session,XMA_URI eventHandler,byte[] inputthrows CommunicationException;

    
Get an implementation of Transport. The implementation to use can be configured by the property boot.transport.defaultimpl in the file at/spardat/xma/boot/bootcfg.properties which names the fully qualified class name of the implementation class.

Returns:
a Transport - object.
    static public Transport getTransport() {
        if(==null) {
            Properties props = new Properties();
            try {
                props.load(Transport.class.getClassLoader().getResourceAsStream("at/spardat/xma/boot/bootcfg.properties")); //$NON-NLS-1$
                String trans = props.getProperty("boot.transport.defaultimpl"); //$NON-NLS-1$
                Class transClass = Class.forName(trans);
                 = (Transport)transClass.newInstance();
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException("error reading configuration: ",e); //$NON-NLS-1$
            }
        }
        return ;
    }
New to GrepCode? Check out our FAQ X