You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ch...@apache.org on 2018/03/29 16:21:31 UTC
hama git commit: 1. add jodatime,
aeron lib. 2. create classes to be used for wrapping related service.
Repository: hama
Updated Branches:
refs/heads/componentization 9ee1751cd -> 98a052b86
1. add jodatime, aeron lib.
2. create classes to be used for wrapping related service.
Project: http://git-wip-us.apache.org/repos/asf/hama/repo
Commit: http://git-wip-us.apache.org/repos/asf/hama/commit/98a052b8
Tree: http://git-wip-us.apache.org/repos/asf/hama/tree/98a052b8
Diff: http://git-wip-us.apache.org/repos/asf/hama/diff/98a052b8
Branch: refs/heads/componentization
Commit: 98a052b860a522b5f56b294a9ae8a0685c1dfe8b
Parents: 9ee1751
Author: ChiaHung Lin <ch...@apache.org>
Authored: Thu Mar 29 18:20:58 2018 +0200
Committer: ChiaHung Lin <ch...@apache.org>
Committed: Thu Mar 29 18:20:58 2018 +0200
----------------------------------------------------------------------
core/pom.xml | 10 +++++
.../org/apache/hama/master/Communicator.scala | 47 ++++++++++++++++++++
.../org/apache/hama/master/Identifier.scala | 32 +++++++++++++
.../org/apache/hama/master/Scheduler.scala | 30 +++++++++++++
.../main/scala/org/apache/hama/util/Utils.scala | 27 +++++++++++
5 files changed, 146 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hama/blob/98a052b8/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 9cf730f..e4ab75d 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -179,6 +179,16 @@
<version>3.0.5</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>2.9.9</version>
+ </dependency>
+ <dependency>
+ <groupId>io.aeron</groupId>
+ <artifactId>aeron-all</artifactId>
+ <version>1.8.2</version>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/hama/blob/98a052b8/core/src/main/scala/org/apache/hama/master/Communicator.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/hama/master/Communicator.scala b/core/src/main/scala/org/apache/hama/master/Communicator.scala
new file mode 100644
index 0000000..4eaae31
--- /dev/null
+++ b/core/src/main/scala/org/apache/hama/master/Communicator.scala
@@ -0,0 +1,47 @@
+/**
+ * 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.hama.master
+
+import org.apache.hama.util.Utils._
+import org.apache.hama.ipc.RPC
+
+case class Address(host: String, port: Int) {
+
+ require(!isEmpty(host), s"Host is not provided!")
+
+ require(isValidPort(port), s"Invalid port range!")
+
+}
+
+trait Communicator {
+
+ def address(): Address
+
+}
+
+object Communicator {
+
+ def create(host: String, port: Int): Communicator =
+ new DefaultCommunicator(Address(host, port))
+
+}
+protected[master] class DefaultCommunicator(addr: Address) extends Communicator {
+
+ override def address(): Address = addr
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hama/blob/98a052b8/core/src/main/scala/org/apache/hama/master/Identifier.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/hama/master/Identifier.scala b/core/src/main/scala/org/apache/hama/master/Identifier.scala
new file mode 100644
index 0000000..b7707da
--- /dev/null
+++ b/core/src/main/scala/org/apache/hama/master/Identifier.scala
@@ -0,0 +1,32 @@
+/**
+ * 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.hama.master
+
+import java.text.SimpleDateFormat
+import java.util.Date
+
+object Identifer {
+
+ def create(): Identifier = {
+ // TODO: supply other mechanism to provide unique id.
+ new Identifier(new SimpleDateFormat("yyyyMMddHHmm").format(new Date()))
+ }
+
+}
+case class Identifier(value: String)
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hama/blob/98a052b8/core/src/main/scala/org/apache/hama/master/Scheduler.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/hama/master/Scheduler.scala b/core/src/main/scala/org/apache/hama/master/Scheduler.scala
new file mode 100644
index 0000000..8d9febf
--- /dev/null
+++ b/core/src/main/scala/org/apache/hama/master/Scheduler.scala
@@ -0,0 +1,30 @@
+/**
+ * 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.hama.master
+
+trait Scheduler
+
+object Scheduler {
+
+ def create(): Scheduler = new DefaultScheduler
+
+}
+
+protected[master] class DefaultScheduler extends Scheduler {
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hama/blob/98a052b8/core/src/main/scala/org/apache/hama/util/Utils.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/hama/util/Utils.scala b/core/src/main/scala/org/apache/hama/util/Utils.scala
new file mode 100644
index 0000000..3bb2ec2
--- /dev/null
+++ b/core/src/main/scala/org/apache/hama/util/Utils.scala
@@ -0,0 +1,27 @@
+/**
+ * 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.hama.util
+
+object Utils {
+
+ def isEmpty(value: String): Boolean =
+ null == value || "".equals(value)
+
+ def isValidPort(value: Int): Boolean =
+ 0 < value && 65535 >= value
+}
\ No newline at end of file