![JAR search and dependency download from the Maven repository](/logo.png)
com.legstar.messaging.AbstractConnectionFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of legstar-messaging Show documentation
Show all versions of legstar-messaging Show documentation
Mainframe message exchange protocol.
/*******************************************************************************
* Copyright (c) 2010 LegSem.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* LegSem - initial API and implementation
******************************************************************************/
package com.legstar.messaging;
/**
* Provides common behavior to all transport connection factories.
*
*/
public abstract class AbstractConnectionFactory implements ConnectionFactory {
/**
* {@inheritDoc}.
* Performs the following steps:
*
* - Clone the endpoint because we are about to modify it and would like endpoints to be immutable
* - Enrich the clone with address related data (user, password, etc)
* - Check that all endpoint parameters are consistent
*
* */
public LegStarConnection createConnection(
final String connectionID,
final LegStarAddress address,
final HostEndpoint endpoint) throws ConnectionException {
HostEndpoint cloneEndpoint = getClone(endpoint);
cloneEndpoint.enrich(address);
cloneEndpoint.checkAll();
return createConnection(connectionID, cloneEndpoint);
}
/**
* Creates a clone of the endpoint parameter.
* @param endpoint the endpoint to clone
* @return a clone
*/
public abstract HostEndpoint getClone(final HostEndpoint endpoint);
/**
* Create a connection.
* @param connectionID the connection identifier
* @param endpoint the host endpoint
* @return a connection to the host
* @throws ConnectionException if something goes wrong
*/
public abstract LegStarConnection createConnection(
final String connectionID,
final HostEndpoint endpoint) throws ConnectionException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy