blob: 7dd8b0a163b755a1231721e2aaa82ad0d148ebea [file] [log] [blame]
// This file automatically generated by:
// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
// Fri Jul 16 12:01:27 CEST 2010
// This file is automatically created and should not be edited!
package etch.cbinding.test;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
import org.apache.etch.bindings.java.support.DeliveryService;
import org.apache.etch.bindings.java.support.Pool;
import org.apache.etch.bindings.java.support.ServerFactory;
import org.apache.etch.bindings.java.msg.ValueFactory;
import org.apache.etch.bindings.java.support.DefaultServerFactory;
import org.apache.etch.util.core.io.Transport;
import org.apache.etch.bindings.java.support.TransportFactory;
import org.apache.etch.bindings.java.support.TransportHelper;
import org.apache.etch.bindings.java.transport.DefaultDeliveryService;
import org.apache.etch.bindings.java.transport.MailboxManager;
import org.apache.etch.bindings.java.transport.PlainMailboxManager;
import org.apache.etch.bindings.java.transport.TransportMessage;
import org.apache.etch.util.Resources;
import org.apache.etch.util.URL;
/**
* Transport helper for helloworld. All methods are static.
*/
abstract public class helloworldHelper extends TransportHelper
{
/**
* Constructs a new server session listener per specifications in uri and
* resources. This listener will accept requests from clients for new server
* sessions.
*
* @param uri contains specifications for the server session listener and
* for the server session transport stack.
*
* @param resources additional resources to aid in constructing new server
* sessions.
*
* @param implFactory factory used to construct a new instance implementing
* helloworldServer. The new instance will receive and process messages from
* the client session.
*
* @return a server session listener.
*
* @throws Exception
*/
public static ServerFactory newListener( final String uri,
final Resources resources, final helloworldServerFactory implFactory )
throws Exception
{
final Resources res = initResources( resources );
final Transport<ServerFactory> listener = TransportFactory.getListener( uri, res );
return new DefaultServerFactory( listener, implFactory )
{
public void newServer( TransportMessage t, String uri, Resources r )
throws Exception
{
ValueFactory vf = (ValueFactory) r.get( Transport.VALUE_FACTORY );
MailboxManager x = new PlainMailboxManager( t, uri, r );
DeliveryService d = new DefaultDeliveryService( x, uri, r );
RemotehelloworldClient client = new RemotehelloworldClient( d, vf );
helloworldServer server = implFactory.newhelloworldServer( client );
Pool qp = (Pool) r.get( QUEUED_POOL );
Pool fp = (Pool) r.get( FREE_POOL );
new StubhelloworldServer( d, server, qp, fp );
client._start();
}
public ValueFactory newValueFactory( String uri )
{
return new ValueFactoryhelloworld( uri );
}
@Override
public String toString()
{
return "helloworldHelper.ServerFactory/" + listener;
}
};
}
/**
* Factory used by
* {@link helloworldHelper#newListener(String, Resources, helloworldServerFactory)}
* to construct a new instance implementing {@link helloworldServer}. The new
* instance will receive and process messages from the client session.
*/
public interface helloworldServerFactory
{
/**
* Constructs a new instance implementing helloworldServer. The new
* instance will receive and process messages from the client session.
*
* @param client an instance of RemotehelloworldClient which may be used to
* send messages to the client session.
* @return a new instance implementing helloworldServer (typically
* ImplhelloworldServer).
* @throws Exception
*/
public helloworldServer newhelloworldServer( RemotehelloworldClient client )
throws Exception;
}
/**
* Constructs a new client session per specifications in uri and resources.
*
* @param uri contains specifications for the client session transport
* stack.
*
* @param resources additional resources to aid in constructing new client
* sessions.
*
* @param implFactory factory used to construct a new instance implementing
* helloworldClient. The new instance will receive and process messages from
* the server session.
*
* @return an instance of RemotehelloworldServer initialized by uri and
* resources which may be used to send messages to the server session.
*
* @throws Exception
*/
public static RemotehelloworldServer newServer( String uri,
Resources resources, helloworldClientFactory implFactory )
throws Exception
{
final Resources res = initResources( resources );
final ValueFactoryhelloworld vf = new ValueFactoryhelloworld( uri );
res.put( Transport.VALUE_FACTORY, vf );
URL u = new URL( uri );
TransportMessage m = TransportFactory.getTransport( uri, res );
MailboxManager r = new PlainMailboxManager( m, u, resources );
DeliveryService d = new DefaultDeliveryService( r, u, resources );
RemotehelloworldServer server = new RemotehelloworldServer( d, vf );
helloworldClient client = implFactory.newhelloworldClient( server );
Pool qp = (Pool) res.get( QUEUED_POOL );
Pool fp = (Pool) res.get( FREE_POOL );
new StubhelloworldClient( d, client, qp, fp );
return server;
}
/**
* Factory used by
* {@link helloworldHelper#newServer(String, Resources, helloworldClientFactory)}
* to construct a new instance implementing {@link helloworldClient}. The new
* instance will receive and process messages from the server session.
*/
public interface helloworldClientFactory
{
/**
* Constructs a new instance implementing helloworldClient. The new
* instance will receive and process messages from the server session.
*
* @param server an instance of RemotehelloworldServer which may be used to
* send messages to the server session.
* @return a new instance implementing helloworldClient (typically
* ImplhelloworldClient).
* @throws Exception
*/
public helloworldClient newhelloworldClient( RemotehelloworldServer server )
throws Exception;
}
}