struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [50/51] [abbrv] [partial] struts-archetypes git commit: WW-4316 Moves Struts archetypes into its own repo
Date Thu, 14 Jul 2016 17:58:06 GMT
http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/ProjectsAction.java
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/ProjectsAction.java
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/ProjectsAction.java
new file mode 100644
index 0000000..996d089
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/ProjectsAction.java
@@ -0,0 +1,72 @@
+/*
+ * 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 ${package}.actions.data;
+
+import com.opensymphony.xwork2.ActionSupport;
+import org.apache.struts2.convention.annotation.Result;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <code>List Apache projects.</code>
+ */
+@Result(type = "json")
+public class ProjectsAction extends ActionSupport {
+
+    private static final long serialVersionUID = 9037336532369476225L;
+    private static final Logger log = LogManager.getLogger(ProjectsAction.class);
+
+    private List<String> projectNames;
+
+    public String execute() throws Exception {
+
+        projectNames = new ArrayList<String>();
+        projectNames.add("Apache Struts");
+        projectNames.add("Apache Log4j");
+        projectNames.add("Apache Tomcat");
+        projectNames.add("Apache Maven");
+        projectNames.add("Apache Ant");
+        projectNames.add("Apache Log4Net");
+        projectNames.add("Apache Log4Cxx");
+        projectNames.add("Apache Chainsaw");
+        projectNames.add("Apache Incubator");
+        projectNames.add("Apache Hadoop");
+        projectNames.add("Apache OpenOffice");
+        projectNames.add("Apache Mahout");
+        projectNames.add("Apache Tapestry");
+        projectNames.add("Apache Jena");
+        projectNames.add("Apache Solr");
+        projectNames.add("Apache Cayenne");
+        projectNames.add("Apache OpenEJB");
+        projectNames.add("Apache Deltaspike");
+        projectNames.add("Apache Cordova");
+
+        log.debug("Return {} Apache projects", projectNames.size());
+
+        return SUCCESS;
+    }
+
+    public List<String> getProjectNames() {
+        return projectNames;
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/package-info.java
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/package-info.java
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/package-info.java
new file mode 100644
index 0000000..3e4af32
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/data/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+@ParentPackage("data")
+@Namespace("/data")
+package ${package}.actions.data;
+
+import org.apache.struts2.convention.annotation.Namespace;
+import org.apache.struts2.convention.annotation.ParentPackage;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/jshint.conf.js
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/jshint.conf.js
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/jshint.conf.js
new file mode 100644
index 0000000..91d3bb3
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/jshint.conf.js
@@ -0,0 +1,13 @@
+{
+    "maxparams": 3,
+    "indent": true,
+    "camelcase": true,
+    "eqeqeq": true,
+    "forin": true,
+    "immed": true,
+    "latedef": false,
+    "noarg": true,
+    "noempty": true,
+    "nonew": true,
+    "globals": {}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..6d27d12
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration>
+    <Appenders>
+        <Console name="STDOUT" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Logger name="com.opensymphony.xwork2" level="info"/>
+        <Logger name="org.apache.struts2" level="info"/>
+        <Logger name="\${groupId}" level="debug"/>
+        <Root level="warn">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package.properties
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package.properties
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package.properties
new file mode 100644
index 0000000..b8ee61f
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package.properties
@@ -0,0 +1 @@
+hello.message = Struts is up and running...

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package_es.properties
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package_es.properties
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package_es.properties
new file mode 100644
index 0000000..9f3bc40
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/package_es.properties
@@ -0,0 +1 @@
+hello.message = \u00A1Struts est\u00E1 bien\!...

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/struts.xml
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/struts.xml
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/struts.xml
new file mode 100644
index 0000000..d11f2d8
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/struts.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+	"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
+	"http://struts.apache.org/dtds/struts-2.5.dtd">
+<struts>
+
+  <constant name="struts.enable.DynamicMethodInvocation" value="false"/>
+  <constant name="struts.devMode" value="true"/>
+
+  <constant name="struts.convention.default.parent.package" value="angularstruts"/>
+  <package name="angularstruts" extends="json-default">
+    <default-action-ref name="index" />
+  </package>
+  <package name="data" extends="angularstruts" namespace="/data"></package>
+
+</struts>

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/index.jsp
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/index.jsp
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/index.jsp
new file mode 100644
index 0000000..3f6c374
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/index.jsp
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<%@ page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<html lang="en" ng-app="app">
+<head>
+    <meta charset="utf-8">
+    <title>My AngularJS Struts2 App</title>
+
+    <base href="<s:url forceAddSchemeHostAndPort="true" includeContext="true" value="/"
namespace="/" />">
+</head>
+<body>
+
+<h2><s:property value="message"/></h2>
+
+<div>
+    <a href="/home">Home</a> - <a href="/projects">Projects</a>
+</div>
+
+<div ng-controller="AppController as app">
+    <div ng-view></div>
+</div>
+
+<s:if test="useMinifiedResources">
+    <script src="<s:url value="js/external.js" />"></script>
+    <script src="<s:url value="js/application.js" />"></script>
+</s:if>
+<s:else>
+    <script src="<s:url value="js/lib/angular/angular.min.js" />"></script>
+    <script src="<s:url value="js/lib/angular/angular-route.min.js" />"></script>
+    <script src="<s:url value="js/app.js" />"></script>
+    <script src="<s:url value="js/config.js" />"></script>
+    <script src="<s:url value="js/services/DataService.js" />"></script>
+    <script src="<s:url value="js/controllers/AppController.js" />"></script>
+    <script src="<s:url value="js/controllers/HomeController.js" />"></script>
+    <script src="<s:url value="js/controllers/ApacheProjectsController.js" />"></script>
+</s:else>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..8d08c0b
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="struts_angularjs" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+    <display-name>Struts Blank AngularJS App</display-name>
+
+    <filter>
+        <filter-name>struts2</filter-name>
+        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>struts2</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+</web-app>

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp
new file mode 100644
index 0000000..a81b87f
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp
@@ -0,0 +1 @@
+<% response.sendRedirect("index"); %>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
new file mode 100644
index 0000000..6d2da17
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
@@ -0,0 +1,26 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app', ['ngRoute']);
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
new file mode 100644
index 0000000..9b93aab
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
@@ -0,0 +1,40 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+(function() {
+    'use strict';
+
+    angular
+    .module('app')
+        .config(['$routeProvider', '$locationProvider',
+            function($routeProvider, $locationProvider) {
+
+                $locationProvider.html5Mode(true).hashPrefix('!');
+
+                $routeProvider.when('/projects', {
+                    templateUrl: 'partials/projects.html',
+                    controller: 'ApacheProjectsController as vm'
+                }).when('/home', {
+                    templateUrl: 'partials/home.html',
+                    controller: 'HomeController as vm'
+                }).otherwise({ redirectTo: '/home' });
+            }
+        ]);
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
new file mode 100644
index 0000000..1fb0ca9
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app')
+        .controller('ApacheProjectsController', ApacheProjectsController);
+
+    function ApacheProjectsController($log, DataService) {
+        var vm = this;
+
+        init();
+
+        function init() {
+            return DataService.getProjects().then(function(data) {
+                vm.projects = data.projectNames;
+                return vm.projects;
+            }, function() {
+                $log.error('Could not receive project names.');
+            });
+        }
+    }
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
new file mode 100644
index 0000000..d6de31a
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app')
+        .controller('AppController', AppController);
+
+    function AppController() {
+
+    }
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/3662396a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
----------------------------------------------------------------------
diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
new file mode 100644
index 0000000..44c7cf9
--- /dev/null
+++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app')
+        .controller('HomeController', HomeController);
+
+    function HomeController() {
+        var vm = this;
+        vm.name = "Sunshine";
+    }
+})();
\ No newline at end of file


Mime
View raw message