http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_256.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_256.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_256.png deleted file mode 100644 index f828834..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_256.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_32.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_32.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_32.png deleted file mode 100644 index a0a7b07..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_32.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_64.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_64.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_64.png deleted file mode 100644 index b5a9375..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/icon_64.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/log_viewer.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/log_viewer.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/log_viewer.png deleted file mode 100644 index b4f6c59..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/log_viewer.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start.png deleted file mode 100644 index 26735b5..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start_active.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start_active.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start_active.png deleted file mode 100644 index 363b5fc..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/start_active.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_green.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_green.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_green.png deleted file mode 100644 index c199695..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_green.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_off.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_off.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_off.png deleted file mode 100644 index bec7181..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_off.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_red.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_red.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_red.png deleted file mode 100644 index d7e2aac..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_red.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_yellow.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_yellow.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_yellow.png deleted file mode 100644 index 5836964..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/status_yellow.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop.png deleted file mode 100644 index 97b5dd3..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop_active.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop_active.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop_active.png deleted file mode 100644 index 74ed5e1..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/stop_active.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/web_browser.png ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/web_browser.png b/stack/launcher/src/main/resources/org/apache/usergrid/launcher/web_browser.png deleted file mode 100644 index bd31888..0000000 Binary files a/stack/launcher/src/main/resources/org/apache/usergrid/launcher/web_browser.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/usergrid-standalone-context.xml ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/usergrid-standalone-context.xml b/stack/launcher/src/main/resources/usergrid-standalone-context.xml deleted file mode 100644 index 856276d..0000000 --- a/stack/launcher/src/main/resources/usergrid-standalone-context.xml +++ /dev/null @@ -1,49 +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 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. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" - xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd - http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> - - <context:annotation-config /> - - <bean id="properties" - class="org.springframework.beans.factory.config.PropertiesFactoryBean"> - <property name="singleton" value="true" /> - <property name="ignoreResourceNotFound" value="true" /> - <property name="locations"> - <list> - <value>classpath:/usergrid-default.properties</value> - <value>classpath:/usergrid-standalone.properties</value> - <value>classpath:/usergrid-deployment.properties</value> - <value>file:./usergrid-custom-standalone.properties</value> - </list> - </property> - </bean> - - <bean id="standaloneServer" class="org.apache.usergrid.launcher.Server" - factory-method="getInstance" init-method="springInit" /> - - <import resource="classpath:/usergrid-rest-context.xml" /> - - - -</beans> http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/launcher/src/main/resources/usergrid-standalone.properties ---------------------------------------------------------------------- diff --git a/stack/launcher/src/main/resources/usergrid-standalone.properties b/stack/launcher/src/main/resources/usergrid-standalone.properties deleted file mode 100644 index 03d9b80..0000000 --- a/stack/launcher/src/main/resources/usergrid-standalone.properties +++ /dev/null @@ -1,263 +0,0 @@ -# Licensed 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. See accompanying LICENSE file. -# Licensed 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. See accompanying LICENSE file. - -# -# Usergrid configuration properties -# Loaded by Spring PropertyPlaceholderConfigurer -# - -# -# Do not put installation-specific or confidential -# configuration settings here if you plan to push -# this to GitHub -# -# Put your settings in usergrid-custom-test.properties -# instead. -# - -# This property is required to be set and cannot be defaulted anywhere -usergrid.cluster_name=usergrid - -# Whether to user the remote Cassandra cluster or not -cassandra.use_remote=false - -# URL for local testing Cassandra cluster -cassandra.local.url=localhost:9160 -cassandra.url=localhost:9160 - -# URL for remote production Cassandra cluster -cassandra.remote.url= - -# Name of Cassandra cluster -cassandra.cluster=Test Cluster - -cassandra.username= -cassandra.password= - -#Properties to control the number of buckets in the index. -usergrid.index.defaultbucketsize=20 -usergrid.counter.skipAggregate=true -usergrid.version.database=1.0.0 -usergrid.version.schema=1.0.0 -usergrid.version.properties=1.0.0 -usergrid.version.build=${version} - -#usergrid.auth.token_secret_salt=super secret token value -#usergrid.auth.token_expires_from_last_use=false -#usergrid.auth.token_refresh_reuses_id=false - -# max time to persist tokens for (milliseconds) -#usergrid.auth.token.persist.expires=0 - -# expiration age for oauth access tokens (milliseconds) -#usergrid.auth.token.access.expires=0 - -# expiration age for oauth refresh tokens (milliseconds) -#usergrid.auth.token.refresh.expires=0 - -# max age for offline tokens (milliseconds) -#usergrid.auth.token.offline.expires=0 - -# max age for email tokens (milliseconds) -#usergrid.auth.token.email.expires=0 - -#Read consistency level for the cassandra cluster -cassandra.readcl=QUORUM - -#Write consistency level for the cassandra cluster -cassandra.writecl=QUORUM - - - -# SysAdmin login -usergrid.sysadmin.login.name=superuser -usergrid.sysadmin.login.email=su...@usergrid.com -usergrid.sysadmin.login.password=superuser -usergrid.sysadmin.login.allowed=true - -usergrid.sysadmin.approve.users=false -usergrid.sysadmin.approve.organizations=false - -# Where to store temporary files -usergrid.temp.files=/tmp/usergrid - - -#AWS_ACCESS_KEY_ID= -#AWS_ACCESS_KEY_SECRET= -#usergrid.binary.bucketname=usergrid-test-binary - -# Disable Mongo API Server -usergrid.mongo.disable=false - -mail.transport.protocol= -mail.smtps.host= -mail.smtps.port= -mail.smtps.auth= -mail.smtps.username= -mail.smtps.password= -mail.smtps.quitwait= - - -usergrid.api.url.base=http://localhost:8080/ROOT - -usergrid.recaptcha.public= -usergrid.recaptcha.private= - -usergrid.sysadmin.email= - -usergrid.management.admin_users_require_confirmation=false -usergrid.management.admin_users_require_activation=false -usergrid.management.notify_admin_of_activation=false -usergrid.management.organizations_require_confirmation=false -usergrid.management.organizations_require_activation=false -usergrid.management.notify_sysadmin_of_new_organizations=false -usergrid.management.notify_sysadmin_of_new_admin_users=false - -usergrid.setup-test-account=true -usergrid.test-account.app=test-app -usergrid.test-account.organization=test-organization -usergrid.test-account.admin-user.username=test -usergrid.test-account.admin-user.name=Test User -usergrid.test-account.admin-user.email=t...@usergrid.com -usergrid.test-account.admin-user.password=test - -usergrid.redirect_root= - -usergrid.management.mailer=Usergrid Mailer <mai...@usergrid.com> - -# email footer -usergrid.management.email.footer=\ - <p></p>\n - -############################################################################### -# -# Sysadmin notifications -# - -# email to sysadmin to notify new organization has been activated -usergrid.management.email.sysadmin-organization-activated=\ - <p>Organization account for ${organization_name}, owned by ${organization_owners}, \ - has been successfully activated.</p> - -# email to sysadmin to notify new admin has been activated -usergrid.management.email.sysadmin-admin-activated=\ - <p>Admin user account for ${user_email}has been successfully activated.</p> - - -############################################################################### -# -# Organization approval flow -# - -# email to sysadmin to approve and activate new organization -usergrid.management.email.sysadmin-organization-activation=\ - <p>To activate the organization account for ${organization_name}, owned by ${organization_owners}, \ - click here:</p>\n<p><a href="${activation_url}">${activation_url}</a></p> - -# email to organization owner to request confirmation -usergrid.management.email.organization-confirmation=\ - <p>To confirm your organization account, click here:</p>\n\ - <p><a href="${confirmation_url}">${confirmation_url}</a></p> - -# email to organization owner to notify approval is pending -usergrid.management.email.organization-activation-pending=\ - <p>Your organization account ${organization_name} is awaiting approval.</p> - -# email to organization owner to notify organization is active -usergrid.management.email.organization-activated=\ - <p>Your organization account ${organization_name} has been successfully activated.</p> - -############################################################################### -# -# Admin approval flow -# - -# email to sysadmin to approve and activate new admin -usergrid.management.email.sysadmin-admin-activation=\ - <p>To activate the user account for ${user_email}, click here:</p>\n\ - <p><a href="${activation_url}">${activation_url}</a></p> - -# email to admin user to confirm email -usergrid.management.email.admin-confirmation=\ - <p>To confirm your email address ${confirm_email}, click here:</p>\n\ - <p><a href="${confirmation_url}">${confirmation_url}</a></p> - -# email to admin user to notify email has been confirmed -usergrid.management.email.admin-confirmed=\ - <p>Your email address ${confirmed_email} has been confirmed.</p>\n\ - <p>You will receive another email with your account has been activated.</p> - -# email to admin to notify account is active -usergrid.management.email.admin-activated=\ - <p>Your user account has been successfully activated.</p> - -# email to admin to notify account has been added to an organization -usergrid.management.email.admin-invited=\ - <p>Your user account has been added to the organization ${organization_name}.</p> - -# email to admin for password reset -usergrid.management.email.admin-password-reset=\ - <p>To reset your password, click here:</p>\n\ - <p><a href="${reset_url}">${reset_url}</a></p> - - -############################################################################### -# -# User approval flow -# - -# email to admin to approve and activate new app user -usergrid.management.email.admin-user-activation=\ - <p>To activate the user account for ${user_email}, click here:</p>\n\ - <p><a href="${activation_url}">${activation_url}</a></p> - -# email to user to request activation -usergrid.management.email.user-confirmation=\ - <p>To confirm your user account, click here:</p>\n\ - <p><a href="${confirmation_url}">${confirmation_url}</a></p> - -# email to user to notify account is confirmed -usergrid.management.email.user-confirmed=\ - <p>Your user account has been successfully confirmed.</p>\n\ - <p>You will receive another email with your account has been activated.</p> - -# email to user to notify account is active -usergrid.management.email.user-activated=\ - <p>Your user account has been successfully activated.</p> - -# email to user to reset password -usergrid.management.email.user-password-reset=\ - <p>To reset your password, click here:</p>\n\ - <p><a href="${reset_url}">${reset_url}</a></p> - -# email to admin to notify new app user has been successfully activated -usergrid.management.email.admin-user-activated=\ - <p>User account for ${user_email} has been successfully activated</p> - - -############################################################################### -# -# email to user to recover pin -usergrid.management.email.user-pin=\ - <p>Your application pin is:</p>\n\ - <p>${pin}</p> http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/pom.xml ---------------------------------------------------------------------- diff --git a/stack/pom.xml b/stack/pom.xml index 8003cf2..be18536 100644 --- a/stack/pom.xml +++ b/stack/pom.xml @@ -776,12 +776,6 @@ </dependency> <dependency> - <groupId>org.jboss.netty</groupId> - <artifactId>netty</artifactId> - <version>3.2.7.Final</version> - </dependency> - - <dependency> <groupId>org.jsoup</groupId> <artifactId>jsoup</artifactId> <version>1.6.0</version> http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/README.txt ---------------------------------------------------------------------- diff --git a/stack/websocket/README.txt b/stack/websocket/README.txt deleted file mode 100644 index 8747368..0000000 --- a/stack/websocket/README.txt +++ /dev/null @@ -1,49 +0,0 @@ -Experimental (incomplete) implementation of Websocket API - -http://en.wikipedia.org/wiki/WebSockets - -The Websocket API will allow for asynchronous communications with the Usergrid -API. - -OAuth credentials are put in the querystring of the initial GET request since -the Javascript Websocket API provides no mechanism for specifying header -contents. - -Once a connection is established, there are two mechanisms of usage. - -Async Request/Response - -The first is to simply access the API the same way as the REST interface -provides, except over the open websocket connection. The benefit is there is -much less overhead than with the REST API since there is no processing of -individual HTTP requests and authentication credentials are checked at the -time the websocket is opened as opposed to per-request as is necessary with -the stateless REST API. - -Subscriptions - -The second is to issue subscribe requests against entities and collections and -be notified asynchronously as those are updated. Subscriptions against the -activity inbox and message queue collections for either users, groups, or the -entire application allow connected applications to get realtime updates. - -Connecting to an inbox or queue in the websocket url will automatically start -a subscription to that collection. For example, the following websocket url -will listen to a specific user's inbox: - -ws://api.usergrid.com:8088/chatapp/users/johndoe/inbox - -This is the real-time equivalent of making a regular REST GET request to: - -http://api.usergrid.com/chatapp/users/edanuff/inbox - -Usergrid listens to websockets on an alternate port than it does standard HTTP -requests. Although websockets can coexist on the same ports 80 or 443, Tomcat -and other Java servlet containers don't do a particularly great job of -handling open async socket connections despite what they claim. For our -purposes, we're using a bare metal Netty websocket server that listens on port -8088. This is going to be much more performant that trying to integrate it -into Tomcat and allows us to move the websocket servers onto different -machines. - - http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/pom.xml ---------------------------------------------------------------------- diff --git a/stack/websocket/pom.xml b/stack/websocket/pom.xml deleted file mode 100644 index af5ed56..0000000 --- a/stack/websocket/pom.xml +++ /dev/null @@ -1,208 +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 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 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/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.usergrid</groupId> - <artifactId>usergrid</artifactId> - <version>2.0.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - <artifactId>usergrid-websocket</artifactId> - <name>Usergrid Websocket</name> - <description>WebSocket API for Usergrid system.</description> - <packaging>jar</packaging> - - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.7</version> - </plugin> - </plugins> - </reporting> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - <includes> - <include>**/*.xml</include> - </includes> - </resource> - </resources> - - <testResources> - <testResource> - <directory>src/test/resources</directory> - <filtering>true</filtering> - <includes> - <include>**/*.xml</include> - </includes> - </testResource> - </testResources> - - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <systemPropertyVariables> - <storage-config>${basedir}/src/test/conf</storage-config> - </systemPropertyVariables> - <forkMode>always</forkMode> - <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${project.build.directory}/jacoco.exec -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - - <!-- Usergrid Dependencies --> - - <dependency> - <groupId>org.apache.usergrid</groupId> - <artifactId>usergrid-config</artifactId> - <version>${project.version}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.usergrid</groupId> - <artifactId>usergrid-services</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- Apache Dependencies --> - - <dependency> - <groupId>org.apache.xbean</groupId> - <artifactId>xbean-spring</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-core</artifactId> - <optional>false</optional> - </dependency> - - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-spring</artifactId> - <optional>false</optional> - </dependency> - - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-pool</artifactId> - <optional>false</optional> - </dependency> - - <dependency> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - </dependency> - - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - - <!-- SUN, Javax Package and Other Com/Net Packages --> - - <dependency> - <groupId>de.undercouch</groupId> - <artifactId>bson4jackson</artifactId> - </dependency> - - <!-- Codehaus, Spring and Other Org Dependencies --> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-jms</artifactId> - </dependency> - - <dependency> - <groupId>org.jboss.netty</groupId> - <artifactId>netty</artifactId> - </dependency> - - <dependency> - <groupId>org.mongodb</groupId> - <artifactId>mongo-java-driver</artifactId> - </dependency> - - <!-- Testing and Logging Dependencies --> - - <dependency> - <groupId>org.apache.usergrid</groupId> - <artifactId>usergrid-config</artifactId> - <version>${project.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>org.apache.usergrid</groupId> - <artifactId>usergrid-core</artifactId> - <version>${project.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jul-to-slf4j</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketChannelHandler.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketChannelHandler.java b/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketChannelHandler.java deleted file mode 100644 index 91ca42f..0000000 --- a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketChannelHandler.java +++ /dev/null @@ -1,358 +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 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.usergrid.websocket; - - -import java.security.MessageDigest; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelFuture; -import org.jboss.netty.channel.ChannelFutureListener; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.jboss.netty.channel.ChannelPipeline; -import org.jboss.netty.channel.ChannelStateEvent; -import org.jboss.netty.channel.ExceptionEvent; -import org.jboss.netty.channel.MessageEvent; -import org.jboss.netty.channel.SimpleChannelUpstreamHandler; -import org.jboss.netty.channel.group.ChannelGroup; -import org.jboss.netty.channel.group.DefaultChannelGroup; -import org.jboss.netty.handler.codec.http.DefaultHttpResponse; -import org.jboss.netty.handler.codec.http.HttpHeaders; -import org.jboss.netty.handler.codec.http.HttpHeaders.Names; -import org.jboss.netty.handler.codec.http.HttpHeaders.Values; -import org.jboss.netty.handler.codec.http.HttpRequest; -import org.jboss.netty.handler.codec.http.HttpResponse; -import org.jboss.netty.handler.codec.http.HttpResponseStatus; -import org.jboss.netty.handler.codec.http.QueryStringDecoder; -import org.jboss.netty.handler.codec.http.websocket.DefaultWebSocketFrame; -import org.jboss.netty.handler.codec.http.websocket.WebSocketFrame; -import org.jboss.netty.handler.codec.http.websocket.WebSocketFrameDecoder; -import org.jboss.netty.handler.codec.http.websocket.WebSocketFrameEncoder; -import org.jboss.netty.util.CharsetUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.usergrid.management.ManagementService; -import org.apache.usergrid.persistence.EntityManagerFactory; -import org.apache.usergrid.services.ServiceManagerFactory; - -import org.apache.shiro.mgt.SessionsSecurityManager; -import org.apache.shiro.subject.Subject; - -import static org.apache.commons.lang.StringUtils.isEmpty; -import static org.apache.commons.lang.StringUtils.removeEnd; -import static org.apache.commons.lang.StringUtils.split; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONNECTION; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.ORIGIN; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.SEC_WEBSOCKET_KEY1; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.SEC_WEBSOCKET_KEY2; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.SEC_WEBSOCKET_LOCATION; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.SEC_WEBSOCKET_ORIGIN; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.SEC_WEBSOCKET_PROTOCOL; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.WEBSOCKET_LOCATION; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.WEBSOCKET_ORIGIN; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.WEBSOCKET_PROTOCOL; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Values.WEBSOCKET; -import static org.jboss.netty.handler.codec.http.HttpHeaders.isKeepAlive; -import static org.jboss.netty.handler.codec.http.HttpHeaders.setContentLength; -import static org.jboss.netty.handler.codec.http.HttpMethod.GET; -import static org.jboss.netty.handler.codec.http.HttpResponseStatus.FORBIDDEN; -import static org.jboss.netty.handler.codec.http.HttpResponseStatus.OK; -import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1; - - -public class WebSocketChannelHandler extends SimpleChannelUpstreamHandler { - - private static final Logger logger = LoggerFactory.getLogger( WebSocketChannelHandler.class ); - - private final EntityManagerFactory emf; - private final ServiceManagerFactory smf; - private final ManagementService management; - private final SessionsSecurityManager securityManager; - private final boolean ssl; - - boolean websocket = false; - - Subject subject = null; - - private static ConcurrentHashMap<String, ChannelGroup> subscribers = new ConcurrentHashMap<String, ChannelGroup>(); - - List<String> subscriptions; - - - public WebSocketChannelHandler( EntityManagerFactory emf, ServiceManagerFactory smf, ManagementService management, - SessionsSecurityManager securityManager, boolean ssl ) { - super(); - - this.emf = emf; - this.smf = smf; - this.management = management; - this.securityManager = securityManager; - this.ssl = ssl; - - if ( securityManager != null ) { - subject = new Subject.Builder( securityManager ).buildSubject(); - } - } - - - public EntityManagerFactory getEmf() { - return emf; - } - - - public ServiceManagerFactory getSmf() { - return smf; - } - - - public ManagementService getOrganizations() { - return management; - } - - - public SessionsSecurityManager getSecurityManager() { - return securityManager; - } - - - private String getWebSocketLocation( HttpRequest req ) { - String path = req.getUri(); - if ( path.equals( "/" ) ) { - path = null; - } - if ( path != null ) { - path = removeEnd( path, "/" ); - } - String location = - ( ssl ? "wss://" : "ws://" ) + req.getHeader( HttpHeaders.Names.HOST ) + ( path != null ? path : "" ); - logger.info( location ); - return location; - } - - - private void sendHttpResponse( ChannelHandlerContext ctx, HttpRequest req, HttpResponse res ) { - // Generate an error page if response status code is not OK (200). - if ( res.getStatus().getCode() != 200 ) { - res.setContent( ChannelBuffers.copiedBuffer( res.getStatus().toString(), CharsetUtil.UTF_8 ) ); - setContentLength( res, res.getContent().readableBytes() ); - } - - // Send the response and close the connection if necessary. - ChannelFuture f = ctx.getChannel().write( res ); - if ( !isKeepAlive( req ) || ( res.getStatus().getCode() != 200 ) ) { - f.addListener( ChannelFutureListener.CLOSE ); - } - } - - - private void sendHttpResponse( ChannelHandlerContext ctx, HttpRequest req, HttpResponseStatus status ) { - sendHttpResponse( ctx, req, new DefaultHttpResponse( HTTP_1_1, status ) ); - } - - - @Override - public void exceptionCaught( ChannelHandlerContext ctx, ExceptionEvent e ) { - logger.warn( "Unexpected exception from downstream.", e.getCause() ); - e.getChannel().close(); - } - - - @Override - public void channelDisconnected( ChannelHandlerContext ctx, ChannelStateEvent e ) throws Exception { - super.channelDisconnected( ctx, e ); - if ( websocket ) { - logger.info( "Websocket disconnected" ); - } - } - - - @Override - public void messageReceived( ChannelHandlerContext ctx, MessageEvent e ) throws Exception { - Object msg = e.getMessage(); - if ( msg instanceof HttpRequest ) { - handleHttpRequest( ctx, ( HttpRequest ) msg ); - } - else if ( msg instanceof WebSocketFrame ) { - handleWebSocketFrame( ctx, ( WebSocketFrame ) msg ); - } - } - - - private void handleHttpRequest( ChannelHandlerContext ctx, HttpRequest req ) throws Exception { - // Allow only GET methods. - if ( req.getMethod() != GET ) { - sendHttpResponse( ctx, req, FORBIDDEN ); - return; - } - - boolean is_ws_request = Values.UPGRADE.equalsIgnoreCase( req.getHeader( CONNECTION ) ) && WEBSOCKET - .equalsIgnoreCase( req.getHeader( Names.UPGRADE ) ); - - // Send the demo page. - if ( !is_ws_request && req.getUri().equals( "/" ) ) { - HttpResponse res = new DefaultHttpResponse( HTTP_1_1, OK ); - - ChannelBuffer content = WebSocketServerIndexPage.getContent( getWebSocketLocation( req ) ); - - res.setHeader( CONTENT_TYPE, "text/html; charset=UTF-8" ); - setContentLength( res, content.readableBytes() ); - - res.setContent( content ); - sendHttpResponse( ctx, req, res ); - - return; - } - else if ( is_ws_request ) { - // Serve the WebSocket handshake request. - - logger.info( "Starting new websocket connection..." ); - websocket = true; - - // Create the WebSocket handshake response. - HttpResponse res = - new DefaultHttpResponse( HTTP_1_1, new HttpResponseStatus( 101, "Web Socket Protocol Handshake" ) ); - res.addHeader( Names.UPGRADE, WEBSOCKET ); - res.addHeader( CONNECTION, Values.UPGRADE ); - - QueryStringDecoder qs = new QueryStringDecoder( req.getUri() ); - String path = qs.getPath(); - logger.info( path ); - - // Fill in the headers and contents depending on handshake method. - if ( req.containsHeader( SEC_WEBSOCKET_KEY1 ) && req.containsHeader( SEC_WEBSOCKET_KEY2 ) ) { - - String[] segments = split( path, '/' ); - - if ( segments.length != 3 ) { - logger.info( "Wrong number of path segments, expected 3, found " + segments.length ); - sendHttpResponse( ctx, req, FORBIDDEN ); - return; - } - - String nsStr = segments[0]; - String collStr = segments[1]; - String idStr = segments[2]; - - logger.info( nsStr + "/" + collStr + "/" + idStr ); - - if ( isEmpty( nsStr ) || isEmpty( collStr ) || isEmpty( idStr ) ) { - sendHttpResponse( ctx, req, FORBIDDEN ); - return; - } - - // New handshake method with a challenge: - res.addHeader( SEC_WEBSOCKET_ORIGIN, req.getHeader( ORIGIN ) ); - res.addHeader( SEC_WEBSOCKET_LOCATION, getWebSocketLocation( req ) ); - String protocol = req.getHeader( SEC_WEBSOCKET_PROTOCOL ); - if ( protocol != null ) { - res.addHeader( SEC_WEBSOCKET_PROTOCOL, protocol ); - } - - // Calculate the answer of the challenge. - String key1 = req.getHeader( SEC_WEBSOCKET_KEY1 ); - String key2 = req.getHeader( SEC_WEBSOCKET_KEY2 ); - int a = ( int ) ( Long.parseLong( key1.replaceAll( "[^0-9]", "" ) ) / key1.replaceAll( "[^ ]", "" ) - .length() ); - int b = ( int ) ( Long.parseLong( key2.replaceAll( "[^0-9]", "" ) ) / key2.replaceAll( "[^ ]", "" ) - .length() ); - long c = req.getContent().readLong(); - ChannelBuffer input = ChannelBuffers.buffer( 16 ); - input.writeInt( a ); - input.writeInt( b ); - input.writeLong( c ); - ChannelBuffer output = - ChannelBuffers.wrappedBuffer( MessageDigest.getInstance( "MD5" ).digest( input.array() ) ); - res.setContent( output ); - } - else { - // Old handshake method with no challenge: - res.addHeader( WEBSOCKET_ORIGIN, req.getHeader( ORIGIN ) ); - res.addHeader( WEBSOCKET_LOCATION, getWebSocketLocation( req ) ); - String protocol = req.getHeader( WEBSOCKET_PROTOCOL ); - if ( protocol != null ) { - res.addHeader( WEBSOCKET_PROTOCOL, protocol ); - } - } - - // Upgrade the connection and send the handshake response. - ChannelPipeline p = ctx.getChannel().getPipeline(); - p.remove( "aggregator" ); - p.replace( "decoder", "wsdecoder", new WebSocketFrameDecoder() ); - - ctx.getChannel().write( res ); - - p.replace( "encoder", "wsencoder", new WebSocketFrameEncoder() ); - - return; - } - - // Send an error page otherwise. - sendHttpResponse( ctx, req, FORBIDDEN ); - } - - - private void handleWebSocketFrame( ChannelHandlerContext ctx, WebSocketFrame frame ) { - // Send the uppercased string back. - ctx.getChannel().write( new DefaultWebSocketFrame( frame.getTextData().toUpperCase() ) ); - } - - // TODO Review this for concurrency safety - // Note: subscriptions are added and removed relatively infrequently - // during the lifecycle of a connection i.e. typical minimum lifespan - // would be 10 seconds when someone opens an app, it connects, then - // they close the app. - - - private ChannelGroup getChannelGroupWithDefault( String path ) { - ChannelGroup group = subscribers.get( path ); - - if ( group == null ) { - group = subscribers.putIfAbsent( path, new DefaultChannelGroup() ); - } - - return group; - } - - - public void addSubscription( String path, Channel channel ) { - ChannelGroup group = subscribers.get( path ); - synchronized ( group ) { - group.add( channel ); - } - } - - - public void removeSubscription( String path, Channel channel ) { - ChannelGroup group = subscribers.get( path ); - synchronized ( group ) { - group.remove( channel ); - if ( group.isEmpty() ) { - subscribers.remove( path, group ); - } - } - } - - - public ChannelGroup getSubscriptionGroup( String path ) { - return subscribers.get( path ); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketKeyStore.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketKeyStore.java b/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketKeyStore.java deleted file mode 100644 index de3d3b9..0000000 --- a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketKeyStore.java +++ /dev/null @@ -1,50 +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 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.usergrid.websocket; - - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - - -public class WebSocketKeyStore { - private static final short[] DATA = new short[] { }; - - - private WebSocketKeyStore() { - throw new AssertionError(); - } - - - public static InputStream asInputStream() { - byte[] data = new byte[DATA.length]; - for ( int i = 0; i < data.length; i++ ) { - data[i] = ( byte ) DATA[i]; - } - return new ByteArrayInputStream( data ); - } - - - public static char[] getCertificatePassword() { - return "jwebsocket".toCharArray(); - } - - - public static char[] getKeyStorePassword() { - return "jwebsocket".toCharArray(); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServer.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServer.java b/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServer.java deleted file mode 100644 index a883f37..0000000 --- a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServer.java +++ /dev/null @@ -1,181 +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 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.usergrid.websocket; - - -import java.net.InetSocketAddress; -import java.util.Properties; -import java.util.concurrent.Executors; - -import org.jboss.netty.bootstrap.ServerBootstrap; -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; -import org.jboss.netty.handler.execution.ExecutionHandler; -import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.apache.usergrid.management.ManagementService; -import org.apache.usergrid.persistence.EntityManagerFactory; -import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl; -import org.apache.usergrid.services.ServiceManagerFactory; - -import org.apache.shiro.mgt.DefaultSecurityManager; -import org.apache.shiro.mgt.SessionsSecurityManager; -import org.apache.shiro.realm.Realm; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - - -/** - * An HTTP server which serves Web Socket requests at: - * <p/> - * http://localhost:8080/websocket - * <p/> - * Open your browser at http://localhost:8080/, then the demo page will be loaded and a Web Socket connection will be - * made automatically. - */ -public class WebSocketServer { - - private static final Logger logger = LoggerFactory.getLogger( WebSocketServer.class ); - - EntityManagerFactory emf; - ServiceManagerFactory smf; - ManagementService management; - Realm realm; - SessionsSecurityManager securityManager; - boolean ssl = false; - Channel channel; - Properties properties; - - - public static void main( String[] args ) throws Exception { - WebSocketServer server = new WebSocketServer(); - server.startSpring(); - server.startServer(); - } - - - public WebSocketServer() { - } - - - @Autowired - public void setEntityManagerFactory( EntityManagerFactory emf ) { - this.emf = emf; - } - - - @Autowired - public void setServiceManagerFactory( ServiceManagerFactory smf ) { - this.smf = smf; - } - - - @Autowired - public void setManagementService( ManagementService management ) { - this.management = management; - } - - - public void setSsl( boolean ssl ) { - this.ssl = ssl; - } - - - @Autowired - public void setRealm( Realm realm ) { - this.realm = realm; - } - - - public Properties getProperties() { - return properties; - } - - - @Autowired - public void setProperties( Properties properties ) { - this.properties = properties; - } - - - public String[] getApplicationContextLocations() { - String[] locations = { "applicationContext.xml" }; - return locations; - } - - - public void startSpring() { - - String[] locations = getApplicationContextLocations(); - ApplicationContext ac = new ClassPathXmlApplicationContext( locations ); - - AutowireCapableBeanFactory acbf = ac.getAutowireCapableBeanFactory(); - acbf.autowireBeanProperties( this, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false ); - acbf.initializeBean( this, "webSocketServer" ); - - assertNotNull( emf ); - assertTrue( "EntityManagerFactory is instance of EntityManagerFactoryImpl", - emf instanceof EntityManagerFactoryImpl ); - } - - - public void startServer() { - if ( ( properties != null ) && ( Boolean - .parseBoolean( properties.getProperty( "usergrid.websocket.disable", "false" ) ) ) ) { - logger.info( "Usergrid WebSocket Server Disabled" ); - return; - } - - logger.info( "Starting Usergrid WebSocket Server" ); - - if ( realm != null ) { - securityManager = new DefaultSecurityManager( realm ); - } - - ServerBootstrap bootstrap = new ServerBootstrap( - new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool() ) ); - - // Set up the pipeline factory. - ExecutionHandler executionHandler = - new ExecutionHandler( new OrderedMemoryAwareThreadPoolExecutor( 16, 1048576, 1048576 ) ); - - // Set up the event pipeline factory. - bootstrap.setPipelineFactory( - new WebSocketServerPipelineFactory( emf, smf, management, securityManager, executionHandler, ssl ) ); - - // Bind and start to accept incoming connections. - channel = bootstrap.bind( new InetSocketAddress( 8088 ) ); - - logger.info( "Usergrid WebSocket Server started..." ); - } - - - public void stopServer() { - logger.info( "Stopping WebSocket Server" ); - if ( channel != null ) { - channel.close(); - channel = null; - } - logger.info( "Usergrid WebSocket Server stopped..." ); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerIndexPage.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerIndexPage.java b/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerIndexPage.java deleted file mode 100644 index 9f0879e..0000000 --- a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerIndexPage.java +++ /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 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.usergrid.websocket; - - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.util.CharsetUtil; - - -/** - * Generates the demo HTML page which is served at http://localhost:8080/ - * - * @author <a href="http://www.jboss.org/netty/">The Netty Project</a> - * @author <a href="http://gleamynode.net/">Trustin Lee</a> - * @version $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $ - */ -public class WebSocketServerIndexPage { - - private static final String NEWLINE = "\r\n"; - - - public static ChannelBuffer getContent( String webSocketLocation ) { - return ChannelBuffers.copiedBuffer( - "<html><head><title>Web Socket Test</title></head>" + NEWLINE + "<body>" + NEWLINE - + "<script type=\"text/javascript\">" + NEWLINE + "var socket;" + NEWLINE - + "if (window.WebSocket) {" + NEWLINE + " socket = new WebSocket(\"" + webSocketLocation - + "/00000000-0000-0000-0000-000000000001/users/00000000-0000-0000-0000-000000000002?a=1\");" - + NEWLINE + " socket.onmessage = function(event) { alert(event.data); };" + NEWLINE - + " socket.onopen = function(event) { alert(\"Web Socket opened!\"); };" + NEWLINE - + " socket.onclose = function(event) { alert(\"Web Socket closed.\"); };" + NEWLINE - + "} else {" + NEWLINE + " alert(\"Your browser does not support Web Socket.\");" + NEWLINE - + "}" + NEWLINE + "" + NEWLINE + "function send(message) {" + NEWLINE - + " if (!window.WebSocket) { return; }" + NEWLINE + " if (socket.readyState == 1) {" + NEWLINE - + " socket.send(message);" + NEWLINE + " } else {" + NEWLINE - + " alert(\"The socket is not open.\");" + NEWLINE + " }" + NEWLINE + "}" + NEWLINE - + "</script>" + NEWLINE + "<form onsubmit=\"return false;\">" + NEWLINE - + "<input type=\"text\" name=\"message\" value=\"Hello, World!\"/>" - + "<input type=\"button\" value=\"Send Web Socket Data\" onclick=\"send(this.form.message" + - ".value)\" />" + NEWLINE + "</form>" + NEWLINE + "</body>" + NEWLINE + "</html>" + NEWLINE, - CharsetUtil.US_ASCII ); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerPipelineFactory.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerPipelineFactory.java b/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerPipelineFactory.java deleted file mode 100644 index c412711..0000000 --- a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketServerPipelineFactory.java +++ /dev/null @@ -1,76 +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 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.usergrid.websocket; - - -import javax.net.ssl.SSLEngine; - -import org.jboss.netty.channel.ChannelPipeline; -import org.jboss.netty.channel.ChannelPipelineFactory; -import org.jboss.netty.handler.codec.http.HttpChunkAggregator; -import org.jboss.netty.handler.codec.http.HttpRequestDecoder; -import org.jboss.netty.handler.codec.http.HttpResponseEncoder; -import org.jboss.netty.handler.execution.ExecutionHandler; -import org.jboss.netty.handler.ssl.SslHandler; -import org.apache.usergrid.management.ManagementService; -import org.apache.usergrid.persistence.EntityManagerFactory; -import org.apache.usergrid.services.ServiceManagerFactory; - -import org.apache.shiro.mgt.SessionsSecurityManager; - -import static org.jboss.netty.channel.Channels.pipeline; - - -public class WebSocketServerPipelineFactory implements ChannelPipelineFactory { - - private final ExecutionHandler executionHandler; - private final EntityManagerFactory emf; - private final ServiceManagerFactory smf; - private final ManagementService management; - private final SessionsSecurityManager securityManager; - private final boolean ssl; - - - public WebSocketServerPipelineFactory( EntityManagerFactory emf, ServiceManagerFactory smf, - ManagementService management, SessionsSecurityManager securityManager, - ExecutionHandler executionHandler, boolean ssl ) { - this.emf = emf; - this.smf = smf; - this.management = management; - this.securityManager = securityManager; - this.executionHandler = executionHandler; - this.ssl = ssl; - } - - - @Override - public ChannelPipeline getPipeline() throws Exception { - // Create a default pipeline implementation. - ChannelPipeline pipeline = pipeline(); - if ( ssl ) { - SSLEngine sslEngine = WebSocketSslContextFactory.getServerContext().createSSLEngine(); - sslEngine.setUseClientMode( false ); - pipeline.addLast( "ssl", new SslHandler( sslEngine ) ); - } - pipeline.addLast( "decoder", new HttpRequestDecoder() ); - pipeline.addLast( "aggregator", new HttpChunkAggregator( 65536 ) ); - pipeline.addLast( "encoder", new HttpResponseEncoder() ); - pipeline.addLast( "execution", executionHandler ); - pipeline.addLast( "handler", new WebSocketChannelHandler( emf, smf, management, securityManager, ssl ) ); - return pipeline; - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketSslContextFactory.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketSslContextFactory.java b/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketSslContextFactory.java deleted file mode 100644 index 2e6303b..0000000 --- a/stack/websocket/src/main/java/org/apache/usergrid/websocket/WebSocketSslContextFactory.java +++ /dev/null @@ -1,63 +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 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.usergrid.websocket; - - -import java.security.KeyStore; -import java.security.Security; - -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; - - -public class WebSocketSslContextFactory { - - private static final String PROTOCOL = "TLS"; - private static final SSLContext SERVER_CONTEXT; - - - static { - String algorithm = Security.getProperty( "ssl.KeyManagerFactory.algorithm" ); - if ( algorithm == null ) { - algorithm = "SunX509"; - } - - SSLContext serverContext = null; - try { - KeyStore ks = KeyStore.getInstance( "JKS" ); - ks.load( WebSocketKeyStore.asInputStream(), WebSocketKeyStore.getKeyStorePassword() ); - - // Set up key manager factory to use our key store - KeyManagerFactory kmf = KeyManagerFactory.getInstance( algorithm ); - kmf.init( ks, WebSocketKeyStore.getCertificatePassword() ); - - // Initialize the SSLContext to work with our key managers. - serverContext = SSLContext.getInstance( PROTOCOL ); - serverContext.init( kmf.getKeyManagers(), null, null ); - } - catch ( Exception e ) { - throw new Error( "Failed to initialize the server-side SSLContext", e ); - } - - SERVER_CONTEXT = serverContext; - } - - - public static SSLContext getServerContext() { - return SERVER_CONTEXT; - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/test/java/org/apache/usergrid/websocket/ExampleListener.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/test/java/org/apache/usergrid/websocket/ExampleListener.java b/stack/websocket/src/test/java/org/apache/usergrid/websocket/ExampleListener.java deleted file mode 100644 index c937105..0000000 --- a/stack/websocket/src/test/java/org/apache/usergrid/websocket/ExampleListener.java +++ /dev/null @@ -1,42 +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 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.usergrid.websocket; - - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.TextMessage; - - -public class ExampleListener implements MessageListener { - - @Override - public void onMessage( Message message ) { - if ( message instanceof TextMessage ) { - try { - System.out.println( ( ( TextMessage ) message ).getText() ); - } - catch ( JMSException ex ) { - throw new RuntimeException( ex ); - } - } - else { - throw new IllegalArgumentException( "Message must be of type TextMessage" ); - } - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/test/java/org/apache/usergrid/websocket/SimpleMessageProducer.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/test/java/org/apache/usergrid/websocket/SimpleMessageProducer.java b/stack/websocket/src/test/java/org/apache/usergrid/websocket/SimpleMessageProducer.java deleted file mode 100644 index fde70d1..0000000 --- a/stack/websocket/src/test/java/org/apache/usergrid/websocket/SimpleMessageProducer.java +++ /dev/null @@ -1,62 +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 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.usergrid.websocket; - - -import java.util.Date; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.jms.core.MessageCreator; - - -public class SimpleMessageProducer { - - private static final Logger logger = LoggerFactory.getLogger( SimpleMessageProducer.class ); - - @Autowired - protected JmsTemplate jmsTemplate; - - protected int numberOfMessages = 100; - - - public void sendMessages() throws JMSException { - - for ( int i = 0; i < numberOfMessages; ++i ) { - - final StringBuilder payload = new StringBuilder(); - payload.append( "Message [" ).append( i ).append( "] sent at: " ).append( new Date() ); - final int j = i; - jmsTemplate.send( new MessageCreator() { - @Override - public Message createMessage( Session session ) throws JMSException { - TextMessage message = session.createTextMessage( payload.toString() ); - message.setIntProperty( "messageCount", j ); - logger.info( "Sending message number [" + j + "]" ); - return message; - } - } ); - } - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/test/java/org/apache/usergrid/websocket/WebSocketServerTest.java ---------------------------------------------------------------------- diff --git a/stack/websocket/src/test/java/org/apache/usergrid/websocket/WebSocketServerTest.java b/stack/websocket/src/test/java/org/apache/usergrid/websocket/WebSocketServerTest.java deleted file mode 100644 index 007cce8..0000000 --- a/stack/websocket/src/test/java/org/apache/usergrid/websocket/WebSocketServerTest.java +++ /dev/null @@ -1,44 +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 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.usergrid.websocket; - - -import org.apache.usergrid.websocket.WebSocketServer; -import org.junit.Ignore; - - -@Ignore -public class WebSocketServerTest extends WebSocketServer { - - public WebSocketServerTest() { - super(); - } - - - public static void main( String[] args ) throws Exception { - WebSocketServer server = new WebSocketServerTest(); - server.startSpring(); - server.startServer(); - } - - - @Override - public String[] getApplicationContextLocations() { - String[] locations = { "testApplicationContext.xml" }; - return locations; - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/test/resources/test-activemq.xml ---------------------------------------------------------------------- diff --git a/stack/websocket/src/test/resources/test-activemq.xml b/stack/websocket/src/test/resources/test-activemq.xml deleted file mode 100644 index 72c5682..0000000 --- a/stack/websocket/src/test/resources/test-activemq.xml +++ /dev/null @@ -1,80 +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 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. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:amq="http://activemq.apache.org/schema/core" 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-2.0.xsd - http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> - - <!-- The <broker> element is used to configure the ActiveMQ broker. --> - <broker xmlns="http://activemq.apache.org/schema/core" - brokerName="localhost" dataDirectory="${activemq.base}/data"> - - <!-- For better performances use VM cursor and small memory limit. For - more information, see: http://activemq.apache.org/message-cursors.html Also, - if your producer is "hanging", it's probably due to producer flow control. - For more information, see: http://activemq.apache.org/producer-flow-control.html --> - - <destinationPolicy> - <policyMap> - <policyEntries> - <policyEntry topic=">" producerFlowControl="true" - memoryLimit="1mb"> - <pendingSubscriberPolicy> - <vmCursor /> - </pendingSubscriberPolicy> - </policyEntry> - <policyEntry queue=">" producerFlowControl="true" - memoryLimit="1mb"> - <!-- Use VM cursor for better latency For more information, see: http://activemq.apache.org/message-cursors.html - <pendingQueuePolicy> <vmQueueCursor/> </pendingQueuePolicy> --> - </policyEntry> - </policyEntries> - </policyMap> - </destinationPolicy> - - - <!-- The managementContext is used to configure how ActiveMQ is exposed - in JMX. By default, ActiveMQ uses the MBean server that is started by the - JVM. For more information, see: http://activemq.apache.org/jmx.html --> - <managementContext> - <managementContext createConnector="false" /> - </managementContext> - - <!-- Configure message persistence for the broker. The default persistence - mechanism is the KahaDB store (identified by the kahaDB tag). For more information, - see: http://activemq.apache.org/persistence.html --> - <persistenceAdapter> - <kahaDB directory="${activemq.base}/data/kahadb" /> - </persistenceAdapter> - - - <!-- The systemUsage controls the maximum amount of space the broker will - use before slowing down producers. For more information, see: http://activemq.apache.org/producer-flow-control.html - <systemUsage> <systemUsage> <memoryUsage> <memoryUsage limit="20 mb"/> </memoryUsage> - <storeUsage> <storeUsage limit="1 gb"/> </storeUsage> <tempUsage> <tempUsage - limit="100 mb"/> </tempUsage> </systemUsage> </systemUsage> --> - - <!-- The transport connectors expose ActiveMQ over a given protocol to - clients and other brokers. For more information, see: http://activemq.apache.org/configuring-transports.html --> - <transportConnectors> - <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" /> - </transportConnectors> - - </broker> - -</beans> http://git-wip-us.apache.org/repos/asf/usergrid/blob/6df86b4a/stack/websocket/src/test/resources/testApplicationContext.xml ---------------------------------------------------------------------- diff --git a/stack/websocket/src/test/resources/testApplicationContext.xml b/stack/websocket/src/test/resources/testApplicationContext.xml deleted file mode 100644 index d92f4fb..0000000 --- a/stack/websocket/src/test/resources/testApplicationContext.xml +++ /dev/null @@ -1,137 +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 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. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" - xmlns:context="http://www.springframework.org/schema/context" - xmlns:amq="http://activemq.apache.org/schema/core" xmlns:jms="http://www.springframework.org/schema/jms" - xmlns:p="http://www.springframework.org/schema/p" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd - http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd - http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd - http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> - - <context:component-scan base-package="org.apache.usergrid.persistence" /> - <context:annotation-config /> - - <bean id="properties" - class="org.springframework.beans.factory.config.PropertiesFactoryBean"> - <property name="singleton" value="true" /> - <property name="ignoreResourceNotFound" value="true" /> - <property name="locations"> - <list> - <value>classpath:/usergrid-default.properties</value> - <value>classpath:/usergrid-test.properties</value> - <value>${usergrid-custom-spring-test-properties}</value> - </list> - </property> - </bean> - - <bean id="propertyPlaceholderConfigurer" - class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> - <property name="properties" ref="properties" /> - <property name="systemPropertiesModeName"> - <value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value> - </property> - </bean> - - <bean id="cassandraUseRemote" class="java.lang.Boolean"> - <constructor-arg value="${cassandra.use_remote}" /> - </bean> - <bean id="cassandraLocalUrl" class="java.lang.String"> - <constructor-arg value="${cassandra.local.url}" /> - </bean> - <bean id="cassandraRemoteUrl" class="java.lang.String"> - <constructor-arg value="${cassandra.remote.url}" /> - </bean> - <bean id="cassandraUrl" class="java.lang.String"> - <constructor-arg - value="#{cassandraUseRemote ? cassandraRemoteUrl : cassandraLocalUrl}" /> - </bean> - <util:map id="cassandraCredentials" map-class="java.util.HashMap"> - <entry key="username" value="${cassandra.username}" /> - <entry key="password" value="${cassandra.password}" /> - </util:map> - - <bean id="realm" class="org.apache.usergrid.security.shiro.Realm"> - <property name="name" value="realm" /> - </bean> - - <bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager"> - <property name="realm" ref="realm" /> - </bean> - - <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/> - - <bean - class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> - <property name="staticMethod" - value="org.apache.shiro.SecurityUtils.setSecurityManager" /> - <property name="arguments" ref="securityManager" /> - </bean> - - <!-- The Time Resolution used for the cluster --> - <bean id="microsecondsTimeResolution" - class="me.prettyprint.cassandra.service.clock.MicrosecondsClockResolution" /> - - <bean id="cassandraHostConfigurator" - class="me.prettyprint.cassandra.service.CassandraHostConfigurator"> - <constructor-arg ref="cassandraUrl" /> - <property name="clockResolution" ref="microsecondsTimeResolution" /> - </bean> - - <bean id="cassandraCluster" class="me.prettyprint.cassandra.service.ThriftCluster"> - <constructor-arg value="${cassandra.cluster}" /> - <constructor-arg ref="cassandraHostConfigurator" /> - <constructor-arg ref="cassandraCredentials" /> - </bean> - - <bean id="injector" - class="org.apache.usergrid.corepersistence.GuiceFactory"> - </bean> - - <bean id="cassandraService" - class="org.apache.usergrid.persistence.cassandra.CassandraService" init-method="init"> - <constructor-arg ref="properties" /> - <constructor-arg ref="cassandraCluster" /> - <constructor-arg ref="cassandraHostConfigurator" /> - <constructor-arg ref="injector" /> - </bean> - - <bean id="entityManagerFactory" - class="org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl"> - <constructor-arg ref="cassandraService" /> - </bean> - - <bean id="queueManagerFactory" - class="org.apache.usergrid.mq.cassandra.QueueManagerFactoryImpl"> - <constructor-arg ref="cassandraService" /> - </bean> - - <bean id="serviceManagerFactory" class="org.apache.usergrid.services.ServiceManagerFactory"> - <constructor-arg> - <ref bean="entityManagerFactory" /> - </constructor-arg> - </bean> - - <bean id="tokenService" class="org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl"/> - - <bean id="managementService" class="org.apache.usergrid.management.cassandra.ManagementServiceImpl" /> - -</beans>