http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/flex/services-config.xml ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/flex/services-config.xml b/apps/samples-spring/WEB-INF/flex/services-config.xml deleted file mode 100755 index 6898ed1..0000000 --- a/apps/samples-spring/WEB-INF/flex/services-config.xml +++ /dev/null @@ -1,122 +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. - ---> -<services-config> - - <services> - <service-include file-path="remoting-config.xml" /> - <service-include file-path="proxy-config.xml" /> - <service-include file-path="messaging-config.xml" /> - <default-channels> - <channel ref="my-amf"/> - </default-channels> - </services> - - <channels> - - <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> - </channel-definition> - - <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> - <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/> - <properties> - <add-no-cache-headers>false</add-no-cache-headers> - </properties> - </channel-definition> - - <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/> - <properties> - <polling-enabled>true</polling-enabled> - <polling-interval-seconds>4</polling-interval-seconds> - </properties> - </channel-definition> - - <channel-definition id="my-longpolling-amf" class="mx.messaging.channels.AMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amflongpolling" class="flex.messaging.endpoints.AMFEndpoint"/> - <properties> - <polling-enabled>true</polling-enabled> - <polling-interval-seconds>5</polling-interval-seconds> - <wait-interval-millis>60000</wait-interval-millis> - <client-wait-interval-millis>1</client-wait-interval-millis> - <max-waiting-poll-requests>200</max-waiting-poll-requests> - <user-agent-settings> - <!-- MSIE 5, 6, 7 default max number of permanent HTTP connections is 2. --> - <user-agent match-on="MSIE" max-streaming-connections-per-session="1"/> - <!-- MSIE 8 max number is 6. --> - <user-agent match-on="MSIE 8" max-streaming-connections-per-session="5"/> - <!-- Firefox 1, 2 max number is 2. --> - <user-agent match-on="Firefox" max-streaming-connections-per-session="1"/> - <!-- Firefox 3 max number is 6. --> - <user-agent match-on="Firefox/3" max-streaming-connections-per-session="5"/> - <!-- Safari 3, 4 max number is 4. --> - <user-agent match-on="Safari" max-streaming-connections-per-session="3"/> - <!-- Chrome 0, 1, 2 max number is 6. --> - <user-agent match-on="Chrome" max-streaming-connections-per-session="5"/> - <!-- Opera 7, 9 max number is 4.--> - <user-agent match-on="Opera" max-streaming-connections-per-session="3"/> - <!-- Opera 8 max number is 8. --> - <user-agent match-on="Opera 8" max-streaming-connections-per-session="7"/> - <!-- Opera 10 max number is 8. --> - <user-agent match-on="Opera 10" max-streaming-connections-per-session="7"/> - </user-agent-settings> - </properties> - </channel-definition> - - <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/> - </channel-definition> - - </channels> - - <security> - <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/> - <security-constraint id="trusted"> - <roles> - <role>ROLE_USER</role> - <role>ROLE_ADMIN</role> - </roles> - </security-constraint> - </security> - - <logging> - <target class="flex.messaging.log.ConsoleTarget" level="Warn"> - <properties> - <prefix>[BlazeDS] </prefix> - <includeDate>false</includeDate> - <includeTime>false</includeTime> - <includeLevel>false</includeLevel> - <includeCategory>false</includeCategory> - </properties> - <filters> - <pattern>Endpoint.*</pattern> - <pattern>Service.*</pattern> - <pattern>Configuration</pattern> - </filters> - </target> - </logging> - - <system> - <redeploy> - <enabled>false</enabled> - </redeploy> - </system> - -</services-config>
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/spring/app-config.xml ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/spring/app-config.xml b/apps/samples-spring/WEB-INF/spring/app-config.xml deleted file mode 100755 index e13cdb8..0000000 --- a/apps/samples-spring/WEB-INF/spring/app-config.xml +++ /dev/null @@ -1,58 +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:security="http://www.springframework.org/schema/security" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/security - http://www.springframework.org/schema/security/spring-security-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - - <!-- - Enable annotation-based configuration. companyService and industryService - (used in the Company Manager sample) are configured using annotations. - Open CompanyDAO.java and IndustryDAO.java for details. - --> - <context:annotation-config /> - <context:component-scan base-package="org.springframework.flex.samples" /> - - <!-- Implementation of ProductDAO using low-level JDBC --> - <bean id="productService" class="org.springframework.flex.samples.product.ProductDAO"> - <constructor-arg ref="dataSource" /> - </bean> - - <!-- Implementation of ContactDAO using Spring's JdbcTemplate --> - <bean id="contactService" class="org.springframework.flex.samples.contact.ContactDAO"> - <constructor-arg ref="dataSource" /> - </bean> - - <!-- A secured implementation of ProductDAO --> - <bean id="securedProductService" class="org.springframework.flex.samples.product.ProductDAO"> - <constructor-arg ref="dataSource" /> - <security:intercept-methods> - <security:protect method="find*" access="ROLE_USER" /> - </security:intercept-methods> - </bean> - -</beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/spring/infrastructure-config.xml ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/spring/infrastructure-config.xml b/apps/samples-spring/WEB-INF/spring/infrastructure-config.xml deleted file mode 100755 index fa70dd2..0000000 --- a/apps/samples-spring/WEB-INF/spring/infrastructure-config.xml +++ /dev/null @@ -1,41 +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:jdbc="http://www.springframework.org/schema/jdbc" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:amq="http://activemq.apache.org/schema/core" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/jdbc - http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"> - - <!-- Create and populate the tables of the embedded database --> - <bean id="dbInit" class="org.springframework.flex.samples.util.DatabaseInitializer"> - <constructor-arg ref="dataSource" /> - </bean> - - <!-- - Simple Spring-managed DataSource for embedded HSQL database - The dbInit bean takes care of creating and populating the sample tables. - --> - <jdbc:embedded-database id="dataSource" type="HSQL" /> - -</beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/spring/security-config.xml ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/spring/security-config.xml b/apps/samples-spring/WEB-INF/spring/security-config.xml deleted file mode 100755 index 9c342a7..0000000 --- a/apps/samples-spring/WEB-INF/spring/security-config.xml +++ /dev/null @@ -1,43 +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:beans xmlns="http://www.springframework.org/schema/security" - xmlns:beans="http://www.springframework.org/schema/beans" 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/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"> - - <http entry-point-ref="entryPoint"> - <anonymous enabled="false"/> - <form-login default-target-url="/spring-blazeds-security-101/index.html" login-page="/login.jsp" /> - </http> - - <beans:bean id="entryPoint" - class="org.springframework.flex.security3.FlexAuthenticationEntryPoint"/> - - <authentication-manager> - <authentication-provider> - <user-service> - <user name="john" password="john" authorities="ROLE_USER" /> - <user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" /> - <user name="guest" password="guest" authorities="ROLE_GUEST" /> - </user-service> - </authentication-provider> - </authentication-manager> - -</beans:beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/.classpath ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/.classpath b/apps/samples-spring/WEB-INF/src/spring-samples/.classpath deleted file mode 100755 index 18eb959..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/.classpath +++ /dev/null @@ -1,68 +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. - ---> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/aopalliance-1.0.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/aspectjrt-1.6.3.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/aspectjweaver-1.6.5.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/backport-util-concurrent-2.2.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/cglib-nodep-2.1_3.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/commons-codec-1.3.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/commons-httpclient-3.1.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/commons-logging-1.1.1.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/flex-messaging-common.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/flex-messaging-core.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/flex-messaging-opt.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/flex-messaging-proxy.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/flex-messaging-remoting.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/flex-rds-server.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/hsqldb.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/jackson-core-asl-1.0.0.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/jstl-1.1.2.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.aop-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.asm-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.aspects-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.beans-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.context.support-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.context-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.core-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.expression-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.flex-1.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.instrument.tomcat-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.instrument-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.integration-1.0.4.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.jdbc-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.jms-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.orm-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.oxm-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.test-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.transaction-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.web.portlet-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.web.servlet-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.web.struts-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/org.springframework.web-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/spring-security-config-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/spring-security-core-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/spring-security-web-3.0.3.RELEASE.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR/standard-1.1.2.jar"/> - <classpathentry kind="var" path="WEBAPP_LIB_DIR"/> - <classpathentry kind="output" path="bin"/> -</classpath> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/.project ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/.project b/apps/samples-spring/WEB-INF/src/spring-samples/.project deleted file mode 100755 index ae8612b..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/.project +++ /dev/null @@ -1,35 +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. - ---> -<projectDescription> - <name>spring-samples</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/Company.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/Company.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/Company.java deleted file mode 100755 index f220d2f..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/Company.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.company; - -import java.io.Serializable; - -import org.springframework.flex.samples.industry.Industry; - -public class Company implements Serializable { - - static final long serialVersionUID = 103844514947365244L; - - private int id; - - private String name; - - private String address; - - private String city; - - private String state; - - private String zip; - - private String phone; - - private Industry industry; - - public Company() { - - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return this.address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return this.city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZip() { - return this.zip; - } - - public void setZip(String zip) { - this.zip = zip; - } - - public String getPhone() { - return this.phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public Industry getIndustry() { - return this.industry; - } - - public void setIndustry(Industry industry) { - this.industry = industry; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/CompanyDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/CompanyDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/CompanyDAO.java deleted file mode 100755 index 713e56f..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/CompanyDAO.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.company; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.flex.remoting.RemotingDestination; -import org.springframework.flex.remoting.RemotingExclude; -import org.springframework.flex.remoting.RemotingInclude; -import org.springframework.flex.samples.industry.IIndustryDAO; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; -import org.springframework.jdbc.core.simple.SimpleJdbcInsert; -import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service("companyService") -@RemotingDestination(channels = { "my-amf" }) -public class CompanyDAO implements ICompanyDAO { - - private final SimpleJdbcTemplate template; - - private final SimpleJdbcInsert insertCompany; - - private final IIndustryDAO industryDAO; - - private final RowMapper<Company> rowMapper = new ParameterizedRowMapper<Company>() { - - public Company mapRow(ResultSet rs, int rowNum) throws SQLException { - Company company = new Company(); - company.setId(rs.getInt("id")); - company.setName(rs.getString("name")); - company.setAddress(rs.getString("address")); - company.setCity(rs.getString("city")); - company.setState(rs.getString("state")); - company.setZip(rs.getString("zip")); - company.setPhone(rs.getString("phone")); - company.setIndustry(CompanyDAO.this.industryDAO.findById(rs.getInt("industry_id"))); - return company; - } - }; - - @Autowired - public CompanyDAO(DataSource dataSource, IIndustryDAO industryDAO) { - this.template = new SimpleJdbcTemplate(dataSource); - this.insertCompany = new SimpleJdbcInsert(dataSource).withTableName("COMPANY").usingGeneratedKeyColumns("ID"); - this.industryDAO = industryDAO; - } - - @RemotingInclude - public Company findById(int id) { - return this.template.queryForObject("SELECT * FROM company WHERE id=?", this.rowMapper, id); - } - - @RemotingInclude - public List<Company> findAll() { - return this.template.query("SELECT * FROM company ORDER BY name", this.rowMapper); - } - - @RemotingInclude - public List<Company> findByName(String name) { - return this.template.query("SELECT * FROM company WHERE UPPER(name) LIKE ? ORDER BY name", this.rowMapper, "%" + name.toUpperCase() + "%"); - } - - @RemotingInclude - public Company create(Company company) { - Map<String, Object> parameters = new HashMap<String, Object>(); - parameters.put("name", company.getName()); - parameters.put("address", company.getAddress()); - parameters.put("city", company.getCity()); - parameters.put("state", company.getState()); - parameters.put("zip", company.getZip()); - parameters.put("phone", company.getPhone()); - parameters.put("industry_id", company.getIndustry().getId()); - Number id = this.insertCompany.executeAndReturnKey(parameters); - company.setId(id.intValue()); - return company; - } - - @RemotingInclude - public boolean update(Company company) { - int count = this.template.update("UPDATE company SET name=?, address=?, city=?, state=?, zip=?, phone=?, industry_id=? WHERE id=?", - company.getName(), company.getAddress(), company.getCity(), company.getState(), company.getZip(), company.getPhone(), - company.getIndustry().getId(), company.getId()); - return count == 1; - } - - @RemotingExclude - public boolean remove(Company company) { - int count = this.template.update("DELETE FROM company WHERE id=?", company.getId()); - return count == 1; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/ICompanyDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/ICompanyDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/ICompanyDAO.java deleted file mode 100755 index 30e66df..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/company/ICompanyDAO.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.company; - -import org.springframework.flex.samples.dao.IGenericDAO; - -public interface ICompanyDAO extends IGenericDAO<Company> { - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/Contact.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/Contact.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/Contact.java deleted file mode 100755 index 364e128..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/Contact.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.contact; - -import java.io.Serializable; - -public class Contact implements Serializable { - - static final long serialVersionUID = 103844514947365244L; - - private int id; - - private String firstName; - - private String lastName; - - private String address; - - private String city; - - private String state; - - private String zip; - - private String phone; - - private String email; - - public Contact() { - - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return this.firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return this.lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getAddress() { - return this.address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return this.city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZip() { - return this.zip; - } - - public void setZip(String zip) { - this.zip = zip; - } - - public String getPhone() { - return this.phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getEmail() { - return this.email; - } - - public void setEmail(String email) { - this.email = email; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/ContactDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/ContactDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/ContactDAO.java deleted file mode 100755 index 8c7115a..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/ContactDAO.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - - /* - * This file has been modified by Adobe (Adobe Systems Incorporated). - * Date: April 10, 2010 - * Reason: Migrated the DB used for samples-spring web app to HSQL. - */ - -package org.springframework.flex.samples.contact; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.sql.DataSource; - -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; -import org.springframework.jdbc.core.simple.SimpleJdbcInsert; -import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; - -public class ContactDAO implements IContactDAO { - - private final SimpleJdbcTemplate template; - - private final SimpleJdbcInsert insertContact; - - private final RowMapper<Contact> rowMapper = new ParameterizedRowMapper<Contact>() { - - public Contact mapRow(ResultSet rs, int rowNum) throws SQLException { - Contact contact = new Contact(); - contact.setId(rs.getInt("id")); - contact.setFirstName(rs.getString("first_name")); - contact.setLastName(rs.getString("last_name")); - contact.setAddress(rs.getString("address")); - contact.setCity(rs.getString("city")); - contact.setState(rs.getString("state")); - contact.setZip(rs.getString("zip")); - contact.setPhone(rs.getString("phone")); - contact.setEmail(rs.getString("email")); - return contact; - } - }; - - public ContactDAO(DataSource dataSource) { - this.template = new SimpleJdbcTemplate(dataSource); - this.insertContact = new SimpleJdbcInsert(dataSource).withTableName("CONTACT").usingGeneratedKeyColumns("ID"); - } - - public List<Contact> findAll() { - return this.template.query("SELECT * FROM contact ORDER BY first_name, last_name", this.rowMapper); - } - - public List<Contact> findByName(String name) { - return this.template.query("SELECT * FROM contact WHERE UPPER(CONCAT(CONCAT(first_name, ' '), last_name)) LIKE ? ORDER BY first_name, last_name", - this.rowMapper, "%" + name.toUpperCase() + "%"); - } - - public Contact findById(int id) { - return this.template.queryForObject("SELECT * FROM contact WHERE id=?", this.rowMapper, id); - } - - public Contact create(Contact contact) { - Map<String, Object> parameters = new HashMap<String, Object>(); - parameters.put("first_name", contact.getFirstName()); - parameters.put("last_name", contact.getLastName()); - parameters.put("address", contact.getAddress()); - parameters.put("city", contact.getCity()); - parameters.put("state", contact.getState()); - parameters.put("zip", contact.getZip()); - parameters.put("phone", contact.getPhone()); - parameters.put("email", contact.getEmail()); - Number id = this.insertContact.executeAndReturnKey(parameters); - contact.setId(id.intValue()); - return contact; - } - - public boolean update(Contact contact) { - int count = this.template.update( - "UPDATE contact SET first_name=?, last_name=?, address=?, city=?, state=?, zip=?, phone=?, email=? WHERE id=?", contact.getFirstName(), - contact.getLastName(), contact.getAddress(), contact.getCity(), contact.getState(), contact.getZip(), contact.getPhone(), - contact.getEmail(), contact.getId()); - return count == 1; - } - - public boolean remove(Contact contact) { - int count = this.template.update("DELETE FROM contact WHERE id=?", contact.getId()); - return count == 1; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/IContactDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/IContactDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/IContactDAO.java deleted file mode 100755 index 5096acf..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/contact/IContactDAO.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.contact; - -import org.springframework.flex.samples.dao.IGenericDAO; - -public interface IContactDAO extends IGenericDAO<Contact> { - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/dao/IGenericDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/dao/IGenericDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/dao/IGenericDAO.java deleted file mode 100755 index ecd5a6e..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/dao/IGenericDAO.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.dao; - -import java.util.List; - -public interface IGenericDAO<T> { - - public List<T> findAll(); - - public List<T> findByName(String name); - - public T findById(int id); - - public T create(T item); - - public boolean update(T item); - - public boolean remove(T item); - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IIndustryDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IIndustryDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IIndustryDAO.java deleted file mode 100755 index 2444f6f..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IIndustryDAO.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.industry; - -import org.springframework.flex.samples.dao.IGenericDAO; - -public interface IIndustryDAO extends IGenericDAO<Industry> { - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/Industry.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/Industry.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/Industry.java deleted file mode 100755 index 92292b2..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/Industry.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.industry; - -import java.io.Serializable; - -public class Industry implements Serializable { - - static final long serialVersionUID = 103844514947365244L; - - private int id; - - private String name; - - public Industry() { - - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IndustryDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IndustryDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IndustryDAO.java deleted file mode 100755 index 47cda01..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/industry/IndustryDAO.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.industry; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.flex.remoting.RemotingDestination; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; -import org.springframework.jdbc.core.simple.SimpleJdbcInsert; -import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service("industryService") -@RemotingDestination(channels = { "my-amf" }) -public class IndustryDAO implements IIndustryDAO { - - private final SimpleJdbcTemplate template; - - private final SimpleJdbcInsert insertIndustry; - - private final RowMapper<Industry> rowMapper = new ParameterizedRowMapper<Industry>() { - - public Industry mapRow(ResultSet rs, int rowNum) throws SQLException { - Industry industry = new Industry(); - industry.setId(rs.getInt("id")); - industry.setName(rs.getString("name")); - return industry; - } - }; - - public List<Industry> findAll() { - return this.template.query("SELECT * FROM industry ORDER BY name", this.rowMapper); - } - - public List<Industry> findByName(String name) { - return this.template.query("SELECT * FROM industry WHERE UPPER(name) LIKE ? ORDER BY name", this.rowMapper, "%" + name.toUpperCase() + "%"); - } - - @Autowired - public IndustryDAO(DataSource dataSource) { - this.template = new SimpleJdbcTemplate(dataSource); - this.insertIndustry = new SimpleJdbcInsert(dataSource).withTableName("INDUSTRY").usingGeneratedKeyColumns("ID"); - } - - public Industry findById(int id) { - return this.template.queryForObject("SELECT * FROM industry WHERE id=?", this.rowMapper, id); - } - - public Industry create(Industry industry) { - Map<String, Object> parameters = new HashMap<String, Object>(); - parameters.put("name", industry.getName()); - Number id = this.insertIndustry.executeAndReturnKey(parameters); - industry.setId(id.intValue()); - return industry; - } - - public boolean update(Industry industry) { - int count = this.template.update("UPDATE industry SET name=? WHERE id=?", industry.getName()); - return count == 1; - } - - public boolean remove(Industry industry) { - int count = this.template.update("DELETE FROM industry WHERE id=?", industry.getId()); - return count == 1; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/integration/Counter.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/integration/Counter.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/integration/Counter.java deleted file mode 100755 index b7dd467..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/integration/Counter.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.integration; - -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class Counter { - - private volatile boolean running; - - private final Log log = LogFactory.getLog(Counter.class); - - private final AtomicInteger count = new AtomicInteger(); - - public Integer next() { - return this.running ? this.count.getAndIncrement() : null; - } - - public void handle(String message) { - if ("start".equalsIgnoreCase(message)) { - this.running = true; - } else if ("stop".equalsIgnoreCase(message)) { - this.running = false; - } else { - try { - this.count.set(Integer.parseInt(message)); - } catch (NumberFormatException e) { - this.log.info("UNSUPPORTED FLEX MESSAGE RECEIVED: " + message); - } - } - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/MarketFeed.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/MarketFeed.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/MarketFeed.java deleted file mode 100755 index db0423f..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/MarketFeed.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - - /* - * This file has been modified by Adobe (Adobe Systems Incorporated). - * Date: May 19, 2010 - * Reason(s): Fixed the following issues: - * BLZ-533: unexploded war fails to deploy on weblogic - * - * Date: Oct 7, 2010 - * Reason(s): Fixed the following issues: - * BLZ-573: Cannot create a new company in Company Manager Sample in Spring BlazeDS Integration Test Drive - * BLZ-574: Error in creating new contact in insync05 sample in Spring BlazeDS Integration test drive - */ - -package org.springframework.flex.samples.marketfeed; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Random; - -import javax.xml.parsers.DocumentBuilderFactory; - -import org.springframework.core.io.Resource; -import org.springframework.flex.messaging.AsyncMessageCreator; -import org.springframework.flex.messaging.MessageTemplate; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import flex.messaging.messages.AsyncMessage; - -public class MarketFeed { - - private static FeedThread thread; - - private final MessageTemplate template; - - private final List<Stock> stockList; - - public MarketFeed(MessageTemplate template, Resource filePath) throws IOException { - this.template = template; - this.stockList = getStocks(filePath.getInputStream()); - } - - public void start() { - if (thread == null) { - thread = new FeedThread(this.template, this.stockList); - thread.start(); - } - } - - public void stop() { - if (thread != null) { - thread.running = false; - thread = null; - } - } - - private List<Stock> getStocks(InputStream fileInputStream) { - - List<Stock> list = new ArrayList<Stock>(); - - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setValidating(false); - Document doc = factory.newDocumentBuilder().parse(fileInputStream); - NodeList stockNodes = doc.getElementsByTagName("stock"); - int length = stockNodes.getLength(); - Stock stock; - Node stockNode; - for (int i = 0; i < length; i++) { - stockNode = stockNodes.item(i); - stock = new Stock(); - stock.setSymbol(getStringValue(stockNode, "symbol")); - stock.setName(getStringValue(stockNode, "company")); - stock.setLast(getDoubleValue(stockNode, "last")); - stock.setHigh(stock.getLast()); - stock.setLow(stock.getLast()); - stock.setOpen(stock.getLast()); - stock.setChange(0); - list.add(stock); - } - } catch (Exception e) { - e.printStackTrace(); - } - - return list; - } - - private String getStringValue(Node node, String name) { - return ((Element) node).getElementsByTagName(name).item(0).getFirstChild().getNodeValue(); - } - - private double getDoubleValue(Node node, String name) { - return Double.parseDouble(getStringValue(node, name)); - } - - public static class FeedThread extends Thread { - - public boolean running = false; - - private final MessageTemplate template; - - private final List<Stock> stockList; - - private final Random random = new Random(); - - public FeedThread(MessageTemplate template, List<Stock> stockList) { - this.template = template; - this.stockList = stockList; - } - - @Override - public void run() { - this.running = true; - - int size = this.stockList.size(); - int index = 0; - - Stock stock; - - while (this.running) { - - stock = this.stockList.get(index); - simulateChange(stock); - - index++; - if (index >= size) { - index = 0; - } - - sendStockUpdate(stock); - - try { - Thread.sleep(20); - } catch (InterruptedException e) { - } - - } - } - - private void sendStockUpdate(final Stock stock) { - template.send(new AsyncMessageCreator() { - - public AsyncMessage createMessage() { - AsyncMessage msg = template.createMessageForDestination("market-feed"); - msg.setHeader("DSSubtopic", stock.getSymbol()); - msg.setBody(stock); - return msg; - } - }); - } - - private void simulateChange(Stock stock) { - - double maxChange = stock.open * 0.005; - double change = maxChange - this.random.nextDouble() * maxChange * 2; - stock.change = change; - double last = stock.last + change; - - if (last < stock.open + stock.open * 0.15 && last > stock.open - stock.open * 0.15) { - stock.last = last; - } else { - stock.last = stock.last - change; - } - - if (stock.last > stock.high) { - stock.high = stock.last; - } else if (stock.last < stock.low) { - stock.low = stock.last; - } - stock.date = new Date(); - - } - - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/Stock.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/Stock.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/Stock.java deleted file mode 100755 index c5cbf45..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/marketfeed/Stock.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.marketfeed; - -import java.io.Serializable; -import java.util.Date; - -public class Stock implements Serializable { - - private static final long serialVersionUID = -1763421100056755200L; - - protected String symbol; - - protected String name; - - protected double low; - - protected double high; - - protected double open; - - protected double last; - - protected double change; - - protected Date date; - - public double getChange() { - return this.change; - } - - public void setChange(double change) { - this.change = change; - } - - public double getHigh() { - return this.high; - } - - public void setHigh(double high) { - this.high = high; - } - - public double getLast() { - return this.last; - } - - public void setLast(double last) { - this.last = last; - } - - public double getLow() { - return this.low; - } - - public void setLow(double low) { - this.low = low; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public double getOpen() { - return this.open; - } - - public void setOpen(double open) { - this.open = open; - } - - public String getSymbol() { - return this.symbol; - } - - public void setSymbol(String symbol) { - this.symbol = symbol; - } - - public Date getDate() { - return this.date; - } - - public void setDate(Date date) { - this.date = date; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/IProductDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/IProductDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/IProductDAO.java deleted file mode 100755 index a5f2f54..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/IProductDAO.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.product; - -import org.springframework.flex.samples.dao.IGenericDAO; - -public interface IProductDAO extends IGenericDAO<Product> { - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/Product.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/Product.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/Product.java deleted file mode 100755 index 5e37e19..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/Product.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.product; - -import java.io.Serializable; - -public class Product implements Serializable { - - static final long serialVersionUID = 103844514947365244L; - - private int productId; - - private String name; - - private String description; - - private String image; - - private String category; - - private double price; - - private int qty; - - public Product() { - - } - - public Product(int productId, String name, String description, String image, String category, double price, int qty) { - this.productId = productId; - this.name = name; - this.description = description; - this.image = image; - this.category = category; - this.price = price; - this.qty = qty; - } - - public String getCategory() { - return this.category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getImage() { - return this.image; - } - - public void setImage(String image) { - this.image = image; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public double getPrice() { - return this.price; - } - - public void setPrice(double price) { - this.price = price; - } - - public int getProductId() { - return this.productId; - } - - public void setProductId(int productId) { - this.productId = productId; - } - - public int getQty() { - return this.qty; - } - - public void setQty(int qty) { - this.qty = qty; - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/ProductDAO.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/ProductDAO.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/ProductDAO.java deleted file mode 100755 index 881b22a..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/product/ProductDAO.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - -package org.springframework.flex.samples.product; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import javax.sql.DataSource; - -public class ProductDAO implements IProductDAO { - - private final DataSource dataSource; - - public ProductDAO(DataSource dataSource) { - this.dataSource = dataSource; - } - - public List<Product> findAll() { - List<Product> list = new ArrayList<Product>(); - Connection c = null; - - try { - c = this.dataSource.getConnection(); - Statement s = c.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM product ORDER BY name"); - while (rs.next()) { - list.add(new Product(rs.getInt("id"), rs.getString("name"), rs.getString("description"), rs.getString("image"), - rs.getString("category"), rs.getDouble("price"), rs.getInt("qty"))); - } - } catch (SQLException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - return list; - } - - public List<Product> findByName(String name) { - List<Product> list = new ArrayList<Product>(); - Connection c = null; - try { - c = this.dataSource.getConnection(); - PreparedStatement ps = c.prepareStatement("SELECT * FROM product WHERE UPPER(name) LIKE ? ORDER BY name"); - ps.setString(1, "%" + name.toUpperCase() + "%"); - ResultSet rs = ps.executeQuery(); - while (rs.next()) { - list.add(new Product(rs.getInt("id"), rs.getString("name"), rs.getString("description"), rs.getString("image"), - rs.getString("category"), rs.getDouble("price"), rs.getInt("qty"))); - } - } catch (SQLException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - return list; - } - - public Product findById(int id) { - Product product = new Product(); - Connection c = null; - try { - c = this.dataSource.getConnection(); - PreparedStatement ps = c.prepareStatement("SELECT * FROM product WHERE id=?"); - ps.setInt(1, id); - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - product = new Product(); - product.setProductId(rs.getInt("id")); - product.setName(rs.getString("name")); - product.setDescription(rs.getString("description")); - product.setImage(rs.getString("image")); - product.setCategory(rs.getString("category")); - product.setPrice(rs.getDouble("price")); - product.setQty(rs.getInt("qty")); - } - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - return product; - } - - public Product create(Product product) { - Connection c = null; - PreparedStatement ps = null; - try { - c = this.dataSource.getConnection(); - ps = c.prepareStatement("INSERT INTO product (name, description, image, category, price, qty) VALUES (?, ?, ?, ?, ?, ?)", - new String[] { "ID" }); - ps.setString(1, product.getName()); - ps.setString(2, product.getDescription()); - ps.setString(3, product.getImage()); - ps.setString(4, product.getCategory()); - ps.setDouble(5, product.getPrice()); - ps.setInt(6, product.getQty()); - ps.executeUpdate(); - ResultSet rs = ps.getGeneratedKeys(); - rs.next(); - // Update the id in the returned object. This is important as this value must be returned to the client. - int id = rs.getInt(1); - product.setProductId(id); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - return product; - } - - public boolean update(Product product) { - Connection c = null; - try { - c = this.dataSource.getConnection(); - PreparedStatement ps = c.prepareStatement("UPDATE product SET name=?, description=?, image=?, category=?, price=?, qty=? WHERE id=?"); - ps.setString(1, product.getName()); - ps.setString(2, product.getDescription()); - ps.setString(3, product.getImage()); - ps.setString(4, product.getCategory()); - ps.setDouble(5, product.getPrice()); - ps.setInt(6, product.getQty()); - ps.setInt(7, product.getProductId()); - return ps.executeUpdate() == 1; - } catch (SQLException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - - } - - public boolean remove(Product product) { - Connection c = null; - try { - c = this.dataSource.getConnection(); - PreparedStatement ps = c.prepareStatement("DELETE FROM product WHERE id=?"); - ps.setInt(1, product.getProductId()); - int count = ps.executeUpdate(); - return count == 1; - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/secured/Security3Helper.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/secured/Security3Helper.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/secured/Security3Helper.java deleted file mode 100755 index 24bd1c0..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/secured/Security3Helper.java +++ /dev/null @@ -1,29 +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.springframework.flex.samples.secured; - -import java.util.Map; - -import org.springframework.flex.security3.AuthenticationResultUtils; - - -public class Security3Helper { - - public Map<String, Object> getAuthentication() { - return AuthenticationResultUtils.getAuthenticationResult(); - } -} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/bf2e1dc9/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/simplefeed/SimpleFeed.java ---------------------------------------------------------------------- diff --git a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/simplefeed/SimpleFeed.java b/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/simplefeed/SimpleFeed.java deleted file mode 100755 index 759cbd6..0000000 --- a/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex/samples/simplefeed/SimpleFeed.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * 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. - */ - - /* - * This file has been modified by Adobe (Adobe Systems Incorporated). - * Date: Oct 7, 2010 - * Reason(s): Fixed the following issues: - * BLZ-573: Cannot create a new company in Company Manager Sample in Spring BlazeDS Integration Test Drive - * BLZ-574: Error in creating new contact in insync05 sample in Spring BlazeDS Integration test drive - */ - -package org.springframework.flex.samples.simplefeed; - -import java.util.Random; - -import org.springframework.flex.messaging.MessageTemplate; - -public class SimpleFeed { - - private static FeedThread thread; - - private final MessageTemplate template; - - public SimpleFeed(MessageTemplate template) { - this.template = template; - } - - public void start() { - if (thread == null) { - thread = new FeedThread(this.template); - thread.start(); - } - } - - public void stop() { - if (thread != null) { - thread.running = false; - thread = null; - } - } - - public static class FeedThread extends Thread { - - public boolean running = false; - - private final MessageTemplate template; - - public FeedThread(MessageTemplate template) { - this.template = template; - } - - @Override - public void run() { - this.running = true; - Random random = new Random(); - double initialValue = 35; - double currentValue = 35; - double maxChange = initialValue * 0.005; - - while (this.running) { - double change = maxChange - random.nextDouble() * maxChange * 2; - double newValue = currentValue + change; - - if (currentValue < initialValue + initialValue * 0.15 && currentValue > initialValue - initialValue * 0.15) { - currentValue = newValue; - } else { - currentValue -= change; - } - - this.template.send("simple-feed", new Double(currentValue)); - - try { - Thread.sleep(300); - } catch (InterruptedException e) { - } - - } - } - } - -}
