You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2014/03/22 00:19:41 UTC
[03/71] [abbrv] fixing STREAMS-26 branch
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-storm/pom.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-storm/pom.xml b/trunk/streams-storm/pom.xml
deleted file mode 100644
index fb8f8a2..0000000
--- a/trunk/streams-storm/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?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
- ~
- ~ 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 xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>streams-project</artifactId>
- <groupId>org.apache.streams</groupId>
- <version>0.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>streams-storm</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-config</artifactId>
- <version>0.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-core</artifactId>
- <version>0.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-config-graph</artifactId>
- <version>0.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-util</artifactId>
- <version>0.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- <version>4.0</version>
- </dependency>
- <dependency>
- <groupId>storm</groupId>
- <artifactId>storm-core</artifactId>
- </dependency>
- <dependency>
- <groupId>storm</groupId>
- <artifactId>storm-netty</artifactId>
- </dependency>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- <version>2.9.2</version>
- <scope>compile</scope>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>com.101tec</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.2</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <testSourceDirectory>src/test/java</testSourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java
----------------------------------------------------------------------
diff --git a/trunk/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java b/trunk/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java
deleted file mode 100644
index a0ad2ea..0000000
--- a/trunk/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java
+++ /dev/null
@@ -1,196 +0,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
- *
- * 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.streams.storm;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.typesafe.config.Config;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.streams.config.StreamsConfigurator;
-import org.apache.streams.util.RegexUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created with IntelliJ IDEA.
- * User: sblackmon
- * Date: 9/20/13
- * Time: 11:17 AM
- * To change this template use File | Settings | File Templates.
- */
-public class PipelineGraphLauncher {
-
- private static final Logger log = LoggerFactory.getLogger(PipelineGraphLauncher.class);
-
- private static Config streamsConfiguration;
-
- private static List<Pair<String,Class>> topologies;
-
- private static List<Pair<String,Class>> resolveClasses(List<Pair<String,String>> topologyPairs) throws IOException, ClassNotFoundException {
-
- List<Pair<String,Class>> topologies = new ArrayList<Pair<String,Class>>();
-
- for( Pair<String,String> pair : topologyPairs ) {
- String topologyId = pair.getLeft();
- Class topologyClass = Class.forName(pair.getRight());
- topologies.add(new ImmutablePair(topologyId, topologyClass));
- }
-
- return topologies;
- }
-
- private static List<Pair<String,Class>> loadTopologiesFromPipelineTopologyListFile(File file) throws IOException, ClassNotFoundException {
-
- List<String> lines = IOUtils.readLines(FileUtils.openInputStream(file));
- String pattern = "^([\\w-]*)[\\s]*?([\\w.]*)$";
-
- List<Pair<String,String>> topologyPairs = RegexUtils.getTwoMatchedGroupsList(lines, pattern);
-
- topologies = resolveClasses(topologyPairs);
-
- for( Pair<String,String> pair : topologyPairs ) {
- String topologyId = pair.getLeft();
- Class topologyClass = Class.forName(pair.getRight());
- topologies.add(new ImmutablePair(topologyId, topologyClass));
- }
-
- return topologies;
- }
-
- private static List<Pair<String,Class>> loadTopologiesFromPipelineGraphFile(File file) throws IOException, ClassNotFoundException {
-
- List<String> lines = IOUtils.readLines(FileUtils.openInputStream(file));
- String pattern = "$([\\w-]*)\\s([\\w.)";
-
- List<Pair<String,String>> topologyPairs = RegexUtils.getTwoMatchedGroupsList(lines, pattern);
-
- topologies = resolveClasses(topologyPairs);
-
- return topologies;
- }
-
- public static boolean isLocal(String[] args) {
- if(args.length >= 1 && args[1].equals("deploy"))
- return false;
- else return true;
- }
-
- public static void main(String[] args) throws Exception {
-
- if(args.length < 3) {
- log.error("Not enough arguments");
- log.error(" storm {local,deploy} <pipelinedef>");
- return;
- }
- if(!args[1].equals("deploy")) {
- log.error("Not a deploy");
- log.error(" storm {local,deploy} <pipelinedef>");
- return;
- }
-
- ObjectMapper mapper = new ObjectMapper();
-
- URL configFileUrl = PipelineGraphLauncher.class.getResource(args[0]);
-
- File configFile;
- try {
- configFile = new File(configFileUrl.toURI());
- } catch(URISyntaxException e) {
- configFile = new File(configFileUrl.getPath());
- }
-
- streamsConfiguration = StreamsConfigurator.config;
-
-// String pipelineIdentifier = streamsConfiguration.getPipeline();
-//
-// for( Map.Entry<String, Object> moduleConfig : streamsConfiguration.getAdditionalProperties().entrySet()) {
-//
-// }
-
-// each defined graph becomes a topology
-
-//
-// URL pipelineFileUrl = PipelineGraphLauncher.class.getResource(args[1]);
-//
-// File pipelineFile;
-// try {
-// pipelineFile = new File(pipelineFileUrl.toURI());
-// } catch(URISyntaxException e) {
-// pipelineFile = new File(pipelineFileUrl.getPath());
-// }
-//
-// topologies = loadTopologiesFromPipelineTopologyListFile(pipelineFile);
-//
-// for( Pair<String,Class> topology : topologies ) {
-// Class topologyClass = topology.getRight();
-//
-// try {
-// Constructor ctor = topologyClass.getDeclaredConstructor(
-// String.class,
-// StreamsConfiguration.class);
-// ctor.setAccessible(true);
-// Object topologyObject = ctor.newInstance(pipelineIdentifier, streamsConfiguration);
-// Runnable runnable = (Runnable) topologyObject;
-// runnable.run();
-// } catch (InstantiationException x) {
-// log.warn(x.getMessage());
-// x.printStackTrace();
-// } catch (IllegalAccessException x) {
-// log.warn(x.getMessage());
-// x.printStackTrace();
-// } catch (InvocationTargetException x) {
-// log.warn(x.getMessage());
-// x.printStackTrace();
-// } catch (NoSuchMethodException x) {
-// log.warn(x.getMessage());
-// x.printStackTrace();
-//
-// try {
-// Constructor ctor = topologyClass.getDeclaredConstructor(
-// String[].class);
-// ctor.setAccessible(true);
-// Object topologyObject = ctor.newInstance(args);
-// Method main = topologyClass.getMethod("main", String[].class);
-// main.invoke(topologyObject, args);
-// } catch (InstantiationException x2) {
-// log.warn(x2.getMessage());
-// x.printStackTrace();
-// } catch (IllegalAccessException x2) {
-// log.warn(x2.getMessage());
-// x.printStackTrace();
-// } catch (InvocationTargetException x2) {
-// log.warn(x2.getMessage());
-// x.printStackTrace();
-// } catch (NoSuchMethodException x2) {
-// log.error(x2.getMessage());
-// x.printStackTrace();
-// }
-// }
-// }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsPersistWriterState.java
----------------------------------------------------------------------
diff --git a/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsPersistWriterState.java b/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsPersistWriterState.java
deleted file mode 100644
index dd360d6..0000000
--- a/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsPersistWriterState.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.streams.storm.trident;
-
-import backtype.storm.task.IMetricsContext;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.streams.core.StreamsDatum;
-import org.apache.streams.core.StreamsPersistWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import storm.trident.operation.TridentCollector;
-import storm.trident.state.BaseStateUpdater;
-import storm.trident.state.State;
-import storm.trident.state.StateFactory;
-import storm.trident.tuple.TridentTuple;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-
-/**
- * Created by sblackmon on 1/16/14.
- */
-public class StreamsPersistWriterState implements State {
-
- private final static Logger LOGGER = LoggerFactory.getLogger(StreamsPersistWriterState.class);
-
- StreamsPersistWriter writer;
- StreamsPersistStateController controller;
-
- public StreamsPersistWriterState(StreamsPersistStateController controller) {
- this.controller = new StreamsPersistStateController();
- writer.start();
- }
-
- public void bulkMessages(List<TridentTuple> tuples) {
- for (TridentTuple tuple : tuples) {
- StreamsDatum entry = this.controller.fromTuple(tuple);
- try {
- writer.write(entry);
- } catch (Exception e) {
- LOGGER.error("Exception writing entry : {}", e, entry);
- }
- }
- LOGGER.debug("******** Ending commit");
- }
-
- @Override
- public void beginCommit(Long aLong) {
-
- }
-
- @Override
- public void commit(Long aLong) {
-
- }
-
- public static class Factory implements StateFactory {
-
- private Logger logger;
- private StreamsPersistStateController controller;
-
- public Factory(StreamsPersistWriter writer, StreamsPersistStateController controller) {
- this.controller = controller;
- this.logger = LoggerFactory.getLogger(Factory.class);
- }
-
- @Override
- public State makeState(Map map, IMetricsContext iMetricsContext, int i, int i2) {
- this.logger.debug("Called makeState. . . ");
- // convert map to config object
- return new StreamsPersistWriterState(controller);
- }
-
- }
-
- public static class StreamsPersistStateController implements Serializable {
-
- private String fieldName;
- private ObjectMapper mapper = new ObjectMapper();
-
- public StreamsPersistStateController() {
- this.fieldName = "datum";
- }
-
- public StreamsPersistStateController(String fieldName) {
- this.fieldName = fieldName;
- }
-
- public StreamsDatum fromTuple(TridentTuple tuple) {
- return mapper.convertValue(tuple.getValueByField(this.fieldName), StreamsDatum.class);
- }
-
- }
-
-
-
- public static class StreamsPersistWriterSendMessage extends BaseStateUpdater<StreamsPersistWriterState> {
-
- private Logger logger = LoggerFactory.getLogger(StreamsPersistWriterSendMessage.class);
-
- @Override
- public void updateState(StreamsPersistWriterState writerState, List<TridentTuple> tridentTuples, TridentCollector tridentCollector) {
- this.logger.debug("**** calling send message. . .");
- writerState.bulkMessages(tridentTuples);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsProviderSpout.java
----------------------------------------------------------------------
diff --git a/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsProviderSpout.java b/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsProviderSpout.java
deleted file mode 100644
index ad7adc4..0000000
--- a/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsProviderSpout.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.streams.storm.trident;
-
-import backtype.storm.task.TopologyContext;
-import backtype.storm.tuple.Fields;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Lists;
-import org.apache.commons.collections4.IteratorUtils;
-import org.apache.streams.core.StreamsDatum;
-import org.apache.streams.core.StreamsProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import storm.trident.operation.TridentCollector;
-import storm.trident.spout.IBatchSpout;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by sblackmon on 1/16/14.
- */
-public class StreamsProviderSpout implements IBatchSpout {
-
- private final static Logger LOGGER = LoggerFactory.getLogger(StreamsProviderSpout.class);
-
- StreamsProvider provider;
-
- public StreamsProviderSpout(StreamsProvider provider) {
- this.provider = provider;
- }
-
- @Override
- public void open(Map map, TopologyContext topologyContext) {
- provider.start();
- }
-
- @Override
- public synchronized void emitBatch(long l, TridentCollector tridentCollector) {
- List<StreamsDatum> batch;
- batch = IteratorUtils.toList(provider.getProviderQueue().iterator());
- for( StreamsDatum datum : batch ) {
- tridentCollector.emit( Lists.newArrayList(
- datum.getTimestamp(),
- datum.getSequenceid(),
- datum.getDocument()
- ));
- }
- }
-
- @Override
- public void ack(long l) {
-
- }
-
- @Override
- public void close() {
- provider.stop();
- }
-
- @Override
- public Map getComponentConfiguration() {
- return null;
- }
-
- @Override
- public Fields getOutputFields() {
- return new Fields("timestamp", "sequenceid", "datum");
- }
-};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java
----------------------------------------------------------------------
diff --git a/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java b/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java
deleted file mode 100644
index 63c64a5..0000000
--- a/trunk/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java
+++ /dev/null
@@ -1,73 +0,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
- *
- * 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.streams.storm.trident;
-
-import backtype.storm.Config;
-import org.apache.streams.StreamsConfiguration;
-import org.apache.streams.config.StreamsConfigurator;
-import storm.trident.TridentTopology;
-
-/**
- * Created with IntelliJ IDEA.
- * User: sblackmon
- * Date: 9/20/13
- * Time: 5:48 PM
- * To change this template use File | Settings | File Templates.
- */
-public abstract class StreamsTopology extends TridentTopology {
-
- StreamsConfiguration configuration;
- Config stormConfig;
- String runmode;
-
- protected StreamsTopology() {
-
- runmode = StreamsConfigurator.config.getConfig("storm").getString("runmode");
- stormConfig = new Config();
-
- }
-
- protected StreamsTopology(StreamsConfiguration configuration) {
- this.configuration = configuration;
- }
-
- public StreamsConfiguration getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(StreamsConfiguration configuration) {
- this.configuration = configuration;
- }
-
- public String getRunmode() {
- return runmode;
- }
-
- public void setRunmode(String runmode) {
- this.runmode = runmode;
- }
-
- public Config getStormConfig() {
- return stormConfig;
- }
-
- public void setStormConfig(Config stormConfig) {
- this.stormConfig = stormConfig;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-util/pom.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-util/pom.xml b/trunk/streams-util/pom.xml
deleted file mode 100644
index cd6d031..0000000
--- a/trunk/streams-util/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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
- ~
- ~ 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 xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>streams-project</artifactId>
- <groupId>org.apache.streams</groupId>
- <version>0.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>streams-util</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
-
- </dependencies>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java
----------------------------------------------------------------------
diff --git a/trunk/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java b/trunk/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java
deleted file mode 100644
index ee2c18c..0000000
--- a/trunk/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java
+++ /dev/null
@@ -1,48 +0,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
- *
- * 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.streams.util;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.hash.Hashing;
-
-import java.nio.charset.Charset;
-
-/**
- * Created by sblackmon on 12/13/13.
- */
-public class GuidUtils {
-
- private static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
-
- public static String generateGuid(String... parts) {
-
- StringBuilder seed = new StringBuilder();
- for( String part : parts ) {
- Preconditions.checkNotNull(part);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(part));
- seed.append(part);
- }
-
- String hash = Hashing.goodFastHash(24).hashString(seed, UTF8_CHARSET).asBytes().toString();
-
- return hash;
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java
----------------------------------------------------------------------
diff --git a/trunk/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java b/trunk/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java
deleted file mode 100644
index c32ed5f..0000000
--- a/trunk/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java
+++ /dev/null
@@ -1,93 +0,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
- *
- * 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.streams.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.Pair;
-
-public class RegexUtils {
-
- public static boolean matches(String line, String regEx) {
-
- boolean regExpMatches = false;
-
- if (StringUtils.isNotBlank(line) && StringUtils.isNotBlank(regEx)) {
- if (line.matches(regEx)) {
- regExpMatches = true;
- }
- }
- return regExpMatches;
- }
-
- public static List<String> getMatches(String line, String regEx, int group){
- Pattern pattern = Pattern.compile(regEx);
- Matcher matcher = pattern.matcher(line);
- List<String> matches = new ArrayList<String>();
-
- while (matcher.find()) {
-
- matches.add(matcher.group(group));
- }
-
- return matches;
- }
-
- public static List<Pair<String,String>> getTwoMatchedGroupsList(List<String> lines, String regEx){
- List<Pair<String,String>> matches = new ArrayList<Pair<String,String>>();
-
- for( String line : lines ) {
-
- Pair<String,String> match = getTwoMatchedGroups(line, regEx);
- if( match != null )
- matches.add(match);
-
- }
- return matches;
- }
-
- public static Pair<String,String> getTwoMatchedGroups(String line, String regEx){
- Pattern pattern = Pattern.compile(regEx);
- Matcher matcher = pattern.matcher(line);
- Pair<String,String> match = null;
-
- while (matcher.find()) {
- Pair<String,String> pair = new ImmutablePair<String,String>(matcher.group(0), matcher.group(1));
- match = pair;
- }
-
- return match;
- }
-
- public static String getMatchedContent(String line, String regEx){
- Pattern pattern = Pattern.compile(regEx);
- Matcher matcher = pattern.matcher(line);
- String matchedContent = null;
- if (matcher.find()) {
- matchedContent = matcher.group();
- }
-
- return matchedContent;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/pom.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-web/pom.xml b/trunk/streams-web/pom.xml
deleted file mode 100644
index 2a44e43..0000000
--- a/trunk/streams-web/pom.xml
+++ /dev/null
@@ -1,218 +0,0 @@
-<?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
- ~
- ~ 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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>streams-project</artifactId>
- <groupId>org.apache.streams</groupId>
- <version>0.1-SNAPSHOT</version>
- </parent>
- <artifactId>streams-web</artifactId>
- <packaging>war</packaging>
-
- <name>Apache Streams Web App</name>
-
- <properties>
- <spring.version>3.0.5.RELEASE</spring.version>
- <junit.version>4.11</junit.version>
- <jdk.version>1.6</jdk.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-eip-routes</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.streams.osgi.components</groupId>
- <artifactId>streams-components-all</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-cassandra</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-web</artifactId>
- <version>2.9.0</version>
- <type>war</type>
- <scope>runtime</scope>
- </dependency>
-
- <!-- Dependencies for using ActiveMQ -->
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-camel</artifactId>
- <version>5.5.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- <version>3.5</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jms</artifactId>
- <version>2.9.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-servlet</artifactId>
- <version>2.9.0</version>
- </dependency>
-
- <!-- Dependencies for stream processing in Camel
- http://camel.apache.org/stream.html -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-stream</artifactId>
- <version>2.9.0</version>
- </dependency>
-
- <!-- logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.1</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.6.1</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <!--rave-->
- <dependency>
- <groupId>org.apache.rave</groupId>
- <artifactId>rave-core-api</artifactId>
- <version>${rave.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.rave</groupId>
- <artifactId>rave-core</artifactId>
- <version>${rave.version}</version>
- </dependency>
-
- </dependencies>
- <build>
- <finalName>streams-web</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-maven-plugin</artifactId>
- <version>2.9.0</version>
- </plugin>
-
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>7.5.3.v20111011</version>
-
- <configuration>
- <webAppConfig>
- <contextPath>/</contextPath>
- </webAppConfig>
-
- <systemProperties>
- <!-- enable easy JMX connection to JConsole -->
- <systemProperty>
- <name>com.sun.management.jmxremote</name>
- <value/>
- </systemProperty>
- </systemProperties>
- <scanIntervalSeconds>10</scanIntervalSeconds>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.4.2</version>
- <executions>
- <execution>
- <id>default-copy-resources</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <overwrite>true</overwrite>
- <outputDirectory>${project.build.directory}/${project.artifactId}/WEB-INF/spring</outputDirectory>
- <resources>
- <resource>
- <directory>${project.parent.basedir}/streams-eip-routes/src/main/resources/META-INF/spring</directory>
- <excludes>
- <exclude>streams-eip-osgi-component-import.xml</exclude>
- <exclude>propertiesLoader.xml</exclude>
- <exclude>streams.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/WEB-INF/cassandra.properties
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/WEB-INF/cassandra.properties b/trunk/streams-web/src/main/webapp/WEB-INF/cassandra.properties
deleted file mode 100644
index b7ea724..0000000
--- a/trunk/streams-web/src/main/webapp/WEB-INF/cassandra.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-keyspaceName=keyspacetest
-activitystreamsColumnFamilyName=activitystreams
-subscriptionColumnFamilyName=subscriptions
-publisherColumnFamilyName=publishers
-cassandraPort=127.0.0.1
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/WEB-INF/propertiesLoader.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/WEB-INF/propertiesLoader.xml b/trunk/streams-web/src/main/webapp/WEB-INF/propertiesLoader.xml
deleted file mode 100644
index d90ef76..0000000
--- a/trunk/streams-web/src/main/webapp/WEB-INF/propertiesLoader.xml
+++ /dev/null
@@ -1,36 +0,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
- ~
- ~ 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.
- -->
-
-<beans
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
-
-
-
- <context:property-placeholder
- location="WEB-INF/streams.properties,
- WEB-INF/cassandra.properties"
- ignore-unresolvable="true"/>
-
- <bean id="configuration" class="org.apache.streams.messaging.configuration.EipConfigurator" />
- <bean id="cassandraConfig" class="org.apache.streams.cassandra.configuration.CassandraConfiguration" />
-
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/WEB-INF/spring-web-servlet.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/WEB-INF/spring-web-servlet.xml b/trunk/streams-web/src/main/webapp/WEB-INF/spring-web-servlet.xml
deleted file mode 100644
index 2d6557d..0000000
--- a/trunk/streams-web/src/main/webapp/WEB-INF/spring-web-servlet.xml
+++ /dev/null
@@ -1,49 +0,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
- ~
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
- <context:component-scan base-package="org.apache.streams" />
- <context:component-scan base-package="org.apache.camel.web" />
-
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix">
- <value>/WEB-INF/</value>
- </property>
- <property name="suffix">
- <value>.jsp</value>
- </property>
- </bean>
-
-
- <bean id="activityPublisherRegistration" class="org.apache.streams.osgi.components.impl.ActivityPublisherRegistrationImpl" />
- <bean id="activityConsumerWarehouse" class="org.apache.streams.osgi.components.activityconsumer.impl.ActivityConsumerWarehouseImpl" />
-
- <bean id="activityStreamsSubscriberRegistration" class="org.apache.streams.osgi.components.impl.ActivityStreamsSubscriberRegistrationImpl" />
- <bean id="activityStreamsSubscriberWarehouse" class="org.apache.streams.osgi.components.activitysubscriber.impl.ActivityStreamsSubscriberWarehouseImpl" />
-
-
-
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/WEB-INF/streams.properties
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/WEB-INF/streams.properties b/trunk/streams-web/src/main/webapp/WEB-INF/streams.properties
deleted file mode 100644
index 157fb64..0000000
--- a/trunk/streams-web/src/main/webapp/WEB-INF/streams.properties
+++ /dev/null
@@ -1,43 +0,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
-#
-# 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.
-#
-
-servlet.baseUrlPath=http://localhost:8080/streams-web/
-
-consumer.inRouteHost=localhost
-consumer.inRoutePort=8000
-consumer.activityQUri = direct:activityQ
-
-consumer.publisherEndpointProtocol=servlet:///
-consumer.publisherEndpointUrlResource=publish
-
-consumer.receiveMethod=receive
-consumer.splitMethod=split
-
-consumer.registrationEndpoint=servlet:///publisher/register
-
-subscriber.inRouteHost=localhost
-subscriber.inRoutePort=8000
-subscriber.subscriberEndpointUrlResource=subscriber
-subscriber.receiveMethod=receive
-subscriber.postMethod=updateActivityStreamsSubscriberConfiguration
-subscriber.getMethod=getStream
-subscriber.registrationEndpoint=servlet:///subscriber/register
-subscriber.subscriberEndpointProtocol=servlet:///
-
-
-activemq.jmsConnectionFactoryUrl=tcp://localhost:61616
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/WEB-INF/web.xml b/trunk/streams-web/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index faf2ba6..0000000
--- a/trunk/streams-web/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,57 +0,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
- ~
- ~ 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.
- -->
-
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="Shindig"
- version="2.5">
- <display-name>Streams</display-name>
-
- <!-- tell Spring where it should load the XML file -->
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>
- /WEB-INF/propertiesLoader.xml
- /WEB-INF/spring/*.xml
- /WEB-INF/spring-web-servlet.xml
- </param-value>
- </context-param>
- <!-- the listener that kick-starts Spring -->
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
-
- <!-- Camel servlet -->
- <servlet>
- <servlet-name>CamelServlet</servlet-name>
- <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <!-- Camel servlet mapping -->
- <servlet-mapping>
- <servlet-name>CamelServlet</servlet-name>
- <url-pattern>/apps/*</url-pattern>
- </servlet-mapping>
-
- <welcome-file-list><welcome-file>/demo/index.html</welcome-file></welcome-file-list>
-
-</web-app>
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/demo/activityDemo.html
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/demo/activityDemo.html b/trunk/streams-web/src/main/webapp/demo/activityDemo.html
deleted file mode 100644
index 452bc61..0000000
--- a/trunk/streams-web/src/main/webapp/demo/activityDemo.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/html">
-<head>
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
- <script type="text/javascript" src="js/handlebars.js"></script>
- <script type="text/javascript" src="js/activityDemo.js"></script>
- <link rel="stylesheet" type="text/css" href="css/activityStyles.css" />
- <title>Activity Streams Demo</title>
-</head>
-<body>
- <label>View Streams for the following tag:</label><br>
- <textarea id="tag" rows="2"></textarea><br>
- <button type="button" onclick="activityDemo.getActivitiesForGivenTag()">Get Activities</button><br><br>
-
- <div id="activityStream"></div>
- <script type="text/x-handlebars-template" id='activity-template'>
- <!--Iterates through each activity in the array that was returned from Streams-->
- {{#each this}}
- <div class='activity'>
- <div class='actor'>{{actor.id}} {{verb}} {{published}}</div>
- </div>
- {{/each}}
- </script>
-
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/demo/css/activityStyles.css
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/demo/css/activityStyles.css b/trunk/streams-web/src/main/webapp/demo/css/activityStyles.css
deleted file mode 100644
index b8b0e55..0000000
--- a/trunk/streams-web/src/main/webapp/demo/css/activityStyles.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.activity {
- -moz-box-shadow: 3px 3px 5px 6px #ccc;
- -webkit-box-shadow: 3px 3px 5px 6px #ccc;
- box-shadow: 3px 3px 5px 6px #ccc;
- padding: .3em .7em .3em .7em;
- width: 300px;
- margin-top: 25px;
- margin-bottom: 25px; }
-.actor { text-align: left; }
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-web/src/main/webapp/demo/js/activityDemo.js
----------------------------------------------------------------------
diff --git a/trunk/streams-web/src/main/webapp/demo/js/activityDemo.js b/trunk/streams-web/src/main/webapp/demo/js/activityDemo.js
deleted file mode 100644
index 17c1e7b..0000000
--- a/trunk/streams-web/src/main/webapp/demo/js/activityDemo.js
+++ /dev/null
@@ -1,66 +0,0 @@
-var activityDemo = activityDemo || (function(){
- var subscriberURL = "";
- var registerUrl = "/streams-web/apps/subscriber/register";
- var activityStream = "";
-
- var getActivitiesForGivenTag = function(){
-
- registerSubscriber();
- };
-
- // Registers a new subscriber and sets the subscriber's filter(s)
- // based on tag entered by the user on the demo webpage
- var registerSubscriber = function(){
- var tag = $("#tag").val();
- console.log("tag = " + tag);
- var registrationObject =
- {
- "authToken": "token",
- "@class":"org.apache.streams.osgi.components.activitysubscriber.impl.ActivityStreamsSubscriptionImpl",
- "filters": [
- tag
- ]
- };
-
- $.ajax({
- url:registerUrl,
- contentType: 'application/json',
- type:"POST",
- data:JSON.stringify(registrationObject),
- success:function(data){
- console.log(data);
- subscriberURL = data;
- getActivitiesStream();
- }
- })
- };
-
- // Gets activities streams array
- var getActivitiesStream = function(){
- if(!subscriberURL){
- alert("Please enter a subscriber url first");
- }
-
- $.ajax({
- contentType: "application/json",
- type:"GET",
- url: subscriberURL,
- success:function(data){
- setTemplate(data);
- }
- })
- };
-
- // Applies the array returned from Streams to the html template to be displayed
- var setTemplate = function(activityStreamData){
- var source = $("#activity-template").html();
- var template = Handlebars.compile(source);
- var html = template(activityStreamData);
- $("#activityStream").html(html);
- };
-
- return {
- getActivitiesForGivenTag: getActivitiesForGivenTag
- }
-
-})();