diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2012-05-29 14:27:51 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2012-05-29 14:27:51 +0000 |
| commit | 2a2e7d6d5282cb96993a68018372f441f2bf237f (patch) | |
| tree | e5549c98f858978db92113bbd1396e1d9be96c1d /qpid/java/client-api | |
| parent | 0c75e80891ea82c362f8c3d049c0ef4341afb373 (diff) | |
| download | qpid-python-2a2e7d6d5282cb96993a68018372f441f2bf237f.tar.gz | |
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
Diffstat (limited to 'qpid/java/client-api')
| -rw-r--r-- | qpid/java/client-api/src/main/java/org/apache/qpid/messaging/ConnectionFactory.java | 52 |
1 files changed, 52 insertions, 0 deletions
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); +} |
