You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/01/28 16:01:19 UTC

svn commit: r904111 - in /tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/ src/...

Author: antelder
Date: Thu Jan 28 15:01:18 2010
New Revision: 904111

URL: http://svn.apache.org/viewvc?rev=904111&view=rev
Log:
Add another endpoint registry impl this time using the Hazelcast native client to connect to an existing domain hazelcast cluster

Added:
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/   (with props)
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/META-INF/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/pom.xml
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/META-INF/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/META-INF/services/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/org/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/org/apache/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/org/apache/tuscany/sca/endpoint/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/org/apache/tuscany/sca/endpoint/hazelcast/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/java/org/apache/tuscany/sca/endpoint/hazelcast/client/
    tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/test/resources/

Propchange: tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 28 15:01:18 2010
@@ -0,0 +1,20 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+derby.log
+maven.log
+maven-eclipse.xml
+build.xml
+build-dependency.xml
+velocity.log*
+junit*.properties
+surefire*.properties
+.project
+.classpath
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders

Added: tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/META-INF/MANIFEST.MF?rev=904111&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/META-INF/MANIFEST.MF (added)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/META-INF/MANIFEST.MF Thu Jan 28 15:01:18 2010
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+SCA-Version: 1.1
+Bundle-Name: Apache Tuscany SCA Hazelcast Client Based EndPoint Registry
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany Hazelcast Client Endpoint Regsitry
+Bundle-SymbolicName: org.apache.tuscany.sca.endpoint.hazelcast.client
+Bundle-DocURL: http://www.apache.org/
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Import-Package: com.hazelcast.client,
+ org.apache.tuscany.sca.assembly;version="2.0.0",
+ org.apache.tuscany.sca.core;version="2.0.0",
+ org.apache.tuscany.sca.endpoint.hazelcast;version="2.0.0",
+ org.apache.tuscany.sca.runtime;version="2.0.0"
+Export-Package: org.apache.tuscany.sca.endpoint.hazelcast.client;version="2.0.0";
+ uses:="org.apache.tuscany.sca.runtime,org.apache.tuscany.sca.assembly,org.apache.tuscany.sca.core,org.apache.tuscany.sca.endpoint.hazelcast"

Added: tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/pom.xml?rev=904111&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/pom.xml Thu Jan 28 15:01:18 2010
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-modules</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>tuscany-endpoint-hazelcast-client</artifactId>
+    <name>Apache Tuscany SCA EndPoint Registry using Hazelcast Native Client</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.hazelcast</groupId>
+            <artifactId>hazelcast-client</artifactId>
+            <version>1.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-endpoint-hazelcast</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Added: tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java?rev=904111&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java Thu Jan 28 15:01:18 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.tuscany.sca.endpoint.hazelcast.client;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.endpoint.hazelcast.HazelcastEndpointRegistry;
+
+import com.hazelcast.client.HazelcastClient;
+
+/**
+ * An EndpointRegistry using a Hazelcast Native Client
+ */
+public class HazelcastClientEndpointRegistry extends HazelcastEndpointRegistry {
+
+    HazelcastClient hazelcastClient;
+
+    public HazelcastClientEndpointRegistry(ExtensionPointRegistry registry,
+                                     Map<String, String> attributes,
+                                     String domainRegistryURI,
+                                     String domainURI) {
+        super(registry, attributes, domainURI, domainRegistryURI);
+    }
+
+    @Override
+    public void start() {
+        if (map != null) {
+            throw new IllegalStateException("The registry has already been started");
+        }
+        initHazelcastClientInstance();
+        map = hazelcastClient.getMap(configURI.getDomainName() + "/Endpoints");
+    }
+
+    @Override
+    public void stop() {
+        if (hazelcastClient != null) {
+            hazelcastClient.shutdown();
+            hazelcastClient = null;
+            map = null;
+        }
+    }
+
+    private void initHazelcastClientInstance() {
+        if (configURI.getRemotes().size() < 1) {
+            throw new IllegalArgumentException("Must specify remote IP address(es) for domain");
+        }
+        this.hazelcastClient = HazelcastClient.newHazelcastClient(configURI.getDomainName(), configURI.getPassword(), configURI.getRemotes().toArray(new String[0]));
+    }
+}

Added: tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry?rev=904111&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry (added)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-hazelcast-client/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry Thu Jan 28 15:01:18 2010
@@ -0,0 +1,18 @@
+# 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.
+org.apache.tuscany.sca.endpoint.hazelcast.client.HazelcastClientEndpointRegistry;ranking=150,scheme=tuscanyClient
+