From 2a2e7d6d5282cb96993a68018372f441f2bf237f Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Tue, 29 May 2012 14:27:51 +0000 Subject: QPID-4027 Experimental cpp binding. Adding the swig and support files. Adding a connection factor class that loads various implementaitons. git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/address-refactor2@1343747 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/messaging/ConnectionFactory.java | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 qpid/java/client-api/src/main/java/org/apache/qpid/messaging/ConnectionFactory.java (limited to 'qpid/java/client-api') diff --git a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/ConnectionFactory.java b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/ConnectionFactory.java new file mode 100644 index 0000000000..099934789b --- /dev/null +++ b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/ConnectionFactory.java @@ -0,0 +1,52 @@ +/* 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. + */ +package org.apache.qpid.messaging; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Acts as the factory that loads a particular API implementation. + */ +public abstract class ConnectionFactory +{ + private final static ConnectionFactory _instance; + private static final Logger _logger = LoggerFactory.getLogger(ConnectionFactory.class); + + static + { + String className = System.getProperty("qpid.connection-factory", + "org.apache.qpid.messaging.cpp.CppConnectionFactory"); // will default to java + try + { + _instance = (ConnectionFactory) Class.forName(className).newInstance(); + } + catch (Exception e) + { + _logger.error("Error loading connection factory class",e); + throw new Error("Error loading connection factory class",e); + } + } + + public static ConnectionFactory get() + { + return _instance; + } + + public abstract Connection createConnection(String url); +} -- cgit v1.2.1