summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2007-03-30 17:14:40 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2007-03-30 17:14:40 +0000
commitafda7906499d1ab997fe9b2d3cddd66d0328a055 (patch)
treeb8ed8d71229f15da0e6aa078fc86a92f6547b16f
parente97c9492b410c791f13d29e8cfec2103df164e3d (diff)
downloadqpid-python-afda7906499d1ab997fe9b2d3cddd66d0328a055.tar.gz
added an abstract class factory to create concrete AMQP classes
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/client_restructure@524182 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPCallBack.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPChannel.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPConnection.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPExchange.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPMessage.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPQueue.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AbstractAMQPClassFactory.java41
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/MessageHelper.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/SecurityHelper.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/StateHelper.java20
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/TestClient.java6
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/config/client.xml1
-rw-r--r--java/newclient/src/main/java/org/apache/qpid/nclient/core/QpidConstants.java46
13 files changed, 257 insertions, 17 deletions
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPCallBack.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPCallBack.java
index 49575be8d2..a733fb7db7 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPCallBack.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPCallBack.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp;
import org.apache.qpid.AMQException;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPChannel.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPChannel.java
index 3c92af9619..cbb60b130d 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPChannel.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPChannel.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp;
import org.apache.qpid.framing.ChannelCloseBody;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPConnection.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPConnection.java
index 99eb690ede..b18fed5605 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPConnection.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPConnection.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp;
import org.apache.qpid.framing.AMQMethodBody;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPExchange.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPExchange.java
index f59ad5acf5..c2f93b8f42 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPExchange.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPExchange.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp;
import org.apache.qpid.framing.ExchangeDeclareBody;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPMessage.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPMessage.java
index 6f21ca2507..61c5825fe0 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPMessage.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPMessage.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp;
import org.apache.qpid.framing.MessageAppendBody;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPQueue.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPQueue.java
index 4559b1f96c..ff26c6adf5 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPQueue.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AMQPQueue.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp;
import org.apache.qpid.framing.QueueBindBody;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AbstractAMQPClassFactory.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AbstractAMQPClassFactory.java
new file mode 100644
index 0000000000..6d0e83bb7e
--- /dev/null
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/AbstractAMQPClassFactory.java
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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.nclient.amqp;
+
+import org.apache.qpid.nclient.config.ClientConfiguration;
+import org.apache.qpid.nclient.core.AMQPException;
+import org.apache.qpid.nclient.core.QpidConstants;
+
+public class AbstractAMQPClassFactory
+{
+ public static AMQPClassFactory getFactoryInstance() throws AMQPException
+ {
+ String className = ClientConfiguration.get().getString(QpidConstants.AMQP_CLASS_FACTORY);
+ try
+ {
+ return (AMQPClassFactory)Class.forName(className).newInstance();
+ }
+ catch(Exception e)
+ {
+ throw new AMQPException("Error creating AMQPClassFactory",e);
+ }
+ }
+}
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/MessageHelper.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/MessageHelper.java
index 528b47beb4..31a0197ab1 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/MessageHelper.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/MessageHelper.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp.sample;
import org.apache.qpid.framing.MessageAppendBody;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/SecurityHelper.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/SecurityHelper.java
index 8c4cb56971..908f0adee0 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/SecurityHelper.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/SecurityHelper.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp.sample;
import java.io.UnsupportedEncodingException;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/StateHelper.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/StateHelper.java
index 43f096a062..04714d7278 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/StateHelper.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/StateHelper.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.nclient.amqp.sample;
import org.apache.qpid.nclient.amqp.state.AMQPStateChangedEvent;
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/TestClient.java b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/TestClient.java
index 4d4fadcc22..3dce1cde1e 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/TestClient.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/amqp/sample/TestClient.java
@@ -65,7 +65,7 @@ import org.apache.qpid.nclient.amqp.AMQPConnection;
import org.apache.qpid.nclient.amqp.AMQPExchange;
import org.apache.qpid.nclient.amqp.AMQPMessage;
import org.apache.qpid.nclient.amqp.AMQPQueue;
-import org.apache.qpid.nclient.amqp.qpid.QpidAMQPClassFactory;
+import org.apache.qpid.nclient.amqp.AbstractAMQPClassFactory;
import org.apache.qpid.nclient.amqp.state.AMQPStateType;
import org.apache.qpid.nclient.transport.AMQPConnectionURL;
import org.apache.qpid.nclient.transport.ConnectionURL;
@@ -91,12 +91,14 @@ public class TestClient
private static int _channel = 2;
// Need a Class factory per connection
- private AMQPClassFactory _classFactory = new QpidAMQPClassFactory();
+ private AMQPClassFactory _classFactory;
private int _ticket;
public AMQPConnection openConnection() throws Exception
{
+ _classFactory = AbstractAMQPClassFactory.getFactoryInstance();
+
//_url = new AMQPConnectionURL("amqp://guest:guest@test/localhost?brokerlist='vm://:3'");
_url = new AMQPConnectionURL("amqp://guest:guest@test/test?brokerlist='tcp://localhost:5672?'");
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/config/client.xml b/java/newclient/src/main/java/org/apache/qpid/nclient/config/client.xml
index 93e6f38074..6eeedbe1ff 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/config/client.xml
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/config/client.xml
@@ -25,6 +25,7 @@
<!-- Model Phase properties -->
<serverTimeoutInMilliSeconds>60000</serverTimeoutInMilliSeconds>
+ <amqpClassFactory>org.apache.qpid.nclient.amqp.qpid.QpidAMQPClassFactory</amqpClassFactory>
<maxAccumilatedResponses>20</maxAccumilatedResponses>
<phasePipe>
diff --git a/java/newclient/src/main/java/org/apache/qpid/nclient/core/QpidConstants.java b/java/newclient/src/main/java/org/apache/qpid/nclient/core/QpidConstants.java
index 9998fda6bb..034fc28070 100644
--- a/java/newclient/src/main/java/org/apache/qpid/nclient/core/QpidConstants.java
+++ b/java/newclient/src/main/java/org/apache/qpid/nclient/core/QpidConstants.java
@@ -1,51 +1,67 @@
package org.apache.qpid.nclient.core;
-public interface QpidConstants {
-
- // Common properties
+public interface QpidConstants
+{
+
+ // Common properties
public static long EMPTY_CORRELATION_ID = -1;
+
public static int CHANNEL_ZERO = 0;
+
public static String CONFIG_FILE_PATH = "ConfigFilePath";
-
+
// Phase Context properties
public final static String AMQP_BROKER_DETAILS = "AMQP_BROKER_DETAILS";
+
public final static String MINA_IO_CONNECTOR = "MINA_IO_CONNECTOR";
+
public final static String EVENT_MANAGER = "EVENT_MANAGER";
-
+
/**---------------------------------------------------------------
* Configuration file properties
* ------------------------------------------------------------
- */
-
+ */
+
// Model Layer properties
-
public final static String SERVER_TIMEOUT_IN_MILLISECONDS = "serverTimeoutInMilliSeconds";
+ public final static String AMQP_CLASS_FACTORY = "amqpClassFactory";
// MINA properties
public final static String USE_SHARED_READ_WRITE_POOL = "useSharedReadWritePool";
+
public final static String ENABLE_DIRECT_BUFFERS = "enableDirectBuffers";
+
public final static String ENABLE_POOLED_ALLOCATOR = "enablePooledAllocator";
+
public final static String TCP_NO_DELAY = "tcpNoDelay";
+
public final static String SEND_BUFFER_SIZE_IN_KB = "sendBufferSizeInKb";
+
public final static String RECEIVE_BUFFER_SIZE_IN_KB = "reciveBufferSizeInKb";
-
+
// Security properties
public final static String AMQP_SECURITY_SASL_CLIENT_FACTORY_TYPES = "saslClientFactoryTypes";
- public final static String AMQP_SECURITY_SASL_CLIENT_FACTORY = "saslClientFactory";
+
+ public final static String AMQP_SECURITY_SASL_CLIENT_FACTORY = "saslClientFactory";
+
public final static String TYPE = "[@type]";
-
- public final static String AMQP_SECURITY = "security";
+
+ public final static String AMQP_SECURITY = "security";
+
public final static String AMQP_SECURITY_MECHANISMS = "securityMechanisms";
+
public final static String AMQP_SECURITY_MECHANISM_HANDLER = "securityMechanismHandler";
-
+
// Execution Layer properties
public final static String MAX_ACCUMILATED_RESPONSES = "maxAccumilatedResponses";
-
+
//Transport Layer properties
public final static String QPID_VM_BROKER_CLASS = "qpidVMBrokerClass";
-
+
//Phase pipe properties
public final static String PHASE_PIPE = "phasePipe";
+
public final static String PHASE = "phase";
+
public final static String INDEX = "[@index]";
}