You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/03 15:50:35 UTC
incubator-ignite git commit: #nodejs: wip.
Repository: incubator-ignite
Updated Branches:
refs/heads/nodejs [created] 45bfba30b
#nodejs: wip.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/45bfba30
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/45bfba30
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/45bfba30
Branch: refs/heads/nodejs
Commit: 45bfba30b5ade47797de484886500869617c58e1
Parents: 97d0bc1
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jun 3 16:48:48 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jun 3 16:48:48 2015 +0300
----------------------------------------------------------------------
examples/config/example-ignite.xml | 26 ++++++++++---
examples/pom.xml | 6 +++
.../org/apache/ignite/examples/ClinetTest.java | 39 +++++++++++++++++++
.../src/test/resources/jetty/rest-jetty.xml | 40 ++++----------------
4 files changed, 73 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45bfba30/examples/config/example-ignite.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-ignite.xml b/examples/config/example-ignite.xml
index e746e59..8574dfb 100644
--- a/examples/config/example-ignite.xml
+++ b/examples/config/example-ignite.xml
@@ -31,6 +31,17 @@
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Set to true to enable distributed class loading for examples, default is false. -->
<property name="peerClassLoadingEnabled" value="true"/>
+ <property name="cacheConfiguration">
+ <list>
+ <!-- Partitioned cache example configuration (Atomic mode). -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="mycache"/>
+ <property name="atomicityMode" value="ATOMIC"/>
+ <property name="backups" value="1"/>
+ </bean>
+ </list>
+ </property>
+
<property name="marshaller">
<bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
@@ -39,6 +50,12 @@
</bean>
</property>
+ <property name="connectorConfiguration">
+ <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
+ <property name="jettyPath" value="modules\clients\src\test\resources\jetty\rest-jetty.xml"/>
+ </bean>
+ </property>
+
<!-- Enable task execution events for examples. -->
<property name="includeEventTypes">
<list>
@@ -69,12 +86,9 @@
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
<!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47509</value>
- </list>
- </property>
+ <constructor-arg>
+ <value>true</value>
+ </constructor-arg>
</bean>
</property>
</bean>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45bfba30/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 2b2bfeb..a7c1c96 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -45,6 +45,12 @@
<dependency>
<groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-rest-http</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
<artifactId>ignite-hibernate</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45bfba30/examples/src/main/java/org/apache/ignite/examples/ClinetTest.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ClinetTest.java b/examples/src/main/java/org/apache/ignite/examples/ClinetTest.java
new file mode 100644
index 0000000..cc70ad9
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/ClinetTest.java
@@ -0,0 +1,39 @@
+package org.apache.ignite.examples;
+
+import java.io.*;
+import java.net.*;
+import java.nio.charset.*;
+import java.util.*;
+
+/**
+ * Created by GridGain on 03.06.2015.
+ */
+public class ClinetTest {
+ private static final String HOST = "127.0.0.1";
+
+ /** Http port. */
+ private static final int HTTP_PORT = 9090;
+
+ /** Url address to send HTTP request. */
+ private static final String TEST_URL = "http://" + HOST + ":" + HTTP_PORT + "/ignite";
+
+
+ /** Used to sent request charset. */
+ private static final String CHARSET = StandardCharsets.UTF_8.name();
+
+
+ public static void main(String[] args) throws Exception {
+ String qry = "cmd=version";
+
+ URLConnection connection = new URL(TEST_URL + "?" + qry).openConnection();
+
+ connection.setRequestProperty("Accept-Charset", CHARSET);
+
+ BufferedReader r = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+
+ String res = r.readLine();
+
+ r.close();
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45bfba30/modules/clients/src/test/resources/jetty/rest-jetty.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/jetty/rest-jetty.xml b/modules/clients/src/test/resources/jetty/rest-jetty.xml
index bbb68a4..e31304f 100644
--- a/modules/clients/src/test/resources/jetty/rest-jetty.xml
+++ b/modules/clients/src/test/resources/jetty/rest-jetty.xml
@@ -1,24 +1,5 @@
<?xml version="1.0"?>
-
-<!--
- 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.
--->
-
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
-
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Arg name="threadPool">
<!-- Default queued blocking thread pool -->
@@ -27,19 +8,17 @@
<Set name="maxThreads">200</Set>
</New>
</Arg>
-
<New id="httpCfg" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme">https</Set>
<Set name="securePort">8443</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
</New>
-
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server"/></Arg>
- <Arg>
+ <Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
@@ -48,19 +27,17 @@
</Item>
</Array>
</Arg>
- <!--
- Note that in order to override local host and port values,
- system properties must have names IGNITE_JETTY_HOST and
- IGNITE_JETTY_PORT accordingly.
- -->
- <Set name="host"><SystemProperty name="IGNITE_JETTY_HOST" default="localhost"/></Set>
- <Set name="port"><SystemProperty name="IGNITE_JETTY_PORT" default="11080"/></Set>
+ <Set name="host">
+ <SystemProperty name="IGNITE_JETTY_HOST" default="localhost"/>
+ </Set>
+ <Set name="port">
+ <SystemProperty name="IGNITE_JETTY_PORT" default="9090"/>
+ </Set>
<Set name="idleTimeout">30000</Set>
<Set name="reuseAddress">true</Set>
</New>
</Arg>
</Call>
-
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
@@ -72,6 +49,5 @@
</Set>
</New>
</Set>
-
<Set name="stopAtShutdown">false</Set>
-</Configure>
+</Configure>
\ No newline at end of file